From a2069daeaa50cf7328f838d4c3f2ca2da0727bbc Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Fri, 18 Oct 2013 19:26:45 +0200 Subject: [PATCH] ResourcesSelected Plugin working with URNs - http://trac.myslice.info/ticket/36 --- plugins/hazelnut/static/js/hazelnut.js | 3 ++- plugins/resources_selected/static/js/resources_selected.js | 6 ++++-- portal/static/js/common.functions.js | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/hazelnut/static/js/hazelnut.js b/plugins/hazelnut/static/js/hazelnut.js index bdb2de70..21b23f5b 100644 --- a/plugins/hazelnut/static/js/hazelnut.js +++ b/plugins/hazelnut/static/js/hazelnut.js @@ -259,7 +259,8 @@ var checkbox_id = this.flat_id(this.id('checkbox', key_value)); - checkbox_id = '#' + checkbox_id; + // function escape_id(myid) is defined in portal/static/js/common.functions.js + checkbox_id = escape_id(checkbox_id); // using dataTables's $ to search also in nodes that are not currently displayed var element = this.table.$(checkbox_id); if (debug) messages.debug("set_checkbox checked=" + checked + " id=" + checkbox_id + " matches=" + element.length); diff --git a/plugins/resources_selected/static/js/resources_selected.js b/plugins/resources_selected/static/js/resources_selected.js index d64d7171..9a064476 100644 --- a/plugins/resources_selected/static/js/resources_selected.js +++ b/plugins/resources_selected/static/js/resources_selected.js @@ -314,9 +314,11 @@ // - Key and confirmation could be sufficient, or key and record state // XXX move record state to the manifold plugin API - on_field_state_changed: function(request, key, value, status) + on_field_state_changed: function(result) { - this.set_state(request, key, value, status); + console.log(result) + /* this.set_state(result.request, result.key, result.value, result.status); */ + this.set_state(result); }, // XXX we will have the requests for change diff --git a/portal/static/js/common.functions.js b/portal/static/js/common.functions.js index 24142168..56b02ca9 100644 --- a/portal/static/js/common.functions.js +++ b/portal/static/js/common.functions.js @@ -1,6 +1,10 @@ /* * This file is included in tophat_render.php */ +// Escape special characters in jQuery Selector +function escape_id( myid ) { + return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" ); +} function getKeySplitId(id,separator){ // id of elements must respect this rule -- 2.43.0