--- loncom/interface/londocs.pm 2007/06/13 23:44:10 1.276
+++ loncom/interface/londocs.pm 2007/07/02 23:43:36 1.282
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.276 2007/06/13 23:44:10 albertel Exp $
+# $Id: londocs.pm,v 1.282 2007/07/02 23:43:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -379,7 +379,7 @@ sub exportcourse {
}
$display .= ' />'."\n";
for (my $i=0; $i<$depth; $i++) {
- $display .= ''."\n";
+ $display .= ''."\n";
}
if ($curRes->is_sequence()) {
$display .= ' '."\n";
@@ -904,15 +904,16 @@ sub store_template {
# Imports the given (name, url) resources into the course
# coursenum, coursedom, and folder must precede the list
sub group_import {
- my $coursenum = shift;
- my $coursedom = shift;
- my $folder = shift;
- my $container = shift;
- my $caller = shift;
- while (@_) {
- my $name = shift;
- my $url = shift;
- if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs')) {
+ my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
+
+ while (@files) {
+ my $name = shift(@files);
+ my $url = shift(@files);
+ #FIXME check if file exists before overwriting, might be restoring it
+ if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$})
+ && ($caller eq 'londocs')
+ && (!&Apache::lonnet::stat_file($url))) {
+
my $errtext = '';
my $fatal = 0;
my $newmapstr = '
');
}
sub editor {
- my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output)=@_;
+ my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_;
my $errtext='';
my $fatal=0;
my $container='sequence';
if ($env{'form.pagepath'}) {
$container='page';
}
- ($errtext,$fatal)=
- &mapread($coursenum,$coursedom,$folder.'.'.$container);
+ ($errtext,$fatal) = &mapread($coursenum,$coursedom,$folder.'.'.$container);
if ($#LONCAPA::map::order<1) {
my $idx=&LONCAPA::map::getresidx();
if ($idx<=0) { $idx=1; }
$LONCAPA::map::order[0]=$idx;
$LONCAPA::map::resources[$idx]='';
}
- if (defined($env{'form.markcopy'})) {
-# Mark for copying
- my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]);
- $env{'form.markedcopy_title'}=$title;
- $env{'form.markedcopy_url'}=$url;
- }
+
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder);
$r->print($breadcrumbtrail);
if ($fatal) {
@@ -1297,11 +1340,11 @@ sub editor {
return;
}
}
-
+
if ($env{'form.pastemarked'}) {
# paste resource to end of list
- my $url=$env{'form.markedcopy_url'};
- my $title=$env{'form.markedcopy_title'};
+ my $url=$env{'docs.markedcopy_url'};
+ my $title=$env{'docs.markedcopy_title'};
# Maps need to be copied first
if (($url=~/\.(page|sequence)$/) || ($url=~/^\/uploaded\//)) {
$title=&mt('Copy of').' '.$title;
@@ -1429,7 +1472,7 @@ sub editor {
}
}
&log_differences($plain);
- }
+ }
# ---------------------------------------------------------------- End commands
# ---------------------------------------------------------------- Print screen
my $idx=0;
@@ -1445,13 +1488,14 @@ sub editor {
$r->print('
'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'
END
- }
+
}
# Figure out what kind of a resource this is
my ($extension)=($url=~/\.(\w+)$/);
@@ -1905,10 +1923,10 @@ END
$path.$pagearg.'.page');
}
$url.='pagepath='.&escape($pagepath).
- '&pagesymb='.&escape($symb).$cpinfo;
+ '&pagesymb='.&escape($symb).$cpinfo;
}
$line.='