diff --git a/assets/plugins/managermanager/functions/topmenu.inc.php b/assets/plugins/managermanager/functions/topmenu.inc.php
new file mode 100644
index 0000000..0ed8825
--- /dev/null
+++ b/assets/plugins/managermanager/functions/topmenu.inc.php
@@ -0,0 +1,156 @@
+array('id'=>'#limenu3','href'=>'#menu3'),
+ 'home'=>array('href'=>'index.php?a=2'),
+ 'preview'=>array('href'=>'../'),
+ 'clear cache'=>array('href'=>'index.php?a=26'),
+ 'search'=>array('href'=>'index.php?a=71'),
+ 'new resource'=>array('href'=>'index.php?a=4'),
+ 'new weblink'=>array('href'=>'index.php?a=72'),
+
+ 'elements'=>array('id'=>'#limenu5','href'=>'#menu5'),
+ 'manage elements'=>array('href'=>'index.php?a=76'),
+ 'manage files'=>array('href'=>'index.php?a=31'),
+ 'manage metatags'=>array('href'=>'index.php?a=81'),
+
+ 'modules'=>array('id'=>'#limenu9','href'=>'#menu9'),
+ 'manage modules'=>array('href'=>'index.php?a=106'),
+
+ 'security'=>array('id'=>'#limenu2','href'=>'#menu2'),
+ 'manager users'=>array('href'=>'index.php?a=75'),
+ 'web users'=>array('href'=>'index.php?a=99'),
+ 'roles'=>array('href'=>'index.php?a=86'),
+ 'manager permissions'=>array('href'=>'index.php?a=40'),
+ 'web permissions'=>array('href'=>'index.php?a=91'),
+
+ 'tools'=>array('id'=>'#limenu1-1','href'=>'#menu1-1'),
+ 'backup'=>array('href'=>'index.php?a=93'),
+ 'remove locks'=>array('href'=>'javascript:removeLocks();'),
+ 'import html'=>array('href'=>'index.php?a=95'),
+ 'export html'=>array('href'=>'index.php?a=83'),
+ 'configuration'=>array('href'=>'index.php?a=17'),
+
+ 'reports'=>array('id'=>'#limenu1-2','href'=>'#menu1-2'),
+ 'shedule'=>array('href'=>'index.php?a=70'),
+ 'system events'=>array('href'=>'index.php?a=114'),
+ 'manager actions'=>array('href'=>'index.php?a=13'),
+ 'system info'=>array('href'=>'index.php?a=53')
+);
+
+
+function renameMenu($name, $newname, $roles='') {
+ $name = strtolower($name);
+ global $mm_top_menu;
+ if (useThisRule($roles)) {
+ $output .= " // ----------- rename tab -------------- \n";
+ if((int)$name > 0) {
+ //rename module tab
+ $output .= "\$j(\"a[href='index.php?a=112&id=".$name."']\").html('".$newname."');\n";
+ }
+ else {
+ //rename tab
+ $output .= "\$j(\"a[href='".$mm_top_menu[$name]['href']."']\").html('".$newname."');\n";
+ }
+ echo ($output . "\n");
+ }
+}
+
+
+function hideMenu($names, $roles='') {
+ $name = strtolower($name);
+ global $mm_top_menu;
+ if (useThisRule($roles)) {
+ $output .= " // ----------- hide tab -------------- \n";
+ $tabsArray = explode(',',$names);
+ foreach($tabsArray as $name) {
+ if((int)$name > 0) {
+ //hide module tab
+ $output .= "\$j(\"a[href='index.php?a=112&id=".$name."']\").parent().remove();\n";
+ }
+ else {
+ //hide tab
+ $output .= "\$j(\"a[href='".$mm_top_menu[$name]['href']."']\").parent().remove();\n";
+ }
+ }
+ echo ($output . "\n");
+ }
+}
+
+function moveMenu($name, $index='', $roles='') {
+ $name = strtolower($name);
+ global $mm_top_menu;
+ (int)$index;
+ if (useThisRule($roles)) {
+ $output = " // ----------- move top tab -------------- \n";
+ if($index) {
+ $output .= "tab = \$j('".$mm_top_menu[$name]['id']."');\n";
+ $output .= "tabs = \$j('#nav').children('li');\n";
+ $output .= "tabs.eq(larry(".$index.", tabs.size())).before(tab);\n";
+ }
+ else {
+ $output .= "\$j('#nav').append(tab);\n";
+ }
+ echo ($output . "\n");
+ }
+}
+
+
+function addMenu($name,$id,$index='', $roles='') {
+ global $mm_debug;
+ (int)$index;
+ if (useThisRule($roles)) {
+ $output .= " // ----------- add top tab -------------- \n";
+ $output.="tab = \$j('
');\n";
+ if($index) {
+ $output .= "tabs = \$j('#nav').children('li');\n";
+ $output .= "tabs.eq(larry(".$index.", tabs.size())).before(tab);\n";
+
+ }
+ else {
+ $output .= "\$j('#nav').append(tab);\n";
+ }
+
+ echo ($output . "\n");
+ }
+}
+
+function addSubMenu($name,$parentTabId,$path='',$index='', $roles='') {
+ global $mm_top_menu,$mm_debug;
+ (int)$index;
+ if (useThisRule($roles)) {
+ $output .= " // ----------- add subtab -------------- \n";
+ if(in_array($parentTabId,array_keys($mm_top_menu))) {
+ $output.= "parentTab = \$j('".$mm_top_menu[$parentTabId]['id']."');\n";
+ }
+ else {
+ $output.= "parentTab = \$j('#limenu".$parentTabId."');\n";
+ }
+ $output.="tab = \$j('".$name."');\n";
+ $output.="tabs = \$j(parentTab).children('ul').children('li');\n";
+ if($mm_debug) {
+ $output .= "console.log(\"add subtab ".$name."\",tabs,tabs.length);\n";
+ }
+ if($index) {
+ $output .= "tabs.eq(larry(".$index.", tabs.length)).after(tab);\n";
+ }
+ else {
+ $output .= "\$j(tab).appendTo(parentTab.children('ul'));\n";
+ }
+
+ echo ($output . "\n");
+ }
+}
+
+
+
+
+
+
+
+
+
+
+?>
diff --git a/assets/plugins/managermanager/mm.inc.php b/assets/plugins/managermanager/mm.inc.php
index afaedcc..1a42eec 100644
--- a/assets/plugins/managermanager/mm.inc.php
+++ b/assets/plugins/managermanager/mm.inc.php
@@ -52,7 +52,7 @@
$ignore_first_chars = array('.', '_', '!');
// Include functions - we'll load all *.inc.php files in the "functions" folder
-$function_dir = $modx->config['base_path'] . 'assets/plugins/managermanager/functions';
+$function_dir = $mm_path . 'functions';
if ($handle = opendir($function_dir)) {
while (false !== ($file = readdir($handle))) {
if (!in_array(substr($file, 0, 1), $ignore_first_chars) && $file != ".." && substr($file, -8) == '.inc.php') {
@@ -66,7 +66,7 @@
// Include widgets
// We look for a PHP file with the same name as the directory - e.g.
// /widgets/widgetname/widgetname.php
-$widget_dir = $modx->config['base_path'] . 'assets/plugins/managermanager/widgets';
+$widget_dir = $mm_path . 'widgets';
if ($handle = opendir($widget_dir)) {
while (false !== ($file = readdir($handle))) {
if (!in_array(substr($file, 0, 1), $ignore_first_chars) && $file != ".." && is_dir($widget_dir.'/'.$file)) {
@@ -116,7 +116,8 @@
'which_editor' => array('fieldtype'=>'select', 'fieldname'=>'which_editor','dbname'=>'', 'tv'=>false),
'resource_type' => array('fieldtype'=>'select', 'fieldname'=>'type', 'dbname'=>'isfolder', 'tv'=>false),
'weblink' => array('fieldtype'=>'input', 'fieldname'=>'ta', 'dbname'=>'content', 'tv'=>false)
-);
+);
+
// Add in TVs to the list of available fields
@@ -169,7 +170,7 @@
function make_changes($chunk) {
global $modx; // Global modx object
- $config_file = $modx->config['base_path'] . 'assets/plugins/managermanager/mm_rules.inc.php';
+ $config_file = $mm_path . 'mm_rules.inc.php';
// See if there is any chunk output (e.g. it exists, and is not empty)
$chunk_output = $modx->getChunk($chunk);
@@ -358,7 +359,7 @@ function make_changes($chunk) {
// Where would we get the config file from?
- $config_file = $modx->config['base_path'] . 'assets/plugins/managermanager/mm_rules.inc.php';
+ $config_file = $mm_path . 'mm_rules.inc.php';
// See if there is any chunk output (e.g. it exists, and is not empty)
$chunk_output = $modx->getChunk($config_chunk);
@@ -451,8 +452,62 @@ function make_changes($chunk) {
}
break;
+//MODx manager top menu
+case 'OnManagerPageInit':
+ if($_REQUEST['f'] == 'menu') {
+ echo includeJs($js_url, 'html');
+ echo '
+
+
+
+
+
+
+';
+ }
+ break;
} // end switch
diff --git a/assets/plugins/managermanager/widgets/!template/!template.php b/assets/plugins/managermanager/widgets/!template/!template.php
index 3c817a3..59ccf98 100644
--- a/assets/plugins/managermanager/widgets/!template/!template.php
+++ b/assets/plugins/managermanager/widgets/!template/!template.php
@@ -6,7 +6,7 @@
//---------------------------------------------------------------------------------
function mm_widget_template($fields, $other_param='defaultValue', $roles='', $templates='') {
- global $modx, $content, $mm_fields;
+ global $modx, $content, $mm_fields, $mm_url;
$e = &$modx->Event;
if (useThisRule($roles, $templates)) {
@@ -42,8 +42,8 @@ function mm_widget_template($fields, $other_param='defaultValue', $roles='', $te
// We have functions to include JS or CSS external files you might need
// The standard ModX API methods don't work here
- $output .= includeJs('/assets/plugins/managermanager/widgets/template/javascript.js');
- $output .= includeCss('/assets/plugins/managermanager/widgets/template/styles.css');
+ $output .= includeJs($mm_url . 'widgets/template/javascript.js');
+ $output .= includeCss($mm_url . 'widgets/template/styles.css');
// Do something for each of the fields supplied
diff --git a/assets/plugins/managermanager/widgets/accessdenied/accessdenied.php b/assets/plugins/managermanager/widgets/accessdenied/accessdenied.php
index e668026..e66f147 100644
--- a/assets/plugins/managermanager/widgets/accessdenied/accessdenied.php
+++ b/assets/plugins/managermanager/widgets/accessdenied/accessdenied.php
@@ -8,7 +8,7 @@
//---------------------------------------------------------------------------------
function mm_widget_accessdenied($ids='', $message='', $roles='') {
- global $modx, $content;
+ global $modx, $content, $mm_url;
$e = &$modx->Event;
if (empty($message)) $message='Access deniedAccess to current document closed for security reasons.';
@@ -23,7 +23,7 @@ function mm_widget_accessdenied($ids='', $message='', $roles='') {
if (in_array($docid, $ids))
{
- $output .= includeCss($modx->config['base_url'] . 'assets/plugins/managermanager/widgets/accessdenied/accessdenied.css');
+ $output .= includeCss($mm_url . 'widgets/accessdenied/accessdenied.css');
$output .= '
$j("input, div, form[name=mutate]").remove(); // Remove all content from the page
diff --git a/assets/plugins/managermanager/widgets/colors/colors.php b/assets/plugins/managermanager/widgets/colors/colors.php
index 3a2b0e9..9419f5e 100644
--- a/assets/plugins/managermanager/widgets/colors/colors.php
+++ b/assets/plugins/managermanager/widgets/colors/colors.php
@@ -6,7 +6,7 @@
// Adds a color selection widget to the specified TVs
//---------------------------------------------------------------------------------
function mm_widget_colors($fields, $default='#ffffff', $roles='', $templates='') {
- global $modx, $content, $mm_fields;
+ global $modx, $content, $mm_fields, $mm_url;
$e = &$modx->Event;
if (useThisRule($roles, $templates)) {
@@ -33,10 +33,10 @@ function mm_widget_colors($fields, $default='#ffffff', $roles='', $templates='')
}
// Insert some JS
- $output .= includeJs($modx->config['base_url'] .'assets/plugins/managermanager/widgets/colors/farbtastic.js');
+ $output .= includeJs($mm_url .'widgets/colors/farbtastic.js');
// Insert some CSS
- $output .= includeCss($modx->config['base_url'] .'assets/plugins/managermanager/widgets/colors/farbtastic.css');
+ $output .= includeCss($mm_url .'widgets/colors/farbtastic.css');
// Go through each of the fields supplied
foreach ($fields as $tv) {
diff --git a/assets/plugins/managermanager/widgets/tags/tags.php b/assets/plugins/managermanager/widgets/tags/tags.php
index 5f844df..d9f0fd5 100644
--- a/assets/plugins/managermanager/widgets/tags/tags.php
+++ b/assets/plugins/managermanager/widgets/tags/tags.php
@@ -6,7 +6,7 @@
//---------------------------------------------------------------------------------
function mm_widget_tags($fields, $delimiter=',', $source='', $display_count=false, $roles='', $templates='') {
- global $modx, $content, $mm_fields;
+ global $modx, $content, $mm_fields, $mm_url;
$e = &$modx->Event;
if (useThisRule($roles, $templates)) {
@@ -43,9 +43,9 @@ function mm_widget_tags($fields, $delimiter=',', $source='', $display_count=fals
// Insert some JS and a style sheet into the head
- $output .= "// -------------- Tag widget include ------------- \n";
- $output .= includeJs($modx->config['base_url'] .'assets/plugins/managermanager/widgets/tags/tags.js');
- $output .= includeCss($modx->config['base_url'] .'assets/plugins/managermanager/widgets/tags/tags.css');
+ $output .= "// -------------- Tag widget include ".$mm_url."------------- \n";
+ $output .= includeJs($mm_url . 'widgets/tags/tags.js');
+ $output .= includeCss($mm_url . 'widgets/tags/tags.css');
// Go through each of the fields supplied
@@ -98,4 +98,4 @@ function mm_widget_tags($fields, $delimiter=',', $source='', $display_count=fals
}
$e->output($output . "\n");
}
-?>
\ No newline at end of file
+?>
diff --git a/plugin.txt b/plugin.txt
index 0d96995..5d28111 100644
--- a/plugin.txt
+++ b/plugin.txt
@@ -7,8 +7,8 @@
* @category plugin
* @version 0.3.9dev
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
- * @internal @properties &config_chunk=Configuration Chunk;text;mm_demo_rules; &remove_deprecated_tv_types_pref=Remove deprecated TV types;list;yes,no;yes &which_jquery=jQuery source;list;local (assets/js),remote (google code),manual url (specify below);local (assets/js) &js_src_type=jQuery URL override;text;
- * @internal @events OnDocFormRender,OnDocFormPrerender,OnPluginFormRender,OnTVFormRender
+ * @internal @properties &topmenu_config_chunk=Top Menu Configuration Chunk;text;topmenu_rules &config_chunk=Configuration Chunk;text;mm_demo_rules &remove_deprecated_tv_types_pref=Remove deprecated TV types;list;yes,no;yes &which_jquery=jQuery source;list;local (assets/js),remote (google code),manual url (specify below);local (assets/js) &js_src_type=jQuery URL override;text;
+ * @internal @events OnDocFormRender,OnDocFormPrerender,OnPluginFormRender,OnTVFormRender,OnManagerPageInit
* @internal @modx_category Manager and Admin
* @internal @legacy_names Image TV Preview, Show Image TVs
*/
@@ -37,5 +37,10 @@ $js_default_url_remote = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jque
//-------------------------------------------------------
// Run the main code
-$asset_path = $modx->config['base_path'] . 'assets/plugins/managermanager/mm.inc.php';
-include($asset_path);
+
+global $mm_url;
+
+$mm_url = $modx->config['base_url'] . 'assets/plugins/managermanager/' ;
+$mm_path = $modx->config['base_path'] . 'assets/plugins/managermanager/';
+
+include($mm_path.'mm.inc.php');