Commit 9e4fc6b1 authored by Janez K's avatar Janez K

word cloud za twitter, brisanje workflowov

parent 3c576f75
......@@ -29,6 +29,7 @@
<script src="{{STATIC_URL}}bootstrap/js/bootstrap.js"></script>
<script src="{{STATIC_URL}}js/fancybox/jquery.fancybox-1.3.4.js"></script>
<script src="{{STATIC_URL}}js/signuplogin.js"></script>
<script src="{{STATIC_URL}}js/bootbox.min.js"></script>
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/favicon.ico">
......@@ -70,6 +71,7 @@
<li {% block "homeactive" %}{% endblock %}><a href="{% url 'website index' %}">Home</a></li>
<li {% block "workflowactive" %}{% endblock %}><a href="{% url 'the index' %}" class="{% if not user.is_authenticated %}must_login{% endif %}">Workflow editor</a></li>
<li {% block "yourworkflowsactive" %}{% endblock %}><a href="{% url 'your workflows' %}" class="{% if not user.is_authenticated %}must_login{% endif %}">Your workflows</a></li>
<li {% block "exploreactive" %}{% endblock %}><a href="{% url 'existing workflows' %}">Explore workflows</a></li>
<li><a class="{% if not user.is_authenticated %}must_login{% endif %}" href="{% if user.is_authenticated %}{% url 'logout' %}{% endif %}{% if not user.is_authenticated %}{% url 'website index' %}{% endif %}">{% if not user.is_authenticated %}Log in{% endif %}{% if user.is_authenticated %}Log out{% endif %}</a></li>
</ul>
......
{% extends 'website/base.html' %}
{% load url from future %}
{% block "yourworkflowsactive" %}class="active"{% endblock %}
{% block 'container' %}
<h1>Your workflows</h1>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Workflow title</th>
<th>Public URL</th>
<th style="width:30%;">Action</th>
</tr>
</thead>
<tbody>
{% for w in workflows %}
<tr>
<td class="name">{{w}}</td>
<td>{% if w.public %}<a href="{{w.get_info_url}}">{{w.get_info_url}}</a>{% else %}This workflow is private.{% endif %}</td>
<td><a href="{{w.get_absolute_url}}">Edit</a> | <a href="{{w.get_copy_url}}">Open as new</a> | <a href="javascript:;" rel="{{w.pk}}" class="delete_workflow">Delete</a> | {% if not w.public %}<a href="#">Make public</a>{% else %}<a href="#">Make private</a>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
$(function() {
$(".delete_workflow").click(function() {
var thistd = $(this);
bootbox.confirm("Are you sure you wish to delete the workflow: "+$(this).parent().parent().find("td.name").html()+"?","No way!", "Yes, definitely!", function(result) {
if (result==true) {
thistd.parent().parent().remove();
$.post("{% url 'delete workflow' %}?workflow_id="+thistd.attr('rel'))
}
});
});
});
</script>
{% endblock %}
......@@ -4,7 +4,8 @@ urlpatterns = patterns('',
url(r'^$', 'website.views.index', name='website index'),
url(r'^existing-workflows/', 'website.views.workflows', name='existing workflows'),
url(r'^workflow/(?P<workflow_id>[0-9]+)/$', 'website.views.workflow_information', name='workflow information'),
)
\ No newline at end of file
url(r'^your-workflows/', 'website.views.your_workflows', name='your workflows'),
url(r'^workflow/(?P<workflow_id>[0-9]+)/$', 'website.views.workflow_information', name='workflow information'),
)
......@@ -19,7 +19,7 @@ import os
def index(request):
return render(request, 'website/index.html')
def workflow_information(request,workflow_id):
w = Workflow.objects.get(pk=workflow_id)
if not w.public:
......@@ -70,7 +70,11 @@ def workflow_information(request,workflow_id):
conn['y2'] = normalized_values[pair[1]][1]+15
w.unique_connections.append(conn)
return render(request, 'website/existing.html', {'workflows':[w,]})
def your_workflows(request):
return render(request, 'website/yourworkflows.html', {'workflows':request.user.workflows.all()})
def workflows(request):
wflows = Workflow.objects.filter(public=True)
min_x = 10000
......
/**
* bootbox.js v3.2.0
*
* http://bootboxjs.com/license.txt
*/
var bootbox=window.bootbox||function(w,n){function k(b,a){"undefined"===typeof a&&(a=p);return"string"===typeof j[a][b]?j[a][b]:a!=t?k(b,t):b}var p="en",t="en",u=!0,s="static",v="",l={},g={},m={setLocale:function(b){for(var a in j)if(a==b){p=b;return}throw Error("Invalid locale: "+b);},addLocale:function(b,a){"undefined"===typeof j[b]&&(j[b]={});for(var c in a)j[b][c]=a[c]},setIcons:function(b){g=b;if("object"!==typeof g||null===g)g={}},setBtnClasses:function(b){l=b;if("object"!==typeof l||null===
l)l={}},alert:function(){var b="",a=k("OK"),c=null;switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}return m.dialog(b,{label:a,icon:g.OK,"class":l.OK,callback:c},{onEscape:c||!0})},confirm:function(){var b="",a=k("CANCEL"),c=k("CONFIRM"),e=null;switch(arguments.length){case 1:b=arguments[0];
break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}var h=function(){if("function"===typeof e)return e(!1)};return m.dialog(b,[{label:a,icon:g.CANCEL,"class":l.CANCEL,callback:h},{label:c,icon:g.CONFIRM,"class":l.CONFIRM,
callback:function(){if("function"===typeof e)return e(!0)}}],{onEscape:h})},prompt:function(){var b="",a=k("CANCEL"),c=k("CONFIRM"),e=null,h="";switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;case 5:b=arguments[0];a=arguments[1];
c=arguments[2];e=arguments[3];h=arguments[4];break;default:throw Error("Incorrect number of arguments: expected 1-5");}var q=n("<form></form>");q.append("<input autocomplete=off type=text value='"+h+"' />");var h=function(){if("function"===typeof e)return e(null)},d=m.dialog(q,[{label:a,icon:g.CANCEL,"class":l.CANCEL,callback:h},{label:c,icon:g.CONFIRM,"class":l.CONFIRM,callback:function(){if("function"===typeof e)return e(q.find("input[type=text]").val())}}],{header:b,show:!1,onEscape:h});d.on("shown",
function(){q.find("input[type=text]").focus();q.on("submit",function(a){a.preventDefault();d.find(".btn-primary").click()})});d.modal("show");return d},dialog:function(b,a,c){function e(){var a=null;"function"===typeof c.onEscape&&(a=c.onEscape());!1!==a&&f.modal("hide")}var h="",l=[];c||(c={});"undefined"===typeof a?a=[]:"undefined"==typeof a.length&&(a=[a]);for(var d=a.length;d--;){var g=null,k=null,j=null,m="",p=null;if("undefined"==typeof a[d].label&&"undefined"==typeof a[d]["class"]&&"undefined"==
typeof a[d].callback){var g=0,k=null,r;for(r in a[d])if(k=r,1<++g)break;1==g&&"function"==typeof a[d][r]&&(a[d].label=k,a[d].callback=a[d][r])}"function"==typeof a[d].callback&&(p=a[d].callback);a[d]["class"]?j=a[d]["class"]:d==a.length-1&&2>=a.length&&(j="btn-primary");g=a[d].label?a[d].label:"Option "+(d+1);a[d].icon&&(m="<i class='"+a[d].icon+"'></i> ");k=a[d].href?a[d].href:"javascript:;";h="<a data-handler='"+d+"' class='btn "+j+"' href='"+k+"'>"+m+""+g+"</a>"+h;l[d]=p}d=["<div class='bootbox modal' tabindex='-1' style='overflow:hidden;'>"];
if(c.header){j="";if("undefined"==typeof c.headerCloseButton||c.headerCloseButton)j="<a href='javascript:;' class='close'>&times;</a>";d.push("<div class='modal-header'>"+j+"<h3>"+c.header+"</h3></div>")}d.push("<div class='modal-body'></div>");h&&d.push("<div class='modal-footer'>"+h+"</div>");d.push("</div>");var f=n(d.join("\n"));("undefined"===typeof c.animate?u:c.animate)&&f.addClass("fade");(h="undefined"===typeof c.classes?v:c.classes)&&f.addClass(h);f.find(".modal-body").html(b);f.on("keyup.dismiss.modal",
function(a){27===a.which&&c.onEscape&&e("escape")});f.on("click","a.close",function(a){a.preventDefault();e("close")});f.on("shown",function(){f.find("a.btn-primary:first").focus()});f.on("hidden",function(){f.remove()});f.on("click",".modal-footer a",function(b){var c=n(this).data("handler"),d=l[c],e=null;"undefined"!==typeof c&&"undefined"!==typeof a[c].href||(b.preventDefault(),"function"===typeof d&&(e=d()),!1!==e&&f.modal("hide"))});n("body").append(f);f.modal({backdrop:"undefined"===typeof c.backdrop?
s:c.backdrop,keyboard:!1,show:!1});f.on("show",function(){n(w).off("focusin.modal")});("undefined"===typeof c.show||!0===c.show)&&f.modal("show");return f},modal:function(){var b,a,c,e={onEscape:null,keyboard:!0,backdrop:s};switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"object"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}e.header=a;
c="object"==typeof c?n.extend(e,c):e;return m.dialog(b,[],c)},hideAll:function(){n(".bootbox").modal("hide")},animate:function(b){u=b},backdrop:function(b){s=b},classes:function(b){v=b}},j={en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},ru:{OK:"OK",CANCEL:"\u041e\u0442\u043c\u0435\u043d\u0430",
CONFIRM:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"}};return m}(document,window.jQuery);window.bootbox=bootbox;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -5,6 +5,44 @@ Streaming widgets librarby
@author: Janez Kranjc <janez.kranjc@ijs.si>
'''
def streaming_split_pos_neg(input_dict):
tweets = input_dict['ltw']
positive_tweets = []
negative_tweets = []
for tweet in tweets:
try:
if tweet['sentiment']=="Positive":
positive_tweets.append(tweet)
if tweet['sentiment']=="Negative" and tweet['reliability']!=-1.0:
negative_tweets.append(tweet)
except:
pass
output_dict = {}
output_dict['ptw']=positive_tweets
output_dict['ntw']=negative_tweets
return output_dict
def streaming_filter_tweets_by_language(input_dict):
language = input_dict['lang']
tweets = input_dict['ltw']
new_tweets = []
for tweet in tweets:
if tweet['lang']==language:
new_tweets.append(tweet)
output_dict = {}
output_dict['ltw']=new_tweets
return output_dict
def streaming_display_tweets(input_dict,widget,stream=None):
from streams.models import StreamWidgetData
if stream is None:
......
{% extends "streams/base.html" %}
{% block 'container' %}
<h1>Tweet cloud</h1>
<div id="vis"></div>
<script src="{{STATIC_URL}}js/d3/d3-2.js"></script>
<script src="{{STATIC_URL}}js/d3/d3.layout.cloud.js"></script>
<script type="text/javascript">
var fill = d3.scale.category20b();
var w = parseInt($("#vis").innerWidth()),
h = 600;
var words = [],
max,
scale = 1,
complete = 0,
keyword = "",
tags,
fontSize,
maxLength = 30,
fetcher = "http://search.twitter.com/search.json?rpp=100&q={word}",
statusText = d3.select("#status");
var layout = d3.layout.cloud()
.timeInterval(10)
.size([w, h])
.fontSize(function(d) { return fontSize(+d.value); })
.text(function(d) { return d.key; })
//.on("word", progress)
.on("end", draw);
var svg = d3.select("#vis").append("svg")
.attr("width", w)
.attr("height", h);
var background = svg.append("g"),
vis = svg.append("g")
.attr("transform", "translate(" + [w >> 1, h >> 1] + ")");
// From Jonathan Feinberg's cue.language, see lib/cue.language/license.txt.
var stopWords = /^(i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|i'm|you're|he's|she's|it's|we're|they're|i've|you've|we've|they've|i'd|you'd|he'd|she'd|we'd|they'd|i'll|you'll|he'll|she'll|we'll|they'll|isn't|aren't|wasn't|weren't|hasn't|haven't|hadn't|doesn't|don't|didn't|won't|wouldn't|shan't|shouldn't|can't|cannot|couldn't|mustn't|let's|that's|who's|what's|here's|there's|when's|where's|why's|how's|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall)$/,
punctuation = /[!"&()*+,-\.\/:;<=>?\[\\\]^`\{|\}~]+/g,
wordSeparators = /[\s\u3031-\u3035\u309b\u309c\u30a0\u30fc\uff70]+/g,
discard = /^(@|https?:)/,
htmlTags = /(<[^>]*?>|<script.*?<\/script>|<style.*?<\/style>|<head.*?><\/head>)/g,
matchTwitter = /^https?:\/\/([^\.]*\.)?twitter\.com/;
function parseHTML(d) {
parseText(d.replace(htmlTags, " ").replace(/&#(x?)([\dA-Fa-f]{1,4});/g, function(d, hex, m) {
return String.fromCharCode(+((hex ? "0x" : "") + m));
}).replace(/&\w+;/g, " "));
}
function flatten(o, k) {
if (typeof o === "string") return o;
var text = [];
for (k in o) {
var v = flatten(o[k], k);
if (v) text.push(v);
}
return text.join(" ");
}
function parseText(text) {
tags = {};
var cases = {};
text.split(wordSeparators).forEach(function(word) {
if (discard.test(word)) return;
word = word.replace(punctuation, "");
if (stopWords.test(word.toLowerCase())) return;
word = word.substr(0, maxLength);
cases[word.toLowerCase()] = word;
tags[word = word.toLowerCase()] = (tags[word] || 0) + 1;
});
tags = d3.entries(tags).sort(function(a, b) { return b.value - a.value; });
tags.forEach(function(d) { d.key = cases[d.key]; });
generate();
}
function generate() {
layout
.font("Impact")
.spiral("archimedean");
fontSize = d3.scale["log"]().range([10, 100]);
if (tags.length) fontSize.domain([+tags[tags.length - 1].value || 1, +tags[0].value]);
complete = 0;
//statusText.style("display", null);
words = [];
layout.stop().words(tags.slice(0, max = Math.min(tags.length, 250))).start();
}
function draw(data, bounds) {
statusText.style("display", "none");
scale = bounds ? Math.min(
w / Math.abs(bounds[1].x - w / 2),
w / Math.abs(bounds[0].x - w / 2),
h / Math.abs(bounds[1].y - h / 2),
h / Math.abs(bounds[0].y - h / 2)) / 2 : 1;
words = data;
var text = vis.selectAll("text")
.data(words, function(d) { return d.text.toLowerCase(); });
text.transition()
.duration(1000)
.attr("transform", function(d) { return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; })
.style("font-size", function(d) { return d.size + "px"; });
text.enter().append("text")
.attr("text-anchor", "middle")
.attr("transform", function(d) { return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; })
.style("font-size", function(d) { return d.size + "px"; })
.style("opacity", 1e-6)
.transition()
.duration(1000)
.style("opacity", 1);
text.style("font-family", function(d) { return d.font; })
.style("fill", function(d) { return fill(d.text.toLowerCase()); })
.text(function(d) { return d.text; });
var exitGroup = background.append("g")
.attr("transform", vis.attr("transform"));
var exitGroupNode = exitGroup.node();
text.exit().each(function() {
exitGroupNode.appendChild(this);
});
exitGroup.transition()
.duration(1000)
.style("opacity", 1e-6)
.remove();
vis.transition()
.delay(1000)
.duration(750)
.attr("transform", "translate(" + [w >> 1, h >> 1] + ")scale(" + scale + ")");
}
(function() {
var r = 40.5,
px = 35,
py = 20;
var angles = d3.select("#angles").append("svg")
.attr("width", 2 * (r + px))
.attr("height", r + 1.5 * py)
.append("g")
.attr("transform", "translate(" + [r + px, r + py] +")");
angles.append("path")
.style("fill", "none")
.attr("d", ["M", -r, 0, "A", r, r, 0, 0, 1, r, 0].join(" "));
angles.append("line")
.attr("x1", -r - 7)
.attr("x2", r + 7);
angles.append("line")
.attr("y2", -r - 7);
angles.selectAll("text")
.data([-90, 0, 90])
.enter().append("text")
.attr("dy", function(d, i) { return i === 1 ? null : ".3em"; })
.attr("text-anchor", function(d, i) { return ["end", "middle", "start"][i]; })
.attr("transform", function(d) {
d += 90;
return "rotate(" + d + ")translate(" + -(r + 10) + ")rotate(" + -d + ")translate(2)";
})
.text(function(d) { return d + "°"; });
var radians = Math.PI / 180,
from,
to,
count,
scale = d3.scale.linear(),
arc = d3.svg.arc()
.innerRadius(0)
.outerRadius(r);
getAngles();
function getAngles() {
count = 5;
from = Math.max(-90, Math.min(90, -60));
to = Math.max(-90, Math.min(90, 60));
update();
}
function update() {
scale.domain([0, count - 1]).range([from, to]);
var step = (to - from) / count;
var path = angles.selectAll("path.angle")
.data([{startAngle: from * radians, endAngle: to * radians}]);
path.enter().insert("path", "circle")
.attr("class", "angle")
.style("fill", "#fc0");
path.attr("d", arc);
var line = angles.selectAll("line.angle")
.data(d3.range(count).map(scale));
line.enter().append("line")
.attr("class", "angle");
line.exit().remove();
line.attr("transform", function(d) { return "rotate(" + (90 + d) + ")"; })
.attr("x2", function(d, i) { return !i || i === count - 1 ? -r - 5 : -r; });
var drag = angles.selectAll("path.drag")
.data([from, to]);
drag.enter().append("path")
.attr("class", "drag")
.attr("d", "M-9.5,0L-3,3.5L-3,-3.5Z")
.call(d3.behavior.drag()
.on("drag", function(d, i) {
d = (i ? to : from) + 90;
var start = [-r * Math.cos(d * radians), -r * Math.sin(d * radians)],
m = [d3.event.x, d3.event.y],
delta = ~~(Math.atan2(cross(start, m), dot(start, m)) / radians);
d = Math.max(-90, Math.min(90, d + delta - 90)); // remove this for 360°
delta = to - from;
if (i) {
to = d;
if (delta > 360) from += delta - 360;
else if (delta < 0) from = to;
} else {
from = d;
if (delta > 360) to += 360 - delta;
else if (delta < 0) to = from;
}
update();
})
.on("dragend", generate));
drag.attr("transform", function(d) { return "rotate(" + (d + 90) + ")translate(-" + r + ")"; });
layout.rotate(function() {
return scale(~~(Math.random() * count));
});
}
function cross(a, b) { return a[0] * b[1] - a[1] * b[0]; }
function dot(a, b) { return a[0] * b[0] + a[1] * b[1]; }
})();
$(function() {
updateCloud = function () {
$.get("{{request.get_full_path}}?raw_tweets=1",function(html) {
parseHTML(html);
},"html")
};
setInterval(updateCloud,1000*{% if stream.period > 5 %}{{stream.period}}{% else %}5{% endif %})
updateCloud();
})
</script>
{% endblock %}
......@@ -37,20 +37,14 @@ def streaming_tweet_cloud(request,widget,stream):
tweet_data = StreamWidgetData.objects.get(widget=widget,stream=stream).value
except:
tweet_data = []
tweets_unsorted = tweet_data
tweets = sorted(tweets_unsorted, key=operator.itemgetter('created_at'))
tweets.reverse()
paginator = Paginator(tweets,20)
page=request.GET.get('page')
try:
tweets = paginator.page(page)
except PageNotAnInteger:
tweets = paginator.page(1)
except EmptyPage:
tweets = paginator.page(paginator.num_pages)
tweets = tweet_data
return render(request, 'streaming_vizualizations/streaming/display_tweets.html', {'tweets':tweets,'widget':widget,
'stream':stream,'paged':tweets})
if request.GET.get('raw_tweets')=='1':
return render(request, 'streaming_vizualizations/streaming/raw_tweets.html', {'tweets':tweets,'widget':widget,
'stream':stream})
else:
return render(request, 'streaming_vizualizations/streaming/tweet_cloud.html', {'tweets':tweets,'widget':widget,
'stream':stream})
def streaming_display_tweets_visualization(request,widget,stream):
try:
......
......@@ -19,6 +19,7 @@ urlpatterns += patterns('',
url(r'^save-position/', 'workflows.views.save_position', name='save position'),
url(r'^add-connection/', 'workflows.views.add_connection', name='add connection'),
url(r'^delete-widget/', 'workflows.views.delete_widget', name='delete widget'),
url(r'^delete-workflow/', 'workflows.views.delete_workflow', name='delete workflow'),
url(r'^delete-connection/', 'workflows.views.delete_connection', name='delete connection'),
url(r'^add-subprocess/', 'workflows.views.add_subprocess', name='add subprocess'),
url(r'^get-subprocess/', 'workflows.views.get_subprocess', name='get subprocess'),
......@@ -34,7 +35,7 @@ urlpatterns += patterns('',
url(r'^save-configuration/', 'workflows.views.save_configuration', name='save configuration'),
url(r'^get-rename/', 'workflows.views.get_rename_dialog', name='rename widget dialog'),
url(r'^rename-widget/', 'workflows.views.rename_widget', name='rename widget'),
url(r'^rename-workflow/', 'workflows.views.rename_workflow', name='rename workflow'),
url(r'^rename-workflow/', 'workflows.views.rename_workflow', name='rename workflow'),
url(r'^run-widget/', 'workflows.views.run_widget', name='run widget'),
url(r'^widget-results/', 'workflows.views.widget_results', name='widget results'),
url(r'^widget-visualization/', 'workflows.views.visualize_widget', name='widget visualization'),
......@@ -43,28 +44,28 @@ urlpatterns += patterns('',
url(r'^widget-interaction/', 'workflows.views.widget_interaction', name='widget interaction'),
url(r'^finish-interaction/', 'workflows.views.finish_interaction', name='finish interaction'),
url(r'^import-webservice/', 'workflows.views.import_webservice', name='import webservice'),
url(r'^documentation/', 'workflows.views.documentation', name='documentation'),
url(r'^get-designate-dialogs/', 'workflows.views.get_designate_dialogs', name='get designate dialogs'),
url(r'^save-designation/', 'workflows.views.save_designation', name='save designation'),
url(r'^get-category/', 'workflows.views.get_category', name='get category'),
url(r'^widget-progress/', 'workflows.views.widget_progress', name='widget progress'),
url(r'^copy-workflow/(?P<workflow_id>[0-9]+)/$', 'workflows.views.copy_workflow', name='copy workflow'),
url(r'^workflow-url/', 'workflows.views.workflow_url', name='workflow url'),
url(r'^workflow-url/', 'workflows.views.workflow_url', name='workflow url'),
url(r'^unfinish-visualizations/', 'workflows.views.unfinish_visualizations', name='unfinish visualizations'),
url(r'^(?P<workflow_id>[0-9]+)/$', 'workflows.views.open_workflow', name='open workflow'),
url(r'^reset-widget/', 'workflows.views.reset_widget', name='reset widget'),
url(r'^get-executed-status/', 'workflows.views.get_executed_status', name='get executed status'),
url(r'^reset-workflow/', 'workflows.views.reset_workflow', name='reset workflow'),
url(r'^export-package/(?P<packages>.+)/$', 'workflows.views.export_package', name='export_package'),
)
\ No newline at end of file
)
......@@ -378,6 +378,17 @@ def delete_widget(request):
else:
return HttpResponse(status=400)
@login_required
def delete_workflow(request):
if request.is_ajax() or DEBUG:
w = get_object_or_404(Workflow, pk=request.GET['workflow_id'])
if (w.user!=request.user):
return HttpResponse(status=400)
w.delete()
return HttpResponse("Ok")
else:
return HttpResponse(status=400)
@login_required
def add_subprocess(request):
if request.is_ajax() or DEBUG:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment