Merge branch 'MDL-52335-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
David Monllao
2015-12-10 15:47:14 +08:00
8 changed files with 44 additions and 9 deletions
+2 -2
View File
@@ -232,8 +232,8 @@ if ($formdata = $mform2->is_cancelled()) {
if (isset($USER->$key) and is_array($USER->$key)) {
// this must be some hacky field that is abusing arrays to store content and format
$user->$key = array();
$user->$key['text'] = $value;
$user->$key['format'] = FORMAT_MOODLE;
$user->{$key['text']} = $value;
$user->{$key['format']} = FORMAT_MOODLE;
} else {
$user->$key = trim($value);
}
@@ -1,4 +1,4 @@
@core @core_admin @_file_upload
@tool @tool_uploaduser @_file_upload
Feature: Upload users
In order to add users to the system
As an admin
@@ -39,3 +39,25 @@ Feature: Upload users
And I follow "Groups"
And I set the field "groups" to "Section 1 (1)"
And the "members" select box should contain "Tom Jones"
@javascript
Scenario: Upload users with custom profile fields
# Create user profile field.
Given I log in as "admin"
And I navigate to "User profile fields" node in "Site administration > Users > Accounts"
And I set the field "datatype" to "Text area"
And I set the following fields to these values:
| Short name | superfield |
| Name | Super field |
And I click on "Save changes" "button"
# Upload users.
When I navigate to "Upload users" node in "Site administration > Users > Accounts"
And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
And I press "Upload users"
And I press "Upload users"
# Check that users were created and the superfield is filled.
And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
And I follow "Tom Jones"
And I should see "Super field"
And I should see "The big guy"
And I log out
+4 -4
View File
@@ -564,7 +564,7 @@ class XMPPHP_XMLStream {
if ($searchxml !== null) {
if($handler[2] === null) $handler[2] = $this;
$this->log->log("Calling {$handler[1]}", XMPPHP_Log::LEVEL_DEBUG);
$handler[2]->$handler[1]($this->xmlobj[2]);
$handler[2]->{$handler[1]}($this->xmlobj[2]);
}
}
}
@@ -578,13 +578,13 @@ class XMPPHP_XMLStream {
if($searchxml !== null and $searchxml->name == $handler[0] and ($searchxml->ns == $handler[1] or (!$handler[1] and $searchxml->ns == $this->default_ns))) {
if($handler[3] === null) $handler[3] = $this;
$this->log->log("Calling {$handler[2]}", XMPPHP_Log::LEVEL_DEBUG);
$handler[3]->$handler[2]($this->xmlobj[2]);
$handler[3]->{$handler[2]}($this->xmlobj[2]);
}
}
foreach($this->idhandlers as $id => $handler) {
if(array_key_exists('id', $this->xmlobj[2]->attrs) and $this->xmlobj[2]->attrs['id'] == $id) {
if($handler[1] === null) $handler[1] = $this;
$handler[1]->$handler[0]($this->xmlobj[2]);
$handler[1]->{$handler[0]}($this->xmlobj[2]);
#id handlers are only used once
unset($this->idhandlers[$id]);
break;
@@ -640,7 +640,7 @@ class XMPPHP_XMLStream {
if($handler[2] === null) {
$handler[2] = $this;
}
$handler[2]->$handler[1]($payload);
$handler[2]->{$handler[1]}($payload);
}
}
foreach($this->until as $key => $until) {
+1
View File
@@ -1,3 +1,4 @@
Description of XMPPHP (aka jabber) version 0.1rc2-r77 library import into Moodle
MDL-20876 - replaced deprecated split() with explode()
MDL-52335 - PHP7 variable syntax changes
+3
View File
@@ -0,0 +1,3 @@
username,password,firstname,lastname,email,profile_field_superfield
jonest,verysecret,Tom,Jones,[email protected],The big guy
reznort,somesecret,Trent,Reznor,[email protected],Loves cats
1 username password firstname lastname email profile_field_superfield
2 jonest verysecret Tom Jones [email protected] The big guy
3 reznort somesecret Trent Reznor [email protected] Loves cats
+1 -1
View File
@@ -199,7 +199,7 @@ class data_field_textarea extends data_field_base {
// the value will be retrieved by file_get_submitted_draft_itemid, do not need to save in DB
return true;
} else {
$content->$names[2] = clean_param($value, PARAM_NOTAGS); // content[1-4]
$content->{$names[2]} = clean_param($value, PARAM_NOTAGS); // content[1-4]
}
} else {
$content->content = clean_param($value, PARAM_CLEAN);
+1 -1
View File
@@ -868,7 +868,7 @@ function lti_parse_custom_parameter($toolproxy, $tool, $params, $value, $islti2)
$value = $params[$val];
} else {
$valarr = explode('->', substr($val, 1), 2);
$value = "{${$valarr[0]}->$valarr[1]}";
$value = "{${$valarr[0]}->{$valarr[1]}}";
$value = str_replace('<br />' , ' ', $value);
$value = str_replace('<br>' , ' ', $value);
$value = format_string($value);
+9
View File
@@ -63,8 +63,11 @@ require_once($CFG->dirroot . '/mod/lti/servicelib.php');
class mod_lti_locallib_testcase extends advanced_testcase {
public function test_split_custom_parameters() {
$this->resetAfterTest();
$tool = new stdClass();
$tool->enabledcapability = '';
$tool->parameter = '';
$this->assertEquals(lti_split_custom_parameters(null, $tool, array(), "x=1\ny=2", false),
array('custom_x' => '1', 'custom_y' => '2'));
@@ -76,6 +79,12 @@ class mod_lti_locallib_testcase extends advanced_testcase {
$this->assertEquals(lti_split_custom_parameters(null, $tool, array(),
'Complex!@#$^*(){}[]KEY=Complex!@#$^*;(){}[]½Value', false),
array('custom_complex____________key' => 'Complex!@#$^*;(){}[]½Value'));
// Test custom parameter that returns $USER property.
$user = $this->getDataGenerator()->create_user(array('middlename' => 'SOMETHING'));
$this->setUser($user);
$this->assertEquals(array('custom_x' => '1', 'custom_y' => 'SOMETHING'),
lti_split_custom_parameters(null, $tool, array(), "x=1\ny=\$Person.name.middle", false));
}
/**