--- loncom/interface/londocs.pm 2013/12/18 23:03:43 1.572 +++ loncom/interface/londocs.pm 2014/11/25 04:32:13 1.588 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.572 2013/12/18 23:03:43 raeburn Exp $ +# $Id: londocs.pm,v 1.588 2014/11/25 04:32:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,6 +46,7 @@ use Apache::lonsimplepage(); use HTML::Entities; use HTML::TokeParser; use GDBM_File; +use File::MMagic; use Apache::lonlocal; use Cwd; use LONCAPA qw(:DEFAULT :match); @@ -301,14 +302,14 @@ ENDJS if ($contents{content}) { $content .= '
-

Content

'. +

'.&mt('Content').'

'. $contents{content}.'
'; } if ($contents{webreferences}) { $content .= '
-

Web References

'. +

'.&mt('Web References').'

'. $contents{webreferences}.'
'; } @@ -1087,6 +1088,7 @@ sub update_paste_buffer { } &Apache::lonnet::appenv(\%addtoenv); delete($env{'form.markcopy'}); + return; } sub recurse_uploaded_maps { @@ -1124,6 +1126,7 @@ sub print_paste_buffer { my @currpaste = split(/,/,$env{'docs.markedcopies'}); my ($pasteitems,@pasteable); + my $clipboardcount = 0; # Construct identifiers for current contents of user's paste buffer foreach my $suffix (@currpaste) { @@ -1132,6 +1135,7 @@ sub print_paste_buffer { my $url = $env{'docs.markedcopy_url_'.$suffix}; if (($cid =~ /^$match_domain\_$match_courseid$/) && ($url ne '')) { + $clipboardcount ++; my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent, $canpaste,$nopaste,$othercrs,$areachange); my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1]; @@ -1225,11 +1229,23 @@ sub print_paste_buffer { $pasteitems .= '
'; $form_start = '
'; if (@pasteable) { - $buttons = ''.(' 'x2); + my $value = &mt('Paste to current folder'); + if ($container eq 'page') { + $value = &mt('Paste to current page'); + } + $buttons = ''.(' 'x2); } - $buttons .= ''. - ''; - $form_end = '
'; + $buttons .= ''.(' 'x2); + if ($clipboardcount > 1) { + $buttons .= + ''.(' 'x20).''.(' 'x2). + ''. + (' 'x2). + ''. + (' 'x2); + } + $form_end = ''. + ''; } else { $pasteitems = &mt('Clipboard is empty'); } @@ -1383,6 +1399,24 @@ function validateClipboard() { } } +function checkClipboard() { + if (document.pasteform.pasting.length > 1) { + for (var i=0; i1) { + for (var i=0; i'; } $$upload_output = '
'.$$upload_output.'
'; - } elsif (&Apache::loncommon::is_archive_file($mimetype)) { + } elsif ((&Apache::loncommon::is_archive_file($mimetype)) && + ($env{'form.uploaddoc.filename'} =~ /\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/i)) { $nextphase = 'decompress_uploaded'; my $position = scalar(@LONCAPA::map::order)-1; my $noextract = &return_to_editor(); @@ -3307,7 +3363,7 @@ sub is_supplemental_title { sub entryline { my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_; - my ($foldertitle,$renametitle); + my ($foldertitle,$renametitle,$oldtitle); if (&is_supplemental_title($title)) { ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); } else { @@ -3320,7 +3376,10 @@ sub entryline { $renametitle=~s/\\/\\\\/g; $renametitle=~s/\"\;/\\\"/g; + $renametitle=~s/"/%22/g; $renametitle=~s/ /%20/g; + $oldtitle = $renametitle; + $renametitle=~s/\'/\\\'/g; my $line=&Apache::loncommon::start_data_table_row(); my ($form_start,$form_end,$form_common,$form_param); # Edit commands @@ -3470,7 +3529,7 @@ ENDREM } } $renamelink=(<$lt{'rn'} +$lt{'rn'} ENDREN $line.=(< @@ -3785,6 +3844,7 @@ sub new_timebased_suffix { if ($type eq 'paste') { $prefix = $type; $namespace = 'courseeditor'; + $idtype = 'addcode'; } elsif ($type eq 'map') { $prefix = 'docs'; if ($area eq 'supplemental') { @@ -3796,9 +3856,8 @@ sub new_timebased_suffix { $prefix = $type; $namespace = 'templated'; } - $idtype = 'concat'; my ($suffix,$freedlock,$error) = - &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num); + &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num,$idtype); if (!$suffix) { if ($type eq 'paste') { $errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.'); @@ -4466,12 +4525,8 @@ sub handler { $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); } - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver', - 'inhibitmenu']); - if ($allowed && $env{'form.chooseserver'}) { - &choose_dump_server($r); - return OK; - } elsif ($allowed && $env{'form.verify'}) { + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']); + if ($allowed && $env{'form.verify'}) { &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content'); &verifycontent($r); } elsif ($allowed && $env{'form.listsymbs'}) { @@ -4813,7 +4868,11 @@ sub handler { 'title' => 'Title', 'comment' => 'Comment', 'parse' => 'Upload embedded images/multimedia files if HTML file', - ); + 'bb5' => 'Blackboard 5', + 'bb6' => 'Blackboard 6', + 'angel5' => 'ANGEL 5.5', + 'webctce4' => 'WebCT 4 Campus Edition', + ); # ----------------------------------------------------------------------------- my $fileupload=(< @@ -4844,10 +4903,10 @@ CHBO $lt{'cms'}: 

@@ -5420,7 +5479,7 @@ sub decompression_info { my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $container='sequence'; my ($pathitem,$hiddenelem); - my @hiddens = ('newidx','comment','position','folderpath'); + my @hiddens = ('newidx','comment','position','folderpath','archiveurl'); if ($env{'form.folderpath'} =~ /\:1$/) { $container='page'; } @@ -5428,7 +5487,7 @@ sub decompression_info { foreach my $item (@hiddens) { if ($env{'form.'.$item}) { $hiddenelem .= ''."\n"; + &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n"; } } return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container, @@ -5485,25 +5544,34 @@ sub remove_archive { } else { $delwarning = &mt('An error occurred retrieving the contents of the current folder.'); } - $delwarning .= &mt('As a result the archive file has not been removed.'); + $delwarning .= ' '.&mt('As a result the archive file has not been removed.'); } else { my $currcmd = $env{'form.cmd'}; my $position = $env{'form.position'}; + my $archiveidx = $position; if ($position > 0) { - $env{'form.cmd'} = 'remove_'.$position; - my ($title,$url,@rrest) = - split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]); - if (&handle_edit_cmd($docuname,$docudom)) { - ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1); - if ($fatal) { - if ($container eq 'page') { - $delwarning = &mt('An error occurred updating the contents of the current page.'); + if (($env{'form.autoextract_camtasia'}) && (scalar(@LONCAPA::map::order) == 2)) { + $archiveidx = $position-1; + } + $env{'form.cmd'} = 'remove_'.$archiveidx; + my ($title,$url,@rrest) = + split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$archiveidx]]); + if ($url eq $env{'form.archiveurl'}) { + if (&handle_edit_cmd($docuname,$docudom)) { + ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1); + if ($fatal) { + if ($container eq 'page') { + $delwarning = &mt('An error occurred updating the contents of the current page.'); + } else { + $delwarning = &mt('An error occurred updating the contents of the current folder.'); + } } else { - $delwarning = &mt('An error occurred updating the contents of the current folder.'); + $delresult = &mt('Archive file removed.'); } - } else { - $delresult = &mt('Archive file removed.'); } + } else { + $delwarning .= &mt('Archive file had unexpected item number in folder.'). + ' '.&mt('As a result the archive file has not been removed.'); } } $env{'form.cmd'} = $currcmd; @@ -6652,7 +6720,7 @@ ENDINJECT sub dump_switchserver_js { my @hosts = @_; my %lt = &Apache::lonlocal::texthash( - dump => 'Copying Content to Authoring Space requires switching server.', + dump => 'Copying content to Authoring Space requires switching server.', swit => 'Switch server?', duco => 'Copying Content to Authoring Space', yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.',