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

« back to all changes in this revision

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

  • Committer: wagrant
  • Date: 2008-07-17 05:27:51 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:909
listing.js: Remove duplication in get_dir_listing's row generation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
653
653
        row = document.createElement("tr");
654
654
        row.filename = filename;
655
655
        row.fileinfo = file;
 
656
 
656
657
        /* Column 1: Selection checkbox */
657
658
        row.setAttribute("class", "row" + row_toggle.toString())
658
659
        row_toggle = row_toggle == 1 ? 2 : 1;
665
666
        checkbox.checked = filename in sel_files_dict;
666
667
        td.appendChild(checkbox);
667
668
        row.appendChild(td);
 
669
 
 
670
        /* Column 2: Filetype and subversion icons. */
 
671
        td = document.createElement("td");
 
672
        td.setAttribute("class", "thincol");
 
673
        td.setAttribute("onclick", selection_string);
 
674
        /* Directories don't really have a MIME type, so we fake one. */
 
675
        if (file.isdir) file.type = "text/directory";
 
676
        td.appendChild(dom_make_img(mime_type_to_icon(file.type),
 
677
            icon_size, icon_size, file.type_nice));
 
678
        row.appendChild(td);
 
679
        td = document.createElement("td");
 
680
        td.setAttribute("class", "thincol");
 
681
        if (under_subversion)
 
682
        {
 
683
            var icon = svnstatus_to_icon(file.svnstatus);
 
684
            if (icon)
 
685
                td.appendChild(dom_make_img(icon, icon_size, icon_size,
 
686
                    svnstatus_to_string(file.svnstatus)));
 
687
        }
 
688
        row.appendChild(td);
 
689
 
 
690
        /* Column 3: Filename */
668
691
        if (file.isdir)
669
692
        {
670
 
            /* Column 2: Filetype and subversion icons. */
671
 
            td = document.createElement("td");
672
 
            td.setAttribute("class", "thincol");
673
 
            td.setAttribute("onclick", selection_string);
674
 
            td.appendChild(dom_make_img(mime_type_to_icon("text/directory"),
675
 
                icon_size, icon_size, file.type_nice));
676
 
            row.appendChild(td);
677
 
            td = document.createElement("td");
678
 
            td.setAttribute("class", "thincol");
679
 
            if (under_subversion)
680
 
            {
681
 
                var icon = svnstatus_to_icon(file.svnstatus);
682
 
                if (icon)
683
 
                    td.appendChild(dom_make_img(icon, icon_size, icon_size,
684
 
                        svnstatus_to_string(file.svnstatus)));
685
 
            }
686
 
            row.appendChild(td);
687
 
            /* Column 3: Filename */
688
693
            td = dom_make_link_elem("td", filename,
689
 
                "Navigate to " + path_join(path, filename),
690
 
                app_path(this_app, path, filename)/*,
691
 
                "navigate(" + repr(path_join(path, filename)) + ")"*/);
692
 
            td.setAttribute("onclick", selection_string);
693
 
            row.appendChild(td);
 
694
                 "Navigate to " + path_join(path, filename),
 
695
                 app_path(this_app, path, filename));
694
696
        }
695
697
        else
696
698
        {
697
 
            /* Column 2: Filetype and subversion icons. */
698
 
            td = document.createElement("td");
699
 
            td.setAttribute("class", "thincol");
700
 
            td.appendChild(dom_make_img(mime_type_to_icon(file.type),
701
 
                icon_size, icon_size, file.type_nice));
702
 
            row.appendChild(td);
703
 
            td = document.createElement("td");
704
 
            td.setAttribute("class", "thincol");
705
 
            if (under_subversion)
706
 
            {
707
 
                var icon = svnstatus_to_icon(file.svnstatus);
708
 
                if (icon)
709
 
                    td.appendChild(dom_make_img(icon, icon_size, icon_size,
710
 
                        svnstatus_to_string(file.svnstatus)));
711
 
            }
712
 
            row.appendChild(td);
713
 
            /* Column 3: Filename */
714
699
            td = dom_make_text_elem("td", filename);
715
 
            td.setAttribute("onclick", selection_string);
716
 
            row.appendChild(td);
717
700
        }
 
701
        td.setAttribute("onclick", selection_string);
 
702
        row.appendChild(td);
 
703
 
718
704
        /* Column 4: Size */
719
705
        td = dom_make_text_elem("td", nice_filesize(file.size));
720
706
        td.setAttribute("onclick", selection_string);
721
707
        row.appendChild(td);
722
 
        /* Column 4: Date */
 
708
 
 
709
        /* Column 5: Date */
723
710
        td = dom_make_text_elem("td", file.mtime_short, file.mtime_nice);
724
711
        td.setAttribute("onclick", selection_string);
725
712
        row.appendChild(td);