[eGroupWare-svn] r55956 - in /trunk/preferences: inc/ lang/ setup/

[email protected] Sat, 30 Apr 2016 17:16:36 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Sat Apr 30 19:16:36 2016
New Revision: 55956

URL: http://svn.stylite.de/viewvc/egroupware?rev=55956&view=rev
Log:
use new api for preferences

Removed:
    trunk/preferences/setup/etemplates.inc.php
Modified:
    trunk/preferences/inc/class.preferences_acl.inc.php
    trunk/preferences/inc/class.preferences_categories_ui.inc.php
    trunk/preferences/inc/class.preferences_hooks.inc.php
    trunk/preferences/inc/class.preferences_password.inc.php
    trunk/preferences/inc/class.preferences_settings.inc.php
    trunk/preferences/lang/   (props changed)
    trunk/preferences/setup/setup.inc.php

Modified: trunk/preferences/inc/class.preferences_acl.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/inc/class.preferences_acl.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/inc/class.preferences_acl.inc.php (original)
+++ trunk/preferences/inc/class.preferences_acl.inc.php Sat Apr 30 19:16:36 2016
@@ -5,10 +5,13 @@
 * @link http://www.egroupware.org
 * @author Ralf Becker <[email protected]>
 * @package admin
-* @copyright (c) 2013 by Ralf Becker <[email protected]>
+* @copyright (c) 2013-16 by Ralf Becker <[email protected]>
 * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
 * @version $Id$
 */
+
+use EGroupware\Api;
+use EGroupware\Api\Framework;
 
 /**
  * Preferences ACL
@@ -19,8 +22,8 @@
 {
 	function __construct()
 	{
-		translation::add_app('admin');
-		egw_framework::includeCSS('admin', 'app');
+		Api\Translation::add_app('admin');
+		Framework::includeCSS('admin', 'app');
 
 		parent::__construct();
 	}

Modified: trunk/preferences/inc/class.preferences_categories_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/inc/class.preferences_categories_ui.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/inc/class.preferences_categories_ui.inc.php (original)
+++ trunk/preferences/inc/class.preferences_categories_ui.inc.php Sat Apr 30 19:16:36 2016
@@ -10,9 +10,11 @@
  * @version $Id$
  */
 
+use EGroupware\Api\Framework;
+
 /**
  * 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 {
 
@@ -22,14 +24,17 @@
 	protected $edit_link = 'preferences.preferences_categories_ui.edit';
 	protected $add_link = 'preferences.preferences_categories_ui.edit';
 
-	function __construct() {
-		egw_framework::includeCSS('/admin/templates/default/app.css');
+	function __construct()
+	{
+		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);
 		$rows['edit_link'] = 'preferences.preferences_categories_ui.edit';
 		return $count;
 	}
 }
-?>

Modified: trunk/preferences/inc/class.preferences_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/inc/class.preferences_hooks.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/inc/class.preferences_hooks.inc.php (original)
+++ trunk/preferences/inc/class.preferences_hooks.inc.php Sat Apr 30 19:16:36 2016
@@ -7,6 +7,10 @@
  * @package preferences
  * @version $Id$
  */
+
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Egw;
 
 /**
  * Static hooks for preferences class
@@ -35,9 +39,9 @@
 
 		if (!$hook_data['setup'])
 		{
-			$langs = translation::get_installed_langs();
-
-			$tzs = egw_time::getTimezones();
+			$langs = Api\Translation::get_installed_langs();
+
+			$tzs = Api\DateTime::getTimezones();
 		}
 
 		$date_formats = array(
@@ -67,7 +71,7 @@
 			'br'	=> lang('br')
 		);
 
-		$rich_text_editor_skins = egw_ckeditor_config::getAvailableCKEditorSkins();
+		$rich_text_editor_skins = Api\Html\CkEditorConfig::getAvailableCKEditorSkins();
 
 		$account_sels = array(
 			'selectbox'     => lang('Selectbox'),
@@ -103,12 +107,12 @@
 			{
 				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->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_unit']);
 		}
@@ -132,7 +136,7 @@
 				'type'   => 'select',
 				'label'  => 'Interface/Template Selection',
 				'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.',
 				'xmlrpc' => True,
 				'admin'  => False,
@@ -253,7 +257,7 @@
 				'type'   => 'select',
 				'label'  => '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.',
 				'xmlrpc' => True,
 				'admin'  => False,
@@ -329,7 +333,7 @@
 				'type'   => 'select',
 				'label'  => 'Charset for the CSV export/import',
 				'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.',
 				'xmlrpc' => True,
 				'admin'  => false,
@@ -343,7 +347,7 @@
 				'type'   => 'select',
 				'label'  => 'Default font',
 				'name'   => 'rte_font',
-				'values' => egw_ckeditor_config::$font_options,
+				'values' => Api\Html\CkEditorConfig::$font_options,
 				'help'   => 'Automatically start with this font',
 				'xmlrpc' => True,
 				'admin'  => false,
@@ -353,7 +357,7 @@
 				'type'   => 'select',
 				'label'  => 'Font size 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.',
 				'default'=> 'pt',
 				'xmlrpc' => True,
@@ -364,7 +368,7 @@
 				'type'   => 'select',
 				'label'  => 'Default 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',
 				'xmlrpc' => True,
 				'admin'  => false,
@@ -460,7 +464,7 @@
 		unset($args);	// unused, but required by function signature
 		$appname = 'preferences';
 		$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);
 	}

Modified: trunk/preferences/inc/class.preferences_password.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/inc/class.preferences_password.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/inc/class.preferences_password.inc.php (original)
+++ trunk/preferences/inc/class.preferences_password.inc.php Sat Apr 30 19:16:36 2016
@@ -8,6 +8,10 @@
  * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  * @version $Id$
  */
