X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fquerycode%2Fquerycode.js;h=0898e4a68e7eb724e4c74842b763eb35a8f98d5b;hb=00c607ef9000811b027330152e09b4da8c46ad02;hp=15f9b1e51e708663261c416eb3c56bd8bd4030ef;hpb=e93fed6669bd5055da5683753d47df616a0108ce;p=unfold.git diff --git a/plugins/querycode/querycode.js b/plugins/querycode/querycode.js index 15f9b1e5..0898e4a6 100644 --- a/plugins/querycode/querycode.js +++ b/plugins/querycode/querycode.js @@ -7,15 +7,6 @@ * License: GPLv3 */ -function debug_object (msg, o) { - var keys=[]; - for (var k in o) keys.push(k); - console.log (msg + " Keys : " + keys); -} - -// xxx TODO -// . turn back on syntax highlighting - (function($) { var debug=false; @@ -34,8 +25,8 @@ function debug_object (msg, o) { var methods = { init : function (options) { - console.log("temporarily turned off SyntaxHighlighter ..."); -// SyntaxHighlighter.all(); + if (debug) console.log("SyntaxHighlighter.all ..."); + SyntaxHighlighter.all(); return this.each(function() { var $this=$(this); var data=$this.data('QueryCode'); @@ -82,18 +73,18 @@ function debug_object (msg, o) { var lang=$plugindiv.find(".querycode-lang").val(); var dom=$plugindiv.find(".querycode-viz"); - var query = $plugindiv.data().QueryCode.options.query; + var query_uuid = $plugindiv.data().QueryCode.options.query_uuid; + var query=manifold.find_query(query_uuid); funname="translate_query_as_" + lang; fun=eval(funname); - if ( ! fun) { + if (! fun) { console.log("Cannot find translator function for lang " + lang); return; } html_code=fun(query); dom.html(html_code); - console.log("turned off SyntaxHighlighter.highlight"); -// SyntaxHighlighter.highlight() - + if (debug) console.log("SyntaxHighlighter.highlight"); + SyntaxHighlighter.highlight() } @@ -131,7 +122,7 @@ function debug_object (msg, o) { }); ofs = '[' + ofs + ']'; - output += 'pp srv.call("' + title_case(query.action) +'", auth, "' + query.method + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')'; + output += 'pp srv.call("' + mixed_case(query.action) +'", auth, "' + query.subject + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')'; var output = '
' + output + "
"; return output; @@ -164,12 +155,12 @@ function debug_object (msg, o) { }); ofs = '[' + ofs + ']'; - output += 'srv.' + title_case(query.action) + '(auth, "' + query.method + '", ' + ifs + ', {}, ' + ofs + ')'; + output += 'srv.' + mixed_case(query.action) + '(auth, "' + query.subject + '", ' + ifs + ', {}, ' + ofs + ')'; var output = '
' + output + "
"; return output; } - function title_case (txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();} + function mixed_case (txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();} })(jQuery); // end closure wrapper