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

« back to all changes in this revision

Viewing changes to www/media/common/tos.js

  • Committer: William Grant
  • Date: 2009-01-19 04:18:20 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090119041820-z6t1a5tmpfzcf6ny
ivle.makeuser: Port rebuild_svn_group_config() to Storm.

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 = window.location.href;
 
106
    }
88
107
}
89
108
 
90
109
function decline_license()