diff options
| -rw-r--r-- | Pigeonholes.php | 31 | ||||
| -rw-r--r-- | admin/admin_pigeonholes_inc.php | 8 | ||||
| -rw-r--r-- | assign_content.php | 25 | ||||
| -rw-r--r-- | templates/assign_content.tpl | 16 | ||||
| -rw-r--r-- | templates/edit_pigeonholes.tpl | 10 |
5 files changed, 73 insertions, 17 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php index 797b4fe..450afe2 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.81 2007/03/03 21:19:52 nickpalmer Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.82 2007/03/05 02:19:54 nickpalmer Exp $ * * +----------------------------------------------------------------------+ * | Copyright ( c ) 2004, bitweaver.org @@ -17,7 +17,7 @@ * Pigeonholes class * * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.81 $ + * @version $Revision: 1.82 $ * @package pigeonholes */ @@ -260,9 +260,21 @@ class Pigeonholes extends LibertyContent { * @TODO We need to sort the returned values that successive pigoenholes are grouped together. */ function getPigeonholesPathList( $pContentId=NULL, $pTruncate = FALSE ) { + global $gBitSystem; + $where = $join = ''; + + if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion')) { + $where .= empty( $where ) ? ' WHERE ' : ' AND '; + $where .= ' lcp.`pref_value` IS NULL OR lcp.`pref_value` != \'on\' '; + $join .= ' LEFT JOIN `'.BIT_DB_PREFIX.'liberty_content_prefs` lcp ON (pig.`content_id` = lcp.`content_id` AND lcp.`pref_name` = \'no_insert\') '; + } + + $query = "SELECT pig.`content_id`, pig.`structure_id` FROM `".BIT_DB_PREFIX."pigeonholes` pig INNER JOIN `".BIT_DB_PREFIX."liberty_structures` ls ON ( ls.`structure_id` = pig.`structure_id` ) + $join + $where ORDER BY ls.`root_structure_id`, ls.`structure_id` ASC"; $result = $this->mDb->query( $query ); $pigeonholes = $result->getRows(); @@ -379,7 +391,7 @@ class Pigeonholes extends LibertyContent { LibertyContent::prepGetList( $pListHash ); $ret = $bindVars = array(); - $where = $order = $join = ''; + $where = $order = $join = $select = ''; if( @BitBase::verifyId( $pListHash['root_structure_id'] ) ) { $where .= empty( $where ) ? ' WHERE ' : ' AND '; @@ -404,6 +416,13 @@ class Pigeonholes extends LibertyContent { $bindVars[] = $pListHash['title']; } + if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion') && !empty( $pListHash['insertable'] ) ) { + $where .= empty( $where ) ? ' WHERE ' : ' AND '; + $where .= ' lcp.`pref_value` IS NULL OR lcp.`pref_value` != \'on\' '; + $join .= ' LEFT JOIN `'.BIT_DB_PREFIX.'liberty_content_prefs` lcp ON (lc.`content_id` = lcp.`content_id` AND lcp.`pref_name` = \'no_insert\') '; + $select .= ' , lcp.`pref_value` as no_insert '; + } + if( isset( $pListHash['parent_id'] ) ) { $where .= empty( $where ) ? ' WHERE ' : ' AND '; $where .= ' ls.`parent_id` = ? '; @@ -430,7 +449,7 @@ class Pigeonholes extends LibertyContent { $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`, lc.`user_id`, lc.`content_type_guid`, uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, - uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name + uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name $select FROM `".BIT_DB_PREFIX."pigeonholes` pig INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON ( lc.`content_id` = pig.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = lc.`modifier_user_id` ) @@ -650,6 +669,10 @@ class Pigeonholes extends LibertyContent { } // individual pigeonhole preference store + global $gBitSystem; + if( $gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion') && empty( $pParamHash['prefs']['no_insert'] ) ) { + $pParamHash['prefs']['no_insert'] = '0'; + } $pParamHash['preferences_store'] = !empty( $pParamHash['prefs'] ) ? $pParamHash['prefs'] : NULL; // structure store diff --git a/admin/admin_pigeonholes_inc.php b/admin/admin_pigeonholes_inc.php index 4003f04..a6fdfbd 100644 --- a/admin/admin_pigeonholes_inc.php +++ b/admin/admin_pigeonholes_inc.php @@ -1,5 +1,5 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.15 2007/03/04 14:03:40 nickpalmer Exp $ +// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.16 2007/03/05 02:19:54 nickpalmer Exp $ $pigeonholeDisplaySettings = array( 'pigeonholes_display_path' => array( @@ -30,10 +30,14 @@ $pigeonholeDisplaySettings = array( 'label' => 'Group gating', 'note' => 'Limit category access to specific groups. Group settings are inhertied by child categories.', ), - 'reverse_assign_table' => array( + 'pigeonholes_reverse_assign_table' => array( 'label' => 'Assign Categories in Rows', 'note' => 'The assign categories page will have categories in rows instead of columns and content in columns instead of rows. This is better if you have lots of categories that do not fit on a single page easily.', ), + 'pigeonholes_allow_forbid_insertion' => array( + 'label' => 'Allow Forbid Insertion', + 'note' => 'Allows pigeonholes to be set to forbid insertion of new members. This is good for heirarchical categories where only leaf categories should have members.' + ), ); $gBitSmarty->assign( 'pigeonholeDisplaySettings', $pigeonholeDisplaySettings ); diff --git a/assign_content.php b/assign_content.php index c8994fa..19c58f9 100644 --- a/assign_content.php +++ b/assign_content.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.8 2007/03/03 21:19:52 nickpalmer Exp $ + * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.9 2007/03/05 02:19:54 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.8 2007/03/03 21:19:52 nickpalmer Exp $ + * $Id: assign_content.php,v 1.9 2007/03/05 02:19:54 nickpalmer Exp $ * @package pigeonholes * @subpackage functions */ @@ -41,12 +41,19 @@ $listHash = array( 'max_records' => ( @BitBase::verifyId( $_REQUEST['max_records'] ) ) ? $_REQUEST['max_records'] : 10, 'include_members' => ( ( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) ? TRUE : FALSE ), 'content_type' => $contentSelect, - 'list_page' => (empty($_REQUEST['list_page']) ? NULL : $_REQUEST['list_page']), ); +// We need to handle insert and next where we are NOT actually doing an insert +if (!empty( $_REQUEST['insert_content']) || !empty( $_REQUEST['insert_content_and_next'])) { + $listHash['list_page'] = (empty($_REQUEST['list_page']) ? 2 : $_REQUEST['list_page'] + 1); +} +else { + $listHash['list_page'] = (empty($_REQUEST['list_page']) ? NULL : $_REQUEST['list_page']); +} + $assignableContent = $gContent->getAssignableContent( $listHash ); -if( (!empty( $_REQUEST['insert_content'] ) || !empty( $_REQUEST['insert_content_and_next'])) && isset( $_REQUEST['pigeonhole'] ) ) { +if( (!empty( $_REQUEST['insert_content'] ) || !empty( $_REQUEST['insert_content_and_next']))) { // here we need to limit all killing to the selected structure $deletableParentIds = array(); if( empty( $gStructure ) && @BitBase::verifyId( $_REQUEST['root_structure_id'] ) ) { @@ -75,7 +82,7 @@ if( (!empty( $_REQUEST['insert_content'] ) || !empty( $_REQUEST['insert_content_ } } - if( empty( $feedback['error'] ) ) { + if( empty( $feedback['error'] ) && !empty($memberHash)) { foreach( $memberHash as $memberStore ) { if( $gContent->insertPigeonholeMember( $memberStore ) ) { $feedback['success'] = 'The content was successfully inserted into the respective categories.'; @@ -88,7 +95,9 @@ if( (!empty( $_REQUEST['insert_content'] ) || !empty( $_REQUEST['insert_content_ // we need to reload the assignableContent, since settings have changed // reuse previous listhash since display settings aren't changed if (!empty( $_REQUEST['insert_content_and_next'])) { - $listHash['list_page'] = $_REQUEST['list_page']; + $listHash['offset'] = $listHash['listInfo']['offset'] + $listHash['listInfo']['max_records']; + unset($listHash['list_page']); + unset($listHash['listInfo']); } $assignableContent = $gContent->getAssignableContent( $listHash ); } @@ -113,6 +122,10 @@ $listHash = array( 'sort_mode' => 'ls.structure_id_asc', ); +if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion')) { + $listHash['insertable'] = TRUE; +} + $pigeonList = $gContent->getList( $listHash ); $gBitSmarty->assign( 'pigeonList', $pigeonList ); diff --git a/templates/assign_content.tpl b/templates/assign_content.tpl index 0b6d429..d551a48 100644 --- a/templates/assign_content.tpl +++ b/templates/assign_content.tpl @@ -16,7 +16,7 @@ {forminput} <select name="max_records"> <option value="10" {if $smarty.request.max_records eq 10 or !$smarty.request.max_rows}selected="selected"{/if}>10</option> - {if !$gBitSystem->isFeatureActive('reverse_assign_table')} + {if !$gBitSystem->isFeatureActive('pigeonholes_reverse_assign_table')} <option value="50" {if $smarty.request.max_records eq 50}selected="selected"{/if}>50</option> <option value="100" {if $smarty.request.max_records eq 100}selected="selected"{/if}>100</option> <option value="200" {if $smarty.request.max_records eq 200}selected="selected"{/if}>200</option> @@ -75,7 +75,7 @@ {formfeedback warning="Using this insertion method will reset any custom sorting you have done so far."} {/if} - {if $gBitSystem->isFeatureActive('reverse_assign_table')} + {if $gBitSystem->isFeatureActive('pigeonholes_reverse_assign_table')} {foreach from=$assignableContent item=item} <dl> <dt>{counter name=dogEatsPigeon}</dt> @@ -162,14 +162,20 @@ {/if} {if $assignableContent} + <div class="row"> + {if $smarty.request.include == 'members'} + <input type="checkbox" name="insert_content_and_next" />Go To Next Page After Insert + {/if} + </div> <div class="row submit"> <input type="submit" name="insert_content" value="Insert Content into Categories" /> - <input type="hidden" name="list_page" value="{math equation="x + 1" x=$listInfo.current_page}" /> + <input type="hidden" name="list_page" value="{$listInfo.current_page}" /> <input type="hidden" name="find" value="{$listInfo.find}" /> - <input type="submit" name="insert_content_and_next" value="Insert Content into Categories and Go To Next Page" /> </div> {/if} - {pagination} + {if $smarty.request.include == 'members'} + {pagination max_records=$smarty.request.max_records include=$smarty.request.include content_type=$contentSelect root_structure_id=$smarty.request.root_structure_id} + {/if} {/form} {/if} diff --git a/templates/edit_pigeonholes.tpl b/templates/edit_pigeonholes.tpl index 5278cdc..0b3bf12 100644 --- a/templates/edit_pigeonholes.tpl +++ b/templates/edit_pigeonholes.tpl @@ -42,6 +42,16 @@ {/forminput} </div> + {if $gBitSystem->isFeatureActive( 'pigeonholes_allow_forbid_insertion') } + <div class="row"> + {formlabel label="Forbid Insertion" for="pigeonhole-no-insert"} + {forminput} + <input type="checkbox" name="pigeonhole[prefs][no_insert]" id="pigeonhole-no-insert" {if $gContent->mPrefs.no_insert}checked{/if} /> + {formhelp note="Forbids inserting new content into this category. Useful for categories which are meant to hold other categories in a heirarchy where only leaf categories should hold content."} + {/forminput} + </div> + {/if} + {if $gBitSystem->isFeatureActive( 'pigeonholes_themes' )} <div class="row"> {formlabel label="Theme" for="pigeonhole-style"} |
