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

« back to all changes in this revision

Viewing changes to www/media/browser/browser.js

  • Committer: mattgiuca
  • Date: 2008-02-25 01:17:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:560
settings: Python code generates all of the HTML for the static page.
The JavaScript makes a call to get the data but doesn't yet populate the page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
function do_action(action, path, args, content_type, ignore_response)
124
124
{
125
125
    args.action = action;
 
126
    /* Callback action, when the server returns */
 
127
    var callback = function(response)
 
128
        {
 
129
            /* Check for action errors reported by the server, and report them
 
130
             * to the user */
 
131
            var error = response.getResponseHeader("X-IVLE-Action-Error");
 
132
            if (error != null)
 
133
                alert("Error: " + error.toString() + ".");
 
134
            /* Now read the response and set up the page accordingly */
 
135
            if (ignore_response != true)
 
136
                handle_response(path, response);
 
137
        }
126
138
    /* Call the server and perform the action. This mutates the server. */
127
 
    response = ajax_call(service_app, path, args, "POST", content_type);
128
 
    /* Check for action errors reported by the server, and report them to the
129
 
     * user */
130
 
    error = response.getResponseHeader("X-IVLE-Action-Error");
131
 
    if (error != null)
132
 
        alert("Error: " + error.toString() + ".");
133
 
    /* Now read the response and set up the page accordingly */
134
 
    if (ignore_response != true)
135
 
        handle_response(path, response);
 
139
    ajax_call(callback, service_app, path, args, "POST", content_type);
136
140
}
137
141
 
138
142
/** Calls the server using Ajax, requesting a directory listing. This should
147
151
 */
148
152
function navigate(path, editmode)
149
153
{
 
154
    callback = function(response)
 
155
        {
 
156
            /* Read the response and set up the page accordingly */
 
157
            handle_response(path, response, editmode);
 
158
        }
150
159
    /* Call the server and request the listing. This mutates the server. */
151
 
    response = ajax_call(service_app, path, null, "GET");
152
 
    /* Now read the response and set up the page accordingly */
153
 
    handle_response(path, response, editmode);
 
160
    ajax_call(callback, service_app, path, null, "GET");
154
161
}
155
162
 
156
163
/** Determines the "handler type" from a MIME type.