diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2008-06-26 09:59:01 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2008-06-26 09:59:01 +0000 |
| commit | 2c1a2101eaa70315c3ed196e42f4dbac33fda3a0 (patch) | |
| tree | 8b24e46b181cdf9d54b7eab376fc16f8636557eb | |
| parent | affbeb4e9355b33baea2ab8515b12be5ab29e316 (diff) | |
| download | themes-2c1a2101eaa70315c3ed196e42f4dbac33fda3a0.tar.gz themes-2c1a2101eaa70315c3ed196e42f4dbac33fda3a0.tar.bz2 themes-2c1a2101eaa70315c3ed196e42f4dbac33fda3a0.zip | |
add separate page for column control
| -rw-r--r-- | admin/admin_columns_inc.php | 77 | ||||
| -rw-r--r-- | templates/admin_columns.tpl | 71 |
2 files changed, 148 insertions, 0 deletions
diff --git a/admin/admin_columns_inc.php b/admin/admin_columns_inc.php new file mode 100644 index 0000000..a207c51 --- /dev/null +++ b/admin/admin_columns_inc.php @@ -0,0 +1,77 @@ +<?php +$activeColumns = array( + 'site_top_column' => array( + 'label' => 'Top Module Area', + 'note' => 'Check to enable the top module area site-wide.', + ), + 'site_right_column' => array( + 'label' => 'Right Module Area', + 'note' => 'Check to enable the right module area site-wide.', + ), + 'site_left_column' => array( + 'label' => 'Left Module Area', + 'note' => 'Check to enable the left module area site-wide.', + ), + 'site_bottom_column' => array( + 'label' => 'Bottom Module Area', + 'note' => 'Check to enable the bottom module area site-wide.', + ), +); +$gBitSmarty->assign( 'activeColumns', $activeColumns ); + +$displayModes = array( + "display" => "Display content", + "list" => "Display listings such as galleries", + "edit" => "Edit areas such as creating a wiki page", + "upload" => "Uploading files to a file or image gallery", + "admin" => "Package administration", +); +$gBitSmarty->assign( 'displayModes', $displayModes ); + +// hide columns in individual packages +foreach( $gBitSystem->mPackages as $key => $package ) { + if( !empty( $package['installed'] ) && ( !empty( $package['activatable'] ) || !empty( $package['tables'] ) ) ) { + if( $package['name'] == 'kernel' ) { + $package['name'] = tra( 'Site Default' ); + } + $hideColumns[strtolower( $key )] = ucfirst( $package['name'] ); + } +} +asort( $hideColumns ); +$gBitSmarty->assign( 'hideColumns', $hideColumns ); + +if( !empty( $_REQUEST['column_control'] )) { + foreach( array_keys( $activeColumns ) as $item ) { + simple_set_toggle( $item, THEMES_PKG_NAME ); + } + + // hideable areas + $hideable = array( 'top', 'left', 'right', 'bottom' ); + + // evaluate what columns to hide + foreach( $hideable as $area ) { + // packages + foreach( array_keys( $hideColumns ) as $package ) { + $pref = "{$package}_hide_{$area}_col"; + if( isset( $_REQUEST['package'][$pref] ) ) { + $gBitSystem->storeConfig( $pref, 'y', THEMES_PKG_NAME ); + } else { + // remove the setting from the db if it's not set + $gBitSystem->storeConfig( $pref, NULL ); + } + } + + // modes + foreach( array_keys( $displayModes ) as $mode ) { + $pref = "{$mode}_hide_{$area}_col"; + if( isset( $_REQUEST['mode'][$pref] ) ) { + $gBitSystem->storeConfig( $pref, 'y', THEMES_PKG_NAME ); + } else { + // remove the setting from the db if it's not set + $gBitSystem->storeConfig( $pref, NULL ); + } + } + } +} + +?> diff --git a/templates/admin_columns.tpl b/templates/admin_columns.tpl new file mode 100644 index 0000000..6439032 --- /dev/null +++ b/templates/admin_columns.tpl @@ -0,0 +1,71 @@ +{form} + <input type="hidden" name="page" value="{$page}" /> + + {legend legend="Available Columns"} + {foreach from=$activeColumns key=feature item=output} + <div class="row"> + {formlabel label=`$output.label` for=$feature} + {forminput} + {html_checkboxes name="$feature" values="y" checked=$gBitSystem->getConfig($feature) labels=false id=$feature} + {formhelp hash=$output} + {/forminput} + </div> + {/foreach} + {/legend} + + {legend legend="Hide Columns in Content Display Modes"} + <table id="hidecolumnsinmodes"> + <caption>{tr}Hide Columns in Content Display Modes{/tr}</caption> + <thead> + <tr> + <th style="width:60%">{tr}Display Mode{/tr}</th> + <th style="width:10%">{tr}Top{/tr}</th> + <th style="width:10%">{tr}Left{/tr}</th> + <th style="width:10%">{tr}Right{/tr}</th> + <th style="width:10%">{tr}Bottom{/tr}</th> + </tr> + </thead> + <tbody> + {foreach from=$displayModes item=name key=mode} + <tr class="{cycle values="odd,even"}"> + <td>{$name}</td> + <td style="text-align:center;"><input type="checkbox" name="mode[{$mode}_hide_top_col]" value="y" {if $gBitSystem->isFeatureActive("`$mode`_hide_top_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="mode[{$mode}_hide_left_col]" value="y" {if $gBitSystem->isFeatureActive("`$mode`_hide_left_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="mode[{$mode}_hide_right_col]" value="y" {if $gBitSystem->isFeatureActive("`$mode`_hide_right_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="mode[{$mode}_hide_bottom_col]" value="y" {if $gBitSystem->isFeatureActive("`$mode`_hide_bottom_col")}checked="checked"{/if} /></td> + </tr> + {/foreach} + </tbody> + </table> + {/legend} + + {legend legend="Hide Columns in Packages"} + <table id="hidecolumnsinpackages"> + <caption>{tr}Hide Columns in Packages{/tr}</caption> + <thead> + <tr> + <th style="width:60%">{tr}Package{/tr}</th> + <th style="width:10%">{tr}Top{/tr}</th> + <th style="width:10%">{tr}Left{/tr}</th> + <th style="width:10%">{tr}Right{/tr}</th> + <th style="width:10%">{tr}Bottom{/tr}</th> + </tr> + </thead> + <tbody> + {foreach from=$hideColumns item=name key=package} + <tr class="{cycle values="odd,even"}"> + <td>{$name}</td> + <td style="text-align:center;"><input type="checkbox" name="package[{$package}_hide_top_col]" value="y" {if $gBitSystem->isFeatureActive("`$package`_hide_top_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="package[{$package}_hide_left_col]" value="y" {if $gBitSystem->isFeatureActive("`$package`_hide_left_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="package[{$package}_hide_right_col]" value="y" {if $gBitSystem->isFeatureActive("`$package`_hide_right_col")}checked="checked"{/if} /></td> + <td style="text-align:center;"><input type="checkbox" name="package[{$package}_hide_bottom_col]" value="y" {if $gBitSystem->isFeatureActive("`$package`_hide_bottom_col")}checked="checked"{/if} /></td> + </tr> + {/foreach} + </tbody> + </table> + {/legend} + + <div class="row submit"> + <input type="submit" name="column_control" value="{tr}Change preferences{/tr}" /> + </div> +{/form} |
