From 4955481bf33ebb12779d1782e48c657e83429819 Mon Sep 17 00:00:00 2001 From: jerome Date: Tue, 20 Oct 2009 06:34:46 +0000 Subject: [PATCH] webservice MDL-17135 fix navigation (kudo to Sam) + trivial few changes --- admin/external_service_users.php | 20 ++++++++++++++++---- admin/settings/plugins.php | 6 +++--- lib/adminlib.php | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/admin/external_service_users.php b/admin/external_service_users.php index 17ac875395..595a206be8 100644 --- a/admin/external_service_users.php +++ b/admin/external_service_users.php @@ -71,7 +71,8 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei $alloweduserselector->invalidate_selected_users(); } } - +/// Print the form. + check_theme_arrows(); /// display the UI ?> @@ -112,11 +113,16 @@ if (optional_param('updateuser', false, PARAM_BOOL) && confirm_sesskey()) { $frommonth = optional_param('frommonth', '', PARAM_INT); $fromyear = optional_param('fromyear', '', PARAM_INT); $addcap = optional_param('addcap', false, PARAM_INT); + $enablevaliduntil = optional_param('enablevaliduntil', false, PARAM_INT); $validuntil = mktime(23, 59, 59, $frommonth, $fromday, $fromyear); $serviceuser = new object(); $serviceuser->id = $serviceuserid; - $serviceuser->validuntil = $validuntil; + if ($enablevaliduntil) { + $serviceuser->validuntil = $validuntil; + } else { + $serviceuser->validuntil = null; //the valid until field is disabled, we reset the value + } $serviceuser->iprestriction = $iprestriction; $DB->update_record('external_services_users', $serviceuser); @@ -137,7 +143,7 @@ if (!empty($allowedusers)) { echo $OUTPUT->box_start('generalbox', 'alloweduserlist'); echo ""; - echo "

"; //reduce font of the user settings + echo "

"; //reduce font of the user settings foreach($allowedusers as $user) { echo ""; @@ -167,7 +173,13 @@ if (!empty($allowedusers)) { $selectors = html_select::make_time_selectors(array('days' => 'fromday','months' => 'frommonth', 'years' => 'fromyear'),$user->validuntil); foreach ($selectors as $select) { $contents .= $OUTPUT->select($select); - } + } $checkbox = new html_select_option(); + $checkbox->value = 1; + $checkbox->selected = empty($user->validuntil)?false:true; + $checkbox->text = get_string('enabled', 'webservice'); + $checkbox->label->text = get_string('enabled', 'webservice'); + $checkbox->alt = get_string('enabled', 'webservice'); + $contents .= $OUTPUT->checkbox($checkbox, 'enablevaliduntil'); $contents .= ""; //TO IMPLEMENT : assign the required capability (if needed) $contents .= "
"; diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 0fd5a1c7f6..93736cc07e 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/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)); $temp = new admin_settingpage('webserviceprotocols', get_string('manageprotocols', 'webservice')); $temp->add(new admin_setting_managewebserviceprotocols()); if (empty($CFG->enablewebservices)) { diff --git a/lib/adminlib.php b/lib/adminlib.php index 21b08debba..0e58ff7adb 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -6196,7 +6196,7 @@ class admin_setting_manageexternalservices extends admin_setting { if ($service->restrictedusers) { $users = "id\">$strusers"; } else { - $users = '-'; + $users = get_string('nouserrestriction','webservice'); } $edit = "id\">$stredit"; @@ -6236,7 +6236,7 @@ class admin_setting_manageexternalservices extends admin_setting { if ($service->restrictedusers) { $users = "id\">$strusers"; } else { - $users = '-'; + $users = get_string('nouserrestriction','webservice'); } $edit = "id\">$stredit"; -- 2.39.5