Commit bdcf9cb0 authored by ecrombag's avatar ecrombag

Revised the masks. Now two masks are built during gUpdate and gVerify...

Revised the masks. Now two masks are built during gUpdate and gVerify (replacing gError/gHint): an UpdateMask and a VerifyMask. Unlike the 'old' mask, these masks have a treelike structure which follows the flow of the components in the form. Furthermore each node of the tree is a tri-state: Untouched, Touched and Blanked; indicating whether a component has never been filled out, has a value or had a value in the past, but is cleared again.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1150 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 8974ff6c
......@@ -313,7 +313,7 @@ itasks.WorkHeaderPanel = Ext.extend(Ext.Panel, {
'</div>'+
'</div>'+
'<div class="worktab-header-indicator">'
, worktabStatus(properties.workerProperties.progress),worktabBackground(properties.managerProperties.priority),subject, properties.systemProperties.manager
, worktabStatus(properties.workerProperties.progress),worktabBackground(properties.managerProperties.priority),subject, itasks.util.formatUser(properties.systemProperties.manager)
, itasks.util.formatDeadline(properties.managerProperties.deadline)
));
},
......
......@@ -10,7 +10,8 @@ itasks.WorkTabsPanel = Ext.extend(Ext.TabPanel, {
Ext.apply(this,{
activeItem: 0,
layoutOnTabChange: true,
items: {xtype: "itasks.hometab"}
items: {xtype: "itasks.hometab"},
bodyCssClass: "worktabs-body"
});
this.addEvents("taskOpened");
......
......@@ -201,6 +201,8 @@ itasks.ttc.FormContainer = Ext.extend(itasks.ttc.InteractionBase, {
clearErrorsNHints : function(){
var f = function(ct){
if(!ct) return true;
if(ct.setHint) ct.setHint(''); //empty string == clear
if(ct.setError) ct.setError('');
......
......@@ -3,23 +3,25 @@ Ext.ns('itasks.tui.common');
itasks.tui.common.markError = function(field,msg){
field.msgTarget = 'side';
if(field.rendered && !field.preventMark){
msg = msg || field.errorText;
var mt = field.getMessageHandler();
if(mt && mt.markError){
mt.markError(field, msg);
}else if(field.errorTarget){
var t = Ext.getDom(field.errorTarget);
if(t){
t.innerHTML = msg;
t.style.display = field.msgDisplay;
(function(){
if(field.rendered && !field.preventMark){
msg = msg || field.errorText;
var mt = field.getMessageHandler();
if(mt && mt.markError){
mt.markError(field, msg);
}else if(field.errorTarget){
var t = Ext.getDom(field.errorTarget);
if(t){
t.innerHTML = msg;
t.style.display = field.msgDisplay;
}
}
}
}
field.activeError = msg;
field.activeError = msg;
}).defer(50,this);
};
itasks.tui.common.clearError = function(field){
......@@ -42,23 +44,25 @@ itasks.tui.common.clearError = function(field){
itasks.tui.common.markHint = function(field,msg){
field.msgTarget = 'side';
if(field.rendered && !field.preventMark){
msg = msg || field.hintText;
var mt = field.getMessageHandler();
if(mt && mt.markHint){
mt.markHint(field, msg);
}else if(field.hintTarget){
var t = Ext.getDom(field.hintTarget);
if(t){
t.innerHTML = msg;
t.style.display = field.msgDisplay;
(function(){
if(field.rendered && !field.preventMark){
msg = msg || field.hintText;
var mt = field.getMessageHandler();
if(mt && mt.markHint){
mt.markHint(field, msg);
}else if(field.hintTarget){
var t = Ext.getDom(field.hintTarget);
if(t){
t.innerHTML = msg;
t.style.display = field.msgDisplay;
}
}
}
}
field.activeHint = msg;
field.activeHint = msg;
}).defer(50,this);
};
itasks.tui.common.clearHint = function(field){
......@@ -79,6 +83,7 @@ itasks.tui.common.clearHint = function(field){
};
itasks.tui.common.alignHintIcon = function(field){
if(field.wrap){
field.hintIcon.alignTo(field.wrap, 'tl-tr', [2, 0]);
}else{
......@@ -87,6 +92,7 @@ itasks.tui.common.alignHintIcon = function(field){
};
itasks.tui.common.alignErrIcon = function(field){
if(field.wrap){
field.errIcon.alignTo(field.wrap, 'tl-tr', [2, 0]);
}else{
......@@ -100,15 +106,13 @@ Ext.apply(Ext.form.MessageTargets.side, {
if(!field.errIcon){
var elp = field.getErrorCt();
if(!elp){
field.el.dom.title = msg;
return;
}
if(!elp) return;
field.errIcon = elp.createChild({cls: 'x-form-invalid-icon'});
if(field.ownerCt){
field.ownerCt.on('afterlayout', function(){ itasks.tui.common.alignErrIcon(this)}, field);
field.ownerCt.on('expand', function(){ itasks.tui.common.alignErrIcon(this)}, field);
//field.ownerCt.on('afterlayout', function(){ itasks.tui.common.alignErrIcon(this)}, field);
//field.ownerCt.on('expand', function(){ itasks.tui.common.alignErrIcon(this)}, field);
}
field.on('resize', function(){ itasks.tui.common.alignErrIcon(this)}, field);
field.on('destroy', function(){ Ext.destroy(this.errIcon); },field);
......@@ -121,25 +125,22 @@ Ext.apply(Ext.form.MessageTargets.side, {
},
clearError : function(field){
if(field.errIcon){
if(field.errIcon && field.errIcon.dom){
field.errIcon.dom.qtip = '';
field.errIcon.hide();
}
},
markHint : function(field, msg){
markHint : function(field, msg){
if(!field.hintIcon){
var elp = field.getErrorCt();
if(!elp){
field.el.dom.title = msg;
return;
}
if(!elp) return;
field.hintIcon = elp.createChild({cls: 'x-form-hint-icon'});
if(field.ownerCt){
field.ownerCt.on('afterlayout', function() {itasks.tui.common.alignHintIcon(this)}, field);
field.ownerCt.on('expand', function() {itasks.tui.common.alignHintIcon(this)}, field);
//field.ownerCt.on('afterlayout', function() {itasks.tui.common.alignHintIcon(this)}, field);
//field.ownerCt.on('expand', function() {itasks.tui.common.alignHintIcon(this)}, field);
}
field.on('resize', function() {itasks.tui.common.alignHintIcon(this)}, field);
field.on('destroy', function(){ Ext.destroy(this.hintIcon); }, field);
......@@ -152,7 +153,7 @@ Ext.apply(Ext.form.MessageTargets.side, {
},
clearHint: function(field){
if(field.hintIcon){
if(field.hintIcon && field.hintIcon.dom){
field.hintIcon.dom.qtip = '';
field.hintIcon.hide();
}
......
This diff was suppressed by a .gitattributes entry.
......@@ -188,6 +188,10 @@ div.newtask-container .x-panel-body {
background: #eee;
}*/
.worktabs-body{
background: #edf0f3 url('img/worktabs-background.png') repeat-x;
}
div.worktab-header {
padding: 0px;
}
......
......@@ -51,7 +51,7 @@ makeInformationTask initial context actions actionStored tst=:{taskNr, newTask,
# taskId = taskNrToString taskNr
# editorId = "tf-" +++ taskNrToString taskNr
# (ovalue,tst) = readValue initial tst
# (omask,tst) = readMask initial tst
# (oumask,tst) = readMask initial tst
# buttonActions = getButtonActions actions
= case treeType of
SpineTree
......@@ -63,7 +63,8 @@ makeInformationTask initial context actions actionStored tst=:{taskNr, newTask,
# (anyEvent,tst) = anyEvents tst
| newTask || not anyEvent
// generate TUI definition
# (form,valid) = visualizeAsEditor editorId Nothing omask ovalue
# ovmask = verifyValue ovalue oumask
# (form,valid) = visualizeAsEditor editorId Nothing oumask ovmask ovalue
# menuActions = evaluateConditions (getMenuActions actions) valid ovalue
# buttonActions = evaluateConditions buttonActions valid ovalue
# tst = setTUIDef (taskPanel taskId context (Just form) (makeButtons editorId buttonActions)) menuActions tst
......@@ -75,16 +76,17 @@ makeInformationTask initial context actions actionStored tst=:{taskNr, newTask,
// no change for this task
# tst = setTUIUpdates [] [] tst
= (TaskBusy,tst)
| otherwise
# (nvalue,nmask,tst) = applyUpdates [(s2dp key,value) \\ (key,value) <- events | isdps key] ovalue omask tst
| otherwise
# (nvalue,numask,tst) = applyUpdates [(s2dp key,value) \\ (key,value) <- events | isdps key] ovalue oumask tst
# (action,tst) = getAction events (map fst buttonActions) tst
| isJust action
= (TaskFinished (fromJust action,nvalue),tst)
| otherwise
# tst = setTaskStore "value" nvalue tst
# tst = setTaskStore "mask" nmask tst
# tst = setTaskStore "mask" numask tst
# updpaths = events2Paths events
# (updates,valid) = determineEditorUpdates editorId Nothing updpaths omask nmask ovalue nvalue
# nvmask = verifyValue nvalue numask
# (updates,valid) = determineEditorUpdates editorId Nothing updpaths numask nvmask ovalue nvalue
# menuActions = evaluateConditions (getMenuActions actions) valid nvalue
# buttonActions = evaluateConditions buttonActions valid nvalue
# tst = setTUIUpdates (enables editorId buttonActions ++ updates) menuActions tst
......@@ -112,13 +114,13 @@ where
# tst = setTaskStore "mask" mask
{TSt|tst & iworld = iworld} // <- store the initial mask
= (mask,tst)
Nothing = ([],tst)
Nothing = ((Untouched True []),tst)
applyUpdates [] val mask tst = (val,mask,tst)
applyUpdates [(p,v):us] val mask tst=:{TSt|iworld}
# (val,mask,iworld) = updateValueAndMask p v val mask iworld
= applyUpdates us val mask {TSt|tst & iworld = iworld}
applyUpdates [] val umask tst = (val,umask,tst)
applyUpdates [(p,v):us] val umask tst=:{TSt|iworld}
# (val,umask,iworld) = updateValueAndMask p v val umask iworld
= applyUpdates us val umask {TSt|tst & iworld = iworld}
enterChoice :: !String !description [a] -> Task a | html description & iTask a
enterChoice subject description [] = throw (subject +++ ": cannot choose from empty option list")
......@@ -385,16 +387,18 @@ where
# (Just oEditV,tst) = getTaskStoreFor taskNr (addStorePrefix n "value") tst
# nEditV = editorFrom new
# tst=:{TSt|iworld} = tst
# (mask,iworld) = defaultMask nEditV iworld
# (umask,iworld) = defaultMask nEditV iworld
# (vmask) = verifyValue nEditV umask
# (events,tst) = getEvents {TSt|tst & iworld = iworld}
# updpaths = events2Paths postValues
= (determineEditorUpdates (editorId taskNr n) (Just n) updpaths mask mask oEditV nEditV,tst)
= (determineEditorUpdates (editorId taskNr n) (Just n) updpaths umask vmask oEditV nEditV,tst)
// generate TUI definition for view
visualize taskNr n stateV tst=:{TSt|iworld}
# editV = editorFrom stateV
# (mask,iworld) = defaultMask editV iworld
= (visualizeAsEditor (editorId taskNr n) (Just n) mask editV,{TSt|tst & iworld = iworld})
# (umask,iworld) = defaultMask editV iworld
# (vmask) = verifyValue editV umask
= (visualizeAsEditor (editorId taskNr n) (Just n) umask vmask editV,{TSt|tst & iworld = iworld})
listener :: !(Listener s a) -> View s | iTask a & iTask s & SharedVariable s
listener {listenerFrom} = Listener {Listener`|visualize = visualize}
......
......@@ -16,8 +16,7 @@ import GenVisualize, GenUpdate, GenMerge
derive gVisualize DBRef
derive gUpdate DBRef
derive gHint DBRef
derive gError DBRef
derive gVerify DBRef
derive gMerge DBRef
derive JSONEncode DBRef
......
......@@ -10,8 +10,7 @@ import GenVisualize, GenUpdate
derive gVisualize DBRef
derive gUpdate DBRef
derive gHint DBRef
derive gError DBRef
derive gVerify DBRef
derive gMerge DBRef
derive JSONEncode DBRef
......
......@@ -17,8 +17,7 @@ from Types import :: User (..)
derive gVisualize GAction, GOnlyAction
derive gUpdate GAction, GOnlyAction
derive gError GAction, GOnlyAction
derive gHint GAction, GOnlyAction
derive gVerify GAction, GOnlyAction
derive JSONEncode GAction, GOnlyAction
derive JSONDecode GAction, GOnlyAction
......
......@@ -21,8 +21,7 @@ import GenVisualize, GenUpdate
derive gVisualize GAction, GOnlyAction, GroupedBehaviour
derive gUpdate GAction, GOnlyAction, GroupedBehaviour
derive gError GAction, GOnlyAction, GroupedBehaviour
derive gHint GAction, GOnlyAction, GroupedBehaviour
derive gVerify GAction, GOnlyAction, GroupedBehaviour
derive JSONEncode GAction, GOnlyAction, GroupedBehaviour
derive JSONDecode GAction, GOnlyAction, GroupedBehaviour
......
......@@ -106,13 +106,7 @@ where
description tasks = "Do the following tasks one at a time:<br /><ul><li>" +++ (join "</li><li>" (map taskSubject tasks)) +++ "</li></ul>"
// Parallel / Grouped composition
derive gVisualize PSt
derive gUpdate PSt
derive gError PSt
derive gHint PSt
derive JSONEncode PSt
derive JSONDecode PSt
derive class iTask PSt
derive bimap Maybe, (,)
:: PSt a b =
......
......@@ -3,6 +3,7 @@ definition module CommonDomain
* This module provides a series of data types, their iTask generics obligations and utility
* functions for common data in workflows.
*/
import GenVisualize, GenUpdate, GenMerge
import StdString
......@@ -54,8 +55,7 @@ currentDateTime :: !*World -> (!DateTime,!*World)
derive gVisualize EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gUpdate EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gMerge EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gError EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gHint EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gVerify EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive JSONEncode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive JSONDecode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
......
This diff is collapsed.
......@@ -5,8 +5,7 @@ import GenUpdate, GenVisualize, GenMerge
derive gVisualize FormattedText, SourceCode, Color
derive gUpdate FormattedText, SourceCode, Color
derive gMerge FormattedText, SourceCode, Color
derive gError FormattedText, SourceCode, Color
derive gHint FormattedText, SourceCode, Color
derive gVerify FormattedText, SourceCode, Color
derive JSONEncode FormattedText, SourceCode, Color
derive JSONDecode FormattedText, SourceCode, Color
......
......@@ -4,8 +4,7 @@ import iTasks, Text
derive gUpdate FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive gMerge FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive gError FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive gHint FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive gVerify FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive JSONEncode FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
derive JSONDecode FormattedText, FormattedTextControls, SourceCode, SourceCodeLanguage, Color
......@@ -72,7 +71,12 @@ noControls = { alignmentControls = False
, enableSourceEdit :: !Bool
}
gVisualize{|FormattedText|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid,errorMask}
gVisualize{|FormattedText|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid,updateMask,verifyMask}
#(cmu,um) = popMask updateMask
#(cmv,vm) = popMask verifyMask
#(valid,err,hnt) = verifyElementStr valid cmu cmv
# oldV = value2s (fst (popMask cmu)) old
# newV = value2s (fst (popMask cmu)) new
= case vizType of
VEditorDefinition = ([TUIFragment (TUICustom (toJSON
{ TUIFormattedText
......@@ -92,25 +96,24 @@ gVisualize{|FormattedText|} old new vst=:{vizType,label,idPrefix,currentPath,use
, enableSourceEdit = controls.sourceEditControl
}
))]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask old optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath, valid= valid, updateMask = um, verifyMask = vm})
VEditorUpdate
| oldV <> newV = ([TUIUpdate (TUISetValue id (replaceMarkers newV))]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath, valid= valid, updateMask = um, verifyMask = vm})
_ # htmlFrag = case old of
VBlank = Text ""
VValue v _ = html v
VValue v = html v
= ([HtmlFragment [htmlFrag]]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath})
where
// Use the path to the inner constructor instead of the current path.
// This way the generic gUpdate will work for this type
contentPath = shiftDataPath currentPath
id = dp2id idPrefix contentPath
oldV = value2s contentPath old
newV = value2s contentPath new
controls = case old of
VBlank = allControls
VValue (FormattedText _ controls) _ = controls
VValue (FormattedText _ controls) = controls
replaceMarkers v
# v = replaceSubString SelectionStartMarker ("<markerstart id='" +++ id +++ "_marker-start'></markerstart>") v
......@@ -194,7 +197,12 @@ getSource (SourceCode src _) = src
, optional :: !Bool
}
gVisualize{|SourceCode|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid, renderAsStatic,errorMask}
gVisualize{|SourceCode|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid, renderAsStatic,updateMask,verifyMask}
#(cmu,um) = popMask updateMask
#(cmv,vm) = popMask verifyMask
# oldV = value2s (fst (popMask cmu)) old
# newV = value2s (fst (popMask cmu)) new
#(valid,err,hnt) = verifyElementStr valid cmu cmv
= case vizType of
VEditorDefinition = ([TUIFragment (TUICustom (toJSON
{ TUISourceCode
......@@ -208,25 +216,23 @@ gVisualize{|SourceCode|} old new vst=:{vizType,label,idPrefix,currentPath,useLab
, language = language
}
))]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask old optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath, valid= valid, updateMask = um, verifyMask = vm})
VEditorUpdate
| oldV <> newV = ([TUIUpdate (TUISetValue id newV)]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath})
_ # htmlFrag = case old of
VBlank = Text ""
VValue v _ = html v
VValue v = html v
= ([HtmlFragment [htmlFrag]]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath})
where
// Use the path to the inner constructor instead of the current path.
// This way the generic gUpdate will work for this type
contentPath = shiftDataPath currentPath
id = dp2id idPrefix contentPath
oldV = value2s contentPath old
newV = value2s contentPath new
language = case old of
VBlank = ""
VValue (SourceCode _ lang) _ = case lang of
VValue (SourceCode _ lang) = case lang of
JS = "js"
CSS = "css"
PHP = "php"
......@@ -242,7 +248,12 @@ instance toString SourceCode
where
toString (SourceCode src _) = src
gVisualize{|Color|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid, renderAsStatic,errorMask}
gVisualize{|Color|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,optional,valid, renderAsStatic,updateMask,verifyMask}
#(cmu,um) = popMask updateMask
#(cmv,vm) = popMask verifyMask
# oldV = value2s (fst (popMask cmu)) old
# newV = value2s (fst (popMask cmu)) new
#(valid,err,hnt) = verifyElementStr valid cmu cmv
= case vizType of
VEditorDefinition = ([TUIFragment (TUICustom (toJSON
{ TUIColorChooser
......@@ -255,22 +266,20 @@ gVisualize{|Color|} old new vst=:{vizType,label,idPrefix,currentPath,useLabels,o
, staticDisplay = renderAsStatic
}
))]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask old optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath, valid= valid, updateMask = um, verifyMask = vm})
VEditorUpdate
| oldV <> newV = ([TUIUpdate (TUISetValue id newV)]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath, valid= valid, updateMask = um, verifyMask = vm})
_ # htmlFrag = case old of
VBlank = Text ""
VValue v _ = html v
VValue v = html v
= ([HtmlFragment [htmlFrag]]
, {VSt|vst & currentPath = stepDataPath currentPath, valid= stillValid contentPath errorMask new optional valid})
, {VSt|vst & currentPath = stepDataPath currentPath})
where
// Use the path to the inner constructor instead of the current path.
// This way the generic gUpdate will work for this type
contentPath = shiftDataPath currentPath
id = dp2id idPrefix contentPath
oldV = value2s contentPath old
newV = value2s contentPath new
instance html Color
where
......
......@@ -5,8 +5,7 @@ import Html, InteractionTasks, CommonDomain, GenVerify
derive gVisualize GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gUpdate GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gMerge GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gError GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gHint GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gVerify GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive JSONEncode GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive JSONDecode GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
......
......@@ -8,8 +8,7 @@ derive JSONDecode MVCUpdate, ClickUpdate, ClickSource, ClickEvent
derive gVisualize GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType
derive gUpdate GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gMerge GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gHint GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gError GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive gVerify GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive JSONEncode GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
derive JSONDecode GoogleMap, GoogleMapMarker, GoogleMapInfoWindow, GoogleMapType, GoogleStaticMap
......@@ -55,21 +54,21 @@ where
toString HYBRID = "HYBRID"
toString TERRAIN = "TERRAIN"
gError{|GoogleMap|} _ est = (stepOut est)
gVisualize {|GoogleMap|} old new vst=:{vizType, label, idPrefix, currentPath, valid, optional, useLabels}
gVisualize {|GoogleMap|} old new vst=:{vizType, label, idPrefix, currentPath, valid, optional, useLabels, updateMask, verifyMask}
# (cmu,um) = popMask updateMask
# (cmv,vm) = popMask verifyMask
= case vizType of
VEditorDefinition = ([TUIFragment (TUICustom ((mapPanel old (label2s optional label) (not useLabels) idPrefix currentPath True)))],{VSt | vst & currentPath = stepDataPath currentPath })
VEditorUpdate = ([TUIUpdate (TUISetValue (dp2id idPrefix currentPath) (toString (mapPanel new (label2s optional label) (not useLabels) idPrefix currentPath True)))],{VSt | vst & currentPath = stepDataPath currentPath })
VEditorDefinition = ([TUIFragment (TUICustom ((mapPanel old label (not useLabels) idPrefix currentPath True)))],{VSt | vst & currentPath = stepDataPath currentPath, updateMask = um, verifyMask = vm})
VEditorUpdate = ([TUIUpdate (TUISetValue (dp2id idPrefix currentPath) (toString (mapPanel new label (not useLabels) idPrefix currentPath True)))],{VSt | vst & currentPath = stepDataPath currentPath, updateMask = um, verifyMask = vm})
_ = (staticMapPanel old, {VSt | vst & currentPath = stepDataPath currentPath})
where
mapPanel VBlank fl hl idp cp ed = toJSON (tuidef mkMap fl hl idp cp ed)
mapPanel (VValue map _) fl hl idp cp ed = toJSON (tuidef map fl hl idp cp ed)
mapPanel (VValue map) fl hl idp cp ed = toJSON (tuidef map fl hl idp cp ed)
staticMapPanel VBlank
# (GoogleStaticMap w h u) = convertToStaticMap mkMap
= ([HtmlFragment [ImgTag [SrcAttr u, WidthAttr (toString w), HeightAttr (toString h)]]])
staticMapPanel (VValue map _)
staticMapPanel (VValue map)
# (GoogleStaticMap w h u) = convertToStaticMap map
= ([HtmlFragment [ImgTag [SrcAttr u, WidthAttr (toString w), HeightAttr (toString h)]]])
......@@ -98,7 +97,7 @@ where
}
gVisualize {|GoogleStaticMap|} VBlank _ vst = ([TextFragment "-"],vst)
gVisualize {|GoogleStaticMap|} (VValue (GoogleStaticMap w h u) _ ) _ vst=:{vizType,idPrefix,currentPath}
gVisualize {|GoogleStaticMap|} (VValue (GoogleStaticMap w h u)) _ vst=:{vizType,idPrefix,currentPath}
= case vizType of
VHtmlDisplay = ([HtmlFragment [ImgTag [SrcAttr u, WidthAttr (toString w), HeightAttr (toString h)]]],{VSt | vst & currentPath = stepDataPath currentPath})
VTextDisplay = ([TextFragment ("Static Map: "+++u)],{VSt | vst & currentPath = stepDataPath currentPath})
......@@ -116,7 +115,7 @@ where
, url = u
}
gUpdate {|GoogleMap|} _ ust =: {USt | mode=UDCreate} = (
gUpdate {|GoogleMap|} _ ust =: {USt | mode=UDCreate,newMask} = (
{ GoogleMap
| center = (51.82,5.86)
, width = 400
......@@ -129,13 +128,14 @@ gUpdate {|GoogleMap|} _ ust =: {USt | mode=UDCreate} = (
, zoom = 10
, mapType = ROADMAP
, markers = []
}, ust)
}, {USt | ust & newMask = appendToMask newMask (Untouched False [])})
gUpdate {|GoogleMap|} s ust =: {USt | mode=UDSearch, searchPath, currentPath, update}
gUpdate {|GoogleMap|} s ust =: {USt | mode=UDSearch, searchPath, currentPath, update,oldMask,newMask}
# (cm,om) = popMask oldMask
| currentPath == searchPath
= (parseUpdate s update, toggleMask {USt | ust & mode = UDDone})
= (parseUpdate s update, {USt | ust & newMask = appendToMask newMask (Touched True []), oldMask = om})
| otherwise
= (s, {USt | ust & currentPath = stepDataPath currentPath})
= (s, {USt | ust & currentPath = stepDataPath currentPath, newMask = appendToMask newMask (cleanUpdMask cm),