--- loncom/interface/londocs.pm 2016/06/20 14:26:58 1.607
+++ loncom/interface/londocs.pm 2016/07/01 19:59:36 1.608
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.607 2016/06/20 14:26:58 raeburn Exp $
+# $Id: londocs.pm,v 1.608 2016/07/01 19:59:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4908,8 +4908,6 @@ sub handler {
my $output = &Apache::lonpublisher::batchpublish($r,$srcfile,$targetfile,$nokeyref,1);
$env{'form.folder'} = $folder;
&snapshotbefore();
- my $url = $redirect;
- $url =~ s{^/priv/}{/res/};
my $title = &LONCAPA::map::qtunescape($env{'form.newresourcetitle'});
my $ext = 'false';
my $newidx = &LONCAPA::map::getresidx(&LONCAPA::map::qtunescape($url));
@@ -5394,61 +5392,11 @@ FUFORM
SEDFFORM
- my $is_home;
- my $crshome = $env{'course.'.$env{'request.course.id'}.'.home'};
- my @ids=&Apache::lonnet::current_machine_ids();
- if (grep(/^\Q$crshome\E$/,@ids)) {
- $is_home = 1;
- }
- my (%subdirs,%files,%selimport_menus);
- my $pickfile;
- my $relpath = "/res/$coursedom/$coursenum";
- &recursedirs($is_home,'res',$londocroot,$relpath,'',\%subdirs,\%files);
- my $numdirs = scalar(keys(%files));
- if ($numdirs > 1) {
- my @order = sort { lc($a) cmp lc($b) } (keys(%files));
- foreach my $key (@order) {
- if (ref($files{$key}) eq 'HASH') {
- my $shown = $key;
- if ($key eq '') {
- $shown = '/';
- }
- $selimport_menus{$key}->{'text'} = $shown;
- $selimport_menus{$key}->{'default'} = '';
- my @ordered = ('');
- $selimport_menus{$key}->{'select2'}->{''} = '';
- foreach my $file (sort { lc($a) cmp lc($b) } (keys(%{$files{$key}}))) {
- $selimport_menus{$key}->{'select2'}->{$file} = $file;
- push(@ordered,$file);
- }
- $selimport_menus{$key}->{'order'} = \@ordered;
- }
- }
- $pickfile = $lt{'dire'}.
- &Apache::loncommon::linked_select_forms('crsresimportform','
'.
- &mt('Filename: '),'',
- 'coursepath','coursefile',
- \%selimport_menus,\@order,
- "resize_scrollbox('contentscroll','1','0');",'','res').
- '
';
- } elsif ($numdirs == 1) {
- my $singledir = (keys(%files))[0];
- my $showdir = $singledir;
- if ($singledir eq '') {
- $showdir = '/';
- }
- $pickfile = $lt{'dire'}.
- '
'.
- &mt('Filename: ').'
'."\n";
- }
my $importcrsresform;
+ my ($numdirs,$pickfile) =
+ &Apache::loncommon::import_crsauthor_form('crsresimportform','coursepath','coursefile',
+ "resize_scrollbox('contentscroll','1','0');",
+ undef,'res');
if ($pickfile) {
$importcrsresform=(<