diff options
| -rw-r--r-- | Pigeonholes.php | 19 | ||||
| -rw-r--r-- | admin/admin_pigeonholes_inc.php | 6 | ||||
| -rw-r--r-- | assign_content.php | 16 | ||||
| -rw-r--r-- | templates/assign_content.tpl | 72 |
4 files changed, 98 insertions, 15 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php index bf59175..797b4fe 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.80 2007/02/26 17:19:33 nickpalmer Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.81 2007/03/03 21:19:52 nickpalmer Exp $ * * +----------------------------------------------------------------------+ * | Copyright ( c ) 2004, bitweaver.org @@ -17,7 +17,7 @@ * Pigeonholes class * * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.80 $ + * @version $Revision: 1.81 $ * @package pigeonholes */ @@ -175,6 +175,7 @@ class Pigeonholes extends LibertyContent { $where = ''; $bindVars = array(); + LibertyContent::prepGetList( $pListHash ); if( empty( $pListHash['include_members'] ) ) { $where .= "WHERE pigm.`content_id` IS NULL"; @@ -192,6 +193,10 @@ class Pigeonholes extends LibertyContent { $bindVars[] = $pListHash['content_type']; } + $where .= empty( $where ) ? ' WHERE ' : ' AND '; + $where .= " lc.`content_type_guid` != ? "; + $bindVars[] = PIGEONHOLES_CONTENT_TYPE_GUID; + if( !empty( $pListHash['sort_mode'] ) ) { $order = " ORDER BY ".$this->mDb->convertSortmode( $pListHash['sort_mode'] )." "; } else { @@ -203,7 +208,14 @@ class Pigeonholes extends LibertyContent { LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pigm ON ( pigm.`content_id` = lc.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON ( uu.`user_id` = lc.`user_id` ) $where $order"; - $result = $this->mDb->query( $query, $bindVars, @BitBase::verifyId( $pListHash['max_records'] ) ? $pListHash['max_records'] : NULL ); + $result = $this->mDb->query( $query, $bindVars, @BitBase::verifyId( $pListHash['max_records'] ) ? $pListHash['max_records'] : NULL , $pListHash['offset']); + + $query = "SELECT count(lc.`content_id`) + FROM `".BIT_DB_PREFIX."liberty_content` lc + LEFT JOIN `".BIT_DB_PREFIX."pigeonhole_members` pigm ON ( pigm.`content_id` = lc.`content_id` ) + LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON ( uu.`user_id` = lc.`user_id` ) + $where"; + $pListHash['cant'] = $this->mDb->getOne( $query, $bindVars); $contentTypes = $gLibertySystem->mContentTypes; while( $row = $result->fetchRow() ) { @@ -233,6 +245,7 @@ class Pigeonholes extends LibertyContent { } } + LibertyContent::postGetList( $pListHash ); return( !empty( $ret ) ? $ret : NULL ); } diff --git a/admin/admin_pigeonholes_inc.php b/admin/admin_pigeonholes_inc.php index 0a44f12..46a1fbe 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.13 2007/02/24 08:51:09 squareing Exp $ +// $Header: /cvsroot/bitweaver/_bit_pigeonholes/admin/admin_pigeonholes_inc.php,v 1.14 2007/03/03 21:19:53 nickpalmer Exp $ $pigeonholeDisplaySettings = array( 'pigeonholes_display_path' => array( @@ -30,6 +30,10 @@ $pigeonholeDisplaySettings = array( 'label' => 'Group gating', 'note' => 'Limit category access to specific groups. Group settings are inhertied by child categories.', ), + 'reverse_assign_table' => array( + 'label' => 'Assign Categories in Columns', + 'note' => 'The assign categories page will have categories in columns instead of rows and content in rows instead of columns. This is better if you have only a few categories that can fit on a single page easily.', + ), ); $gBitSmarty->assign( 'pigeonholeDisplaySettings', $pigeonholeDisplaySettings ); diff --git a/assign_content.php b/assign_content.php index e7b676b..c8994fa 100644 --- a/assign_content.php +++ b/assign_content.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.7 2006/12/31 13:01:16 squareing Exp $ + * $Header: /cvsroot/bitweaver/_bit_pigeonholes/assign_content.php,v 1.8 2007/03/03 21:19:52 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.7 2006/12/31 13:01:16 squareing Exp $ + * $Id: assign_content.php,v 1.8 2007/03/03 21:19:52 nickpalmer Exp $ * @package pigeonholes * @subpackage functions */ @@ -41,10 +41,12 @@ $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']), ); + $assignableContent = $gContent->getAssignableContent( $listHash ); -if( !empty( $_REQUEST['insert_content'] ) && isset( $_REQUEST['pigeonhole'] ) ) { +if( (!empty( $_REQUEST['insert_content'] ) || !empty( $_REQUEST['insert_content_and_next'])) && isset( $_REQUEST['pigeonhole'] ) ) { // here we need to limit all killing to the selected structure $deletableParentIds = array(); if( empty( $gStructure ) && @BitBase::verifyId( $_REQUEST['root_structure_id'] ) ) { @@ -85,9 +87,14 @@ if( !empty( $_REQUEST['insert_content'] ) && isset( $_REQUEST['pigeonhole'] ) ) // 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']; + } $assignableContent = $gContent->getAssignableContent( $listHash ); } +$gBitSmarty->assign_by_ref( 'listInfo', $listHash['listInfo'] ); + $listHash = array( 'load_only_root' => TRUE, 'max_records' => -1, @@ -103,8 +110,11 @@ $listHash = array( 'root_structure_id' => ( !empty( $_REQUEST['root_structure_id'] ) ? $_REQUEST['root_structure_id'] : NULL ), 'force_extras' => TRUE, 'max_records' => -1, + 'sort_mode' => 'ls.structure_id_asc', ); + $pigeonList = $gContent->getList( $listHash ); + $gBitSmarty->assign( 'pigeonList', $pigeonList ); $gBitSmarty->assign( 'assignableContent', $assignableContent ); $gBitSmarty->assign( 'contentCount', count( $assignableContent ) ); diff --git a/templates/assign_content.tpl b/templates/assign_content.tpl index 318db11..d019cc9 100644 --- a/templates/assign_content.tpl +++ b/templates/assign_content.tpl @@ -16,11 +16,18 @@ {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')} <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> <option value="500" {if $smarty.request.max_records eq 500}selected="selected"{/if}>500</option> <option value="-1" {if $smarty.request.max_records eq -1}selected="selected"{/if}>{tr}All{/tr}</option> + {else} + <option value="15" {if $smarty.request.max_records eq 15}selected="selected"{/if}>15</option> + <option value="20" {if $smarty.request.max_records eq 20}selected="selected"{/if}>20</option> + <option value="25" {if $smarty.request.max_records eq 25}selected="selected"{/if}>25</option> + <option value="-1" {if $smarty.request.max_records eq -1}selected="selected"{/if}>{tr}All{/tr}</option> + {/if} </select> {tr}Records{/tr} {/forminput} @@ -68,6 +75,48 @@ {formfeedback warning="Using this insertion method will reset any custom sorting you have done so far."} {/if} + {if !$gBitSystem->isFeatureActive('reverse_assign_table')} + {foreach from=$assignableContent item=item} + <dl> + <dt>{counter name=dogEatsPigeon}</dt> + <dd>{$contentTypes[$item.content_type_guid]}: <a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$item.content_id}">{$item.title|escape}</a></dd> + </dl> + {foreachelse} + <div class=warning>No assignable content.</div> + {/foreach} + + {if $assignableContent} + <table class="data"> + <caption>{tr}Available Categories{/tr}</caption> + <tr> + <th>Categories</th> + {foreach from=$assignableContent item=item} + <th><abbr title="{$item.title|escape} - {$contentTypes[$item.content_type_guid]}">{counter}</abbr></th> + {/foreach} + </tr> + + {foreach from=$pigeonList item=pigeon} + <tr class="{cycle values='odd,even'}"> + <td>{$pigeon.display_path} + </td> + {foreach from=$assignableContent item=item} + <td style="text-align:center"> + <input type="checkbox" name="pigeonhole[{$item.content_id}][]" value="{$pigeon.content_id}" + {foreach from=$item.assigned item=parent_id} + {if $pigeon.content_id eq $parent_id}checked="checked"{/if} + {/foreach} + title="{$item.title|escape}" /> + </td> + {/foreach} + </tr> + {foreachelse} + <tr> + <td colspan="2" class="norecords">{tr}No Content can be found with your selection criteria{/tr}</td> + </tr> + {/foreach} + </table> + {/if} + {else} <table class="data"> <caption>{tr}Available Content{/tr}</caption> <tr> @@ -102,20 +151,27 @@ </table> {if $assignableContent} - <div class="row submit"> - <input type="submit" name="insert_content" value="Insert Content into Categories" /> - </div> - {/if} - {/form} - - {if $assignableContent} {foreach from=$pigeonList item=pigeon} <dl> <dt>{counter name=dogEatsPigeon}</dt> <dd>{$pigeon.display_path}<br /><small>{$pigeon.data|escape}</small></dd> </dl> {/foreach} - {/if} + {/if} + + {/if} + + {if $assignableContent} + <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="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} + {/form} + {/if} </div><!-- end .body --> </div><!-- end .liberty --> |
