version 1.271, 2007/01/29 21:18:53
|
version 1.278.2.1, 2007/06/28 23:26:46
|
Line 904 sub store_template {
|
Line 904 sub store_template {
|
# Imports the given (name, url) resources into the course |
# Imports the given (name, url) resources into the course |
# coursenum, coursedom, and folder must precede the list |
# coursenum, coursedom, and folder must precede the list |
sub group_import { |
sub group_import { |
my $coursenum = shift; |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
my $coursedom = shift; |
|
my $folder = shift; |
while (@files) { |
my $container = shift; |
my $name = shift(@files); |
my $caller = shift; |
my $url = shift(@files); |
while (@_) { |
#FIXME check if file exists before overwriting, might be restoring it |
my $name = shift; |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) |
my $url = shift; |
&& ($caller eq 'londocs') |
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 $errtext = ''; |
my $fatal = 0; |
my $fatal = 0; |
my $newmapstr = '<map>'."\n". |
my $newmapstr = '<map>'."\n". |
Line 936 sub group_import {
|
Line 937 sub group_import {
|
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
my $ext = 'false'; |
my $ext = 'false'; |
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } |
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } |
$url =~ &LONCAPA::map::qtunescape($url); |
$url = &LONCAPA::map::qtunescape($url); |
$name =~ &LONCAPA::map::qtunescape($name); |
$name = &LONCAPA::map::qtunescape($name); |
$LONCAPA::map::resources[$idx] = |
$LONCAPA::map::resources[$idx] = |
join ':', ($name, $url, $ext, 'normal', 'res'); |
join ':', ($name, $url, $ext, 'normal', 'res'); |
} |
} |
Line 966 sub breadcrumbs {
|
Line 967 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 975 sub breadcrumbs {
|
Line 977 sub breadcrumbs {
|
&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 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 { |
Line 983 sub breadcrumbs {
|
Line 985 sub breadcrumbs {
|
} |
} |
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 994 sub breadcrumbs {
|
Line 997 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 1085 sub docs_change_log {
|
Line 1088 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 1167 sub docs_change_log {
|
Line 1171 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 1209 sub editor {
|
Line 1213 sub editor {
|
$env{'form.markedcopy_title'}=$title; |
$env{'form.markedcopy_title'}=$title; |
$env{'form.markedcopy_url'}=$url; |
$env{'form.markedcopy_url'}=$url; |
} |
} |
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) { |
if ($fatal) { |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
Line 1250 sub editor {
|
Line 1254 sub editor {
|
&remember_parms($idx,'encrypturl','del'); |
&remember_parms($idx,'encrypturl','del'); |
} |
} |
} |
} |
|
if ($env{'form.changeparms'} eq 'randomorder') { |
|
if ($env{'form.randorder_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_randomorder','yes','string_yesno'); |
|
&remember_parms($idx,'randomorder','set',$env{'form.randorder_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_randomorder'); |
|
&remember_parms($idx,'randomorder','del'); |
|
} |
|
} |
# store the changed version |
# store the changed version |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
if ($fatal) { |
if ($fatal) { |
Line 1434 sub editor {
|
Line 1447 sub editor {
|
# ---------------------------------------------------------------- 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>':''). |
|
($is_random_order?'<li>'.&mt('contents randomly ordered').'</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>'); |
} |
} |
|
if ($is_random_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. Do not modify the contents of this folder if it is in active student use.').'</p>'); |
|
} |
$r->print('<table>'); |
$r->print('<table>'); |
foreach (@LONCAPA::map::order) { |
foreach my $res (@LONCAPA::map::order) { |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]); |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
$name=&LONCAPA::map::qtescape($name); |
$name=&LONCAPA::map::qtescape($name); |
$url=&LONCAPA::map::qtescape($url); |
$url=&LONCAPA::map::qtescape($url); |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $idx++; next; } |
unless ($name) { $idx++; next; } |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, |
|
$coursenum)); |
$idx++; |
$idx++; |
$shown++; |
$shown++; |
} |
} |
Line 1465 sub editor {
|
Line 1484 sub editor {
|
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
ENDPASTE |
ENDPASTE |
$r->print( |
$r->print('<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> '); |
'<input type="submit" name="pastemarked" value="'.&mt('Paste'). |
|
'" /> '.&Apache::loncommon::filedescription( |
my $type; |
(split(/\./,$env{'form.markedcopy_url'}))[-1]).': '. |
if ($env{'form.markedcopy_url'} =~ m{^/adm/wrapper/ext}) { |
$env{'form.markedcopy_title'}); |
$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 = '<img src="'.&Apache::loncommon::icon($extension). |
|
'" class="LC_icon" />'; |
|
$r->print($icon.$type.': '. $env{'form.markedcopy_title'}); |
|
} |
if ($container eq 'page') { |
if ($container eq 'page') { |
$r->print(<<PAGEINFO); |
$r->print(<<PAGEINFO); |
<input type="hidden" name="pagepath" value="$env{'form.pagepath'}" /> |
<input type="hidden" name="pagepath" value="$env{'form.pagepath'}" /> |
Line 1583 sub ask_for_embedded_content {
|
Line 1610 sub ask_for_embedded_content {
|
&Apache::loncommon::start_data_table(); |
&Apache::loncommon::start_data_table(); |
|
|
my $num = 0; |
my $num = 0; |
foreach my $embed_file (keys(%{$allfiles})) { |
foreach my $embed_file (sort {lc($a) cmp lc($b)} keys(%{$allfiles})) { |
$upload_output .= &Apache::loncommon::start_data_table_row(). |
$upload_output .= &Apache::loncommon::start_data_table_row(). |
'<td>'.$embed_file.'</td><td>'; |
'<td>'.$embed_file.'</td><td>'; |
if ($args->{'error_on_invalid_names'} |
if ($args->{'ignore_remote_references'} |
|
&& $embed_file =~ m{^\w+://}) { |
|
$upload_output.='<span class="LC_warning">'.&mt("URL points to other server.").'</span>'; |
|
} elsif ($args->{'error_on_invalid_names'} |
&& $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) { |
&& $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) { |
|
|
$upload_output.='<span class="LC_warning">'.&mt("Invalid characters").'</span>'; |
$upload_output.='<span class="LC_warning">'.&mt("Invalid characters").'</span>'; |
|
|
} else { |
} else { |
|
|
$upload_output .=' |
$upload_output .=' |
<input name="embedded_item_'.$num.'" type="file" value="bob" /> |
<input name="embedded_item_'.$num.'" type="file" value="bob" /> |
<input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />'; |
<input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />'; |
Line 1611 sub ask_for_embedded_content {
|
Line 1643 sub ask_for_embedded_content {
|
} |
} |
$upload_output .= &Apache::loncommon::end_data_table().'<br /> |
$upload_output .= &Apache::loncommon::end_data_table().'<br /> |
<input type ="hidden" name="number_embedded_items" value="'.$num.'" /> |
<input type ="hidden" name="number_embedded_items" value="'.$num.'" /> |
<input type ="submit" value="Complete upload" /> |
<input type ="submit" value="'.&mt('Upload Listed Files').'" /> |
|
'.&mt('(only files for which a location has been provided will be uploaded)').' |
</form>'; |
</form>'; |
return $upload_output; |
return $upload_output; |
} |
} |
Line 1873 END
|
Line 1906 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="randpick_'.$orderidx.'" value="'. |
(&LONCAPA::map::getparameter($orderidx, |
(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]. |
'parameter_randompick'))[0]. |
'" />'. |
'" />'. |
'<font size="-2"><a href="javascript:void(0)">'.&mt('Store').'</a></font></label>'; |
'<font size="-2"><a href="javascript:void(0)">'.&mt('Save').'</a></font></label>'; |
|
|
} |
} |
if ($ispage) { |
if ($ispage) { |
Line 1908 END
|
Line 1943 END
|
if (($allowed) && ($folder!~/^supplemental/)) { |
if (($allowed) && ($folder!~/^supplemental/)) { |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'hd' => 'Hidden', |
'hd' => 'Hidden', |
'ec' => 'URL hidden'); |
'ec' => 'URL hidden', |
|
'ro' => 'Random Order',); |
my $enctext= |
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= |
my $hidtext= |
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); |
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); |
|
my $rotext= |
|
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); |
$line.=(<<ENDPARMS); |
$line.=(<<ENDPARMS); |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td> |
|
<td bgcolor="#BBBBFF"><font size='-2'> |
|
<nobr><label><input type="checkbox" name="randorder_$orderidx" onClick="this.form.changeparms.value='randomorder';this.form.submit()" $rotext /> $lt{'ro'}</label></nobr></td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
ENDPARMS |
ENDPARMS |
} |
} |
Line 2139 sub checkversions {
|
Line 2179 sub checkversions {
|
if (&Apache::lonnet::put('resourceversions',\%newsetversions, |
if (&Apache::lonnet::put('resourceversions',\%newsetversions, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { |
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { |
$r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>'); |
$r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>'); |
} else { |
} else { |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</font></h1>'); |
} |
} |
&mark_hash_old(); |
&mark_hash_old(); |
} |
} |