~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-01-23 00:14:53 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:269
browser: Added publish functionality to JavaScript client side.
Added "published" icon.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
    return false;
93
93
}
94
94
 
 
95
function action_publish(files)
 
96
{
 
97
    do_action("svnpublish", current_path, {"path":files});
 
98
    return false;
 
99
}
 
100
 
 
101
function action_unpublish(files)
 
102
{
 
103
    do_action("svnunpublish", current_path, {"path":files});
 
104
    return false;
 
105
}
 
106
 
95
107
function action_commit(files)
96
108
{
97
109
    /* Get a commit log from the user */
149
161
        sidepanel.appendChild(p);
150
162
        p = dom_make_text_elem("p", filetype_nice);
151
163
        sidepanel.appendChild(p);
 
164
        var mini_icons = document.createElement("p");
 
165
        sidepanel.appendChild(mini_icons);
 
166
        var icon;
152
167
        if (under_subversion)
153
168
        {
154
 
            p = document.createElement("p");
155
 
            var icon = svnstatus_to_icon(file.svnstatus);
 
169
            icon = svnstatus_to_icon(file.svnstatus);
156
170
            if (icon)
157
 
                p.appendChild(dom_make_img(icon, icon_size, icon_size,
 
171
                mini_icons.appendChild(dom_make_img(icon, icon_size, icon_size,
158
172
                    svnstatus_to_string(file.svnstatus)));
159
 
            sidepanel.appendChild(p);
160
173
            p = dom_make_text_elem("p", svnstatus_to_string(file.svnstatus));
161
174
            sidepanel.appendChild(p);
162
175
        }
 
176
        if ("published" in file && file.published)
 
177
        {
 
178
            icon = make_path(path_join(published_icon));
 
179
            if (icon)
 
180
            {
 
181
                if (mini_icons.childNodes.length > 0)
 
182
                    mini_icons.appendChild(document.createTextNode(" "));
 
183
                mini_icons.appendChild(dom_make_img(icon, icon_size, icon_size,
 
184
                    "Published directory"));
 
185
            }
 
186
            p = dom_make_text_elem("p", "Published directory");
 
187
            p.setAttribute("title",
 
188
                "Anybody on the web can view the files in this directory.");
 
189
            sidepanel.appendChild(p);
 
190
        }
 
191
        /* If we never wrote any mini-icons, remove this element */
 
192
        if (mini_icons.childNodes.length == 0)
 
193
            sidepanel.removeChild(mini_icons);
163
194
        if ("size" in file)
164
195
        {
165
196
            p = dom_make_text_elem("p", "Size: " + nice_filesize(file.size));
190
221
    p = dom_make_text_elem("h3", "Actions");
191
222
    sidepanel.appendChild(p);
192
223
 
 
224
    if (file.isdir)
 
225
    {
 
226
        /* Publish/unpublish */
 
227
        if (selected_files.length == 0)
 
228
            path = ".";
 
229
        else
 
230
            path = filename;
 
231
        if ("published" in file && file.published)
 
232
        {
 
233
            p = dom_make_link_elem("p", "Unpublish",
 
234
                "Make it so this directory cannot be seen by anyone but you",
 
235
                null,
 
236
                "return action_unpublish(" + repr(path) + ")");
 
237
            sidepanel.appendChild(p);
 
238
        }
 
239
        else
 
240
        {
 
241
            p = dom_make_link_elem("p", "Publish",
 
242
                "Make it so this directory can be seen by anyone on the web",
 
243
                null,
 
244
                "return action_publish(" + repr(path) + ")");
 
245
            sidepanel.appendChild(p);
 
246
        }
 
247
    }
 
248
 
193
249
    if (selected_files.length <= 1)
194
250
    {
195
251
        var handler_type = null;
241
297
        if (p)
242
298
            sidepanel.appendChild(p);
243
299
 
244
 
        p = dom_make_link_elem("p", "Rename",
245
 
            "Change the name of this file", null,
246
 
            "return action_rename(" + repr(filename) + ")");
247
 
        sidepanel.appendChild(p);
 
300
        if (selected_files.length > 0)
 
301
        {   /* Can't rename if we're in it */
 
302
            p = dom_make_link_elem("p", "Rename",
 
303
                "Change the name of this file", null,
 
304
                "return action_rename(" + repr(filename) + ")");
 
305
            sidepanel.appendChild(p);
 
306
        }
248
307
    }
249
308
    else
250
309
    {
259
318
    }
260
319
 
261
320
    /* Common actions */
262
 
    p = dom_make_link_elem("p", "Delete",
263
 
        "Delete the selected files", null,
264
 
        "return action_remove(selected_files)");
265
 
    sidepanel.appendChild(p);
266
 
    p = dom_make_link_elem("p", "Cut",
267
 
        "Prepare to move the selected files to another directory", null,
268
 
        "return action_cut(selected_files)");
269
 
    sidepanel.appendChild(p);
270
 
    p = dom_make_link_elem("p", "Copy",
271
 
        "Prepare to copy the selected files to another directory", null,
272
 
        "return action_copy(selected_files)");
273
 
    sidepanel.appendChild(p);
 
321
    if (selected_files.length > 0)
 
322
    {
 
323
        p = dom_make_link_elem("p", "Delete",
 
324
            "Delete the selected files", null,
 
325
            "return action_remove(selected_files)");
 
326
        sidepanel.appendChild(p);
 
327
        p = dom_make_link_elem("p", "Cut",
 
328
            "Prepare to move the selected files to another directory", null,
 
329
            "return action_cut(selected_files)");
 
330
        sidepanel.appendChild(p);
 
331
        p = dom_make_link_elem("p", "Copy",
 
332
            "Prepare to copy the selected files to another directory", null,
 
333
            "return action_copy(selected_files)");
 
334
        sidepanel.appendChild(p);
 
335
    }
274
336
    p = dom_make_link_elem("p", "Paste",
275
337
        "Paste the copied or cut files to the current directory", null,
276
338
        "return action_paste()");