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

« back to all changes in this revision

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

  • Committer: drtomc
  • Date: 2008-02-25 02:23:18 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:561
app: improve the error message when an app fails to load.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    "application/x-javascript" : "text",
44
44
    "application/javascript" : "text",
45
45
    "application/json" : "text",
46
 
    "application/xml" : "text",
 
46
    "application/xml" : "text"
47
47
};
48
48
 
49
49
/* Mapping MIME types to icons, just the file's basename */
50
50
type_icons = {
51
51
    "text/directory": "dir.png",
52
 
    "text/x-python": "py.png",
 
52
    "text/x-python": "py.png"
53
53
};
54
54
 
55
55
default_type_icon = "txt.png";
65
65
    "added": "added.png",
66
66
    "missing": "missing.png",
67
67
    "deleted": "deleted.png",
68
 
    "modified": "modified.png",
 
68
    "modified": "modified.png"
69
69
};
70
70
 
71
71
/* Mapping SVN status to "nice" strings */
78
78
    "replaced": "Permanent file (replaced)",
79
79
    "modified": "Permanent file (modified)",
80
80
    "merged": "Permanent file (merged)",
81
 
    "conflicted": "Permanent file (conflicted)",
 
81
    "conflicted": "Permanent file (conflicted)"
82
82
};
83
83
 
84
84
default_svn_icon = null;
93
93
 * application can interpret them.
94
94
 */
95
95
types_exec = [
96
 
    "text/x-python",
 
96
    "text/x-python"
97
97
];
98
98
 
99
99
 
120
120
 *      Defaults to "application/x-www-form-urlencoded".
121
121
 *      "multipart/form-data" is recommended for large uploads.
122
122
 */
123
 
function do_action(action, path, args, content_type)
 
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
 
    handle_response(path, response);
 
139
    ajax_call(callback, service_app, path, args, "POST", content_type);
135
140
}
136
141
 
137
142
/** Calls the server using Ajax, requesting a directory listing. This should
146
151
 */
147
152
function navigate(path, editmode)
148
153
{
 
154
    callback = function(response)
 
155
        {
 
156
            /* Read the response and set up the page accordingly */
 
157
            handle_response(path, response, editmode);
 
158
        }
149
159
    /* Call the server and request the listing. This mutates the server. */
150
 
    response = ajax_call(service_app, path, null, "GET");
151
 
    /* Now read the response and set up the page accordingly */
152
 
    handle_response(path, response, editmode);
 
160
    ajax_call(callback, service_app, path, null, "GET");
153
161
}
154
162
 
155
163
/** Determines the "handler type" from a MIME type.