635
652
+ "can be seen by anyone on the web");
636
653
publish.textContent = "Publish";
638
submit.setAttribute("class", "choice");
639
submit.removeAttribute("disabled");
643
publish.setAttribute("class", "disabled");
644
publish.setAttribute("disabled", "disabled");
645
submit.setAttribute("class", "disabled");
646
submit.setAttribute("disabled", "disabled");
656
set_action_state("publish", pubcond);
657
set_action_state("submit", pubcond);
650
/* If exactly 1 non-directory file is selected/opened, and its parent
660
/* If exactly 1 non-directory file is selected, and its parent
651
661
* directory is published.
653
var share = document.getElementById("act_share");
654
if (numsel <= 1 && !file.isdir)
656
/* Work out if parent dir is published */
657
parentdir = current_file;
658
if (parentdir.published)
660
share.setAttribute("class", "choice");
661
share.removeAttribute("disabled");
663
share.setAttribute("class", "disabled");
664
share.setAttribute("disabled", "disabled");
669
share.setAttribute("class", "disabled");
670
share.setAttribute("disabled", "disabled");
663
set_action_state("share", numsel == 1 && !file.isdir &&
664
current_file.published);
674
667
/* If exactly 1 file is selected */
675
var rename = document.getElementById("act_rename");
678
rename.setAttribute("class", "choice");
679
rename.removeAttribute("disabled");
683
rename.setAttribute("class", "disabled");
684
rename.setAttribute("disabled", "disabled");
668
set_action_state("rename", numsel == 1);
687
670
/* Delete, cut, copy */
688
671
/* If >= 1 file is selected */
689
var act_delete = document.getElementById("act_delete");
690
var cut = document.getElementById("act_cut");
691
var copy = document.getElementById("act_copy");
694
act_delete.setAttribute("class", "choice");
695
act_delete.removeAttribute("disabled");
696
cut.setAttribute("class", "choice");
697
cut.removeAttribute("disabled");
698
copy.setAttribute("class", "choice");
699
copy.removeAttribute("disabled");
703
act_delete.setAttribute("class", "disabled");
704
act_delete.setAttribute("disabled", "disabled");
705
cut.setAttribute("class", "disabled");
706
cut.setAttribute("disabled", "disabled");
707
copy.setAttribute("class", "disabled");
708
copy.setAttribute("disabled", "disabled");
672
set_action_state("delete", numsel >= 1);
673
set_action_state("cut", numsel >= 1);
674
set_action_state("copy", numsel >= 1);
711
676
/* Paste, new file, new directory, upload */
712
677
/* Disable if the current file is not a directory */
713
if (!current_file.isdir)
715
var paste = document.getElementById("act_paste");
716
var newfile = document.getElementById("act_newfile");
717
var mkdir = document.getElementById("act_mkdir");
718
var upload = document.getElementById("act_upload");
719
paste.setAttribute("class", "disabled");
720
paste.setAttribute("disabled", "disabled");
721
newfile.setAttribute("class", "disabled");
722
newfile.setAttribute("disabled", "disabled");
723
mkdir.setAttribute("class", "disabled");
724
mkdir.setAttribute("disabled", "disabled");
725
upload.setAttribute("class", "disabled");
726
upload.setAttribute("disabled", "disabled");
678
set_action_state("paste", current_file.isdir);
679
set_action_state("newfile", current_file.isdir);
680
set_action_state("mkdir", current_file.isdir);
681
set_action_state("upload", current_file.isdir);
729
683
/* Subversion actions */
730
var svnadd = document.getElementById("act_svnadd");
731
684
var svndiff = document.getElementById("act_svndiff");
732
var svnrevert = document.getElementById("act_svnrevert");
733
var svncommit = document.getElementById("act_svncommit");
734
685
var svnlog = document.getElementById("act_svnlog");
735
686
/* These are only useful if we are in a versioned directory and have some
736
687
* files selected. */
737
if (numsel >= 1 && current_file.svnstatus)
739
svnadd.setAttribute("class", "choice");
740
svnadd.removeAttribute("disabled");
741
svnrevert.setAttribute("class", "choice");
742
svnrevert.removeAttribute("disabled");
743
svncommit.setAttribute("class", "choice");
744
svncommit.removeAttribute("disabled");
748
svnadd.setAttribute("class", "disabled");
749
svnadd.setAttribute("disabled", "disabled");
750
svnrevert.setAttribute("class", "disabled");
751
svnrevert.setAttribute("disabled", "disabled");
752
svncommit.setAttribute("class", "disabled");
753
svncommit.setAttribute("disabled", "disabled");
688
set_action_state("svnadd", numsel >= 1 && current_file.svnstatus);
689
set_action_state("svnrevert", numsel >= 1 && current_file.svnstatus);
690
set_action_state("svncommit", numsel >= 1 && current_file.svnstatus);
756
692
/* Diff and log only support one path at the moment. */
759
svnst = file_listing[selected_files[0]].svnstatus;
761
/* Diff and log also don't like unversioned paths, and diffs on unchanged
762
* files are pointless. */
763
if (svnst && svnst != "unversioned")
765
if (svnst != "normal")
767
svndiff.setAttribute("class", "choice");
768
svndiff.removeAttribute("disabled");
772
svndiff.setAttribute("class", "disabled");
773
svndiff.setAttribute("disabled", "disabled");
776
svnlog.setAttribute("class", "choice");
777
svnlog.removeAttribute("disabled");
782
svndiff.setAttribute("class", "disabled");
783
svndiff.setAttribute("disabled", "disabled");
784
svnlog.setAttribute("class", "disabled");
785
svnlog.setAttribute("disabled", "disabled");
788
var svncheckout = document.getElementById("act_svncheckout");
693
single_versioned_path = (numsel == 1 &&
694
(svnst = file_listing[selected_files[0]].svnstatus) &&
695
svnst != "unversioned");
696
set_action_state("svnlog", single_versioned_path);
697
set_action_state("svndiff", single_versioned_path && svnst != "normal");
789
699
/* current_path == username: We are at the top level */
790
if (current_path == username)
792
svncheckout.setAttribute("class", "choice");
793
svncheckout.removeAttribute("disabled");
797
svncheckout.setAttribute("class", "disabled");
798
svncheckout.setAttribute("disabled", "disabled");
700
set_action_state("svncheckout", current_path == username);
801
702
/* There is currently nothing on the More Actions menu of use
802
703
* when the current file is not a directory. Hence, just remove