Commit ae243191 authored by matjaz's avatar matjaz

added template CrossBee application

parent ccc90892
......@@ -197,6 +197,7 @@ INSTALLED_APPS_WORKFLOWS_SUB = (
'workflows.perfeval',
'workflows.mysql',
'workflows.lemmagen',
'workflows.crossbee',
#WORKFLOWS_SUBAPP_PLACEHOLDER
)
......
[
{
"pk": 20,
"model": "workflows.category",
"fields": {
"uid": "8a36b427-3c07-4905-b62a-c9cc6b9d461a",
"parent": null,
"workflow": null,
"user": null,
"order": 3,
"name": "CrossBee"
}
},
{
"pk": 98,
"model": "workflows.abstractwidget",
"fields": {
"category": 20,
"treeview_image": "",
"name": "Create Integer List",
"is_streaming": false,
"uid": "41de0b36-c531-411e-bf99-dc6d304bc4c8",
"interaction_view": "",
"image": "",
"package": "crossbee",
"static_image": "construction_work .png",
"post_interact_action": "",
"user": null,
"visualization_view": "",
"action": "crossbee_create_integers",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 1,
"description": ""
}
},
{
"pk": 248,
"model": "workflows.abstractinput",
"fields": {
"widget": 98,
"name": "Integer List String",
"short_name": "str",
"uid": "32049f66-214a-4b25-a4ed-d4df961a62bc",
"default": "3\r\n2\r\n1\r\n4",
"required": false,
"multi": false,
"parameter_type": "textarea",
"variable": "intStr",
"parameter": true,
"order": 1,
"description": "Comma or new-line separated list of integers"
}
},
{
"pk": 253,
"model": "workflows.abstractinput",
"fields": {
"widget": 98,
"name": "Sort list",
"short_name": "bol",
"uid": "64511a98-df6c-4643-b727-abb2ba696645",
"default": "true",
"required": true,
"multi": false,
"parameter_type": "checkbox",
"variable": "sort",
"parameter": true,
"order": 2,
"description": "Should the list be sorted"
}
},
{
"pk": 104,
"model": "workflows.abstractoutput",
"fields": {
"widget": 98,
"name": "Integer List",
"short_name": "lst",
"variable": "intList",
"uid": "0b8eed09-4150-4451-92c7-1d44bdb5d004",
"order": 1,
"description": "List of integers"
}
},
{
"pk": 101,
"model": "workflows.abstractwidget",
"fields": {
"category": 20,
"treeview_image": "",
"name": "Filter Integers",
"is_streaming": false,
"uid": "6206b6f9-b3d6-4fff-95fc-0983adda7b29",
"interaction_view": "crossbee_filter_integers",
"image": "",
"package": "crossbee",
"static_image": "construction_work .png",
"post_interact_action": "crossbee_post_filter_integers",
"user": null,
"visualization_view": "",
"action": "crossbee_pre_filter_integers",
"wsdl_method": "",
"wsdl": "",
"interactive": true,
"has_progress_bar": false,
"order": 2,
"description": ""
}
},
{
"pk": 250,
"model": "workflows.abstractinput",
"fields": {
"widget": 101,
"name": "Integer List",
"short_name": "lst",
"uid": "b3727994-d2be-41ea-bb21-416f58b32232",
"default": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "intList",
"parameter": false,
"order": 1,
"description": "List of integers"
}
},
{
"pk": 106,
"model": "workflows.abstractoutput",
"fields": {
"widget": 101,
"name": "Filtered Integer List",
"short_name": "lst",
"variable": "intList",
"uid": "556ada77-eb44-4b4c-a738-2f1aee5253ba",
"order": 1,
"description": "Filtered list of integers"
}
},
{
"pk": 99,
"model": "workflows.abstractwidget",
"fields": {
"category": 20,
"treeview_image": "",
"name": "Sum Integers",
"is_streaming": false,
"uid": "09406cda-7d3e-43d0-89cc-26f8ae69c698",
"interaction_view": "",
"image": "",
"package": "crossbee",
"static_image": "construction_work .png",
"post_interact_action": "",
"user": null,
"visualization_view": "",
"action": "crossbee_sum_integers",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 3,
"description": ""
}
},
{
"pk": 249,
"model": "workflows.abstractinput",
"fields": {
"widget": 99,
"name": "Integer List",
"short_name": "lst",
"uid": "35cbd410-6eef-4eb3-9ea2-5211d9d164da",
"default": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "intList",
"parameter": false,
"order": 1,
"description": "List of integers"
}
},
{
"pk": 105,
"model": "workflows.abstractoutput",
"fields": {
"widget": 99,
"name": "Sum",
"short_name": "int",
"variable": "sum",
"uid": "6b99b92b-a0fc-49e5-a4a0-457607c1c0cf",
"order": 1,
"description": "Sum of integer list"
}
},
{
"pk": 100,
"model": "workflows.abstractwidget",
"fields": {
"category": 20,
"treeview_image": "",
"name": "Display Summation",
"is_streaming": false,
"uid": "4f844f8b-7dec-4d38-8030-b2bd2072e165",
"interaction_view": "",
"image": "",
"package": "crossbee",
"static_image": "construction_work .png",
"post_interact_action": "",
"user": null,
"visualization_view": "crossbee_display_summation",
"action": "crossbee_pre_display_summation",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 4,
"description": ""
}
},
{
"pk": 251,
"model": "workflows.abstractinput",
"fields": {
"widget": 100,
"name": "Integer List",
"short_name": "lst",
"uid": "28a082d5-8071-4f70-8d4a-8d21202eebd5",
"default": "",
"required": false,
"multi": false,
"parameter_type": null,
"variable": "intList",
"parameter": false,
"order": 1,
"description": "List of integers"
}
},
{
"pk": 252,
"model": "workflows.abstractinput",
"fields": {
"widget": 100,
"name": "Sum",
"short_name": "int",
"uid": "7893b2b8-e4ed-4e4a-98bf-0fb8ada3617c",
"default": "",
"required": false,
"multi": false,
"parameter_type": null,
"variable": "sum",
"parameter": false,
"order": 2,
"description": "Sum (possibly correct) of integer list"
}
}
]
\ No newline at end of file
from django.shortcuts import render
def crossbee_filter_integers(request,input_dict,output_dict,widget):
return render(request, 'interactions/crossbee_filter_integers.html',{'widget':widget,'intList':input_dict['intList']})
\ No newline at end of file
import re
def crossbee_create_integers(input_dict):
intStr = input_dict['intStr']
intList = []
for i in re.findall(r'\w+', intStr):
try:
intList.append(int(i))
except:
pass
if input_dict['sort'].lower() == "true":
intList.sort()
return {'intList':intList}
def crossbee_sum_integers(input_dict):
intList = input_dict['intList']
return {'sum':sum(intList)}
def crossbee_pre_filter_integers(input_dict):
return input_dict
def crossbee_post_filter_integers(postdata,input_dict,output_dict):
intListOut = postdata['intListOut']
intList = []
for i in intListOut:
try:
intList.append(int(i))
except:
pass
return {'intList': intList}
def crossbee_pre_display_summation(input_dict):
return {}
\ No newline at end of file
import os
# === STANDARD PACKAGE SETTINGS ===
PACKAGE_ROOT = os.path.dirname(__file__)
# === AUTO IMPORT OPTIONS ===
#If auto_import_package_data is true then given data file is automatically imported when ClowdFlows project is newly deployed or refreshed from git
AUTO_IMPORT_DB = False
#For auto_import_package_data_replace_option description see the 'replace' option in workflows/import_package command
AUTO_IMPORT_DB_REPLACE_OPTION = True
#If file(s) other than ./db/package_data.json should be imported, auto_import_package_data_files should be corrected
AUTO_IMPORT_DB_FILES = [os.path.join(PACKAGE_ROOT,'db/package_data.json')]
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
{% for i in intList %}
<input type="checkbox" name="intListOut" value="{{i}}" style="display:inline;width:auto;">{{i}}<br>
{% endfor %}
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetvisualization-{{widget.pk}}" rel="{{widget.pk}}" class="widgetvisualizationdialog" title="{{widget.name}} visualization">
<div style="width:400px;font-family:monospace;">
<table style="width:auto; border-collapse:collapse;">
{% for i in input_dict.intList %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{% if forloop.first %} {% else %}+{% endif %}
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{{ i }}
</td>
</tr>
{% endfor %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px; padding-top: 4px; margin:2px;">
=
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px;margin:2px;">
{{ input_dict.sum }}
</td>
</tr>
</table>
<br/>
{{ check }}
</div>
</div>
\ No newline at end of file
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/nx/Index.html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Index.html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Index(?P<document_id_from>[0-9]+)-(?P<document_id_to>[0-9]+).html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Document(?P<document_id>[0-9]+).html', 'workflows.latino.views.get_adc_page', name='get adc page'),
)
\ No newline at end of file
from django.shortcuts import render
def crossbee_display_summation(request,input_dict,output_dict,widget):
if sum(input_dict['intList']) == input_dict['sum']:
check = 'The calculation appears correct.'
else:
check = 'The calculation appears incorrect!'
return render(request, 'visualizations/crossbee_display_integers.html',{'widget':widget,'input_dict':input_dict, 'output_dict':output_dict, 'check':check})
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