735
632
+ "can be seen by anyone on the web");
736
633
publish.textContent = "Publish";
739
set_action_state(["publish", "submit"], pubcond);
635
submit.setAttribute("class", "choice");
636
submit.removeAttribute("disabled");
640
publish.setAttribute("class", "disabled");
641
publish.setAttribute("disabled", "disabled");
642
submit.setAttribute("class", "disabled");
643
submit.setAttribute("disabled", "disabled");
742
/* If exactly 1 non-directory file is selected, and its parent
647
/* If exactly 1 non-directory file is selected/opened, and its parent
743
648
* directory is published.
745
set_action_state("share", numsel == 1 && !file.isdir &&
746
current_file.published);
650
var share = document.getElementById("act_share");
651
if (numsel <= 1 && !file.isdir)
653
/* Work out if parent dir is published */
654
parentdir = current_file;
655
if (parentdir.published)
657
share.setAttribute("class", "choice");
658
share.removeAttribute("disabled");
660
share.setAttribute("class", "disabled");
661
share.setAttribute("disabled", "disabled");
666
share.setAttribute("class", "disabled");
667
share.setAttribute("disabled", "disabled");
749
671
/* If exactly 1 file is selected */
750
set_action_state("rename", numsel == 1);
672
var rename = document.getElementById("act_rename");
675
rename.setAttribute("class", "choice");
676
rename.removeAttribute("disabled");
680
rename.setAttribute("class", "disabled");
681
rename.setAttribute("disabled", "disabled");
752
684
/* Delete, cut, copy */
753
685
/* If >= 1 file is selected */
754
set_action_state(["delete", "cut", "copy"], numsel >= 1);
686
var act_delete = document.getElementById("act_delete");
687
var cut = document.getElementById("act_cut");
688
var copy = document.getElementById("act_copy");
691
act_delete.setAttribute("class", "choice");
692
act_delete.removeAttribute("disabled");
693
cut.setAttribute("class", "choice");
694
cut.removeAttribute("disabled");
695
copy.setAttribute("class", "choice");
696
copy.removeAttribute("disabled");
700
act_delete.setAttribute("class", "disabled");
701
act_delete.setAttribute("disabled", "disabled");
702
cut.setAttribute("class", "disabled");
703
cut.setAttribute("disabled", "disabled");
704
copy.setAttribute("class", "disabled");
705
copy.setAttribute("disabled", "disabled");
756
708
/* Paste, new file, new directory, upload */
757
709
/* Disable if the current file is not a directory */
758
set_action_state(["paste", "newfile", "mkdir", "upload"], current_file.isdir);
710
if (!current_file.isdir)
712
var paste = document.getElementById("act_paste");
713
var newfile = document.getElementById("act_newfile");
714
var mkdir = document.getElementById("act_mkdir");
715
var upload = document.getElementById("act_upload");
716
paste.setAttribute("class", "disabled");
717
paste.setAttribute("disabled", "disabled");
718
newfile.setAttribute("class", "disabled");
719
newfile.setAttribute("disabled", "disabled");
720
mkdir.setAttribute("class", "disabled");
721
mkdir.setAttribute("disabled", "disabled");
722
upload.setAttribute("class", "disabled");
723
upload.setAttribute("disabled", "disabled");
760
726
/* Subversion actions */
761
/* These are only useful if we are in a versioned directory and have some
763
set_action_state(["svnadd",], numsel >= 1 && current_file.svnstatus);
764
/* And these are only usefull is ALL the selected files are versioned */
765
set_action_state(["svnremove", "svnrevert", "svncommit", "svncopy",
766
"svncut"], numsel >= 1 && current_file.svnstatus && svn_selection);
768
/* Diff, log and update only support one path at the moment, so we must
769
* have 0 or 1 versioned files selected. If 0, the directory must be
771
single_versioned_path = (
773
(numsel == 1 && (svnst = file_listing[selected_files[0]].svnstatus)) ||
774
(numsel == 0 && (svnst = current_file.svnstatus))
775
) && svnst != "unversioned");
776
set_action_state(["svndiff", "svnupdate"], single_versioned_path);
778
/* We can resolve if we have a file selected and it is conflicted. */
779
set_action_state("svnresolved", single_versioned_path && numsel == 1 && svnst == "conflicted");
781
/* Log should be available for revisions as well. */
782
set_action_state("svnlog", single_versioned_path, true);
727
/* TODO: Work out when these are appropriate */
728
var svnadd = document.getElementById("act_svnadd");
729
var svnrevert = document.getElementById("act_svnrevert");
730
var svncommit = document.getElementById("act_svncommit");
733
svnadd.setAttribute("class", "choice");
734
svnadd.removeAttribute("disabled");
735
svnrevert.setAttribute("class", "choice");
736
svnrevert.removeAttribute("disabled");
737
svncommit.setAttribute("class", "choice");
738
svncommit.removeAttribute("disabled");
740
var svncheckout = document.getElementById("act_svncheckout");
741
/* current_path == username: We are at the top level */
742
if (current_path == username)
744
svncheckout.setAttribute("class", "choice");
745
svncheckout.removeAttribute("disabled");
749
svncheckout.setAttribute("class", "disabled");
750
svncheckout.setAttribute("disabled", "disabled");
784
753
/* There is currently nothing on the More Actions menu of use
785
754
* when the current file is not a directory. Hence, just remove
787
756
* (This makes some of the above decisions somewhat redundant).
788
* We also take this opportunity to show the appropriate actions2
789
* bar for this path. It should either be a save or upload widget.
791
if (current_file.isdir)
758
if (!(current_file.isdir))
793
var actions2_directory = document.getElementById("actions2_directory");
794
actions2_directory.setAttribute("style", "display: inline;");
795
760
var moreactions = document.getElementById("moreactions_area");
796
moreactions.setAttribute("style", "display: inline;");
800
var actions2_file = document.getElementById("actions2_file");
801
actions2_file.setAttribute("style", "display: inline;");
761
moreactions.setAttribute("style", "display: none;");