--- loncom/interface/londocs.pm 2013/05/27 00:07:52 1.484.2.35 +++ loncom/interface/londocs.pm 2013/08/03 18:16:46 1.484.2.36 @@ -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 multiple_check_form { } 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 = '
'. + &mt('Unable to upload [_1]. (size = [_2] bytes)', + ''.$env{'form.uploaddoc.filename'}.'', + $filesize).'
'. + &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').'
'. + '
'; + 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 @@ sub handler { '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 @@ sub handler { '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 @@ sub handler { # 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 @@ sub handler { 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 @@ sub handler { '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 @@ NSPROBFORM $pathitem $lt{'drbx'} + $help{'Dropbox'} NDBFORM @@ -4705,7 +4727,7 @@ NROSTFORM $pathitem $lt{'webp'} - $help{'Web Page'} + $help{'Web_Page'} NWEBFORM @@ -4804,14 +4826,14 @@ NGFFORM $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 @@ SNAMFORM $pathitem $lt{'webp'} - $help{'Web Page'} + $help{'Web_Page'} SWEBFORM @@ -4945,8 +4967,8 @@ my @supimportdoc = ( $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,