--- loncom/interface/londocs.pm 2016/01/26 14:30:25 1.598 +++ loncom/interface/londocs.pm 2016/05/09 02:25:33 1.603 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.598 2016/01/26 14:30:25 raeburn Exp $ +# $Id: londocs.pm,v 1.603 2016/05/09 02:25:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -685,7 +685,7 @@ sub group_import { } else { $fname =~ s/\W/_/g; } - if (length($fname > 15)) { + if (length($fname) > 15) { $fname = substr($fname,0,14); } my $initialtext = &mt('Replace with your own content.'); @@ -3020,7 +3020,7 @@ sub editor { $r->print($upload_output); # Rename, cut, copy or remove a single resource - if (&handle_edit_cmd()) { + if (&handle_edit_cmd($coursenum,$coursedom)) { my $contentchg; if ($env{'form.cmd'} =~ m{^(remove|cut)_}) { $contentchg = 1; @@ -3429,7 +3429,9 @@ sub process_file_upload { } my $quotatype = 'unofficial'; if ($crstype eq 'Community') { - $quotatype = 'community'; + $quotatype = 'community'; + } elsif ($crstype eq 'Placement') { + $quotatype = 'placement'; } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) { $quotatype = 'official'; } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) { @@ -3703,6 +3705,7 @@ END $currgroups); my ($copylink,$cutlink,$removelink); my $skip_confirm = 0; + my $confirm_removal = 0; if ( $folder =~ /^supplemental/ || ($url =~ m{( /smppg$ |/syllabus$ @@ -3714,6 +3717,10 @@ END || $isexternal) { $skip_confirm = 1; } + if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && + ($url!~/$LONCAPA::assess_page_seq_re/)) { + $confirm_removal = 1; + } if ($denied{'copy'}) { $copylink=(< $form_common + $lt{'rm'} $form_end ENDREM @@ -4990,8 +4998,9 @@ sub handler { } my $tabidstr = join("','",@tabids); %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom); + my $posslti = keys(%ltitools); my $exttoolurl = "/adm/$coursedom/$coursenum/new/exttool"; - $script .= &editing_js($udom,$uname,$supplementalflag). + $script .= &editing_js($udom,$uname,$supplementalflag,$posslti). &history_tab_js(). &inject_data_js(). &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid). @@ -5150,7 +5159,9 @@ sub handler { # file size to determine if upload should be allowed. my $quotatype = 'unofficial'; if ($crstype eq 'Community') { - $quotatype = 'community'; + $quotatype = 'community'; + } elsif ($crstype eq 'Placement') { + $quotatype = 'placement'; } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) { $quotatype = 'official'; } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) { @@ -6087,7 +6098,7 @@ END } sub editing_js { - my ($udom,$uname,$supplementalflag) = @_; + my ($udom,$uname,$supplementalflag,$posslti) = @_; my %js_lt = &Apache::lonlocal::texthash( p_mnf => 'Name of New Folder', t_mnf => 'New Folder', @@ -6105,16 +6116,18 @@ sub editing_js { p_mab_alrt2 => 'Please enter both user and domain in the format user:domain', p_chn => 'New Title', p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!', - p_rmr2a => 'Remove[_99]', - p_rmr2b => '?[_99]', - p_rmr3a => 'Remove those [_2]', - p_rmr3b => 'items?[_2]', + p_rmr2a => 'Remove', + p_rmr2b => '?', + p_rmr3a => 'Remove those', + p_rmr3b => 'items?', + p_rmr4 => 'WARNING: Removing a resource uploaded to a course cannot be undone via "Undo Delete".', + p_rmr5 => 'Push "Cancel" and then use "Cut" instead if you might need to undo this change.', p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!', p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.', - p_ctr2a => 'Cut[_98]', - p_ctr2b => '?[_98]', - p_ctr3a => 'Cut those[_2]', - p_ctr3b => 'items?[_2]', + p_ctr2a => 'Cut', + p_ctr2b => '?', + p_ctr3a => 'Cut those', + p_ctr3b => 'items?', rpck => 'Enter number to pick (e.g., 3)', imsfile => 'You must choose an IMS package for import', imscms => 'You must select which Course Management System was the source of the IMS package', @@ -6161,12 +6174,18 @@ sub editing_js { $backtourl = '/adm/navmaps'; } - my $fieldsets = "'ext','tool','doc'"; + my $fieldsets = "'ext','doc'"; + if ($posslti) { + $fieldsets .= ",'tool'"; + } unless ($main_container_page) { $fieldsets .=",'ims'"; } if ($supplementalflag) { - $fieldsets = "'suppext','supptool','suppdoc'"; + $fieldsets = "'suppext','suppdoc'"; + if ($posslti) { + $fieldsets .= ",'supptool'"; + } } return < 0) { - if ((cutwarnings > 0) || (remwarnings > 0)) { + if ((cutwarnings > 0) || (remwarnings > 0) || (removalinfo > 0)) { if (remwarnings > 0) { if (!confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr3a"} '+remwarnings+' $js_lt{"p_rmr3b"}')) { return false; } } + if (removalinfo > 0) { + if (!confirm('$js_lt{"p_rmr4"}\\n$js_lt{"p_rmr5"}\\n\\n$js_lt{"p_rmr3a"} '+removalinfo+' $js_lt{"p_rmr3b"}')) { + return false; + } + } if (cutwarnings > 0) { if (!confirm('$js_lt{"p_ctr1a"}\\n$js_lt{"p_ctr1b"}\\n\\n$js_lt{"p_ctr3a"} '+cutwarnings+' $js_lt{"p_ctr3b"}')) { return false;