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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2009-12-01 04:27:58 UTC
  • mfrom: (1164.2.46 sphinx-docs)
  • Revision ID: matt.giuca@gmail.com-20091201042758-wuxd9bdec00c283i
Merged sphinx-docs branch. This adds Sphinx documentation for the entire IVLE system (for system administrators and developers), and removes all of our random old document files (all either irrelevant, or moved into the Sphinx docs nicely). Currently incomplete, but ready to merge.

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
 
103
    {
 
104
        /* Refresh the page; as the user is now (apparently) logged in */
 
105
        window.location.href = parse_url(window.location.href).args["url"] || "/";
 
106
    }
88
107
}
89
108
 
90
109
function decline_license()
91
110
{
92
111
    /* Redirect to the logout page */
93
 
    window.location.href = app_path("logout");
 
112
    window.location.href = app_path("+logout");
94
113
}