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
typo3
qfq
Commits
c1cd39fe
Commit
c1cd39fe
authored
Jan 30, 2018
by
bbaer
Browse files
c
parent
d65db5ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
javascript/src/Plugins/qfq.fabric.js
View file @
c1cd39fe
...
...
@@ -24,7 +24,7 @@ $(function (n) {
});
this
.
emojiContainer
=
{};
this
.
eventEmitter
=
new
EventEmitter
();
this
.
Q
fq
Form
=
n
.
QfqForm
;
this
.
q
fq
Page
=
{}
;
this
.
textContainer
=
{};
this
.
userTextInput
=
{};
this
.
outputField
=
{};
...
...
@@ -244,12 +244,13 @@ $(function (n) {
fabric
.
Object
.
prototype
.
transparentCorners
=
false
;
};
n
.
Fabric
.
prototype
.
initialize
=
function
(
$fabricElement
)
{
n
.
Fabric
.
prototype
.
initialize
=
function
(
$fabricElement
,
qfqPage
)
{
var
inputField
=
$fabricElement
.
data
(
'
control-name
'
);
var
imageOutput
=
$fabricElement
.
data
(
'
image-output
'
);
var
viewOnly
=
$fabricElement
.
data
(
'
view-only
'
)
||
false
;
var
editImage
=
$fabricElement
.
data
(
'
edit-image
'
)
||
false
;
var
resizeWidth
=
$fabricElement
.
data
(
'
image-resize-width
'
)
||
0
;
this
.
qfqPage
=
qfqPage
;
this
.
parentElement
=
$fabricElement
;
this
.
backgroundImage
=
$fabricElement
.
data
(
'
background-image
'
)
||
false
;
this
.
fabricJSON
=
$fabricElement
.
data
(
'
fabric-json
'
)
||
false
;
...
...
@@ -940,11 +941,13 @@ $(function (n) {
/* Important! Changes only possible after initialisation */
if
(
this
.
userChangePossible
)
{
var
that
=
this
;
console
.
log
(
'
test
'
);
this
.
outputField
.
val
(
JSON
.
stringify
(
that
.
canvas
.
toJSON
()));
var
$saveButton
=
$
(
"
#save-button
"
);
$saveButton
.
removeClass
(
"
disabled
"
);
$saveButton
.
addClass
(
$saveButton
.
data
(
'
class-on-change
'
)
||
'
alert-warning
'
);
$saveButton
.
removeAttr
(
"
disabled
"
);
if
(
this
.
qfqPage
.
qfqForm
)
{
this
.
qfqPage
.
qfqForm
.
eventEmitter
.
emitEvent
(
'
form.changed
'
,
n
.
EventEmitter
.
makePayload
(
that
,
null
));
}
else
{
throw
(
"
Error: Couldn't initialize qfqForm - not possible to send form.changed event
"
);
}
}
};
...
...
javascript/src/QfqForm.js
View file @
c1cd39fe
...
...
@@ -744,6 +744,7 @@ var QfqNS = QfqNS || {};
if
(
this
.
formImmutableDueToConcurrentAccess
)
{
return
;
}
console
.
log
(
"
QFQForm Changehandler
"
);
this
.
getSaveButton
().
removeClass
(
"
disabled
"
);
this
.
getSaveButton
().
addClass
(
this
.
getSaveButtonAttentionClass
());
this
.
getSaveButton
().
removeAttr
(
"
disabled
"
);
...
...
@@ -940,8 +941,7 @@ var QfqNS = QfqNS || {};
this
.
applyFormConfiguration
(
data
[
'
form-update
'
]);
}
if
(
data
[
'
element-update
'
])
{
this
.
applyElementConfiguration
(
data
[
'
element-update
'
]);
if
(
data
[
'
element-update
'
])
{
this
.
applyElementConfiguration
(
data
[
'
element-update
'
]);
}
if
(
data
.
redirect
===
"
url
"
&&
data
[
'
redirect-url
'
])
{
...
...
@@ -1132,6 +1132,7 @@ var QfqNS = QfqNS || {};
n
.
QfqForm
.
prototype
.
applyElementConfiguration
=
function
(
configuration
)
{
if
(
!
configuration
)
{
console
.
error
(
"
No configuration for Element Update found
"
);
return
;
}
...
...
javascript/src/QfqPage.js
View file @
c1cd39fe
...
...
@@ -24,10 +24,11 @@ var QfqNS = QfqNS || {};
* @name QfqNS.QfqPage
*/
n
.
QfqPage
=
function
(
settings
)
{
this
.
qfqForm
=
{};
this
.
settings
=
$
.
extend
(
{
tabsId
:
"
qfqTabs
"
,
formId
:
"
qfq
Form
"
,
formId
:
"
qfq
Page
"
,
submitTo
:
"
typo3conf/ext/qfq/qfq/api/save.php
"
,
deleteUrl
:
"
typo3conf/ext/qfq/qfq/api/delete.php
"
,
refreshUrl
:
"
typo3conf/ext/qfq/qfq/api/load.php
"
,
...
...
@@ -88,6 +89,17 @@ var QfqNS = QfqNS || {};
this
.
qfqForm
=
null
;
}
// Initialize Fabric to access form events
try
{
var
page
=
this
;
$
(
"
.fabric
"
).
each
(
function
()
{
var
qfqFabric
=
new
QfqNS
.
Fabric
();
qfqFabric
.
initialize
(
$
(
this
),
page
);
});
}
catch
(
e
)
{
n
.
Log
.
error
(
e
.
message
);
}
QfqNS
.
TypeAhead
.
install
(
this
.
settings
.
typeAheadUrl
);
QfqNS
.
CharacterCount
.
initialize
();
};
...
...
@@ -99,20 +111,20 @@ var QfqNS = QfqNS || {};
var
message
=
"
\
0/
"
;
n
.
Log
.
debug
(
"
beforeUnloadHandler()
"
);
if
(
this
.
qfq
Form
.
isFormChanged
()
&&
!
this
.
intentionalClose
)
{
if
(
this
.
qfq
Page
.
isFormChanged
()
&&
!
this
.
intentionalClose
)
{
event
.
returnValue
=
message
;
return
message
;
}
this
.
qfq
Form
.
releaseLock
();
this
.
qfq
Page
.
releaseLock
();
};
/**
* @private
*/
n
.
QfqPage
.
prototype
.
destroyFormHandler
=
function
(
obj
)
{
this
.
settings
.
qfq
Form
=
null
;
this
.
settings
.
qfq
Page
=
null
;
$
(
'
#
'
+
this
.
settings
.
tabsId
).
remove
();
};
...
...
mockup/fabric.html
View file @
c1cd39fe
...
...
@@ -77,8 +77,7 @@
QfqNS
.
Log
.
level
=
0
;
// Just for mockup, init() function called from new QfqNS.Plugin class maybe.
var
qfqFabric
=
new
QfqNS
.
Fabric
();
qfqFabric
.
initialize
(
$
(
"
.fabric
"
));
});
</script>
</body>
...
...
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