open all sidebox admin link in admin vi admin.admin_ui.index loader

This commit is contained in:
Ralf Becker 2013-10-15 16:53:43 +00:00
parent 319a503c90
commit 6e76361736
6 changed files with 66 additions and 106 deletions

View File

@ -40,6 +40,8 @@ class admin_ui
*/
public function index(array $content=null, $msg='')
{
admin_statistics::check();
$tpl = new etemplate_new('admin.index');
$content = array();
@ -101,6 +103,19 @@ class admin_ui
);
$tpl->setElementAttribute('tree', 'actions', $actions);
if (!empty($_GET['load']))
{
$vars = $_GET;
$vars['menuaction'] = $vars['load'];
unset($vars['ajax']);
unset($vars['load']);
}
else
{
$vars = array('menuaction' => 'admin.uiconfig.index', 'appname' => 'admin');
}
$content['iframe'] = egw::link('/index.php', $vars);
$tpl->exec('admin.admin_ui.index', $content, $sel_options);
}
@ -277,7 +292,14 @@ if ($app == 'felamimail') continue; // disabled fmail for now, as it break whole
if (empty($data['id']))
{
$data['id'] = $root.($app == 'admin' ? 'admin' : 'apps/'.$app).'/';
$data['id'] .= preg_match('/menuaction=([^&]+)/', $data['link'], $matches) ? $matches[1] : md5($link);
if (preg_match_all('/(menuaction|load)=([^&]+)/', $data['link'], $matches))
{
$data['id'] .= $matches[2][(int)array_search('load', $matches[1])];
}
else
{
$data['id'] .= md5($data['link']);
}
}
if (!empty($data['icon']))
{

View File

@ -10,95 +10,5 @@
* @version $Id$
*/
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'admin',
'noheader' => true,
'nonavbar' => true,
),
);
include('../header.inc.php');
admin_statistics::check();
common::egw_header();
$GLOBALS['admin_tpl'] =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
$GLOBALS['admin_tpl']->set_file(
Array(
'admin' => 'index.tpl'
)
);
$GLOBALS['admin_tpl']->set_block('admin','list');
$GLOBALS['admin_tpl']->set_block('admin','app_row');
$GLOBALS['admin_tpl']->set_block('admin','app_row_noicon');
$GLOBALS['admin_tpl']->set_block('admin','link_row');
$GLOBALS['admin_tpl']->set_block('admin','spacer_row');
$GLOBALS['admin_tpl']->set_var('title',lang('Administration'));
// This func called by the includes to dump a row header
function section_start($appname='',$icon='')
{
$GLOBALS['admin_tpl']->set_var('link_backcolor',$GLOBALS['egw_info']['theme']['row_off']);
$GLOBALS['admin_tpl']->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
$GLOBALS['admin_tpl']->set_var('a_name',$appname);
$GLOBALS['admin_tpl']->set_var('app_icon',$icon);
if ($icon)
{
$GLOBALS['admin_tpl']->parse('rows','app_row',True);
}
else
{
$GLOBALS['admin_tpl']->parse('rows','app_row_noicon',True);
}
}
function section_item($pref_link='',$pref_text='')
{
$GLOBALS['admin_tpl']->set_var('pref_link',$pref_link);
$GLOBALS['admin_tpl']->set_var('pref_text',$pref_text);
$GLOBALS['admin_tpl']->parse('rows','link_row',True);
}
function section_end()
{
$GLOBALS['admin_tpl']->parse('rows','spacer_row',True);
}
function display_section($appname,$file,$file2=False)
{
if ($file2)
{
$file = $file2;
}
if(is_array($file))
{
section_start($appname,
common::image(
$appname,
Array(
'navbar',
$appname,
'nonav'
)
)
);
while(list($text,$url) = each($file))
{
if (is_array($url)) $url = $url['link'];
// If user doesn't have application configuration access, then don't show the configuration links
if (strpos($url, 'admin.uiconfig') === False || !$GLOBALS['egw']->acl->check('site_config_access',1,'admin'))
{
section_item($url,lang($text));
}
}
section_end();
}
}
$GLOBALS['egw']->hooks->process('admin',array('admin'));
$GLOBALS['admin_tpl']->pparse('out','list');
common::egw_footer();
header('Location: ../index.php?menuaction=admin.uiconfig.index&appname=admin'.
(isset($_GET['sessionid']) ? '&sessionid='.$_GET['sessionid'].'&kp3='.$_GET['kp3'] : ''));

View File

@ -62,19 +62,13 @@ app.admin = AppJS.extend(
var iframe = this.iframe = this.et2.getWidgetById('iframe');
if (iframe)
{
iframe.set_src(egw.webserverUrl+'/admin/index.php');
var self = this;
jQuery(iframe.getDOMNode()).bind('load', function(){
self._hide_navbar.call(self);
self.splitter.dock();
});
}
var splitter = this.splitter = this.et2.getWidgetById('splitter');
if (splitter)
{
window.setTimeout(function(){
splitter.dock();
}, 1);
}
this.splitter = this.et2.getWidgetById('splitter');
},
/**
@ -85,6 +79,10 @@ app.admin = AppJS.extend(
_hide_navbar: function()
{
var document = this.iframe.getDOMNode().contentDocument;
// set white background, as transparent one lets account-list show through
document.getElementsByTagName('body')[0].style.backgroundColor = 'white';
// hide navbar elements
var ids2hide = ['divLogo', 'topmenu', 'divAppIconBar', 'divStatusBar', 'tdSidebox', 'divAppboxHeader'];
for(var i=0; i < ids2hide.length; ++i)
@ -108,6 +106,29 @@ app.admin = AppJS.extend(
this.iframe.set_src(url);
},
/**
* Link hander for jDots template to just reload our iframe, instead of reloading whole admin app
*
* @param _url
* @return boolean true, if linkHandler took care of link, false otherwise
*/
linkHandler: function(_url)
{
var matches;
if (!_url.match('menuaction=admin.admin_ui.index') ||
(matches = _url.match(/menuaction=admin.admin_ui.index.*&load=([^&]+)/)))
{
if (matches)
{
_url = _url.replace(/menuaction=admin.admin_ui.index/, 'menuaction='+matches[1]).replace(/&(ajax=true|load=[^&]+)/g, '');
}
this.iframe.set_src(_url);
return true;
}
// can not load our own index page, has to be done by framework
return false;
},
/**
* Run an admin module / onclick callback for tree
*
@ -131,7 +152,7 @@ app.admin = AppJS.extend(
else if (link[0] == '/' || link.substr(0,4) == 'http')
{
this.splitter.dock();
this.iframe.set_src(link+'&nonavbar=1');
this.iframe.set_src(link+(link.match(/\?/)?'&':'?')+'nonavbar=1');
}
else if (link.substr(0,11) == 'javascript:')
{

View File

@ -823,14 +823,13 @@ class calendar_ui
if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$menu_title = lang('Administration');
$file = Array(
'Configuration'=>egw::link('/index.php','menuaction=admin.uiconfig.index&appname=calendar'),
'Custom Fields'=>egw::link('/index.php','menuaction=admin.customfields.edit&appname=calendar'),
'Holiday Management'=>egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
'Global Categories' =>egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
);
display_sidebox($appname,$menu_title,$file);
$GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin');
}
}

View File

@ -337,8 +337,9 @@ abstract class egw_framework
* @param string $appname
* @param string $menu_title
* @param array $file
* @param string $type=null 'admin', 'preferences', 'favorites', ...
*/
abstract function sidebox($appname,$menu_title,$file);
abstract function sidebox($appname,$menu_title,$file,$type=null);
/**
* Returns the html from the closing div of the main application area to the closing html-tag

View File

@ -772,11 +772,18 @@ egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['acc
* @param string $appname
* @param string $menu_title
* @param array $file
* @param string $type=null 'admin', 'preferences', 'favorites', ...
*/
function sidebox($appname,$menu_title,$file)
function sidebox($appname,$menu_title,$file,$type=null)
{
if((!$appname || ($appname==$GLOBALS['egw_info']['flags']['currentapp'] && $file)) && is_object($this->tpl))
{
// fix app admin menus to use admin.admin_ui.index loader
if (($type == 'admin' || $menu_title == lang('Admin')) && $appname != 'admin')
{
$file = preg_replace("/^(.*)menuaction=([^&]+)(.*)$/",
'$1menuaction=admin.admin_ui.index&load=$2$3&ajax=true', $file);
}
$this->tpl->set_var('lang_title',$menu_title);
$this->sidebox_content .= $this->tpl->fp('out','extra_blocks_header');