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

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/browser/media/browser.js

  • Committer: Matt Giuca
  • Date: 2010-02-23 04:38:33 UTC
  • Revision ID: matt.giuca@gmail.com-20100223043833-f73naxuzoz6ux7rm
browser.js: Fixed generation of links in file browser to Serve, Download and Share-this-file links containing special URI characters. Now properly URL-encoded. Added util.js app_url and public_app_url, replacing calls to app_path and public_app_path. Fixes Launchpad bug #524176.

Show diffs side-by-side

added added

removed removed

Lines of Context:
522
522
    var div = document.createElement("div");
523
523
    files.appendChild(div);
524
524
    div.setAttribute("class", "padding");
525
 
    var download_link = app_path(download_app, path);
 
525
    var download_link = app_url(download_app, path);
526
526
    var par1 = dom_make_text_elem("p",
527
527
        "The file " + path + " is a binary file. To download this file, " +
528
528
        "click the following link:");
627
627
              "return maybe_save('The last saved version will be served.')");
628
628
        if (numsel == 0)
629
629
            serve.setAttribute("href",
630
 
                app_path(serve_app, current_path));
 
630
                app_url(serve_app, current_path));
631
631
        else
632
632
            serve.setAttribute("href",
633
 
                app_path(serve_app, current_path, filename));
 
633
                app_url(serve_app, current_path, filename));
634
634
    }
635
635
    else
636
636
    {
686
686
        if (numsel == 0)
687
687
        {
688
688
            download.setAttribute("href",
689
 
                app_path(download_app, current_path));
 
689
                app_url(download_app, current_path));
690
690
            if (file.isdir)
691
691
                download.setAttribute("title",
692
692
                    "Download the current directory as a ZIP file");
697
697
        else
698
698
        {
699
699
            download.setAttribute("href",
700
 
                app_path(download_app, current_path, filename));
 
700
                app_url(download_app, current_path, filename));
701
701
            if (file.isdir)
702
702
                download.setAttribute("title",
703
703
                    "Download the selected directory as a ZIP file");
709
709
    else
710
710
    {
711
711
        /* Make a query string with all the files to download */
712
 
        var dlpath = urlencode_path(app_path(download_app, current_path)) + "?";
 
712
        var dlpath = app_url(download_app, current_path) + "?";
713
713
        for (var i=0; i<numsel; i++)
714
714
            dlpath += "path=" + encodeURIComponent(selected_files[i]) + "&";
715
715
        dlpath = dlpath.substr(0, dlpath.length-1);
854
854
        action_unpublish(selected_files);
855
855
        break;
856
856
    case "share":
857
 
        window.open(public_app_path("~" + current_path, filename), 'share')
 
857
        window.open(public_app_url("~" + current_path, filename), 'share')
858
858
        break;
859
859
    case "submit":
860
860
        if (selected_files.length == 1)
912
912
        action_revert(selected_files);
913
913
        break;
914
914
    case "svndiff":
915
 
        window.location = path_join(app_path('diff'), current_path, selected_files[0] || '');
 
915
        window.location = path_join(app_url('diff'), current_path, selected_files[0] || '');
916
916
        break;
917
917
    case "svnupdate":
918
918
        action_update(selected_files);
924
924
        action_commit(selected_files);
925
925
        break;
926
926
    case "svnlog":
927
 
        window.location = path_join(app_path('svnlog'), current_path, selected_files[0] || '');
 
927
        window.location = path_join(app_url('svnlog'), current_path, selected_files[0] || '');
928
928
        break;
929
929
    case "svncopy":
930
930
        action_svncopy(selected_files);