diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2008-06-26 09:56:44 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2008-06-26 09:56:44 +0000 |
| commit | affbeb4e9355b33baea2ab8515b12be5ab29e316 (patch) | |
| tree | 60bf5fd1eeb818596a0f2df049405d57c211faf8 | |
| parent | cf1677f193414c91085549b234d3e195b493cbe7 (diff) | |
| download | themes-affbeb4e9355b33baea2ab8515b12be5ab29e316.tar.gz themes-affbeb4e9355b33baea2ab8515b12be5ab29e316.tar.bz2 themes-affbeb4e9355b33baea2ab8515b12be5ab29e316.zip | |
make use of display_mode option recently added by spiderr and add some rudimentary column control based on display_mode. also moved FormatHeader stuff to BitThemes.
| -rw-r--r-- | BitThemes.php | 86 | ||||
| -rw-r--r-- | admin/admin_layout_inc.php | 56 | ||||
| -rw-r--r-- | templates/admin_layout.tpl | 49 | ||||
| -rw-r--r-- | templates/menu_themes_admin.tpl | 1 |
4 files changed, 79 insertions, 113 deletions
diff --git a/BitThemes.php b/BitThemes.php index 1a90d09..3a7e989 100644 --- a/BitThemes.php +++ b/BitThemes.php @@ -1,7 +1,7 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_themes/BitThemes.php,v 1.67 2008/06/20 04:16:40 spiderr Exp $ - * @version $Revision: 1.67 $ + * @version $Header: /cvsroot/bitweaver/_bit_themes/BitThemes.php,v 1.68 2008/06/26 09:56:44 squareing Exp $ + * @version $Revision: 1.68 $ * @package themes */ @@ -30,6 +30,9 @@ class BitThemes extends BitBase { // Raw Javascript Files var $mRawJsFiles = array(); + // Display Mode + var $mDisplayMode; + /** * Initiate class @@ -395,11 +398,16 @@ class BitThemes extends BitBase { $this->mLayout = $this->getLayout( $pParamHash ); // hideable areas - $hideable = array( 't' => 'top', 'l' => 'left', 'r' => 'right', 'b' => 'bottom' ); + $areas = array( 't' => 'top', 'l' => 'left', 'r' => 'right', 'b' => 'bottom' ); - // this needs to occur after loading the layout to ensure that we don't distrub the fallback process during layout loading - foreach( $hideable as $layout => $area ) { - if( $gBitSystem->isFeatureActive( ACTIVE_PACKAGE."_hide_{$area}_col" )) { + /* this needs to occur after loading the layout to ensure that we don't distrub the fallback process during layout loading + * we can disable clumns using various criteria: + * <package>_hide_<area>_col + * <package>_hide_<display_mode>_col + * <package>_hide_<area>_<display_mode>_col + */ + foreach( $areas as $layout => $area ) { + if( $gBitSystem->isFeatureActive( "{$this->mDisplayMode}_hide_{$area}_col" ) || $gBitSystem->isFeatureActive( ACTIVE_PACKAGE."_hide_{$area}_col" )) { unset( $this->mLayout[$layout] ); } } @@ -418,11 +426,11 @@ class BitThemes extends BitBase { $ret = array( 'l' => NULL, 'c' => NULL, 'r' => NULL ); $layouts = array(); - if( !empty( $pParamHash['layout'] ) ) { - $layouts[] = $pParamHash['layout']; + if( !empty( $pParamHash['layout'] )) { + $layouts[] = $pParamHash['layout']; } - if( !empty( $pParamHash['fallback_layout'] ) ) { - $layouts[] = $pParamHash['fallback_layout']; + if( !empty( $pParamHash['fallback_layout'] )) { + $layouts[] = $pParamHash['fallback_layout']; } $layouts[] = ACTIVE_PACKAGE; $layouts[] = DEFAULT_PACKAGE; @@ -1414,6 +1422,64 @@ class BitThemes extends BitBase { // }}} + // {{{ =================== Miscellaneous Stuff ==================== + /** + * setDisplayMode + * + * @param string $pDisplayMode + * @access public + * @return void + */ + function setDisplayMode( $pDisplayMode ) { + if( !empty( $pDisplayMode )) { + $this->mDisplayMode = $pDisplayMode; + } + } + + /** + * Set the proper headers for requested output + * + * @param $pFormat the output headers. Available options include: html, json, xml or none + * @access public + */ + function setFormatHeader( $pFormat = 'html' ) { + // this will tell BitSystem::display what headers have been set in case it's been called independently + $this->mFormatHeader = $pFormat; + + switch( $pFormat ) { + case "xml" : + //since we are returning xml we must report so in the header + //we also need to tell the browser not to cache the page + //see: http://mapki.com/index.php?title=Dynamic_XML + // Date in the past + header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); + // always modified + header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" )." GMT" ); + // HTTP/1.1 + header( "Cache-Control: no-store, no-cache, must-revalidate" ); + header( "Cache-Control: post-check=0, pre-check=0", FALSE ); + // HTTP/1.0 + header( "Pragma: no-cache" ); + //XML Header + header( "Content-Type: text/xml" ); + break; + + case "json" : + header( 'Content-type: application/json' ); + break; + + case "none" : + case "center_only" : + break; + + case "html" : + default : + header( 'Content-Type: text/html; charset=utf-8' ); + break; + } + } + + // {{{ =================== old code ==================== // deprecated stuff and temporary place holders // --------------- all of these functions will be removed quite soon diff --git a/admin/admin_layout_inc.php b/admin/admin_layout_inc.php index 8a21d2e..84b07d8 100644 --- a/admin/admin_layout_inc.php +++ b/admin/admin_layout_inc.php @@ -1,5 +1,5 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_themes/admin/admin_layout_inc.php,v 1.7 2008/05/21 12:44:48 wjames5 Exp $ +// $Header: /cvsroot/bitweaver/_bit_themes/admin/admin_layout_inc.php,v 1.8 2008/06/26 09:56:44 squareing Exp $ // Initialization require_once( '../../bit_setup_inc.php' ); @@ -30,38 +30,6 @@ if( !empty( $_REQUEST['module_name'] ) ) { $gBitSystem->verifyInstalledPackages(); -$formMiscFeatures = 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( 'formMiscFeatures',$formMiscFeatures ); - -// 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 ); - // clone existing layout $cloneLayouts = $gBitThemes->getAllLayouts(); $gBitSmarty->assign( 'cloneLayouts', $cloneLayouts ); @@ -72,27 +40,7 @@ if( !empty( $_REQUEST['from_layout'] ) && !empty( $_REQUEST['to_layout'] )) { // process form - check what tab was used and set it $processForm = set_tab(); -if( $processForm == 'Hide' ) { - foreach( array_keys( $formMiscFeatures ) 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 ) { - foreach( array_keys( $hideColumns ) as $package ) { - $pref = "{$package}_hide_{$area}_col"; - if( isset( $_REQUEST['hide'][$pref] ) ) { - $gBitSystem->storeConfig( $pref, 'y', THEMES_PKG_NAME ); - } else { - // remove the setting from the db if it's not set - $gBitSystem->storeConfig( $pref, NULL ); - } - } - } -} elseif( isset( $_REQUEST['module_id'] ) && !empty( $_REQUEST['move_module'] )) { +if( isset( $_REQUEST['module_id'] ) && !empty( $_REQUEST['move_module'] )) { if( isset( $_REQUEST['move_module'] )) { switch( $_REQUEST['move_module'] ) { case "unassign": diff --git a/templates/admin_layout.tpl b/templates/admin_layout.tpl index b7b7dc4..1e5f632 100644 --- a/templates/admin_layout.tpl +++ b/templates/admin_layout.tpl @@ -301,55 +301,6 @@ </div> {/form} {/jstab} - - {jstab title="Column Control"} - {form legend="Column Visibility"} - <input type="hidden" name="page" value="{$page}" /> - - {foreach from=$formMiscFeatures 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} - - <table id="hidecolumns"> - <caption>{tr}Hide areas in selected packages.{/tr}</caption> - <thead> - <tr> - <th>{tr}Package{/tr}</th> - <th>{tr}Top{/tr}</th> - <th>{tr}Left{/tr}</th> - <th>{tr}Right{/tr}</th> - <th>{tr}Bottom{/tr}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="5"> - <div class="row submit"> - <input type="submit" name="HideTabSubmit" value="{tr}Change preferences{/tr}" /> - </div> - </td> - </tr> - </tfoot> - <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="hide[{$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="hide[{$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="hide[{$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="hide[{$package}_hide_bottom_col]" value="y" {if $gBitSystem->isFeatureActive("`$package`_hide_bottom_col")}checked="checked"{/if} /></td> - </tr> - {/foreach} - </tbody> - </table> - {/form} - {/jstab} {/jstabs} <h1>{tr}Modules Help{/tr}</h1> diff --git a/templates/menu_themes_admin.tpl b/templates/menu_themes_admin.tpl index 4929b21..27c682a 100644 --- a/templates/menu_themes_admin.tpl +++ b/templates/menu_themes_admin.tpl @@ -2,6 +2,7 @@ <ul> <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=themes" >{tr}Theme Settings{/tr}</a></li> <li><a class="item" href="{$smarty.const.THEMES_PKG_URL}admin/admin_themes_manager.php">{tr}Themes Manager{/tr}</a></li> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=columns" >{tr}Column Control{/tr}</a></li> <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=layout" >{tr}Manage Layouts{/tr}</a></li> <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=layout_overview" >{tr}Configure Layout Options{/tr}</a></li> <li><a class="item" href="{$smarty.const.THEMES_PKG_URL}admin/menus.php">{tr}Menus{/tr}</a></li> |
