From cbe559474ad73396743d84afdd036ea9755c16a5 Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Wed, 8 Feb 2006 13:17:41 +0000 Subject: Make Theme/Permissions/Group optional in pigeonholes --- admin/admin_pigeonholes_inc.php | 14 +++++++++++- admin/schema_inc.php | 3 +++ edit_pigeonholes.php | 42 +++++++++++++++++++++--------------- templates/edit_pigeonholes.tpl | 48 +++++++++++++++++++++++------------------ 4 files changed, 68 insertions(+), 39 deletions(-) diff --git a/admin/admin_pigeonholes_inc.php b/admin/admin_pigeonholes_inc.php index 26c1054..c900844 100644 --- a/admin/admin_pigeonholes_inc.php +++ b/admin/admin_pigeonholes_inc.php @@ -1,5 +1,5 @@ array( @@ -14,6 +14,18 @@ $pigeonholeSettings = array( 'label' => 'Display Description', 'note' => 'When showing the category members, you can display the category description as well.', ), + 'pigeonholes_themes' => array( + 'label' => 'Enable variable theme selection', + 'note' => 'Allow the selection of a different theme to use for a category.', + ), + 'pigeonholes_permissions' => array( + 'label' => 'Enable variable permission selection', + 'note' => 'Allow the selection of different permissions to use for each category.', + ), + 'pigeonholes_groups' => array( + 'label' => 'Enable group management selection', + 'note' => 'Allow the selection of a different group to use for a category.', + ), ); $gBitSmarty->assign( 'pigeonholeSettings', $pigeonholeSettings ); diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 4bc4d76..b9214ec 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -49,6 +49,9 @@ $gBitInstaller->registerPreferences( PIGEONHOLES_PKG_NAME, array( array( PIGEONHOLES_PKG_NAME, 'display_pigeonhole_members','y' ), array( PIGEONHOLES_PKG_NAME, 'limit_member_number','100' ), array( PIGEONHOLES_PKG_NAME, 'pigeonholes_list_style','table' ), + array( PIGEONHOLES_PKG_NAME, 'pigeonholes_themes','y' ), + array( PIGEONHOLES_PKG_NAME, 'pigeonholes_permissions','y' ), + array( PIGEONHOLES_PKG_NAME, 'pigeonholes_groups','y' ), ) ); // ### Default UserPermissions diff --git a/edit_pigeonholes.php b/edit_pigeonholes.php index ed1a47c..0e5a347 100644 --- a/edit_pigeonholes.php +++ b/edit_pigeonholes.php @@ -1,6 +1,6 @@ isAdmin() ) { - $tmpPerms = $gBitUser->getGroupPermissions(); -} else { - $tmpPerms = $gBitUser->mPerms; -} -$perms[''] = tra( 'None' ); -foreach( $tmpPerms as $perm => $info ) { - $perms[$info['package']][$perm] = $perm; +if ( $gBitSystem->isFeatureActive( 'pigeonholes_permissions' ) ) { + 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 ); } -$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']; +if ( $gBitSystem->isFeatureActive( 'pigeonholes_groups' ) ) { + $groups[''] = tra( 'None' ); + foreach( $gBitUser->mGroups as $group_id => $group ) { + $groups[$group_id] = $group['group_name']; + } + $gBitSmarty->assign( 'groups', $groups ); } -$gBitSmarty->assign( 'groups', $groups ); // get content include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' ); @@ -159,8 +164,11 @@ $gBitSmarty->assign( 'pigeonList', $pigeonList ); $gBitSmarty->assign( 'feedback', !empty( $feedback ) ? $feedback : NULL ); // Get list of available styles -$styles = $gBitThemes->getStyles( NULL, TRUE ); -$gBitSmarty->assign( 'styles', $styles ); +if ( $gBitSystem->isFeatureActive( 'pigeonholes_themes' ) ) { + $styles = $gBitThemes->getStyles( NULL, TRUE ); + $gBitSmarty->assign( 'styles', $styles ); +} + // Display the template if ( !empty( $gStructure ) ) { $gBitSystem->display( 'bitpackage:pigeonholes/edit_pigeonholes.tpl', !empty( $gStructure->mInfo['title'] ) ? tra( 'Edit Pigeonhole' ).': '.$gStructure->mInfo["title"] : tra( 'Create Pigeonhole' ) ); diff --git a/templates/edit_pigeonholes.tpl b/templates/edit_pigeonholes.tpl index 89d8046..f788d61 100644 --- a/templates/edit_pigeonholes.tpl +++ b/templates/edit_pigeonholes.tpl @@ -42,29 +42,35 @@ {/forminput} -
- {formlabel label="Theme" for="pigeonhole-style"} - {forminput} - {html_options id="pigeonhole-style" name="pigeonhole[prefs][style]" output=$styles values=$styles selected=$gContent->mPrefs.style} - {formhelp note="This theme will be applied when viewing any page belonging to this category." warning="Setting is inherited from parent category."} - {/forminput} -
+ {if $gBitSystem->isFeatureActive( 'pigeonholes_themes' )} +
+ {formlabel label="Theme" for="pigeonhole-style"} + {forminput} + {html_options id="pigeonhole-style" name="pigeonhole[prefs][style]" output=$styles values=$styles selected=$gContent->mPrefs.style} + {formhelp note="This theme will be applied when viewing any page belonging to this category." warning="Setting is inherited from parent category."} + {/forminput} +
+ {/if} -
- {formlabel label="Permission" for="perm"} - {forminput} - {html_options name="pigeonhole[prefs][permission]" id="perm" options=$perms selected=`$gContent->mPrefs.permission`} - {formhelp note="Permission required to view any page in this category." warning="Setting is inherited from parent category."} - {/forminput} -
+ {if $gBitSystem->isFeatureActive( 'pigeonholes_permissions' )} +
+ {formlabel label="Permission" for="perm"} + {forminput} + {html_options name="pigeonhole[prefs][permission]" id="perm" options=$perms selected=`$gContent->mPrefs.permission`} + {formhelp note="Permission required to view any page in this category." warning="Setting is inherited from parent category."} + {/forminput} +
+ {/if} -
- {formlabel label="Group" for="group"} - {forminput} - {html_options name="pigeonhole[prefs][group_id]" id="group" options=$groups selected=`$gContent->mPrefs.group_id`} - {formhelp note="Users of only this group can view the content of this category." warning="Setting is inherited from parent category."} - {/forminput} -
+ {if $gBitSystem->isFeatureActive( 'pigeonholes_groups' )} +
+ {formlabel label="Group" for="group"} + {forminput} + {html_options name="pigeonhole[prefs][group]" id="group" options=$groups selected=`$gContent->mPrefs.group_id`} + {formhelp note="Users of only this group can view the content of this category." warning="Setting is inherited from parent category."} + {/forminput} +
+ {/if}
{formlabel label="Content" for="pigeonhole-content"} -- cgit v1.3