Add save & cancel buttons, they re-direct to selected app's index

This commit is contained in:
Nathan Gray 2013-12-02 17:38:15 +00:00
parent 7e2b648590
commit b4703be700
2 changed files with 18 additions and 1 deletions

View File

@ -63,12 +63,12 @@ class preferences_settings
if ($content['button']) if ($content['button'])
{ {
list($button) = each($content['button']); list($button) = each($content['button']);
$appname = $content['old_appname'] ? $content['old_appname'] : 'common';
switch($button) switch($button)
{ {
case 'save': case 'save':
case 'apply': case 'apply':
// ToDo: save preferences // ToDo: save preferences
$appname = $content['old_appname'] ? $content['old_appname'] : 'common';
list($type,$account_id) = explode(':', $content['old_type']); list($type,$account_id) = explode(':', $content['old_type']);
// merge prefs of all tabs together again // merge prefs of all tabs together again
$prefs = array(); $prefs = array();
@ -92,6 +92,21 @@ class preferences_settings
$msg = lang('Preferences saved.'); $msg = lang('Preferences saved.');
} }
} }
if(in_array($button, array('save','cancel')))
{
if($appname != 'common')
{
egw_framework::redirect_link(
egw_framework::link('/index.php'),
egw_link::get_registry($appname, 'index')
);
}
else
{
egw_framework::window_close();
}
return;
}
} }
$appname = $content['appname'] ? $content['appname'] : 'common'; $appname = $content['appname'] ? $content['appname'] : 'common';
list($type,$account_id) = explode(':', $content['type']); list($type,$account_id) = explode(':', $content['type']);

View File

@ -36,6 +36,8 @@
<template id="preferences.settings.tab1" content="tab1"/> <template id="preferences.settings.tab1" content="tab1"/>
</tabpanels> </tabpanels>
</tabbox> </tabbox>
<button label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]"/> <button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]"/>
</template> </template>
</overlay> </overlay>