webservice MDL-24230 fix /admin/ into $CFG->admin + /lib/ into $CFG->libdir
This commit is contained in:
@@ -27,13 +27,13 @@ require_once('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$PAGE->set_url('/admin/webservice/protocols.php');
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/protocols.php');
|
||||
//TODO: disable the blocks here or better make the page layout default to no blocks!
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=webserviceprotocols";
|
||||
$returnurl = $CFG->wwwroot . "/" . $CFG->admin . "/settings.php?section=webserviceprotocols";
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$webservice = optional_param('webservice', '', PARAM_SAFEDIR);
|
||||
|
||||
@@ -36,20 +36,20 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
admin_externalpage_setup('externalservicefunctions');
|
||||
|
||||
//define nav bar
|
||||
$PAGE->set_url('/admin/websevice/service_functions.php', array('id' => $serviceid));
|
||||
$PAGE->set_url('/' . $CFG->admin . '/websevice/service_functions.php', array('id' => $serviceid));
|
||||
$PAGE->navbar->ignore_active(true);
|
||||
$PAGE->navbar->add(get_string('administrationsite'));
|
||||
$PAGE->navbar->add(get_string('plugins', 'admin'));
|
||||
$PAGE->navbar->add(get_string('webservices', 'webservice'));
|
||||
$PAGE->navbar->add(get_string('externalservices', 'webservice'),
|
||||
new moodle_url('/admin/settings.php?section=externalservices'));
|
||||
new moodle_url('/' . $CFG->admin . '/settings.php?section=externalservices'));
|
||||
$PAGE->navbar->add(get_string('functions', 'webservice'),
|
||||
new moodle_url('/admin/webservice/service_functions.php?id=' . $serviceid));
|
||||
new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php?id=' . $serviceid));
|
||||
|
||||
$service = $DB->get_record('external_services', array('id' => $serviceid), '*', MUST_EXIST);
|
||||
$webservicemanager = new webservice();
|
||||
$renderer = $PAGE->get_renderer('core', 'webservice');
|
||||
$functionlisturl = new moodle_url('/admin/webservice/service_functions.php',
|
||||
$functionlisturl = new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php',
|
||||
array('id' => $serviceid));
|
||||
|
||||
// Add or Delete operations
|
||||
|
||||
@@ -25,29 +25,26 @@
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/webservice/lib.php');
|
||||
require_once($CFG->dirroot . '/admin/webservice/forms.php');
|
||||
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/webservice/forms.php');
|
||||
|
||||
$serviceid = required_param('serviceid', PARAM_INT);
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
|
||||
$PAGE->set_url('/admin/webservice/service_user_settings.php', array('id' => $serviceid, 'userid' => $userid));
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/service_user_settings.php', array('id' => $serviceid, 'userid' => $userid));
|
||||
$PAGE->navbar->ignore_active(true);
|
||||
$PAGE->navbar->add(get_string('administrationsite'));
|
||||
$PAGE->navbar->add(get_string('plugins', 'admin'));
|
||||
$PAGE->navbar->add(get_string('webservices', 'webservice'));
|
||||
$PAGE->navbar->add(get_string('externalservices', 'webservice'),
|
||||
new moodle_url('/admin/settings.php?section=externalservices'));
|
||||
new moodle_url('/' . $CFG->admin . '/settings.php?section=externalservices'));
|
||||
$PAGE->navbar->add(get_string('serviceusers', 'webservice'),
|
||||
new moodle_url('/admin/webservice/service_users.php', array('id' => $serviceid)));
|
||||
new moodle_url('/' . $CFG->admin . '/webservice/service_users.php', array('id' => $serviceid)));
|
||||
$PAGE->navbar->add(get_string('serviceusersettings', 'webservice'));
|
||||
|
||||
//$PAGE->requires->js('/admin/webservice/script.js');
|
||||
|
||||
admin_externalpage_setup('externalserviceusersettings');
|
||||
|
||||
$formaction = new moodle_url('', array('id' => $serviceid, 'userid' => $userid));
|
||||
$returnurl = new moodle_url('/admin/webservice/service_users.php', array('id' => $serviceid));
|
||||
$returnurl = new moodle_url('/' . $CFG->admin . '/webservice/service_users.php', array('id' => $serviceid));
|
||||
|
||||
$webservicemanager = new webservice();
|
||||
$serviceuser = $webservicemanager->get_ws_authorised_user($serviceid, $userid);
|
||||
|
||||
@@ -24,18 +24,18 @@
|
||||
*/
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/admin/webservice/lib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/webservice/lib.php');
|
||||
require_once($CFG->dirroot . '/webservice/lib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
$PAGE->set_url('/admin/webservice/service_users.php', array('id' => $id));
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/service_users.php', array('id' => $id));
|
||||
$PAGE->navbar->ignore_active(true);
|
||||
$PAGE->navbar->add(get_string('administrationsite'));
|
||||
$PAGE->navbar->add(get_string('plugins', 'admin'));
|
||||
$PAGE->navbar->add(get_string('webservices', 'webservice'));
|
||||
$PAGE->navbar->add(get_string('externalservices', 'webservice'),
|
||||
new moodle_url('/admin/settings.php?section=externalservices'));
|
||||
new moodle_url('/' . $CFG->admin . '/settings.php?section=externalservices'));
|
||||
$PAGE->navbar->add(get_string('serviceusers', 'webservice'));
|
||||
|
||||
admin_externalpage_setup('externalserviceusers');
|
||||
|
||||
@@ -27,17 +27,18 @@
|
||||
require('../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once("$CFG->libdir/externallib.php");
|
||||
require_once("$CFG->dirroot/admin/webservice/testclient_forms.php");
|
||||
require_once($CFG->dirroot . "/" . $CFG->admin . "/webservice/testclient_forms.php");
|
||||
|
||||
$function = optional_param('function', '', PARAM_SAFEDIR);
|
||||
$protocol = optional_param('protocol', '', PARAM_SAFEDIR);
|
||||
$authmethod = optional_param('authmethod', '', PARAM_SAFEDIR);
|
||||
|
||||
$PAGE->set_url('/admin/webservice/testclient.php');
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/testclient.php');
|
||||
$PAGE->navbar->ignore_active(true);
|
||||
$PAGE->navbar->add(get_string('administrationsite'));
|
||||
$PAGE->navbar->add(get_string('development', 'admin'));
|
||||
$PAGE->navbar->add(get_string('testclient', 'webservice'), new moodle_url('/admin/webservice/testclient.php'));
|
||||
$PAGE->navbar->add(get_string('testclient', 'webservice'),
|
||||
new moodle_url('/' . $CFG->admin . '/webservice/testclient.php'));
|
||||
if (!empty($function)) {
|
||||
$PAGE->navbar->add($function);
|
||||
}
|
||||
@@ -91,7 +92,7 @@ if (!$function or !$protocol) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('testclient', 'webservice'));
|
||||
echo $OUTPUT->box_start();
|
||||
$url = new moodle_url('/admin/settings.php?section=debugging');
|
||||
$url = new moodle_url('/' . $CFG->admin . '/settings.php?section=debugging');
|
||||
$atag =html_writer::start_tag('a', array('href' => $url)).get_string('debug', 'admin').html_writer::end_tag('a');
|
||||
$descparams = new stdClass();
|
||||
$descparams->atag = $atag;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
|
||||
|
||||
class webservice_test_client_form extends moodleform {
|
||||
|
||||
@@ -25,20 +25,20 @@
|
||||
*/
|
||||
require_once('../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/admin/webservice/forms.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/webservice/forms.php');
|
||||
require_once($CFG->libdir . '/externallib.php');
|
||||
|
||||
$action = optional_param('action', '', PARAM_ACTION);
|
||||
$tokenid = optional_param('tokenid', '', PARAM_SAFEDIR);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('/admin/webservice/tokens.php');
|
||||
$PAGE->set_url('/' . $CFG->admin . '/webservice/tokens.php');
|
||||
$PAGE->navbar->ignore_active(true);
|
||||
$PAGE->navbar->add(get_string('administrationsite'));
|
||||
$PAGE->navbar->add(get_string('plugins', 'admin'));
|
||||
$PAGE->navbar->add(get_string('webservices', 'webservice'));
|
||||
$PAGE->navbar->add(get_string('managetokens', 'webservice'),
|
||||
new moodle_url('/admin/settings.php?section=webservicetokens'));
|
||||
new moodle_url('/' . $CFG->admin . '/settings.php?section=webservicetokens'));
|
||||
if ($action == "delete") {
|
||||
$PAGE->navbar->add(get_string('delete'));
|
||||
} else {
|
||||
@@ -49,7 +49,7 @@ admin_externalpage_setup('addwebservicetoken');
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$tokenlisturl = new moodle_url("/admin/settings.php", array('section' => 'webservicetokens'));
|
||||
$tokenlisturl = new moodle_url("/" . $CFG->admin . "/settings.php", array('section' => 'webservicetokens'));
|
||||
|
||||
switch ($action) {
|
||||
|
||||
|
||||
+10
-6
@@ -35,6 +35,7 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
* @return string html
|
||||
*/
|
||||
public function admin_authorised_user_selector(&$options) {
|
||||
global $CFG;
|
||||
$formcontent = html_writer::empty_tag('input',
|
||||
array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
|
||||
|
||||
@@ -81,7 +82,7 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
|
||||
$formcontent = html_writer::tag('div', $formcontent);
|
||||
|
||||
$actionurl = new moodle_url('/admin/webservice/service_users.php',
|
||||
$actionurl = new moodle_url('/' . $CFG->admin . '/webservice/service_users.php',
|
||||
array('id' => $options->serviceid));
|
||||
$html = html_writer::tag('form', $formcontent,
|
||||
array('id' => 'assignform', 'action' => $actionurl, 'method' => 'post'));
|
||||
@@ -94,9 +95,10 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
* @return string $html
|
||||
*/
|
||||
public function admin_authorised_user_list($users, $serviceid) {
|
||||
global $CFG;
|
||||
$html = $this->output->box_start('generalbox', 'alloweduserlist');
|
||||
foreach ($users as $user) {
|
||||
$modifiedauthoriseduserurl = new moodle_url('/admin/webservice/service_user_settings.php',
|
||||
$modifiedauthoriseduserurl = new moodle_url('/' . $CFG->admin . '/webservice/service_user_settings.php',
|
||||
array('userid' => $user->id, 'serviceid' => $serviceid));
|
||||
$html .= html_writer::tag('a', $user->firstname . " "
|
||||
. $user->lastname . ", " . $user->email,
|
||||
@@ -160,14 +162,15 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
* @return string html
|
||||
*/
|
||||
public function admin_delete_token_confirmation($token) {
|
||||
global $CFG;
|
||||
$optionsyes = array('tokenid' => $token->id, 'action' => 'delete',
|
||||
'confirm' => 1, 'sesskey' => sesskey());
|
||||
$optionsno = array('section' => 'webservicetokens', 'sesskey' => sesskey());
|
||||
$formcontinue = new single_button(
|
||||
new moodle_url('/admin/webservice/tokens.php', $optionsyes),
|
||||
new moodle_url('/' . $CFG->admin . '/webservice/tokens.php', $optionsyes),
|
||||
get_string('delete'));
|
||||
$formcancel = new single_button(
|
||||
new moodle_url('/admin/settings.php', $optionsno),
|
||||
new moodle_url('/' . $CFG->admin . '/settings.php', $optionsno),
|
||||
get_string('cancel'), 'get');
|
||||
return $this->output->confirm(get_string('deletetokenconfirm', 'webservice',
|
||||
(object) array('user' => $token->firstname . " "
|
||||
@@ -183,6 +186,7 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
* @return string the table html + add operation html
|
||||
*/
|
||||
public function admin_service_function_list($functions, $service) {
|
||||
global $CFG;
|
||||
if (!empty($functions)) {
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('function', 'webservice'),
|
||||
@@ -208,7 +212,7 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
array('class' => 'functiondesc'));
|
||||
//display remove function operation (except for build-in service)
|
||||
if (empty($service->component)) {
|
||||
$removeurl = new moodle_url('/admin/webservice/service_functions.php',
|
||||
$removeurl = new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php',
|
||||
array('sesskey' => sesskey(), 'fid' => $function->id,
|
||||
'id' => $service->id,
|
||||
'action' => 'delete'));
|
||||
@@ -228,7 +232,7 @@ class core_webservice_renderer extends plugin_renderer_base {
|
||||
|
||||
//display add function operation (except for build-in service)
|
||||
if (empty($service->component)) {
|
||||
$addurl = new moodle_url('/admin/webservice/service_functions.php',
|
||||
$addurl = new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php',
|
||||
array('sesskey' => sesskey(), 'id' => $service->id, 'action' => 'add'));
|
||||
$html .= html_writer::tag('a', get_string('addfunctions', 'webservice'), array('href' => $addurl));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user