X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fstatic%2Fjs%2Fplugin.js;h=e27812956a1664e662c26e9cc9405805b66fdb3c;hb=03f7c0b84beda916f8bc9c5458d84673be24fb6e;hp=f39296170d98b7b362fd7c01d2a2a7ce8ce0280b;hpb=9a62ec0dc3ee3e859f3563da29d9c838a658b140;p=myslice.git diff --git a/manifold/static/js/plugin.js b/manifold/static/js/plugin.js index f3929617..e2781295 100644 --- a/manifold/static/js/plugin.js +++ b/manifold/static/js/plugin.js @@ -189,7 +189,29 @@ var Plugin = Class.extend({ id_from_key: function(key_field, value) { - return key_field + manifold.separator + unfold.escape_id(value).replace(/\\/g, ''); + return key_field + manifold.separator + this.escape_id(value).replace(/\\/g, ''); + }, + + // we do not need to carry around all the nonsense about backslashing dots in hrns + // likewise, DOM ids do not like to have dots in them + // because "#foo.bar" matches an elem named foo with class bar - not an id that is foo.bar + // so this method gives you a valid DOMID but that cannot be 'reversed' back to retrieve an hrn or the like + // e.g. + // input=input="ple.aluiple.host147-82-static\\.93-94-b\\.business\\.telecomitalia\\.it" + // > "ple.aluiple.host147-82-static\.93-94-b\.business\.telecomitalia\.it" + // flat_id(input) + // "ple-aluiple-host147-82-static-93-94-b-business-telecomitalia-it" + flat_id : function (id_in) { + return id_in.replace(/\\\./g,"-").replace(/\\/g,"-").replace(/\./g,"-"); + }, + + // escape (read: backslashes) some meta-chars in input + escape_id: function(id) { + if( id !== undefined){ + return id.replace( /(:|\.|\[|\])/g, "\\$1" ); + }else{ + return "undefined-id"; + } }, id_from_record: function(method, record) { @@ -226,6 +248,15 @@ var Plugin = Class.extend({ return array[arguments.length + 1]; }, + // TOGGLE + // plugin-helper.js is about managing toggled state + // it would be beneficial to merge it in here + toggle_on: function () { return this.toggle("true"); }, + toggle_off: function () { return this.toggle("false"); }, + toggle: function (status) { + plugin_helper.set_toggle_status (this.options.plugin_uuid,status); + }, + /* SPIN */ spin: function() {