diff --git a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php index cb50301b90..495bff6393 100644 --- a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php +++ b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php @@ -31,6 +31,8 @@ class admin_prefs_sidebox_hooks */ static function all_hooks($args) { + unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); + if (!isset($_GET['menuaction']) && substr($_SERVER['PHP_SELF'],-16) == '/admin/index.php') { admin_statistics::check(); @@ -38,9 +40,21 @@ class admin_prefs_sidebox_hooks $appname = 'admin'; $location = is_array($args) ? $args['location'] : $args; + if ($location == 'sidebox_menu') + { + // Destination div for folder tree + $file[] = array( + 'no_lang' => true, + 'text' => '', + 'link' => false, + 'icon' => false + ); + display_sidebox($appname,lang('Admin'),$file); + return; + } if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'admins') { -$file['new admin'] = egw::link('/index.php', array('menuaction' => 'admin.admin_ui.index')); + if (! $GLOBALS['egw']->acl->check('site_config_access',1,'admin')) { $file['Site Configuration'] = egw::link('/index.php','menuaction=admin.uiconfig.index&appname=admin'); @@ -136,7 +150,7 @@ $file['new admin'] = egw::link('/index.php', array('menuaction' => 'admin.admin_ } else { - foreach($file as &$url) if (is_array($url)) $url = $url['link']; + foreach($file as &$url) if (is_array($url) && $url['link']) $url = $url['link']; display_sidebox($appname,lang('Admin'),$file); } } diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index 1fced1efbd..6325dcee11 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -33,10 +33,10 @@ class admin_ui */ public function index(array $content=null, $msg='') { - $tpl = new etemplate('admin.index'); + $tpl = new etemplate_new('admin.index'); $content = array(); - $content['msg'] = 'Hi Ralf ;-)'; + //$content['msg'] = 'Hi Ralf ;-)'; $sel_options['tree'] = $this->tree_data(); $tpl->exec('admin.admin_ui.index', $content, $sel_options); } @@ -106,6 +106,7 @@ class admin_ui $data['im0'] = $icon; } } + unset($data['icon']); $parent =& $tree['item']; $parts = explode('/', $data['id']); if ($data['id'][0] == '/') array_shift($parts); // remove root @@ -128,12 +129,14 @@ class admin_ui 'item' => array(), 'child' => 1, ); + if ($path == '/admin') $parent[$path]['open'] = true; } $parent =& $parent[$path]['item']; } $data['text'] = lang($data['text']); - if (!empty($data['title'])) $data['title'] = lang($data['title']); - $parent[$data['id']] = $data; + if (!empty($data['tooltip'])) $data['tooltip'] = lang($data['tooltip']); + + $parent[$data['id']] = self::fix_userdata($data); } } } @@ -153,6 +156,28 @@ class admin_ui return $tree; } + /** + * Fix userdata as understood by tree + * + * @param array $data + * @return array + */ + private static function fix_userdata(array $data) + { + // store link as userdata, maybe we should store everything not directly understood by tree this way ... + foreach(array_diff_key($data, array_flip(array( + 'id','text','tooltip','im0','im1','im2','item','child','select','open','call', + ))) as $name => $content) + { + $data['userdata'][] = array( + 'name' => $name, + 'content' => $content, + ); + unset($data[$name]); + } + return $data; + } + private static function strip_item_keys(&$items) { $items = array_values($items); @@ -177,7 +202,7 @@ class admin_ui function display_section($appname,$file,$file2=False) { admin_ui::$hook_data[$appname] = $file2 ? $file2 : $file; - error_log(__METHOD__."(".array2string(func_get_args()).")"); + //error_log(__METHOD__."(".array2string(func_get_args()).")"); } return array_merge($GLOBALS['egw']->hooks->process('admin', array('admin')), self::$hook_data); } diff --git a/admin/inc/class.uiconfig.inc.php b/admin/inc/class.uiconfig.inc.php index a2168d920f..99cac3140c 100644 --- a/admin/inc/class.uiconfig.inc.php +++ b/admin/inc/class.uiconfig.inc.php @@ -259,7 +259,7 @@ class uiconfig $t->set_var('lang_cancel', lang('Cancel')); // set currentapp to our calling app, to show the right sidebox-menu - $GLOBALS['egw_info']['flags']['currentapp'] = $show_app; +// $GLOBALS['egw_info']['flags']['currentapp'] = $show_app; // render the page $GLOBALS['egw']->framework->render( diff --git a/admin/index.php b/admin/index.php index eb7bd89bd0..0d0cbf3bdc 100755 --- a/admin/index.php +++ b/admin/index.php @@ -14,6 +14,7 @@ $GLOBALS['egw_info'] = array( 'flags' => array( 'currentapp' => 'admin', 'noheader' => true, + 'nonavbar' => true, ), ); include('../header.inc.php'); diff --git a/admin/js/app.js b/admin/js/app.js new file mode 100644 index 0000000000..30bb8d6ff8 --- /dev/null +++ b/admin/js/app.js @@ -0,0 +1,88 @@ +/** + * EGroupware - Admin - Javascript UI + * + * @link http://www.egroupware.org + * @package filemanager + * @author Ralf Becker + * @copyright (c) 2013 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +/** + * UI for Admin + * + * @augments AppJS + */ +app.admin = AppJS.extend( +{ + appname: 'admin', + /** + * et2 widget container + */ + et2: null, + + /** + * Constructor + * + * @memberOf app.filemanager + */ + init: function() + { + // call parent + this._super.apply(this, arguments); + }, + + /** + * Destructor + */ + destroy: function() + { + delete this.et2; + // call parent + this._super.apply(this, arguments); + }, + + /** + * This function is called when the etemplate2 object is loaded + * and ready. If you must store a reference to the et2 object, + * make sure to clean it up in destroy(). + * + * @param _et2 etemplate2 Newly ready object + */ + et2_ready: function(_et2) + { + // call parent + this._super.apply(this, arguments); + + this.et2 = _et2.widgetContainer; + + var iframe = this.et2.getWidgetById('admin_iframe'); + if (iframe) iframe.set_src(egw.webserverUrl+'/admin/index.php'); + }, + + /** + * Run an admin module / onclick callback for tree + * + * @param string _id id of clicked node + * @param et2_tree _widget reference to tree widget + */ + run: function(_id, _widget) + { + var link = _widget.getUserData(_id, 'link'); + var iframe = this.et2.getWidgetById('admin_iframe'); + + if (typeof link == 'undefined') + { + _widget.openItem(_id, 'toggle'); + } + else if (link[0] == '/' || link.substr(0,4) == 'http') + { + iframe.set_src(link+'&nonavbar=1'); + } + else if (link.substr(0,11) == 'javascript:') + { + eval(link.substr(11)); + } + } +}); diff --git a/admin/templates/default/app.css b/admin/templates/default/app.css new file mode 100644 index 0000000000..4e260dde07 --- /dev/null +++ b/admin/templates/default/app.css @@ -0,0 +1,21 @@ +/** + * EGroupware - CSS Styles used by admin app + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @link http://www.egroupware.org + * @author Ralf Becker + * @version $Id$ + */ + +.admin_tree table, .admin_tree tr, .admin_tree td { + border: none; +} + +div#divAppbox { + padding: 0; +} + +body { + background-image: none; +} diff --git a/admin/templates/default/index.xet b/admin/templates/default/index.xet index 11138994cc..a17e93ec95 100644 --- a/admin/templates/default/index.xet +++ b/admin/templates/default/index.xet @@ -2,8 +2,8 @@