Commit 0fd79894 authored by Robert Lyon's avatar Robert Lyon Committed by Yuliya Bozhko
Browse files

Updating the config edit pages to use new menu structure (Bug #1396435)



For serviceconfig.php, tokenconfig.php, and userconfig.php

Got missed from earlier tidy menu patch.

Also needed to make the edit/delete forms not be jsforms as they
didn't work right

Change-Id: I110813d9460fbd199a10291c24fb4e5ece4fc4c9
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
Signed-off-by: default avatarYuliya <yuliya.bozhko@gmail.com>
parent 9b605ebe
......@@ -588,7 +588,7 @@ function service_tokens_edit_form() {
'elementclasses' => false,
'successcallback' => 'webservices_token_submit',
'class' => 'oneline inline',
'jsform' => true,
'jsform' => false,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $token->tokenid),
'action' => array('type' => 'hidden', 'value' => 'edit'),
......@@ -607,7 +607,7 @@ function service_tokens_edit_form() {
'elementclasses' => false,
'successcallback' => 'webservices_token_submit',
'class' => 'oneline inline',
'jsform' => true,
'jsform' => false,
'elements' => array(
'token' => array('type' => 'hidden', 'value' => $token->tokenid),
'action' => array('type' => 'hidden', 'value' => 'delete'),
......@@ -782,7 +782,7 @@ function service_users_edit_form() {
'elementclasses' => false,
'successcallback' => 'webservices_user_submit',
'class' => 'oneline inline',
'jsform' => true,
'jsform' => false,
'elements' => array(
'suid' => array('type' => 'hidden', 'value' => $user->id),
'action' => array('type' => 'hidden', 'value' => 'edit'),
......@@ -801,7 +801,7 @@ function service_users_edit_form() {
'elementclasses' => false,
'successcallback' => 'webservices_user_submit',
'class' => 'oneline inline',
'jsform' => true,
'jsform' => false,
'elements' => array(
'suid' => array('type' => 'hidden', 'value' => $user->id),
'action' => array('type' => 'hidden', 'value' => 'delete'),
......
......@@ -403,7 +403,6 @@ function webservice_server_list_form($sopts, $iopts) {
'action' => array('type' => 'hidden', 'value' => 'edit'),
'submit' => array(
'type' => 'submit',
'class' => 'linkbtn inline',
'value' => get_string('edit')
),
),
......@@ -421,7 +420,6 @@ function webservice_server_list_form($sopts, $iopts) {
'action' => array('type' => 'hidden', 'value' => 'delete'),
'submit' => array(
'type' => 'submit',
'class' => 'linkbtn inline',
'value' => get_string('delete')
),
),
......@@ -463,7 +461,6 @@ function webservice_server_list_form($sopts, $iopts) {
'action' => array('type' => 'hidden', 'value' => 'add'),
'submit' => array(
'type' => 'submit',
'class' => 'linkbtn',
'value' => get_string('add', 'auth.webservice'),
),
),
......
......@@ -11,7 +11,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/pluginadminwebservices');
define('MENUITEM', 'configextensions/webservices');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
......@@ -20,7 +20,7 @@ $service = param_integer('service', 0);
$dbservice = get_record('external_services', 'id', $service);
if (empty($dbservice)) {
$SESSION->add_error_msg(get_string('invalidservice', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_function_groups');
}
$enabled = $dbservice->enabled;
$restrictedusers = ($dbservice->restrictedusers <= 0 ? 0 : 1);
......@@ -82,7 +82,7 @@ foreach ($dbfunctions as $function) {
$functions['elements']['submit'] = array(
'type' => 'submitcancel',
'value' => array(get_string('save'), get_string('back')),
'goto' => get_config('wwwroot') . 'webservice/admin/index.php',
'goto' => get_config('wwwroot') . 'webservice/admin/index.php?open=webservices_function_groups',
);
$elements = array(
......@@ -205,7 +205,8 @@ $form['successcallback'] = 'serviceconfig_submit';
$form = pieform($form);
$smarty = smarty(array(), array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/webservice.css', false, 'auth/webservice') . '">',));
safe_require('auth', 'webservice');
PluginAuthWebservice::menu_items($smarty, 'webservice');
$webservice_menu = PluginAuthWebservice::menu_items(MENUITEM);
$smarty->assign('TERTIARYMENU', $webservice_menu);
$smarty->assign('servicename', $dbservice->name);
$smarty->assign('form', $form);
$smarty->assign('PAGEHEADING', $heading);
......
......@@ -11,8 +11,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/pluginadminwebservices');
define('SECTION_PAGE', 'webservice');
define('MENUITEM', 'configextensions/webservices');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
......@@ -21,13 +20,13 @@ require_once(get_config('docroot') . 'api/xmlrpc/lib.php');
$token = param_variable('token', 0);
// lookup user cancelled
if ($token == 'add') {
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_token');
}
$dbtoken = get_record('external_tokens', 'id', $token);
if (empty($dbtoken)) {
$SESSION->add_error_msg(get_string('invalidtoken', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_token');
}
$dbuser = get_record('usr', 'id', $dbtoken->userid);
......@@ -146,7 +145,7 @@ $token_details['elements']['publickeyexpires']= array(
$token_details['elements']['submit'] = array(
'type' => 'submitcancel',
'value' => array(get_string('save'), get_string('back')),
'goto' => get_config('wwwroot') . 'webservice/admin/index.php',
'goto' => get_config('wwwroot') . 'webservice/admin/index.php?open=webservices_token',
);
$elements = array(
......@@ -180,7 +179,8 @@ $form = pieform($form);
$smarty = smarty(array(), array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/webservice.css', false, 'auth/webservice') . '">',));
safe_require('auth', 'webservice');
PluginAuthWebservice::menu_items($smarty, 'webservice');
$webservice_menu = PluginAuthWebservice::menu_items(MENUITEM);
$smarty->assign('TERTIARYMENU', $webservice_menu);
$smarty->assign('token', $dbtoken->token);
$smarty->assign('form', $form);
$heading = get_string('tokens', 'auth.webservice');
......@@ -192,7 +192,7 @@ function allocate_webservice_tokens_submit(Pieform $form, $values) {
$dbtoken = get_record('external_tokens', 'id', $values['tokenid']);
if (empty($dbtoken)) {
$SESSION->add_error_msg(get_string('invalidtoken', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_token');
return;
}
......@@ -250,7 +250,7 @@ function allocate_webservice_tokens_validate(PieForm $form, $values) {
$dbtoken = get_record('external_tokens', 'id', $values['tokenid']);
if (empty($dbtoken)) {
$SESSION->add_error_msg(get_string('invalidtoken', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_token');
return;
}
return true;
......
......@@ -11,8 +11,7 @@
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configextensions/pluginadminwebservices');
define('SECTION_PAGE', 'webservice');
define('MENUITEM', 'configextensions/webservices');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
......@@ -20,13 +19,13 @@ require_once('pieforms/pieform.php');
$suid = param_variable('suid', '');
// lookup user cancelled
if ($suid == 'add') {
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_user');
}
$dbserviceuser = get_record('external_services_users', 'id', $suid);
if (empty($dbserviceuser)) {
$SESSION->add_error_msg(get_string('invalidserviceuser', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_user');
}
$services = get_records_array('external_services', 'restrictedusers', 1);
......@@ -154,7 +153,7 @@ $serviceuser_details['elements']['publickeyexpires']= array(
$serviceuser_details['elements']['submit'] = array(
'type' => 'submitcancel',
'value' => array(get_string('save'), get_string('back')),
'goto' => get_config('wwwroot') . 'webservice/admin/index.php',
'goto' => get_config('wwwroot') . 'webservice/admin/index.php?open=webservices_user',
);
$elements = array(
......@@ -188,7 +187,8 @@ $form = pieform($form);
$smarty = smarty(array(), array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/webservice.css', false, 'auth/webservice') . '">',));
safe_require('auth', 'webservice');
PluginAuthWebservice::menu_items($smarty, 'webservice');
$webservice_menu = PluginAuthWebservice::menu_items(MENUITEM);
$smarty->assign('TERTIARYMENU', $webservice_menu);
$smarty->assign('suid', $dbserviceuser->id);
$smarty->assign('form', $form);
$heading = get_string('users', 'auth.webservice');
......@@ -200,7 +200,7 @@ function allocate_webservice_users_submit(Pieform $form, $values) {
$dbserviceuser = get_record('external_services_users', 'id', $values['suid']);
if (empty($dbserviceuser)) {
$SESSION->add_error_msg(get_string('invalidserviceuser', 'auth.webservice'));
redirect('/webservice/admin/index.php');
redirect('/webservice/admin/index.php?open=webservices_user');
return;
}
......
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