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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-02-28 05:19:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:602
util.js: Added shallow_copy_object function.
fileservice: Removed temp code causing return=contents to be the default.
    Now return=listing is the default, so you will not get file contents
    unless you explicitly say "return=contents".
browser: Moved the code to handle a dir listing somewhat from listing.js
    to browser.js, and applies to all returns. Now even non-dir files have a
    listing - all files have a file_listing and current_file global variable,
    which means the correct processing can now be done on files and dirs.
    For non-dir files, it now makes a SECOND Ajax request to get the contents,
    which it then handles in the way it always has (in the text editor or
    a binary form).
    (Suggested by Tom Conway).

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
/* DOM nodeType constants */
32
32
ELEMENT_NODE = 1;
33
33
 
34
 
/** The listing object returned by the server as JSON */
35
 
file_listing = null;
36
 
thisdir = null;
37
 
 
38
34
/** The current sort order (a list of fields to sort by, in order of
39
35
 * priority), and whether it is ascending or descending. */
40
36
sort_order = [];
170
166
    var p;
171
167
    var div;
172
168
    /* Is this dir under svn? */
173
 
    var under_subversion = "svnstatus" in thisdir;
 
169
    var under_subversion = "svnstatus" in current_file;
174
170
    dom_removechildren(sidepanel);
175
171
    if (selected_files.length <= 1)
176
172
    {
178
174
        {
179
175
            /* Display information about the current directory instead */
180
176
            filename = path_basename(current_path);
181
 
            file = thisdir;
 
177
            file = current_file;
182
178
        }
183
179
        else if (selected_files.length == 1)
184
180
        {
765
761
    var row_toggle = 1;
766
762
    /* Nav through the top-level of the JSON to the actual listing object. */
767
763
    var listing = listing.listing;
768
 
    file_listing = listing;     /* Global */
769
764
 
770
 
    /* Get "." out, it's special */
771
 
    thisdir = listing["."];     /* Global */
772
 
    delete listing["."];
773
765
    /* Is this dir under svn? */
774
 
    var under_subversion = "svnstatus" in thisdir;
 
766
    var under_subversion = "svnstatus" in current_file;
775
767
 
776
768
    var files = document.getElementById("files");
777
769
    var file;