Commit e5623f0a authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Fixing links/forms/layout for some more pages (Bug #1397128)



Change-Id: I85c961e145128ed7761dcd021b060b309a202bce
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 8d3d754f
......@@ -94,7 +94,12 @@ span.response {
}
.heading {
line-height: 1.25em;
text-align: left;
font-size: 1.167em;
white-space: nowrap;
color: #42637b;
padding: 3px 5px;
font-weight: bold;
border-bottom: 1px solid #CCCCCC;
}
......@@ -219,36 +219,36 @@ function webservices_master_switch_form() {
// enable/disable webservices completely
$enabled = (get_config('webservice_enabled') || 0);
$elements =
array(
'funnylittleform' =>
array(
'type' => 'html',
'value' =>
pieform(
array(
'name' => 'activate_webservices',
'elementclasses' => false,
'successcallback' => 'activate_webservices_submit',
'renderer' => 'div',
'jsform' => false,
'elements' => array(
'plugintype' => array('type' => 'hidden', 'value' => 'auth'),
'type' => array('type' => 'hidden', 'value' => 'webservice'),
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'enabled' => array('type' => 'switchbox',
'value' => $enabled,
'on_callback' => 'switchbox_submit',
'off_callback' => 'switchbox_submit',
'on_label' => get_string('enabled'),
'off_label' => get_string('disabled'),
'wrapperclass' => 'switch-wrapper-inline',
'labelhtml' => get_string('control_webservices', 'auth.webservice'),
),
),
)
),
array(
'webservicesmasterswitchform' =>
array(
'type' => 'html',
'value' =>
pieform(
array(
'name' => 'activate_webservices',
'elementclasses' => false,
'successcallback' => 'activate_webservices_submit',
'renderer' => 'div',
'jsform' => false,
'elements' => array(
'plugintype' => array('type' => 'hidden', 'value' => 'auth'),
'type' => array('type' => 'hidden', 'value' => 'webservice'),
'pluginname' => array('type' => 'hidden', 'value' => 'webservice'),
'enabled' => array('type' => 'switchbox',
'value' => $enabled,
'on_callback' => 'switchbox_submit',
'off_callback' => 'switchbox_submit',
'on_label' => get_string('enabled'),
'off_label' => get_string('disabled'),
'wrapperclass' => 'switch-wrapper-inline',
'labelhtml' => get_string('control_webservices', 'auth.webservice'),
),
),
);
)
),
),
);
return $elements;
}
......@@ -313,37 +313,32 @@ function service_fg_edit_form() {
'elements' => array(
'servicegroup' => array(
'title' => ' ',
'class' => 'header',
'class' => 'heading',
'type' => 'html',
'value' => get_string('service', 'auth.webservice'),
),
'component' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('component', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled'),
),
'restricted' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('restrictedusers', 'auth.webservice'),
),
'tokenusers' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('fortokenusers', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
......@@ -479,43 +474,37 @@ function service_tokens_edit_form() {
'elements' => array(
'token' => array(
'title' => ' ',
'class' => 'header',
'class' => 'heading',
'type' => 'html',
'value' => get_string('token', 'auth.webservice'),
),
'institution' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('institution'),
),
'username' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('username', 'auth.webservice'),
),
'servicename' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('servicename', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled'),
),
'wssigenc' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('titlewssigenc', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
......@@ -684,37 +673,32 @@ function service_users_edit_form() {
'elements' => array(
'username' => array(
'title' => ' ',
'class' => 'header',
'class' => 'heading',
'type' => 'html',
'value' => get_string('username', 'auth.webservice'),
),
'institution' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('institution'),
),
'servicename' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('servicename', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled'),
),
'wssigenc' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('titlewssigenc', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
......@@ -874,7 +858,6 @@ function get_config_options_extended() {
$protosform = array(
'name' => 'activate_webservice_protos',
'renderer' => 'multicolumntable',
'elements' => webservices_protocol_switch_form(),
);
$protos = new Pieform($protosform);
......
......@@ -44,10 +44,6 @@ else {
$form = webservice_server_list_form($sopts, $iopts);
}
function webservices_add_application_validate(Pieform $form, $values) {
global $SESSION;
}
function webservices_add_application_submit(Pieform $form, $values) {
global $SESSION, $USER;
......@@ -104,7 +100,6 @@ function webservice_oauth_server_submit(Pieform $form, $values) {
global $USER, $SESSION;
$store = OAuthStore::instance();
$is_admin = ($USER->get('admin') ||defined('ADMIN') || defined('INSTITUTIONALADMIN') || $USER->is_institutional_admin() ? true : false);
$dbserver = get_record('oauth_server_registry', 'id', $values['id']);
if ($dbserver) {
......@@ -135,7 +130,8 @@ function webservice_oauth_server_submit(Pieform $form, $values) {
redirect('/webservice/admin/oauthv1sregister.php');
}
$form = pieform($form);
$pieform = new Pieform($form);
$form = $pieform->build(false);
$smarty = smarty(array(), array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/webservice.css', false, 'auth/webservice') . '">',));
safe_require('auth', 'webservice');
......@@ -153,8 +149,8 @@ function webservice_server_edit_form($dbserver, $sopts, $iopts) {
array(
'name' => 'webservice_oauth_server',
'successcallback' => 'webservice_oauth_server_submit',
'jsform' => true,
'renderer' => 'multicolumntable',
'jsform' => false,
'renderer' => 'table',
'elements' => array(
'id' => array(
'type' => 'hidden',
......@@ -262,7 +258,7 @@ function webservice_server_edit_form($dbserver, $sopts, $iopts) {
'type' => 'div',
'id' => 'maintable',
'name' => 'tokenconfig',
'jsform' => true,
'jsform' => false,
'successcallback' => 'webservice_server_edit_submit',
'elements' => $elements,
);
......@@ -306,43 +302,37 @@ function webservice_server_list_form($sopts, $iopts) {
'elements' => array(
'application' => array(
'title' => ' ',
'class' => 'header',
'class' => 'heading',
'type' => 'html',
'value' => get_string('application', 'auth.webservice'),
),
'username' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('owner', 'auth.webservice'),
),
'consumer_key' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('consumer_key', 'auth.webservice'),
),
'consumer_secret' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('consumer_secret', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled'),
),
'calback_uri' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('callback', 'auth.webservice'),
),
'consumer_secret' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('consumer_secret', 'auth.webservice'),
),
......@@ -377,9 +367,9 @@ function webservice_server_list_form($sopts, $iopts) {
'key' => $consumer->consumer_key,
);
$form['elements']['id' . $consumer->id . '_enabled'] = array(
'defaultvalue' => (($consumer->enabled == 1) ? 'checked' : ''),
'type' => 'checkbox',
'disabled' => true,
'value' => (($consumer->enabled == 1) ? display_icon('enabled') : display_icon('disabled')),
'type' => 'html',
'class' => 'center',
'key' => $consumer->consumer_key,
);
$form['elements']['id' . $consumer->id . '_calback_uri'] = array(
......@@ -390,97 +380,99 @@ function webservice_server_list_form($sopts, $iopts) {
// edit and delete buttons
$form['elements']['id' . $consumer->id . '_actions'] = array(
'value' => '<span class="actions inline">' .
pieform(array(
'name' => 'webservices_server_edit_' . $consumer->id,
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_server_submit',
'class' => 'oneline inline',
'jsform' => true,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $consumer->id),
'action' => array('type' => 'hidden', 'value' => 'edit'),
'submit' => array(
'type' => 'submit',
'value' => get_string('edit')
),
),
))
.
pieform(array(
'name' => 'webservices_server_delete_' . $consumer->id,
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_server_submit',
'class' => 'oneline inline',
'jsform' => true,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $consumer->id),
'action' => array('type' => 'hidden', 'value' => 'delete'),
'submit' => array(
'type' => 'submit',
'value' => get_string('delete')
),
),
)) . '</span>'
,
'type' => 'html',
'key' => $consumer->consumer_key,
'class' => 'actions',
'value' => '<span class="actions inline">' .
pieform(array(
'name' => 'webservices_server_edit_' . $consumer->id,
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_server_submit',
'jsform' => false,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $consumer->id),
'action' => array('type' => 'hidden', 'value' => 'edit'),
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_edit.png'),
'alt' => get_string('editspecific', 'mahara', $consumer->id),
'elementtitle' => get_string('edit'),
),
),
))
.
pieform(array(
'name' => 'webservices_server_delete_' . $consumer->id,
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_server_submit',
'jsform' => false,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $consumer->id),
'action' => array('type' => 'hidden', 'value' => 'delete'),
'submit' => array(
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'alt' => get_string('deletespecific', 'mahara', $consumer->id),
'elementtitle' => get_string('delete'),
),
),
)) . '</span>',
'type' => 'html',
'key' => $consumer->consumer_key,
'class' => 'webserviceconfigcontrols',
);
}
$form = pieform($form);
$pieform = new Pieform($form);
$form = $pieform->build(false);
}
$form = '<tr><td colspan="2">' .
$form . '</td></tr><tr><td colspan="2">' .
pieform(array(
'name' => 'webservices_token_generate',
'renderer' => 'div',
'validatecallback' => 'webservices_add_application_validate',
'successcallback' => 'webservices_add_application_submit',
'class' => 'oneline inline',
'jsform' => false,
'action' => get_config('wwwroot') . 'webservice/admin/oauthv1sregister.php',
'elements' => array(
'application' => array(
'type' => 'text',
'title' => get_string('application', 'auth.webservice'),
),
'institution' => array(
'type' => 'select',
'options' => $iopts,
),
'service' => array(
'type' => 'select',
'options' => $sopts,
),
'action' => array('type' => 'hidden', 'value' => 'add'),
'submit' => array(
'type' => 'submit',
'value' => get_string('add', 'auth.webservice'),
),
),
)) .
'</td></tr>';
$form . '</td></tr><tr><td colspan="2">' .
pieform(array(
'name' => 'webservices_token_generate',
'renderer' => 'div',
'validatecallback' => 'webservices_add_application_validate',
'successcallback' => 'webservices_add_application_submit',
'class' => 'oneline inline',
'jsform' => false,
'action' => get_config('wwwroot') . 'webservice/admin/oauthv1sregister.php',
'elements' => array(
'application' => array(
'type' => 'text',
'title' => get_string('application', 'auth.webservice') . ': ',
),
'institution' => array(
'type' => 'select',
'options' => $iopts,
),
'service' => array(
'type' => 'select',
'options' => $sopts,
),
'action' => array('type' => 'hidden', 'value' => 'add'),
'submit' => array(
'type' => 'submit',
'value' => get_string('add', 'auth.webservice'),
),
),
)) .
'</td></tr>';
$elements = array(
// fieldset for managing service function list
'register_server' => array(
'type' => 'fieldset',
'legend' => get_string('userapplications', 'auth.webservice'),
'elements' => array(
'sflist' => array(
'type' => 'html',
'value' => $form,
)
),
'collapsible' => false,
),
);
// fieldset for managing service function list
'register_server' => array(
'type' => 'fieldset',
'legend' => get_string('userapplications', 'auth.webservice'),
'elements' => array(
'sflist' => array(
'type' => 'html',
'value' => $form,
)
),
'collapsible' => false,
),
);
$form = array(
'renderer' => 'table',
......
......@@ -61,37 +61,32 @@ if (!empty($dbservices)) {
'elements' => array(
'service_name' => array(
'title' => ' ',
'class' => 'header',
'class' => 'heading',
'type' => 'html',
'value' => get_string('serviceaccess', 'auth.webservice'),
),
'enabled' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('enabled'),
),
'token' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('token', 'auth.webservice'),
),
'functions' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('functions', 'auth.webservice'),
),
'last_access' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('last_access', 'auth.webservice'),
),
'expires' => array(
'title' => ' ',
'class' => 'header',
'type' => 'html',
'value' => get_string('expires', 'auth.webservice'),
),
......@@ -106,9 +101,9 @@ if (!empty($dbservices)) {
);
// is the service group enabled
$userform['elements']['id' . $service->id . '_enabled'] = array(
'defaultvalue' => (($service->enabled == 1) ? 'checked' : ''),
'type' => 'checkbox',
'disabled' => true,
'value' => (($service->enabled == 1) ? display_icon('enabled') : display_icon('disabled')),
'type' => 'html',
'class' => 'center',
'key' => $service->id,
);
// token for the service if it exists
......@@ -146,22 +141,20 @@ if (!empty($dbservices)) {
// generate button
// delete button
$userform['elements']['id' . $service->id . '_actions'] = array(
'value' => '<span class="actions inline">' .
pieform(array(
'value' => pieform(array(
'name' => 'webservices_user_token_generate_' . $service->id,
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_user_token_submit',
'class' => 'oneline inline',
'jsform' => false,
'action' => get_config('wwwroot') . 'webservice/admin/index.php',
'elements' => array(
'service' => array('type' => 'hidden', 'value' => $service->id),
'action' => array('type' => 'hidden', 'value' => 'generate'),
'submit' => array(
'type' => 'submit',
'class' => 'linkbtn inline',
'value' => get_string('gen', 'auth.webservice')
'type' => 'image',
'src' => $THEME->get_url('images/btn_configure.png'),
'alt' => get_string('gen', 'auth.webservice'),
'elementtitle' => get_string('gen', 'auth.webservice')
),
),
))
......@@ -172,25 +165,26 @@ if (!empty($dbservices)) {
'renderer' => 'div',
'elementclasses' => false,
'successcallback' => 'webservices_user_token_submit',
'class' => 'oneline inline',
'jsform' => true,
'jsform' => false,
'elements' => array(
'service' => array('type' => 'hidden', 'value' => $service->id),
'action' => array('type' => 'hidden', 'value' => 'delete'),
'submit' => array(
'type' => 'submit',
'class' => 'linkbtn inline',
'value' => get_string('delete')
'type' => 'image',
'src' => $THEME->get_url('images/btn_deleteremove.png'),
'alt' => get_string('deletespecific', 'mahara', $service->id),
'elementtitle' => get_string('delete'),
),
),
))) . '</span>'
)))
,