Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/255085
Change subject: Checklist: Made sure, there is always on option selected
......................................................................
Checklist: Made sure, there is always on option selected
* bs:checklist will always have a selected option for type list
Change-Id: Id0b501c4f1fca8a279ffae38f705ebfb11e2987c
---
M Checklist/Checklist.class.php
1 file changed, 8 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/85/255085/1
diff --git a/Checklist/Checklist.class.php b/Checklist/Checklist.class.php
index b63c63d..bd6a958 100644
--- a/Checklist/Checklist.class.php
+++ b/Checklist/Checklist.class.php
@@ -352,6 +352,9 @@
if (isset($args['list'])) {
$aOptions = $this->getListOptions( $args['list'] );
}
+ if( !isset($args['value']) || $args['value'] === 'false' ) {
+ $args['value'] = '';
+ }
//$aOptions = array("grĂ¼n", "blau", "gelb", "rot");
$sSelectColor = '';
@@ -360,6 +363,8 @@
$sOut[] = "id='bs-cb-".$this->getNewCheckboxId()."' ";
$sOut[] = "onchange='BsChecklist.change(this);' ";
$sOut[] = ">";
+
+ $bDefault = empty($args['value']) ? true : false;
foreach ( $aOptions as $sOption ) {
$aOptionSet = explode("|", $sOption);
@@ -373,7 +378,8 @@
if (isset ($aOptionSet[1])) {
$sOut[] =
"style='color:".$aOptionSet[1].";' ";
}
- if (isset ($args['value'] ) && $args['value']
== $sOption ) {
+ if( $bDefault || $args['value'] == $sOption ) {
+ $bDefault = false;
$sOut[] = "selected='selected'";
if (isset ($aOptionSet[1])) {
$sSelectColor =
"style='color:".$aOptionSet[1].";' ";
@@ -388,7 +394,7 @@
$sOut[] = "<input type='checkbox' ";
$sOut[] = "id='bs-cb-".$this->getNewCheckboxId()."' ";
$sOut[] = "onclick='BsChecklist.click(this);' ";
- if (isset ($args['value'] ) && $args['value'] ==
'checked') {
+ if( $args['value'] == 'checked' ) {
$sOut[] = "checked='checked' ";
}
$sOut[] = "/>";
--
To view, visit https://gerrit.wikimedia.org/r/255085
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0b501c4f1fca8a279ffae38f705ebfb11e2987c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits