[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Sat Aug 3 14:16:47 EDT 2013


raeburn		Sat Aug  3 18:16:47 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	londocs.pm 
  Log:
  - For 2.11
    - Backport 1.552, 1.553, 1.554.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.35 loncom/interface/londocs.pm:1.484.2.36
--- loncom/interface/londocs.pm:1.484.2.35	Mon May 27 00:07:52 2013
+++ loncom/interface/londocs.pm	Sat Aug  3 18:16:46 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484.2.35 2013/05/27 00:07:52 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.36 2013/08/03 18:16:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2802,8 +2802,30 @@
 }
 
 sub process_file_upload {
-    my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
+    my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd,$crstype) = @_;
 # upload a file, if present
+    my $filesize = length($env{'form.uploaddoc'});
+    if (!$filesize) {
+        $$upload_output = '<div class="LC_error">'.
+                           &mt('Unable to upload [_1]. (size = [_2] bytes)',
+                          '<span class="LC_filename">'.$env{'form.uploaddoc.filename'}.'</span>',
+                          $filesize).'<br />'.
+                          &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').'<br />'.
+                          '</div>';
+        return;
+    }
+    my $quotatype = 'unofficial';
+    if ($crstype eq 'Community') {
+        $quotatype = 'community';
+    } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.instcode'}) {
+        $quotatype = 'official';
+    }
+    if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) {
+        $filesize = int($filesize/1000); #expressed in kb
+        $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course',
+                                                                      $env{'form.uploaddoc.filename'},$filesize,'upload');
+        return if ($$upload_output);
+    }
     my ($parseaction,$showupload,$nextphase,$mimetype);
     if ($env{'form.parserflag'}) {
         $parseaction = 'parse';
@@ -4075,7 +4097,8 @@
 	               'Supplemental','Score_Upload_Form','Adding_Pages',
 	               'Importing_LON-CAPA_Resource','Importing_IMS_Course',
                        'Uploading_From_Harddrive',
-	               'Check_Resource_Versions','Verify_Content') {
+	               'Check_Resource_Versions','Verify_Content',
+                       'Course_Roster','Web_Page','Dropbox') {
 	$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
     }
     # Composite help files
@@ -4091,8 +4114,6 @@
 		  'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
     $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
-    $help{'Course Roster'} = &Apache::loncommon::help_open_topic('Docs_Course_Roster');
-    $help{'Web Page'} =  &Apache::loncommon::help_open_topic('Docs_Web_Page');
  
     my $allowed;
 # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
@@ -4357,7 +4378,7 @@
           # Process file upload - phase one - upload and parse primary file.
 	  undef($hadchanges);
           $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,
-                                              \%allfiles,\%codebase,$context);
+                                              \%allfiles,\%codebase,$context,$crstype);
 	  if ($hadchanges) {
 	      &mark_hash_old();
 	  }
@@ -4409,7 +4430,7 @@
        my %lt=&Apache::lonlocal::texthash(
 		'copm' => 'All documents out of a published map into this folder',
                 'upfi' => 'Upload File',
-                'upld' => 'Import Content',
+                'upld' => 'Upload Content',
                 'srch' => 'Search',
                 'impo' => 'Import',
 		'lnks' => 'Import from Stored Links',
@@ -4430,8 +4451,8 @@
                 'grpo' => 'Group Portfolio',
                 'rost' => 'Course Roster',
                 'abou' => 'Personal Information Page for a User',
-                'imsf' => 'IMS Import',
-                'imsl' => 'Import IMS package',
+                'imsf' => 'IMS Upload',
+                'imsl' => 'Upload IMS package',
                 'cms'  => 'Origin of IMS package',
                 'se'   => 'Select',
                 'file' =>  'File',
@@ -4635,6 +4656,7 @@
 	$pathitem
 	<input type="hidden" name="importdetail" value="" />
 	<a class="LC_menubuttons_link" href="javascript:makedropbox();">$lt{'drbx'}</a>
+        $help{'Dropbox'}
 	</form>
 NDBFORM
 
@@ -4705,7 +4727,7 @@
         $pathitem
         <input type="hidden" name="importdetail" value="$newwebpage" />
         <a class="LC_menubuttons_link" href="javascript:makewebpage();">$lt{'webp'}</a>
-        $help{'Web Page'}
+        $help{'Web_Page'}
         </form>
 NWEBFORM
  
@@ -4804,14 +4826,14 @@
         $communityform = &create_form_ul(&create_list_elements(@communityforma));
 
 my %orderhash = (
-                'aa' => ['Import Content',$fileuploadform],
-                'bb' => ['Published Content',$importpubform],
-                'cc' => ['Grading Resources',$gradingform],
+                'aa' => ['Upload',$fileuploadform],
+                'bb' => ['Import',$importpubform],
+                'cc' => ['Grading',$gradingform],
                 );
 unless ($container eq 'page') {
     $orderhash{'00'} = ['Newfolder',$newfolderform];
     $orderhash{'dd'} = ['Collaboration',$communityform];
-    $orderhash{'ee'} = ['Special Pages',$specialdocumentsform];
+    $orderhash{'ee'} = ['Other',$specialdocumentsform];
 }
 
  $hadchanges=0;
@@ -4922,7 +4944,7 @@
         $pathitem
         <input type="hidden" name="importdetail" value="$supwebpage" />
         <a class="LC_menubuttons_link" href="javascript:makewebpage('supp');">$lt{'webp'}</a>
-        $help{'Web Page'}
+        $help{'Web_Page'}
         </form>
 SWEBFORM
 
@@ -4945,8 +4967,8 @@
 $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));
 my %suporderhash = (
 		'00' => ['Supnewfolder', $supnewfolderform],
-                'ee' => ['Import Content',$supupdocform],
-                'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))]
+                'ee' => ['Upload',$supupdocform],
+                'ff' => ['Other',&create_form_ul(&create_list_elements(@specialdocs))]
                 );
         if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,




More information about the LON-CAPA-cvs mailing list