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
typo3
qfq
Commits
3feb3386
Commit
3feb3386
authored
Apr 18, 2016
by
Carsten Rose
Browse files
Merge remote-tracking branch 'origin/raos_work' into crose_work
parents
5b0416b1
bb15e252
Changes
2
Hide whitespace changes
Inline
Side-by-side
javascript/src/QfqForm.js
View file @
3feb3386
...
...
@@ -12,6 +12,16 @@ var QfqNS = QfqNS || {};
'
use strict
'
;
// TODO: This object is getting too big. Start refactoring.
/**
* Represents a QFQ Form.
*
* @param formId {string} value of the form's id attribute
* @param submitTo {string} url where data will be submitted to
* @param deleteUrl {string} url to call upon record deletion
* @param dataRefreshUrl {string} url where to fetch new element values from
* @param fileUploadTo {string} url used for file uploads
* @constructor
*/
n
.
QfqForm
=
function
(
formId
,
submitTo
,
deleteUrl
,
dataRefreshUrl
,
fileUploadTo
)
{
this
.
formId
=
formId
;
this
.
submitTo
=
submitTo
;
...
...
@@ -181,7 +191,6 @@ var QfqNS = QfqNS || {};
*/
n
.
QfqForm
.
prototype
.
handleNewClick
=
function
(
event
)
{
event
.
preventDefault
();
var
anchorTarget
=
event
.
target
.
getAttribute
(
"
href
"
);
this
.
lastButtonPress
=
"
new
"
;
if
(
this
.
form
.
getFormChanged
())
{
...
...
@@ -189,12 +198,15 @@ var QfqNS = QfqNS || {};
var
that
=
this
;
alert
.
on
(
'
alert.save
'
,
function
()
{
that
.
form
.
submitTo
(
that
.
submitTo
);
window
.
location
=
anchorTarget
;
});
alert
.
on
(
'
alert.ok
'
,
function
()
{
var
anchorTarget
=
that
.
getNewButtonTarget
();
window
.
location
=
anchorTarget
;
});
alert
.
show
();
}
else
{
var
anchorTarget
=
this
.
getNewButtonTarget
();
window
.
location
=
anchorTarget
;
}
n
.
Log
.
debug
(
"
new click
"
);
};
...
...
@@ -406,18 +418,25 @@ var QfqNS = QfqNS || {};
n
.
Log
.
debug
(
'
Reset form state
'
);
form
.
resetFormChanged
();
if
(
this
.
lastButtonPress
===
'
save
'
||
!
data
.
redirect
||
data
.
redirect
===
"
no
"
)
{
if
(
data
.
message
)
{
var
alert
=
new
n
.
Alert
(
data
.
message
);
alert
.
timeout
=
1500
;
alert
.
show
();
}
// do we have to update the HTML Form?
if
(
data
[
'
form-update
'
])
{
this
.
applyElementConfiguration
(
data
[
'
form-update
'
]);
}
return
;
switch
(
this
.
lastButtonPress
)
{
case
'
save
'
:
if
(
!
data
.
redirect
||
data
.
redirect
===
"
no
"
)
{
if
(
data
.
message
)
{
var
alert
=
new
n
.
Alert
(
data
.
message
);
alert
.
timeout
=
1500
;
alert
.
show
();
}
// do we have to update the HTML Form?
if
(
data
[
'
form-update
'
])
{
this
.
applyElementConfiguration
(
data
[
'
form-update
'
]);
}
}
return
;
case
'
new
'
:
var
target
=
this
.
getNewButtonTarget
();
window
.
location
=
this
.
getNewButtonTarget
();
return
;
}
if
(
data
.
redirect
===
"
client
"
)
{
...
...
@@ -433,6 +452,10 @@ var QfqNS = QfqNS || {};
};
n
.
QfqForm
.
prototype
.
getNewButtonTarget
=
function
()
{
return
$
(
'
#form-new-button
'
).
attr
(
'
href
'
);
};
n
.
QfqForm
.
prototype
.
getFormGroupByControlName
=
function
(
formControlName
)
{
var
$formControl
=
$
(
"
[name='
"
+
formControlName
+
"
']
"
);
if
(
$formControl
.
length
===
0
)
{
...
...
mockup/personmock.html
View file @
3feb3386
...
...
@@ -91,8 +91,8 @@
class=
"glyphicon glyphicon-trash"
></span></button>
</div>
<div
class=
"btn-group"
role=
"group"
>
<
button
id=
"
new-button"
type=
"button
"
class=
"btn btn-default navbar-btn"
><span
class=
"glyphicon glyphicon-plus"
></span></
button
>
<
a
id=
"form-
new-button"
href=
"http://www.wikipedia.org
"
class=
"btn btn-default navbar-btn"
><span
class=
"glyphicon glyphicon-plus"
></span></
a
>
</div>
</div>
</div>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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