From 3a5ece79a70bc9a5ff151a518082d63b8acdbd23 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Feb 2014 15:37:49 +0000 Subject: [PATCH] fixed creating or deleting favorites in calendar does not work: was caused by sidebox not initialised as not yet loaded, now calling _init_sidebox from framework, also need to add a click handler for favorites as initialising sidebox removes one installed from template --- phpgwapi/js/jsapi/app_base.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index 8e451fd9d4..465b50ba5c 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -298,6 +298,15 @@ var AppJS = Class.extend( .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) + // need to install a favorite handler, as we switch original one off with .off() + .on('click','li[data-id]', this, function(){ + var href = jQuery('a[href^="javascript:"]', this).prop('href'); + var matches = href.match(/^javascript:([^\(]+)\((.*)?\);?$/); + if (matches.length > 1 && matches[2] !== undefined) + { + return self.setState.call(self, JSON.parse(matches[2])); + } + }) .addClass("ui-helper-clearfix"); return true; }