summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pigeonholes.php41
-rw-r--r--assign_non_members.php13
-rw-r--r--edit_pigeonholes.php14
-rw-r--r--templates/edit_pigeonholes.tpl1
-rw-r--r--templates/list.tpl4
-rw-r--r--templates/section_inc.tpl20
-rw-r--r--view.php26
7 files changed, 73 insertions, 46 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index ec986e1..10d16d7 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.17 2006/01/17 17:23:40 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.18 2006/01/18 11:14:51 squareing Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,7 +17,7 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
* @package pigeonholes
*/
@@ -314,7 +314,7 @@ class Pigeonholes extends LibertyAttachable {
$ret = '';
if( !empty( $pPath ) && is_array( $pPath ) ) {
foreach( $pPath as $node ) {
- $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' &raquo; ' : '' ).'<a title="'.$node['title'].'" href="'.PIGEONHOLES_PKG_URL.'view.php?structure_id='.$node['structure_id'].'">'.$node['title'].'</a>';
+ $ret .= ( @BitBase::verifyId( $node['parent_id'] ) ? ' &raquo; ' : '' ).'<a title="'.$node['title'].'" href="'.PIGEONHOLES_PKG_URL.'view.php?structure_id='.$node['structure_id'].'">'.htmlspecialchars( $node['title'] ).'</a>';
}
}
return $ret;
@@ -334,14 +334,8 @@ class Pigeonholes extends LibertyAttachable {
global $gBitSystem;
LibertyContent::prepGetList( $pListHash );
- $bindVars = array();
- $where = '';
- $ret = array();
-
- if( !empty( $pListHash['find'] ) ) {
- $where .= " WHERE UPPER( tc.`title` ) LIKE ? ";
- $bindVars[] = '%'.strtoupper( $pListHash['find'] ).'%';
- }
+ $ret = $bindVars = array();
+ $where = $order = '';
if( @BitBase::verifyId( $pListHash['root_structure_id'] ) ) {
$where .= empty( $where ) ? ' WHERE ' : ' AND ';
@@ -354,11 +348,17 @@ class Pigeonholes extends LibertyAttachable {
$where .= " ts.`structure_id`=ts.`root_structure_id` ";
}
+ if( !empty( $pListHash['find'] ) ) {
+ $where .= empty( $where ) ? ' WHERE ' : ' AND ';
+ $where .= " UPPER( tc.`title` ) LIKE ? ";
+ $bindVars[] = '%'.strtoupper( $pListHash['find'] ).'%';
+ }
+
if( !empty( $pListHash['sort_mode'] ) ) {
- $where .= " ORDER BY ".$this->mDb->convert_sortmode( $pListHash['sort_mode'] )." ";
+ $order .= " ORDER BY ".$this->mDb->convert_sortmode( $pListHash['sort_mode'] )." ";
} else {
// default sort mode makes list look nice
- $where .= " ORDER BY ts.`root_structure_id`, ts.`structure_id` ASC";
+ $order .= " ORDER BY ts.`root_structure_id`, ts.`structure_id` ASC";
}
$query = "SELECT bp.*, ts.`root_structure_id`, ts.`parent_id`, tc.`title`, tc.`data`, tc.`content_type_guid`,
@@ -369,7 +369,7 @@ class Pigeonholes extends LibertyAttachable {
LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = tc.`modifier_user_id` )
LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON ( uuc.`user_id` = tc.`user_id` )
INNER JOIN `".BIT_DB_PREFIX."tiki_structures` ts ON ( ts.`structure_id` = bp.`structure_id` )
- $where";
+ $where $order";
$result = $this->mDb->query( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
@@ -384,7 +384,7 @@ class Pigeonholes extends LibertyAttachable {
( !empty( $pListHash['load_extras'] ) && $aux['structure_id'] == @$pListHash['structure_id'] && $gBitSystem->getPreference( 'pigeonholes_list_style' ) == 'table' )
) {
$aux['path'] = $this->getPigeonholePath( $aux['structure_id'] );
- $aux['display_path'] = $this->getDisplayPath( $aux['path'] );
+ $aux['display_path'] = Pigeonholes::getDisplayPath( $aux['path'] );
$aux['members'] = $this->getMemberList( array( 'content_id' => $aux['content_id'] ) );
$aux['members_count'] = count( $aux['members'] );
if( $gBitSystem->getPreference( 'pigeonholes_list_style' ) == 'table' ) {
@@ -396,13 +396,16 @@ class Pigeonholes extends LibertyAttachable {
$result->MoveNext();
}
- $query = "SELECT COUNT( bp.`content_id` )
+ $query = "SELECT COUNT( tc.`title` )
FROM `".BIT_DB_PREFIX."bit_pigeonholes` bp
+ INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON ( tc.`content_id` = bp.`content_id` )
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = tc.`modifier_user_id` )
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON ( uuc.`user_id` = tc.`user_id` )
INNER JOIN `".BIT_DB_PREFIX."tiki_structures` ts ON ( ts.`structure_id` = bp.`structure_id` )
- WHERE ts.`structure_id`=ts.`root_structure_id`";
- $pListHash['cant'] = $this->mDb->getOne( $query );
- LibertyContent::postGetList( $pListHash );
+ $where";
+ $pListHash['cant'] = $this->mDb->getOne( $query, $bindVars );
+ LibertyContent::postGetList( $pListHash );
return $ret;
}
diff --git a/assign_non_members.php b/assign_non_members.php
index 11b1f82..2da3a17 100644
--- a/assign_non_members.php
+++ b/assign_non_members.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/Attic/assign_non_members.php,v 1.5 2006/01/17 13:40:49 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/Attic/assign_non_members.php,v 1.6 2006/01/18 11:14:51 squareing 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_non_members.php,v 1.5 2006/01/17 13:40:49 squareing Exp $
+ * $Id: assign_non_members.php,v 1.6 2006/01/18 11:14:51 squareing Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -73,7 +73,11 @@ if( !empty( $_REQUEST['insert_content'] ) && isset( $_REQUEST['pigeonhole'] ) )
$nonMembers = $gPigeonholes->getNonPigeonholeMembers( $listHash, $contentSelect, ( !empty( $_REQUEST['include'] ) && $_REQUEST['include'] == 'members' ) ? $_REQUEST['include'] : FALSE );
}
-$pigeonRootData = $gPigeonholes->getList( array( 'only_get_root' => TRUE ) );
+$listHash = array(
+ 'only_get_root' => TRUE,
+ 'max_records' => -1,
+);
+$pigeonRootData = $gPigeonholes->getList( $listHash );
$pigeonRoots[0] = 'All';
foreach( $pigeonRootData as $root ) {
$pigeonRoots[$root['root_structure_id']] = $root['title'];
@@ -82,7 +86,8 @@ $gBitSmarty->assign( 'pigeonRoots', !empty( $pigeonRoots ) ? $pigeonRoots : NULL
$listHash = array(
'root_structure_id' => ( !empty( $_REQUEST['root_structure_id'] ) ? $_REQUEST['root_structure_id'] : NULL ),
- 'force_extras' => TRUE
+ 'force_extras' => TRUE,
+ 'max_records' => -1,
);
$pigeonList = $gPigeonholes->getList( $listHash );
$gBitSmarty->assign( 'pigeonList', $pigeonList );
diff --git a/edit_pigeonholes.php b/edit_pigeonholes.php
index b709c05..a4e70fb 100644
--- a/edit_pigeonholes.php
+++ b/edit_pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/edit_pigeonholes.php,v 1.6 2006/01/17 13:40:49 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/edit_pigeonholes.php,v 1.7 2006/01/18 11:14:51 squareing 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: edit_pigeonholes.php,v 1.6 2006/01/17 13:40:49 squareing Exp $
+ * $Id: edit_pigeonholes.php,v 1.7 2006/01/18 11:14:51 squareing Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -53,7 +53,7 @@ if( !empty( $_REQUEST['pigeonhole_store'] ) ) {
$pigeonStore->mContentId = !empty( $_REQUEST['content_id'] ) ? $_REQUEST['content_id'] : NULL;
$pigeonStore->load();
if( $pigeonStore->store( $_REQUEST['pigeonhole'] ) ) {
- header( "Location: ".$_SERVER['PHP_SELF'].'?structure_id='.$pigeonStore->mStructureId.( !empty( $_REQUEST['action'] ) ? '&action='.$_REQUEST['action'] : '' ) );
+ header( "Location: ".$_SERVER['PHP_SELF'].'?structure_id='.$pigeonStore->mStructureId.( !empty( $_REQUEST['action'] ) ? '&action='.$_REQUEST['action'] : '' )."&success=".urlencode( tra( "The category was successfully stored" ) ) );
} else {
vd( $gPigeonholes->mErrors );
$gBitSmarty->assign( 'msg', tra( "There was a problem trying to store the pigeonhole." ) );
@@ -108,13 +108,13 @@ if( !empty( $_REQUEST['search_objects'] ) ) {
$formHash['action'] = 'remove';
$msgHash = array(
'label' => 'Remove Pigeonhole',
- 'confirm_item' => $gPigeonholes->mInfo['title'].'<br />and any subitems',
+ 'confirm_item' => $gPigeonholes->mInfo['title'].'<br />'.tra( 'and any subcategories' ),
'warning' => 'This will remove the pigeonhole but will <strong>not</strong> modify or remove the content itself.',
);
$gBitSystem->confirmDialog( $formHash, $msgHash );
}
- if( $_REQUEST['action'] == 'demember' && !empty( $_REQUEST['content_id'] ) && !empty( $_REQUEST['parent_id'] ) ) {
+ if( $_REQUEST['action'] == 'dismember' && !empty( $_REQUEST['content_id'] ) && !empty( $_REQUEST['parent_id'] ) ) {
if( $gPigeonholes->expungePigeonholeMember( $_REQUEST['content_id'], $_REQUEST['parent_id'] ) ) {
$feedback['success'] = tra( 'The item was successfully removed' );
} else {
@@ -125,6 +125,10 @@ if( !empty( $_REQUEST['search_objects'] ) ) {
}
}
+if( !empty( $_REQUEST['success'] ) ) {
+ $feedback['success'] = $_REQUEST['success'];
+}
+
// get content
include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' );
foreach( $contentList['data'] as $cItem ) {
diff --git a/templates/edit_pigeonholes.tpl b/templates/edit_pigeonholes.tpl
index 854961d..5151da2 100644
--- a/templates/edit_pigeonholes.tpl
+++ b/templates/edit_pigeonholes.tpl
@@ -6,6 +6,7 @@
</div>
<div class="body">
+ {$feedback.success}
{formfeedback hash=$feedback}
{form legend="Create / Edit Category"}
{if $gPigeonholes->mStructureId}
diff --git a/templates/list.tpl b/templates/list.tpl
index f4e18ae..0d57607 100644
--- a/templates/list.tpl
+++ b/templates/list.tpl
@@ -18,8 +18,8 @@
<div class="navbar">
<ul>
<li>{biticon ipackage=liberty iname=sort iexplain=sort}</li>
- <li>{smartlink ititle="Title" isort=title page=$page idefault=1}</li>
- <li>{smartlink ititle="Description" isort=data page=$page}</li>
+ <li>{smartlink ititle="Title" find=$find isort=title idefault=1 icontrol=$listInfo}</li>
+ <li>{smartlink ititle="Description" find=$find isort=data icontrol=$listInfo}</li>
</ul>
</div>
<div class="clear"></div>
diff --git a/templates/section_inc.tpl b/templates/section_inc.tpl
index e9e6a40..19cf4a3 100644
--- a/templates/section_inc.tpl
+++ b/templates/section_inc.tpl
@@ -75,22 +75,22 @@
{foreach from=$pigeonItem.members item=pigeonMember}
{if $gBitSystem->isFeatureActive( 'custom_member_sorting' )}
<li>
- {if $edit && $gBitSystem->isFeatureActive( 'custom_member_sorting' )}
+ {if $gBitSystem->isFeatureActive( 'custom_member_sorting' )}
{if $pigeonMember.pos ne 1}
- {smartlink ititle="Move item up" ibiticon="liberty/nav_up" expand_all=$smarty.request.expand_all ifile="edit_pigeonholes.php" action=move orientation=north structure_id=$pigeonItem.structure_id parent_id=$pigeonItem.content_id member_id=$pigeonMember.content_id}
+ {smartlink ititle="Move item up" ibiticon="liberty/move_up" expand_all=$smarty.request.expand_all action=move orientation=north structure_id=$pigeonItem.structure_id parent_id=$pigeonItem.content_id member_id=$pigeonMember.content_id}
{else}
- {biticon ipackage="liberty" iname="spacer"}
+ {biticon ipackage="liberty" iname="spacer_small"}
{/if}
{if $pigeonMember.pos ne $pigeonItem.members_count}
- {smartlink ititle="Move item down" ibiticon="liberty/nav_down" expand_all=$smarty.request.expand_all ifile="edit_pigeonholes.php" action=move orientation=south structure_id=$pigeonItem.structure_id parent_id=$pigeonItem.content_id member_id=$pigeonMember.content_id}
+ &nbsp;{smartlink ititle="Move item down" ibiticon="liberty/move_down" expand_all=$smarty.request.expand_all action=move orientation=south structure_id=$pigeonItem.structure_id parent_id=$pigeonItem.content_id member_id=$pigeonMember.content_id}
{else}
- {biticon ipackage="liberty" iname="spacer"}
+ &nbsp;{biticon ipackage="liberty" iname="spacer_small"}
{/if}
{/if}
&nbsp; <a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$pigeonMember.content_id}">{$pigeonMember.title|escape}</a> &nbsp;
- {if $edit}
- {smartlink ititle="Remove Item" ibiticon="liberty/delete_small" expand_all=$smarty.request.expand_all ifile="edit_pigeonholes.php" action=demember structure_id=$pigeonItem.structure_id parent_id=$pigeonMember.content_id content_id=$pigeonItem.content_id}
+ {if $gBitUser->hasPermission( 'edit_pigeonholes' )}
+ {smartlink ititle="Remove Item" ibiticon="liberty/delete_small" expand_all=$smarty.request.expand_all action=dismember structure_id=$pigeonItem.structure_id parent_id=$pigeonMember.content_id content_id=$pigeonItem.content_id}
{/if}
</li>
{else}
@@ -110,8 +110,8 @@
<li>
<a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$pigeonMember.content_id}">{$pigeonMember.title|escape}</a>
- {if $edit}
- &nbsp; {smartlink ititle="Remove Item" ibiticon="liberty/delete_small" expand_all=$smarty.request.expand_all ifile="edit_pigeonholes.php" action=demember structure_id=$pigeonItem.structure_id parent_id=$pigeonMember.content_id content_id=$pigeonItem.content_id}
+ {if $gBitUser->hasPermission( 'edit_pigeonholes' )}
+ &nbsp; {smartlink ititle="Remove Item" ibiticon="liberty/delete_small" expand_all=$smarty.request.expand_all action=dismember structure_id=$pigeonItem.structure_id parent_id=$pigeonMember.content_id content_id=$pigeonItem.content_id}
{/if}
</li>
@@ -143,7 +143,7 @@
{if !$no_details}
{foreach from=$pigeonList item=pigeonItem}
{if $pigeonItem.structure_id eq $subtree[ix].structure_id}
- {$pigeonItem.data|escape} <small> [ {tr}{$pigeonItem.members_count|default:0} Item(s){/tr} ] </small>
+ <br />{$pigeonItem.data|escape} <small> [ {tr}{$pigeonItem.members_count|default:0} Item(s){/tr} ] </small>
{/if}
{/foreach}
{/if}
diff --git a/view.php b/view.php
index 5b9b6d3..6659db3 100644
--- a/view.php
+++ b/view.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.3 2006/01/17 13:40:49 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/view.php,v 1.4 2006/01/18 11:14:51 squareing 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.3 2006/01/17 13:40:49 squareing Exp $
+ * $Id: view.php,v 1.4 2006/01/18 11:14:51 squareing Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -28,7 +28,21 @@ global $gStructure;
$gStructure = new LibertyStructure( $gPigeonholes->mInfo['root_structure_id'] );
$gStructure->load();
-// order matters for these conditionals
+if( !empty( $_REQUEST['action'] ) ) {
+ if( $_REQUEST['action'] == 'dismember' && !empty( $_REQUEST['content_id'] ) && !empty( $_REQUEST['parent_id'] ) && $gBitUser->hasPermission( 'bit_p_edit_pigeonholes' ) ) {
+ if( $gPigeonholes->expungePigeonholeMember( $_REQUEST['content_id'], $_REQUEST['parent_id'] ) ) {
+ $feedback['success'] = tra( 'The item was successfully removed' );
+ } else {
+ $feedback['error'] = tra( 'The item could not be removed' );
+ }
+ }
+
+ if( $_REQUEST['action'] == 'move' ) {
+ $gPigeonholes->moveMember( $_REQUEST['parent_id'], $_REQUEST['member_id'], $_REQUEST['orientation'] );
+ }
+}
+
+// confirm that structure is valid
if( empty( $gStructure ) || !$gStructure->isValid() ) {
$gBitSystem->fatalError( 'Invalid structure' );
}
@@ -37,13 +51,13 @@ $gBitSmarty->assign_by_ref( 'gStructure', $gStructure );
$gBitSmarty->assign( 'structureInfo', $gStructure->mInfo );
$gBitSmarty->assign( 'subtree', $gStructure->getSubTree( $gStructure->mStructureId ) );
-$pigeonList = array(
+$listHash = array(
'root_structure_id' => $gPigeonholes->mInfo['root_structure_id'],
'structure_id' => $gPigeonholes->mInfo['structure_id'],
'load_extras' => TRUE
);
-$gPigeonholes->getList( $pigeonList );
-$gBitSmarty->assign( 'pigeonList', $pigeonList['data'] );
+$pigeonList = $gPigeonholes->getList( $listHash );
+$gBitSmarty->assign( 'pigeonList', $pigeonList );
$gBitSmarty->assign( 'list_style', $gBitSystem->getPreference( 'pigeonholes_list_style', 'dynamic' ) );
// Display the template