diff options
| -rw-r--r-- | .htaccess | 4 | ||||
| -rw-r--r-- | Pigeonholes.php | 23 | ||||
| -rw-r--r-- | assign_content.php | 10 | ||||
| -rw-r--r-- | templates/menu_pigeonholes.tpl | 2 | ||||
| -rw-r--r-- | templates/section_inc.tpl | 4 | ||||
| -rw-r--r-- | templates/service_view_members_inc.tpl | 6 | ||||
| -rw-r--r-- | view.php | 9 |
7 files changed, 37 insertions, 21 deletions
@@ -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] </IfModule> diff --git a/Pigeonholes.php b/Pigeonholes.php index 07a68e6..4eb5bb4 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.84 2007/03/14 14:32:03 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.85 2007/04/05 22:16:33 nickpalmer Exp $ * * +----------------------------------------------------------------------+ * | Copyright ( c ) 2004, bitweaver.org @@ -17,14 +17,14 @@ * Pigeonholes class * * @author xing <xing@synapse.plus.com> - * @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'] ) ? ' » ' : '' ).'<a title="'.htmlspecialchars( $node['title'] ).'" href="'.PIGEONHOLES_PKG_URL.'view.php?structure_id='.$node['structure_id'].'">'.htmlspecialchars( $node['title'] ).'</a>'; + $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' » ' : '' ).'<a title="'.htmlspecialchars( $node['title'] ).'" href="'.PIGEONHOLES_PKG_URL.($gBitSystem->isFeatureActive('pretty_urls_extended') ? 'view/structure/' : 'view.php?structure_id=').$node['structure_id'].'">'.htmlspecialchars( $node['title'] ).'</a>'; } } 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 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.10 2007/03/09 03:57:16 nickpalmer Exp $ + * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.11 2007/04/05 22:16:33 nickpalmer Exp $ * * Copyright ( c ) 2004 bitweaver.org * Copyright ( c ) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: assign_content.php,v 1.10 2007/03/09 03:57:16 nickpalmer Exp $ + * $Id: assign_content.php,v 1.11 2007/04/05 22:16:33 nickpalmer Exp $ * @package pigeonholes * @subpackage functions */ @@ -26,9 +26,9 @@ include_once( PIGEONHOLES_PKG_PATH.'lookup_pigeonholes_inc.php' ); $feedback = ''; $gBitSmarty->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' )} <li><a class="item" href="{$smarty.const.PIGEONHOLES_PKG_URL}list.php">{biticon ipackage="icons" iname="format-justify-fill" iexplain="List Categories" iforce="icon"} {tr}List Categories{/tr}</a></li> {if $gContent->mStructureId and $gContent->mType.content_type_guid == $smarty.const.PIGEONHOLES_CONTENT_TYPE_GUID} - <li><a class="item" href="{$smarty.const.PIGEONHOLES_PKG_URL}view.php?structure_id={$gContent->mStructureId}">{biticon ipackage=liberty iname=spacer iexplain="" iforce="icon"} {tr}View Category{/tr}</a></li> + <li><a class="item" href="{$smarty.const.PIGEONHOLES_PKG_URL}{if $gBitSystem->isFeatureActive('pretty_urls_extended')}view/strcture/{else}view.php?structure_id={/if}{$gContent->mStructureId}">{biticon ipackage=liberty iname=spacer iexplain="" iforce="icon"} {tr}View Category{/tr}</a></li> {if $gBitUser->hasPermission( 'p_pigeonholes_edit' )} <li><a class="head" href="{$smarty.const.PIGEONHOLES_PKG_URL}edit_pigeonholes.php?structure_id={$gContent->mInfo.structure_id}&action=edit">{biticon ipackage="icons" iname="accessories-text-editor" iexplain="Edit Category" iforce="icon"} {tr}Edit Category{/tr}</a></li> <li><a class="item" href="{$smarty.const.PIGEONHOLES_PKG_URL}edit_pigeonholes.php?structure_id={$gContent->mInfo.root_structure_id}&action=create">{biticon ipackage="icons" iname="insert-object" iexplain="Insert Category" iforce="icon"} {tr}Insert Category{/tr}</a></li> 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} - <h3 class="highlight"><a href="{$smarty.const.PIGEONHOLES_PKG_URL}view.php?structure_id={$subtree[ix].structure_id}">{$subtree[ix].title|escape}</a></h3> + <h3 class="highlight"><a href="{$smarty.const.PIGEONHOLES_PKG_URL}{if $gBitSystem->isFeatureActive('pretty_urls_extended')}view/structure{else}view.php?structure_id={/if}{$subtree[ix].structure_id}">{$subtree[ix].title|escape}</a></h3> {foreach from=$pigeonList item=pigeonItem} {if $pigeonItem.structure_id eq $subtree[ix].structure_id} @@ -63,7 +63,7 @@ {/if} {if $current}<strong>{/if} - <a href="{$smarty.const.PIGEONHOLES_PKG_URL}view.php?structure_id={$subtree[ix].structure_id}#members">{$subtree[ix].title|escape}</a> + <a href="{$smarty.const.PIGEONHOLES_PKG_URL}{if $gBitSystem->isFeatureActive('pretty_urls_extended')}view/structure/{else}view.php?structure_id={/if}{$subtree[ix].structure_id}#members">{$subtree[ix].title|escape}</a> {if $current}</strong>{/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} - <a href="{$smarty.const.PIGEONHOLES_PKG_URL}view.php?structure_id={$pigeonItem.structure_id}">[ … ]</a> + {if $gBitSystem->isFeatureActive('pretty_urls_extended')} + <a href="{$smarty.const.PIGEONHOLES_PKG_URL}view/structure/{$pigeonItem.structure_id}">[ … ]</a> + {else} + <a href="{$smarty.const.PIGEONHOLES_PKG_URL}view.php?structure_id={$pigeonItem.structure_id}">[ … ]</a> + {/if} {/if} </p> {* reset the ctg2 value *} @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.15 2006/06/20 10:24:11 bitweaver Exp $ + * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.16 2007/04/05 22:16:33 nickpalmer Exp $ * * Copyright ( c ) 2004 bitweaver.org * Copyright ( c ) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: view.php,v 1.15 2006/06/20 10:24:11 bitweaver Exp $ + * $Id: view.php,v 1.16 2007/04/05 22:16:33 nickpalmer Exp $ * @package pigeonholes * @subpackage functions */ @@ -23,6 +23,11 @@ $gBitSystem->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 |
