Commit af70b352 authored by Bas Lijnse's avatar Bas Lijnse

Refactored UI definitions, setting heights no longer possible for component...

Refactored UI definitions, setting heights no longer possible for component which don't support it client-side

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2706 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent c683045a
......@@ -91,34 +91,6 @@ arrangeWithSideBar :: !Int !UISide !Int -> SubUICombinator
instance tune ArrangeCustom
toSubUIStack :: [UISubUI] -> UISubUIStack
//Modifiers on interface definitions
setSize :: !UISize !UISize !UIControl -> UIControl
setWidth :: !UISize !UIControl -> UIControl
setHeight :: !UISize !UIControl -> UIControl
setMinSize :: !UIMinSize !UIMinSize !UIControl -> UIControl
setMinWidth :: !UIMinSize !UIControl -> UIControl
setMinHeight :: !UIMinSize !UIControl -> UIControl
fill :: !UIControl -> UIControl
fillHeight :: !UIControl -> UIControl
fillWidth :: !UIControl -> UIControl
fixedHeight :: !Int !UIControl -> UIControl
fixedWidth :: !Int !UIControl -> UIControl
wrapHeight :: !UIControl -> UIControl
wrapWidth :: !UIControl -> UIControl
setMargins :: !Int !Int !Int !Int !UIControl -> UIControl
setTopMargin :: !Int !UIControl -> UIControl
setRightMargin :: !Int !UIControl -> UIControl
setBottomMargin :: !Int !UIControl -> UIControl
setLeftMargin :: !Int !UIControl -> UIControl
setPadding :: !Int !Int !Int !Int !UIControl -> UIControl
setTitle :: !String !UIControl -> UIControl
setFramed :: !Bool !UIControl -> UIControl
setIconCls :: !String !UIControl -> UIControl
setBaseCls :: !String !UIControl -> UIControl
setDirection :: !UIDirection !UIControl -> UIControl
setHalign :: !UIHAlign !UIControl -> UIControl
setValign :: !UIVAlign !UIControl -> UIControl
//Combinators on interface definitions
hjoin :: ![UIControl] -> UIControl
vjoin :: ![UIControl] -> UIControl
......
......@@ -206,9 +206,9 @@ where
iconCtrl _ _ _ _ (Just msg) = icon "icon-invalid" msg
iconCtrl _ _ _ _ _ = []
icon cls tooltip = [setLeftMargin 5 (UIIcon defaultSizeOpts {UIIconOpts|iconCls = cls, tooltip = Just tooltip})]
icon cls tooltip = [setLeftMargin 5 (UIIcon defaultFSizeOpts {UIIconOpts|iconCls = cls, tooltip = Just tooltip})]
hasMargin control = isJust (getSizeOpts control).UISizeOpts.margins
hasMargin control = isJust (getMargins control)
noMarginControl (UIPanel _ _ _) = True
noMarginControl (UIGrid _ _ _) = True
......@@ -468,7 +468,7 @@ decoratePrompt [] = []
decoratePrompt controls = [UIContainer sizeOpts itemsOpts]
where
sizeOpts = {defaultSizeOpts & margins = Just {top= 5, right = 5, bottom = 10, left = 5}
, width = Just FlexSize, minWidth = Just WrapMin, height = Just WrapSize}
, width = Just FlexSize, minWidth = Just WrapBound, height = Just WrapSize}
itemsOpts = {UIItemsOpts|defaultItemsOpts (map fst controls) & baseCls=Just "itwc-prompt"}
//Adds a button panel to a set of controls
......@@ -501,193 +501,6 @@ where
//TODO move down into tabs and fieldsets??
addTriggerToItem t c = c
updSizeOpts :: (UISizeOpts -> UISizeOpts) UIControl -> UIControl
updSizeOpts f (UIViewString sOpts vOpts) = (UIViewString (f sOpts) vOpts)
updSizeOpts f (UIViewHtml sOpts vOpts) = (UIViewHtml (f sOpts) vOpts)
updSizeOpts f (UIViewDocument sOpts vOpts) = (UIViewDocument (f sOpts) vOpts)
updSizeOpts f (UIViewCheckbox sOpts vOpts) = (UIViewCheckbox (f sOpts) vOpts)
updSizeOpts f (UIViewSlider sOpts vOpts opts) = (UIViewSlider (f sOpts) vOpts opts)
updSizeOpts f (UIViewProgress sOpts vOpts opts) = (UIViewProgress (f sOpts) vOpts opts)
updSizeOpts f (UIEditString sOpts eOpts) = (UIEditString (f sOpts) eOpts)
updSizeOpts f (UIEditNote sOpts eOpts) = (UIEditNote (f sOpts) eOpts)
updSizeOpts f (UIEditPassword sOpts eOpts) = (UIEditPassword (f sOpts) eOpts)
updSizeOpts f (UIEditInt sOpts eOpts) = (UIEditInt (f sOpts) eOpts)
updSizeOpts f (UIEditDecimal sOpts eOpts) = (UIEditDecimal (f sOpts) eOpts)
updSizeOpts f (UIEditCheckbox sOpts eOpts) = (UIEditCheckbox (f sOpts) eOpts)
updSizeOpts f (UIEditSlider sOpts eOpts opts) = (UIEditSlider (f sOpts) eOpts opts)
updSizeOpts f (UIEditDate sOpts eOpts) = (UIEditDate (f sOpts) eOpts)
updSizeOpts f (UIEditTime sOpts eOpts) = (UIEditTime (f sOpts) eOpts)
updSizeOpts f (UIEditDocument sOpts eOpts) = (UIEditDocument (f sOpts) eOpts)
updSizeOpts f (UIEditButton sOpts eOpts opts) = (UIEditButton (f sOpts) eOpts opts)
updSizeOpts f (UIDropdown sOpts cOpts) = (UIDropdown (f sOpts) cOpts)
updSizeOpts f (UIRadioGroup sOpts cOpts) = (UIRadioGroup (f sOpts) cOpts)
updSizeOpts f (UICheckboxGroup sOpts cOpts) = (UICheckboxGroup (f sOpts) cOpts)
updSizeOpts f (UIGrid sOpts cOpts opts) = (UIGrid (f sOpts) cOpts opts)
updSizeOpts f (UITree sOpts cOpts opts) = (UITree (f sOpts) cOpts opts)
updSizeOpts f (UIActionButton sOpts aOpts opts) = (UIActionButton (f sOpts) aOpts opts)
updSizeOpts f (UIMenuButton sOpts opts) = (UIMenuButton (f sOpts) opts)
updSizeOpts f (UILabel sOpts opts) = (UILabel (f sOpts) opts)
updSizeOpts f (UIIcon sOpts opts) = (UIIcon (f sOpts) opts)
updSizeOpts f (UITasklet sOpts opts) = (UITasklet (f sOpts) opts)
updSizeOpts f (UITaskletPH sOpts opts) = (UITaskletPH (f sOpts) opts)
updSizeOpts f (UIContainer sOpts iOpts) = (UIContainer (f sOpts) iOpts)
updSizeOpts f (UIPanel sOpts iOpts opts) = (UIPanel (f sOpts) iOpts opts)
updSizeOpts f (UIFieldSet sOpts iOpts opts) = (UIFieldSet (f sOpts) iOpts opts)
updSizeOpts f (UITabSet sOpts opts) = (UITabSet (f sOpts) opts)
updSizeOpts f (UIEditlet sOpts opts) = (UIEditlet (f sOpts) opts)
getSizeOpts :: UIControl -> UISizeOpts
getSizeOpts (UIViewString sOpts vOpts) = sOpts
getSizeOpts (UIViewHtml sOpts vOpts) = sOpts
getSizeOpts (UIViewDocument sOpts vOpts) = sOpts
getSizeOpts (UIViewCheckbox sOpts vOpts) = sOpts
getSizeOpts (UIViewSlider sOpts vOpts opts) = sOpts
getSizeOpts (UIViewProgress sOpts vOpts opts) = sOpts
getSizeOpts (UIEditString sOpts eOpts) = sOpts
getSizeOpts (UIEditNote sOpts eOpts) = sOpts
getSizeOpts (UIEditPassword sOpts eOpts) = sOpts
getSizeOpts (UIEditInt sOpts eOpts) = sOpts
getSizeOpts (UIEditDecimal sOpts eOpts) = sOpts
getSizeOpts (UIEditCheckbox sOpts eOpts) = sOpts
getSizeOpts (UIEditSlider sOpts eOpts opts) = sOpts
getSizeOpts (UIEditDate sOpts eOpts) = sOpts
getSizeOpts (UIEditTime sOpts eOpts) = sOpts
getSizeOpts (UIEditDocument sOpts eOpts) = sOpts
getSizeOpts (UIEditButton sOpts eOpts opts) = sOpts
getSizeOpts (UIDropdown sOpts cOpts) = sOpts
getSizeOpts (UIRadioGroup sOpts cOpts) = sOpts
getSizeOpts (UICheckboxGroup sOpts cOpts) = sOpts
getSizeOpts (UIGrid sOpts cOpts opts) = sOpts
getSizeOpts (UITree sOpts cOpts opts) = sOpts
getSizeOpts (UIActionButton sOpts aOpts opts) = sOpts
getSizeOpts (UIMenuButton sOpts opts) = sOpts
getSizeOpts (UILabel sOpts opts) = sOpts
getSizeOpts (UIIcon sOpts opts) = sOpts
getSizeOpts (UITasklet sOpts opts) = sOpts
getSizeOpts (UITaskletPH sOpts opts) = sOpts
getSizeOpts (UIContainer sOpts iOpts) = sOpts
getSizeOpts (UIPanel sOpts iOpts opts) = sOpts
getSizeOpts (UIFieldSet sOpts iOpts opts) = sOpts
getSizeOpts (UITabSet sOpts opts) = sOpts
getSizeOpts (UIEditlet sOpts opts) = sOpts
setSize :: !UISize !UISize !UIControl -> UIControl
setSize width height ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & width = Just width, height = Just height}) ctrl
setWidth :: !UISize !UIControl -> UIControl
setWidth width ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & width = Just width}) ctrl
setHeight :: !UISize !UIControl -> UIControl
setHeight height ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & height = Just height}) ctrl
setMinSize :: !UIMinSize !UIMinSize !UIControl -> UIControl
setMinSize width height ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & minWidth = Just width, minHeight = Just height}) ctrl
setMinWidth :: !UIMinSize !UIControl -> UIControl
setMinWidth width ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & minWidth = Just width}) ctrl
setMinHeight :: !UIMinSize !UIControl -> UIControl
setMinHeight height ctrl = updSizeOpts (\opts -> {UISizeOpts| opts & minHeight = Just height}) ctrl
fill :: !UIControl -> UIControl
fill ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & width = Just FlexSize, height = Just FlexSize}) ctrl
fillHeight :: !UIControl -> UIControl
fillHeight ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & height = Just FlexSize}) ctrl
fillWidth :: !UIControl -> UIControl
fillWidth ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & width = Just FlexSize}) ctrl
fixedHeight :: !Int !UIControl -> UIControl
fixedHeight size ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & height = Just (ExactSize size)}) ctrl
fixedWidth :: !Int !UIControl -> UIControl
fixedWidth size ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & width = Just (ExactSize size)}) ctrl
wrapHeight :: !UIControl -> UIControl
wrapHeight ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & height = Just WrapSize}) ctrl
wrapWidth :: !UIControl -> UIControl
wrapWidth ctrl = updSizeOpts (\opts -> {UISizeOpts|opts & width = Just WrapSize}) ctrl
setMargins :: !Int !Int !Int !Int !UIControl -> UIControl
setMargins top right bottom left ctrl
= updSizeOpts (\opts -> {UISizeOpts|opts & margins = Just {top = top, right = right, bottom = bottom, left = left}}) ctrl
setTopMargin :: !Int !UIControl -> UIControl
setTopMargin top ctrl = updSizeOpts f ctrl
where
f opts = case opts.margins of
Nothing = {UISizeOpts|opts & margins = Just {top = top, right = 0, bottom = 0, left = 0}}
Just m = {UISizeOpts|opts & margins = Just {m & top = top}}
setRightMargin :: !Int !UIControl -> UIControl
setRightMargin right ctrl = updSizeOpts f ctrl
where
f opts = case opts.margins of
Nothing = {UISizeOpts|opts & margins = Just {top = 0, right = right, bottom = 0, left = 0}}
Just m = {UISizeOpts|opts & margins = Just {m & right = right}}
setBottomMargin :: !Int !UIControl -> UIControl
setBottomMargin bottom ctrl = updSizeOpts f ctrl
where
f opts = case opts.margins of
Nothing = {UISizeOpts|opts & margins = Just {top = 0, right = 0, bottom = bottom, left = 0}}
Just m = {UISizeOpts|opts & margins = Just {m & bottom = bottom}}
setLeftMargin :: !Int !UIControl -> UIControl
setLeftMargin left ctrl = updSizeOpts f ctrl
where
f opts = case opts.margins of
Nothing = {UISizeOpts|opts & margins = Just {top = 0, right = 0, bottom = 0, left = left}}
Just m = {UISizeOpts|opts & margins = Just {m & left = left}}
setPadding :: !Int !Int !Int !Int !UIControl -> UIControl
setPadding top right bottom left (UIContainer sOpts iOpts)
= UIContainer sOpts {UIItemsOpts|iOpts & padding = Just {top=top,right=right,bottom=bottom,left=left}}
setPadding top right bottom left (UIPanel sOpts iOpts opts)
= UIPanel sOpts {UIItemsOpts|iOpts & padding = Just {top=top,right=right,bottom=bottom,left=left}} opts
setPadding top right bottom left ctrl = ctrl
setTitle :: !String !UIControl -> UIControl
setTitle title (UIPanel sOpts iOpts opts) = UIPanel sOpts iOpts {UIPanelOpts|opts & title = Just title}
setTitle title (UIFieldSet sOpts iOpts opts) = UIFieldSet sOpts iOpts {UIFieldSetOpts|opts & title = title}
setTitle title ctrl = ctrl
setFramed :: !Bool !UIControl -> UIControl
setFramed frame (UIPanel sOpts iOpts opts) = UIPanel sOpts iOpts {UIPanelOpts|opts & frame = frame}
setFramed frame ctrl = ctrl
setIconCls :: !String !UIControl -> UIControl
setIconCls iconCls (UIActionButton sOpts aOpts opts) = UIActionButton sOpts aOpts {UIButtonOpts|opts & iconCls = Just iconCls}
setIconCls iconCls (UIMenuButton sOpts opts) = UIMenuButton sOpts {UIMenuButtonOpts|opts & iconCls = Just iconCls}
setIconCls iconCls (UIIcon sOpts opts) = UIIcon sOpts {UIIconOpts|opts & iconCls = iconCls}
setIconCls iconCls (UIPanel sOpts iOpts opts) = UIPanel sOpts iOpts {UIPanelOpts|opts & iconCls = Just iconCls}
setIconCls iconCls ctrl = ctrl
setBaseCls :: !String !UIControl -> UIControl
setBaseCls baseCls (UIContainer sOpts iOpts) = UIContainer sOpts {UIItemsOpts|iOpts & baseCls = Just baseCls}
setBaseCls baseCls (UIPanel sOpts iOpts opts) = UIPanel sOpts {UIItemsOpts|iOpts & baseCls = Just baseCls} opts
setBaseCls baseCls ctrl = ctrl
setDirection :: !UIDirection !UIControl -> UIControl
setDirection dir (UIContainer sOpts iOpts) = UIContainer sOpts {UIItemsOpts|iOpts & direction = dir}
setDirection dir (UIPanel sOpts iOpts opts) = UIPanel sOpts {UIItemsOpts|iOpts & direction = dir} opts
setDirection dir ctrl = ctrl
setHalign :: !UIHAlign !UIControl -> UIControl
setHalign align (UIContainer sOpts iOpts) = UIContainer sOpts {iOpts & halign = align}
setHalign align (UIPanel sOpts iOpts opts) = UIPanel sOpts {iOpts & halign = align} opts
setHalign align ctrl = ctrl
setValign :: !UIVAlign !UIControl -> UIControl
setValign align (UIContainer sOpts iOpts) = UIContainer sOpts {iOpts & valign = align}
setValign align (UIPanel sOpts iOpts opts) = UIPanel sOpts {iOpts & valign = align} opts
setValign align ctrl = ctrl
setTBar :: ![UIControl] !UIControl -> UIControl
setTBar tbar (UIPanel sOpts iOpts opts) = UIPanel sOpts iOpts {UIPanelOpts|opts & tbar = Just tbar}
setTBar tbar ctrl = ctrl
//Container coercion
toPanel :: !UIControl -> UIControl
......
......@@ -29,7 +29,7 @@ from Data.Map import qualified get
from Text.HTML import class html
from System.Time import :: Timestamp
from iTasks.Framework.IWorld import :: IWorld
from iTasks.Framework.UIDefinition import :: UIDef, :: UIControlStack, :: UIAnnotatedControls, :: UIControl, :: UISize, :: UIDirection, :: UISideSizes, :: UIMinSize, :: UIAttributes
from iTasks.Framework.UIDefinition import :: UIDef, :: UIControlStack, :: UIAnnotatedControls, :: UIControl, :: UISize, :: UIDirection, :: UISideSizes, :: UIBound, :: UIAttributes
from iTasks.Framework.Task import :: Task, :: TaskId
from iTasks.Framework.Generic import class iTask
from iTasks.Framework.Generic.Interaction import generic gEditor, generic gEditMeta, generic gVerify, generic gUpdate, :: VSt, :: VisualizationResult,:: EditMeta, :: VerifyOptions
......
......@@ -34,7 +34,7 @@ gEditor{|URL|} dp vv=:(URL url,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewHtml defaultSizeOpts {UIViewOpts|value = Just (ATag [HrefAttr url] [Text url])},newMap)], vst)
| otherwise
# value = checkMaskValue mask url
# ui = UIEditString defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value}
# ui = UIEditString defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value}
= (NormalEditor [(ui,editorAttributes vv meta)],vst)
gUpdate{|URL|} target upd val = basicUpdate (\json url -> Just (maybe url (\s -> URL s) (fromJSON json))) target upd val
......@@ -72,7 +72,7 @@ gEditor{|Note|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
# value = checkMaskValue mask ((\(Note v) -> v) val)
= (NormalEditor [(UIEditNote sizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
where
sizeOpts = {UISizeOpts|defaultSizeOpts & height = Just FlexSize, minHeight = Just WrapMin}
sizeOpts = {UISizeOpts|defaultSizeOpts & height = Just FlexSize, minHeight = Just WrapBound}
// THIS IS A HACK!
// The encoding of a Text constructor should escape newlines and convert them to <br> tags. Unfortunately it doesn't
......@@ -132,7 +132,7 @@ gEditor{|EUR|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap (\(EUR v) -> toString v) val},newMap)],vst)
| otherwise
# value = checkMaskValue mask ((\(EUR v) -> toReal v / 100.0) val)
= (NormalEditor [(UIEditDecimal defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditDecimal defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate{|EUR|} target upd val = basicUpdateSimple target upd val
......@@ -175,7 +175,7 @@ gEditor{|USD|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString val},newMap)],vst)
| otherwise
# value = checkMaskValue mask ((\(USD v) -> toReal v / 100.0) val)
= (NormalEditor [(UIEditDecimal defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditDecimal defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate{|USD|} target upd val = basicUpdateSimple target upd val
......@@ -231,7 +231,7 @@ gEditor{|Date|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString val},newMap)],vst)
| otherwise
# value = checkMaskValue mask val
= (NormalEditor [(UIEditDate defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditDate defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gDefault{|Date|} = {Date|day = 1, mon = 1, year = 1970}
gUpdate{|Date|} target upd val = basicUpdate (\json old -> fromJSON json) target upd val
......@@ -311,7 +311,7 @@ gEditor{|Time|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString val},newMap)],vst)
| otherwise
# value = checkMaskValue mask val
= (NormalEditor [(UIEditTime defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditTime defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate{|Time|} target upd val = basicUpdate (\json old -> fromJSON json) target upd val
......@@ -431,10 +431,10 @@ gVisualizeText{|Document|} _ val
gEditor {|Document|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
# val = checkMask mask val
= (NormalEditor [(UIViewDocument defaultSizeOpts {UIViewOpts|value = val},newMap)],vst)
= (NormalEditor [(UIViewDocument defaultHSizeOpts {UIViewOpts|value = val},newMap)],vst)
| otherwise
# value = checkMaskValue mask val
= (NormalEditor [(UIEditDocument defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditDocument defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate {|Document|} [] upd (val,mask) = case fromJSON upd of
Nothing = ({Document|documentId = "", contentUrl = "", name="", mime="", size = 0},Blanked)// Reset
......@@ -468,7 +468,7 @@ gEditor{|Username|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap (\(Username v) -> v) val},newMap)],vst)
| otherwise
# value = checkMaskValue mask ((\(Username v) -> v) val)
= (NormalEditor [(UIEditString defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditString defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate{|Username|} target upd val = basicUpdateSimple target upd val
gVerify{|Username|} mv options = simpleVerify mv options
......@@ -501,7 +501,7 @@ gEditor{|Password|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = Just "********"},newMap)],vst)
| otherwise
# value = checkMaskValue mask ((\(Password v) -> v) val)
= (NormalEditor [(UIEditPassword defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditPassword defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=value},editorAttributes vv meta)],vst)
gUpdate{|Password|} target upd val = basicUpdateSimple target upd val
gVerify{|Password|} mv options = simpleVerify mv options
gEditMeta{|Password|} _ = [{label=Nothing,hint=Just "Enter a password",unit=Nothing}]
......@@ -569,11 +569,11 @@ gEditor{|Scale|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
# val = checkMask mask val
# viewOpts = {UIViewOpts|value = fmap curVal val}
= (NormalEditor [(UIViewSlider defaultSizeOpts viewOpts sliderOpts, newMap)],vst)
= (NormalEditor [(UIViewSlider defaultHSizeOpts viewOpts sliderOpts, newMap)],vst)
| otherwise
# value = checkMaskValue mask (curVal val)
# editOpts = {UIEditOpts|taskId = taskId, editorId = editorId dp, value = value}
= (NormalEditor [(UIEditSlider defaultSizeOpts editOpts sliderOpts, editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditSlider defaultHSizeOpts editOpts sliderOpts, editorAttributes vv meta)],vst)
where
curVal {Scale|cur} = cur
......@@ -589,7 +589,7 @@ gEditMeta{|Scale|} _ = [{label=Nothing,hint=Just "You can change the value by sl
gVisualizeText{|Progress|} _ {Progress|description} = [description]
gEditor{|Progress|} dp (val,mask,ver) meta vst=:{VSt|taskId}
= (NormalEditor [(UIViewProgress defaultSizeOpts {UIViewOpts|value=Just (value val)} {UIProgressOpts|text = text val},newMap)],vst)
= (NormalEditor [(UIViewProgress defaultHSizeOpts {UIViewOpts|value=Just (value val)} {UIProgressOpts|text = text val},newMap)],vst)
where
text {Progress|description} = description
......@@ -727,7 +727,7 @@ gEditor{|ComboChoice|} fx gx _ hx _ _ dp vv=:(val,mask,ver) meta vst=:{VSt|taskI
| disabled
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = vvalue val},newMap)],vst)
| otherwise
= (NormalEditor [(UIDropdown defaultSizeOpts {UIChoiceOpts|taskId=taskId,editorId=editorId dp,value=evalue val,options=options val},editorAttributes vv (gEditMeta{|*->*|} hx val))],vst)
= (NormalEditor [(UIDropdown defaultHSizeOpts {UIChoiceOpts|taskId=taskId,editorId=editorId dp,value=evalue val,options=options val},editorAttributes vv (gEditMeta{|*->*|} hx val))],vst)
where
vvalue (ComboChoice options (Just sel)) = Just (hd (gx AsLabel (options !! sel)))
vvalue _ = Nothing
......@@ -1367,7 +1367,7 @@ derive gEditMeta Icon
derive gUpdate Icon
derive gVerify Icon
gEditor{|Icon|} _ (Icon icon,msk,ver) meta vst = (NormalEditor [(UIIcon defaultSizeOpts {UIIconOpts|iconCls="icon-"+++icon,tooltip=Nothing} ,newMap)], vst)
gEditor{|Icon|} _ (Icon icon,msk,ver) meta vst = (NormalEditor [(UIIcon defaultFSizeOpts {UIIconOpts|iconCls="icon-"+++icon,tooltip=Nothing} ,newMap)], vst)
// Generic instances for common library types
derive JSONEncode Map, Either, HtmlTag, HtmlAttr
......
......@@ -10,7 +10,8 @@ import iTasks.Framework.IWorld, iTasks.Framework.WebService
CLEAN_HOME_VAR :== "CLEAN_HOME"
import StdFile, StdInt, StdList, StdChar, StdBool, StdString, StdFunc
import TCPIP, tcp, Internet.HTTP, System.Time, System.CommandLine, Data.Func
import tcp
import Internet.HTTP, System.Time, System.CommandLine, Data.Func
import iTasks.Framework.Engine, iTasks.Framework.IWorld, iTasks.Framework.TaskEval, iTasks.Framework.TaskStore
import iTasks.Framework.Util
......
......@@ -35,7 +35,7 @@ gEditor{|RECORD of {grd_arity}|} fx _ _ mx _ _ dp (RECORD x,mask,ver) meta vst=:
# viz = if (optional && not disabled) (OptionalEditor [checkbox True:controlsOf fieldsViz]) fieldsViz
= (viz,vst)
where
checkbox checked = (UIEditCheckbox defaultSizeOpts {UIEditOpts|taskId = taskId, editorId = editorId dp, value = Just (JSONBool checked)},newMap)
checkbox checked = (UIEditCheckbox defaultFSizeOpts {UIEditOpts|taskId = taskId, editorId = editorId dp, value = Just (JSONBool checked)},newMap)
gEditor{|FIELD of {gfd_name}|} fx _ _ mx _ _ dp (FIELD x,mask,ver) _ vst=:{VSt|disabled,layout}
# (vizBody,vst) = fx dp (x,mask,ver) (mx x) vst
......@@ -57,7 +57,7 @@ gEditor{|OBJECT of {gtd_num_conses,gtd_conses}|} fx _ _ mx _ _ dp vv=:(OBJECT x,
Blanked = ([],[])
_ = (controlsOf items,[selectedConsIndex])
# content = layout.layoutSubEditor {UIControlStack|attributes = newMap, controls = controls}
= (NormalEditor [(UIDropdown defaultSizeOpts
= (NormalEditor [(UIDropdown defaultHSizeOpts
{UIChoiceOpts
| taskId = taskId
, editorId = editorId dp
......@@ -118,31 +118,31 @@ gEditor{|Int|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString (checkMask mask val)},newMap)],vst)
| otherwise
= (NormalEditor [(UIEditInt defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditInt defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
gEditor{|Real|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString (checkMask mask val)},newMap)],vst)
| otherwise
= (NormalEditor [(UIEditDecimal defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditDecimal defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
gEditor{|Char|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value = fmap toString (checkMask mask val)},newMap)],vst)
| otherwise
= (NormalEditor [(UIEditString defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditString defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
gEditor{|String|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled}
| disabled
= (NormalEditor [(UIViewString defaultSizeOpts {UIViewOpts|value= checkMask mask val},newMap)],vst)
| otherwise
= (NormalEditor [(UIEditString defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
= (NormalEditor [(UIEditString defaultHSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
gEditor{|Bool|} dp vv=:(val,mask,ver) meta vst=:{VSt|taskId,disabled} //Bools are shown as optional by default, because a mandatory bool makes little sense
| disabled
= (OptionalEditor [(UIViewCheckbox defaultSizeOpts {UIViewOpts|value =checkMask mask val},newMap)],vst)
= (OptionalEditor [(UIViewCheckbox defaultFSizeOpts {UIViewOpts|value =checkMask mask val},newMap)],vst)
| otherwise
= (OptionalEditor [(UIEditCheckbox defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
= (OptionalEditor [(UIEditCheckbox defaultFSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=checkMaskValue mask val},editorAttributes vv meta)],vst)
gEditor{|[]|} fx _ _ mx _ _ dp (val,mask,ver) meta vst=:{VSt|taskId,disabled,layout}
# (items,vst) = listControl dp val (subMasks (length val) mask) (subVerifications (length val) ver) vst
......@@ -158,7 +158,7 @@ where
//= ([listItemControl disabled numItems idx dx \\ dx <- itemsVis & idx <- [0..]] ++ [newItemControl newItem],vst)
= ([listItemControl disabled numItems idx dx \\ dx <- itemsVis & idx <- [0..]] ++ [addItemControl numItems],vst)
listItemControl disabled numItems idx item
listItemControl disabled numItems idx item
# controls = map fst (layout.layoutSubEditor {UIControlStack| attributes = newMap, controls = controlsOf item})
# buttons = [UIEditButton defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=Just (JSONString ("mup_" +++ toString idx))} {UIButtonOpts|text=Nothing,iconCls=Just "icon-up",disabled=idx == 0}
,UIEditButton defaultSizeOpts {UIEditOpts|taskId=taskId,editorId=editorId dp,value=Just (JSONString ("mdn_" +++ toString idx))} {UIButtonOpts|text=Nothing,iconCls=Just "icon-down",disabled= idx == numItems - 1}
......
......@@ -11,19 +11,19 @@ derive JSONEncode TIMeta, TIType, SessionInfo, TIReduct, TaskTree, TaskListEntry
derive JSONDecode TIMeta, TIType, SessionInfo, TIReduct, TaskTree, TaskListEntry, TaskListEntryState, TaskResult, TaskRep, TaskInfo
//IS ALSO DERIVED IN TASK STORE: SEEMS REDUNDANT
derive JSONEncode UIDef, UIAction, UIViewport, UIWindow, UIControl, UISizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONEncode UIDef, UIAction, UIViewport, UIWindow, UIControl, UIFSizeOpts, UISizeOpts, UIHSizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONEncode UIControlStack, UISubUI, UISubUIStack
derive JSONEncode UIProgressOpts, UISliderOpts, UIGridOpts, UITreeOpts, UIIconOpts, UILabelOpts, UITreeNode
derive JSONEncode UIMenuButtonOpts, UIButtonOpts, UIPanelOpts, UIFieldSetOpts, UIWindowOpts, UIViewportOpts, UITabSetOpts, UITab, UITabOpts
derive JSONEncode UISize, UIMinSize, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONEncode UISize, UIBound, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONEncode UITaskletOpts, UITaskletPHOpts, UIEditletOpts
derive JSONDecode TaskCompositionType
derive JSONDecode UIDef, UIAction, UIViewport, UIWindow, UIControl, UISizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONDecode UIDef, UIAction, UIViewport, UIWindow, UIControl, UIFSizeOpts, UISizeOpts, UIHSizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONDecode UIControlStack, UISubUI, UISubUIStack
derive JSONDecode UIProgressOpts, UISliderOpts, UIGridOpts, UITreeOpts, UIIconOpts, UILabelOpts, UITreeNode
derive JSONDecode UIMenuButtonOpts, UIButtonOpts, UIPanelOpts, UIFieldSetOpts, UIWindowOpts, UIViewportOpts, UITabSetOpts, UITab, UITabOpts
derive JSONDecode UISize, UIMinSize, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONDecode UISize, UIBound, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONDecode UITaskletOpts, UITaskletPHOpts, UIEditletOpts
JSONEncode{|DeferredJSON|} (DeferredJSON a)
......
......@@ -11,19 +11,19 @@ import iTasks.Framework.SerializationGraphCopy //TODO: Make switchable from with
//Derives required for storage of UI definitions
derive JSONEncode TaskResult, TaskInfo, TaskRep, TaskCompositionType
derive JSONEncode UIDef, UIAction, UIViewport, UIWindow, UIControl, UISizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONEncode UIDef, UIAction, UIViewport, UIWindow, UIControl, UIFSizeOpts, UISizeOpts, UIHSizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONEncode UIProgressOpts, UISliderOpts, UIGridOpts, UITreeOpts, UIIconOpts, UILabelOpts, UITreeNode
derive JSONEncode UIControlStack, UISubUI, UISubUIStack
derive JSONEncode UIMenuButtonOpts, UIButtonOpts, UIPanelOpts, UIFieldSetOpts, UIWindowOpts, UIViewportOpts, UITabSetOpts, UITab, UITabOpts
derive JSONEncode UISize, UIMinSize, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONEncode UISize, UIBound, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONEncode UITaskletOpts, UITaskletPHOpts, UIEditletOpts
derive JSONDecode TaskResult, TaskInfo, TaskRep, TaskCompositionType
derive JSONDecode UIDef, UIAction, UIViewport, UIWindow, UIControl, UISizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONDecode UIDef, UIAction, UIViewport, UIWindow, UIControl, UIFSizeOpts, UISizeOpts, UIHSizeOpts, UIViewOpts, UIEditOpts, UIActionOpts, UIChoiceOpts, UIItemsOpts
derive JSONDecode UIProgressOpts, UISliderOpts, UIGridOpts, UITreeOpts, UIIconOpts, UILabelOpts, UITreeNode
derive JSONDecode UIControlStack, UISubUI, UISubUIStack
derive JSONDecode UIMenuButtonOpts, UIButtonOpts, UIPanelOpts, UIFieldSetOpts, UIWindowOpts, UIViewportOpts, UITabSetOpts, UITab, UITabOpts
derive JSONDecode UISize, UIMinSize, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONDecode UISize, UIBound, UIDirection, UIHAlign, UIVAlign, UISideSizes, UIMenuItem
derive JSONDecode UITaskletOpts, UITaskletPHOpts, UIEditletOpts
INCREMENT :== "increment"
......
......@@ -84,62 +84,76 @@ from iTasks.API.Core.SystemTypes import :: Document, :: DocumentId, :: Date, ::
:: UIControl
// Components for viewing data:
= UIViewString !UISizeOpts !(UIViewOpts String) // - String (non-wrapping single line text with automatic escaping)
| UIViewHtml !UISizeOpts !(UIViewOpts HtmlTag) // - Html (formatted multi line text)
| UIViewDocument !UISizeOpts !(UIViewOpts Document) // - Document (info + download link)
| UIViewCheckbox !UISizeOpts !(UIViewOpts Bool) // - Checkbox (non-editable tick-mark)
| UIViewSlider !UISizeOpts !(UIViewOpts Int) !UISliderOpts // - Slider (non-editable slider)
| UIViewProgress !UISizeOpts !(UIViewOpts ProgressAmount) !UIProgressOpts // - Progress (non editable progress bar)
= UIViewString !UISizeOpts !(UIViewOpts String) // - String (non-wrapping single line text with automatic escaping)
| UIViewHtml !UISizeOpts !(UIViewOpts HtmlTag) // - Html (formatted multi line text)
| UIViewDocument !UIHSizeOpts !(UIViewOpts Document) // - Document (info + download link)
| UIViewCheckbox !UIFSizeOpts !(UIViewOpts Bool)