Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-libraries
Commits
993f3c20
Commit
993f3c20
authored
Nov 03, 2006
by
Rinus Plasmeijer
Browse files
*** empty log message ***
parent
cf0e00e4
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/htmlGEC/Examples/Simple Workflows/workflowExamples.icl
View file @
993f3c20
...
...
@@ -16,13 +16,49 @@ derive gUpd []
//Start world = doHtmlServer (mkflow CreateMusic) world
//Start world = doHtmlServer (mkflow (Quotation myQuotation)) world
//Start world = doHtmlServer (mkflow travel) world
Start
world
=
doHtmlServer
(
mkflow
t
wotasks2
)
world
Start
world
=
doHtmlServer
(
mkflow
t
est4
)
world
where
mkflow
tasks
hst
#
(
html
,
hst
)
=
startTask
tasks
hst
=
mkHtml
"test"
html
hst
twotasks3
tst
#
((
tboss
,
tsecr
),
tst
)
=
mkRDynTaskCall
"name"
0
tst
// split name task
=
PTasks
[(
"secretary"
,
tsecr
)
// assign name task
,(
"boss"
,
STask
"Choose"
Easy
`
bind`
\
situation
->
tboss
(
handle
situation
)
`
bind`
\
result
->
STask
"accept"
result
)
]
tst
where
handle
Easy
tst
#
tst
=
returnF
[
Txt
(
"Handle easy case"
)]
tst
=
STask
"Damage"
0
tst
handle
(
Difficult
upperbound
)
tst
#
tst
=
returnF
[
Txt
(
"Handle difficult case with limit "
+++
(
toString
upperbound
)
+++
" Euro's"
)]
tst
=
checktask
upperbound
tst
where
checktask
limit
tst
#
(
amount
,
tst
)
=
STask
"Damage"
0
tst
|
amount
>
limit
#
tst
=
returnF
[
Txt
(
"amount "
+++
toString
amount
+++
" exceeds limit set"
)]
tst
=
mkTask
(
checktask
limit
)
tst
=
returnTask
amount
tst
test4
tst
#
(
result
,
tst
)
=
PMilestoneTasks
[(
"secretary"
,
STask
"een"
1
)
,(
"boss"
,
STask
"twee"
2
)
]
tst
=
STask
"drie"
3
tst
twotasks2
tst
#
((
tboss
,
tsecr
),
tst
)
=
mkRDynTaskCall
"name"
0
tst
// split name task
=
PTasks
...
...
@@ -31,6 +67,10 @@ twotasks2 tst
\
situation
->
tboss
(
handle
situation
)
`
bind`
\
result
->
STask
"accept"
result
)
,(
"boss2"
,
STask
"Choose"
Easy
`
bind`
\
situation
->
tboss
(
handle
situation
)
`
bind`
\
result
->
STask
"accept"
result
)
]
tst
where
handle
Easy
tst
...
...
libraries/htmlGEC/Examples/WebShopDeLuxe/cdShop.prj
View file @
993f3c20
This diff is collapsed.
Click to expand it.
libraries/htmlGEC/StdHtml.dcl
View file @
993f3c20
...
...
@@ -7,8 +7,9 @@ import
// iData modules:
htmlFormData
// basic iData type definitions
,
htmlHandler
// the kernel module for iData creation
htmlSettings
// some global settings
,
htmlFormData
// general iData type definitions
,
htmlHandler
// the kernel module for iData creation and handling
,
htmlButtons
// basic collections of buttons, data types for lay-out control
,
htmlFormlib
// handy collection of advanced iData creating functions
...
...
@@ -16,15 +17,16 @@ import
,
htmlArrow
// arrow instantiations for iData forms
// free to change when the default style of the generated web pages is not appealing:
,
htmlStylelib
// style definitions used by iData
// html code generation:
,
htmlDataDef
// Clean's ADT representation of Html
,
htmlStyleDef
// Clean's ADT representation of Style sheets
// free to change when the default style of the generated web pages is not appealing:
,
htmlStylelib
// style definitions used by iData
// automatic data base storage and retrieval
,
Gerda
// Clean's GEneRic Database Access
...
...
libraries/htmlGEC/htmlArrow.dcl
View file @
993f3c20
...
...
@@ -20,15 +20,15 @@ startCircuit :: !(GecCircuit a b) !a !*HSt -> (!Form b,!*HSt)
// a display just shows the value
// a store applies the function to the stored value
edit
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
,
TC
a
display
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
,
TC
a
store
::
(
FormId
a
)
->
GecCircuit
(
a
->
a
)
a
|
iData
,
TC
a
edit
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
a
display
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
a
store
::
(
FormId
a
)
->
GecCircuit
(
a
->
a
)
a
|
iData
a
feedback
::
(
GecCircuit
a
b
)
(
GecCircuit
b
a
)
->
(
GecCircuit
a
b
)
self
::
(
a
->
a
)
(
GecCircuit
a
a
)
->
GecCircuit
a
a
loops
::
(
GecCircuit
(
a
,
b
)
(
c
,
b
))
->
GecCircuit
a
c
|
iData
,
TC
b
loops
::
(
GecCircuit
(
a
,
b
)
(
c
,
b
))
->
GecCircuit
a
c
|
iData
b
(
`
bindC`
)
infix
0
::
(
GecCircuit
a
b
)
(
b
->
GecCircuit
b
c
)
->
(
GecCircuit
a
c
)
(
`
bindCI`
)
infix
0
::
(
GecCircuit
a
b
)
((
Form
b
)
->
GecCircuit
b
c
)
->
(
GecCircuit
a
c
)
...
...
libraries/htmlGEC/htmlArrow.icl
View file @
993f3c20
...
...
@@ -40,21 +40,21 @@ where
#
((
b
,
bodya
),
ch
,
hst
)
=
gec_ab
((
a
,
prevbody
),
ch
,
hst
)
=
(((
b
,
c
),
bodya
),
ch
,
hst
)
edit
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
,
TC
a
edit
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
a
edit
formid
=
HGC
mkApplyEdit`
where
mkApplyEdit`
((
initval
,
prevbody
),
ch
,
hst
)
#
(
na
,
hst
)
=
mkApplyEditForm
(
Init
,
setFormId
formid
initval
)
initval
hst
=
((
na
.
value
,[(
formid
.
id
,
BodyTag
na
.
form
):
prevbody
]),
ch
||
na
.
changed
,
hst
)
// propagate change
display
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
,
TC
a
display
::
(
FormId
a
)
->
GecCircuit
a
a
|
iData
a
display
formid
=
HGC
mkEditForm`
where
mkEditForm`
((
val
,
prevbody
),
ch
,
hst
)
#
(
na
,
hst
)
=
mkEditForm
(
Set
,
setFormId
{
formid
&
mode
=
Display
}
val
)
hst
=
((
na
.
value
,[(
formid
.
id
,
BodyTag
na
.
form
):
prevbody
]),
ch
||
na
.
changed
,
hst
)
store
::
(
FormId
s
)
->
GecCircuit
(
s
->
s
)
s
|
iData
,
TC
s
store
::
(
FormId
s
)
->
GecCircuit
(
s
->
s
)
s
|
iData
s
store
formid
=
HGC
mkStoreForm`
where
mkStoreForm`
((
fun
,
prevbody
),
ch
,
hst
)
...
...
@@ -67,7 +67,7 @@ self fun gecaa = feedback gecaa (arr fun)
feedback
::
(
GecCircuit
a
b
)
(
GecCircuit
b
a
)
->
(
GecCircuit
a
b
)
feedback
(
HGC
gec_ab
)
(
HGC
gec_ba
)
=
HGC
(
gec_ab
o
gec_ba
o
gec_ab
)
loops
::
(
GecCircuit
(
a
,
b
)
(
c
,
b
))
->
GecCircuit
a
c
|
iData
,
TC
b
loops
::
(
GecCircuit
(
a
,
b
)
(
c
,
b
))
->
GecCircuit
a
c
|
iData
b
loops
(
HGC
gec_abcb
)
=
HGC
loopForm
where
loopForm
((
aval
,
prevbody
),
ch
,
hst
)
...
...
libraries/htmlGEC/htmlButtons.icl
View file @
993f3c20
...
...
@@ -312,7 +312,7 @@ where
thisyear
=
2006
mkBimapEditor
::
!(
InIDataId
d
)
!(
Bimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
v
|
iData
v
mkBimapEditor
inIDataId
{
map_to
,
map_from
}
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewMap
map_to
,
updForm
=
\_
v
->
v
...
...
libraries/htmlGEC/htmlFormlib.dcl
View file @
993f3c20
...
...
@@ -36,44 +36,44 @@ mkTable :: [[BodyTag]] -> BodyTag // Make a table
// mkSubState : makes form for substate, with ok and cancel buttons; only added to state if ok is pressed
// mkShowHide : as mkEdit, but with show / hide button
mkBimapEditor
::
!(
InIDataId
d
)
!(
Bimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
v
mkEditForm
::
!(
InIDataId
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkStoreForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkSelfForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkApplyEditForm
::
!(
InIDataId
d
)
!
d
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkBimapEditor
::
!(
InIDataId
d
)
!(
Bimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
v
mkEditForm
::
!(
InIDataId
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkStoreForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkSelfForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkApplyEditForm
::
!(
InIDataId
d
)
!
d
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkSubStateForm
::
!(
InIDataId
!
subState
)
!
state
!(
subState
state
->
state
)
!*
HSt
->
(
Bool
,
Form
state
,!*
HSt
)
|
iData
,
TC
subState
|
iData
subState
mkShowHideForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
mkShowHideForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
// **** forms for lists ****
listForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
horlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
vertlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
table_hv_Form
::
!(
InIDataId
[[
a
]])
!*
HSt
->
(
Form
[[
a
]],!*
HSt
)
|
iData
,
TC
a
listForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
horlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
vertlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
table_hv_Form
::
!(
InIDataId
[[
a
]])
!*
HSt
->
(
Form
[[
a
]],!*
HSt
)
|
iData
a
layoutListForm
::
!([
BodyTag
]
[
BodyTag
]
->
[
BodyTag
])
!(!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,*
HSt
))
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
// User controlled number of list elements will be shown, including optional delete and append buttons; Int indicates max number of browse buttons
vertlistFormButs
::
!
Int
!
Bool
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
vertlistFormButs
::
!
Int
!
Bool
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
// **** forms for tuples ****
t2EditForm
::
!(
InIDataId
(
a
,
b
))
!*
HSt
->
((
Form
a
,
Form
b
),!*
HSt
)|
iData
,
TC
a
&
iData
,
TC
b
t2EditForm
::
!(
InIDataId
(
a
,
b
))
!*
HSt
->
((
Form
a
,
Form
b
),!*
HSt
)|
iData
a
&
iData
b
t3EditForm
::
!(
InIDataId
(
a
,
b
,
c
))
!*
HSt
->
((
Form
a
,
Form
b
,
Form
c
),!*
HSt
)
|
iData
,
TC
a
&
iData
,
TC
b
&
iData
,
TC
c
|
iData
a
&
iData
b
&
iData
c
t4EditForm
::
!(
InIDataId
(
a
,
b
,
c
,
d
))
!*
HSt
->
((
Form
a
,
Form
b
,
Form
c
,
Form
d
),!*
HSt
)
|
iData
,
TC
a
&
iData
,
TC
b
&
iData
,
TC
c
&
iData
,
TC
d
|
iData
a
&
iData
b
&
iData
c
&
iData
d
// **** special buttons ****
counterForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
+,
-,
one
,
iData
,
TC
a
counterForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
+,
-,
one
,
iData
a
// buttons returning index between 1 to n given stepsize, n, maximal numberofbuttuns to show
browseButtons
::
!(
InIDataId
!
Int
)
!
Int
!
Int
!
Int
!*
HSt
->
(
Form
Int
,!*
HSt
)
...
...
libraries/htmlGEC/htmlFormlib.icl
View file @
993f3c20
...
...
@@ -74,12 +74,12 @@ where
// frequently used variants of mkViewForm
mkEditForm
::
!(
InIDataId
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkEditForm
::
!(
InIDataId
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkEditForm
inIDataId
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewId
,
updForm
=
\_
v
->
v
,
fromForm
=
\_
v
->
v
,
resetForm
=
Nothing
}
hst
mkSelfForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkSelfForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkSelfForm
inIDataId
cbf
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewId
,
updForm
=
update
,
fromForm
=
\_
v
->
v
,
resetForm
=
Nothing
}
hst
...
...
@@ -88,12 +88,12 @@ where
|
b
.
isChanged
=
cbf
val
|
otherwise
=
val
mkStoreForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkStoreForm
::
!(
InIDataId
d
)
!(
d
->
d
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkStoreForm
inIDataId
cbf
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewId
,
updForm
=
\_
v
=
cbf
v
,
fromForm
=
\_
v
->
v
,
resetForm
=
Nothing
}
hst
mkApplyEditForm
::
!(
InIDataId
d
)
!
d
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
d
mkApplyEditForm
::
!(
InIDataId
d
)
!
d
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
d
mkApplyEditForm
inIDataId
inputval
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewId
,
updForm
=
update
,
fromForm
=
\_
v
->
v
,
resetForm
=
Nothing
}
hst
...
...
@@ -102,7 +102,7 @@ where
|
b
.
isChanged
=
val
|
otherwise
=
inputval
mkBimapEditor
::
!(
InIDataId
d
)
!(
Bimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
v
mkBimapEditor
::
!(
InIDataId
d
)
!(
Bimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
v
mkBimapEditor
inIDataId
{
map_to
,
map_from
}
hst
=
mkViewForm
inIDataId
{
toForm
=
toViewMap
map_to
,
updForm
=
\_
v
->
v
...
...
@@ -111,7 +111,7 @@ mkBimapEditor inIDataId {map_to,map_from} hst
}
hst
mkSubStateForm
::
!(
InIDataId
!
subState
)
!
state
!(
subState
state
->
state
)
!*
HSt
->
(
Bool
,
Form
state
,!*
HSt
)
|
iData
,
TC
subState
|
iData
subState
mkSubStateForm
(
init
,
formid
)
state
upd
hst
#
(
nsubState
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"subst"
subState
)
hst
#
(
commitBut
,
hst
)
=
FuncBut
(
Init
,
subnFormId
formid
"CommitBut"
(
LButton
defpixel
"commit"
,
id
))
hst
...
...
@@ -135,7 +135,7 @@ mkSubStateForm (init,formid) state upd hst
where
subState
=
formid
.
ival
mkShowHideForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
mkShowHideForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
mkShowHideForm
(
init
,
formid
)
hst
|
formid
.
mode
==
NoForm
||
formid
.
lifespan
==
Temp
=
mkEditForm
(
init
,
formid
)
hst
...
...
@@ -155,13 +155,13 @@ where
// Form collection:
horlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
horlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
horlistForm
inIDataId
hSt
=
layoutListForm
(\
f1
f2
->
[
f1
<=>
f2
])
mkEditForm
inIDataId
hSt
vertlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
vertlistForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
vertlistForm
inIDataId
hSt
=
layoutListForm
(\
f1
f2
->
[
f1
<||>
f2
])
mkEditForm
inIDataId
hSt
vertlistFormButs
::
!
Int
!
Bool
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
vertlistFormButs
::
!
Int
!
Bool
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
vertlistFormButs
nbuts
showbuts
(
init
,
formid
)
hst
#
indexId
=
{
subFormId
formid
"idx"
0
&
mode
=
Display
}
...
...
@@ -242,10 +242,10 @@ where
[
(
but
5
"P"
,
\_
->
i
)
\\
i
<-
[
index
..
index
+
step
]]
table_hv_Form
::
!(
InIDataId
[[
a
]])
!*
HSt
->
(
Form
[[
a
]],!*
HSt
)
|
iData
,
TC
a
table_hv_Form
::
!(
InIDataId
[[
a
]])
!*
HSt
->
(
Form
[[
a
]],!*
HSt
)
|
iData
a
table_hv_Form
inIDataId
hSt
=
layoutListForm
(\
f1
f2
->
[
f1
<||>
f2
])
horlistForm
inIDataId
hSt
t2EditForm
::
!(
InIDataId
(
a
,
b
))
!*
HSt
->
((
Form
a
,
Form
b
),!*
HSt
)
|
iData
,
TC
a
&
iData
,
TC
b
t2EditForm
::
!(
InIDataId
(
a
,
b
))
!*
HSt
->
((
Form
a
,
Form
b
),!*
HSt
)
|
iData
a
&
iData
b
t2EditForm
(
init
,
formid
)
hst
#
(
forma
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t21"
a
)
hst
#
(
formb
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t21"
b
)
hst
...
...
@@ -253,7 +253,7 @@ t2EditForm (init,formid) hst
where
(
a
,
b
)
=
formid
.
ival
t3EditForm
::
!(
InIDataId
(
a
,
b
,
c
))
!*
HSt
->
((
Form
a
,
Form
b
,
Form
c
),!*
HSt
)
|
iData
,
TC
a
&
iData
,
TC
b
&
iData
,
TC
c
t3EditForm
::
!(
InIDataId
(
a
,
b
,
c
))
!*
HSt
->
((
Form
a
,
Form
b
,
Form
c
),!*
HSt
)
|
iData
a
&
iData
b
&
iData
c
t3EditForm
(
init
,
formid
)
hst
#
(
forma
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t31"
a
)
hst
#
(
formb
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t32"
b
)
hst
...
...
@@ -263,7 +263,7 @@ where
(
a
,
b
,
c
)
=
formid
.
ival
t4EditForm
::
!(
InIDataId
(
a
,
b
,
c
,
d
))
!*
HSt
->
((
Form
a
,
Form
b
,
Form
c
,
Form
d
),!*
HSt
)
|
iData
,
TC
a
&
iData
,
TC
b
&
iData
,
TC
c
&
iData
,
TC
d
|
iData
a
&
iData
b
&
iData
c
&
iData
d
t4EditForm
(
init
,
formid
)
hst
#
(
forma
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t41"
a
)
hst
#
(
formb
,
hst
)
=
mkEditForm
(
init
,
subFormId
formid
"t42"
b
)
hst
...
...
@@ -276,7 +276,7 @@ where
simpleButton
::
!
String
!
String
!(
a
->
a
)
!*
HSt
->
(
Form
(
a
->
a
),!*
HSt
)
simpleButton
id
label
fun
hst
=
FuncBut
(
Init
,
nFormId
(
id
+++
label
)
(
LButton
defpixel
label
,
fun
))
hst
counterForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
+,
-,
one
,
iData
,
TC
a
counterForm
::
!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
+,
-,
one
,
iData
a
counterForm
inIDataId
hst
=
mkViewForm
inIDataId
bimap
hst
where
bimap
=
{
toForm
=
toViewMap
(\
n
->
(
n
,
down
,
up
))
...
...
@@ -296,12 +296,12 @@ where
up
=
LButton
(
defpixel
/
6
)
"+"
down
=
LButton
(
defpixel
/
6
)
"-"
listForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
listForm
::
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
listForm
inIDataId
hSt
=
layoutListForm
(\
f1
f2
->
[
BodyTag
f1
:
f2
])
mkEditForm
inIDataId
hSt
layoutListForm
::
!([
BodyTag
]
[
BodyTag
]
->
[
BodyTag
])
!(!(
InIDataId
a
)
!*
HSt
->
(
Form
a
,*
HSt
))
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
,
TC
a
!(
InIDataId
[
a
])
!*
HSt
->
(
Form
[
a
],!*
HSt
)
|
iData
a
layoutListForm
layoutF
formF
(
init
,
formid
)
hst
#
(
store
,
hst
)
=
mkStoreForm
(
init
,
formid
)
id
hst
// enables to store list with different # elements
#
(
layout
,
hst
)
=
layoutListForm`
0
store
.
value
hst
...
...
libraries/htmlGEC/htmlHandler.dcl
View file @
993f3c20
...
...
@@ -3,20 +3,9 @@ definition module htmlHandler
// Converting Clean types to iData for automatic generation and dealing with Html form's ..
// (c) MJP 2005
import
htmlDataDef
,
htmlFormData
import
htmlDataDef
,
htmlFormData
,
htmlSettings
import
StdBool
TraceInput
:==
False
// set it to True if you want to see what kind of information is received from browser
MyDataBase
:==
"iDataDatabase"
// name of database being used by iData applications
class
iData
a
// The collection of generic functions needed to make iData:
|
gForm
{|*|}
// Creates an Html Form
,
gUpd
{|*|}
// Makes it possible to edit the form and updates the corresponding value
,
gPrint
{|*|}
// To serialize a form to a String
,
gParse
{|*|}
// To de-serialize the string back to a value
,
gerda
{|*|}
a
// To store and retrieve a value in a database
//TC a // To be able to store values in a dynamic
// TC is a special class cannot be included here
generic
gForm
a
::
!(
InIDataId
a
)
!*
HSt
->
*(
Form
a
,
!*
HSt
)
// user defined gForms: use "specialize"
generic
gUpd
a
::
UpdMode
a
->
(
UpdMode
,
a
)
// gUpd can simply be derived
...
...
@@ -41,7 +30,7 @@ doHtmlServer :: (*HSt -> (Html,!*HSt)) *World -> *World // use this applicati
// mkViewForm is the *swiss army nife* function creating stateful interactive forms with a view v of data d
// make shure that all editors have a unique identifier !
mkViewForm
::
!(
InIDataId
d
)
!(
HBimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
v
mkViewForm
::
!(
InIDataId
d
)
!(
HBimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
v
//mkViewForm :: !(InIDataId d) !(HBimap d v) !*HSt -> (Form d,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, gerda{|*|}, TC v
// specialize has to be used if one wants to specialize gForm for a user-defined type
...
...
libraries/htmlGEC/htmlHandler.icl
View file @
993f3c20
implementation
module
htmlHandler
import
StdEnv
,
ArgEnv
,
StdMaybe
import
htmlDataDef
,
htmlTrivial
import
htmlDataDef
,
htmlTrivial
,
htmlSettings
import
StdGeneric
import
iDataState
,
htmlStylelib
import
GenParse
,
GenPrint
...
...
@@ -108,7 +108,7 @@ where
// swiss army nife editor that makes coffee too ...
mkViewForm
::
!(
InIDataId
d
)
!(
HBimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
,
TC
v
mkViewForm
::
!(
InIDataId
d
)
!(
HBimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
v
//mkViewForm :: !(InIDataId d) !(HBimap d v) !*HSt -> (Form d,!*HSt) | gForm{|*|}, gUpd{|*|}, gPrint{|*|}, gParse{|*|}, gerda{|*|}, TC v
mkViewForm
(
init
,
formid
)
bm
=:{
toForm
,
updForm
,
fromForm
,
resetForm
}
hst
=:{
states
,
world
}
|
init
==
Const
&&
formid
.
lifespan
<>
Temp
...
...
@@ -488,7 +488,8 @@ toHtml a
#
(
na
,_)
=
gForm
{|*|}
(
Set
,{
id
=
"__toHtml"
,
lifespan
=
Page
,
mode
=
Display
,
storage
=
PlainString
,
ival
=
a
})
{
cntr
=
0
,
states
=
emptyFormStates
,
world
=
undef
}
=
BodyTag
na
.
form
toHtmlForm
::
(*
HSt
->
*(
Form
a
,*
HSt
))
->
[
BodyTag
]
|
gForm
{|*|},
gUpd
{|*|},
gPrint
{|*|},
gParse
{|*|},
TC
a
toHtmlForm
::
(*
HSt
->
*(
Form
a
,*
HSt
))
->
[
BodyTag
]
|
gForm
{|*|},
gUpd
{|*|},
gPrint
{|*|},
gParse
{|*|},
TC
a
toHtmlForm
anyform
#
(
na
,
hst
)
=
anyform
{
cntr
=
0
,
states
=
emptyFormStates
,
world
=
undef
}
=
na
.
form
...
...
libraries/htmlGEC/htmlRefFormlib.dcl
View file @
993f3c20
...
...
@@ -9,12 +9,12 @@ import StdEnv, htmlHandler, htmlButtons
::
Ref2
a
=
Ref2
String
instance
==
(
Ref2
a
)
ref2EditForm
::
!(
InIDataId
a
)
!(
InIDataId
(
Ref2
a
))
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
ref2EditForm
::
!(
InIDataId
a
)
!(
InIDataId
(
Ref2
a
))
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
invokeRefEditor
::
(!(
InIDataId
b
)
!*
HSt
->
(
Form
d
,!*
HSt
))
(
InIDataId
b
)
!*
HSt
->
(
Form
b
,!*
HSt
)
universalRefEditor
::
!
Lifespan
!(
InIDataId
(
Ref2
a
))
!(
a
->
Judgement
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
universalRefEditor
::
!
Lifespan
!(
InIDataId
(
Ref2
a
))
!(
a
->
Judgement
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
universalDB
::
!(!
Init
,!
Lifespan
,!
a
,!
String
)
!(
String
a
->
Judgement
)
!*
HSt
->
(
a
,!*
HSt
)
|
iData
,
TC
a
universalDB
::
!(!
Init
,!
Lifespan
,!
a
,!
String
)
!(
String
a
->
Judgement
)
!*
HSt
->
(
a
,!*
HSt
)
|
iData
a
// Usefull for exception handling
...
...
libraries/htmlGEC/htmlRefFormlib.icl
View file @
993f3c20
...
...
@@ -18,7 +18,7 @@ instance == (Ref2 a)
where
(==)(
Ref2
file1
)
(
Ref2
file2
)
=
file1
==
file2
ref2EditForm
::
!(
InIDataId
a
)
!(
InIDataId
(
Ref2
a
))
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
ref2EditForm
::
!(
InIDataId
a
)
!(
InIDataId
(
Ref2
a
))
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
ref2EditForm
(
inita
,
formida
)
(_,{
ival
=
Ref2
refname
})
hst
|
refname
==
""
=
mkEditForm
(
Init
,
reuseFormId
formida
createDefault
)
hst
|
otherwise
=
mkEditForm
(
inita
,{
formida
&
id
=
refname
})
hst
...
...
@@ -28,7 +28,7 @@ invokeRefEditor editor (init,formid) hst
#
(
idata
,
hst
)
=
editor
(
init
,
formid
)
hst
=
({
idata
&
value
=
formid
.
ival
},
hst
)
universalRefEditor
::
!
Lifespan
!(
InIDataId
(
Ref2
a
))
!(
a
->
Judgement
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
universalRefEditor
::
!
Lifespan
!(
InIDataId
(
Ref2
a
))
!(
a
->
Judgement
)
!*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
universalRefEditor
lifespan
(
init
,
formid
)
invariant
hst
#
(
Ref2
filename
)
=
formid
.
ival
|
filename
==
""
=
mkEditForm
(
Init
,
xtFormId
"ure_TEMP"
createDefault
)
hst
...
...
@@ -71,7 +71,7 @@ where
myVersion
init
filename
cnt
hst
=
mkEditForm
(
init
,{
reuseFormId
formid
cnt
&
id
=
(
"vrs_r_"
+++
filename
)
,
mode
=
NoForm
})
hst
// to remember version number
myEditor
::
!
Init
!
String
!
a
*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
,
TC
a
myEditor
::
!
Init
!
String
!
a
*
HSt
->
(
Form
a
,!*
HSt
)
|
iData
a
myEditor
init
filename
value
hst
#
formId
=
{
reuseFormId
formid
value
&
id
=
"copy_r_"
+++
filename
}
=
mkShowHideForm
(
init
,
formId
)
hst
// copy of database information
...
...
@@ -79,7 +79,7 @@ where
// editor for persistent information
universalDB
::
!(!
Init
,!
Lifespan
,!
a
,!
String
)
!(
String
a
->
Judgement
)
!*
HSt
->
(
a
,!*
HSt
)
|
iData
,
TC
a
universalDB
::
!(!
Init
,!
Lifespan
,!
a
,!
String
)
!(
String
a
->
Judgement
)
!*
HSt
->
(
a
,!*
HSt
)
|
iData
a
universalDB
(
init
,
lifespan
,
value
,
filename
)
invariant
hst
#
(
dbf
,
hst
)
=
myDatabase
Init
0
value
hst
// create / read out database file
#
dbversion
=
fst
dbf
.
value
// version number stored in database
...
...
libraries/htmlGEC/htmlTask.dcl
View file @
993f3c20
...
...
@@ -23,11 +23,12 @@ CTask_pdmenu :: Choose one iTask from list, depending on pulldownmenu item selec
MCTask_ckbox :: Multiple Choice of iTasks, depending on marked checkboxes
PCTask2 :: do both iTasks in any order (paralel), task completed as soon as first one done
PCTasks :: do all iTasks in any order (paralel), task completed as soon as first one done
PCTask2 :: do both iTasks in any order (paralel), task completed
and ends
as soon as first one done
PCTasks :: do all iTasks in any order (paralel), task completed
and ends
as soon as first one done
PTask2 :: do both iTasks in any order (paralel), task completed when both done
PTask :: do all iTasks in any order (paralel), task completed when all done
PTasks :: do all iTasks in any order (paralel), task completed when all done
PMilestoneTasks :: do all iTasks in any order (paralel), task completed (but not ended) as soon as first one done
returnTask :: return the value and show it, no IO action from the user required
returnVF :: return the value and show the code, no IO action from the user required
...
...
@@ -45,34 +46,34 @@ mkRDynTaskCall :: a remote task is set up, but the task that is created will be
BE CAREFUL: static dynamics are used here, will work only for one exectable.
*/
startTask
::
(
Task
a
)
*
HSt
->
([
BodyTag
],
HSt
)
|
iData
,
TC
a
mkTask
::
(*
TSt
->
*(
a
,*
TSt
))
->
(
Task
a
)
|
iData
,
TC
a
startTask
::
(
Task
a
)
*
HSt
->
([
BodyTag
],
HSt
)
|
iData
a
mkTask
::
(*
TSt
->
*(
a
,*
TSt
))
->
(
Task
a
)
|
iData
a
STask
::
String
a
->
(
Task
a
)
|
iData
,
TC
a
STask_button
::
String
(
Task
a
)
->
(
Task
a
)
|
iData
,
TC
a
STasks
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
,
TC
a
STask
::
String
a
->
(
Task
a
)
|
iData
a
STask_button
::
String
(
Task
a
)
->
(
Task
a
)
|
iData
a
STasks
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
a
CTask_button
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
,
TC
a
CTask_pdmenu
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
,
TC
a
CTask_button
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
a
CTask_pdmenu
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
a
MCTask_ckbox
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
,
TC
a
MCTask_ckbox
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
a
PCTask2
::
(
Task
a
,
Task
a
)
->
(
Task
a
)
|
iData
,
TC
a
PCTasks
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
,
TC
a
PCTask2
::
(
Task
a
,
Task
a
)
->
(
Task
a
)
|
iData
a
PCTasks
::
[(
String
,
Task
a
)]
->
(
Task
a
)
|
iData
a
PTask2
::
(
Task
a
,
Task
b
)
->
(
Task
(
a
,
b
))
|
iData
,
TC
a
&
iData
,
TC
b
PTasks
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
,
TC
a
PTask2
::
(
Task
a
,
Task
b
)
->
(
Task
(
a
,
b
))
|
iData
a
&
iData
b
PTasks
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
a
PMilestoneTasks
::
[(
String
,
Task
a
)]
->
(
Task
[
a
])
|
iData
a
returnTask
::
a
->
(
Task
a
)
|
iData
,
TC
a
returnVF
::
a
[
BodyTag
]
->
(
Task
a
)
|
iData
,
TC
a
returnV
::
a
->
(
Task
a
)
|
iData
,
TC
a
returnTask
::
a
->
(
Task
a
)
|
iData
a
returnVF
::
a
[
BodyTag
]
->
(
Task
a
)
|
iData
a
returnV
::
a
->
(
Task
a
)
|
iData
a
returnF
::
[
BodyTag
]
->
TSt
->
TSt
appIData
::
(
IDataFun
a
)
->
(
Task
a
)
|
iData
,
TC
a