--- loncom/interface/londocs.pm 2007/01/26 23:37:53 1.270
+++ 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.270 2007/01/26 23:37:53 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);
+ $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(<
@@ -1574,36 +1601,50 @@ sub process_file_upload {
}
sub ask_for_embedded_content {
- my ($actionurl,$state,$allfiles,$codebase)=@_;
+ my ($actionurl,$state,$allfiles,$codebase,$args)=@_;
my $upload_output = '
';
return $upload_output;
}
@@ -1853,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'};
@@ -1865,15 +1906,21 @@ 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='';
+''.&mt('Save').'';
+ my $ro_set=
+ ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
+ $rand_order_text ='
+';
}
if ($ispage) {
my $pagename=&escape($pagetitle);
@@ -1902,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.=(<
+
$rand_order_text
$parameterset
ENDPARMS
}
@@ -2131,9 +2180,9 @@ sub checkversions {
if (&Apache::lonnet::put('resourceversions',\%newsetversions,
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
- $r->print('
'.&mt('Your Version Settings have been Stored').'
');
+ $r->print('
'.&mt('Your Version Settings have been Saved').'
');
} else {
- $r->print('
'.&mt('An Error Occured while Attempting to Store your Version Settings').'
');
+ $r->print('
'.&mt('An Error Occured while Attempting to Save your Version Settings').'