~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-27 00:00:38 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:594
Added to doc/setup/faq.txt: sessions directory.

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";
66
66
    "missing": "missing.png",
67
67
    "deleted": "deleted.png",
68
68
    "modified": "modified.png",
 
69
    "revision": "revision.png"
69
70
};
70
71
 
71
72
/* Mapping SVN status to "nice" strings */
79
80
    "modified": "Permanent file (modified)",
80
81
    "merged": "Permanent file (merged)",
81
82
    "conflicted": "Permanent file (conflicted)",
 
83
    "revision": "Past Permanent file (revision)"
82
84
};
83
85
 
84
86
default_svn_icon = null;
93
95
 * application can interpret them.
94
96
 */
95
97
types_exec = [
96
 
    "text/x-python",
 
98
    "text/x-python"
97
99
];
98
100
 
99
101
 
120
122
 *      Defaults to "application/x-www-form-urlencoded".
121
123
 *      "multipart/form-data" is recommended for large uploads.
122
124
 */
123
 
function do_action(action, path, args, content_type)
 
125
function do_action(action, path, args, content_type, ignore_response)
124
126
{
125
127
    args.action = action;
 
128
    /* Callback action, when the server returns */
 
129
    var callback = function(response)
 
130
        {
 
131
            /* Check for action errors reported by the server, and report them
 
132
             * to the user */
 
133
            var error = response.getResponseHeader("X-IVLE-Action-Error");
 
134
            if (error != null)
 
135
                alert("Error: " + error.toString() + ".");
 
136
            /* Now read the response and set up the page accordingly */
 
137
            if (ignore_response != true)
 
138
                handle_response(path, response);
 
139
        }
126
140
    /* 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);
 
141
    ajax_call(callback, service_app, path, args, "POST", content_type);
135
142
}
136
143
 
137
144
/** Calls the server using Ajax, requesting a directory listing. This should
146
153
 */
147
154
function navigate(path, editmode)
148
155
{
 
156
    callback = function(response)
 
157
        {
 
158
            /* Read the response and set up the page accordingly */
 
159
            handle_response(path, response, editmode);
 
160
        }
 
161
    /* Get any query strings */
 
162
    url = parse_url(window.location.href);
 
163
    
149
164
    /* 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);
 
165
    ajax_call(callback, service_app, path, url.args, "GET");
153
166
}
154
167
 
155
168
/** Determines the "handler type" from a MIME type.