diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-10-11 10:15:26 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-10-11 10:15:26 +0000 |
| commit | 7391eeb99ebd6df8e346c8d7588e6fb73a9ba560 (patch) | |
| tree | 1075d60ad677e14f6691ad9b44e0b2471a125036 | |
| parent | 00a309359dd02fdab1a4f5c2b3c9f5a01ff7a4eb (diff) | |
| download | nexus-7391eeb99ebd6df8e346c8d7588e6fb73a9ba560.tar.gz nexus-7391eeb99ebd6df8e346c8d7588e6fb73a9ba560.tar.bz2 nexus-7391eeb99ebd6df8e346c8d7588e6fb73a9ba560.zip | |
some nexus cleanup, removed plugins table and use LibertySystem instead, clean up UI, still need to allow dynamic menus at some point
| -rw-r--r-- | NexusSystem.php | 298 | ||||
| -rw-r--r-- | admin/admin_nexus_inc.php | 20 | ||||
| -rw-r--r-- | admin/schema_inc.php | 8 | ||||
| -rw-r--r-- | admin/upgrade_inc.php | 4 | ||||
| -rw-r--r-- | bit_setup_inc.php | 25 | ||||
| -rw-r--r-- | menu_items.php | 4 | ||||
| -rw-r--r-- | menus.php | 8 | ||||
| -rw-r--r-- | plugins/menu.formelements.php | 28 | ||||
| -rw-r--r-- | plugins/menu.suckerfish.php | 23 | ||||
| -rw-r--r-- | plugins/menu.tikiwiki.php | 29 | ||||
| -rw-r--r-- | servicefunctions_inc.php | 8 | ||||
| -rw-r--r-- | templates/admin_nexus.tpl | 11 | ||||
| -rw-r--r-- | templates/menu_items_edit_inc.tpl | 2 | ||||
| -rw-r--r-- | templates/menu_nexus_admin.tpl | 5 | ||||
| -rw-r--r-- | templates/menus.tpl | 197 |
15 files changed, 372 insertions, 298 deletions
diff --git a/NexusSystem.php b/NexusSystem.php index afc7b6c..8f520e7 100644 --- a/NexusSystem.php +++ b/NexusSystem.php @@ -1,142 +1,180 @@ <?php /** -* Nexus system class for handling the menu plugins -* -* @abstract -* @author xing <xing@synapse.plus.com> -* copied copied from LibertySystem.php -* @version $Revision: 1.6 $ -* @package nexus -*/ + * @version: $Header: /cvsroot/bitweaver/_bit_nexus/NexusSystem.php,v 1.7 2006/10/11 10:15:23 squareing Exp $ + * + * @author: xing <xing@synapse.plus.com> + * @version: $Revision: 1.7 $ + * @created: Monday Jul 03, 2006 11:06:47 CEST + * @package: nexus + * @copyright: 2003-2006 bitweaver + * @license: LGPL {@link http://www.gnu.org/licenses/lgpl.html} + **/ +require_once( LIBERTY_PKG_PATH.'LibertySystem.php' ); -// for menus that use regular HTML as output -/** -* definitions -*/ -define( 'NEXUS_HTML_PLUGIN', 'nexushtml' ); -define( 'NEXUS_DEFAULT_GUID', 'suckerfish' ); - -/** -* required setup -*/ -require_once( KERNEL_PKG_PATH.'BitBase.php' ); +define( 'NEXUS_DEFAULT_MENU', 'suckerfish' ); /** -* @package nexus -* @subpackage NexusSystem -*/ -class NexusSystem extends BitBase { - + * NexusSystem + * + * @uses LibertySystem + */ +class NexusSystem extends LibertySystem { + // Contains plugin information var $mPlugins; - function NexusSystem() { - BitBase::BitBase(); - $this->loadPlugins(); - } - - function loadPlugins( $pCacheTime=BIT_QUERY_CACHE_TIME ) { - $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."nexus_plugins`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ); - while( $rs && !$rs->EOF ) { - $this->mPlugins[$rs->fields['plugin_guid']] = $rs->fields; - $rs->MoveNext(); - } - } - - function scanPlugins() { - $pluginsPath = NEXUS_PKG_PATH.'plugins/'; - if( $pluginDir = opendir( $pluginsPath ) ) { - // Scan the plugins directory for plugins - while( FALSE !== ( $plugin = readdir( $pluginDir ) ) ) { - if( preg_match( '/\.php$/', $plugin ) ) { - include_once( $pluginsPath.$plugin ); - } - } - } - - // match up storage_type_id to plugin_guids. this _id varies from install to install, but guids are the same - foreach( array_keys( $this->mPlugins ) as $guid ) { - $handler = &$this->mPlugins[$guid]; //shorthand var alias - if( !isset( $handler['verified'] ) && $handler['is_active'] =='y' ) { - // We are missing a plugin! - $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='x' WHERE `plugin_guid`=?"; - $this->mDb->query( $sql, array( $guid ) ); - $handler['is_active'] = 'n'; - } elseif( !empty( $handler['verified'] ) && $handler['is_active'] =='x' ) { - //We found a formally missing plugin - re-enable it - $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='y' WHERE `plugin_guid`=?"; - $this->mDb->query( $sql, array( $guid ) ); - $handler['is_active'] = 'y'; - } elseif( empty( $handler['verified'] ) && !isset( $handler['is_active'] ) ) { - //We found a missing plugin - insert it - $sql = "INSERT INTO `".BIT_DB_PREFIX."nexus_plugins` ( `plugin_guid`, `plugin_type`, `plugin_description`, `is_active` ) VALUES ( ?, ?, ?, 'y' )"; - $this->mDb->query( $sql, array( $guid, $handler['plugin_type'], $handler['description'] ) ); - $handler['is_active'] = 'y'; - } - } - if( !empty( $sql ) ) { - // we just ran some SQL - let's flush the loadPlugins query cache - $this->loadPlugins( 0 ); - } - asort( $this->mPlugins ); - } - - function registerPlugin( $pGuid, $pPluginParams ) { - if( isset( $this->mPlugins[$pGuid] ) ) { - $this->mPlugins[$pGuid]['verified'] = TRUE; - } else { - $this->mPlugins[$pGuid]['verified'] = FALSE; - } - $this->mPlugins[$pGuid] = array_merge( $this->mPlugins[$pGuid], $pPluginParams ); - } - - // @parameter pPluginGuids an array of all the plugin guids that are active. Any left out are *inactive*! - function setActivePlugins( $pPluginGuids ) { - if( is_array( $pPluginGuids ) ) { - $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='n' WHERE `is_active`!='x'"; - $this->mDb->query( $sql ); - foreach( array_keys( $this->mPlugins ) as $guid ) { - $this->mPlugins[$guid]['is_active'] = 'n'; - } - - foreach( array_keys( $pPluginGuids ) as $guid ) { - $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='y' WHERE `plugin_guid`=?"; - $this->mDb->query( $sql, array( $guid ) ); - $this->mPlugins[$guid]['is_active'] = 'y'; - } - // we just ran some SQL - let's flush the loadPlugins query cache - $this->loadPlugins( 0 ); - } - } - - function getPluginFunction( $pGuid, $pFunctionName ) { - $ret = NULL; - if( !empty( $pGuid ) - && !empty( $this->mPlugins[$pGuid] ) - && !empty( $this->mPlugins[$pGuid][$pFunctionName] ) - && function_exists( $this->mPlugins[$pGuid][$pFunctionName] ) - ) { - $ret = $this->mPlugins[$pGuid][$pFunctionName]; - } - return $ret; - } - /** - * fucntion to store pluging settings - * $param $pParamHash contains settings for any guid that require updating - * return TRUE + * Initiate class + * + * @access public + * @return void */ - function storePluginSettings( $pParamHash ) { - // first get all values from nexus_plugin_settings to see which ones need updating and which ones are added for the first time - $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."nexus_plugin_settings`", NULL ); - while( $rs && !$rs->EOF ) { - $settings[] = $rs->fields; - $rs->MoveNext(); - } + function NexusSystem() { + // Set the package using LibertySystem + $this->mSystem = NEXUS_PKG_NAME; + + LibertySystem::LibertySystem( FALSE ); } } - -global $gNexusSystem; -$gNexusSystem = new NexusSystem(); -$gNexusSystem->scanPlugins(); -$gBitSmarty->assign_by_ref( 'gNexusSystem', $gNexusSystem ); +?> +<?php +#/** +#* Nexus system class for handling the menu plugins +#* +#* @abstract +#* @author xing <xing@synapse.plus.com> +#* copied copied from LibertySystem.php +#* @version $Revision: 1.7 $ +#* @package nexus +#*/ +# +#// for menus that use regular HTML as output +#/** +#* definitions +#*/ +#define( 'NEXUS_HTML_PLUGIN', 'nexushtml' ); +#define( 'NEXUS_DEFAULT_GUID', 'suckerfish' ); +# +#/** +#* required setup +#*/ +#require_once( KERNEL_PKG_PATH.'BitBase.php' ); +# +#/** +#* @package nexus +#* @subpackage NexusSystem +#*/ +#class NexusSystem extends BitBase { +# +# var $mPlugins; +# +# function NexusSystem() { +# BitBase::BitBase(); +# $this->loadPlugins(); +# } +# +# function loadPlugins( $pCacheTime=BIT_QUERY_CACHE_TIME ) { +# $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."nexus_plugins`", NULL, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ); +# while( $rs && !$rs->EOF ) { +# $this->mPlugins[$rs->fields['plugin_guid']] = $rs->fields; +# $rs->MoveNext(); +# } +# } +# +# function scanPlugins() { +# $pluginsPath = NEXUS_PKG_PATH.'plugins/'; +# if( $pluginDir = opendir( $pluginsPath ) ) { +# // Scan the plugins directory for plugins +# while( FALSE !== ( $plugin = readdir( $pluginDir ) ) ) { +# if( preg_match( '/\.php$/', $plugin ) ) { +# include_once( $pluginsPath.$plugin ); +# } +# } +# } +# +# // match up storage_type_id to plugin_guids. this _id varies from install to install, but guids are the same +# foreach( array_keys( $this->mPlugins ) as $guid ) { +# $handler = &$this->mPlugins[$guid]; //shorthand var alias +# if( !isset( $handler['verified'] ) && $handler['is_active'] =='y' ) { +# // We are missing a plugin! +# $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='x' WHERE `plugin_guid`=?"; +# $this->mDb->query( $sql, array( $guid ) ); +# $handler['is_active'] = 'n'; +# } elseif( !empty( $handler['verified'] ) && $handler['is_active'] =='x' ) { +# //We found a formally missing plugin - re-enable it +# $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='y' WHERE `plugin_guid`=?"; +# $this->mDb->query( $sql, array( $guid ) ); +# $handler['is_active'] = 'y'; +# } elseif( empty( $handler['verified'] ) && !isset( $handler['is_active'] ) ) { +# //We found a missing plugin - insert it +# $sql = "INSERT INTO `".BIT_DB_PREFIX."nexus_plugins` ( `plugin_guid`, `plugin_type`, `plugin_description`, `is_active` ) VALUES ( ?, ?, ?, 'y' )"; +# $this->mDb->query( $sql, array( $guid, $handler['plugin_type'], $handler['description'] ) ); +# $handler['is_active'] = 'y'; +# } +# } +# if( !empty( $sql ) ) { +# // we just ran some SQL - let's flush the loadPlugins query cache +# $this->loadPlugins( 0 ); +# } +# asort( $this->mPlugins ); +# } +# +# function registerPlugin( $pGuid, $pPluginParams ) { +# if( isset( $this->mPlugins[$pGuid] ) ) { +# $this->mPlugins[$pGuid]['verified'] = TRUE; +# } else { +# $this->mPlugins[$pGuid]['verified'] = FALSE; +# } +# $this->mPlugins[$pGuid] = array_merge( $this->mPlugins[$pGuid], $pPluginParams ); +# } +# +# // @parameter pPluginGuids an array of all the plugin guids that are active. Any left out are *inactive*! +# function setActivePlugins( $pPluginGuids ) { +# if( is_array( $pPluginGuids ) ) { +# $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='n' WHERE `is_active`!='x'"; +# $this->mDb->query( $sql ); +# foreach( array_keys( $this->mPlugins ) as $guid ) { +# $this->mPlugins[$guid]['is_active'] = 'n'; +# } +# +# foreach( array_keys( $pPluginGuids ) as $guid ) { +# $sql = "UPDATE `".BIT_DB_PREFIX."nexus_plugins` SET `is_active`='y' WHERE `plugin_guid`=?"; +# $this->mDb->query( $sql, array( $guid ) ); +# $this->mPlugins[$guid]['is_active'] = 'y'; +# } +# // we just ran some SQL - let's flush the loadPlugins query cache +# $this->loadPlugins( 0 ); +# } +# } +# +# function getPluginFunction( $pGuid, $pFunctionName ) { +# $ret = NULL; +# if( !empty( $pGuid ) +# && !empty( $this->mPlugins[$pGuid] ) +# && !empty( $this->mPlugins[$pGuid][$pFunctionName] ) +# && function_exists( $this->mPlugins[$pGuid][$pFunctionName] ) +# ) { +# $ret = $this->mPlugins[$pGuid][$pFunctionName]; +# } +# return $ret; +# } +# +# /** +# * fucntion to store pluging settings +# * $param $pParamHash contains settings for any guid that require updating +# * return TRUE +# */ +# function storePluginSettings( $pParamHash ) { +# // first get all values from nexus_plugin_settings to see which ones need updating and which ones are added for the first time +# $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."nexus_plugin_settings`", NULL ); +# while( $rs && !$rs->EOF ) { +# $settings[] = $rs->fields; +# $rs->MoveNext(); +# } +# } +#} +# +#global $gNexusSystem; +#$gNexusSystem = new NexusSystem(); +#$gNexusSystem->scanPlugins(); +#$gBitSmarty->assign_by_ref( 'gNexusSystem', $gNexusSystem ); ?> diff --git a/admin/admin_nexus_inc.php b/admin/admin_nexus_inc.php new file mode 100644 index 0000000..40c5812 --- /dev/null +++ b/admin/admin_nexus_inc.php @@ -0,0 +1,20 @@ +<?php +require_once( NEXUS_PKG_PATH.'Nexus.php'); + +$gNexus = new Nexus(); +$gNexusSystem->scanAllPlugins( NEXUS_PKG_PATH.'plugins/' ); + +$feedback = array(); + +if( !empty( $_REQUEST['rewrite_cache'] ) ) { + if( $gNexus->rewriteMenuCache() ) { + $feedback['success'] = tra( 'The complete menu cache has been rewritten.' ); + } +} + +if( !empty( $_REQUEST['pluginsave'] ) ) { + $gNexusSystem->setActivePlugins( $_REQUEST['plugins'] ); + $feedback['success'] = tra( 'The plugins were successfully updated' ); +} +$gBitSmarty->assign( 'feedback', $feedback ); +?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 29d9989..9f4014e 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,14 +1,6 @@ <?php $tables = array( -'nexus_plugins' => " - plugin_guid C(16) PRIMARY, - plugin_type C(16) NOTNULL, - is_active C(1) NOTNULL DEFAULT 'y', - plugin_description C(250), - maintainer_url C(250) -", - 'nexus_menus' => " menu_id I4 AUTO PRIMARY, plugin_guid C(16) NOTNULL, diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php index cc472ac..d649c4f 100644 --- a/admin/upgrade_inc.php +++ b/admin/upgrade_inc.php @@ -8,8 +8,10 @@ $upgrades = array( 'BWR2' => array( // de-tikify tables array( 'DATADICT' => array( + array( 'DROPTABLE' => array( + 'tiki_nexus_plugins' + )), array( 'RENAMETABLE' => array( - 'tiki_nexus_plugins' => 'nexus_plugins', 'tiki_nexus_menus' => 'nexus_menus', 'tiki_nexus_menu_items' => 'nexus_menu_items', )), diff --git a/bit_setup_inc.php b/bit_setup_inc.php index 6ee1ec6..5f524d3 100644 --- a/bit_setup_inc.php +++ b/bit_setup_inc.php @@ -1,7 +1,7 @@ <?php /** * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ * @package Nexus * @subpackage functions */ @@ -10,21 +10,30 @@ global $gBitSystem, $gBitUser, $gLibertySystem; $registerHash = array( 'package_name' => 'nexus', 'package_path' => dirname( __FILE__ ).'/', - 'service' => LIBERTY_SERVICE_MENU, + 'service' => LIBERTY_SERVICE_MENU, ); $gBitSystem->registerPackage( $registerHash ); if( $gBitSystem->isPackageActive( 'nexus' ) ) { + // load nexus plugins + require_once( NEXUS_PKG_PATH.'NexusSystem.php' ); + global $gNexusSystem; + $gNexusSystem = new NexusSystem(); + if( !$gBitSystem->isFeatureActive( NEXUS_PKG_NAME.'_plugin_file_suckerfish' ) ) { + $gNexusSystem->scanAllPlugins( NEXUS_PKG_PATH.'plugins/' ); + } else { + $gNexusSystem->loadActivePlugins(); + } + $gBitSmarty->assign_by_ref( 'gNexusSystem', $gNexusSystem ); + + require_once( NEXUS_PKG_PATH.'Nexus.php' ); $gLibertySystem->registerService( LIBERTY_SERVICE_MENU, NEXUS_PKG_NAME, array( - 'content_store_function' => 'nexus_store_content', - 'content_edit_function' => 'nexus_input_content', + 'content_store_function' => 'nexus_store_content', + 'content_edit_function' => 'nexus_input_content', 'content_preview_function' => 'nexus_preview_content', - 'content_edit_tab_tpl' => 'bitpackage:nexus/insert_menu_item_inc.tpl', + 'content_edit_tab_tpl' => 'bitpackage:nexus/insert_menu_item_inc.tpl', ) ); - // include service functions - require_once( NEXUS_PKG_PATH.'servicefunctions_inc.php' ); - if( $gBitUser->hasPermission( 'p_nexus_create_menus' ) ) { $menuHash = array( 'package_name' => NEXUS_PKG_NAME, diff --git a/menu_items.php b/menu_items.php index d629e8f..33e8a9d 100644 --- a/menu_items.php +++ b/menu_items.php @@ -1,7 +1,7 @@ <?php /** * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @package nexus * @subpackage functions */ @@ -88,7 +88,7 @@ $rsrcTypes = array( 'external' => 'URL', 'content_id' => 'Content ID', 'structure_id' => 'Structure ID', - 'menu_id' => 'Menu ID', + //'menu_id' => 'Menu ID', // 'gallery_list' => 'Gallery List', // this is not in use yet - xing ); $gBitSmarty->assign( 'rsrcTypes', $rsrcTypes ); @@ -1,7 +1,7 @@ <?php /** * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ * @package nexus * @subpackage functions */ @@ -33,12 +33,6 @@ if( isset( $_REQUEST['action'] ) ) { $gBitSystem->confirmDialog( $formHash,$msgHash ); } - if( $_REQUEST['action'] == 'rewrite_cache' ) { - if( $gNexus->rewriteMenuCache() ) { - $formfeedback['success'] = tra( 'The complete menu cache has been rewritten.' ); - } - } - if( $_REQUEST['action'] == 'remove_dead' ) { if( $deadLinks = $gNexus->expungeDeadItems( $menuId ) ) { $deadHtml = '<ul>'; diff --git a/plugins/menu.formelements.php b/plugins/menu.formelements.php index 6791777..0424809 100644 --- a/plugins/menu.formelements.php +++ b/plugins/menu.formelements.php @@ -6,7 +6,7 @@ * @abstract implements javascript menu using form elements * @author william@elan.net * copied copied from menu.suckerfish.php originally by xing - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ * @package nexus * @subpackage plugins */ @@ -18,20 +18,22 @@ global $gNexusSystem; define( 'NEXUS_PLUGIN_GUID_FORMELEMENTSMENU', 'formelements' ); $pluginParams = array( - 'write_cache_function' => 'writeFormMenuCache', - 'description' => 'Menus using form elements', - 'web_link' => '', + 'auto_activate' => FALSE, + 'write_cache_function' => 'write_form_menu_cache', + 'title' => 'Formelements menu', + 'description' => 'Menus using form elements', + 'web_link' => '', 'browser_requirements' => 'This menu should work in all browsers that support javascript', - 'edit_label' => 'Menus using form elements', - 'menu_types' => array( + 'edit_label' => 'Menus using form elements', + 'include_js_in_head' => '/nexus/plugins/menu.formelements.js', + 'plugin_type' => 'nexus_plugin', + 'menu_types' => array( 'sdd' => array( 'label' => 'Standard DropDown', 'note' => 'drop-down menu using select with menu name on top' ), - 'qdd' => array( 'label' => 'Quick DropDown', 'note' => 'drop-down menu using select with menu name in drop-down select box'), - 's3' => array( 'label' => '3-Line Box', 'note' => 'select menu with 3 lines showing' ), - 's5' => array( 'label' => '5-Line Box', 'note' => 'select menu with 5 lines showing' ), - 'sal' => array( 'label' => 'Full Text Box', 'note' => 'select menu with all menu items showing' ), + 'qdd' => array( 'label' => 'Quick DropDown', 'note' => 'drop-down menu using select with menu name in drop-down select box'), + 's3' => array( 'label' => '3-Line Box', 'note' => 'select menu with 3 lines showing' ), + 's5' => array( 'label' => '5-Line Box', 'note' => 'select menu with 5 lines showing' ), + 'sal' => array( 'label' => 'Full Text Box', 'note' => 'select menu with all menu items showing' ), ), - 'plugin_type' => NEXUS_HTML_PLUGIN, - 'include_js_in_head' => '/nexus/plugins/menu.formelements.js', ); $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_FORMELEMENTSMENU, $pluginParams ); @@ -42,7 +44,7 @@ $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_FORMELEMENTSMENU, $pluginParams * @return number of errors encountered * @public */ -function writeFormMenuCache( $pMenuHash ) { +function write_form_menu_cache( $pMenuHash ) { global $gBitSmarty; $menu_name = preg_replace( "/ +/", "_", trim( $pMenuHash->mInfo['title'] ) ); $menu_name = strtolower( $menu_name ); diff --git a/plugins/menu.suckerfish.php b/plugins/menu.suckerfish.php index 0c62d4b..354bed5 100644 --- a/plugins/menu.suckerfish.php +++ b/plugins/menu.suckerfish.php @@ -5,7 +5,7 @@ * * @abstract creates a simple <ul> and <li> based list of items * @author xing@synapse.plus.com - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * @package nexus * @subpackage plugins */ @@ -18,18 +18,19 @@ global $gNexusSystem; define( 'NEXUS_PLUGIN_GUID_SUCKERFISH', 'suckerfish' ); $pluginParams = array( - 'write_cache_function' => 'writeSuckerfishCache', - 'description' => 'Sophisticated and flexible CSS driven dropdown menus', - 'web_link' => '<a class="external" href="http://www.htmldog.com/articles/suckerfish/">Sons of Suckerfish Menus</a>', + 'auto_activate' => TRUE, + 'write_cache_function' => 'write_suckerfish_cache', + 'title' => 'Suckerfish Menus', + 'description' => 'Sophisticated and flexible CSS driven dropdown menus', + 'web_link' => '<a class="external" href = "http: // www.htmldog.com/articles/suckerfish/">Sons of Suckerfish Menus</a>', 'browser_requirements' => 'Many modern browsers support suckerfish menus inherently using CSS. MSIE requires javascript to be ON for them to work.', - 'edit_label' => 'CSS based menus', - 'menu_types' => array( - 'nor' => array( 'label' => 'Normal', 'note' => 'Nested list of menu items using "ul" and "li" HTML tags.' ), - 'ver' => array( 'label' => 'Vertical', 'note' => 'Vertical dropdown menu that usually resides in one of the side modules.' ), + 'edit_label' => 'CSS based menus', + 'plugin_type' => 'nexus_plugin', + 'menu_types' => array( + 'nor' => array( 'label' => 'Normal', 'note' => 'Nested list of menu items using "ul" and "li" HTML tags.' ), + 'ver' => array( 'label' => 'Vertical', 'note' => 'Vertical dropdown menu that usually resides in one of the side modules.' ), 'hor' => array( 'label' => 'Horizontal', 'note' => 'Horizontal menu which you can use to insert in or replace the top menu bar.' ), ), - 'plugin_type' => NEXUS_HTML_PLUGIN, - 'include_js_in_head' => FALSE, ); $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_SUCKERFISH, $pluginParams ); @@ -39,7 +40,7 @@ $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_SUCKERFISH, $pluginParams ); * @param $pMenuHash full menu hash * @return full menu string ready for printing (key serves as cache file path) */ -function writeSuckerfishCache( $pMenuHash ) { +function write_suckerfish_cache( $pMenuHash ) { global $gBitSmarty; $menu_name = preg_replace( "/ +/", "_", trim( $pMenuHash->mInfo['title'] ) ); $menu_name = strtolower( $menu_name ); diff --git a/plugins/menu.tikiwiki.php b/plugins/menu.tikiwiki.php index 9a9b679..193add5 100644 --- a/plugins/menu.tikiwiki.php +++ b/plugins/menu.tikiwiki.php @@ -4,7 +4,7 @@ * * @abstract creates a javascript expandable menu * @author xing@synapse.plus.com - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * @package nexus * @subpackage plugins */ @@ -17,21 +17,22 @@ global $gNexusSystem; define( 'NEXUS_PLUGIN_GUID_TIKIWIKI', 'tikiwiki' ); $pluginParams = array( - 'write_cache_function' => 'writeTikiWikiCache', - 'description' => 'expandable menu reminiscent of the tikiwiki menu', - 'web_link' => '<a class="external" href="http://www.tikiwiki.org">TikiWiki</a>', + 'auto_activate' => TRUE, + 'write_cache_function' => 'write_tikiwiki_cache', + 'title' => 'TikiWiki menus', + 'description' => 'expandable menu reminiscent of the tikiwiki menu', + 'web_link' => '<a class="external" href = "http: // www.tikiwiki.org">TikiWiki</a>', 'browser_requirements' => 'Most browsers that support javascript should support these menus.', - 'edit_label' => 'TikiWiki menus', - 'menu_types' => array( - 'heo' => array( 'label' => 'head expands - open', 'note' => 'Head item serves merely as container and clicking on it will expand the underlying items (initial setting is open).' ), - 'iho' => array( 'label' => 'head expands (with icon) - open', 'note' => 'Head item serves merely as container and clicking on it will expand the underlying items (initial setting is open). Displays an icon along with it.' ), - 'hec' => array( 'label' => 'head expands - closed', 'note' => 'Initial setting is closed.' ), + 'edit_label' => 'TikiWiki menus', + 'plugin_type' => 'nexus_plugin', + 'menu_types' => array( + 'heo' => array( 'label' => 'head expands - open', 'note' => 'Head item serves merely as container and clicking on it will expand the underlying items (initial setting is open).' ), + 'iho' => array( 'label' => 'head expands (with icon) - open', 'note' => 'Head item serves merely as container and clicking on it will expand the underlying items (initial setting is open). Displays an icon along with it.' ), + 'hec' => array( 'label' => 'head expands - closed', 'note' => 'Initial setting is closed.' ), 'ihc' => array( 'label' => 'head expands (with icon) - closed', 'note' => 'Initial setting is closed. Displays an icon along with it.' ), - 'ieo' => array( 'label' => 'icon expands - open', 'note' => 'Menu head item serves as link and there is an icon to expand the menu (initial setting is open).' ), - 'iec' => array( 'label' => 'icon expands - closed', 'note' => 'Initial setting is closed.' ), + 'ieo' => array( 'label' => 'icon expands - open', 'note' => 'Menu head item serves as link and there is an icon to expand the menu (initial setting is open).' ), + 'iec' => array( 'label' => 'icon expands - closed', 'note' => 'Initial setting is closed.' ), ), - 'plugin_type' => NEXUS_HTML_PLUGIN, - 'include_js_in_head' => FALSE, ); $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_TIKIWIKI, $pluginParams ); @@ -41,7 +42,7 @@ $gNexusSystem->registerPlugin( NEXUS_PLUGIN_GUID_TIKIWIKI, $pluginParams ); * @param $pMenuHash full menu hash * @return full menu string ready for printing (key serves as cache file path) */ -function writeTikiWikiCache( $pMenuHash ) { +function write_tikiwiki_cache( $pMenuHash ) { global $gBitSmarty; $menu_name = preg_replace( "/ +/", "_", trim( $pMenuHash->mInfo['title'] ) ); $menu_name = strtolower( $menu_name ); diff --git a/servicefunctions_inc.php b/servicefunctions_inc.php index 1001621..3d04d9d 100644 --- a/servicefunctions_inc.php +++ b/servicefunctions_inc.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_nexus/servicefunctions_inc.php,v 1.3 2006/01/10 21:14:10 squareing Exp $ + * $Header: /cvsroot/bitweaver/_bit_nexus/servicefunctions_inc.php,v 1.4 2006/10/11 10:15:23 squareing Exp $ * * @package nexus * @subpackage functions @@ -9,7 +9,7 @@ /** * Nexus edit template service */ -function nexus_input_content( $pObject=NULL ) { +function nexus_content_edit( $pObject=NULL ) { global $gBitSmarty; require_once( NEXUS_PKG_PATH.'Nexus.php' ); $nexus = new Nexus(); @@ -31,14 +31,14 @@ function nexus_input_content( $pObject=NULL ) { * Nexus preview service * when we hit preview, we make the selections persistent */ -function nexus_preview_content( $pObject=NULL ) { +function nexus_content_preview( $pObject=NULL ) { } /** * Nexus store service * store the content as part of an existing menu */ -function nexus_store_content( $pObject, $pParamHash ) { +function nexus_content_store( $pObject, $pParamHash ) { global $gBitSystem, $gBitUser, $gBitSmarty; require_once( NEXUS_PKG_PATH.'Nexus.php' ); $nexus = new Nexus(); diff --git a/templates/admin_nexus.tpl b/templates/admin_nexus.tpl new file mode 100644 index 0000000..5f6c501 --- /dev/null +++ b/templates/admin_nexus.tpl @@ -0,0 +1,11 @@ +{formfeedback hash=$feedback} + +{legend legend="Menu Cache"} + <div class="row"> + {formlabel label="Menu Cache" for=""} + {forminput} + {smartlink ititle="Rewrite Menu Cache" rewrite_cache=1 page=$page} + {formhelp note="This will remove any old files in the nexus menu cache directory and rewrite any exiting menus. Useful when you have renamed menus."} + {/forminput} + </div> +{/legend} diff --git a/templates/menu_items_edit_inc.tpl b/templates/menu_items_edit_inc.tpl index 419103c..68e8a35 100644 --- a/templates/menu_items_edit_inc.tpl +++ b/templates/menu_items_edit_inc.tpl @@ -68,7 +68,7 @@ {formlabel label="Resource link" for="rsrc"} {forminput} <input type="text" name="rsrc" id="rsrc" size="50" value="{$editItem.rsrc|escape}" /> - {formhelp note="<dl><dt>External URL</dt><dd>enter full link. e.g.: <strong>http://www.example.com</strong></dd><dt>Internal URL</dt><dd>enter link beginning from your bitweaver installation directory. e.g.: <strong>wiki/rankings.php</strong></dd><dt>Content ID</dt><dd>enter the number referring to some content (e.g. the number assoctiated with each item in the content dropdown is a content ID). e.g.: <strong>3</strong></dd><dt>Menu ID</dt><dd>Enter the menu ID of the menu you wish to insert.</dd></dl>"} + {formhelp note="<dl><dt>External URL</dt><dd>enter full link. e.g.: <strong>http://www.example.com</strong></dd><dt>Internal URL</dt><dd>enter link beginning from your bitweaver installation directory. e.g.: <strong>wiki/rankings.php</strong></dd><dt>Content ID</dt><dd>enter the number referring to some content (e.g. the number assoctiated with each item in the content dropdown is a content ID). e.g.: <strong>3</strong></dd><dt>Structure ID</dt><dd>Enter the structure ID that you want to use.</dd></dl>"} {/forminput} </div> diff --git a/templates/menu_nexus_admin.tpl b/templates/menu_nexus_admin.tpl new file mode 100644 index 0000000..8b4197f --- /dev/null +++ b/templates/menu_nexus_admin.tpl @@ -0,0 +1,5 @@ +{strip} +<ul> + <li><a class="item" href="{$smarty.const.KERNEL_PKG_URL}admin/index.php?page=nexus">{tr}Nexus Settings{/tr}</a></li> +</ul> +{/strip} diff --git a/templates/menus.tpl b/templates/menus.tpl index 13eb6c6..3d83900 100644 --- a/templates/menus.tpl +++ b/templates/menus.tpl @@ -11,113 +11,112 @@ {formfeedback hash=$formfeedback} - {jstabs} - {jstab title="Create / Edit Menus"} - {form legend="Create / Edit Menus"} - <input type="hidden" name="menu_id" value="{$editMenu.menu_id}" /> + {form legend="Create / Edit Menus"} + <input type="hidden" name="menu_id" value="{$editMenu.menu_id}" /> - <div class="row"> - {if $editMenu} - {formfeedback warning="{tr}Renaming an assigned menu will cause an error because the cache file will be renamed as well. You will have to make appropriate modifications in the layout page as well.{/tr}"} - {/if} - {formlabel label="Title" for="title"} - {forminput} - <input type="text" name="title" id="title" size="50" value="{$editMenu.title|escape}" /> - {formhelp note="Enter a name for your menu."} - {/forminput} - </div> + <div class="row"> + {if $editMenu} + {formfeedback warning="{tr}Renaming an assigned menu will cause an error because the cache file will be renamed as well. You will have to make appropriate modifications in the layout page as well.{/tr}"} + {/if} + {formlabel label="Title" for="title"} + {forminput} + <input type="text" name="title" id="title" size="50" value="{$editMenu.title|escape}" /> + {formhelp note="Enter a name for your menu."} + {/forminput} + </div> - <div class="row"> - {formlabel label="Description" for="description"} - {forminput} - <textarea name="description" id="description" cols="50" rows="3">{$editMenu.description}</textarea> - {formhelp note="A description of this menu. This description is visible to users that can add items to this menu."} - {/forminput} - </div> + <div class="row"> + {formlabel label="Description" for="description"} + {forminput} + <textarea name="description" id="description" cols="50" rows="3">{$editMenu.description}</textarea> + {formhelp note="A description of this menu. This description is visible to users that can add items to this menu."} + {/forminput} + </div> - <div class="row"> - {formlabel label="Editable menu" for="editable"} - {forminput} - {html_checkboxes name="editable" values="1" checked=`$editMenu.editable` labels=false id="editable"} - {formhelp note="Checking this will allow users with the correct permission (p_nexus_insert_item) to add menu items when they are editing content such as a wiki page or a fisheye gallery."} - {/forminput} - </div> + <div class="row"> + {formlabel label="Editable menu" for="editable"} + {forminput} + {html_checkboxes name="editable" values="1" checked=`$editMenu.editable` labels=false id="editable"} + {formhelp note="Checking this will allow users with the correct permission (p_nexus_insert_item) to add menu items when they are editing content such as a wiki page or a fisheye gallery."} + {/forminput} + </div> - <div class="row"> - {formlabel label="Pick menu type"} - {forminput} - {foreach from=$gNexusSystem->mPlugins item=plugin} - {if $plugin.is_active eq 'y'} - <div class="row"> - <label> - <input type="radio" name="plugin_guid" value="{$plugin.plugin_guid}" - {if $editMenu.plugin_guid eq $plugin.plugin_guid or ( $editMenu.plugin_guid eq '' and $plugin.plugin_guid eq 'suckerfish' )} - checked="checked" - {/if} - /> - {$plugin.plugin_guid} - </label> - <br /> - - <select name="type_{$plugin.plugin_guid}" id="type_{$plugin.plugin_guid}"> - {foreach from=$plugin.menu_types key=type item=menu_type} - {if $type eq hor and $use_custom_top_bar and !$editMenu.menu_type eq 'hor'} - <option value="">{tr}Only one horizontal menu can exist.{/tr}</option> - {else} - <option value="{$type}"{if $type eq $editMenu.menu_type} selected="selected"{/if}>{$menu_type.label}</option> - {/if} - {/foreach} - </select> - {formhelp note=$plugin.plugin_description} - <div class="formhelp"> - <dl> - {foreach from=$plugin.menu_types item=menu_type} - <dt>{$menu_type.label}</dt><dd>{$menu_type.note}</dd> - {/foreach} - </dl> - </div> - </div> - {/if} - {/foreach} - {/forminput} - </div> + <div class="row"> + {formlabel label="Pick menu type"} + {forminput} + {foreach from=$gNexusSystem->mPlugins item=plugin name=foo} + {if $plugin.is_active eq 'y'} + <label> + <input type="radio" name="plugin_guid" value="{$plugin.plugin_guid}" + {if $editMenu.plugin_guid eq $plugin.plugin_guid or ( $editMenu.plugin_guid eq '' and $plugin.plugin_guid eq 'suckerfish' )} + checked="checked" + {/if} + /> {$plugin.title} + </label> + <br /> + <select name="type_{$plugin.plugin_guid}" id="type_{$plugin.plugin_guid}"> + {foreach from=$plugin.menu_types key=type item=menu_type} + {if $type eq hor and $use_custom_top_bar and !$editMenu.menu_type eq 'hor'} + {assign var=has_horizontal_menu value=1} + <option value="">{tr}Only one horizontal menu can exist.{/tr}</option> + {else} + <option value="{$type}"{if $type eq $editMenu.menu_type} selected="selected"{/if}>{$menu_type.label}</option> + {/if} + {/foreach} + </select> - <div class="row submit"> - <input type="submit" name="store_menu" value="Save Settings" /> - </div> - {/form} - {/jstab} + <script type="text/javascript">/* <![CDATA[ */ + document.write( ' <a href="javascript:flip(\'{$plugin.plugin_guid}\')">{tr}Detailed menu help{/tr}</a>' ); + /* ]]> */</script> - {jstab title="Advanced Settings"} - {form legend="Top Bar Menu Position"} - <div class="row"> - {formlabel label="Position" for="nexus_top_bar"} - {forminput} - <select name="nexus_top_bar" id="nexus_top_bar"> - <option value="right" {if $gBitSystem->getConfig('nexus_top_bar') eq 'right'}selected="selected"{/if}>{tr}To the right of the bitweaver menu{/tr}</option> - <option value="left" {if $gBitSystem->getConfig('nexus_top_bar') eq 'left'}selected="selected"{/if}>{tr}To the left of the bitweaver menu{/tr}</option> - <option value="replace" {if $gBitSystem->getConfig('nexus_top_bar') eq 'replace'}selected="selected"{/if}>{tr}Replace the bitweaver menu{/tr}</option> - </select> - {formhelp note="Here you can set the position of where your custom top bar menu should be. This setting is only used when you are using a horizontal suckerfish menu."} - {/forminput} - </div> + {formhelp note=$plugin.description} + + <script type="text/javascript">/* <![CDATA[ */ + document.write( '<div class="formhelp" id="{$plugin.plugin_guid}" style="display:none;">' ); + /* ]]> */</script> + + <dl> + {foreach from=$plugin.menu_types item=menu_type} + <dt>{$menu_type.label}</dt><dd>{$menu_type.note}</dd> + {/foreach} + </dl> + + <script type="text/javascript">/* <![CDATA[ */ + document.write( '</div>' ); + /* ]]> */</script> + + {if !$smarty.foreach.foo.last} + <hr /> + {/if} + {/if} + {/foreach} + {/forminput} + </div> + + <div class="row submit"> + <input type="submit" name="store_menu" value="Save Settings" /> + </div> + {/form} - <div class="row submit"> - <input type="submit" name="store_pos" value="Save Settings" /> - </div> - {/form} + {if $has_horizontal_menu} + {form legend="Top Bar Menu Position"} + <div class="row"> + {formlabel label="Position" for="nexus_top_bar"} + {forminput} + <select name="nexus_top_bar" id="nexus_top_bar"> + <option value="right" {if $gBitSystem->getConfig('nexus_top_bar') eq 'right' }selected="selected"{/if}>{tr}To the right of the bitweaver menu{/tr}</option> + <option value="left" {if $gBitSystem->getConfig('nexus_top_bar') eq 'left' }selected="selected"{/if}>{tr}To the left of the bitweaver menu{/tr}</option> + <option value="replace" {if $gBitSystem->getConfig('nexus_top_bar') eq 'replace'}selected="selected"{/if}>{tr}Replace the bitweaver menu{/tr}</option> + </select> + {formhelp note="Here you can set the position of where your custom top bar menu should be. This setting is only used when you are using a horizontal suckerfish menu."} + {/forminput} + </div> - {legend legend="Menu Cache"} - <div class="row"> - {formlabel label="Menu Cache" for=""} - {forminput} - {smartlink ititle="Rewrite Menu Cache" action=rewrite_cache} - {formhelp note="This will remove any old files in the nexus menu cache directory and rewrite any exiting menus. Useful when you have renamed menus."} - {/forminput} - </div> - {/legend} - {/jstab} - {/jstabs} + <div class="row submit"> + <input type="submit" name="store_pos" value="Save Settings" /> + </div> + {/form} + {/if} <table class="data" summary="{tr}List of menus that can be used on this site{/tr}"> <caption>{tr}Existing menus{/tr}</caption> |
