[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 02 Nov 2007 19:24:44 -0000


albertel		Fri Nov  2 15:24:44 2007 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm 
  Log:
  - BUG#5508 warn on no action selected
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.104 loncom/publisher/lonpubdir.pm:1.105
--- loncom/publisher/lonpubdir.pm:1.104	Thu Oct 18 17:58:21 2007
+++ loncom/publisher/lonpubdir.pm	Fri Nov  2 15:24:44 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.104 2007/10/18 21:58:21 albertel Exp $
+# $Id: lonpubdir.pm,v 1.105 2007/11/02 19:24:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -362,11 +362,12 @@
                                        move => 'Move current file to',
                                        copy => 'Copy current file to',
                                        type => 'Type Name Here',
-                                       go => 'Go',
+                                       go   => 'Go',
                                        prnt => 'Print contents of directory',
                                        crea => 'Create a new directory or LON-CAPA document',
 				       acti => 'Actions for current directory',
-				       updc => 'Upload a new document'
+				       updc => 'Upload a new document',
+				       pick => 'Please select an action to perform using the new filename',
                                       );
     $r->print(<<END);
         <table id="LC_cstr_controls">
@@ -406,19 +407,29 @@
 	    <form name="fileaction" method="post" action="/adm/cfile" target="_parent">
 	      <span style="white-space: nowrap">
 		<input type="hidden" name="filename" value="/~$uname$thisdisfn/" />
-			  <select name="action">
-			    <option value="Select Action">$lt{'sela'}</option>
-			    <option value="newfile">$lt{'nfil'}:</option>
-			    <option value="newhtmlfile">$lt{'nhtm'}:</option>
-			    <option value="newproblemfile">$lt{'nprb'}:</option>
-                            <option value="newpagefile">$lt{'npag'}:</option>
-                            <option value="newsequencefile">$lt{'nseq'}:</option>
-                            <option value="newrightsfile">$lt{'ncrf'}:</option>
-                            <option value="newstyfile">$lt{'nsty'}:</option>
-                            <option value="newtaskfile">$lt{'nbt'}:</option>
-                            <option value="newlibraryfile">$lt{'nlib'}:</option>
-			    <option value="newdir">$lt{'nsub'}:</option>
-		  </select>&nbsp;<input type="text" name="newfilename" value="Type Name Here" onfocus="if (this.value == 'Type Name Here') this.value=''" />&nbsp;<input type="button" value="Go" onclick="document.fileaction.submit()" />
+                  <script type="text/javascript">
+                    function validate_go() {
+                        var selected = document.fileaction.action.selectedIndex;
+                        if (selected == 0) {
+                            alert('$lt{'pick'}');
+                        } else {
+                            document.fileaction.submit();
+                        }
+                    }
+                  </script>
+		  <select name="action">
+		    <option value="none">$lt{'sela'}</option>
+		    <option value="newfile">$lt{'nfil'}:</option>
+		    <option value="newhtmlfile">$lt{'nhtm'}:</option>
+		    <option value="newproblemfile">$lt{'nprb'}:</option>
+                    <option value="newpagefile">$lt{'npag'}:</option>
+                    <option value="newsequencefile">$lt{'nseq'}:</option>
+                    <option value="newrightsfile">$lt{'ncrf'}:</option>
+                    <option value="newstyfile">$lt{'nsty'}:</option>
+                    <option value="newtaskfile">$lt{'nbt'}:</option>
+                    <option value="newlibraryfile">$lt{'nlib'}:</option>
+	            <option value="newdir">$lt{'nsub'}:</option>
+		  </select>&nbsp;<input type="text" name="newfilename" value="Type Name Here" onfocus="if (this.value == 'Type Name Here') this.value=''" />&nbsp;<input type="button" value="Go" onclick="validate_go();" />
 		 </span>
 		</form>
 	  </td>