+
+use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
 
 class preferences_password
 {
@@ -25,7 +29,7 @@
 	{
 		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))
@@ -38,19 +42,19 @@
 			{
 				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();
 				}
 				else
 				{
-					egw_framework::refresh_opener(lang('Password changed'), 'preferences');
-					egw_framework::window_close();
+					Framework::refresh_opener(lang('Password changed'), 'preferences');
+					Framework::window_close();
 				}
 			}
 		}
 
 		$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);
 	}
@@ -67,7 +71,7 @@
 	{
 		if ($GLOBALS['egw_info']['flags']['currentapp'] != 'preferences')
 		{
-			translation::add_app('preferences');
+			Api\Translation::add_app('preferences');
 		}
 		$errors = array();
 

Modified: trunk/preferences/inc/class.preferences_settings.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/inc/class.preferences_settings.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/inc/class.preferences_settings.inc.php (original)
+++ trunk/preferences/inc/class.preferences_settings.inc.php Sat Apr 30 19:16:36 2016
@@ -5,13 +5,19 @@
  * @link http://www.egroupware.org
  * @author Ralf Becker <[email protected]>
  * @package preferences
- * @copyright (c) 2013-14 by Ralf Becker <[email protected]>
+ * @copyright (c) 2013-16 by Ralf Becker <[email protected]>
  * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  * @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
 {
@@ -41,7 +47,7 @@
 	 */
 	function index(array $content=null, $msg='')
 	{
-		$tpl = new etemplate_new('preferences.settings');
+		$tpl = new Etemplate('preferences.settings');
 		if (!is_array($content))
 		{
 			$appname = isset($_GET['appname']) && $_GET['appname'] != 'preferences' &&
@@ -71,7 +77,7 @@
 						// check if user has rights to store preferences for $type and $account_id
 						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']);
 						// merge prefs of all tabs together again
@@ -111,17 +117,17 @@
 								//error_log(__METHOD__."() ".__LINE__.": old_values=".array2string($old_values).", new_values=".array2string($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
-						egw_framework::ajax_get_preference($appname);
+						// update client-side Api\Preferences in response
+						Framework::ajax_get_preference($appname);
 				}
 				if (in_array($button, array('save','cancel')))
 				{
-					egw_json_response::get()->call('egw.message', $msg, $msg_type);
-					egw_framework::window_close();
+					Api\Json\Response::get()->call('egw.message', $msg, $msg_type);
+					Framework::window_close();
 				}
 			}
 			$appname = $content['appname'] ? $content['appname'] : 'common';
@@ -144,7 +150,7 @@
 		$preserve['current_app'] = $content['current_app'];
 		$GLOBALS['egw_info']['flags']['currentapp'] = $content['current_app'] == 'common' ?
 			'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 (!isset($button))
@@ -160,7 +166,7 @@
 		$preserve['type'] = $preserve['old_type'] = $data['type'];
 		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);
 	}
@@ -209,7 +215,7 @@
 					}
 					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));
 						}
@@ -221,7 +227,7 @@
 						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 ($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);
 							}
