MDL-68098 ws: Fix WebServices broken by filters HTML
This commit is contained in:
@@ -1613,7 +1613,7 @@ class external extends external_api {
|
||||
*/
|
||||
private static function get_tree_node_structure($allowchildbranches = true) {
|
||||
$fields = [
|
||||
'text' => new external_value(PARAM_TEXT, 'The node text', VALUE_REQUIRED),
|
||||
'text' => new external_value(PARAM_RAW, 'The node text', VALUE_REQUIRED),
|
||||
'expandcontextid' => new external_value(PARAM_INT, 'The contextid this node expands', VALUE_REQUIRED),
|
||||
'expandelement' => new external_value(PARAM_ALPHA, 'What element is this node expanded to', VALUE_REQUIRED),
|
||||
'contextid' => new external_value(PARAM_INT, 'The node contextid', VALUE_REQUIRED),
|
||||
|
||||
@@ -139,7 +139,7 @@ class external extends external_api {
|
||||
array(
|
||||
'wwwroot' => new external_value(PARAM_RAW, 'Site URL.'),
|
||||
'httpswwwroot' => new external_value(PARAM_RAW, 'Site https URL (if httpslogin is enabled).'),
|
||||
'sitename' => new external_value(PARAM_TEXT, 'Site name.'),
|
||||
'sitename' => new external_value(PARAM_RAW, 'Site name.'),
|
||||
'guestlogin' => new external_value(PARAM_INT, 'Whether guest login is enabled.'),
|
||||
'rememberusername' => new external_value(PARAM_INT, 'Values: 0 for No, 1 for Yes, 2 for optional.'),
|
||||
'authloginviaemail' => new external_value(PARAM_INT, 'Whether log in via email is enabled.'),
|
||||
|
||||
@@ -147,12 +147,12 @@ class auth_email_external extends external_api {
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Profile field id', VALUE_OPTIONAL),
|
||||
'shortname' => new external_value(PARAM_ALPHANUMEXT, 'Profile field shortname', VALUE_OPTIONAL),
|
||||
'name' => new external_value(PARAM_TEXT, 'Profield field name', VALUE_OPTIONAL),
|
||||
'name' => new external_value(PARAM_RAW, 'Profield field name', VALUE_OPTIONAL),
|
||||
'datatype' => new external_value(PARAM_ALPHANUMEXT, 'Profield field datatype', VALUE_OPTIONAL),
|
||||
'description' => new external_value(PARAM_RAW, 'Profield field description', VALUE_OPTIONAL),
|
||||
'descriptionformat' => new external_format_value('description'),
|
||||
'categoryid' => new external_value(PARAM_INT, 'Profield field category id', VALUE_OPTIONAL),
|
||||
'categoryname' => new external_value(PARAM_TEXT, 'Profield field category name', VALUE_OPTIONAL),
|
||||
'categoryname' => new external_value(PARAM_RAW, 'Profield field category name', VALUE_OPTIONAL),
|
||||
'sortorder' => new external_value(PARAM_INT, 'Profield field sort order', VALUE_OPTIONAL),
|
||||
'required' => new external_value(PARAM_INT, 'Profield field required', VALUE_OPTIONAL),
|
||||
'locked' => new external_value(PARAM_INT, 'Profield field locked', VALUE_OPTIONAL),
|
||||
|
||||
@@ -59,7 +59,7 @@ class core_block_external extends external_api {
|
||||
'visible' => new external_value(PARAM_BOOL, 'Whether the block is visible.', VALUE_OPTIONAL),
|
||||
'contents' => new external_single_structure(
|
||||
array(
|
||||
'title' => new external_value(PARAM_TEXT, 'Block title.'),
|
||||
'title' => new external_value(PARAM_RAW, 'Block title.'),
|
||||
'content' => new external_value(PARAM_RAW, 'Block contents.'),
|
||||
'contentformat' => new external_format_value('content'),
|
||||
'footer' => new external_value(PARAM_RAW, 'Block footer.'),
|
||||
|
||||
@@ -319,6 +319,7 @@ class core_calendar_external extends external_api {
|
||||
$event = (array) $eventobj;
|
||||
// Description formatting.
|
||||
$calendareventobj = new calendar_event($event);
|
||||
$event['name'] = $calendareventobj->format_external_name();
|
||||
list($event['description'], $event['format']) = $calendareventobj->format_external_text();
|
||||
|
||||
if ($hassystemcap) {
|
||||
@@ -365,7 +366,7 @@ class core_calendar_external extends external_api {
|
||||
'events' => new external_multiple_structure( new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'event id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'event name'),
|
||||
'name' => new external_value(PARAM_RAW, 'event name'),
|
||||
'description' => new external_value(PARAM_RAW, 'Description', VALUE_OPTIONAL, null, NULL_ALLOWED),
|
||||
'format' => new external_format_value('description'),
|
||||
'courseid' => new external_value(PARAM_INT, 'course id'),
|
||||
@@ -745,7 +746,7 @@ class core_calendar_external extends external_api {
|
||||
'events' => new external_multiple_structure( new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'event id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'event name'),
|
||||
'name' => new external_value(PARAM_RAW, 'event name'),
|
||||
'description' => new external_value(PARAM_RAW, 'Description', VALUE_OPTIONAL),
|
||||
'format' => new external_format_value('description'),
|
||||
'courseid' => new external_value(PARAM_INT, 'course id'),
|
||||
|
||||
@@ -968,6 +968,22 @@ class calendar_event {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the event name using the external API.
|
||||
*
|
||||
* This function should we used when text formatting is required in external functions.
|
||||
*
|
||||
* @return string Formatted name.
|
||||
*/
|
||||
public function format_external_name() {
|
||||
if ($this->editorcontext === null) {
|
||||
// Switch on the event type to decide upon the appropriate context to use for this event.
|
||||
$this->editorcontext = $this->get_context();
|
||||
}
|
||||
|
||||
return external_format_string($this->properties->name, $this->editorcontext->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the text using the external API.
|
||||
*
|
||||
|
||||
+14
-14
@@ -426,7 +426,7 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Section ID'),
|
||||
'name' => new external_value(PARAM_TEXT, 'Section name'),
|
||||
'name' => new external_value(PARAM_RAW, 'Section name'),
|
||||
'visible' => new external_value(PARAM_INT, 'is the section visible', VALUE_OPTIONAL),
|
||||
'summary' => new external_value(PARAM_RAW, 'Section description'),
|
||||
'summaryformat' => new external_format_value('summary'),
|
||||
@@ -669,12 +669,12 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'course id'),
|
||||
'shortname' => new external_value(PARAM_TEXT, 'course short name'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'course short name'),
|
||||
'categoryid' => new external_value(PARAM_INT, 'category id'),
|
||||
'categorysortorder' => new external_value(PARAM_INT,
|
||||
'sort order into the category', VALUE_OPTIONAL),
|
||||
'fullname' => new external_value(PARAM_TEXT, 'full name'),
|
||||
'displayname' => new external_value(PARAM_TEXT, 'course display name'),
|
||||
'fullname' => new external_value(PARAM_RAW, 'full name'),
|
||||
'displayname' => new external_value(PARAM_RAW, 'course display name'),
|
||||
'idnumber' => new external_value(PARAM_RAW, 'id number', VALUE_OPTIONAL),
|
||||
'summary' => new external_value(PARAM_RAW, 'summary'),
|
||||
'summaryformat' => new external_format_value('summary'),
|
||||
@@ -729,7 +729,7 @@ class core_course_external extends external_api {
|
||||
),
|
||||
'customfields' => new external_multiple_structure(
|
||||
new external_single_structure(
|
||||
['name' => new external_value(PARAM_TEXT, 'The name of the custom field'),
|
||||
['name' => new external_value(PARAM_RAW, 'The name of the custom field'),
|
||||
'shortname' => new external_value(PARAM_ALPHANUMEXT, 'The shortname of the custom field'),
|
||||
'type' => new external_value(PARAM_COMPONENT,
|
||||
'The type of the custom field - text, checkbox...'),
|
||||
@@ -939,7 +939,7 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'course id'),
|
||||
'shortname' => new external_value(PARAM_TEXT, 'short name'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'short name'),
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -1485,7 +1485,7 @@ class core_course_external extends external_api {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'course id'),
|
||||
'shortname' => new external_value(PARAM_TEXT, 'short name'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'short name'),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'category id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'category name'),
|
||||
'name' => new external_value(PARAM_RAW, 'category name'),
|
||||
'idnumber' => new external_value(PARAM_RAW, 'category id number', VALUE_OPTIONAL),
|
||||
'description' => new external_value(PARAM_RAW, 'category description'),
|
||||
'descriptionformat' => new external_format_value('description'),
|
||||
@@ -2069,7 +2069,7 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'new category id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'new category name'),
|
||||
'name' => new external_value(PARAM_RAW, 'new category name'),
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -2607,11 +2607,11 @@ class core_course_external extends external_api {
|
||||
protected static function get_course_structure($onlypublicdata = true) {
|
||||
$coursestructure = array(
|
||||
'id' => new external_value(PARAM_INT, 'course id'),
|
||||
'fullname' => new external_value(PARAM_TEXT, 'course full name'),
|
||||
'displayname' => new external_value(PARAM_TEXT, 'course display name'),
|
||||
'shortname' => new external_value(PARAM_TEXT, 'course short name'),
|
||||
'fullname' => new external_value(PARAM_RAW, 'course full name'),
|
||||
'displayname' => new external_value(PARAM_RAW, 'course display name'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'course short name'),
|
||||
'categoryid' => new external_value(PARAM_INT, 'category id'),
|
||||
'categoryname' => new external_value(PARAM_TEXT, 'category name'),
|
||||
'categoryname' => new external_value(PARAM_RAW, 'category name'),
|
||||
'sortorder' => new external_value(PARAM_INT, 'Sort order in the category', VALUE_OPTIONAL),
|
||||
'summary' => new external_value(PARAM_RAW, 'summary'),
|
||||
'summaryformat' => new external_format_value('summary'),
|
||||
@@ -2861,7 +2861,7 @@ class core_course_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_ALPHANUMEXT, 'Outcome id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'Outcome full name'),
|
||||
'name' => new external_value(PARAM_RAW, 'Outcome full name'),
|
||||
'scale' => new external_value(PARAM_TEXT, 'Scale items')
|
||||
)
|
||||
),
|
||||
|
||||
@@ -460,7 +460,7 @@ class core_enrol_external extends external_api {
|
||||
'id' => new external_value(PARAM_INT, 'id of course'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'short name of course'),
|
||||
'fullname' => new external_value(PARAM_RAW, 'long name of course'),
|
||||
'displayname' => new external_value(PARAM_TEXT, 'course display name for lists.', VALUE_OPTIONAL),
|
||||
'displayname' => new external_value(PARAM_RAW, 'course display name for lists.', VALUE_OPTIONAL),
|
||||
'enrolledusercount' => new external_value(PARAM_INT, 'Number of enrolled users in this course',
|
||||
VALUE_OPTIONAL),
|
||||
'idnumber' => new external_value(PARAM_RAW, 'id number of course'),
|
||||
|
||||
Vendored
+1
-1
@@ -497,7 +497,7 @@ class core_external extends external_api {
|
||||
'value' => new external_value(PARAM_RAW, 'value of the item as it is stored', VALUE_OPTIONAL),
|
||||
'itemid' => new external_value(PARAM_RAW, 'identifier of the updated item', VALUE_OPTIONAL),
|
||||
'edithint' => new external_value(PARAM_NOTAGS, 'hint for editing element', VALUE_OPTIONAL),
|
||||
'editlabel' => new external_value(PARAM_NOTAGS, 'label for editing element', VALUE_OPTIONAL),
|
||||
'editlabel' => new external_value(PARAM_RAW, 'label for editing element', VALUE_OPTIONAL),
|
||||
'type' => new external_value(PARAM_ALPHA, 'type of the element (text, toggle, select)', VALUE_OPTIONAL),
|
||||
'options' => new external_value(PARAM_RAW, 'options of the element, format depends on type', VALUE_OPTIONAL),
|
||||
'linkeverything' => new external_value(PARAM_INT, 'Should everything be wrapped in the edit link or link displayed separately', VALUE_OPTIONAL),
|
||||
|
||||
@@ -1002,8 +1002,8 @@ class core_message_external extends external_api {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'The conversation id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'The conversation name, if set', VALUE_DEFAULT, null),
|
||||
'subname' => new external_value(PARAM_TEXT, 'A subtitle for the conversation name, if set', VALUE_DEFAULT, null),
|
||||
'name' => new external_value(PARAM_RAW, 'The conversation name, if set', VALUE_DEFAULT, null),
|
||||
'subname' => new external_value(PARAM_RAW, 'A subtitle for the conversation name, if set', VALUE_DEFAULT, null),
|
||||
'imageurl' => new external_value(PARAM_URL, 'A link to the conversation picture, if set', VALUE_DEFAULT, null),
|
||||
'type' => new external_value(PARAM_INT, 'The type of the conversation (1=individual,2=group,3=self)'),
|
||||
'membercount' => new external_value(PARAM_INT, 'Total number of conversation members'),
|
||||
@@ -1063,7 +1063,7 @@ class core_message_external extends external_api {
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Conversations id'),
|
||||
'type' => new external_value(PARAM_INT, 'Conversation type: private or public'),
|
||||
'name' => new external_value(PARAM_TEXT, 'Multilang compatible conversation name'. VALUE_OPTIONAL),
|
||||
'name' => new external_value(PARAM_RAW, 'Multilang compatible conversation name'. VALUE_OPTIONAL),
|
||||
'timecreated' => new external_value(PARAM_INT, 'The timecreated timestamp for the conversation'),
|
||||
), 'information about conversation', VALUE_OPTIONAL),
|
||||
'Conversations between users', VALUE_OPTIONAL
|
||||
|
||||
@@ -593,8 +593,8 @@ class mod_assign_external extends external_api {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'course id'),
|
||||
'fullname' => new external_value(PARAM_TEXT, 'course full name'),
|
||||
'shortname' => new external_value(PARAM_TEXT, 'course short name'),
|
||||
'fullname' => new external_value(PARAM_RAW, 'course full name'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'course short name'),
|
||||
'timemodified' => new external_value(PARAM_INT, 'last time modified'),
|
||||
'assignments' => new external_multiple_structure(self::get_assignments_assignment_structure(), 'assignment info')
|
||||
), 'course information object'
|
||||
|
||||
@@ -467,7 +467,7 @@ class mod_forum_external extends external_api {
|
||||
'created' => new external_value(PARAM_INT, 'Creation time'),
|
||||
'modified' => new external_value(PARAM_INT, 'Time modified'),
|
||||
'mailed' => new external_value(PARAM_INT, 'Mailed?'),
|
||||
'subject' => new external_value(PARAM_TEXT, 'The post subject'),
|
||||
'subject' => new external_value(PARAM_RAW, 'The post subject'),
|
||||
'message' => new external_value(PARAM_RAW, 'The post message'),
|
||||
'messageformat' => new external_format_value('message'),
|
||||
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
|
||||
@@ -716,7 +716,7 @@ class mod_forum_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Post id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'Discussion name'),
|
||||
'name' => new external_value(PARAM_RAW, 'Discussion name'),
|
||||
'groupid' => new external_value(PARAM_INT, 'Group id'),
|
||||
'timemodified' => new external_value(PARAM_INT, 'Time modified'),
|
||||
'usermodified' => new external_value(PARAM_INT, 'The id of the user who last modified'),
|
||||
@@ -728,7 +728,7 @@ class mod_forum_external extends external_api {
|
||||
'created' => new external_value(PARAM_INT, 'Creation time'),
|
||||
'modified' => new external_value(PARAM_INT, 'Time modified'),
|
||||
'mailed' => new external_value(PARAM_INT, 'Mailed?'),
|
||||
'subject' => new external_value(PARAM_TEXT, 'The post subject'),
|
||||
'subject' => new external_value(PARAM_RAW, 'The post subject'),
|
||||
'message' => new external_value(PARAM_RAW, 'The post message'),
|
||||
'messageformat' => new external_format_value('message'),
|
||||
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
|
||||
@@ -1002,7 +1002,7 @@ class mod_forum_external extends external_api {
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Post id'),
|
||||
'name' => new external_value(PARAM_TEXT, 'Discussion name'),
|
||||
'name' => new external_value(PARAM_RAW, 'Discussion name'),
|
||||
'groupid' => new external_value(PARAM_INT, 'Group id'),
|
||||
'timemodified' => new external_value(PARAM_INT, 'Time modified'),
|
||||
'usermodified' => new external_value(PARAM_INT, 'The id of the user who last modified'),
|
||||
@@ -1014,7 +1014,7 @@ class mod_forum_external extends external_api {
|
||||
'created' => new external_value(PARAM_INT, 'Creation time'),
|
||||
'modified' => new external_value(PARAM_INT, 'Time modified'),
|
||||
'mailed' => new external_value(PARAM_INT, 'Mailed?'),
|
||||
'subject' => new external_value(PARAM_TEXT, 'The post subject'),
|
||||
'subject' => new external_value(PARAM_RAW, 'The post subject'),
|
||||
'message' => new external_value(PARAM_RAW, 'The post message'),
|
||||
'messageformat' => new external_format_value('message'),
|
||||
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
|
||||
|
||||
Reference in New Issue
Block a user