mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
use new api for preferences
This commit is contained in:
parent
f94aa623db
commit
fa9cd4766f
@ -5,11 +5,14 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <rb@stylite.de>
|
* @author Ralf Becker <rb@stylite.de>
|
||||||
* @package admin
|
* @package admin
|
||||||
* @copyright (c) 2013 by Ralf Becker <rb@stylite.de>
|
* @copyright (c) 2013-16 by Ralf Becker <rb@stylite.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferences ACL
|
* Preferences ACL
|
||||||
*
|
*
|
||||||
@ -19,8 +22,8 @@ class preferences_acl extends admin_acl
|
|||||||
{
|
{
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
translation::add_app('admin');
|
Api\Translation::add_app('admin');
|
||||||
egw_framework::includeCSS('admin', 'app');
|
Framework::includeCSS('admin', 'app');
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,11 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference UI extends Admin class to give regular users restricted
|
* Preference UI extends Admin class to give regular users restricted
|
||||||
* access to modify categories
|
* access to modify Api\Categories
|
||||||
*/
|
*/
|
||||||
class preferences_categories_ui extends admin_categories {
|
class preferences_categories_ui extends admin_categories {
|
||||||
|
|
||||||
@ -22,14 +24,17 @@ class preferences_categories_ui extends admin_categories {
|
|||||||
protected $edit_link = 'preferences.preferences_categories_ui.edit';
|
protected $edit_link = 'preferences.preferences_categories_ui.edit';
|
||||||
protected $add_link = 'preferences.preferences_categories_ui.edit';
|
protected $add_link = 'preferences.preferences_categories_ui.edit';
|
||||||
|
|
||||||
function __construct() {
|
function __construct()
|
||||||
egw_framework::includeCSS('/admin/templates/default/app.css');
|
{
|
||||||
|
if (false) parent::__construct (); // parent constructor explicitly not called!
|
||||||
|
|
||||||
|
Framework::includeCSS('/admin/templates/default/app.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_rows(&$query, &$rows, &$readonlys) {
|
public function get_rows(&$query, &$rows, &$readonlys)
|
||||||
|
{
|
||||||
$count = parent::get_rows($query, $rows, $readonlys);
|
$count = parent::get_rows($query, $rows, $readonlys);
|
||||||
$rows['edit_link'] = 'preferences.preferences_categories_ui.edit';
|
$rows['edit_link'] = 'preferences.preferences_categories_ui.edit';
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
use EGroupware\Api\Egw;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static hooks for preferences class
|
* Static hooks for preferences class
|
||||||
*/
|
*/
|
||||||
@ -35,9 +39,9 @@ class preferences_hooks
|
|||||||
|
|
||||||
if (!$hook_data['setup'])
|
if (!$hook_data['setup'])
|
||||||
{
|
{
|
||||||
$langs = translation::get_installed_langs();
|
$langs = Api\Translation::get_installed_langs();
|
||||||
|
|
||||||
$tzs = egw_time::getTimezones();
|
$tzs = Api\DateTime::getTimezones();
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_formats = array(
|
$date_formats = array(
|
||||||
@ -67,7 +71,7 @@ class preferences_hooks
|
|||||||
'br' => lang('br')
|
'br' => lang('br')
|
||||||
);
|
);
|
||||||
|
|
||||||
$rich_text_editor_skins = egw_ckeditor_config::getAvailableCKEditorSkins();
|
$rich_text_editor_skins = Api\Html\CkEditorConfig::getAvailableCKEditorSkins();
|
||||||
|
|
||||||
$account_sels = array(
|
$account_sels = array(
|
||||||
'selectbox' => lang('Selectbox'),
|
'selectbox' => lang('Selectbox'),
|
||||||
@ -103,12 +107,12 @@ class preferences_hooks
|
|||||||
{
|
{
|
||||||
if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
|
if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
|
||||||
{
|
{
|
||||||
egw_ckeditor_config::font_size_from_prefs($prefs->{$type}, $prefs->{$type}['common']['rte_font_size'],
|
Api\Html\CkEditorConfig::font_size_from_prefs($prefs->{$type}, $prefs->{$type}['common']['rte_font_size'],
|
||||||
$prefs->{$type}['common']['rte_font_unit']);
|
$prefs->{$type}['common']['rte_font_unit']);
|
||||||
$prefs->save_repository(false, $type);
|
$prefs->save_repository(false, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
egw_ckeditor_config::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
|
Api\Html\CkEditorConfig::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
|
||||||
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'],
|
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'],
|
||||||
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit']);
|
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit']);
|
||||||
}
|
}
|
||||||
@ -132,7 +136,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Interface/Template Selection',
|
'label' => 'Interface/Template Selection',
|
||||||
'name' => 'template_set',
|
'name' => 'template_set',
|
||||||
'values' => egw_framework::list_templates(),
|
'values' => Framework::list_templates(),
|
||||||
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
|
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
@ -253,7 +257,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Country',
|
'label' => 'Country',
|
||||||
'name' => 'country',
|
'name' => 'country',
|
||||||
'values' => ExecMethod('phpgwapi.country.countries'),
|
'values' => Api\Country::countries(),
|
||||||
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
@ -329,7 +333,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Charset for the CSV export/import',
|
'label' => 'Charset for the CSV export/import',
|
||||||
'name' => 'csv_charset',
|
'name' => 'csv_charset',
|
||||||
'values' => translation::get_installed_charsets(),
|
'values' => Api\Translation::get_installed_charsets(),
|
||||||
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
|
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -343,7 +347,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Default font',
|
'label' => 'Default font',
|
||||||
'name' => 'rte_font',
|
'name' => 'rte_font',
|
||||||
'values' => egw_ckeditor_config::$font_options,
|
'values' => Api\Html\CkEditorConfig::$font_options,
|
||||||
'help' => 'Automatically start with this font',
|
'help' => 'Automatically start with this font',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -353,7 +357,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Font size unit',
|
'label' => 'Font size unit',
|
||||||
'name' => 'rte_font_unit',
|
'name' => 'rte_font_unit',
|
||||||
'values' => array_map('lang', egw_ckeditor_config::$font_unit_options),
|
'values' => array_map('lang', Api\Html\CkEditorConfig::$font_unit_options),
|
||||||
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.',
|
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.',
|
||||||
'default'=> 'pt',
|
'default'=> 'pt',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
@ -364,7 +368,7 @@ class preferences_hooks
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Default font size',
|
'label' => 'Default font size',
|
||||||
'name' => 'rte_font_size',
|
'name' => 'rte_font_size',
|
||||||
'values' => egw_ckeditor_config::$font_size_options,
|
'values' => Api\Html\CkEditorConfig::$font_size_options,
|
||||||
'help' => 'Automatically start with this font size',
|
'help' => 'Automatically start with this font size',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -460,7 +464,7 @@ class preferences_hooks
|
|||||||
unset($args); // unused, but required by function signature
|
unset($args); // unused, but required by function signature
|
||||||
$appname = 'preferences';
|
$appname = 'preferences';
|
||||||
$file = Array(
|
$file = Array(
|
||||||
'Site configuration' => egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'),
|
'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'),
|
||||||
);
|
);
|
||||||
display_section($appname, $file);
|
display_section($appname, $file);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
use EGroupware\Api\Etemplate;
|
||||||
|
|
||||||
class preferences_password
|
class preferences_password
|
||||||
{
|
{
|
||||||
var $public_functions = array(
|
var $public_functions = array(
|
||||||
@ -25,7 +29,7 @@ class preferences_password
|
|||||||
{
|
{
|
||||||
if ($GLOBALS['egw']->acl->check('nopasswordchange', 1))
|
if ($GLOBALS['egw']->acl->check('nopasswordchange', 1))
|
||||||
{
|
{
|
||||||
egw_framework::window_close('There was no password change!');
|
Framework::window_close('There was no password change!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($content))
|
if (!is_array($content))
|
||||||
@ -38,19 +42,19 @@ class preferences_password
|
|||||||
{
|
{
|
||||||
if (($errors = self::do_change($content['o_passwd_2'], $content['n_passwd'], $content['n_passwd_2'])))
|
if (($errors = self::do_change($content['o_passwd_2'], $content['n_passwd'], $content['n_passwd_2'])))
|
||||||
{
|
{
|
||||||
egw_framework::message(implode("\n", $errors), 'error');
|
Framework::message(implode("\n", $errors), 'error');
|
||||||
$content = array();
|
$content = array();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
egw_framework::refresh_opener(lang('Password changed'), 'preferences');
|
Framework::refresh_opener(lang('Password changed'), 'preferences');
|
||||||
egw_framework::window_close();
|
Framework::window_close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
|
||||||
$tmpl = new etemplate_new('preferences.password');
|
$tmpl = new Etemplate('preferences.password');
|
||||||
|
|
||||||
$tmpl->exec('preferences.preferences_password.change', $content,array(),array(),array(),2);
|
$tmpl->exec('preferences.preferences_password.change', $content,array(),array(),array(),2);
|
||||||
}
|
}
|
||||||
@ -67,7 +71,7 @@ class preferences_password
|
|||||||
{
|
{
|
||||||
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'preferences')
|
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'preferences')
|
||||||
{
|
{
|
||||||
translation::add_app('preferences');
|
Api\Translation::add_app('preferences');
|
||||||
}
|
}
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
|
@ -5,13 +5,19 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <rb@stylite.de>
|
* @author Ralf Becker <rb@stylite.de>
|
||||||
* @package preferences
|
* @package preferences
|
||||||
* @copyright (c) 2013-14 by Ralf Becker <rb@stylite.de>
|
* @copyright (c) 2013-16 by Ralf Becker <rb@stylite.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
use EGroupware\Api\Framework;
|
||||||
|
use EGroupware\Api\Egw;
|
||||||
|
use EGroupware\Api\Vfs;
|
||||||
|
use EGroupware\Api\Etemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for settings / preferences
|
* UI for settings / Api\Preferences
|
||||||
*/
|
*/
|
||||||
class preferences_settings
|
class preferences_settings
|
||||||
{
|
{
|
||||||
@ -41,7 +47,7 @@ class preferences_settings
|
|||||||
*/
|
*/
|
||||||
function index(array $content=null, $msg='')
|
function index(array $content=null, $msg='')
|
||||||
{
|
{
|
||||||
$tpl = new etemplate_new('preferences.settings');
|
$tpl = new Etemplate('preferences.settings');
|
||||||
if (!is_array($content))
|
if (!is_array($content))
|
||||||
{
|
{
|
||||||
$appname = isset($_GET['appname']) && $_GET['appname'] != 'preferences' &&
|
$appname = isset($_GET['appname']) && $_GET['appname'] != 'preferences' &&
|
||||||
@ -71,7 +77,7 @@ class preferences_settings
|
|||||||
// check if user has rights to store preferences for $type and $account_id
|
// check if user has rights to store preferences for $type and $account_id
|
||||||
if ($content['old_type'] !== 'user' && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
if ($content['old_type'] !== 'user' && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||||
{
|
{
|
||||||
throw new egw_exception_no_permission_admin;
|
throw new Api\Exception\NoPermission\Admin;
|
||||||
}
|
}
|
||||||
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
|
||||||
@ -111,17 +117,17 @@ class preferences_settings
|
|||||||
//error_log(__METHOD__."() ".__LINE__.": old_values=".array2string($old_values).", new_values=".array2string($new_values));
|
//error_log(__METHOD__."() ".__LINE__.": old_values=".array2string($old_values).", new_values=".array2string($new_values));
|
||||||
if ($old_values != $new_values)
|
if ($old_values != $new_values)
|
||||||
{
|
{
|
||||||
egw_framework::refresh_opener($msg, null, null, null, null, null, null, $msg_type);
|
Framework::refresh_opener($msg, null, null, null, null, null, null, $msg_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// update client-side preferences in response
|
// update client-side Api\Preferences in response
|
||||||
egw_framework::ajax_get_preference($appname);
|
Framework::ajax_get_preference($appname);
|
||||||
}
|
}
|
||||||
if (in_array($button, array('save','cancel')))
|
if (in_array($button, array('save','cancel')))
|
||||||
{
|
{
|
||||||
egw_json_response::get()->call('egw.message', $msg, $msg_type);
|
Api\Json\Response::get()->call('egw.message', $msg, $msg_type);
|
||||||
egw_framework::window_close();
|
Framework::window_close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$appname = $content['appname'] ? $content['appname'] : 'common';
|
$appname = $content['appname'] ? $content['appname'] : 'common';
|
||||||
@ -144,7 +150,7 @@ class preferences_settings
|
|||||||
$preserve['current_app'] = $content['current_app'];
|
$preserve['current_app'] = $content['current_app'];
|
||||||
$GLOBALS['egw_info']['flags']['currentapp'] = $content['current_app'] == 'common' ?
|
$GLOBALS['egw_info']['flags']['currentapp'] = $content['current_app'] == 'common' ?
|
||||||
'preferences' : $content['current_app'];
|
'preferences' : $content['current_app'];
|
||||||
egw_framework::includeCSS('preferences','app');
|
Framework::includeCSS('preferences','app');
|
||||||
|
|
||||||
// if not just saved, call validation before, to be able to show failed validation of current prefs
|
// if not just saved, call validation before, to be able to show failed validation of current prefs
|
||||||
if (!isset($button))
|
if (!isset($button))
|
||||||
@ -160,7 +166,7 @@ class preferences_settings
|
|||||||
$preserve['type'] = $preserve['old_type'] = $data['type'];
|
$preserve['type'] = $preserve['old_type'] = $data['type'];
|
||||||
if (isset($old_tab)) $data['tabs'] = $old_tab;
|
if (isset($old_tab)) $data['tabs'] = $old_tab;
|
||||||
|
|
||||||
if ($msg) egw_framework::message($msg, $msg_type ? $msg_type : 'error');
|
if ($msg) Framework::message($msg, $msg_type ? $msg_type : 'error');
|
||||||
|
|
||||||
$tpl->exec('preferences.preferences_settings.index', $data, $sel_options, $readonlys, $preserve, 2);
|
$tpl->exec('preferences.preferences_settings.index', $data, $sel_options, $readonlys, $preserve, 2);
|
||||||
}
|
}
|
||||||
@ -209,7 +215,7 @@ class preferences_settings
|
|||||||
}
|
}
|
||||||
elseif ($types[$var] == 'vfs_file')
|
elseif ($types[$var] == 'vfs_file')
|
||||||
{
|
{
|
||||||
if ($value[0] != '/' || !egw_vfs::stat($value) || egw_vfs::is_dir($value))
|
if ($value[0] != '/' || !Vfs::stat($value) || Vfs::is_dir($value))
|
||||||
{
|
{
|
||||||
$error = lang('%1 is no existing vfs file!',htmlspecialchars($value));
|
$error = lang('%1 is no existing vfs file!',htmlspecialchars($value));
|
||||||
}
|
}
|
||||||
@ -221,7 +227,7 @@ class preferences_settings
|
|||||||
foreach($types[$var] == 'vfs_dir' ? array($value) : preg_split('/[,\s]+\//', $value) as $n => $dir)
|
foreach($types[$var] == 'vfs_dir' ? array($value) : preg_split('/[,\s]+\//', $value) as $n => $dir)
|
||||||
{
|
{
|
||||||
if ($n) $dir = '/'.$dir; // re-adding trailing slash removed by split
|
if ($n) $dir = '/'.$dir; // re-adding trailing slash removed by split
|
||||||
if ($dir[0] != '/' || !egw_vfs::stat($dir) || !egw_vfs::is_dir($dir))
|
if ($dir[0] != '/' || !Vfs::stat($dir) || !Vfs::is_dir($dir))
|
||||||
{
|
{
|
||||||
$error .= ($error ? ' ' : '').lang('%1 is no existing vfs directory!',$dir);
|
$error .= ($error ? ' ' : '').lang('%1 is no existing vfs directory!',$dir);
|
||||||
}
|
}
|
||||||
@ -255,7 +261,7 @@ class preferences_settings
|
|||||||
// if you return something else than False, it is treated as an error-msg and
|
// if you return something else than False, it is treated as an error-msg and
|
||||||
// displayed to the user (the prefs are not saved)
|
// displayed to the user (the prefs are not saved)
|
||||||
//
|
//
|
||||||
if(($error .= $GLOBALS['egw']->hooks->single(array(
|
if(($error .= Api\Hooks::single(array(
|
||||||
'location' => 'verify_settings',
|
'location' => 'verify_settings',
|
||||||
'prefs' => &$repository[$appname],
|
'prefs' => &$repository[$appname],
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
@ -272,7 +278,7 @@ class preferences_settings
|
|||||||
// certain common prefs (language, template, ...) require the session to be re-created
|
// certain common prefs (language, template, ...) require the session to be re-created
|
||||||
if ($appname == 'common' && !$only_verify)
|
if ($appname == 'common' && !$only_verify)
|
||||||
{
|
{
|
||||||
egw::invalidate_session_cache();
|
Egw::invalidate_session_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -287,14 +293,14 @@ class preferences_settings
|
|||||||
* @param array &$readonlys
|
* @param array &$readonlys
|
||||||
* @param array &$types on return setting-name => setting-type
|
* @param array &$types on return setting-name => setting-type
|
||||||
* @param etemplate $tpl
|
* @param etemplate $tpl
|
||||||
* @throws egw_exception_wrong_parameter
|
* @throws Api\Exception\WrongParameter
|
||||||
* @return array content
|
* @return array content
|
||||||
*/
|
*/
|
||||||
function get_content($appname, $type, &$sel_options, &$readonlys, &$types, $tpl)
|
function get_content($appname, $type, &$sel_options, &$readonlys, &$types, $tpl)
|
||||||
{
|
{
|
||||||
if (!$this->call_hook($appname, $type, $GLOBALS['egw']->preferences->get_account_id()))
|
if (!$this->call_hook($appname, $type, $GLOBALS['egw']->preferences->get_account_id()))
|
||||||
{
|
{
|
||||||
throw new egw_exception_wrong_parameter("Could not find settings for application: ".$appname);
|
throw new Api\Exception\WrongParameter("Could not find settings for application: ".$appname);
|
||||||
}
|
}
|
||||||
$attribute = $type == 'group' ? 'user' : $type;
|
$attribute = $type == 'group' ? 'user' : $type;
|
||||||
//error_log(__METHOD__."('$appname', '$type' ) attribute='$attribute', preferences->account_id=".$GLOBALS['egw']->preferences->get_account_id());
|
//error_log(__METHOD__."('$appname', '$type' ) attribute='$attribute', preferences->account_id=".$GLOBALS['egw']->preferences->get_account_id());
|
||||||
@ -454,7 +460,7 @@ class preferences_settings
|
|||||||
|
|
||||||
$content['appname'] = $appname;
|
$content['appname'] = $appname;
|
||||||
$sel_options['appname'] = array();
|
$sel_options['appname'] = array();
|
||||||
foreach($GLOBALS['egw']->hooks->hook_implemented('settings') as $app)
|
foreach(Api\Hooks::implemented('settings') as $app)
|
||||||
{
|
{
|
||||||
if ($app != 'preferences' && $GLOBALS['egw_info']['user']['apps'][$app])
|
if ($app != 'preferences' && $GLOBALS['egw_info']['user']['apps'][$app])
|
||||||
{
|
{
|
||||||
@ -474,7 +480,7 @@ class preferences_settings
|
|||||||
if (($id = $GLOBALS['egw']->preferences->get_account_id()) != $GLOBALS['egw_info']['user']['account_id'])
|
if (($id = $GLOBALS['egw']->preferences->get_account_id()) != $GLOBALS['egw_info']['user']['account_id'])
|
||||||
{
|
{
|
||||||
$content['type'] .= ':'.$id;
|
$content['type'] .= ':'.$id;
|
||||||
$sel_options['type'][$content['type']] = common::grab_owner_name($GLOBALS['egw']->preferences->account_id);
|
$sel_options['type'][$content['type']] = Api\Accounts::username($GLOBALS['egw']->preferences->account_id);
|
||||||
|
|
||||||
// Restrict app list to apps the user has access to
|
// Restrict app list to apps the user has access to
|
||||||
$user_apps = $GLOBALS['egw']->acl->get_user_applications($id);
|
$user_apps = $GLOBALS['egw']->acl->get_user_applications($id);
|
||||||
@ -482,7 +488,7 @@ class preferences_settings
|
|||||||
}
|
}
|
||||||
foreach($GLOBALS['egw']->accounts->search(array('type' => 'groups', 'order' => 'account_lid')) as $account_id => $group)
|
foreach($GLOBALS['egw']->accounts->search(array('type' => 'groups', 'order' => 'account_lid')) as $account_id => $group)
|
||||||
{
|
{
|
||||||
$sel_options['type']['group:'.$account_id] = lang('Preferences').' '.common::display_fullname($group['account_lid'], '', '', $account_id);
|
$sel_options['type']['group:'.$account_id] = lang('Preferences').' '.Api\Accounts::format_username($group['account_lid'], '', '', $account_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -554,13 +560,13 @@ class preferences_settings
|
|||||||
|
|
||||||
// Set framework here to make sure we get the right settings for user's [newly] selected template
|
// Set framework here to make sure we get the right settings for user's [newly] selected template
|
||||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw']->preferences->data['common']['template_set'];
|
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw']->preferences->data['common']['template_set'];
|
||||||
translation::add_app($this->appname);
|
Api\Translation::add_app($this->appname);
|
||||||
if($this->appname != 'preferences')
|
if($this->appname != 'preferences')
|
||||||
{
|
{
|
||||||
translation::add_app('preferences'); // we need the prefs translations too
|
Api\Translation::add_app('preferences'); // we need the prefs translations too
|
||||||
}
|
}
|
||||||
|
|
||||||
// make type available, to hooks from applications can use it, eg. activesync
|
// make type available, to hooks from Egw\Applications can use it, eg. activesync
|
||||||
$hook_data = array(
|
$hook_data = array(
|
||||||
'location' => 'settings',
|
'location' => 'settings',
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
@ -569,7 +575,7 @@ class preferences_settings
|
|||||||
$GLOBALS['type'] = $type; // old global variable
|
$GLOBALS['type'] = $type; // old global variable
|
||||||
|
|
||||||
// calling app specific settings hook
|
// calling app specific settings hook
|
||||||
$settings = $GLOBALS['egw']->hooks->single($hook_data, $this->appname);
|
$settings = Api\Hooks::single($hook_data, $this->appname);
|
||||||
// it either returns the settings or save it in $GLOBALS['settings'] (deprecated!)
|
// it either returns the settings or save it in $GLOBALS['settings'] (deprecated!)
|
||||||
if (isset($settings) && is_array($settings) && $settings)
|
if (isset($settings) && is_array($settings) && $settings)
|
||||||
{
|
{
|
||||||
@ -586,7 +592,7 @@ class preferences_settings
|
|||||||
|
|
||||||
// calling settings hook all apps can answer (for a specific app)
|
// calling settings hook all apps can answer (for a specific app)
|
||||||
$hook_data['location'] = 'settings_'.$this->appname;
|
$hook_data['location'] = 'settings_'.$this->appname;
|
||||||
foreach($GLOBALS['egw']->hooks->process($hook_data, $this->appname,true) as $settings)
|
foreach(Api\Hooks::process($hook_data, $this->appname,true) as $settings)
|
||||||
{
|
{
|
||||||
if (isset($settings) && is_array($settings) && $settings)
|
if (isset($settings) && is_array($settings) && $settings)
|
||||||
{
|
{
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* EGroupware - eTemplates for Application preferences
|
|
||||||
* http://www.egroupware.org
|
|
||||||
* generated by soetemplate::dump4setup() 2013-05-15 11:42
|
|
||||||
*
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
||||||
* @package preferences
|
|
||||||
* @subpackage setup
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
$templ_version=1;
|
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'preferences.settings','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:5:{i:0;a:3:{s:4:"name";s:3:"msg";s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";}i:1;a:4:{s:8:"onchange";s:1:"1";s:5:"class";s:8:"prefType";s:4:"name";s:4:"type";s:4:"type";s:6:"select";}i:2;a:5:{s:8:"onchange";s:1:"1";s:5:"class";s:7:"prefApp";s:4:"name";s:7:"appname";s:4:"size";s:18:"Common preferences";s:4:"type";s:6:"select";}i:3;a:3:{s:4:"name";s:30:"tabs=preferences.settings.tab1";s:4:"type";s:3:"tab";s:5:"label";s:8:"Settings";}i:4;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"type";s:6:"button";}i:2;a:3:{s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"type";s:6:"button";}i:3;a:3:{s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"type";s:6:"button";}}}','size' => '','style' => '','modified' => '1368610928',);
|
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'preferences.settings.tab1','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"name";s:4:"tab1";s:4:"data";a:2:{i:0;a:2:{s:1:"A";s:3:"50%";s:2:"c1";s:7:"prefRow";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";s:4:"span";s:9:",prefName";i:1;a:3:{s:3:"for";s:13:"@${row}[name]";s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}i:2;a:3:{s:4:"name";s:12:"${row}[help]";s:4:"type";s:4:"html";s:4:"span";s:9:",prefHelp";}}s:1:"B";a:4:{s:4:"type";s:3:"box";s:4:"size";s:1:"2";i:1;a:6:{s:4:"type";s:13:"@${row}[type]";s:8:"onchange";s:17:"@${row}[onchange]";s:4:"size";s:13:"@${row}[size]";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"@${row}[name]";s:4:"span";s:10:",prefValue";}i:2;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:15:"${row}[default]";s:4:"type";s:5:"label";s:4:"span";s:12:",prefDefault";}}}}s:4:"cols";i:2;s:4:"rows";i:1;s:4:"size";s:33:"100%,,,prefTable egwGridView_grid";s:7:"options";a:2:{i:3;s:26:"prefTable egwGridView_grid";i:0;s:4:"100%";}}}','size' => '100%,,,prefTable egwGridView_grid','style' => '','modified' => '1368610894',);
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
$setup_info['preferences']['name'] = 'preferences';
|
$setup_info['preferences']['name'] = 'preferences';
|
||||||
$setup_info['preferences']['title'] = 'Preferences';
|
$setup_info['preferences']['title'] = 'Preferences';
|
||||||
$setup_info['preferences']['version'] = '14.1';
|
$setup_info['preferences']['version'] = '16.1';
|
||||||
$setup_info['preferences']['app_order'] = 1;
|
$setup_info['preferences']['app_order'] = 1;
|
||||||
$setup_info['preferences']['tables'] = '';
|
$setup_info['preferences']['tables'] = '';
|
||||||
$setup_info['preferences']['enable'] = 2;
|
$setup_info['preferences']['enable'] = 2;
|
||||||
@ -33,10 +33,6 @@ $setup_info['preferences']['hooks']['deny_cats'] = 'preferences_hooks::deny_
|
|||||||
|
|
||||||
/* Dependencies for this app to work */
|
/* Dependencies for this app to work */
|
||||||
$setup_info['preferences']['depends'][] = array(
|
$setup_info['preferences']['depends'][] = array(
|
||||||
'appname' => 'phpgwapi',
|
'appname' => 'api',
|
||||||
'versions' => Array('14.1')
|
'versions' => Array('16.1')
|
||||||
);
|
|
||||||
$setup_info['preferences']['depends'][] = array(
|
|
||||||
'appname' => 'etemplate',
|
|
||||||
'versions' => Array('14.1')
|
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user