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

« back to all changes in this revision

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

  • Committer: wagrant
  • Date: 2008-07-08 04:38:03 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:829
Add an svndiff action, and give it an option in the action listbox.
Enable it and the other SVN actions only when appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
724
724
    }
725
725
 
726
726
    /* Subversion actions */
727
 
    /* TODO: Work out when these are appropriate */
728
727
    var svnadd = document.getElementById("act_svnadd");
 
728
    var svndiff = document.getElementById("act_svndiff");
729
729
    var svnrevert = document.getElementById("act_svnrevert");
730
730
    var svncommit = document.getElementById("act_svncommit");
731
 
    if (true)
 
731
    /* These are only useful if we are in a versioned directory and have some
 
732
     * files selected. */
 
733
    if (numsel >= 1 && current_file.svnstatus)
732
734
    {
733
735
        svnadd.setAttribute("class", "choice");
734
736
        svnadd.removeAttribute("disabled");
737
739
        svncommit.setAttribute("class", "choice");
738
740
        svncommit.removeAttribute("disabled");
739
741
    }
 
742
    else
 
743
    {
 
744
        svnadd.setAttribute("class", "disabled");
 
745
        svnadd.setAttribute("disabled", "disabled");
 
746
        svnrevert.setAttribute("class", "disabled");
 
747
        svnrevert.setAttribute("disabled", "disabled");
 
748
        svncommit.setAttribute("class", "disabled");
 
749
        svncommit.setAttribute("disabled", "disabled");
 
750
    }
 
751
 
 
752
    /* Diff only supports one path at the moment. */
 
753
    if (numsel == 1)
 
754
    {
 
755
        svnst = file_listing[selected_files[0]].svnstatus;
 
756
 
 
757
        /* Diff also doesn't like unversioned paths, and diffs on unchanged
 
758
         * files are pointless. */
 
759
        if (svnst && svnst != "unversioned" && svnst != "normal")
 
760
        {
 
761
            svndiff.setAttribute("class", "choice");
 
762
            svndiff.removeAttribute("disabled");
 
763
        }
 
764
    }
 
765
    else
 
766
    {
 
767
        svndiff.setAttribute("class", "disabled");
 
768
        svndiff.setAttribute("disabled", "disabled");
 
769
    }
 
770
 
740
771
    var svncheckout = document.getElementById("act_svncheckout");
741
772
    /* current_path == username: We are at the top level */
742
773
    if (current_path == username)
832
863
    case "svnrevert":
833
864
        action_revert(selected_files);
834
865
        break;
 
866
    case "svndiff":
 
867
        window.location = path_join(app_path('diff'), current_path, selected_files[0]);
 
868
        break;
835
869
    case "svncommit":
836
870
        action_commit(selected_files);
837
871
        break;