[LON-CAPA-cvs] cvs: loncom /interface londocs.pm /javascriptlib file_upload.js

raeburn raeburn at source.lon-capa.org
Tue Jul 11 18:24:30 EDT 2023


raeburn		Tue Jul 11 22:24:30 2023 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /loncom/javascriptlib	file_upload.js 
  Log:
  - Satisfy w3c HTML validation: id attributes must be unique.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.701 loncom/interface/londocs.pm:1.702
--- loncom/interface/londocs.pm:1.701	Tue Jul 11 19:33:02 2023
+++ loncom/interface/londocs.pm	Tue Jul 11 22:24:29 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.701 2023/07/11 19:33:02 raeburn Exp $
+# $Id: londocs.pm,v 1.702 2023/07/11 22:24:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4554,7 +4554,7 @@
     } else {
         $reinit = &mt('(re-initialize course to access)');
     }
-    $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink.'</span>';;
+    $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink.'</span>';
     if ($orig_url =~ /$LONCAPA::assess_re/) {
         $line.= '<br />';
         if ($curralias ne '') {
@@ -6233,10 +6233,7 @@
 	my $fileupload=(<<FIUP);
         $quotainfo
 	$lt{'file'}:<br />
-	<input type="file" name="uploaddoc" class="LC_flUpload" size="40" $disabled />
-        <input type="hidden" id="LC_free_space" value="$free_space" />
 FIUP
-
 	my $checkbox=(<<CHBO);
 	<!-- <label>$lt{'parse'}?
 	<input type="checkbox" name="parserflag" />
@@ -6256,6 +6253,8 @@
         <fieldset id="uploadimsform" style="display: none;">
         <legend>$lt{'imsf'}</legend>
         $fileupload
+        <input type="file" name="uploaddoc" id="uploaddocims" class="LC_flUpload LC_uploaddoc" size="40" $disabled />
+        <input type="hidden" id="LC_free_space_ims" value="$free_space" />
         <br />
         <p>
         $lt{'cms'}:  
@@ -6282,6 +6281,8 @@
         <legend>$lt{'upfi'}</legend>
 	<input type="hidden" name="active" value="aa" />
     $fileupload
+        <input type="file" name="uploaddoc" class="LC_flUpload" size="40" $disabled />
+        <input type="hidden" id="LC_free_space" value="$free_space" />
 	<br />
 	$lt{'title'}:<br />
 	<input type="text" size="60" name="comment" $disabled />
@@ -6884,6 +6885,8 @@
         <legend>$lt{'upfi'}</legend>
 	<input type="hidden" name="active" value="ee" />
 	$fileupload
+        <input type="file" name="uploaddoc" id="uploaddocsupp" class="LC_flUpload LC_uploaddoc" size="40" $disabled />
+        <input type="hidden" id="LC_free_space_supp" value="$free_space" />
 	<br />
 	<br />
 	<span class="LC_nobreak">
Index: loncom/javascriptlib/file_upload.js
diff -u loncom/javascriptlib/file_upload.js:1.3 loncom/javascriptlib/file_upload.js:1.4
--- loncom/javascriptlib/file_upload.js:1.3	Sun Aug 11 14:16:55 2019
+++ loncom/javascriptlib/file_upload.js	Tue Jul 11 22:24:30 2023
@@ -2,7 +2,7 @@
 The LearningOnline Network with CAPA
 JavaScript functions handling file uploading
 
-$Id: file_upload.js,v 1.3 2019/08/11 14:16:55 raeburn Exp $
+$Id: file_upload.js,v 1.4 2023/07/11 22:24:30 raeburn Exp $
 
 Copyright Michigan State University Board of Trustees
 
@@ -105,6 +105,11 @@
 
     The PREFIX is empty unless the resource is within a composite page.
 
+    For upload to "IMS upload" in Main Content or "Upload File" in 
+    Supplemental Content in the Course Editor, the SUFFIX is extracted 
+    from the id of the file upload element, by splitting the id on
+    underscore, and using the second element.
+
 */
 function getMaxSize (fileInput,sizeItem) {
     var maxSize = 0;
@@ -118,6 +123,13 @@
             if (found.length == 3) {
                 sizeId = found[1]+sizeItem+'_'+found[2];
             }
+        } else if ($(fileInput).hasClass("LC_uploaddoc")) {
+            uploadId = $(fileInput).attr('id');
+            var re = /^uploaddoc(.+)$/;
+            var found = uploadId.match(re);
+            if (found.length == 2) {
+                sizeId = sizeItem+'_'+found[1]; 
+            }
         }
         if ( $("#"+sizeId).length) {
             if ( $("#"+sizeId).val() > 0) {




More information about the LON-CAPA-cvs mailing list