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

Adjusting the webservice protocols to use the switchbox (Bug #1396430)

Change-Id: Ief2496eefd3f827a84c49e39580aad630ead5ecc
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 901df0a5
...@@ -93,13 +93,8 @@ span.response { ...@@ -93,13 +93,8 @@ span.response {
margin-right: 3px; margin-right: 3px;
} }
.header { .heading {
border-bottom: 1px solid #ccc;
font-size: 1.167em; font-size: 1.167em;
color: #42637b; color: #42637b;
line-height: 1.25em;
padding: 3px 5px;
text-align: left;
vertical-align: bottom;
font-weight: bold; font-weight: bold;
} }
\ No newline at end of file
...@@ -229,22 +229,21 @@ function webservices_master_switch_form() { ...@@ -229,22 +229,21 @@ function webservices_master_switch_form() {
'name' => 'activate_webservices', 'name' => 'activate_webservices',
'elementclasses' => false, 'elementclasses' => false,
'successcallback' => 'activate_webservices_submit', 'successcallback' => 'activate_webservices_submit',
'class' => 'oneline inline',
'renderer' => 'div', 'renderer' => 'div',
'jsform' => false, 'jsform' => false,
'elements' => array( 'elements' => array(
'label' => array('type' => 'html', 'value' => get_string('control_webservices', 'auth.webservice'),),
'plugintype' => array('type' => 'hidden', 'value' => 'auth'), 'plugintype' => array('type' => 'hidden', 'value' => 'auth'),
'type' => array('type' => 'hidden', 'value' => 'webservice'), 'type' => array('type' => 'hidden', 'value' => 'webservice'),
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'), 'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'enabled' => array('type' => 'hidden', 'value' => $enabled), 'enabled' => array('type' => 'switchbox',
'enable' => array('type' => 'hidden', 'value' => $enabled-1), 'value' => $enabled,
'submit' => array( 'on_callback' => 'switchbox_submit',
'type' => 'submit', 'off_callback' => 'switchbox_submit',
'class' => 'linkbtn', 'on_label' => get_string('enabled'),
'value' => $enabled ? get_string('disable') : get_string('enable') 'off_label' => get_string('disabled'),
), 'wrapperclass' => 'switch-wrapper-inline',
'state' => array('type' => 'html', 'value' => '[' . ($enabled ? get_string('enabled') : get_string('disabled')) . ']',), 'labelhtml' => get_string('control_webservices', 'auth.webservice'),
),
), ),
) )
), ),
...@@ -262,35 +261,35 @@ function webservices_master_switch_form() { ...@@ -262,35 +261,35 @@ function webservices_master_switch_form() {
function webservices_protocol_switch_form() { function webservices_protocol_switch_form() {
// enable/disable separate protocols of SOAP/XML-RPC/REST // enable/disable separate protocols of SOAP/XML-RPC/REST
$elements = array(); $elements = array();
$elements['label'] = array('title' => ' ', 'class' => 'header', 'type' => 'html', 'value' => get_string('protocol', 'auth.webservice'),); $elements['label'] = array('title' => ' ', 'type' => 'html', 'value' => '<span class="heading">' . get_string('protocol', 'auth.webservice') . '</span>');
foreach (array('soap', 'xmlrpc', 'rest', 'oauth') as $proto) { foreach (array('soap', 'xmlrpc', 'rest', 'oauth') as $proto) {
$enabled = (get_config('webservice_' . $proto . '_enabled') || 0); $enabled = (get_config('webservice_' . $proto . '_enabled') || 0);
$elements[$proto] = array( $elements[$proto] = array(
'class' => 'header',
'title' => ' ', 'title' => ' ',
'type' => 'html', 'type' => 'html',
'value' => 'value' =>
pieform(array( pieform(array(
'name' => 'activate_webservice_protos_' . $proto, 'name' => 'activate_webservice_protos_' . $proto,
'renderer' => 'oneline',
'elementclasses' => false, 'elementclasses' => false,
'renderer' => 'div',
'successcallback' => 'activate_webservice_proto_submit', 'successcallback' => 'activate_webservice_proto_submit',
'class' => 'oneline inline',
'jsform' => false, 'jsform' => false,
'elements' => array( 'elements' => array(
'label' => array('type' => 'html', 'value' => get_string($proto, 'auth.webservice'),),
'plugintype' => array('type' => 'hidden', 'value' => 'auth'), 'plugintype' => array('type' => 'hidden', 'value' => 'auth'),
'type' => array('type' => 'hidden', 'value' => 'webservice'), 'type' => array('type' => 'hidden', 'value' => 'webservice'),
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'), 'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'protocol' => array('type' => 'hidden', 'value' => $proto), 'protocol' => array('type' => 'hidden', 'value' => $proto),
'enabled' => array('type' => 'hidden', 'value' => $enabled), 'enabled' => array('type' => 'switchbox',
'submit' => array( 'value' => $enabled,
'type' => 'submit', 'on_callback' => 'switchbox_submit',
'class' => 'linkbtn', 'off_callback' => 'switchbox_submit',
'value' => $enabled ? get_string('disable') : get_string('enable') 'on_label' => get_string('enabled'),
), 'off_label' => get_string('disabled'),
'state' => array('type' => 'html', 'value' => '[' . ($enabled ? get_string('enabled') : get_string('disabled')) . ']',), 'wrapperclass' => 'switch-wrapper-inline',
'labelhtml' => get_string($proto, 'auth.webservice') . ': ',
),
), ),
))); )));
} }
......
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