Commit 99f7c2e2 authored by ecrombag's avatar ecrombag

Made MessageContainer for displaying static messages

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@946 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 2f2c2eb7
......@@ -29,6 +29,7 @@
,{"text":"TTCCommon.js","path":"src/js/ttc/"}
,{"text":"FormContainer.js","path":"src/js/ttc/"}
,{"text":"FinishedContainer.js","path":"src/js/ttc/"}
,{"text":"MessageContainer.js","path":"src/js/ttc/"}
,{"text":"MonitorContainer.js","path":"src/js/ttc/"}
,{"text":"InstructionContainer.js","path":"src/js/ttc/"}
,{"text":"ResultContainer.js","path":"src/js/ttc/"}
......
Ext.ns('itasks.ttc');
itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
initComponent : function() {
this.buildComponents(this);
this.tbar = this.content.tbar;
delete this.content;
Ext.apply(this,
{ layout: 'anchor'
, taskUpdates : {}
, url: itasks.config.serverUrl + '/work/tab'
, items: [this.descpanel,this.panel]
, unstyled: true
, autoScroll: true
, cls: 'MessageContainer'
});
itasks.ttc.MessageContainer.superclass.initComponent.apply(this,arguments);
},
buildComponents: function(data){
data.content.form.buttons = data.content.buttons;
this.panel = {
xtype: 'itasks.ttc.message.panel',
items: data.content.form
}
this.descpanel = {
xtype: 'itasks.ttc.message.description',
html: data.description
}
},
afterRender: function(){
itasks.ttc.MessageContainer.superclass.afterRender.call(this,arguments);
//attachTaskHandlers is moved to file 'TTCCommon.js'
itasks.ttc.common.attachTaskHandlers(this);
var tb = this.getTopToolbar();
this.setupToolbar(tb);
},
addUpdate: function(name, value) {
this.taskUpdates[name] = value;
},
sendUpdates: function(delay) {
if(delay) {
new Ext.util.DelayedTask().delay(250,this.sendUpdates,this);
} else {
var wt = this.findParentByType(itasks.WorkPanel);
if(!wt) return;
wt.sendTaskUpdates(this.taskId,this.taskUpdates);
this.taskUpdates = {};
}
},
setupToolbar: function(tb) {
tb.setVisible(tb.items.length > 0);
var enabledPresent = false;
for(var i = 0; i < tb.items.length; i++)
if(!tb.get(i).disabled) {
enabledPresent = true;
break;
}
var cls = 'GroupToolbarNoEnabledItems';
if(enabledPresent)
tb.removeClass(cls);
else {
tb.removeClass(cls);
tb.addClass(cls);
}
}
});
Ext.ns('itasks.ttc.message');
itasks.ttc.message.MessageDescription = Ext.extend(Ext.Panel,{
initComponent : function(){
Ext.apply(this,{
cls: 'task-description MessageDescription',
unstyled: true,
});
itasks.ttc.message.MessageDescription.superclass.initComponent.apply(this,arguments);
}
});
itasks.ttc.message.MessagePanel = Ext.extend(Ext.Panel, {
initComponent : function(){
Ext.apply(this,
{ layout: 'fit'
, unstyled: true
, cls: 'MessagePanel'
});
itasks.ttc.message.MessagePanel.superclass.initComponent.apply(this,arguments);
}
});
Ext.reg('itasks.ttc.message',itasks.ttc.MessageContainer);
Ext.reg('itasks.ttc.message.panel', itasks.ttc.message.MessagePanel);
Ext.reg('itasks.ttc.message.description', itasks.ttc.message.MessageDescription);
\ No newline at end of file
......@@ -13,6 +13,8 @@ itasks.ttc.common.attachTaskHandlers = function(comp,taskId){
ct = this.findParentByType(itasks.ttc.GroupContainer);
if (!ct)
ct = this.findParentByType(itasks.ttc.InstructionContainer);
if(!ct)
ct = this.findParentByType(itasks.ttc.MessageContainer);
if(!ct) return;
//Helper function to get the value of a checkbox group
......@@ -45,6 +47,8 @@ itasks.ttc.common.attachTaskHandlers = function(comp,taskId){
ct = this.findParentByType(itasks.ttc.GroupContainer);
if (!ct)
ct = this.findParentByType(itasks.ttc.InstructionContainer);
if(!ct)
ct = this.findParentByType(itasks.ttc.MessageContainer);
if(!ct) return;
var taskId = (comp.taskId)? comp.taskId : ct.taskId
......
......@@ -68,15 +68,16 @@
<!-- TTC -->
<script type="text/javascript" src="../js/ttc/TTCCommon.js"></script>
<script type="text/javascript" src="../js/ttc/ParallelContainer.js"></script>
<script type="text/javascript" src="../js/ttc/GroupContainer.js"></script>
<script type="text/javascript" src="../js/ttc/ParallelContainer.js"></script>
<script type="text/javascript" src="../js/ttc/FormContainer.js"></script>
<script type="text/javascript" src="../js/ttc/FinishedContainer.js"></script>
<script type="text/javascript" src="../js/ttc/MonitorContainer.js"></script>
<script type="text/javascript" src="../js/ttc/FormContainer.js"></script>
<script type="text/javascript" src="../js/ttc/InstructionContainer.js"></script>
<script type="text/javascript" src="../js/ttc/ResultContainer.js"></script>
<script type="text/javascript" src="../js/ttc/MessageContainer.js"></script>
<script type="text/javascript" src="../js/ttc/MonitorContainer.js"></script>
<script type="text/javascript" src="../js/ttc/ProcessControlContainer.js"></script>
<script type="text/javascript" src="../js/ttc/ResultContainer.js"></script>
<!-- core -->
<script type="text/javascript" src="../js/itasks.LoginWindow.js"></script>
......
This diff was suppressed by a .gitattributes entry.
......@@ -273,8 +273,8 @@ div.task-description {
div.task-context {
padding: 2px;
margin: 0px 0px 15px 0px;
background: #fff !important;
border-width: 1px !important;
/*background: #fff !important;
border-width: 1px !important;*/
}
div.task-context th {
font-weight: bold;
......
......@@ -19,6 +19,7 @@
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
width: 700px;
background-repeat: repeat;
}
.FormDescription {
......@@ -50,6 +51,7 @@
border-bottom:1px solid #ddd;
border-left:1px solid #ddd;
border-right:1px solid #ddd;
background-repeat: repeat;
}
.GroupFixedNoFocus .task-description {
......@@ -97,6 +99,7 @@
border: 1px solid #99BBE8;
width: 700px;
margin: 10px 0px 0px 10px;
background-repeat: repeat;
}
/* Result Container */
......@@ -126,6 +129,7 @@
border-right: 1px solid #99BBE8;
width: 700px;
margin: 0px 0px 0px 10px;
background-repeat: repeat;
}
/* Parallel Container */
......@@ -151,6 +155,7 @@
border-bottom: 1px solid #99BBE8;
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
background-repeat: repeat;
}
/* Instruction Container */
......@@ -179,6 +184,7 @@
border-right: 1px solid #99BBE8;
width: 700px;
margin: 0px 0px 0px 10px;
background-repeat: repeat;
}
.InstructionContainer-Context {
......@@ -190,6 +196,7 @@
border-right: 1px solid #99BBE8;
width: 700px;
margin: 0px 0px 0px 10px;
background-repeat: repeat;
}
/* Process Control Container */
......@@ -218,6 +225,35 @@
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
width: 700px;
background-repeat: repeat;
}
/* Message Container */
.MessageContainer {
background-color: #eee;
background-image : url('img/ttc-icons/TTCMessageContainer.png') !important;
background-repeat: no-repeat ;
background-position: 3px 3px;
}
.MessagePanel {
background-image : url('img/ttc-icons/TTCBackground80.png') !important;
padding: 4px;
border-left: 1px solid #99BBE8;
border-bottom: 1px solid #99BBE8;
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
width: 700px;
background-repeat: repeat;
}
.MessageDescription {
background-image : url('img/ttc-icons/TTCDescriptionBackground.png') !important;
background-repeat: repeat-x;
border: 1px solid #99BBE8;
margin: 10px 0px 0px 10px;
width: 700px;
}
......
......@@ -292,7 +292,7 @@ makeMessageTask message context actions tst=:{taskNr}
| isEmpty updates
# menuActions = evaluateConditions (getMenuActions actions) True Void
# buttonActions = evaluateConditions buttonActions True Void
# tst = setTUIDef (taskPanel taskId (html message) context Nothing (makeButtons editorId buttonActions)) (html message) menuActions tst
# tst = setTUIMessage (taskPanel taskId (html message) context Nothing (makeButtons editorId buttonActions)) (html message) menuActions tst
= (TaskBusy, tst)
| otherwise
# (action,tst) = getAction updates (map fst buttonActions) tst
......@@ -492,8 +492,8 @@ where
(case mbContext of Just context = [taskContextPanel ("context-"+++taskid) context]; Nothing = []) ++
(case mbForm of Just form = [taskFormPanel form]; Nothing = [])
taskDescriptionPanel :: !String ![HtmlTag] -> TUIDef
taskDescriptionPanel panelid description = TUIHtmlPanel {TUIHtmlPanel| id = panelid, html = toString (DivTag [] description), border = False, bodyCssClass = "task-description", fieldLabel = Nothing, hideLabel = True, unstyled=True}
//taskDescriptionPanel :: !String ![HtmlTag] -> TUIDef
//taskDescriptionPanel panelid description = TUIHtmlPanel {TUIHtmlPanel| id = panelid, html = toString (DivTag [] description), border = False, bodyCssClass = "task-description", fieldLabel = Nothing, hideLabel = True, unstyled=True}
taskContextPanel :: !String ![HtmlTag] -> TUIDef
taskContextPanel panelid context = TUIHtmlPanel {TUIHtmlPanel| id = panelid, html = toString (DivTag [] (html context)), border = False, bodyCssClass = "task-context", fieldLabel = Nothing, hideLabel = True, unstyled=True}
......
......@@ -298,6 +298,7 @@ applyTask :: !(Task a) !*TSt -> (!TaskResult a,!*TSt) | iTask a
setTUIDef :: !(TUIDef,[TUIButton]) [HtmlTag] ![(Action,Bool)] !*TSt -> *TSt
setTUIUpdates :: ![TUIUpdate] ![(Action,Bool)] !*TSt -> *TSt //Only for interactive tasks
setTUIFunc :: (*TSt -> *(!InteractiveTask, !*TSt)) [HtmlTag] !*TSt -> *TSt //Only for interactive tasks
setTUIMessage :: !(TUIDef,[TUIButton]) [HtmlTag] ![(Action,Bool)] !*TSt -> *TSt //Only for interactive tasks
setStatus :: ![HtmlTag] !*TSt -> *TSt //Only for monitor tasks
getUserUpdates :: !*TSt -> ([(String,String)],!*TSt)
......
......@@ -652,6 +652,12 @@ setTUIFunc func taskDescription tst=:{tree}
(TTInteractiveTask info _) = {tst & tree = TTInteractiveTask {info & taskDescription = foldl (+++) "" (map toString taskDescription)} (Func func)}
_ = tst
setTUIMessage :: !(TUIDef,[TUIButton]) [HtmlTag] ![(Action,Bool)] !*TSt -> *TSt
setTUIMessage msg taskDescription accActions tst=:{tree}
= case tree of
(TTInteractiveTask info _) = {tst & tree = TTInteractiveTask {info & taskDescription = foldl (+++) "" (map toString taskDescription)} (Message msg accActions)}
_ = tst
setStatus :: ![HtmlTag] !*TSt -> *TSt
setStatus msg tst=:{tree}
= case tree of
......
......@@ -12,6 +12,7 @@ derive JSONEncode TTCFormContainer, TTCMonitorContainer, TTCResultContainer, TTC
= TaskDone
| TaskRedundant
| TTCFormContainer TTCFormContainer
| TTCMessageContainer TTCMessageContainer
| TTCMonitorContainer TTCMonitorContainer
| TTCInstructionContainer TTCInstructionContainer
| TTCResultContainer TTCResultContainer
......@@ -45,6 +46,15 @@ derive JSONEncode TTCFormContainer, TTCMonitorContainer, TTCResultContainer, TTC
, subtaskId :: !(Maybe String)
, description :: !String
}
:: TTCMessageContainer =
{ xtype :: !String
, id :: !String
, taskId :: !String
, content :: !FormContent
, subtaskId :: !(Maybe String)
, description :: !String
}
:: TTCMonitorContainer =
{ xtype :: !String
......@@ -89,12 +99,6 @@ derive JSONEncode TTCFormContainer, TTCMonitorContainer, TTCResultContainer, TTC
, content :: ![TaskPanel]
}
:: GroupContainerElement =
{ panel :: TaskPanel
, behaviour :: GroupedBehaviour
, index :: Int
}
:: TTCGroupContainer =
{ xtype :: !String
, taskId :: !String
......@@ -102,6 +106,12 @@ derive JSONEncode TTCFormContainer, TTCMonitorContainer, TTCResultContainer, TTC
, subtaskId :: !(Maybe String)
}
:: GroupContainerElement =
{ panel :: TaskPanel
, behaviour :: GroupedBehaviour
, index :: Int
}
:: SubtaskInfo =
{ finished :: !Bool
, properties :: !(Maybe TaskProperties)
......
......@@ -6,7 +6,7 @@ import Html
derive JSONEncode TaskProperties, TaskSystemProperties, TaskManagerProperties, TaskWorkerProperties, TaskPriority, TaskProgress, SubtaskInfo
derive JSONEncode TTCFormContainer, FormContent, TTCMonitorContainer, TTCResultContainer, TTCProcessControlContainer, TTCInstructionContainer
derive JSONEncode TTCFormContainer, FormContent, TTCMonitorContainer, TTCMessageContainer, TTCResultContainer, TTCProcessControlContainer, TTCInstructionContainer
derive JSONEncode TTCParallelContainer, TTCGroupContainer, GroupedBehaviour, GroupContainerElement
//JSON specialization for TaskPanel: Ignore the union constructor
......@@ -14,6 +14,7 @@ JSONEncode{|TaskPanel|} (TaskDone) c = ["\"done\"" : c]
JSONEncode{|TaskPanel|} (TaskRedundant) c = ["\"redundant\"" : c]
JSONEncode{|TaskPanel|} (TTCFormContainer x) c = JSONEncode{|*|} x c
JSONEncode{|TaskPanel|} (TTCMonitorContainer x) c = JSONEncode{|*|} x c
JSONEncode{|TaskPanel|} (TTCMessageContainer x) c = JSONEncode{|*|} x c
JSONEncode{|TaskPanel|} (TTCInstructionContainer x) c = JSONEncode{|*|} x c
JSONEncode{|TaskPanel|} (TTCResultContainer x) c = JSONEncode{|*|} x c
JSONEncode{|TaskPanel|} (TTCProcessControlContainer x) c = JSONEncode{|*|} x c
......@@ -51,6 +52,15 @@ buildTaskPanel tree menus currentUser tst = case tree of
(TTInteractiveTask ti (Func f))
# (fres,tst) = f tst
= buildTaskPanel (TTInteractiveTask ti fres) menus currentUser tst
(TTInteractiveTask ti (Message (msg,buttons) acceptedA))
= (TTCMessageContainer {TTCMessageContainer
| xtype = "itasks.ttc.message"
, id = "taskform-" +++ ti.TaskInfo.taskId
, taskId = ti.TaskInfo.taskId
, content = {form = msg, tbar = makeMenuBar menus acceptedA ti, buttons = map TUIButton buttons}
, subtaskId = Nothing
, description = ti.TaskInfo.taskDescription
}, tst)
(TTMonitorTask ti html)
= (TTCMonitorContainer {TTCMonitorContainer
| xtype = "itasks.ttc.monitor"
......@@ -166,6 +176,23 @@ buildSubtaskPanels tree stnr menus manager partype inClosed procProps tst = case
(TTInteractiveTask ti (Func f))
# (fres,tst) = f tst
= buildSubtaskPanels (TTInteractiveTask ti fres) stnr menus manager partype inClosed procProps tst
(TTInteractiveTask ti (Message (msg,buttons) acceptedA))
= ([{SubtaskContainer
| subtaskNr = stnr
, manager = manager
, inClosedPar = inClosed
, tasktree = tree
, processProperties = procProps
, taskpanel = TTCMessageContainer {TTCMessageContainer
| xtype = "itasks.ttc.message"
, id = "taskform-" +++ ti.TaskInfo.taskId
, taskId = ti.TaskInfo.taskId
, content = {form = msg, tbar = makeMenuBar menus acceptedA ti, buttons = map TUIButton buttons}
, subtaskId = Just (subtaskNrToString stnr)
, description = ti.TaskInfo.taskDescription
}
}], tst)
(TTMonitorTask ti html)
= ([{SubtaskContainer
| subtaskNr = stnr
......
......@@ -18,6 +18,7 @@ from TUIDefinition import :: TUIDef, :: TUIUpdate
:: InteractiveTask = Definition (TUIDef,[TUIButton]) [(Action,Bool)]
| Updates [TUIUpdate] [(Action,Bool)]
| Func (*TSt -> *(!InteractiveTask, !*TSt))
| Message (TUIDef,[TUIButton]) [(Action,Bool)]
:: TaskTree = TTMainTask TaskInfo TaskProperties (Maybe [Menu]) !(Maybe TaskParallelType) TaskTree //A task that is treated as a main chunk of work
| TTInteractiveTask TaskInfo InteractiveTask //A task that can be worked on through a gui
......
......@@ -33,7 +33,6 @@ eitherTest = eitherTask (enterInformation "Value 1") (enterInformation "Value 2"
maybeTest :: Task (Maybe (Int,Note))
maybeTest = (enterInformation "Value 1" -&?&- enterInformation "Value 2")
parExtendTest :: Task Int
parExtendTest =
group "Extender" "" extfunc id 0 [task]
......@@ -113,6 +112,17 @@ where
parse b = snd (unzip (sortBy (\l -> \r -> (fst l) < (fst r)) (snd b)))
parNestedTest4 :: Task[[Note]]
parNestedTest4 =
allProc [
{ user = toUserName "erik", task = allTest },
{ user = toUserName "erik", task = allTest }
] Open
parNestedTest5 :: Task ([Int],[Int])
parNestedTest5 =
parOpenTest -&&- parOpenTest
Start :: *World -> *World
Start world = startEngine [
workflow "Simple Test" (simpleTest >>= showMessageAbout "Result"),
......@@ -127,5 +137,7 @@ Start world = startEngine [
workflow "Closed Test" (parClosedTest >>= showMessageAbout "Result"),
workflow "Nested Test 1" (parNestedTest1 >>= showMessageAbout "Result"),
workflow "Nested Test 2" (parNestedTest2 >>= showMessageAbout "Result"),
workflow "Nested Test 3" (parNestedTest3 >>= showMessageAbout "Result")
workflow "Nested Test 3" (parNestedTest3 >>= showMessageAbout "Result"),
workflow "Nested Test 4" (parNestedTest4 >>= showMessageAbout "Result"),
workflow "Nested Test 5" (parNestedTest5 >>= showMessageAbout "Result")
] world
\ No newline at end of file
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