From daac136f47646a613368246cb33ce2487df9b8c4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 5 Feb 2013 11:24:02 +0000 Subject: [PATCH] as et2 adds options as text, we can NOT use html entities, but direct utf-8 chars, which unfortunately php does not support as string literals, using html_entity_decode therefor --- addressbook/inc/class.addressbook_ui.inc.php | 12 +++++++++--- .../inc/class.etemplate_widget_menupopup.inc.php | 10 ++-------- phpgwapi/inc/class.categories.inc.php | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 36ba4ce161..4bd339191a 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -5,7 +5,7 @@ * @link www.egroupware.org * @author Cornelius Weiss * @author Ralf Becker - * @copyright (c) 2005-12 by Ralf Becker + * @copyright (c) 2005-13 by Ralf Becker * @copyright (c) 2005/6 by Cornelius Weiss * @package addressbook * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License @@ -1392,14 +1392,20 @@ class addressbook_ui extends addressbook_bo $this->type_icon($row['owner'],$row['private'],$row['tid'],$row['type'],$row['type_label']); static $tel2show = array('tel_work','tel_cell','tel_home','tel_fax'); + static $prefer_marker; + if (is_null($prefer_marker)) + { + // as et2 adds options with .text(), it can't be entities, but php knows no string literals with utf-8 + $prefer_marker = html_entity_decode(' ♥', ENT_NOQUOTES, 'utf-8'); + } foreach($tel2show as $name) { - $row[$name] .= ' '.($row['tel_prefer'] == $name ? '♥' : ''); // .' ' to NOT remove the field + $row[$name] .= ' '.($row['tel_prefer'] == $name ? $prefer_marker : ''); // .' ' to NOT remove the field } // allways show the prefered phone, if not already shown if (!in_array($row['tel_prefer'],$tel2show) && $row[$row['tel_prefer']]) { - $row['tel_prefered'] = $row[$row['tel_prefer']].' ♥'; + $row['tel_prefered'] = $row[$row['tel_prefer']].$prefer_marker; } if (!$this->check_perms(EGW_ACL_DELETE,$row) || (!$GLOBALS['egw_info']['user']['apps']['admin'] && $this->config['history'] != 'userpurge' && $query['col_filter']['tid'] == addressbook_so::DELETED_TYPE)) { diff --git a/etemplate/inc/class.etemplate_widget_menupopup.inc.php b/etemplate/inc/class.etemplate_widget_menupopup.inc.php index 40feb61813..e5ffc0eafe 100644 --- a/etemplate/inc/class.etemplate_widget_menupopup.inc.php +++ b/etemplate/inc/class.etemplate_widget_menupopup.inc.php @@ -7,7 +7,7 @@ * @subpackage api * @link http://www.egroupware.org * @author Ralf Becker - * @copyright 2002-11 by RalfBecker@outdoor-training.de + * @copyright 2002-13 by RalfBecker@outdoor-training.de * @version $Id$ */ @@ -296,13 +296,7 @@ class etemplate_widget_menupopup extends etemplate_widget if (categories::is_global($cat)) { - static $global_marker; - if (is_null($global_marker)) - { - // as we add options with .text(), it can't be entities, but php knows no string literals with utf-8 - $global_marker = html_entity_decode(' ♦', ENT_NOQUOTES, 'utf-8'); - } - $s .= $global_marker; + $s .= categories::$global_marker; } $options[$cat['id']] = array( 'label' => $s, diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index 2001d2a4c8..db98aa5453 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -105,6 +105,13 @@ class categories */ private $global_owners = array(self::GLOBAL_ACCOUNT); + /** + * string to postfix global cats + * + * @var string + */ + static public $global_marker; + /** * constructor for categories class * @@ -133,6 +140,11 @@ class categories { self::init_cache(); } + if (is_null(self::$global_marker)) + { + // as et2 adds options with .text(), it can't be entities, but php knows no string literals with utf-8 + self::$global_marker = html_entity_decode(' ♦', ENT_NOQUOTES, 'utf-8'); + } } /** @@ -344,7 +356,7 @@ class categories { $parents[] = $cat['id']; } - + if($parent_id || !$cats) // Avoid wiping search results { // Go find the children @@ -1156,7 +1168,7 @@ class categories $s .= $GLOBALS['egw']->strip_html($cat['name']); if (self::is_global($cat)) { - $s .= ' ♦'; + $s .= self::$global_marker; } $s .= '' . "\n"; }