diff --git a/bin/index.html b/bin/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f6e9b77668d34d358135a400d1405fce5012751d --- /dev/null +++ b/bin/index.html @@ -0,0 +1,134 @@ + + + + + Jflow - Test page + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+

Hello, world!

+

This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.

+

Learn more »

+
+ + +
+
+

Heading

+

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

+

View details »

+
+
+

Heading

+

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

+

View details »

+
+
+

Heading

+

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

+

View details »

+
+
+ +
+
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bin/jflow.js b/bin/jflow.js new file mode 100644 index 0000000000000000000000000000000000000000..defa747bc6619cc080400ddb825a65bcce4370c8 --- /dev/null +++ b/bin/jflow.js @@ -0,0 +1,143 @@ +/*************************************************************** +* Copyright notice +* +* (c) 2013 PF bioinformatique de Toulouse +* All rights reserved +* +* It is distributed under the terms of the GNU General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + +(function($) { + + $.fn.jflow = function(options) { + + var JFLOW_CONTAINER_PREFIX = "jflow_container_"; + var defaults = { + jflowServerWebPath: "http://localhost:8080", + template: "workflowsList", + workflow_class: null, + workflowsList: ['{{each(index, workflow) workflows}}', + '
', + '

${workflow.name}

', + '${workflow.help}', + '
', + '{{/each}}'].join('\n'), + workflowForm: ['
', + '
', + '
', + ' ${workflow.name} ${workflow.help}', + '
', + ' {{each(index, param) workflow.parameters}}', + '
', + ' ', + '
', + // if it's a multiple choice parameter, add a select + ' {{if param.choices}}', + ' ', + // else a simple text input + ' {{else}}', + ' ', + ' {{/if}}', + '

${param.help}

', + '
', + '
', + ' {{/each}}', + '
', + ' ', + '
', + '
', + '
', + ' Reset', + ' Run', + '
', + '
', + '
', + '
', + '
', + '
'].join('\n'), + errorTemplate: ['
', + '', + '${title} ${message}', + '
'].join('\n') + }; + var opts = $.extend(defaults, options); + + var _displayWorkflowsList = function(div) { + $.ajax({ + url: opts.jflowServerWebPath + '/get_available_workflows?callback=?', + dataType: "json", + success: function(data) { + $.tmpl(opts["workflowsList"], {workflows: data}).appendTo(div); + } + }); + } + + var _displayWorkflowForm = function(div) { + if (opts.workflow_class == null) { + $.tmpl(opts["errorTemplate"], {"title": "Error!", "message": "workflow_class option is required."}).appendTo(div); + } else { + $.ajax({ + url: opts.jflowServerWebPath + '/get_available_workflows?callback=?', + dataType: "json", + success: function(data) { + var workflow = null; + for (var i in data) { + if (data[i]["class"] == opts.workflow_class) { + workflow = data[i]; + break; + } + } + $.tmpl(opts["workflowForm"], {workflow: workflow}).appendTo(div); + } + }); + } + } + + this.each(function() { + var $t = $(this), + indexes = new Array(), + index = 0; + // First off, detect jflow containers and found out which index should be used + $("[id^="+JFLOW_CONTAINER_PREFIX+"]").each(function() { + indexes.push($(this).attr("id").split("_")[2]); + }); + while (true) { + if (indexes.indexOf(index.toString()) == -1) { break; } + else { index += 1; } + } + $t.html('
'); + var $div = $("#"+JFLOW_CONTAINER_PREFIX+index.toString()); + switch (opts.template) { + case "workflowForm": + _displayWorkflowForm($div); + break; + default: + _displayWorkflowsList($div); + break + } + }); + return this; + + }; + +})(jQuery); \ No newline at end of file diff --git a/bin/jflow_server.py b/bin/jflow_server.py index 0580f07e547d7a5c06c399d2f936c2a809b03a04..85f46862e9048ed331537642cb635890425f4ba2 100644 --- a/bin/jflow_server.py +++ b/bin/jflow_server.py @@ -104,13 +104,15 @@ class JFlowServer (object): "name": param.name}) workflows.append({"name": instance.name, "help": instance.description, - "params": parameters}) + "class": instance.__class__.__name__, + "parameters": parameters}) return workflows @cherrypy.expose @jsonify def run_workflow(self, **kwargs): - pass + print kwargs + return [{"return": "sdsdsd"}] # self.wfmanager.run_workflow(workflow_class, args, True) @cherrypy.expose diff --git a/bin/jquery.tmpl.min.js b/bin/jquery.tmpl.min.js new file mode 100644 index 0000000000000000000000000000000000000000..a615f5b21677b16948259ef15147d71d66e4b634 --- /dev/null +++ b/bin/jquery.tmpl.min.js @@ -0,0 +1,10 @@ +/* + * jQuery Templates Plugin 1.0.0pre + * http://github.com/jquery/jquery-tmpl + * Requires jQuery 1.4.2 + * + * Copyright 2011, Software Freedom Conservancy, Inc. + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + */ +(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery); \ No newline at end of file