From cf47ac9247dc01755e770b7d24dee36972ee8402 Mon Sep 17 00:00:00 2001 From: Nick Palmer Date: Thu, 5 Apr 2007 22:16:33 +0000 Subject: Make pigeonholes not call LibertyAttachable since it is LibertyContent (for the moment). Fixup pretty url and extended url support and make sure to force a cononical url for pigeonholes for better SEO. Make sure stuff in Related Content is actually viewable by the user. --- .htaccess | 4 ++++ Pigeonholes.php | 23 +++++++++++++---------- assign_content.php | 10 +++++----- templates/menu_pigeonholes.tpl | 2 +- templates/section_inc.tpl | 4 ++-- templates/service_view_members_inc.tpl | 6 +++++- view.php | 9 +++++++-- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.htaccess b/.htaccess index dc9f6ef..d36a453 100644 --- a/.htaccess +++ b/.htaccess @@ -5,4 +5,8 @@ RewriteCond %{SCRIPT_FILENAME}/index.php -f RewriteRule ^(.*)$ - [L] RewriteRule ^([0-9]+)(\&.*)?$ view.php?content_id=$1$2 [L] + + RewriteRule ^view/structure/(.*)$ view.php?structure_id=$1 [L,QSA] + RewriteRule ^view/(.*)$ view.php?content_id=$1 [L,QSA] + RewriteRule ^(.*)$ index.php?content_id=$1 [L,QSA] diff --git a/Pigeonholes.php b/Pigeonholes.php index 07a68e6..4eb5bb4 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ - * @version $Revision: 1.84 $ + * @version $Revision: 1.85 $ * @package pigeonholes */ /** * required setup */ -require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' ); +require_once( LIBERTY_PKG_PATH.'LibertyContent.php' ); require_once( LIBERTY_PKG_PATH.'LibertyStructure.php' ); /** @@ -159,9 +159,11 @@ class Pigeonholes extends LibertyContent { include_once( $gBitSystem->mPackages[$type['handler_package']]['path'].$type['handler_file'] ); $type['content_object'] = new $type['handler_class'](); } - $aux['display_link'] = $type['content_object']->getDisplayLink( $aux['title'], $aux ); - $aux['title'] = $type['content_object']->getTitle( $aux ); - $ret[] = $aux; + if ($type['content_object']->isViewable($aux['content_id'])) { + $aux['display_link'] = $type['content_object']->getDisplayLink( $aux['title'], $aux ); + $aux['title'] = $type['content_object']->getTitle( $aux ); + $ret[] = $aux; + } } } return( !empty( $this->mErrors ) ? $this->mErrors : $ret ); @@ -363,10 +365,11 @@ class Pigeonholes extends LibertyContent { * @return the link to display the page. */ function getDisplayPath( $pPath ) { + global $gBitSystem; $ret = ''; if( !empty( $pPath ) && is_array( $pPath ) ) { foreach( $pPath as $node ) { - $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' » ' : '' ).''.htmlspecialchars( $node['title'] ).''; + $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' » ' : '' ).''.htmlspecialchars( $node['title'] ).''; } } return $ret; @@ -563,7 +566,7 @@ class Pigeonholes extends LibertyContent { * @access public **/ function store( &$pParamHash ) { - if( $this->verify( $pParamHash ) && LibertyAttachable::store( $pParamHash ) ) { + if( $this->verify( $pParamHash ) && LibertyContent::store( $pParamHash ) ) { $table = BIT_DB_PREFIX."pigeonholes"; $this->mDb->StartTrans(); @@ -575,7 +578,7 @@ class Pigeonholes extends LibertyContent { } $pParamHash['structure_location_id'] = $this->mStructureId; } else { - // update the pigeonhole_store and structure_store content_id with the one from LibertyAttachable::store() + // update the pigeonhole_store and structure_store content_id with the one from LibertyContent::store() $pParamHash['structure_store']['content_id'] = $pParamHash['content_id']; $pParamHash['pigeonhole_store']['content_id'] = $pParamHash['content_id']; @@ -824,7 +827,7 @@ class Pigeonholes extends LibertyContent { // remove all entries from content tables $this->mContentId = $id['content_id']; - if( LibertyAttachable::expunge() ) { + if( LibertyContent::expunge() ) { $ret = TRUE; $this->mDb->CompleteTrans(); } else { diff --git a/assign_content.php b/assign_content.php index 7450ae5..5eccbe0 100644 --- a/assign_content.php +++ b/assign_content.php @@ -1,6 +1,6 @@ assign_by_ref( 'feedback', $feedback ); -if( empty( $contentTypes ) ) { - $contentTypes = array( '' => tra( 'All Content' ) ); - foreach( $gLibertySystem->mContentTypes as $cType ) { +$contentTypes = array( '' => tra( 'All Content' ) ); +foreach( $gLibertySystem->mContentTypes as $cType ) { + if ($cType['content_type_guid'] != PIGEONHOLES_CONTENT_TYPE_GUID) { $contentTypes[$cType['content_type_guid']] = $cType['content_description']; } } diff --git a/templates/menu_pigeonholes.tpl b/templates/menu_pigeonholes.tpl index abacb65..e69873a 100644 --- a/templates/menu_pigeonholes.tpl +++ b/templates/menu_pigeonholes.tpl @@ -7,7 +7,7 @@ {if $gBitUser->hasPermission( 'p_pigeonholes_view' )}
  • {biticon ipackage="icons" iname="format-justify-fill" iexplain="List Categories" iforce="icon"} {tr}List Categories{/tr}
  • {if $gContent->mStructureId and $gContent->mType.content_type_guid == $smarty.const.PIGEONHOLES_CONTENT_TYPE_GUID} -
  • {biticon ipackage=liberty iname=spacer iexplain="" iforce="icon"} {tr}View Category{/tr}
  • +
  • {biticon ipackage=liberty iname=spacer iexplain="" iforce="icon"} {tr}View Category{/tr}
  • {if $gBitUser->hasPermission( 'p_pigeonholes_edit' )}
  • {biticon ipackage="icons" iname="accessories-text-editor" iexplain="Edit Category" iforce="icon"} {tr}Edit Category{/tr}
  • {biticon ipackage="icons" iname="insert-object" iexplain="Insert Category" iforce="icon"} {tr}Insert Category{/tr}
  • diff --git a/templates/section_inc.tpl b/templates/section_inc.tpl index ac8ca92..973b34a 100644 --- a/templates/section_inc.tpl +++ b/templates/section_inc.tpl @@ -1,7 +1,7 @@ {strip} {if $gBitSystem->getConfig('pigeonholes_list_style') == "dynamic" && !$no_details} -

    {$subtree[ix].title|escape}

    +

    {$subtree[ix].title|escape}

    {foreach from=$pigeonList item=pigeonItem} {if $pigeonItem.structure_id eq $subtree[ix].structure_id} @@ -63,7 +63,7 @@ {/if} {if $current}{/if} - {$subtree[ix].title|escape} + {$subtree[ix].title|escape} {if $current}{/if} {biticon ipackage=liberty iname=spacer iforce=icon} diff --git a/templates/service_view_members_inc.tpl b/templates/service_view_members_inc.tpl index 234c2ce..31ff57e 100644 --- a/templates/service_view_members_inc.tpl +++ b/templates/service_view_members_inc.tpl @@ -43,7 +43,11 @@ {/foreach} {if $more eq 1} - [ … ] + {if $gBitSystem->isFeatureActive('pretty_urls_extended')} + [ … ] + {else} + [ … ] + {/if} {/if}

    {* reset the ctg2 value *} diff --git a/view.php b/view.php index 812a844..5a6b34c 100644 --- a/view.php +++ b/view.php @@ -1,6 +1,6 @@ verifyPermission( 'p_pigeonholes_view' ); include_once( PIGEONHOLES_PKG_PATH.'lookup_pigeonholes_inc.php' ); +/* If we came in via structure_id redirect to content_id */ +if (isset($_REQUEST['structure_id'])) { + header("Location:".$gContent->getDisplayUrl()); +} + $gBitSmarty->assign_by_ref( 'memberFeedback', $memberFeedback = array() ); // set up structure related stuff -- cgit v1.3