Commit 0e7b8f3a authored by Robert Lyon's avatar Robert Lyon

Adjusting more checkboxes to switchboxes for consistency (Bug 1482447)

Now checkboxes should only be used when there is a list of options
and switchboxes should be used where there is a binary choice.

behatnotneeded: Is a style change on checkboxes - the checkboxes
should still works as before so existing behat tests will suffice

Change-Id: I818b7c7e5cf786c0d51d75cab1c0993e29b3f02c
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent ed5c2891
......@@ -56,7 +56,7 @@ $form = array(
)
),
'emailusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('emailusersaboutnewaccount', 'admin'),
'description' => get_string('emailusersaboutnewaccountdescription', 'admin'),
'defaultvalue' => true,
......@@ -90,7 +90,6 @@ function bulkimport_validate(Pieform $form, $values) {
}
require_once('csvfile.php');
$zipfile = $values['file'];
if (!is_file($zipfile)) {
$form->set_error('file', get_string('importfilenotafile', 'admin'));
......
......@@ -98,19 +98,22 @@ $form = array(
)
),
'forcepasswordchange' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('forceuserstochangepassword', 'admin'),
'description' => get_string('forceuserstochangepassworddescription', 'admin'),
'defaultvalue' => true,
),
'emailusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('emailusersaboutnewaccount', 'admin'),
'description' => get_string('emailusersaboutnewaccountdescription', 'admin'),
'defaultvalue' => true,
),
'updateusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('updateusers', 'admin'),
'description' => get_string('updateusersdescription', 'admin'),
'defaultvalue' => false,
......
......@@ -145,8 +145,8 @@ class PluginBlocktypeFolder extends PluginBlocktype {
);
if (get_config_plugin('blocktype', 'folder', 'folderdownloadzip')) {
$elements['folderdownloadzip'] = array(
'type' => 'checkbox',
'labelhtml' => get_string('downloadfolderzipblock', 'artefact.file'),
'type' => 'switchbox',
'title' => get_string('downloadfolderzipblock', 'artefact.file'),
'description' => get_string('downloadfolderzipdescriptionblock', 'artefact.file'),
'defaultvalue' => (get_config_plugin('blocktype', 'folder', 'folderdownloadzip') ? (isset($configdata['folderdownloadzip']) ? $configdata['folderdownloadzip'] : 0) : 0),
);
......
......@@ -99,7 +99,7 @@ class PluginBlocktypeSocialprofile extends PluginBlocktype {
)
),
'displayemail' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'labelhtml' => '<span class="pseudolabel">' . get_string('displaydefaultemail', 'blocktype.internal/socialprofile') . '</span>',
'defaultvalue' => (!empty($configdata['displayemail']) ? $configdata['displayemail'] : 0),
),
......
......@@ -145,7 +145,8 @@ class PluginAuthBrowserid extends PluginAuth {
'value' => 'browserid',
),
'weautocreateusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('weautocreateusers', 'auth'),
'defaultvalue' => self::$default_config['weautocreateusers'],
'help' => true
......
......@@ -1762,18 +1762,20 @@ class PluginAuthLdap extends PluginAuth {
'help' => true,
),
'starttls' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('starttls', 'auth.ldap'),
'defaultvalue' => self::$default_config['starttls'],
),
'updateuserinfoonlogin' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('updateuserinfoonlogin', 'auth.ldap'),
'defaultvalue' => self::$default_config['updateuserinfoonlogin'],
'help' => true,
),
'weautocreateusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('weautocreateusers', 'auth.ldap'),
'defaultvalue' => self::$default_config['weautocreateusers'],
'help' => true,
......@@ -1815,18 +1817,18 @@ class PluginAuthLdap extends PluginAuth {
'collapsed' => (!self::$default_config['syncuserscron']),
'elements' => array(
'syncuserscron' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncuserscron', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncuserscron'],
),
'syncusersupdate' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncusersupdate', 'auth.ldap'),
'defaultvalue' => self::$default_config['syncusersupdate'],
),
'syncuserscreate' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncuserscreate', 'auth.ldap'),
'defaultvalue' => self::$default_config['syncuserscreate'],
),
......@@ -1856,13 +1858,13 @@ class PluginAuthLdap extends PluginAuth {
'collapsed' => (!self::$default_config['syncgroupscron']),
'elements' => array(
'syncgroupscron' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncgroupscron', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncgroupscron'],
),
'syncgroupsautocreate' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncgroupsautocreate', 'auth.ldap'),
'defaultvalue' => self::$default_config['syncgroupsautocreate'],
),
......@@ -1889,7 +1891,7 @@ class PluginAuthLdap extends PluginAuth {
'value' => '<hr />',
),
'syncgroupsbyclass' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('syncgroupsbyclass', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncgroupsbyclass'],
......@@ -1913,13 +1915,15 @@ class PluginAuthLdap extends PluginAuth {
'defaultvalue' => self::$default_config['syncgroupsmemberattribute'],
),
'syncgroupsmemberattributeisdn' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('syncgroupsmemberattributeisdn', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncgroupsmemberattributeisdn'],
),
'syncgroupsnestedgroups' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('syncgroupsnestedgroups', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncgroupsnestedgroups'],
......@@ -1944,7 +1948,8 @@ class PluginAuthLdap extends PluginAuth {
'value' => '<hr />',
),
'syncgroupsbyuserfield' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('syncgroupsbyuserfield', 'auth.ldap'),
'help' => true,
'defaultvalue' => self::$default_config['syncgroupsbyuserfield'],
......
......@@ -401,7 +401,8 @@ class PluginAuthSaml extends PluginAuth {
'help' => true,
),
'institutionregex' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('institutionregex', 'auth.saml'),
'defaultvalue' => self::$default_config['institutionregex'],
'help' => true,
......@@ -416,26 +417,30 @@ class PluginAuthSaml extends PluginAuth {
'help' => true,
),
'remoteuser' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('remoteuser', 'auth.saml'),
'defaultvalue' => self::$default_config['remoteuser'],
'help' => true,
),
'loginlink' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('loginlink', 'auth.saml'),
'defaultvalue' => self::$default_config['loginlink'],
'disabled' => (self::$default_config['remoteuser'] ? false : true),
'help' => true,
),
'updateuserinfoonlogin' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('updateuserinfoonlogin', 'auth.saml'),
'defaultvalue' => self::$default_config['updateuserinfoonlogin'],
'help' => true,
),
'weautocreateusers' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'switchtext' => 'yesno',
'title' => get_string('weautocreateusers', 'auth.saml'),
'defaultvalue' => self::$default_config['weautocreateusers'],
'help' => true,
......
......@@ -806,28 +806,28 @@ class PluginAuthXmlrpc extends PluginAuth {
);
$elements['updateuserinfoonlogin'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('updateuserinfoonlogin', 'auth'),
'defaultvalue' => self::$default_config['updateuserinfoonlogin'],
'help' => true
);
$elements['weautocreateusers'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('weautocreateusers', 'auth'),
'defaultvalue' => self::$default_config['weautocreateusers'],
'help' => true
);
$elements['theyautocreateusers'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('theyautocreateusers', 'auth'),
'defaultvalue' => self::$default_config['theyautocreateusers'],
'help' => true
);
$elements['weimportcontent'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('weimportcontent', 'auth'),
'defaultvalue' => self::$default_config['weimportcontent'],
'help' => true,
......
......@@ -166,7 +166,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
),
),
'insecuresslmode' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('insecuresslmode', 'blocktype.externalfeed'),
'description' => get_string('insecuresslmodedesc', 'blocktype.externalfeed'),
'defaultvalue' => (bool)$insecuresslmode,
......@@ -195,7 +195,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
'maxvalue' => 20,
),
'full' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('showfeeditemsinfull', 'blocktype.externalfeed'),
'description' => get_string('showfeeditemsinfulldesc', 'blocktype.externalfeed'),
'defaultvalue' => (bool)$full,
......
......@@ -140,7 +140,7 @@ class PluginBlocktypeInbox extends SystemBlocktype {
$title = get_string('type' . $type->name, 'activity');
}
$elements['types']['elements'][$type->name] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => $title,
'defaultvalue' => isset($configdata[$type->name]) ? $configdata[$type->name] : 0,
);
......
......@@ -160,7 +160,7 @@ class PluginBlocktypeWall extends SystemBlocktype {
'value' => get_string('maxcharacters', 'blocktype.wall', get_config_plugin('blocktype', 'wall', 'defaultpostsizelimit'))
),
'private' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('makeyourpostprivate', 'blocktype.wall'),
),
'instance' => array(
......
......@@ -55,11 +55,10 @@ $elements = array(
'defaultvalue' => 'all',
),
'includefeedback' => array(
'type' => 'checkbox',
'class' => 'checkbox last',
'type' => 'switchbox',
'class' => 'last',
'title' => get_string('includefeedback', 'export'),
'description' => get_string('includefeedbackdescription', 'export'),
'separator' => '</div><div>',
'defaultvalue' => 1,
),
);
......
......@@ -466,7 +466,7 @@ class Collection {
'help' => true,
),
'navigation' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('viewnavigation','collection'),
'description' => get_string('viewnavigationdesc','collection'),
'defaultvalue' => 1,
......
......@@ -159,7 +159,7 @@ class ImageBrowser {
)
),
'constrain' => array (
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string ( 'constrain' ),
'defaultvalue' => true
),
......
......@@ -56,7 +56,7 @@ EOF;
)
),
'sendweeklyupdates' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('sendweeklyupdates', 'admin'),
'defaultvalue' => true,
),
......
......@@ -88,7 +88,7 @@ $searchform['elements']['submit'] = array(
'value' => get_string('search'),
);
$searchform['elements']['tagsonly'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'value' => (isset($options['tagsonly']) && $options['tagsonly'] == true) ? true : false,
'title' => get_string('tagsonly', 'search.elasticsearch'),
);
......
......@@ -326,7 +326,7 @@ $elements['viewheader'] = array(
),
),
'header_link_normal_underline' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('linkunderlined', 'skin'),
'defaultvalue' => (isset($viewskin['header_link_normal_underline']) and intval($viewskin['header_link_normal_underline']) == 1 ? 'checked' : ''),
),
......@@ -340,7 +340,7 @@ $elements['viewheader'] = array(
),
),
'header_link_hover_underline' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('linkunderlined', 'skin'),
'defaultvalue' => (isset($viewskin['header_link_hover_underline']) and intval($viewskin['header_link_hover_underline']) == 1 ? 'checked' : ''),
),
......@@ -432,7 +432,7 @@ $elements['viewcontent'] = array(
),
),
'view_link_normal_underline' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('linkunderlined', 'skin'),
'defaultvalue' => (isset($viewskin['view_link_normal_underline']) and intval($viewskin['view_link_normal_underline']) == 1 ? 'checked' : ''),
),
......@@ -446,7 +446,7 @@ $elements['viewcontent'] = array(
),
),
'view_link_hover_underline' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('linkunderlined', 'skin'),
'defaultvalue' => (isset($viewskin['view_link_hover_underline']) and intval($viewskin['view_link_hover_underline']) == 1 ? 'checked' : ''),
),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -67,6 +67,9 @@
label {
min-width: 100px;
}
.form-switch label {
min-width: auto;
}
}
.form-condensed & {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -161,19 +161,19 @@ $form['elements']['more'] = array(
'legend' => get_string('moreoptions', 'view'),
'elements' => array(
'allowcomments' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('allowcomments','artefact.comment'),
'description' => get_string('allowcommentsonview','view'),
'defaultvalue' => $view->get('allowcomments'),
),
'approvecomments' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('moderatecomments', 'artefact.comment'),
'description' => get_string('moderatecommentsdescription', 'artefact.comment'),
'defaultvalue' => $view->get('approvecomments'),
),
'template' => array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('allowcopying', 'view'),
'description' => get_string('templatedescriptionplural1', 'view'),
'defaultvalue' => $view->get('template'),
......@@ -194,7 +194,7 @@ $js = '';
if ($institution) {
if ($institution == 'mahara') {
$form['elements']['more']['elements']['copynewuser'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('copyfornewusers', 'view'),
'description' => get_string('copyfornewusersdescription1', 'view'),
'defaultvalue' => $view->get('copynewuser'),
......@@ -210,7 +210,7 @@ if ($institution) {
$createfor = $view->get_autocreate_grouptypes();
foreach (group_get_grouptype_options() as $grouptype => $grouptypedesc) {
$form['elements']['more']['elements']['copyfornewgroups_'.$grouptype] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => $grouptypedesc,
'defaultvalue' => in_array($grouptype, $createfor),
);
......@@ -221,7 +221,7 @@ if ($institution) {
$i = new Institution($institution);
$instname = hsc($i->displayname);
$form['elements']['more']['elements']['copynewuser'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('copyfornewmembers', 'view'),
'description' => get_string('copyfornewmembersdescription1', 'view', $instname),
'defaultvalue' => $view->get('copynewuser'),
......@@ -229,7 +229,7 @@ if ($institution) {
}
} else {
$form['elements']['more']['elements']['retainview'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('retainviewrights1', 'view'),
'description' => $group ? get_string('retainviewrightsgroupdescription1', 'view') : get_string('retainviewrightsdescription1', 'view'),
'defaultvalue' => $view->get('template') && $view->get('retainview'),
......
......@@ -147,7 +147,7 @@ if ($group) {
$grouproles = $USER->get('grouproles');
if ($grouproles[$group] == 'admin') {
$editview['elements']['locked'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('Locked', 'view'),
'description' => get_string('lockedgroupviewdesc', 'view'),
'defaultvalue' => $view->get('locked'),
......@@ -173,7 +173,7 @@ if (!($group || $institution)) {
if (get_config('allowanonymouspages')) {
$editview['elements']['anonymise'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('anonymise','view'),
'description' => get_string('anonymisedescription','view'),
'defaultvalue' => $view->get('anonymise'),
......
......@@ -98,12 +98,12 @@ for ($i = 0; $i < count($records); $i++) {
);
if (!$allowcomments) {
$elements['allowcomments'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('allowcomments', 'artefact.comment'),
'defaultvalue' => $r->allowcomments,
);
$elements['approvecomments'] = array(
'type' => 'checkbox',
'type' => 'switchbox',
'title' => get_string('moderatecomments', 'artefact.comment'),
'defaultvalue' => $r->approvecomments,
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment