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

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/browser/media/browser.js

  • Committer: William Grant
  • Date: 2009-12-02 05:13:18 UTC
  • mfrom: (1328 trunk)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20091202051318-delr1lu69zri05gz
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
 *      May be "application/x-www-form-urlencoded" or "multipart/form-data".
135
135
 *      Defaults to "application/x-www-form-urlencoded".
136
136
 *      "multipart/form-data" is recommended for large uploads.
 
137
 * \param callback, optional.
 
138
 *      A callback function for after the action has been handled.
137
139
 */
138
 
function do_action(action, path, args, content_type, ignore_response)
 
140
function do_action(action, path, args, content_type, callback)
139
141
{
140
142
    args.action = action;
141
143
    /* Callback action, when the server returns */
142
 
    var callback = function(response)
 
144
    var callback_inner = function(response)
143
145
        {
144
146
            /* Check for action errors reported by the server, and report them
145
147
             * to the user */
149
151
                 * allow multi-line error messages. Decode */
150
152
                alert("Error: " + decodeURIComponent(error.toString()) + ".");
151
153
            /* Now read the response and set up the page accordingly */
152
 
            if (ignore_response != true)
153
 
                handle_response(path, response, true);
 
154
            if (callback != null)
 
155
                callback(path, response);
154
156
        }
155
157
    /* Call the server and perform the action. This mutates the server. */
156
 
    ajax_call(callback, service_app, path, args, "POST", content_type);
 
158
    ajax_call(callback_inner, service_app, path, args, "POST", content_type);
157
159
}
158
160
 
159
161
/** Calls the server using Ajax, requesting a directory listing. This should
781
783
    /* Log should be available for revisions as well. */
782
784
    set_action_state("svnlog", single_versioned_path, true);
783
785
 
 
786
    /* Cleanup should be available for revisions as well. */
 
787
    set_action_state("svncleanup", single_versioned_path, true);
 
788
 
784
789
    single_ivle_versioned_path = (
785
790
         (
786
791
          (numsel == 1 && (stat = file_listing[selected_files[0]])) ||
921
926
    case "svncut":
922
927
        action_svncut(selected_files);
923
928
        break;
 
929
    case "svncleanup":
 
930
        action_svncleanup(".");
 
931
        break;
924
932
    }
925
933
}
926
934
 
948
956
     * This causes the page to be populated with whatever is at that address,
949
957
     * whether it be a directory or a file.
950
958
     */
 
959
    var path = get_path();
 
960
    navigate(path);
 
961
}
 
962
 
 
963
/** Gets the current path of the window */
 
964
function get_path() {
951
965
    var path = parse_url(window.location.href).path;
952
966
    /* Strip out root_dir + "/files" from the front of the path */
953
967
    var strip = make_path(this_app);
970
984
        path = username;
971
985
    }
972
986
 
973
 
    navigate(path);
 
987
    return path;
974
988
}