From: skodak Date: Wed, 21 Oct 2009 19:58:50 +0000 (+0000) Subject: MDL-17135 moving all webservice and external API related admin UI to new directory... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=72977b3786eb2f102fad9504ab0097d1a6ff6e99;p=moodle.git MDL-17135 moving all webservice and external API related admin UI to new directory, I did not expect there would be so many files, sorry for the trouble --- diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 93736cc07e..98e9359411 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -242,9 +242,9 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) $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)) { diff --git a/admin/external_forms.php b/admin/webservice/forms.php similarity index 100% rename from admin/external_forms.php rename to admin/webservice/forms.php diff --git a/admin/webservice/lib.php b/admin/webservice/lib.php index 84da28d2f9..2f9365f62c 100644 --- a/admin/webservice/lib.php +++ b/admin/webservice/lib.php @@ -118,7 +118,7 @@ class service_user_selector extends user_selector_base { 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; diff --git a/admin/webservice_protocols.php b/admin/webservice/protocols.php similarity index 96% rename from admin/webservice_protocols.php rename to admin/webservice/protocols.php index e1b7abab81..5f296b69e8 100644 --- a/admin/webservice_protocols.php +++ b/admin/webservice/protocols.php @@ -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(); diff --git a/admin/webservice/script.js b/admin/webservice/script.js index 35a28abc97..8db3c012e6 100644 --- a/admin/webservice/script.js +++ b/admin/webservice/script.js @@ -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) diff --git a/admin/external_service.php b/admin/webservice/service.php similarity index 90% rename from admin/external_service.php rename to admin/webservice/service.php index 089ef3fada..94948f2668 100644 --- a/admin/external_service.php +++ b/admin/webservice/service.php @@ -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); @@ -48,8 +48,8 @@ if ($action == 'delete' and confirm_sesskey() and $service and empty($service->c 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; diff --git a/admin/external_service_functions.php b/admin/webservice/service_functions.php similarity index 88% rename from admin/external_service_functions.php rename to admin/webservice/service_functions.php index 7a20b72d53..e37c644e05 100644 --- a/admin/external_service_functions.php +++ b/admin/webservice/service_functions.php @@ -23,7 +23,7 @@ * @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); @@ -31,12 +31,12 @@ $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); @@ -46,8 +46,8 @@ if ($action === 'delete' and confirm_sesskey() and $service and empty($service-> 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; @@ -94,7 +94,7 @@ else if ($action === 'add') { // 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(); @@ -105,7 +105,7 @@ else if ($action === 'add') { 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 @@ -161,7 +161,7 @@ if (empty($service->component)) { $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 @@ -180,7 +180,7 @@ echo $OUTPUT->table($table); // 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); @@ -188,7 +188,7 @@ if (empty($service->component)) { // 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); diff --git a/admin/external_service_users.php b/admin/webservice/service_users.php similarity index 92% rename from admin/external_service_users.php rename to admin/webservice/service_users.php index 88ec21252a..0287793271 100644 --- a/admin/external_service_users.php +++ b/admin/webservice/service_users.php @@ -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(); @@ -50,7 +50,7 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei $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(); @@ -65,7 +65,7 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei 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(); @@ -77,7 +77,7 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei /// display the UI ?> -
+
@@ -117,8 +117,7 @@ if (optional_param('updateuser', false, PARAM_BOOL) && confirm_sesskey()) { $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 = ""; } @@ -159,7 +158,7 @@ if (!empty($allowedusers)) { //user settings form $contents = "
"; $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; diff --git a/lib/adminlib.php b/lib/adminlib.php index 974dbd44c8..654be2d43e 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -6163,9 +6163,9 @@ class admin_setting_manageexternalservices extends admin_setting { $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'); @@ -6362,7 +6362,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting { $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);