@@ -255,7 +261,7 @@
 		// if you return something else than False, it is treated as an error-msg and
 		// 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',
 				'prefs'    => &$repository[$appname],
 				'type'     => $type,
@@ -272,7 +278,7 @@
 		// certain common prefs (language, template, ...) require the session to be re-created
 		if ($appname == 'common' && !$only_verify)
 		{
-			egw::invalidate_session_cache();
+			Egw::invalidate_session_cache();
 		}
 
 		return null;
@@ -287,14 +293,14 @@
 	 * @param array &$readonlys
 	 * @param array &$types on return setting-name => setting-type
 	 * @param etemplate $tpl
-	 * @throws egw_exception_wrong_parameter
+	 * @throws Api\Exception\WrongParameter
 	 * @return array content
 	 */
 	function get_content($appname, $type, &$sel_options, &$readonlys, &$types, $tpl)
 	{
 		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;
 		//error_log(__METHOD__."('$appname', '$type' ) attribute='$attribute', preferences->account_id=".$GLOBALS['egw']->preferences->get_account_id());
@@ -454,7 +460,7 @@
 
 		$content['appname'] = $appname;
 		$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])
 			{
@@ -474,7 +480,7 @@
 			if (($id = $GLOBALS['egw']->preferences->get_account_id()) != $GLOBALS['egw_info']['user']['account_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
 				$user_apps = $GLOBALS['egw']->acl->get_user_applications($id);
@@ -482,7 +488,7 @@
 			}
 			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
@@ -554,13 +560,13 @@
 
 		// 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'];
-		translation::add_app($this->appname);
+		Api\Translation::add_app($this->appname);
 		if($this->appname != 'preferences')
 		{
-			translation::add_app('preferences');	// we need the prefs translations too
-		}
-
-		// make type available, to hooks from applications can use it, eg. activesync
+			Api\Translation::add_app('preferences');	// we need the prefs translations too
+		}
+
+		// make type available, to hooks from Egw\Applications can use it, eg. activesync
 		$hook_data = array(
 			'location' => 'settings',
 			'type' => $type,
@@ -569,7 +575,7 @@
 		$GLOBALS['type'] = $type;	// old global variable
 
 		// 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!)
 		if (isset($settings) && is_array($settings) && $settings)
 		{
@@ -586,7 +592,7 @@
 
 		// calling settings hook all apps can answer (for a specific app)
 		$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)
 			{

Propchange: trunk/preferences/lang/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Apr 30 19:16:36 2016
@@ -1,0 +1,37 @@
+egw_bg.lang.old
+egw_ca.lang.old
+egw_cs.lang.old
+egw_da.lang.old
+egw_de.lang.old
+egw_el.lang.old
+egw_en.lang.old
+egw_es-es.lang.old
+egw_et.lang.old
+egw_eu.lang.old
+egw_fa.lang.old
+egw_fi.lang.old
+egw_fr.lang.old
+egw_hr.lang.old
+egw_hu.lang.old
+egw_id.lang.old
+egw_it.lang.old
+egw_iw.lang.old
+egw_ja.lang.old
+egw_ko.lang.old
+egw_lo.lang.old
+egw_lv.lang.old
+egw_nl.lang.old
+egw_no.lang.old
+egw_pl.lang.old
+egw_pt-br.lang.old
+egw_pt.lang.old
+egw_ru.lang.old
+egw_rw.lang.old
+egw_sk.lang.old
+egw_sl.lang.old
+egw_sv.lang.old
+egw_tr.lang.old
+egw_uk.lang.old
+egw_vi.lang.old
+egw_zh-tw.lang.old
+egw_zh.lang.old

Modified: trunk/preferences/setup/setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/preferences/setup/setup.inc.php?rev=55956&r1=55955&r2=55956&view=diff
==============================================================================
--- trunk/preferences/setup/setup.inc.php (original)
+++ trunk/preferences/setup/setup.inc.php Sat Apr 30 19:16:36 2016
@@ -11,7 +11,7 @@
 
 $setup_info['preferences']['name']      = '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']['tables']    = '';
 $setup_info['preferences']['enable']    = 2;
@@ -33,10 +33,6 @@
 
 /* Dependencies for this app to work */
 $setup_info['preferences']['depends'][] = array(
-	'appname' => 'phpgwapi',
-	'versions' => Array('14.1')
+	'appname' => 'api',
+	'versions' => Array('16.1')
 );
-$setup_info['preferences']['depends'][] = array(
-	'appname' => 'etemplate',
-	'versions' => Array('14.1')
-);


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z