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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-02-24 22:09:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:553
Added new app: Settings (UI for userservice).
    (Added app dir, media dir with empty JS file, icon).
apps/__init__.py: Added error message.
dispatch/__init__.py: Added error message.
dispatch/html.py: Added link to Settings at the top
    (a special app).
    Fixed HTML icons (correct size link).
    Catch keyerror on icon which would otherwise be thrown all
    the way up on certain errors.

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
     */
69
72
    tos_acceptbuttons.appendChild(dom_make_text_elem("p",
70
73
        "IVLE is now setting up your environment. Please wait..."));
71
74
    tos_acceptbuttons.appendChild(make_dots_anim());
72
75
    /* Make the Ajax request */
73
 
    ajax_call(handle_accept_response, "userservice", "activate_me",
74
 
        USER_DECLARATION, "POST")
 
76
    var xhr = ajax_call("userservice", "activate_me", USER_DECLARATION,
 
77
        "POST")
 
78
    handle_accept_response(xhr)
75
79
}
76
80
 
77
81
function handle_accept_response(xhr)
79
83
    /* TEMP */
80
84
    var tos_acceptbuttons = document.getElementById("tos_acceptbuttons");
81
85
    dom_removechildren(tos_acceptbuttons);
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
 
    }
 
86
    /* Refresh the page; as the user is now (apparently) logged in */
 
87
    window.location.reload()
107
88
}
108
89
 
109
90
function decline_license()
110
91
{
111
92
    /* Redirect to the logout page */
112
 
    window.location.href = app_path("+logout");
 
93
    window.location.href = app_path("logout");
113
94
}