version 1.291, 2007/07/13 23:08:07
|
version 1.296, 2007/08/29 00:52:36
|
Line 963 sub breadcrumbs {
|
Line 963 sub breadcrumbs {
|
my $randompick=-1; |
my $randompick=-1; |
my $isencrypted=0; |
my $isencrypted=0; |
my $ishidden=0; |
my $ishidden=0; |
|
my $is_random_order=0; |
while (@folders) { |
while (@folders) { |
my $folder=shift(@folders); |
my $folder=shift(@folders); |
my $foldername=shift(@folders); |
my $foldername=shift(@folders); |
Line 970 sub breadcrumbs {
|
Line 971 sub breadcrumbs {
|
$folderpath.=$folder.'&'.$foldername; |
$folderpath.=$folder.'&'.$foldername; |
my $url='/adm/coursedocs?folderpath='. |
my $url='/adm/coursedocs?folderpath='. |
&escape($folderpath); |
&escape($folderpath); |
my $name=&unescape($foldername); |
my $name=&unescape($foldername); |
# randompick number, hidden, encrypted is appended with ":"s to the foldername |
# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername |
$name=~s/\:(\d*)\:(\w*)\:(\w*)$//; |
$name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//; |
if ($1 ne '') { |
if ($1 ne '') { |
$randompick=$1; |
$randompick=$1; |
} else { |
} else { |
$randompick=-1; |
$randompick=-1; |
} |
} |
if ($2) { $ishidden=1; } |
if ($2) { $ishidden=1; } |
if ($3) { $isencrypted=1; } |
if ($3) { $isencrypted=1; } |
|
if ($4 ne '') { $is_random_order = 1; } |
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{'href'=>$url.$cpinfo, |
{'href'=>$url.$cpinfo, |
'title'=>$name, |
'title'=>$name, |
Line 991 sub breadcrumbs {
|
Line 993 sub breadcrumbs {
|
} |
} |
$plain=~s/\>\;\s*$//; |
$plain=~s/\>\;\s*$//; |
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', |
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', |
'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain); |
'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order); |
} |
} |
|
|
sub log_docs { |
sub log_docs { |
Line 1082 sub docs_change_log {
|
Line 1084 sub docs_change_log {
|
my %lt=('hiddenresource' => 'Resources hidden', |
my %lt=('hiddenresource' => 'Resources hidden', |
'encrypturl' => 'URL hidden', |
'encrypturl' => 'URL hidden', |
'randompick' => 'Randomly pick', |
'randompick' => 'Randomly pick', |
|
'randomorder' => 'Randomly ordered', |
'set' => 'set to', |
'set' => 'set to', |
'del' => 'deleted'); |
'del' => 'deleted'); |
$r->print(&Apache::loncommon::display_filter(). |
$r->print(&Apache::loncommon::display_filter(). |
Line 1164 sub docs_change_log {
|
Line 1167 sub docs_change_log {
|
$r->print('</ul>'); |
$r->print('</ul>'); |
if ($docslog{$id}{'logentry'}{'parameter_res'}) { |
if ($docslog{$id}{'logentry'}{'parameter_res'}) { |
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>'); |
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>'); |
foreach my $parameter ('randompick','hiddenresource','encrypturl') { |
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') { |
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
$r->print('<li>'. |
$r->print('<li>'. |
&mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]', |
&mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]', |
Line 1243 ENDPASTE
|
Line 1246 ENDPASTE
|
} |
} |
|
|
sub do_paste_from_buffer { |
sub do_paste_from_buffer { |
my ($coursenum,$coursedom,$folder,$container) = @_; |
my ($coursenum,$coursedom) = @_; |
|
|
|
return 0 if (!$env{'form.pastemarked'}); |
|
|
# paste resource to end of list |
# paste resource to end of list |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); |
my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}); |
my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}); |
Line 1285 sub do_paste_from_buffer {
|
Line 1291 sub do_paste_from_buffer {
|
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; |
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; |
push(@LONCAPA::map::order, $newidx); |
push(@LONCAPA::map::order, $newidx); |
# Store the result |
# Store the result |
return &storemap($coursenum,$coursedom,$folder.'.'.$container); |
} |
|
|
|
my %parameter_type = ( 'randompick' => 'int_pos', |
|
'hiddenresource' => 'string_yesno', |
|
'encrypturl' => 'string_yesno', |
|
'randomorder' => 'string_yesno',); |
|
my $valid_parameters_re = join('|',keys(%parameter_type)); |
|
# set parameters |
|
sub update_parameter { |
|
|
|
return 0 if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/); |
|
|
|
my $which = $env{'form.changeparms'}; |
|
my $idx = $env{'form.setparms'}; |
|
if ($env{'form.'.$which.'_'.$idx}) { |
|
my $value = ($which eq 'randompick') ? $env{'form.'.$which.'_'.$idx} |
|
: 'yes'; |
|
&LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value, |
|
$parameter_type{$which}); |
|
&remember_parms($idx,$which,'set',$value); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_'.$which); |
|
|
|
&remember_parms($idx,$which,'del'); |
|
} |
|
return 1; |
|
} |
|
|
|
|
|
sub handle_edit_cmd { |
|
my ($coursenum,$coursedom) =@_; |
|
|
|
my ($cmd,$idx)=split('_',$env{'form.cmd'}); |
|
|
|
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
|
my ($title, $url, @rrest) = split(':', $ratstr); |
|
|
|
if ($cmd eq 'del') { |
|
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && |
|
($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { |
|
&Apache::lonnet::removeuploadedurl($url); |
|
} else { |
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
|
} |
|
splice(@LONCAPA::map::order, $idx, 1); |
|
|
|
} elsif ($cmd eq 'cut') { |
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
|
splice(@LONCAPA::map::order, $idx, 1); |
|
|
|
} elsif ($cmd eq 'up' |
|
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
|
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1]; |
|
|
|
} elsif ($cmd eq 'down' |
|
&& defined($LONCAPA::map::order[$idx+1])) { |
|
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1]; |
|
|
|
} elsif ($cmd eq 'rename') { |
|
|
|
my $comment = &LONCAPA::map::qtunescape($env{'form.title'}); |
|
if ($comment=~/\S/) { |
|
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
|
$comment.':'.join(':', $url, @rrest); |
|
} |
|
# Devalidate title cache |
|
my $renamed_url=&LONCAPA::map::qtescape($url); |
|
&Apache::lonnet::devalidate_title_cache($renamed_url); |
|
} else { |
|
return 0; |
|
} |
|
return 1; |
} |
} |
|
|
sub editor { |
sub editor { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_; |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_; |
my $errtext=''; |
|
my $fatal=0; |
my $container= ($env{'form.pagepath'}) ? 'page' |
my $container='sequence'; |
: 'sequence'; |
if ($env{'form.pagepath'}) { |
|
$container='page'; |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
} |
$folder.'.'.$container); |
($errtext,$fatal) = &mapread($coursenum,$coursedom,$folder.'.'.$container); |
return $errtext if ($fatal); |
|
|
if ($#LONCAPA::map::order<1) { |
if ($#LONCAPA::map::order<1) { |
my $idx=&LONCAPA::map::getresidx(); |
my $idx=&LONCAPA::map::getresidx(); |
if ($idx<=0) { $idx=1; } |
if ($idx<=0) { $idx=1; } |
Line 1304 sub editor {
|
Line 1382 sub editor {
|
$LONCAPA::map::resources[$idx]=''; |
$LONCAPA::map::resources[$idx]=''; |
} |
} |
|
|
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder); |
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)= |
|
&breadcrumbs($folder); |
$r->print($breadcrumbtrail); |
$r->print($breadcrumbtrail); |
if ($fatal) { |
|
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
} else { |
|
# ------------------------------------------------------------ Process commands |
# ------------------------------------------------------------ Process commands |
|
|
# ---------------- if they are for this folder and user allowed to make changes |
# ---------------- if they are for this folder and user allowed to make changes |
if (($allowed) && ($env{'form.folder'} eq $folder)) { |
if (($allowed) && ($env{'form.folder'} eq $folder)) { |
# set parameters and change order |
# set parameters and change order |
&snapshotbefore(); |
&snapshotbefore(); |
if ($env{'form.changeparms'}) { |
|
my $idx=$env{'form.setparms'}; |
|
# set parameters |
|
if ($env{'form.changeparms'} eq 'randompick') { |
|
if ($env{'form.randpick_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
|
&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
|
&remember_parms($idx,'randompick','del'); |
|
} |
|
} |
|
if ($env{'form.changeparms'} eq 'hiddenresource') { |
|
if ($env{'form.hidprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
|
&remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); |
|
&remember_parms($idx,'hiddenresource','del'); |
|
} |
|
} |
|
if ($env{'form.changeparms'} eq 'encrypturl') { |
|
if ($env{'form.encprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
|
&remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_encrypturl'); |
|
&remember_parms($idx,'encrypturl','del'); |
|
} |
|
} |
|
# store the changed version |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
if ($fatal) { |
|
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
return; |
|
} |
|
} |
|
|
|
if ($env{'form.newpos'}) { |
if (&update_parameter()) { |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
return $errtext if ($fatal); |
|
} |
|
|
|
if ($env{'form.newpos'} && $env{'form.currentpos'}) { |
# change order |
# change order |
my $newpos=$env{'form.newpos'}-1; |
my $res = splice(@LONCAPA::map::order,$env{'form.currentpos'}-1,1); |
my $currentpos=$env{'form.currentpos'}-1; |
splice(@LONCAPA::map::order,$env{'form.newpos'}-1,0,$res); |
my $i; |
|
my @neworder=(); |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
if ($newpos>$currentpos) { |
return $errtext if ($fatal); |
# moving stuff up |
} |
for ($i=0;$i<$currentpos;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i]; |
|
} |
|
for ($i=$currentpos;$i<$newpos;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i+1]; |
|
} |
|
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
|
for ($i=$newpos+1;$i<=$#LONCAPA::map::order;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i]; |
|
} |
|
} else { |
|
# moving stuff down |
|
for ($i=0;$i<$newpos;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i]; |
|
} |
|
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
|
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i-1]; |
|
} |
|
for ($i=$currentpos+1;$i<=$#LONCAPA::map::order;$i++) { |
|
$neworder[$i]=$LONCAPA::map::order[$i]; |
|
} |
|
} |
|
@LONCAPA::map::order=@neworder; |
|
# store the changed version |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
if ($fatal) { |
|
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
return; |
|
} |
|
} |
|
|
|
if ($env{'form.pastemarked'}) { |
if ($env{'form.pastemarked'}) { |
my ($errtext,$fatal) = |
&do_paste_from_buffer($coursenum,$coursedom); |
&do_paste_from_buffer($coursenum,$coursedom,$folder, |
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); |
$container); |
return $errtext if ($fatal); |
if ($fatal) { |
} |
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
return; |
$r->print($upload_output); |
|
|
|
if (&handle_edit_cmd()) { |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
return $errtext if ($fatal); |
|
} |
|
# Group import/search |
|
if ($env{'form.importdetail'}) { |
|
my @imports; |
|
foreach (split(/\&/,$env{'form.importdetail'})) { |
|
if (defined($_)) { |
|
my ($name,$url,$residx)= |
|
map {&unescape($_)} split(/\=/,$_); |
|
push(@imports, [$name, $url, $residx]); |
} |
} |
} |
} |
$r->print($upload_output); |
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, |
if ($env{'form.cmd'}) { |
$container,'londocs',@imports); |
my ($cmd,$idx)=split(/\_/,$env{'form.cmd'}); |
return $errtext if ($fatal); |
if ($cmd eq 'del') { |
} |
my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
# Loading a complete map |
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && |
if ($env{'form.loadmap'}) { |
($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { |
if ($env{'form.importmap'}=~/\w/) { |
&Apache::lonnet::removeuploadedurl($url); |
foreach my $res (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
} else { |
my ($title,$url,$ext,$type)=split(/\:/,$res); |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
my $idx=&LONCAPA::map::getresidx($url); |
} |
$LONCAPA::map::resources[$idx]=$res; |
for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
} |
} |
|
$#LONCAPA::map::order--; |
|
} elsif ($cmd eq 'cut') { |
|
my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
|
for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { |
|
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
|
} |
|
$#LONCAPA::map::order--; |
|
} elsif ($cmd eq 'up') { |
|
if (($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
|
my $i=$LONCAPA::map::order[$idx-1]; |
|
$LONCAPA::map::order[$idx-1] = $LONCAPA::map::order[$idx]; |
|
$LONCAPA::map::order[$idx] = $i; |
|
} |
|
} elsif ($cmd eq 'down') { |
|
if (defined($LONCAPA::map::order[$idx+1])) { |
|
my $i=$LONCAPA::map::order[$idx+1]; |
|
$LONCAPA::map::order[$idx+1] = $LONCAPA::map::order[$idx]; |
|
$LONCAPA::map::order[$idx] = $i; |
|
} |
|
} elsif ($cmd eq 'rename') { |
|
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
|
my ($rtitle,@rrest)=split(/\:/, |
|
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
|
my $comment=$env{'form.title'}; |
|
$comment = &LONCAPA::map::qtunescape($comment); |
|
if ($comment=~/\S/) { |
|
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
|
$comment.':'.join(':',@rrest); |
|
} |
|
# Devalidate title cache |
|
my $renamed_url=&LONCAPA::map::qtescape($rrest[0]); |
|
&Apache::lonnet::devalidate_title_cache($renamed_url); |
|
} |
|
# Store the changed version |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
$folder.'.'.$container); |
$folder.'.'.$container); |
if ($fatal) { |
return $errtext if ($fatal); |
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
} else { |
return; |
$r->print('<p><span class="LC_error">'.&mt('No map selected.').'</span></p>'); |
} |
|
} |
} |
# Group import/search |
|
if ($env{'form.importdetail'}) { |
|
my @imports; |
|
foreach (split(/\&/,$env{'form.importdetail'})) { |
|
if (defined($_)) { |
|
my ($name,$url,$residx)= |
|
map {&unescape($_)} split(/\=/,$_); |
|
push(@imports, [$name, $url, $residx]); |
|
} |
|
} |
|
# Store the changed version |
|
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, |
|
$container,'londocs',@imports); |
|
if ($fatal) { |
|
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
return; |
|
} |
|
} |
|
# Loading a complete map |
|
if ($env{'form.loadmap'}) { |
|
if ($env{'form.importmap'}=~/\w/) { |
|
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
|
my ($title,$url,$ext,$type)=split(/\:/,$_); |
|
my $idx=&LONCAPA::map::getresidx($url); |
|
$LONCAPA::map::resources[$idx]=$_; |
|
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
|
} |
|
# Store the changed version |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
|
$folder.'.'.$container); |
|
if ($fatal) { |
|
$r->print('<p><span class="LC_error">'.$errtext.'</span></p>'); |
|
return; |
|
} |
|
} else { |
|
$r->print('<p><span class="LC_error">'.&mt('No map selected.').'</span></p>'); |
|
|
|
} |
|
} |
|
&log_differences($plain); |
|
} |
} |
|
&log_differences($plain); |
|
} |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- Print screen |
# ---------------------------------------------------------------- Print screen |
my $idx=0; |
my $idx=0; |
my $shown=0; |
my $shown=0; |
if (($ishidden) || ($isencrypted) || ($randompick>=0)) { |
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) { |
$r->print('<p>'.&mt('Parameters').':<ul>'. |
$r->print('<p>'.&mt('Parameters').':<ul>'. |
($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':''). |
($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':''). |
($ishidden?'<li>'.&mt('contents hidden').'</li>':''). |
($ishidden?'<li>'.&mt('contents hidden').'</li>':''). |
($isencrypted?'<li>'.&mt('URLs hidden').'</li>':''). |
($isencrypted?'<li>'.&mt('URLs hidden').'</li>':''). |
'</ul></p>'); |
'</ul></p>'); |
} |
} |
if ($randompick>=0) { |
if ($randompick>=0) { |
$r->print('<p>'.&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.').'</p>'); |
$r->print('<p>'.&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.').'</p>'); |
} |
} |
$r->print('<table class="LC_docs_editor">'); |
if ($is_random_order) { |
foreach my $res (@LONCAPA::map::order) { |
$r->print('<p>'.&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.').'</p>'); |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
} |
$name=&LONCAPA::map::qtescape($name); |
$r->print('<table class="LC_docs_editor">'); |
$url=&LONCAPA::map::qtescape($url); |
foreach my $res (@LONCAPA::map::order) { |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
unless ($name) { $idx++; next; } |
$name=&LONCAPA::map::qtescape($name); |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, |
$url=&LONCAPA::map::qtescape($url); |
$coursenum)); |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
$idx++; |
unless ($name) { $idx++; next; } |
$shown++; |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, |
} |
$coursenum)); |
unless ($shown) { |
$idx++; |
$r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>'); |
$shown++; |
} |
|
$r->print("\n</table>\n"); |
|
|
|
&print_paste_buffer($r,$container); |
|
|
|
} |
} |
|
unless ($shown) { |
|
$r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>'); |
|
} |
|
$r->print("\n</table>\n"); |
|
|
|
&print_paste_buffer($r,$container); |
|
return; |
} |
} |
|
|
sub process_file_upload { |
sub process_file_upload { |
Line 1743 sub entryline {
|
Line 1698 sub entryline {
|
my $line='<tr>'; |
my $line='<tr>'; |
my ($form_start,$form_end); |
my ($form_start,$form_end); |
# Edit commands |
# Edit commands |
my $container; |
|
my ($container, $type, $esc_path, $path, $symb); |
my ($container, $type, $esc_path, $path, $symb); |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
$type = 'folder'; |
$type = 'folder'; |
Line 1936 END
|
Line 1890 END
|
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
} |
} |
} |
} |
my $parameterset=' '; |
my ($parameterset,$rand_order_text) = (' ', ' '); |
if ($isfolder || $extension eq 'sequence') { |
if ($isfolder || $extension eq 'sequence') { |
my $foldername=&escape($foldertitle); |
my $foldername=&escape($foldertitle); |
my $folderpath=$env{'form.folderpath'}; |
my $folderpath=$env{'form.folderpath'}; |
Line 1948 END
|
Line 1902 END
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_hiddenresource'))[0]=~/^yes$/i) |
'parameter_hiddenresource'))[0]=~/^yes$/i) |
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&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; |
$url.='folderpath='.&escape($folderpath).$cpinfo; |
$parameterset='<label>'.&mt('Randomly Pick: '). |
$parameterset='<label>'.&mt('Randomly Pick: '). |
'<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
'<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randompick_'.$orderidx.'" value="'. |
(&LONCAPA::map::getparameter($orderidx, |
(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]. |
'parameter_randompick'))[0]. |
'" />'. |
'" />'. |
'<a href="javascript:void(0)">'.&mt('Save').'</a></label>'; |
'<a href="javascript:void(0)">'.&mt('Save').'</a></label>'; |
|
my $ro_set= |
|
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); |
|
$rand_order_text =' |
|
<nobr><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></nobr>'; |
} |
} |
if ($ispage) { |
if ($ispage) { |
my $pagename=&escape($pagetitle); |
my $pagename=&escape($pagetitle); |
Line 2000 END
|
Line 1959 END
|
$line.=(<<ENDPARMS); |
$line.=(<<ENDPARMS); |
<td class="LC_docs_entry_parameter"> |
<td class="LC_docs_entry_parameter"> |
$form_start |
$form_start |
<label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label> |
<label><input type="checkbox" name="hiddenresource_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label> |
$form_end |
$form_end |
</td> |
</td> |
<td class="LC_docs_entry_parameter"> |
<td class="LC_docs_entry_parameter"> |
$form_start |
$form_start |
<label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label> |
<label><input type="checkbox" name="encrypturl_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label> |
$form_end |
$form_end |
</td> |
</td> |
|
<td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td> |
<td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td> |
<td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td> |
ENDPARMS |
ENDPARMS |
} |
} |
Line 2714 sub handler {
|
Line 2674 sub handler {
|
'bull' => 'Bulletin Board', |
'bull' => 'Bulletin Board', |
'mypi' => 'My Personal Info', |
'mypi' => 'My Personal Info', |
'grpo' => 'Group Files', |
'grpo' => 'Group Files', |
|
'rost' => 'Course Roster', |
'abou' => 'About User', |
'abou' => 'About User', |
'imsf' => 'Import IMS package', |
'imsf' => 'Import IMS package', |
'file' => 'File', |
'file' => 'File', |
Line 2784 ENDCOURSEVERIFY
|
Line 2745 ENDCOURSEVERIFY
|
&mt('Editing the Table of Contents for your '.$type))); |
&mt('Editing the Table of Contents for your '.$type))); |
} |
} |
# --------------------------------------------------------- Standard documents |
# --------------------------------------------------------- Standard documents |
$r->print('<table class="LC_docs_documents">');#border=2 cellspacing=4 cellpadding=4>'); |
$r->print('<table class="LC_docs_documents">'); |
|
|
if (($standard) && ($allowed) && (!$forcesupplement)) { |
if (($standard) && ($allowed) && (!$forcesupplement)) { |
$r->print('<tr><td class="LC_docs_document">'); |
$r->print('<tr><td class="LC_docs_document">'); |
# '<h2>'.&mt('Main Course Documents'). |
# '<h2>'.&mt('Main Course Documents'). |
Line 2793 ENDCOURSEVERIFY
|
Line 2755 ENDCOURSEVERIFY
|
if ($folder eq '' || $folder eq 'supplemental') { |
if ($folder eq '' || $folder eq 'supplemental') { |
$folder='default'; |
$folder='default'; |
$env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); |
$env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents')); |
|
$uploadtag = '<input type="hidden" name="folderpath" value="'. |
|
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
} |
} |
my $postexec=''; |
my $postexec=''; |
if ($folder eq 'default') { |
if ($folder eq 'default') { |
Line 2801 ENDCOURSEVERIFY
|
Line 2765 ENDCOURSEVERIFY
|
#$postexec='self.close();'; |
#$postexec='self.close();'; |
} |
} |
$hadchanges=0; |
$hadchanges=0; |
&editor($r,$coursenum,$coursedom,$folder,$allowed,$upload_output); |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed, |
|
$upload_output); |
|
if ($error) { |
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
|
} |
if ($hadchanges) { |
if ($hadchanges) { |
&mark_hash_old() |
&mark_hash_old() |
} |
} |
Line 2998 value="Group Files=/adm/$coursedom/$cour
|
Line 2966 value="Group Files=/adm/$coursedom/$cour
|
$help{'Group Files'} |
$help{'Group Files'} |
</span> |
</span> |
</form> |
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newroster"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="Course Roster=/adm/viewclasslist" /> |
|
<span class="LC_nobreak"> |
|
<input name="newroster" type="submit" value="$lt{'rost'}" /> |
|
$help{'Course Roster'} |
|
</span> |
|
</form> |
ENDFORM |
ENDFORM |
} |
} |
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
Line 3039 ENDBLOCK
|
Line 3016 ENDBLOCK
|
$env{'form.folderpath'}='supplemental&'. |
$env{'form.folderpath'}='supplemental&'. |
&escape(&mt('Supplemental '.$type.' Documents')); |
&escape(&mt('Supplemental '.$type.' Documents')); |
} |
} |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed); |
|
if ($error) { |
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
|
} |
if ($allowed) { |
if ($allowed) { |
my $folderseq= |
my $folderseq= |
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. |
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. |