From cbbd03f388cc2f65d758d15d8a15ee9ded1ded86 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 18 Mar 2013 20:58:55 +0000 Subject: [PATCH] - Use top-level preferences to load favorites - Empty sidebox target on unload to prevent handlers hanging around --- etemplate/js/et2_widget_favorites.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/etemplate/js/et2_widget_favorites.js b/etemplate/js/et2_widget_favorites.js index 5fae793935..febfc60613 100644 --- a/etemplate/js/et2_widget_favorites.js +++ b/etemplate/js/et2_widget_favorites.js @@ -95,7 +95,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],{ var apps = egw().user('apps'); this.is_admin = (typeof apps['admin'] != "undefined"); - this.preferred = this.egw().preference(this.options.default_pref,this.options.app); + this.preferred = egw.preference(this.options.default_pref,this.options.app); if(!this.preferred || typeof this.stored_filters[this.preferred] == "undefined") { this.preferred = "blank"; @@ -122,7 +122,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],{ if(this.sidebox_target.length) { this.sidebox_target - .off("mouseenter mouseleave click") + .off() .on("mouseenter","div.ui-icon-trash", function() {$j(this).wrap("");}) .on("mouseleave","div.ui-icon-trash", function() {$j(this).unwrap();}) .on("click","div.ui-icon-trash", this, this.delete_favorite) @@ -179,6 +179,12 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],{ destroy: function() { this.popup.dialog("destroy"); this.popup = null; + if(this.sidebox_target.length) + { + this.sidebox_target + .off() + .empty(); + } this._super.apply(this, arguments); }, @@ -198,7 +204,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],{ }; // Load saved favorites - var preferences = this.egw().preference("*",app); + var preferences = egw.preference("*",app); for(var pref_name in preferences) { if(pref_name.indexOf(this.favorite_prefix) == 0)