Commit 4e585756 authored by Robert Lyon's avatar Robert Lyon

Bug 1611547: Problem with userlist forms

The forms are not rendering correctly now that we have removed
mochikit from mahara.js

The problem is the typeof(message) check can return 'object' when the
message is null - see http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.3

So need to avoid trying to get the sub message from null object

Also added some accessibility strings to the Institutions -> Members
add form

Change-Id: Ic0a02ef35d5d0ed1844ab5792542fe0872e5376f
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 7c3f5646
......@@ -79,6 +79,8 @@ if ($usertype == 'requesters') {
'title' => get_string('addnewmembers', 'admin'),
'lefttitle' => get_string('usersrequested', 'admin'),
'righttitle' => get_string('userstoaddorreject', 'admin'),
'leftarrowlabel' => get_string('moveusersfromadd', 'admin'),
'rightarrowlabel' => get_string('moveuserstoadd', 'admin'),
'searchparams' => array('requested' => 1),
);
$submittext = get_string('addmembers', 'admin');
......@@ -88,6 +90,8 @@ if ($usertype == 'requesters') {
'title' => get_string('removeusersfrominstitution', 'admin'),
'lefttitle' => get_string('currentmembers', 'admin'),
'righttitle' => get_string('userstoberemoved', 'admin'),
'leftarrowlabel' => get_string('movemembersfromremove', 'admin'),
'rightarrowlabel' => get_string('movememberstoremove', 'admin'),
'searchparams' => array('member' => 1),
);
$submittext = get_string('removeusers', 'admin');
......@@ -100,6 +104,8 @@ else if ($usertype == 'lastinstitution') {
'title' => get_string('inviteuserstojoin', 'admin'),
'lefttitle' => get_string('userswhohaveleft', 'admin', $lastinstitutionobj->displayname),
'righttitle' => get_string('userstobeinvited', 'admin'),
'leftarrowlabel' => get_string('moveusersfrominviteinstitution', 'admin', $lastinstitutionobj->displayname),
'rightarrowlabel' => get_string('moveuserstoinviteinstitution', 'admin', $lastinstitutionobj->displayname),
'searchparams' => array('member' => 0, 'invitedby' => 0, 'requested' => 0, 'lastinstitution' => $lastinstitution),
);
$submittext = get_string('inviteusers', 'admin');
......@@ -112,6 +118,8 @@ else if ($usertype == 'nonmembers') {
'title' => get_string('inviteuserstojoin', 'admin'),
'lefttitle' => get_string('Non-members', 'admin'),
'righttitle' => get_string('userstobeinvited', 'admin'),
'leftarrowlabel' => get_string('moveusersfrominvite', 'admin'),
'rightarrowlabel' => get_string('moveuserstoinvite', 'admin'),
'searchparams' => array('member' => 0, 'invitedby' => 0, 'requested' => 0)
);
$submittext = get_string('inviteusers', 'admin');
......@@ -122,6 +130,8 @@ else if ($usertype == 'invited') {
'title' => get_string('revokeinvitations', 'admin'),
'lefttitle' => get_string('invitedusers', 'admin'),
'righttitle' => get_string('userstobeuninvited', 'admin'),
'leftarrowlabel' => get_string('moveusersfromuninvited', 'admin'),
'rightarrowlabel' => get_string('moveuserstouninvited', 'admin'),
'searchparams' => array('member' => 0, 'invitedby' => 1),
);
$submittext = get_string('revokeinvitations', 'admin');
......
......@@ -327,7 +327,7 @@ function sendjsonrequest(url, data, method, successcallback, errorcallback, quie
request.done(function(data) {
var error = data.error;
if (typeof(data.message) === 'object') {
if (typeof(data.message) === 'object' && data.message !== null) {
data = data.message;
}
......
......@@ -1009,6 +1009,16 @@ $string['errorupdatinginstitutionusers'] = 'An error occurred when updating inst
$string['revokeinvitations'] = 'Revoke invitations';
$string['invitedusers'] = 'Invited users';
$string['userstobeuninvited'] = 'Users to be uninvited';
$string['moveuserstoadd'] = 'Turn selected member requests into members';
$string['moveusersfromadd'] = 'Turn selected members into member requests';
$string['moveuserstoinvite'] = 'Turn selected non-members into invited';
$string['moveusersfrominvite'] = 'Turn selected invited into non-members';
$string['moveuserstoinviteinstitution'] = 'Turn selected old %s users into invited';
$string['moveusersfrominviteinstitution'] = 'Turn selected invited users into old %s users';
$string['movememberstoremove'] = 'Turn selected members into removed members';
$string['movemembersfromremove'] = 'Turn selected removed members into members';
$string['moveuserstouninvited'] = 'Turn selected invited users into uninvited';
$string['moveusersfromuninvited'] = 'Turn selected uninvited users into invited';
$string['institutionusersupdated_addUserAsMember'] = 'Users added';
$string['institutionusersupdated_declineRequestFromUser'] = 'Requests declined';
......
......@@ -15,6 +15,7 @@ Feature: Mahara user permissions in institutions
| username | password | email | firstname | lastname | institution | authname | role |
| userA | Kupuhipa1 | test01@example.com | Pete | Mc | mahara | internal | member |
| userB | Kupuhipa2 | test02@example.com | Son | Nguyen | instone | internal | admin |
| userC | Kupuhipa3 | test03@example.com | New | User | mahara | internal | member |
And the following "pages" exist:
| title | description| ownertype | ownername |
......@@ -52,3 +53,15 @@ Feature: Mahara user permissions in institutions
And I follow "Share page"
Then the "accesslist[0][searchtype]" select box should contain "Institution One"
And the "accesslist[0][searchtype]" select box should contain "Institution Two"
And I log out
# Add new member to institution via Institution -> Member's page
Given I log in as "admin" with password "Kupuhipa1"
And I follow "Administration"
And I choose "Members" in "Institutions"
And I select "People who have not requested institution membership yet" from "Users to display:"
And I wait until the page is ready
And I select "userC" from "Non-members"
And I press "Turn selected non-members into invited"
And I press "Add members"
And I should see "Users added"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment