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

« back to all changes in this revision

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

  • Committer: wagrant
  • Date: 2008-07-17 06:28:23 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:910
filebrowser_lib: Send the current revision along with the listing if we
                 are a revision browser.
browser: Link to the currently selected revision of each file.

I think we are now a useful (and fairly complete) revision browser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
/** The listing object returned by the server as JSON */
105
105
file_listing = null;
106
106
current_file = null;
 
107
current_revision = null;
107
108
current_path = "";
108
109
 
109
110
/** Filenames of all files selected
287
288
    current_file = file_listing["."];     /* Global */
288
289
    delete file_listing["."];
289
290
 
 
291
    if ('revision' in listing)
 
292
    {
 
293
        current_revision = listing.revision;
 
294
    }
 
295
 
290
296
    /* Check if this is a directory listing or file contents */
291
297
    var isdir = response.getResponseHeader("X-IVLE-Return") == "Dir";
292
298
    if (isdir)
427
433
    files.appendChild(txt_elem);
428
434
}
429
435
 
 
436
/** Given a path, filename and optional revision, returns a URL to open that
 
437
 *  revision of that file.
 
438
 */
 
439
function build_revision_url(path, filename, revision)
 
440
{
 
441
    bits = {'path': app_path(this_app, path, filename)};
 
442
    if (current_revision)
 
443
    {
 
444
        bits['query_string'] = 'r=' + revision;
 
445
    }
 
446
    return build_url(bits);
 
447
}
 
448
 
430
449
/** Given a mime type, returns the path to the icon.
431
450
 * \param type String, Mime type.
432
451
 * \param sizelarge Boolean, optional.
550
569
        else
551
570
            open.setAttribute("title",
552
571
                "Edit or view this file");
553
 
        open.setAttribute("href", app_path(this_app, current_path, filename));
 
572
        open.setAttribute("href", build_revision_url(current_path, filename,
 
573
                                                     current_revision));
554
574
    }
555
575
    else
556
576
    {