From 1ca01da9b0773adf2ed858b1804def939d3cb6d8 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 12 Feb 2014 17:33:22 +0000 Subject: [PATCH] Fix missing group ID when deleting group favorites, fixes unable to delete group favorites --- phpgwapi/inc/class.egw_framework.inc.php | 4 ++-- phpgwapi/js/jsapi/app_base.js | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 4fb28b2540..aa2ba93250 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -1957,7 +1957,7 @@ abstract class egw_framework foreach($filters as $name => $filter) { $href = "javascript:app.$app.setState(" . json_encode($filter,JSON_FORCE_OBJECT) . ');'; - $html .= "\n"; $j(html).on('click.favorites',jQuery.proxy(function(event) { @@ -509,7 +504,7 @@ var AppJS = Class.extend( return; } app[self.appname].setState(this); - },state)) + },favorite)) .insertBefore($j('li',self.sidebox).last()); self._init_sidebox(self.sidebox); } @@ -566,6 +561,7 @@ var AppJS = Class.extend( var app = event.data; var id = $j(this).parentsUntil('li').parent().attr("data-id"); + var group = $j(this).parentsUntil('li').parent().attr("data-group") || ''; var line = $j('li[data-id="'+id+'"]',app.sidebox); var name = line.first().text(); var trash = this; @@ -585,9 +581,12 @@ var AppJS = Class.extend( // Delete preference server side var request = egw.json(app.appname + ".egw_framework.ajax_set_favorite.template", - [app.appname, id, "delete", '', ''], + [app.appname, id, "delete", group, ''], function(result) { - if(result) + // Got the full response from callback, which we don't want + if(result.type) return; + + if(result && typeof result == 'boolean') { // Remove line from list line.slideUp("slow", function() { });