Skip to content

Commit

Permalink
MDL-17135 moving all webservice and external API related admin UI to …
Browse files Browse the repository at this point in the history
…new directory, I did not expect there would be so many files, sorry for the trouble
  • Loading branch information
skodak committed Oct 21, 2009
1 parent 86c252b commit 72977b3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 34 deletions.
6 changes: 3 additions & 3 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@
$temp = new admin_settingpage('externalservices', get_string('externalservices', 'webservice'));
$temp->add(new admin_setting_manageexternalservices());
$ADMIN->add('webservicesettings', $temp);
$ADMIN->add('webservicesettings', new admin_externalpage('externalservice', get_string('externalservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', get_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_functions.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', get_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_users.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalservice', get_string('externalservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', get_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php", 'moodle/site:config', true));
$ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', get_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_users.php", 'moodle/site:config', true));
$temp = new admin_settingpage('webserviceprotocols', get_string('manageprotocols', 'webservice'));
$temp->add(new admin_setting_managewebserviceprotocols());
if (empty($CFG->enablewebservices)) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion admin/webservice/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function find_users($search) {
protected function get_options() {
global $CFG;
$options = parent::get_options();
$options['file'] = '/admin/webservice/lib.php'; //need to be set, otherwise
$options['file'] = $CFG->admin.'/webservice/lib.php'; //need to be set, otherwise
// the /user/selector/search.php
//will fail to find this user_selector class
$options['serviceid'] = $this->serviceid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');

$PAGE->set_url('admin/webservice_protocols.php', array());
$PAGE->set_url('/admin/webservice/protocols.php', array());
//TODO: disable the blocks here or better make the page layout default to no blocks!

require_login();
Expand Down
2 changes: 1 addition & 1 deletion admin/webservice/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/* This function disable the valid until field of a user into external_service_users.php*/
/* This function disable the valid until field of a user into service_users.php*/
function disablevaliduntil(event, userid) {
var disabled;
if (document.getElementById('enablevaliduntil'+userid).checked)
Expand Down
8 changes: 4 additions & 4 deletions admin/external_service.php → admin/webservice/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once('external_forms.php');
require_once('forms.php');

$id = required_param('id', PARAM_INT);
$action = optional_param('action', '', PARAM_ACTION);
Expand All @@ -48,8 +48,8 @@
admin_externalpage_print_header();
$optionsyes = array('id'=>$id, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey());
$optionsno = array('section'=>'externalservices');
$formcontinue = html_form::make_button('external_service.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button('settings.php', $optionsno, get_string('cancel'), 'get');
$formcontinue = html_form::make_button('service.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button("$CFG->wwwroot/$CFG->admin/settings.php", $optionsno, get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('deleteserviceconfirm', 'webservice', $service->name), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');

$id = required_param('id', PARAM_INT);
$fid = optional_param('fid', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ACTION);
$confirm = optional_param('confirm', 0, PARAM_BOOL);

$PAGE->set_url('admin/external_service_functions.php', array('id'=>$id));
$PAGE->set_url('admin/websevice/service_functions.php', array('id'=>$id));

admin_externalpage_setup('externalservicefunctions');

$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=externalservices";
$thisurl = "external_service_functions.php?id=$id";
$thisurl = "service_functions.php?id=$id";

$service = $DB->get_record('external_services', array('id'=>$id), '*', MUST_EXIST);

Expand All @@ -46,8 +46,8 @@
admin_externalpage_print_header();
$optionsyes = array('id'=>$id, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey(), 'fid'=>$function->id);
$optionsno = array('id'=>$id);
$formcontinue = html_form::make_button('external_service_functions.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button('external_service_functions.php', $optionsno, get_string('cancel'), 'get');
$formcontinue = html_form::make_button('service_functions.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button('service_functions.php', $optionsno, get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('removefunctionconfirm', 'webservice', (object)array('service'=>$service->name, 'function'=>$function->name)), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down Expand Up @@ -94,7 +94,7 @@

// Javascript for the function search/selection fields
$PAGE->requires->yui_lib('event');
$PAGE->requires->js('admin/webservice/script.js');
$PAGE->requires->js($CFG->admin.'/webservice/script.js');
$PAGE->requires->js_function_call('capability_service.cap_filter_init', array(get_string('search'))); //TODO generalize javascript

admin_externalpage_print_header();
Expand All @@ -105,7 +105,7 @@
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter centerpara');
//the service form
$form = new html_form();
$form->url = new moodle_url('/admin/external_service_functions.php', array('id' => $id, 'action' => 'add', 'save' => 1)); // Required
$form->url = new moodle_url('service_functions.php', array('id' => $id, 'action' => 'add', 'save' => 1)); // Required
$form->button = new html_button();
$form->button->id = 'settingssubmit';
$form->button->text = get_string('addfunction', 'webservice'); // Required
Expand Down Expand Up @@ -161,7 +161,7 @@
$table->align[] = 'center';
}

$durl = "$CFG->wwwroot/$CFG->admin/external_service_functions.php?sesskey=".sesskey();
$durl = "service_functions.php?sesskey=".sesskey();

foreach ($functions as $function) {
//TODO: manage when the description is into a module/plugin lang file
Expand All @@ -180,15 +180,15 @@
// we can edit only custom functions, the build-in would be overridden after each upgrade
if (empty($service->component)) {
$form = new html_form();
$form->url = new moodle_url('external_service_functions.php', array('sesskey'=>sesskey(), 'id'=>$service->id, 'action'=>'add'));
$form->url = new moodle_url('service_functions.php', array('sesskey'=>sesskey(), 'id'=>$service->id, 'action'=>'add'));
$form->button->text = get_string('add');
$form->method = 'get';
echo $OUTPUT->button($form);
}

// simple back button
$form = new html_form();
$form->url = new moodle_url('settings.php', array('section'=>'externalservices'));
$form->url = new moodle_url('../settings.php', array('section'=>'externalservices'));
$form->button->text = get_string('back');
$form->method = 'get';
echo $OUTPUT->button($form);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/admin/webservice/lib.php');

$id = required_param('id', PARAM_INT);

$PAGE->set_url('admin/external_service_users.php', array('id'=>$id));
$PAGE->requires->js('admin/webservice/script.js');
$PAGE->set_url('admin/webservice/service_users.php', array('id'=>$id));
$PAGE->requires->js($CFG->admin.'/webservice/script.js');

admin_externalpage_setup('externalserviceusers');
admin_externalpage_print_header();
Expand All @@ -50,7 +50,7 @@
$serviceuser->userid = $adduser->id;
$serviceuser->timecreated = mktime();
$DB->insert_record('external_services_users', $serviceuser);
add_to_log(1, 'core', 'assign', 'admin/external_service_users.php?id='.$id, 'add', '', $adduser->id);
add_to_log(1, 'core', 'assign', $CFG->admin.'/webservice/service_users.php?id='.$id, 'add', '', $adduser->id);
}

$potentialuserselector->invalidate_selected_users();
Expand All @@ -65,7 +65,7 @@

foreach ($userstoremove as $removeuser) {
$DB->delete_records('external_services_users', array('externalserviceid' => $id, 'userid' => $removeuser->id));
add_to_log(1, 'core', 'assign', 'admin/external_service_users.php?id='.$id, 'remove', '', $removeuser->id);
add_to_log(1, 'core', 'assign', $CFG->admin.'/webservice/service_users.php?id='.$id, 'remove', '', $removeuser->id);
}

$potentialuserselector->invalidate_selected_users();
Expand All @@ -77,7 +77,7 @@

/// display the UI
?>
<form id="assignform" method="post" action="external_service_users.php?id=<?php echo $id ?>"><div>
<form id="assignform" method="post" action="service_users.php?id=<?php echo $id ?>"><div>
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />

<table summary="" class="roleassigntable generaltable generalbox boxaligncenter" cellspacing="0">
Expand Down Expand Up @@ -117,8 +117,7 @@
$enablevaliduntil = optional_param('enablevaliduntil', false, PARAM_INT);
if (!empty($fromday) && !empty($frommonth) && !empty($fromyear)) {
$validuntil = mktime(23, 59, 59, $frommonth, $fromday, $fromyear);
}
else {
} else {
$validuntil = "";
}

Expand Down Expand Up @@ -159,7 +158,7 @@
//user settings form
$contents = "<div class=\"fcontainer clearfix\">";
$form = new html_form();
$form->url = new moodle_url('/admin/external_service_users.php', array('id' => $id, 'userid' => $user->id, 'updateuser' => 1, 'serviceuserid' => $user->serviceuserid)); // Required
$form->url = new moodle_url('service_users.php', array('id' => $id, 'userid' => $user->id, 'updateuser' => 1, 'serviceuserid' => $user->serviceuserid)); // Required
$form->button = new html_button();
$form->button->text = get_string('update'); // Required
$form->button->disabled = false;
Expand Down
8 changes: 4 additions & 4 deletions lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6163,9 +6163,9 @@ public function output_html($data, $query='') {
$strusers = get_string('restrictedusers', 'webservice');
$strserviceusers = get_string('serviceusers', 'webservice');

$esurl = "$CFG->wwwroot/$CFG->admin/external_service.php";
$efurl = "$CFG->wwwroot/$CFG->admin/external_service_functions.php";
$euurl = "$CFG->wwwroot/$CFG->admin/external_service_users.php";
$esurl = "$CFG->wwwroot/$CFG->admin/webservice/service.php";
$efurl = "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php";
$euurl = "$CFG->wwwroot/$CFG->admin/webservice/service_users.php";

// built in services
$return = $OUTPUT->heading(get_string('servicesbuiltin', 'webservice'), 3, 'main');
Expand Down Expand Up @@ -6362,7 +6362,7 @@ public function output_html($data, $query='') {
$table->data = array();

// iterate through auth plugins and add to the display table
$url = "$CFG->wwwroot/$CFG->admin/webservice_protocols.php?sesskey=" . sesskey();
$url = "$CFG->wwwroot/$CFG->admin/webservice/protocols.php?sesskey=" . sesskey();
foreach ($protocols_available as $protocol => $location) {
$name = get_string('pluginname', 'webservice_'.$protocol);

Expand Down

0 comments on commit 72977b3

Please sign in to comment.