You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/02/22 20:38:31 UTC

svn commit: r379855 - in /incubator/roller/trunk/web: WEB-INF/classes/ApplicationResources.properties website/UploadFile.jsp

Author: snoopdave
Date: Wed Feb 22 11:38:30 2006
New Revision: 379855

URL: http://svn.apache.org/viewcvs?rev=379855&view=rev
Log:
Ripping out JavaScript from new File-Upload page, so we can work on Moz 1.4

Modified:
    incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
    incubator/roller/trunk/web/website/UploadFile.jsp

Modified: incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties?rev=379855&r1=379854&r2=379855&view=diff
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties Wed Feb 22 11:38:30 2006
@@ -1134,6 +1134,7 @@
 uploadFiles.button.delete=Delete Selected
 uploadFiles.uploadedFile=Uploaded file: {0}
 uploadFiles.deletedFiles=Deleted {0} file(s)
+uploadFiles.noFilesSpecified=You have chosen no files to upload
 
 # ------------------------------------------------------------------- User admin
 

Modified: incubator/roller/trunk/web/website/UploadFile.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/website/UploadFile.jsp?rev=379855&r1=379854&r2=379855&view=diff
==============================================================================
--- incubator/roller/trunk/web/website/UploadFile.jsp (original)
+++ incubator/roller/trunk/web/website/UploadFile.jsp Wed Feb 22 11:38:30 2006
@@ -10,56 +10,19 @@
 
 <script type="text/javascript">
 <!--
-var max = 9;
-var count = 0;
-function toggleMore(targetId) {
-    if (document.getElementById) {
-        ++count;
-        var id = targetId + count;
-        target = document.getElementById(id);
-        target.style.display = "inline";
-        if (count == max) {
-           target = document.getElementById("moreToggle");
-           target.style.display = "none";
-        }
-        target = document.getElementById("lessToggle");
-        target.style.display = "inline";
+function validate() {
+    valid = false;
+    for (i=0; i<5; i++) {
+       var field = document.getElementById("uploadFile" + i);
+       if (!isblank(field.value)) {
+          valid = true;
+          break;
+       }
     }
+    if (!valid) window.alert('<fmt:message key="uploadFiles.noFilesSpecified" />');
+    else document.forms[0].submit();
 }
-function toggleLess(targetId) {
-    if (document.getElementById) {
-        var id = targetId + count;
-        target = document.getElementById(id);
-        target.style.display = "none";
-        field = document.getElementById("uploadFile" + count);
-        field.value = "";
-        count--;
-        if (count == 0) {
-           target = document.getElementById("lessToggle");
-           target.style.display = "none";
-        }
-        target = document.getElementById("moreToggle");
-        target.style.display = "inline";
-   } 
-   fileChanged();
-}
-<%-- 
-Would be nice to disable submit button until a file has been
-chosen, but Netscape7 won't fire fileupload's onselected event.
-leaving this commented out for the day we drop support or Netscape7
---%>
-function fileChanged() {
-//   disabled = true;
-//   for (i=0; i<=9; i++) {
-//      field = document.getElementById("uploadFile" + i);
-//      if (!isblank(field.value)) {
-//         disabled = false;
-//         break;
-//      }
-//   }
-//   document.forms[0].submitButton.disabled = disabled;
-}
--->
+// -->
 </script>
 
 <p class="subtitle">
@@ -95,64 +58,29 @@
         <form name="uploadFiles" method="post" action="<%= edit %>" enctype="multipart/form-data">
             <br />
             
-            <input type="file" name="uploadedFile0" id="uploadFile0" size="30"     onselect="fileChanged()" onkeyup="fileChanged()" value="" /><br />
+            <input type="file" name="uploadedFile0" id="uploadFile0" size="30" /><br />
               
-            <div id="fileControl1" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile1" id="uploadFile1" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
+            <div id="fileControl1" class="miscControl">
+                <input type="file" name="uploadedFile1" id="uploadFile1" size="30" /><br />
             </div>                     
             
-            <div id="fileControl2" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile2" id="uploadFile2" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
+            <div id="fileControl2" class="miscControl">
+                <input type="file" name="uploadedFile2" id="uploadFile2" size="30" /><br />
             </div>                     
             
-            <div id="fileControl3" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile3" id="uploadFile3" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
+            <div id="fileControl3" class="miscControl">
+                <input type="file" name="uploadedFile3" id="uploadFile3" size="30" /><br />
             </div>                     
             
-            <div id="fileControl4" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile4" id="uploadFile4" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
-            </div>      
-               
-            <div id="fileControl5" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile5" id="uploadFile5" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
+            <div id="fileControl4" class="miscControl">
+                <input type="file" name="uploadedFile4" id="uploadFile4" size="30" /><br />
             </div>      
-               
-            <div id="fileControl6" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile6" id="uploadFile6" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
-            </div>      
-               
-            <div id="fileControl7" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile7" id="uploadFile7" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
-            </div>      
-               
-            <div id="fileControl8" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile8" id="uploadFile8" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
-            </div>      
-               
-            <div id="fileControl9" class="miscControl" style="display:none">
-                <input type="file" name="uploadedFile9" id="uploadFile9" size="30" onselect="fileChanged()" onkeyup="fileChanged()" /><br />
-            </div>          
-               
-            <div id="lessToggle" style="display:none; float:left;">
-                <a onclick="javascript:toggleLess('fileControl')">
-                   <img src='<c:url value="/images/delete.png"/>' style="padding:4px" title="Remove last from upload list" />
-                </a>
-            </div>
-            <div id="moreToggle" style="display:inline; float:left">
-                <a onclick="javascript:toggleMore('fileControl')">
-                    <img src='<c:url value="/images/add.png"/>' style="padding:4px" title="Add file to upload list" />
-                </a>
-            </div>
-         
+
             <br />
             <br />
             
-            <%-- 
-            Would be nice to disable submit button until a file has been
-            chosen, but Netscape7 won't fire fileupload's onselected event,
-            so here we have the submit button enabled from the start
-            --%>
-            <input name="submitButton" type="submit" value='<%= bundle.getString("uploadFiles.upload") %>' /> 
+            <input name="submitButton" type="button" onclick="validate()"
+                value='<%= bundle.getString("uploadFiles.upload") %>' /> 
             <input type="hidden" name="method" value="upload" />
             <input type="hidden" name="weblog" value='<%= model.getWebsite().getHandle() %>'>
             <br />