'.
'';
+ &mt('Dump Course DOCS to Construction Space').'" />'.
+ &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
} else {
return'
'.
&mt('Dump Course DOCS to Construction Space: available on other servers');
@@ -298,15 +299,80 @@ sub editor {
$r->print('
'.$errtext.'
');
} else {
# ------------------------------------------------------------ Process commands
+
# ---------------- if they are for this folder and user allowed to make changes
if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
+# set parameters and change order
+ if (defined($ENV{'form.setparms'})) {
+ my $idx=$ENV{'form.setparms'};
+# set parameters
+ if ($ENV{'form.randpick_'.$idx}) {
+ &Apache::lonratedt::storeparameter($idx,'parameter_randompick',$ENV{'form.randpick_'.$idx},'int_pos');
+ } else {
+ &Apache::lonratedt::delparameter($idx,'parameter_randompick');
+ }
+ if ($ENV{'form.hidprs_'.$idx}) {
+ &Apache::lonratedt::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
+ } else {
+ &Apache::lonratedt::delparameter($idx,'parameter_hiddenresource');
+ }
+ if ($ENV{'form.encprs_'.$idx}) {
+ &Apache::lonratedt::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
+ } else {
+ &Apache::lonratedt::delparameter($idx,'parameter_encrypturl');
+ }
+
+ if ($ENV{'form.newpos'}) {
+# change order
+
+ my $newpos=$ENV{'form.newpos'}-1;
+ my $currentpos=$ENV{'form.currentpos'}-1;
+ my $i;
+ my @neworder=();
+ if ($newpos>$currentpos) {
+# moving stuff up
+ for ($i=0;$i<$currentpos;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i];
+ }
+ for ($i=$currentpos;$i<$newpos;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i+1];
+ }
+ $neworder[$newpos]=$Apache::lonratedt::order[$currentpos];
+ for ($i=$newpos+1;$i<=$#Apache::lonratedt::order;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i];
+ }
+ } else {
+# moving stuff down
+ for ($i=0;$i<$newpos;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i];
+ }
+ $neworder[$newpos]=$Apache::lonratedt::order[$currentpos];
+ for ($i=$newpos+1;$i<$currentpos+1;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i-1];
+ }
+ for ($i=$currentpos+1;$i<=$#Apache::lonratedt::order;$i++) {
+ $neworder[$i]=$Apache::lonratedt::order[$i];
+ }
+ }
+ @Apache::lonratedt::order=@neworder;
+ }
+# store the changed version
+
+ ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
+ if ($fatal) {
+ $r->print('
'.$errtext.'
');
+ return;
+ }
+
+ }
+
# upload a file, if present
if (($ENV{'form.uploaddoc.filename'}) &&
($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
# this is for a course, not a user, so set coursedoc flag
# probably the only place in the system where this should be "1"
- my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
+ my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs');
my $ext='false';
if ($url=~/^http\:\/\//) { $ext='true'; }
$url=~s/\:/\:/g;
@@ -334,6 +400,10 @@ sub editor {
if ($ENV{'form.cmd'}) {
my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
if ($cmd eq 'del') {
+ my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]);
+ if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) {
+ &Apache::lonnet::removeuploadedurl($url);
+ }
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
$Apache::lonratedt::order[$i]=
$Apache::lonratedt::order[$i+1];
@@ -424,6 +494,9 @@ sub editor {
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
$idx++;
}
+ unless ($idx) {
+ $r->print('
'.&mt('Currently no documents.').'
');
+ }
$r->print('');
}
}
@@ -437,6 +510,7 @@ sub entryline {
&Apache::lonnet::unescape($title)),'"<>&\'');
my $renametitle=$title;
my $foldertitle=$title;
+ my $orderidx=$Apache::lonratedt::order[$index];
if ($title=~ /^(\d+)___&&&___(\w+)___&&&___(\w+)___&&&___(.*)$/ ) {
$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
$renametitle=$4;
@@ -447,17 +521,36 @@ sub entryline {
$renametitle=~s/\"\;/\\\"/g;
my $line='
';
# Edit commands
+ my $folderpath;
+ if ($ENV{'form.folderpath'}) {
+ $folderpath=&Apache::lonnet::escape($ENV{'form.folderpath'});
+ # $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"');
+ }
if ($allowed) {
- my %lt=('up' => 'Move Up',
+ my $incindex=$index+1;
+ my $selectbox='';
+ if ($folder!~/^supplemental/) {
+ $selectbox=
+ ''.
+ '';
+ }
+ my %lt=&Apache::lonlocal::texthash(
+ 'up' => 'Move Up',
'dw' => 'Move Down',
'rm' => 'Remove',
'rn' => 'Rename');
- my $folderpath;
- if ($ENV{'form.folderpath'}) {
- $folderpath=&Apache::lonnet::escape($ENV{'form.folderpath'});
- # $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"');
- }
$line.=(<
+
+