mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-09 01:24:07 +01:00
Use favorite settings from preference to avoid all the encoding problems
Avoids errors in Firefox. (See rev. 53183, 53215, 53244)
This commit is contained in:
parent
52cf6344d8
commit
d443f124b1
@ -78,10 +78,9 @@ class egw_favorites
|
|||||||
error_log(__METHOD__.'Favorite filter is not suppose to be empty, it should be an array. filter = '. array2string($filters[$name]));
|
error_log(__METHOD__.'Favorite filter is not suppose to be empty, it should be an array. filter = '. array2string($filters[$name]));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$href = "javascript:app.$app.setState(" . json_encode($filter,JSON_FORCE_OBJECT) . ');';
|
$href = "javascript:app.$app.setState(" . json_encode($filter,JSON_FORCE_OBJECT) . ');';
|
||||||
$li = "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n";
|
$li = "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n";
|
||||||
$li .= '<a href="'.htmlspecialchars($href).'" class="ui-corner-all" tabindex="-1">';
|
$li .= '<a href="#" class="ui-corner-all" tabindex="-1">';
|
||||||
$li .= "<div class='" . ((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
|
$li .= "<div class='" . ((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
|
||||||
$filter['name'];
|
$filter['name'];
|
||||||
$li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" :
|
$li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" :
|
||||||
|
@ -373,7 +373,7 @@ var AppJS = Class.extend(
|
|||||||
li.siblings().removeClass('ui-state-highlight');
|
li.siblings().removeClass('ui-state-highlight');
|
||||||
|
|
||||||
// Wait an arbitrary 50ms to avoid having the class removed again
|
// Wait an arbitrary 50ms to avoid having the class removed again
|
||||||
// by the change handler.
|
// by the change handler.
|
||||||
if(li.attr('data-id') !== 'blank')
|
if(li.attr('data-id') !== 'blank')
|
||||||
{
|
{
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
@ -381,12 +381,16 @@ var AppJS = Class.extend(
|
|||||||
},50);
|
},50);
|
||||||
}
|
}
|
||||||
|
|
||||||
var href = jQuery('a[href^="javascript:"]', this).prop('href');
|
var state = {};
|
||||||
var matches = href ? href.match(/^javascript:([^\(]+)\((.*)?\);?$/) : null;
|
var pref = egw.preference('favorite_' + this.dataset.id, self.appname);
|
||||||
if (matches && matches.length > 1 && matches[2] !== undefined)
|
if(pref)
|
||||||
|
{
|
||||||
|
state = pref;
|
||||||
|
}
|
||||||
|
if(this.dataset.id != 'add')
|
||||||
{
|
{
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
self.setState.call(self, JSON.parse(matches[2]));
|
self.setState.call(self, state);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -760,16 +764,15 @@ var AppJS = Class.extend(
|
|||||||
var state = this.getState();
|
var state = this.getState();
|
||||||
var best_match = false;
|
var best_match = false;
|
||||||
var best_count = 0;
|
var best_count = 0;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
$j('li[data-id]',this.sidebox).removeClass('ui-state-highlight');
|
$j('li[data-id]',this.sidebox).removeClass('ui-state-highlight');
|
||||||
|
|
||||||
$j('li[data-id] a[href^="javascript:"]',this.sidebox).each(function(i,href) {
|
$j('li[data-id]',this.sidebox).each(function(i,href) {
|
||||||
|
|
||||||
var matches = href.href ? href.href.match(/^javascript:([^\(]+)\((.*)?\);?$/) : null;
|
|
||||||
var favorite = {}
|
var favorite = {}
|
||||||
if (matches && matches.length > 1 && matches[2] !== undefined)
|
if(this.dataset.id && egw.preference('favorite_'+this.dataset.id,self.appname))
|
||||||
{
|
{
|
||||||
favorite = JSON.parse(matches[2]);
|
favorite = egw.preference('favorite_'+this.dataset.id,self.appname);
|
||||||
}
|
}
|
||||||
if(!favorite || jQuery.isEmptyObject(favorite)) return;
|
if(!favorite || jQuery.isEmptyObject(favorite)) return;
|
||||||
|
|
||||||
@ -834,7 +837,7 @@ var AppJS = Class.extend(
|
|||||||
}
|
}
|
||||||
if(match_count > best_count)
|
if(match_count > best_count)
|
||||||
{
|
{
|
||||||
best_match = href.parentNode.dataset.id;
|
best_match = this.dataset.id;
|
||||||
best_count = match_count;
|
best_count = match_count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user