--- loncom/interface/londocs.pm 2017/12/29 16:01:33 1.649 +++ loncom/interface/londocs.pm 2018/05/29 19:33:48 1.655 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.649 2017/12/29 16:01:33 raeburn Exp $ +# $Id: londocs.pm,v 1.655 2018/05/29 19:33:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,6 +46,7 @@ use Apache::lonsimplepage(); use Apache::lonhomework(); use Apache::lonpublisher(); use Apache::lonparmset(); +use Apache::loncourserespicker(); use HTML::Entities; use HTML::TokeParser; use GDBM_File; @@ -1908,7 +1909,7 @@ sub do_paste_from_buffer { cnum => $coursenum, ); if ($prefix eq 'ext.tool') { - if ($prefixchg{$suffix} eq 'docstosupp') { + if ($prefixchg{$suffix} eq 'docstosupp') { $info{'delgradable'} = 1; } } @@ -2004,7 +2005,7 @@ sub do_paste_from_buffer { $coursedom,$coursenum,$template,$newidx,"$folder.$container"); } } elsif ($url =~ /ext\.tool$/) { - if (($newidx) && ($folder=~/^default/)) { + if (($newidx) && ($folder=~/^default/)) { my $marker = (split(m{/},$url))[4]; my %toolsettings = &Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); my $val = 'no'; @@ -2557,7 +2558,7 @@ sub url_paste_fixups { my $rem = $3; my ($is_exttool,$exttoolchg); if ($rem =~ m{\d+/ext\.tool$}) { - $is_exttool = 1; + $is_exttool = 1; } if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { $rewrites->{$oldurl}{$id} = $ressrc; @@ -4402,7 +4403,7 @@ $form_end; $reinit = &mt('(re-initialize course to access)'); } $line.=''.$editlink.$renamelink; - if ($url =~ /$LONCAPA::assess_re/) { + if ($orig_url =~ /$LONCAPA::assess_re/) { $line.= '
'; if ($curralias ne '') { $line.=''. @@ -4812,6 +4813,48 @@ sub list_symbs { $r->print(&endContentScreen()); } +sub short_urls { + my ($r,$canedit) = @_; + my $crstype = &Apache::loncommon::course_type(); + my $formname = 'shortenurl'; + $r->print(&Apache::loncommon::start_page('Display/Set Shortened URLs')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Shortened URLs')); + $r->print(&startContentScreen('tools')); + my ($navmap,$errormsg) = + &Apache::loncourserespicker::get_navmap_object($crstype,'shorturls'); + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my (%maps,%resources,%titles); + if (!ref($navmap)) { + $r->print($errormsg. + &endContentScreen()); + return ''; + } else { + $r->print('

'.&mt('Tiny URLs for deep-linking into course').'

'."\n"); + $r->rflush(); + my $readonly; + if ($canedit) { + my ($numnew,$errors) = &Apache::loncommon::make_short_symbs($cdom,$cnum,$navmap); + if ($numnew) { + $r->print('

'.&mt('Created [quant,_1,URL]',$numnew).'

'); + } + if ((ref($errors) eq 'ARRAY') && (@{$errors} > 0)) { + $r->print(&mt('The following errors occurred when processing your request to create shortened URLs:').'
    '); + foreach my $error (@{$errors}) { + $r->print('
  • '.$error.'
  • '); + } + $r->print('

'); + } + } else { + $readonly = 1; + } + my %currtiny = &Apache::lonnet::dump('tiny',$cdom,$cnum); + $r->print(&Apache::loncourserespicker::create_picker($navmap,'shorturls',$formname,$crstype,undef, + undef,undef,undef,undef,undef,\%currtiny,$readonly)); + } + $r->print(&endContentScreen()); +} + sub contentverifyform { my ($r) = @_; my $crstype = &Apache::loncommon::course_type(); @@ -5182,13 +5225,17 @@ sub changewarning { if (!defined($message)) { $message='Changes will become active for your current session after [_1], or the next time you log in.'; } + my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print("\n\n". ''."\n". -'
'. +''. '

'. &mt($message,' '."\n" .'// '."\n" .''."\n" ); @@ -6122,7 +6178,7 @@ HIDDENFORM my $newnavform=(< - + $pathitem @@ -6132,7 +6188,7 @@ HIDDENFORM NNFORM my $newsmppageform=(< - + $pathitem $lt{'sipa'} @@ -6142,7 +6198,7 @@ NSPFORM my $newsmpproblemform=(< - + $pathitem $lt{'sipr'} @@ -6153,7 +6209,7 @@ NSPROBFORM my $newdropboxform=(< - + $pathitem $lt{'drbx'} @@ -6163,7 +6219,7 @@ NDBFORM my $newexuploadform=(< - + $pathitem $lt{'scuf'} @@ -6173,7 +6229,7 @@ NEXUFORM my $newbulform=(< - + $pathitem $lt{'bull'} @@ -6183,7 +6239,7 @@ NBFORM my $newaboutmeform=(< - + $pathitem @@ -6194,7 +6250,7 @@ NAMFORM my $newaboutsomeoneform=(< - + $pathitem $lt{'abou'} @@ -6203,7 +6259,7 @@ NASOFORM my $newrosterform=(< - + $pathitem @@ -6224,7 +6280,7 @@ NROSTFORM } my $newwebpageform =(< - + $pathitem $lt{'webp'} @@ -6407,7 +6463,7 @@ NWEBFORM