From dc09db26fac78ddda2a66a9b362c180cefe58cb1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 27 Aug 2015 11:33:07 +0000 Subject: [PATCH] * All apps: some favorites could not be deleted (reappeared after reload/next login) --- phpgwapi/inc/class.egw_favorites.inc.php | 2 +- phpgwapi/js/jsapi/app_base.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpgwapi/inc/class.egw_favorites.inc.php b/phpgwapi/inc/class.egw_favorites.inc.php index d7caa28285..aed3915388 100644 --- a/phpgwapi/inc/class.egw_favorites.inc.php +++ b/phpgwapi/inc/class.egw_favorites.inc.php @@ -189,7 +189,7 @@ class egw_favorites { // Only use alphanumeric for preference name, so it can be used directly as DOM ID $name = strip_tags($_name); - $pref_name = "favorite_".preg_replace('/[^A-Za-z0-9-_]/','_',$name); + $pref_name = "favorite_".$name; // older group-favorites have just true as their group and are not deletable, if we dont find correct group if ($group === true || $group === '1') diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 20001285b0..78cc8ababd 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -380,7 +380,7 @@ var AppJS = Class.extend( li.addClass('ui-state-highlight'); },50); } - + var state = {}; var pref = egw.preference('favorite_' + this.dataset.id, self.appname); if(pref) @@ -614,7 +614,7 @@ var AppJS = Class.extend( self.egw.jsonq(self.appname+'.egw_framework.ajax_set_favorite.template', [ self.appname, - name.val(), + safe_name, "add", self.favorite_popup.group.get_value(), self.favorite_popup.state @@ -775,7 +775,7 @@ var AppJS = Class.extend( favorite = egw.preference('favorite_'+this.dataset.id,self.appname); } if(!favorite || jQuery.isEmptyObject(favorite)) return; - + var match_count = 0; for(var state_key in state) { @@ -783,7 +783,7 @@ var AppJS = Class.extend( { match_count++; } - else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object' + else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object' && typeof favorite.state != 'undefined' && typeof favorite.state[state_key] != 'undefined' && favorite.state[state_key] && typeof favorite.state[state_key] === 'object') { if((typeof state[state_key].length !== 'undefined' || typeof state[state_key].length !== 'undefined') @@ -827,7 +827,7 @@ var AppJS = Class.extend( { // Skip, might be set, might not } - else if (typeof state[state_key] !== 'undefined' + else if (typeof state[state_key] !== 'undefined' && typeof favorite.state != 'undefined'&&typeof favorite.state[state_key] !== 'undefined' && state[state_key] != favorite.state[state_key]) {