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

« back to all changes in this revision

Viewing changes to ivle/webapp/tos/media/tos.js

  • Committer: William Grant
  • Date: 2010-02-17 12:00:09 UTC
  • Revision ID: grantw@unimelb.edu.au-20100217120009-o48s4r1junx8oq8n
Tags: 1.0beta2
Drop version number to 1.0beta2. We are going in for another one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    var tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
67
67
    dom_removechildren(tos_acceptbuttons);
68
68
    /* Print a "please wait" message */
69
 
    /* XXX: The current implementation of Ajax is SYNCHRONOUS.
70
 
     * That means we return right away; the animation won't work properly.
71
 
     */
72
69
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
73
70
        "IVLE is now setting up your environment. Please wait..."));
74
71
    tos_acceptbuttons.appendChild(make_dots_anim());
75
72
    /* Make the Ajax request */
76
 
    var xhr = ajax_call("userservice", "activate_me", USER_DECLARATION,
77
 
        "POST")
78
 
    handle_accept_response(xhr)
 
73
    ajax_call(handle_accept_response, "userservice", "activate_me",
 
74
        USER_DECLARATION, "POST")
79
75
}
80
76
 
81
77
function handle_accept_response(xhr)
83
79
    /* TEMP */
84
80
    var tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
85
81
    dom_removechildren(tos_acceptbuttons);
86
 
    /* Refresh the page; as the user is now (apparently) logged in */
87
 
    window.location.reload()
 
82
 
 
83
    try
 
84
    {
 
85
        response = JSON.parse(xhr.responseText);
 
86
    }
 
87
    catch (e)
 
88
    {
 
89
        response = {'response': 'parse-failure'};
 
90
    }
 
91
 
 
92
    if (response.response == 'usrmgt-failure')
 
93
    {
 
94
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
 
95
        "Error connecting to User Management server. Please try again later.")); 
 
96
    }
 
97
    else if (response.response == 'parse-failure')
 
98
    {
 
99
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
 
100
        "Error connecting to server. Please try again later. "));
 
101
    }
 
102
    else if (response.response == 'error')
 
103
    {
 
104
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
 
105
        "Error activating user: " + response.message));
 
106
    }
 
107
    else
 
108
    {
 
109
        /* Refresh the page; as the user is now (apparently) logged in */
 
110
        window.location.href = parse_url(window.location.href).args["url"] || "/";
 
111
    }
88
112
}
89
113
 
90
114
function decline_license()
91
115
{
92
116
    /* Redirect to the logout page */
93
 
    window.location.href = app_path("logout");
 
117
    window.location.href = app_path("+logout");
94
118
}