~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/user-media/settings.js

Move the remaining images to the new framework, in the new ivle.webapp.core
plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
var user_data;
24
24
 
25
 
function onload()
26
 
{
27
 
    revert_settings();
28
 
}
29
 
 
30
25
/* Fetch the user's details from the server, and populate the page.
31
26
 * Returns false. */
32
27
function revert_settings()
37
32
            populate(user);
38
33
        }
39
34
    /* Just get details for the logged in user */
40
 
    ajax_call(callback, "userservice", "get_user", {}, "GET");
 
35
    ajax_call(callback, "userservice", "get_user", {"login": settings_login}, "GET");
41
36
    return false;
42
37
}
43
38
 
111
106
        p.appendChild(document.createTextNode("Change password"))
112
107
        changepassword.appendChild(p);
113
108
        p = document.createElement("p");
114
 
        p.appendChild(document.createTextNode("Please type your new password "
115
 
            + "twice, to make sure you remember it."))
 
109
        
 
110
        p.appendChild(document.createTextNode("Please type your old password, "
 
111
                + "and new password twice, for verification."));
116
112
        changepassword.appendChild(p);
117
113
 
118
114
        table = document.createElement("table");
120
116
 
121
117
        tr = document.createElement("tr");
122
118
        td = document.createElement("td");
 
119
        td.appendChild(document.createTextNode("Old password:"))
 
120
        tr.appendChild(td);
 
121
        td = document.createElement("td");
 
122
        inputbox = document.createElement("input");
 
123
        inputbox.setAttribute("type", "password");
 
124
        inputbox.setAttribute("name", "oldpass");
 
125
        inputbox.setAttribute("id", "oldpass");
 
126
        inputbox.setAttribute("size", "40");
 
127
        td.appendChild(inputbox)
 
128
        tr.appendChild(td);
 
129
        tbody.appendChild(tr);
 
130
 
 
131
        tr = document.createElement("tr");
 
132
        td = document.createElement("td");
123
133
        td.appendChild(document.createTextNode("New password:"))
124
134
        tr.appendChild(td);
125
135
        td = document.createElement("td");
202
212
    /* Textbox (input) elements */
203
213
    try
204
214
    {
 
215
        var oldpass = document.getElementById("oldpass");
205
216
        var newpass = document.getElementById("newpass");
206
217
        var repeatpass = document.getElementById("repeatpass");
207
218
    }
214
225
    var email = document.getElementById("email");
215
226
 
216
227
    /* Check */
 
228
    oldpassval = oldpass == null ? null : oldpass.value;
217
229
    newpassval = newpass == null ? null : newpass.value;
218
230
    repeatpassval = repeatpass == null ? null : repeatpass.value;
219
231
    nickval = nick.value;
260
272
            dom_removechildren(usernick);
261
273
            usernick.appendChild(document.createTextNode(nickval));
262
274
        }
 
275
        else if (xhr.getResponseHeader("X-IVLE-Action-Error"))
 
276
        {
 
277
            set_result(decodeURIComponent(xhr.getResponseHeader(
 
278
                                     "X-IVLE-Action-Error").toString()), true);        
 
279
        }
263
280
        else
264
281
        {
265
282
            set_result("There was a problem updating the details."
266
 
                + " Your changes have not been saved.");
 
283
                + " Your changes have not been saved.", true);
267
284
        }
268
285
    }
269
286
    data = {
270
287
        "login": user_data.login,
271
288
        "nick": nickval,
272
289
        "email": emailval,
 
290
        "oldpass": oldpassval,
273
291
    }
274
292
    if (newpassval != null && newpassval != "")
275
293
        data['password'] = newpassval;