summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pigeonholes.php13
-rw-r--r--edit_pigeonholes.php28
-rw-r--r--servicefunctions_inc.php23
-rw-r--r--templates/display_members.tpl9
-rw-r--r--templates/edit_pigeonholes.tpl20
5 files changed, 74 insertions, 19 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php
index 36136ad..628ed2a 100644
--- a/Pigeonholes.php
+++ b/Pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.38 2006/02/04 17:47:24 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.39 2006/02/07 13:33:33 squareing Exp $
*
* +----------------------------------------------------------------------+
* | Copyright ( c ) 2004, bitweaver.org
@@ -17,7 +17,7 @@
* Pigeonholes class
*
* @author xing <xing@synapse.plus.com>
- * @version $Revision: 1.38 $
+ * @version $Revision: 1.39 $
* @package pigeonholes
*/
@@ -469,9 +469,10 @@ class Pigeonholes extends LibertyAttachable {
}
// store individual pigeonhole preferences
- if( !empty( $pParamHash['pigeonhole_settings_store'] ) ) {
- foreach( $pParamHash['pigeonhole_settings_store'] as $name => $value ) {
- $this->storePreference( $name, $value );
+ if( !empty( $pParamHash['pigeonhole_prefs_store'] ) ) {
+ foreach( $pParamHash['pigeonhole_prefs_store'] as $name => $value ) {
+ // make sure null is used when value is empty. this makes sure the preference is removed from the table rather than filled with empty strings
+ $this->storePreference( $name, ( !empty( $value ) ? $value : NULL ) );
}
}
@@ -553,7 +554,7 @@ class Pigeonholes extends LibertyAttachable {
}
// pigeonhole settings store
- $pParamHash['pigeonhole_settings_store'] = !empty( $pParamHash['settings'] ) ? $pParamHash['settings'] : NULL;
+ $pParamHash['pigeonhole_prefs_store'] = !empty( $pParamHash['prefs'] ) ? $pParamHash['prefs'] : NULL;
// structure store
if( @BitBase::verifyId( $pParamHash['root_structure_id'] ) ) {
diff --git a/edit_pigeonholes.php b/edit_pigeonholes.php
index 3745bfa..2023e4e 100644
--- a/edit_pigeonholes.php
+++ b/edit_pigeonholes.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/edit_pigeonholes.php,v 1.12 2006/02/01 20:38:41 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/edit_pigeonholes.php,v 1.13 2006/02/07 13:33:33 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.12 2006/02/01 20:38:41 squareing Exp $
+ * $Id: edit_pigeonholes.php,v 1.13 2006/02/07 13:33:33 squareing Exp $
* @package pigeonholes
* @subpackage functions
*/
@@ -124,6 +124,25 @@ if( !empty( $_REQUEST['success'] ) ) {
$feedback['success'] = $_REQUEST['success'];
}
+// get all available perms only when the admin is visiting here.
+if( $gBitUser->isAdmin() ) {
+ $tmpPerms = $gBitUser->getGroupPermissions();
+} else {
+ $tmpPerms = $gBitUser->mPerms;
+}
+$perms[''] = tra( 'None' );
+foreach( $tmpPerms as $perm => $info ) {
+ $perms[$info['package']][$perm] = $perm;
+}
+$gBitSmarty->assign( 'perms', $perms );
+
+// get available groups ready that we can assign the pigoenhole to one of them
+$groups[''] = tra( 'None' );
+foreach( $gBitUser->mGroups as $group_id => $group ) {
+ $groups[$group_id] = $group['group_name'];
+}
+$gBitSmarty->assign( 'groups', $groups );
+
// get content
include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' );
foreach( $contentList['data'] as $cItem ) {
@@ -133,7 +152,7 @@ $gBitSmarty->assign( 'contentList', $cList );
$gBitSmarty->assign( 'contentSelect', $contentSelect );
$gBitSmarty->assign( 'contentTypes', $contentTypes );
-$listHash['root_structure_id'] = $gContent->mInfo['root_structure_id'];
+$listHash['root_structure_id'] = !empty( $gContent->mInfo['root_structure_id'] ) ? $gContent->mInfo['root_structure_id'] : NULL;
$listHash['force_extras'] = TRUE;
$pigeonList = $gContent->getList( $listHash );
$gBitSmarty->assign( 'pigeonList', $pigeonList );
@@ -141,9 +160,8 @@ $gBitSmarty->assign( 'feedback', !empty( $feedback ) ? $feedback : NULL );
// Get list of available styles
$styles = $gBitThemes->getStyles( NULL, TRUE );
-array_unshift( $styles, '' );
$gBitSmarty->assign( 'styles', $styles );
// Display the template
-$gBitSystem->display( 'bitpackage:pigeonholes/edit_pigeonholes.tpl', !empty( $gStructure ) ? tra( 'Edit Pigeonhole' ).': '.$gStructure->mInfo["title"] : tra( 'Create Pigeonhole' ) );
+$gBitSystem->display( 'bitpackage:pigeonholes/edit_pigeonholes.tpl', !empty( $gStructure->mInfo['title'] ) ? tra( 'Edit Pigeonhole' ).': '.$gStructure->mInfo["title"] : tra( 'Create Pigeonhole' ) );
?>
diff --git a/servicefunctions_inc.php b/servicefunctions_inc.php
index ebb0b4b..43c2fff 100644
--- a/servicefunctions_inc.php
+++ b/servicefunctions_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_pigeonholes/Attic/servicefunctions_inc.php,v 1.8 2006/01/30 16:41:46 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_pigeonholes/Attic/servicefunctions_inc.php,v 1.9 2006/02/07 13:33:33 squareing Exp $
*
* Copyright ( c ) 2004 bitweaver.org
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -24,10 +24,29 @@ function display_pigeonholes( &$pObject ) {
foreach( $pigeons as $pigeon ) {
$pigeonholes->mContentId = $pigeon['content_id'];
$pigeonholes->load( TRUE );
+ //$pigeonholes->loadPreferences();
$pigeonData[] = $pigeonholes->mInfo;
// set the theme chosen for this page - virtually random if page is part of multiple themes
$pigeonholes->loadPreferences();
- $gPreviewStyle = $pigeonholes->getPreference( 'style' );
+ $gPreviewStyle = $pigeonholes->getPreference( 'pigeonholes_style' );
+ // we need to check all pigeonholes in the path, load the prefs and work out if the user is allowed to view the page
+ foreach( $pigeonholes->getField( 'path' ) as $p ) {
+ $tmpPigeon = new Pigeonholes( NULL, $p['content_id'] );
+ $tmpPigeon->loadPreferences();
+ $group_id = $tmpPigeon->getPreference( 'pigeonholes_group_id' );
+ $permission = $tmpPigeon->getPreference( 'pigeonholes_permission' );
+ if( ( !empty( $group_id ) && !$gBitUser->isInGroup( $group_id ) ) ||
+ ( !empty( $permission ) && !$gBitUser->hasPermission( $permission ) )
+ ) {
+ $msg = tra( "This content is part of a category to which you have no access to. Please log in or request the appropriate permission for the site administrator." );
+ $gBitSystem->fatalPermission( NULL, $msg );
+ }
+ $style = $tmpPigeon->getPreference( 'pigeonholes_style' );
+ if( !empty( $style ) ) {
+ $gPreviewStyle = $style;
+ }
+ unset( $tmpPigeon );
+ }
}
$gBitSmarty->assign( 'pigeonData', !empty( $pigeonData ) ? $pigeonData : FALSE );
}
diff --git a/templates/display_members.tpl b/templates/display_members.tpl
index 9230b4f..102a537 100644
--- a/templates/display_members.tpl
+++ b/templates/display_members.tpl
@@ -26,20 +26,21 @@
{assign var=more value=0}
{foreach from=$pigeonItem.members item=member}
- {if $gContent->mContentId != $member.content_id}
{assign var=ctg1 value=$member.content_type_guid}
- {if $ctg1 ne $ctg2}{if $ctg2}<br />{/if}{$gLibertySystem->mContentTypes.$ctg1.content_description}: {/if}
+ {if $ctg1 ne $ctg2}{if $ctg2}<br />{/if}{$gLibertySystem->mContentTypes.$ctg1.content_description}:&nbsp;{/if}
{if !$gBitSystemPrefs.limit_member_number or $member_count lt $gBitSystemPrefs.limit_member_number}
- <a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$member.content_id}">{$member.title}</a>&nbsp; &bull; &nbsp;
+ {if $gContent->mContentId == $member.content_id}<strong>{/if}
+ {$member.display_link}
+ {if $gContent->mContentId == $member.content_id}</strong>{/if}
+ &nbsp; &bull; &nbsp;
{else}
{assign var=more value=1}
{/if}
{counter assign=member_count}
{assign var=ctg2 value=$member.content_type_guid}
- {/if}
{/foreach}
{if $more eq 1}
diff --git a/templates/edit_pigeonholes.tpl b/templates/edit_pigeonholes.tpl
index 833358a..17ae59b 100644
--- a/templates/edit_pigeonholes.tpl
+++ b/templates/edit_pigeonholes.tpl
@@ -45,8 +45,24 @@
<div class="row">
{formlabel label="Theme" for="pigeonhole-style"}
{forminput}
- {html_options id="pigeonhole-style" name="pigeonhole[settings][style]" output=$styles values=$styles selected=$gContent->mPrefs.style}
- {formhelp note="This theme will be applied when viewing any page belonging to this category."}
+ {html_options id="pigeonhole-style" name="pigeonhole[prefs][pigeonholes_style]" output=$styles values=$styles selected=$gContent->mPrefs.pigeonholes_style}
+ {formhelp note="This theme will be applied when viewing any page belonging to this category." warning="Setting is inherited from parent category."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Permission" for="perm"}
+ {forminput}
+ {html_options name="pigeonhole[prefs][pigeonholes_permission]" id="perm" options=$perms selected=`$gContent->mPrefs.pigeonholes_permission`}
+ {formhelp note="Permission required to view any page in this category." warning="Setting is inherited from parent category."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Group" for="group"}
+ {forminput}
+ {html_options name="pigeonhole[prefs][pigeonholes_group]" id="group" options=$groups selected=`$gContent->mPrefs.pigeonholes_group_id`}
+ {formhelp note="Users of only this group can view the content of this category." warning="Setting is inherited from parent category."}
{/forminput}
</div>