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
mahara
mahara
Commits
b39a55c3
Commit
b39a55c3
authored
Apr 14, 2014
by
Son Nguyen
Committed by
Gerrit Code Review
Apr 14, 2014
Browse files
Merge "Colour form option not saving properly (Bug #1305275)"
parents
f8ba4271
f3e612a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/pieforms.php
View file @
b39a55c3
...
...
@@ -34,7 +34,7 @@ $string['element.files.addattachment'] = 'Add attachment';
$string
[
'element.select.other'
]
=
'Other'
;
$string
[
'element.color.
custom'
]
=
'Customise
'
;
$string
[
'element.color.
transparent'
]
=
'Transparent or
'
;
$string
[
'rule.before.before'
]
=
'This cannot be after the field "%s"'
;
...
...
htdocs/lib/form/elements/color.php
View file @
b39a55c3
...
...
@@ -34,14 +34,14 @@ function pieform_element_color(Pieform $form, $element) {
var {$baseid}_oldval = '';
function {$baseid}_toggle(x) {
if ( x.checked ) {
$('{$baseid}').value = {$baseid}_oldval;
$('{$baseid}').disabled = false;
}
else {
{$baseid}_oldval = $('{$baseid}').value;
$('{$baseid}').value = '';
$('{$baseid}').disabled = true;
}
else {
$('{$baseid}').value = {$baseid}_oldval;
$('{$baseid}').disabled = false;
}
}
</script>
EOF;
...
...
@@ -52,18 +52,18 @@ EOF;
}
$optional
.
=
' <input type="checkbox" '
.
(
isset
(
$element
[
'defaultvalue'
])
&&
$element
[
'defaultvalue'
]
==
'transparent'
?
''
:
'checked="checked" '
)
.
(
isset
(
$element
[
'defaultvalue'
])
&&
$element
[
'defaultvalue'
]
==
'transparent'
?
'checked="checked" '
:
''
)
.
'name="'
.
$name
.
'_optional" id="'
.
$baseid
.
'_optional" onchange="'
.
$baseid
.
'_toggle(this)" '
.
'tabindex="'
.
Pieform
::
hsc
(
$element
[
'tabindex'
])
.
'">'
;
$optional
.
=
' <label for="'
.
$baseid
.
'_optional">'
.
$title
.
$form
->
i18n
(
'element'
,
'color'
,
'
custom
'
,
$element
)
.
'</label> '
;
.
$title
.
$form
->
i18n
(
'element'
,
'color'
,
'
transparent
'
,
$element
)
.
'</label> '
;
$result
.
=
$optional
;
}
// Color Picker (Chooser)
$result
.
=
'<input type="text" name="'
.
$name
.
'_color" id="'
.
$baseid
.
'"'
.
(
$transparent
&&
!
isset
(
$element
[
'defaultvalue'
])
?
' disabled="disabled"'
:
''
)
.
(
$transparent
&&
(
!
isset
(
$element
[
'defaultvalue'
])
||
$element
[
'defaultvalue'
]
==
'transparent'
)
?
' disabled="disabled"'
:
''
)
.
(
$transparent
?
' class="color {hash:true,required:false}"'
:
' class="color {hash:true}"'
)
.
' value="'
.
(
$value
==
'transparent'
?
''
:
$value
)
.
'">'
;
...
...
@@ -80,7 +80,7 @@ EOF;
function
pieform_element_color_get_value
(
Pieform
$form
,
$element
)
{
$name
=
$element
[
'name'
];
$global
=
(
$form
->
get_property
(
'method'
)
==
'get'
)
?
$_GET
:
$_POST
;
if
(
$form
->
is_submitted
()
&&
isset
(
$global
[
$name
.
'_color'
])
&&
isset
(
$global
[
$name
.
'_optional'
]))
{
if
(
$form
->
is_submitted
()
&&
isset
(
$global
[
$name
.
'_color'
])
&&
!
isset
(
$global
[
$name
.
'_optional'
]))
{
$color
=
$global
[
$name
.
'_color'
];
// Whitelist for a 6-digit hex color
...
...
Write
Preview
Markdown
is supported
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