Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
ce0758a5
Commit
ce0758a5
authored
9 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Plain Diff
Merge pull request #1361 from TorMec/master
multicheckbox without extra string input
parents
54c0fa7c
77446daa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/plugins/config/settings/config.class.php
+16
-10
16 additions, 10 deletions
lib/plugins/config/settings/config.class.php
lib/plugins/config/settings/config.metadata.php
+6
-0
6 additions, 0 deletions
lib/plugins/config/settings/config.metadata.php
with
22 additions
and
10 deletions
lib/plugins/config/settings/config.class.php
+
16
−
10
View file @
ce0758a5
...
...
@@ -1191,6 +1191,7 @@ if (!class_exists('setting_multicheckbox')) {
var
$_choices
=
array
();
var
$_combine
=
array
();
var
$_other
=
'always'
;
/**
* update changed setting with user provided value $input
...
...
@@ -1274,16 +1275,21 @@ if (!class_exists('setting_multicheckbox')) {
}
// handle any remaining values
$other
=
join
(
','
,
$value
);
$class
=
((
count
(
$default
)
==
count
(
$value
))
&&
(
count
(
$value
)
==
count
(
array_intersect
(
$value
,
$default
))))
?
" selectiondefault"
:
""
;
$input
.
=
'<div class="other'
.
$class
.
'">'
.
"
\n
"
;
$input
.
=
'<label for="config___'
.
$key
.
'_other">'
.
$plugin
->
getLang
(
$key
.
'_other'
)
.
"</label>
\n
"
;
$input
.
=
'<input id="config___'
.
$key
.
'_other" name="config['
.
$key
.
'][other]" type="text" class="edit" value="'
.
htmlspecialchars
(
$other
)
.
'" '
.
$disable
.
" />
\n
"
;
$input
.
=
"</div>
\n
"
;
if
(
$this
->
_other
!=
'never'
){
$other
=
join
(
','
,
$value
);
// test equivalent to ($this->_other == 'always' || ($other && $this->_other == 'exists')
// use != 'exists' rather than == 'always' to ensure invalid values default to 'always'
if
(
$this
->
_other
!=
'exists'
||
$other
)
{
$class
=
((
count
(
$default
)
==
count
(
$value
))
&&
(
count
(
$value
)
==
count
(
array_intersect
(
$value
,
$default
))))
?
" selectiondefault"
:
""
;
$input
.
=
'<div class="other'
.
$class
.
'">'
.
"
\n
"
;
$input
.
=
'<label for="config___'
.
$key
.
'_other">'
.
$plugin
->
getLang
(
$key
.
'_other'
)
.
"</label>
\n
"
;
$input
.
=
'<input id="config___'
.
$key
.
'_other" name="config['
.
$key
.
'][other]" type="text" class="edit" value="'
.
htmlspecialchars
(
$other
)
.
'" '
.
$disable
.
" />
\n
"
;
$input
.
=
"</div>
\n
"
;
}
}
$label
=
'<label>'
.
$this
->
prompt
(
$plugin
)
.
'</label>'
;
return
array
(
$label
,
$input
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/plugins/config/settings/config.metadata.php
+
6
−
0
View file @
ce0758a5
...
...
@@ -70,6 +70,12 @@
* '_pregflags' - string, default 'ui', valid preg pattern modifiers used when testing regex input values, for more
* information see http://uk1.php.net/manual/en/reference.pcre.pattern.modifiers.php
* '_multiple' - bool, allow multiple comma separated email values; optional for 'email', ignored by others
* '_other' - how to handle other values (not listed in _choices). accepted values: 'always','exists','never'
* default value 'always'. 'exists' only shows 'other' input field when the setting contains value(s)
* not listed in choices (e.g. due to manual editing or update changing _choices). This is safer than
* 'never' as it will not discard unknown/other values.
* optional for 'multicheckbox', ignored by others
*
*
* @author Chris Smith <chris@jalakai.co.uk>
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment