webservice MDL-23341 function list page: display "no functions" message, a better title, and fix a css typo

This commit is contained in:
jerome mouneyrac
2010-07-23 06:54:59 +00:00
parent f84a434909
commit 1d2a1936c5
5 changed files with 43 additions and 36 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ switch ($action) {
/// OUTPUT function list page
echo $OUTPUT->header();
echo $OUTPUT->heading($service->name);
echo $OUTPUT->heading(get_string('addservicefunction', 'webservice', $service->name));
$functions = $webservicemanager->get_external_functions(array($service->id));
echo $renderer->admin_service_function_list($functions, $service);
echo $OUTPUT->footer();
+2
View File
@@ -35,6 +35,7 @@ $string['addfunctions'] = 'Add functions';
$string['addfunctionsdescription'] = 'On the <strong>Manage service</strong> page, click the <strong>Functions</strong> link for the newly created service. Add some functions to the service.';
$string['addrequiredcapability'] = 'Assign/Unassign the required capability';
$string['addservice'] = 'Add a new service: {$a->name} (id: {$a->id})';
$string['addservicefunction'] = 'Add functions to the service "{$a}"';
$string['allusers'] = 'All users';
$string['amftestclient'] = 'AMF test client';
$string['apiexplorer'] = 'API explorer';
@@ -110,6 +111,7 @@ $string['missingcaps_help'] = 'List of capabilities that the service functions r
<br/><br/>Note: in rare case some of these "required" capabilities could depend of a function use case. For example \'moodle_role_get_enrolled_users\' function requires \'moodle/site:viewparticipants\' capability only for a site-wide request.';
$string['missingpassword'] = 'Missing password';
$string['missingusername'] = 'Missing username';
$string['nofunctions'] = 'This service has no functions.';
$string['norequiredcapability'] = 'No required capability';
$string['notoken'] = 'The token list is empty.';
$string['onesystemcontrolling'] = 'One system controlling Moodle with token';
+1 -1
View File
@@ -121,4 +121,4 @@
*/
#page-admin-webservice-service_users .missingcaps {color: #ff6600;font-size: 90%;}
#page-admin-setting-webservicetokens .missingcaps {color: #ff6600;font-size: 90%;}
#page-admin-websevice-service_functions .functiondesc {font-size: 90%;}
#page-admin-webservice-service_functions .functiondesc {font-size: 90%;}
+1 -1
View File
@@ -150,4 +150,4 @@ table.flexible .r1 {background-color: #FAFAFA;}
*/
#page-admin-webservice-service_users .missingcaps {color: #ff6600;font-size: 90%;}
#page-admin-setting-webservicetokens .missingcaps {color: #ff6600;font-size: 90%;}
#page-admin-websevice-service_functions .functiondesc {font-size: 90%;}
#page-admin-webservice-service_functions .functiondesc {font-size: 90%;}
+38 -33
View File
@@ -143,49 +143,54 @@ class core_webservice_renderer extends plugin_renderer_base {
* @return string the table html + add operation html
*/
public function admin_service_function_list($functions, $service) {
$table = new html_table();
$table->head = array(get_string('function', 'webservice'),
get_string('description'), get_string('requiredcaps', 'webservice'));
$table->align = array('left', 'left', 'left');
$table->size = array('15%', '40%', '40%');
$table->width = '100%';
$table->align[] = 'left';
if (!empty($functions)) {
$table = new html_table();
$table->head = array(get_string('function', 'webservice'),
get_string('description'), get_string('requiredcaps', 'webservice'));
$table->align = array('left', 'left', 'left');
$table->size = array('15%', '40%', '40%');
$table->width = '100%';
$table->align[] = 'left';
//display remove function operation (except for build-in service)
if (empty($service->component)) {
$table->head[] = get_string('edit');
$table->align[] = 'center';
}
foreach ($functions as $function) {
$function = external_function_info($function);
$requiredcaps = html_writer::tag('div',
empty($function->capabilities)?'':$function->capabilities,
array('class' => 'functiondesc'));;
$description = html_writer::tag('div', $function->description,
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',
array('sesskey' => sesskey(), 'fid' => $function->id,
'id' => $service->id,
'action' => 'delete'));
$removelink = html_writer::tag('a',
get_string('removefunction', 'webservice'),
array('href' => $removeurl));
$table->data[] = array($function->name, $description, $requiredcaps, $removelink);
} else {
$table->data[] = array($function->name, $description, $requiredcaps);
$table->head[] = get_string('edit');
$table->align[] = 'center';
}
}
$html = html_writer::table($table);
foreach ($functions as $function) {
$function = external_function_info($function);
$requiredcaps = html_writer::tag('div',
empty($function->capabilities) ? '' : $function->capabilities,
array('class' => 'functiondesc'));
;
$description = html_writer::tag('div', $function->description,
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',
array('sesskey' => sesskey(), 'fid' => $function->id,
'id' => $service->id,
'action' => 'delete'));
$removelink = html_writer::tag('a',
get_string('removefunction', 'webservice'),
array('href' => $removeurl));
$table->data[] = array($function->name, $description, $requiredcaps, $removelink);
} else {
$table->data[] = array($function->name, $description, $requiredcaps);
}
}
$html = html_writer::table($table);
} else {
$html = get_string('nofunctions', 'webservice') . html_writer::empty_tag('br');
}
//display add function operation (except for build-in service)
if (empty($service->component)) {
$addurl = new moodle_url('/admin/webservice/service_functions.php',
array('sesskey' => sesskey(), 'id' => $service->id, 'action' => 'add'));
$html .= html_writer::tag('a', get_string('add'), array('href' => $addurl));
$html .= html_writer::tag('a', get_string('addfunctions', 'webservice'), array('href' => $addurl));
}
return $html;