--- loncom/interface/londocs.pm 2007/06/13 23:44:10 1.276
+++ loncom/interface/londocs.pm 2007/06/29 19:51:06 1.278.2.2
@@ -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.278.2.2 2007/06/29 19:51:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -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 = '
');
- }
+ }
if ($randompick>=0) {
$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.').'
');
}
+ if ($is_random_order) {
+ $r->print('
'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown. Do not modify the contents of this folder if it is in active student use.').'
');
+ }
$r->print('
');
- foreach (@LONCAPA::map::order) {
- my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]);
+ foreach my $res (@LONCAPA::map::order) {
+ my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
$name=&LONCAPA::map::qtescape($name);
$url=&LONCAPA::map::qtescape($url);
unless ($name) { $name=(split(/\//,$url))[-1]; }
unless ($name) { $idx++; next; }
- $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
+ $r->print(&entryline($idx,$name,$url,$folder,$allowed,$res,
+ $coursenum));
$idx++;
$shown++;
}
@@ -1465,11 +1484,19 @@ sub editor {
ENDPASTE
- $r->print(
- ' '.&Apache::loncommon::filedescription(
- (split(/\./,$env{'form.markedcopy_url'}))[-1]).': '.
- $env{'form.markedcopy_title'});
+ $r->print(' ');
+
+ my $type;
+ if ($env{'form.markedcopy_url'} =~ m{^/adm/wrapper/ext}) {
+ $type = &mt('External Resource');
+ $r->print($type.': '. $env{'form.markedcopy_title'});
+ } else {
+ my $extension = (split(/\./,$env{'form.markedcopy_url'}))[-1];
+ my $type = &Apache::loncommon::filedescription($extension);
+ my $icon = '';
+ $r->print($icon.$type.': '. $env{'form.markedcopy_title'});
+ }
if ($container eq 'page') {
$r->print(<
@@ -1867,7 +1894,7 @@ END
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
}
}
- my $parameterset=' ';
+ my ($parameterset,$rand_order_text) = (' ', ' ');
if ($isfolder || $extension eq 'sequence') {
my $foldername=&escape($foldertitle);
my $folderpath=$env{'form.folderpath'};
@@ -1879,7 +1906,9 @@ END
.':'.((&LONCAPA::map::getparameter($orderidx,
'parameter_hiddenresource'))[0]=~/^yes$/i)
.':'.((&LONCAPA::map::getparameter($orderidx,
- 'parameter_encrypturl'))[0]=~/^yes$/i);
+ 'parameter_encrypturl'))[0]=~/^yes$/i)
+ .':'.((&LONCAPA::map::getparameter($orderidx,
+ 'parameter_randomorder'))[0]=~/^yes$/i);
$url.='folderpath='.&escape($folderpath).$cpinfo;
$parameterset='';
+ my $ro_set=
+ ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
+ $rand_order_text ='
+';
}
if ($ispage) {
my $pagename=&escape($pagetitle);
@@ -1916,14 +1949,16 @@ END
'hd' => 'Hidden',
'ec' => 'URL hidden');
my $enctext=
- ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
+ ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':'');
my $hidtext=
- ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
+ ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':'');
+
$line.=(<