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

« back to all changes in this revision

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

  • Committer: chadnickbok
  • Date: 2009-01-19 22:56:46 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1170
This commit fixes issue #10 and part of issue #9

There are now two options for moving files with their
svn history intact; svn move and svn copy. These
use the svn commands to move the files, allowing students
to move and rename files without their histories being
lost.

This commit also shows the svn status of a dir, if it is
the 'head' of an svn repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
{
146
146
    /* Get the "clipboard" object from the browser cookie */
147
147
    var clip_obj = read_cookie("clipboard");
 
148
    var under_subversion;
 
149
    
148
150
    if (clip_obj == null)
149
151
    {
150
152
        alert("No files have been cut or copied.");
151
153
        return false;
152
154
    }
 
155
 
 
156
    if (clip_obj.mode == "svnmove" || clip_obj.mode == "svncopy")
 
157
    {
 
158
        under_subversion = ("svnstatus" in current_file) && 
 
159
                                (current_file.svnstatus != "unversioned");
 
160
        if (!under_subversion)
 
161
        {
 
162
            alert("Cannot perform an Subversion Move outside of"
 
163
                                                + " Permanent directories!");
 
164
            return false;
 
165
        }        
 
166
    }
 
167
    
153
168
    /* The clip_obj is exactly what we want to pass, plus the current path
154
169
     * as destination. */
155
170
    clip_obj.dst = ".";
157
172
    return false;
158
173
}
159
174
 
 
175
function action_svncopy(files)
 
176
{
 
177
    action_copy_or_cut(files, "svncopy");
 
178
    return false;
 
179
}
 
180
 
 
181
function action_svncut(files)
 
182
{
 
183
    action_copy_or_cut(files, "svnmove");
 
184
    return false;
 
185
}
 
186
 
160
187
function action_add(files)
161
188
{
162
189
    do_action("svnadd", current_path, {"path":files});
689
716
        row.appendChild(td);
690
717
        td = document.createElement("td");
691
718
        td.setAttribute("class", "thincol");
692
 
        if (under_subversion)
693
 
        {
694
 
            var icon = svnstatus_to_icon(file.svnstatus);
695
 
            if (icon)
696
 
                td.appendChild(dom_make_img(icon, icon_size, icon_size,
697
 
                    svnstatus_to_string(file.svnstatus)));
698
 
        }
 
719
        var icon = svnstatus_to_icon(file.svnstatus);
 
720
        if (icon)
 
721
            td.appendChild(dom_make_img(icon, icon_size, icon_size,
 
722
                                        svnstatus_to_string(file.svnstatus)));
699
723
        row.appendChild(td);
700
724
 
701
725
        /* Column 3: Filename */