Skip to content
GitLab
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
d26aac8f
Commit
d26aac8f
authored
Apr 24, 2008
by
Bas Lijnse
Browse files
Fixed subforms in submit mode, there are no longer extra submit buttons in nested forms
parent
88d9325f
Changes
6
Hide whitespace changes
Inline
Side-by-side
libraries/iData/PrintUtil.dcl
View file @
d26aac8f
...
...
@@ -46,7 +46,8 @@ print :: !String -> FoF
(<+)
infixl
::
!*
HtmlStream
!
a
->
*
HtmlStream
|
gHpr
{|*|}
a
(<+>)
infixl
::
!*
HtmlStream
!
FoF
->
*
HtmlStream
htmlAttrCmnd
::
!
hdr
!
tag
!
body
->
FoF
|
gHpr
{|*|}
hdr
&
gHpr
{|*|}
tag
&
gHpr
{|*|}
body
openCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
styleCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
styleAttrCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
htmlAttrCmnd
::
!
hdr
!
tag
!
body
->
FoF
|
gHpr
{|*|}
hdr
&
gHpr
{|*|}
tag
&
gHpr
{|*|}
body
htmlBodylessAttrCmnd
::
!
hdr
!
attr
->
FoF
|
gHpr
{|*|}
hdr
&
gHpr
{|*|}
attr
openCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
styleCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
styleAttrCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
libraries/iData/PrintUtil.icl
View file @
d26aac8f
...
...
@@ -95,6 +95,9 @@ closeCmnd hdr = \file -> print "</" file <+ hdr <+ ">"
htmlAttrCmnd
::
!
hdr
!
attr
!
body
->
FoF
|
gHpr
{|*|}
hdr
&
gHpr
{|*|}
attr
&
gHpr
{|*|}
body
htmlAttrCmnd
hdr
attr
txt
=
\
file
->
closeCmnd
hdr
(
openCmnd
hdr
attr
file
<+
txt
)
htmlBodylessAttrCmnd
::
!
hdr
!
attr
->
FoF
|
gHpr
{|*|}
hdr
&
gHpr
{|*|}
attr
htmlBodylessAttrCmnd
hdr
attr
=
\
file
->
[|
"<"
:
file
]
<+
hdr
<+
attr
<+
" />"
styleCmnd
::
!
a
!
b
->
FoF
|
gHpr
{|*|}
a
&
gHpr
{|*|}
b
styleCmnd
stylename
attr
=
\
file
->
print
"."
file
<+
stylename
<+
"{"
<+
attr
<+
"}"
...
...
libraries/iData/Resources/js/clean.js
View file @
d26aac8f
...
...
@@ -143,7 +143,7 @@ function addState(form) {
//Sends the information in a form to the server/client handler
function
sendForm
(
formid
,
onclient
)
{
var
form
=
document
.
getElementById
(
formid
);
if
(
form
==
undefined
)
{
...
...
@@ -159,6 +159,7 @@ function sendForm(formid, onclient) {
return
;
//When sapl fails we try sending via ajax or submit.
}
}
//Send the form to the server. Either via ajax or with a submit.
if
(
use_ajax
)
{
ajaxSendForm
(
form
);
...
...
@@ -210,6 +211,7 @@ function getForm(elem)
//Sends a form by submitting it
function
submitSendForm
(
form
)
{
//Always send the values of checkboxes
var
inputs
=
form
.
getElementsByTagName
(
'
input
'
);
for
(
var
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
...
...
libraries/iData/iDataHandler.dcl
View file @
d26aac8f
...
...
@@ -23,6 +23,7 @@ derive write Inline
::
*
HSt
=
{
cntr
::
!
Int
// counts position in expression
,
submits
::
!
Bool
// True if we are in submitting mode
,
issub
::
!
Bool
// True if this form is a subform of another
,
states
::
!*
FormStates
// all form states are collected here ...
,
request
::
!
HTTPRequest
// to enable access to the current HTTP request
,
world
::
*
NWorld
// to enable all other kinds of I/O
...
...
libraries/iData/iDataHandler.icl
View file @
d26aac8f
...
...
@@ -20,6 +20,7 @@ gPrint{|(->)|} gArg gRes _ _ = abort "functions can only be used with dynamic st
::
*
HSt
=
{
cntr
::
!
Int
// counts position in expression
,
submits
::
!
Bool
// True if we are in submit form
,
issub
::
!
Bool
// True if this form is a subform of another
,
states
::
!*
FormStates
// all form states are collected here ...
,
request
::
!
HTTPRequest
// to enable access to the current HTTP request
,
world
::
*
NWorld
// to enable all other kinds of I/O
...
...
@@ -201,7 +202,7 @@ doHtmlClient userpage world
mkHSt
::
*
FormStates
*
NWorld
->
*
HSt
mkHSt
states
nworld
=
{
cntr
=
0
,
states
=
states
,
request
=
http_emptyRequest
,
world
=
nworld
,
submits
=
False
}
mkHSt
states
nworld
=
{
cntr
=
0
,
states
=
states
,
request
=
http_emptyRequest
,
world
=
nworld
,
submits
=
False
,
issub
=
False
}
// The function mkViewForm is *the* magic main function
...
...
@@ -209,7 +210,7 @@ mkHSt states nworld = {cntr=0, states=states, request= http_emptyRequest, world=
// It does everything, a swiss army knife editor that makes coffee too ...
mkViewForm
::
!(
InIDataId
d
)
!(
HBimap
d
v
)
!*
HSt
->
(
Form
d
,!*
HSt
)
|
iData
v
mkViewForm
(
init
,
formid
)
bm
=:{
toForm
,
updForm
,
fromForm
,
resetForm
}
hst
=:{
states
,
world
,
submits
}
mkViewForm
(
init
,
formid
)
bm
=:{
toForm
,
updForm
,
fromForm
,
resetForm
}
hst
=:{
states
,
world
,
submits
,
issub
}
|
init
==
Const
&&
formid
.
lifespan
<>
Temp
=
mkViewForm
(
init
,{
formid
&
lifespan
=
Temp
})
bm
hst
// constant i-data are never stored
|
init
==
Const
// constant i-data, no look up of previous value
...
...
@@ -238,7 +239,7 @@ where
,
mkHSt
states
world
)
#
(
viewform
,{
states
,
world
})
// make a form for it
=
mkForm
(
init
,
if
(
init
==
Const
)
vformid
(
reuseFormId
formid
view
))
({
mkHSt
states
world
&
submits
=
submits
})
=
mkForm
(
init
,
if
(
init
==
Const
)
vformid
(
reuseFormId
formid
view
))
({
mkHSt
states
world
&
submits
=
submits
,
issub
=
issub
})
|
viewform
.
changed
&&
not
isupdated
// important: redo it all to handle the case that a user defined specialisation is updated !!
=
calcnextView
True
(
Just
viewform
.
value
)
states
world
...
...
@@ -335,23 +336,26 @@ where
// gForm: automatically derives a Html form for any Clean type
mkForm
::
!(
InIDataId
a
)
!*
HSt
->
*(
Form
a
,
!*
HSt
)
|
gForm
{|*|}
a
mkForm
(
init
,
formid
)
hst
#
(
form
,
hst
)
=
gForm
{|*|}
(
init
,
formid
)
{
hst
&
submits
=
(
formid
.
mode
==
Submit
)
}
//Use gForm to create the html form
mkForm
(
init
,
formid
)
hst
=:
{
issub
}
#
(
form
,
hst
)
=
gForm
{|*|}
(
init
,
formid
)
{
hst
&
submits
=
(
formid
.
mode
==
Submit
)
,
issub
=
True
}
//Use gForm to create the html form
#
buttons
=
if
(
formid
.
mode
==
Submit
)
//Add submit and clear buttons to a form in submit mode.
[
Br
,
Input
[
Inp_Type
Inp_Submit
,
Inp_Value
(
SV
"Submit"
)]
""
,
Input
[
Inp_Type
Inp_Reset
,
Inp_Value
(
SV
"Clear"
)]
""
,
Br
]
[
Input
[
Inp_Type
Inp_Submit
,
`
Inp_Std
[
Std_Style
"display: none"
]
]
""
]
//Add a hidden submit input to allow updates on press of "enter" button
#
sform
=
[
Form
[
Frm_Action
(
"/"
+++
ThisExe
)
//Wrap the form in html form tags
#
sform
=
if
issub
form
.
form
[
Form
[
Frm_Action
(
"/"
+++
ThisExe
)
//Wrap the form in html form tags
,
Frm_Method
Post
,
Frm_Name
(
encodeString
formid
.
id
)
//Enable the use of any character in a form name
,
Frm_Enctype
"multipart/form-data"
,
`
Frm_Events
[
OnSubmit
(
SScript
"return catchSubmit(this);"
)]
,
`
Frm_Std
[
Std_Id
(
encodeString
formid
.
id
)]
]
(
form
.
form
++
buttons
)
]
]
=
({
form
&
form
=
sform
}
,
hst
)
generic
gForm
a
::
!(
InIDataId
a
)
!*
HSt
->
*(
Form
a
,
!*
HSt
)
...
...
libraries/iData/iDataHtmlDef.icl
View file @
d26aac8f
...
...
@@ -62,11 +62,11 @@ gHpr{|BodyTag|} prev (H3 attr text) = prev <+> htmlAttrCmnd "h3" attr tex
gHpr
{|
BodyTag
|}
prev
(
H4
attr
text
)
=
prev
<+>
htmlAttrCmnd
"h4"
attr
text
gHpr
{|
BodyTag
|}
prev
(
H5
attr
text
)
=
prev
<+>
htmlAttrCmnd
"h5"
attr
text
gHpr
{|
BodyTag
|}
prev
(
H6
attr
text
)
=
prev
<+>
htmlAttrCmnd
"h6"
attr
text
gHpr
{|
BodyTag
|}
prev
(
Hr
attr
)
=
prev
<+>
htmlAttrCmnd
"hr"
attr
None
gHpr
{|
BodyTag
|}
prev
(
Hr
attr
)
=
prev
<+>
html
Bodyless
AttrCmnd
"hr"
attr
gHpr
{|
BodyTag
|}
prev
(
I
attr
text
)
=
prev
<+>
htmlAttrCmnd
"i"
attr
text
gHpr
{|
BodyTag
|}
prev
(
Iframe
attr
)
=
prev
<+>
htmlAttrCmnd
"iframe"
attr
None
gHpr
{|
BodyTag
|}
prev
(
Img
attr
)
=
prev
<+>
htmlAttrCmnd
"img"
attr
None
gHpr
{|
BodyTag
|}
prev
(
Input
attr
text
)
=
prev
<+>
htmlAttrCmnd
"input"
attr
text
gHpr
{|
BodyTag
|}
prev
(
Input
attr
text
)
=
prev
<+>
html
Bodyless
AttrCmnd
"input"
attr
gHpr
{|
BodyTag
|}
prev
(
Ins
attr
text
)
=
prev
<+>
htmlAttrCmnd
"ins"
attr
text
gHpr
{|
BodyTag
|}
prev
(
Kbd
attr
text
)
=
prev
<+>
htmlAttrCmnd
"kbd"
attr
text
gHpr
{|
BodyTag
|}
prev
(
Label
attr
text
)
=
prev
<+>
htmlAttrCmnd
"label"
attr
text
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment