Commit 8100eb08 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Adjustments for the webservices index page (Bug #1396434)

- Changing the readonly checkboxes to be icon images
- adding a sitewide function display_icon() to render the ticks/crosses
- added a list of generic states to the mahara lang file
- tidied up the varying uses of enabled/disabled to use the generic ones

Change-Id: I009c6d54f0033dd46391c61387c84575536dcd4b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 34226901
......@@ -52,8 +52,6 @@ $string['youmaynotregisterwithouttandc'] = 'You may not register unless you agre
// core webservices strings start here
$string['control_webservices'] = 'Switch ALL WebServices on or off: ';
$string['enabled'] = 'enabled';
$string['disabled'] = 'disabled';
$string['masterswitch'] = 'WebServices master switch';
$string['formatdate'] = '';
$string['protocolswitches'] = 'Switch On/Off Protocols';
......
......@@ -35,10 +35,6 @@ $string['friendsdescr'] = 'Friends control';
$string['updatedfriendcontrolsetting'] = 'Updated friends control';
$string['wysiwygdescr'] = 'HTML editor';
$string['on'] = 'On';
$string['off'] = 'Off';
$string['disabled'] = 'Disabled';
$string['enabled'] = 'Enabled';
$string['licensedefault'] = 'Default license';
$string['licensedefaultdescription'] = 'The default license for your content.';
......
......@@ -57,6 +57,15 @@ $string['imagexofy'] = 'Image {x} of {y}';
$string['clickformore'] = '(Press \'enter\' to display more information)';
$string['goto'] = 'Go to \'%s\'';
$string['gotomore'] = 'Read more...';
// generic switch state strings.
$string['on'] = 'On';
$string['off'] = 'Off';
$string['yes'] = 'Yes';
$string['no'] = 'No';
$string['true'] = 'True';
$string['false'] = 'False';
$string['enabled'] = 'Enabled';
$string['disabled'] = 'Disabled';
// Objectionable strings.
$string['complaint'] = 'Complaint';
$string['notifyadministrator'] = 'Notify administrator';
......@@ -68,12 +77,9 @@ $string['reportsent'] = 'Your report has been sent.';
$string['tabs'] = 'Tabs';
$string['tab'] = 'tab';
$string['selected'] = 'selected';
$string['disabled'] = 'disabled';
$string['admin'] = 'Admin';
$string['menu'] = 'Menu';
$string['no'] = 'No';
$string['yes'] = 'Yes';
$string['at'] = 'at';
$string['From'] = 'From';
$string['To'] = 'To';
......
......@@ -4298,3 +4298,39 @@ function can_use_skins($userid = null, $managesiteskin=false, $issiteview=false)
}
return false;
}
/**
* Display image icon based on name
*
* @param string $type Type of icon image to show
* @param string $id Optional id to add to the image
*
* @return string An <img> tag of the icon we want
*/
function display_icon($type, $id = false) {
global $THEME;
switch ($type) {
case 'on':
case 'yes':
case 'success':
case 'true':
case 'enabled':
$image = 'success.png';
break;
case 'off':
case 'no':
case 'fail':
case 'false':
case 'disabled':
$image = 'fail.png';
break;
}
$imageurl = $THEME->get_url('images/' . $image);
$html = '<img src="' . $imageurl . '" class="displayicon" alt="' . get_string($type) . '"';
if ($id) {
$html .= ' id="' . $id . '"';
}
$html .= '>';
return $html;
}
{foreach from=$form.elements item=element}
<div class="pseudofieldset collapsible collapsed">
<span class="pseudolegend"><h4><a href="">{$element.legend}</a></h4></span>
<span class="pseudolegend"><h4 id="{$element.name}_pseudofieldset"><a href="">{$element.legend}</a></h4></span>
{foreach from=$element.elements item=item}
{$item.value|safe}
{/foreach}
......@@ -21,7 +21,13 @@ jQuery(function() {
}
e.preventDefault();
});
// Keep open current section after save/reload of page.
// Will reopen only the fieldset that had a form saved within it
var opened = '{$opened}';
if (opened !== '') {
jQuery('#' + opened + '_pseudofieldset').closest('div.pseudofieldset').removeClass('collapsed');
}
});
});
</script>
\ No newline at end of file
</script>
This diff is collapsed.
......@@ -216,7 +216,7 @@ function webservice_server_edit_form($dbserver, $sopts, $iopts) {
);
$server_details['elements']['enabled'] = array(
'title' => get_string('enabled', 'auth.webservice'),
'title' => get_string('enabled'),
'defaultvalue' => (($dbserver->enabled == 1) ? 'checked' : ''),
'type' => 'checkbox',
'disabled' => true,
......@@ -332,7 +332,7 @@ function webservice_server_list_form($sopts, $iopts) {
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled', 'auth.webservice'),
'value' => get_string('enabled'),
),
'calback_uri' => array(
'title' => ' ',
......
......@@ -38,7 +38,7 @@ $functions =
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled', 'auth.webservice'),
'value' => get_string('enabled'),
),
'classname' => array(
'title' => ' ',
......@@ -113,7 +113,7 @@ $elements = array(
'class' => 'linkbtn',
'value' => $enabled ? get_string('disable') : get_string('enable')
),
'state' => array('type' => 'html', 'value' => '[' . ($enabled ? get_string('enabled', 'auth.webservice') : get_string('disabled', 'auth.webservice')) . ']',),
'state' => array('type' => 'html', 'value' => '[' . ($enabled ? get_string('enabled') : get_string('disabled')) . ']',),
),
)
),
......@@ -165,7 +165,7 @@ $elements = array(
'class' => 'linkbtn',
'value' => $tokenusers ? get_string('disable') : get_string('enable')
),
'state' => array('type' => 'html', 'value' => '[' . ($tokenusers ? get_string('enabled', 'auth.webservice') : get_string('disabled', 'auth.webservice')) . ']',),
'state' => array('type' => 'html', 'value' => '[' . ($tokenusers ? get_string('enabled') : get_string('disabled')) . ']',),
),
)
),
......
......@@ -95,7 +95,7 @@ $token_details['elements']['service'] = array(
);
$token_details['elements']['enabled'] = array(
'title' => get_string('enabled', 'auth.webservice'),
'title' => get_string('enabled'),
'defaultvalue' => (($dbservice->enabled == 1) ? 'checked' : ''),
'type' => 'checkbox',
'disabled' => true,
......
......@@ -111,7 +111,7 @@ $serviceuser_details['elements']['service'] = array(
);
$serviceuser_details['elements']['enabled'] = array(
'title' => get_string('enabled', 'auth.webservice'),
'title' => get_string('enabled'),
'defaultvalue' => (($serviceenabled == 1) ? 'checked' : ''),
'type' => 'checkbox',
'disabled' => true,
......
......@@ -68,7 +68,7 @@ if (!empty($dbservices)) {
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled', 'auth.webservice'),
'value' => get_string('enabled'),
),
'token' => array(
'title' => ' ',
......
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