- implemented limited support for sidebox options in preferences

- opening import/export dialogs as popups, as they use egw window.close()
This commit is contained in:
Ralf Becker 2010-07-08 08:11:44 +00:00
parent f3017cdeba
commit 1c7e2f6e27
2 changed files with 133 additions and 130 deletions

View File

@ -24,16 +24,18 @@ class importexport_admin_prefs_sidebox_hooks
if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
{ {
$file = array( $file = array(
'Import'=> array( array(
'text' => 'Import', 'text' => 'Import',
'link' => $GLOBALS['egw']->link('/index.php','menuaction=importexport.importexport_import_ui.import_dialog'), 'link' => "javascript:egw_openWindowCentered2('".
'target' => 'new', egw::link('/index.php','menuaction=importexport.importexport_import_ui.import_dialog',false).
"','_blank',850,440,'yes')",
'icon' => 'import' 'icon' => 'import'
), ),
'Export'=> array( array(
'text' => 'Export', 'text' => 'Export',
'link' => $GLOBALS['egw']->link('/index.php','menuaction=importexport.importexport_export_ui.export_dialog'), 'link' => "javascript:egw_openWindowCentered2('".
'target' => 'new', egw::link('/index.php','menuaction=importexport.importexport_export_ui.export_dialog',false).
"','_blank',850,440,'yes')",
'icon' => 'export' 'icon' => 'export'
), ),
); );
@ -50,11 +52,11 @@ class importexport_admin_prefs_sidebox_hooks
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
{ {
$file = Array( $file = Array(
'Import definitions' => $GLOBALS['egw']->link('/index.php','menuaction=importexport.importexport_definitions_ui.import_definition'), 'Import definitions' => egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.import_definition'),
'Define imports|exports' => $GLOBALS['egw']->link('/index.php',array( 'Define imports|exports' => egw::link('/index.php',array(
'menuaction' => 'importexport.importexport_definitions_ui.index', 'menuaction' => 'importexport.importexport_definitions_ui.index',
)), )),
'Schedule' => $GLOBALS['egw']->link('/index.php', array( 'Schedule' => egw::link('/index.php', array(
'menuaction' => 'importexport.importexport_schedule_ui.index' 'menuaction' => 'importexport.importexport_schedule_ui.index'
)), )),
); );

View File

@ -1,142 +1,143 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - preferences * * EGroupware preferences
* http://www.egroupware.org * *
* Written by Joseph Engo <jengo@phpgroupware.org> * * @package preferences
* -------------------------------------------- * * @link http://www.egroupware.org
* This program is free software; you can redistribute it and/or modify it * * @author Joseph Engo <jengo@phpgroupware.org>
* under the terms of the GNU General Public License as published by the * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\**************************************************************************/
/* $Id$ */ $GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'preferences',
'disable_Template_class' => True,
),
);
include('../header.inc.php');
$GLOBALS['egw_info'] = array( $pref_tpl =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
'flags' => array( $templates = Array(
'currentapp' => 'preferences', 'pref' => 'index.tpl'
'disable_Template_class' => True, );
),
$pref_tpl->set_file($templates);
$pref_tpl->set_block('pref','list');
$pref_tpl->set_block('pref','app_row');
$pref_tpl->set_block('pref','app_row_noicon');
$pref_tpl->set_block('pref','link_row');
$pref_tpl->set_block('pref','spacer_row');
if ($GLOBALS['egw']->acl->check('run',1,'admin'))
{
// This is where we will keep track of our position.
// Developers won't have to pass around a variable then
$session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
if (! is_array($session_data))
{
$session_data = array('type' => 'user');
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
}
if (! $_GET['type'])
{
$type = $session_data['type'];
}
else
{
$type = $_GET['type'];
$session_data = array('type' => $type);
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
}
$tabs[] = array(
'label' => lang('Your preferences'),
'link' => egw::link('/preferences/index.php','type=user')
); );
include('../header.inc.php'); $tabs[] = array(
'label' => lang('Default preferences'),
$pref_tpl =& CreateObject('phpgwapi.Template',EGW_APP_TPL); 'link' => egw::link('/preferences/index.php','type=default')
$templates = Array( );
'pref' => 'index.tpl' $tabs[] = array(
'label' => lang('Forced preferences'),
'link' => egw::link('/preferences/index.php','type=forced')
); );
$pref_tpl->set_file($templates); switch($type)
$pref_tpl->set_block('pref','list');
$pref_tpl->set_block('pref','app_row');
$pref_tpl->set_block('pref','app_row_noicon');
$pref_tpl->set_block('pref','link_row');
$pref_tpl->set_block('pref','spacer_row');
if ($GLOBALS['egw']->acl->check('run',1,'admin'))
{ {
// This is where we will keep track of our position. case 'user': $selected = 0; break;
// Developers won't have to pass around a variable then case 'default': $selected = 1; break;
$session_data = $GLOBALS['egw']->session->appsession('session_data','preferences'); case 'forced': $selected = 2; break;
}
$pref_tpl->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected));
}
if (! is_array($session_data)) // This func called by the includes to dump a row header
{ function section_start($appname='',$icon='')
$session_data = array('type' => 'user'); {
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data); global $pref_tpl;
}
if (! $_GET['type']) $pref_tpl->set_var('a_name',$appname);
{ $pref_tpl->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
$type = $session_data['type']; $pref_tpl->set_var('app_icon',$icon);
} if ($icon)
else {
{ $pref_tpl->parse('rows','app_row',True);
$type = $_GET['type']; }
$session_data = array('type' => $type); else
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data); {
} $pref_tpl->parse('rows','app_row_noicon',True);
}
}
$tabs[] = array( function section_item($pref_link='',$pref_text='')
'label' => lang('Your preferences'), {
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=user') global $pref_tpl;
);
$tabs[] = array(
'label' => lang('Default preferences'),
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=default')
);
$tabs[] = array(
'label' => lang('Forced preferences'),
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=forced')
);
switch($type) $pref_tpl->set_var('pref_link',$pref_link);
{
case 'user': $selected = 0; break; if (strtolower($pref_text) == 'grant access' && $GLOBALS['egw_info']['server']['deny_user_grants_access'])
case 'default': $selected = 1; break; {
case 'forced': $selected = 2; break; return False;
} }
$pref_tpl->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected)); else
{
$pref_tpl->set_var('pref_text',$pref_text);
} }
// This func called by the includes to dump a row header $pref_tpl->parse('rows','link_row',True);
function section_start($appname='',$icon='') }
function section_end()
{
global $pref_tpl;
$pref_tpl->parse('rows','spacer_row',True);
}
function display_section($appname,$file,$file2=False)
{
if ($file2)
{ {
global $pref_tpl; $file = $file2;
$pref_tpl->set_var('a_name',$appname);
$pref_tpl->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
$pref_tpl->set_var('app_icon',$icon);
if ($icon)
{
$pref_tpl->parse('rows','app_row',True);
}
else
{
$pref_tpl->parse('rows','app_row_noicon',True);
}
} }
section_start($appname,$GLOBALS['egw']->common->image($appname,Array('navbar',$appname)));
function section_item($pref_link='',$pref_text='') foreach($file as $text => $url)
{ {
global $pref_tpl; if (is_array($url))
$pref_tpl->set_var('pref_link',$pref_link);
if (strtolower($pref_text) == 'grant access' && $GLOBALS['egw_info']['server']['deny_user_grants_access'])
{ {
return False; $text = $url['text'];
$url = $url['link'];
} }
else section_item($url,lang($text));
{
$pref_tpl->set_var('pref_text',$pref_text);
}
$pref_tpl->parse('rows','link_row',True);
} }
section_end();
}
function section_end() $GLOBALS['egw']->hooks->process('preferences',array('preferences'));
{ $pref_tpl->pfp('out','list');
global $pref_tpl; common::egw_footer();
$pref_tpl->parse('rows','spacer_row',True);
}
function display_section($appname,$file,$file2=False)
{
if ($file2)
{
$file = $file2;
}
section_start($appname,$GLOBALS['egw']->common->image($appname,Array('navbar',$appname)));
while(list($text,$url) = each($file))
{
section_item($url,lang($text));
}
section_end();
}
$GLOBALS['egw']->hooks->process('preferences',array('preferences'));
$pref_tpl->pfp('out','list');
$GLOBALS['egw']->common->egw_footer();
?>