version 1.518, 2012/12/02 22:40:09
|
version 1.519, 2012/12/03 14:47:30
|
Line 391 sub docs_change_log {
|
Line 391 sub docs_change_log {
|
my %orderhash; |
my %orderhash; |
my $container='sequence'; |
my $container='sequence'; |
my $pathitem; |
my $pathitem; |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /\:1$/) { |
$container='page'; |
$container='page'; |
$pathitem = '<input type="hidden" name="pagepath" value="'. |
|
&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'; |
|
} else { |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath eq '') { |
|
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents')); |
|
} |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
|
&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
|
} |
} |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath eq '') { |
|
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents').':::::'); |
|
} |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
|
&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
my $jumpto = $readfile; |
my $jumpto = $readfile; |
$jumpto =~ s{^/}{}; |
$jumpto =~ s{^/}{}; |
Line 761 sub print_paste_buffer {
|
Line 758 sub print_paste_buffer {
|
} |
} |
} |
} |
$r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs); |
$r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs); |
if ($container eq 'page') { |
$r->print(' |
$r->print(' |
|
<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" /> |
|
<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" /> |
|
'); |
|
} else { |
|
$r->print(' |
|
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /> |
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /> |
'); |
'); |
} |
|
$r->print('</form>'); |
$r->print('</form>'); |
} else { |
} else { |
$r->print(&mt('Paste buffer contains:').' '.$buffer. |
$r->print(&mt('Paste buffer contains:').' '.$buffer. |
Line 1692 sub handle_edit_cmd {
|
Line 1682 sub handle_edit_cmd {
|
sub editor { |
sub editor { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_; |
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_; |
my $container= ($env{'form.pagepath'}) ? 'page' |
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container); |
: 'sequence'; |
|
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order); |
|
if ($allowed) { |
if ($allowed) { |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) = |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain, |
|
$is_random_order,$container) = |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
$r->print($breadcrumbtrail); |
$r->print($breadcrumbtrail); |
|
} elsif ($env{'form.folderpath'} =~ /\:1$/) { |
|
$container = 'page'; |
|
} else { |
|
$container = 'sequence'; |
} |
} |
|
|
my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; |
my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; |
Line 1862 sub editor {
|
Line 1855 sub editor {
|
unless ($name) { $idx++; next; } |
unless ($name) { $idx++; next; } |
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$coursenum,$coursedom,$crstype, |
$coursenum,$coursedom,$crstype, |
$pathitem,$supplementalflag); |
$pathitem,$supplementalflag,$container); |
$idx++; |
$idx++; |
$shown++; |
$shown++; |
} |
} |
Line 1948 sub process_file_upload {
|
Line 1941 sub process_file_upload {
|
my $errtext=''; |
my $errtext=''; |
my $fatal=0; |
my $fatal=0; |
my $container='sequence'; |
my $container='sequence'; |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /:1$/) { |
$container='page'; |
$container='page'; |
} |
} |
($errtext,$fatal)= |
($errtext,$fatal)= |
Line 2038 sub process_file_upload {
|
Line 2031 sub process_file_upload {
|
my $archiveurl = &HTML::Entities::encode($url,'<>&"'); |
my $archiveurl = &HTML::Entities::encode($url,'<>&"'); |
my %archiveitems = ( |
my %archiveitems = ( |
folderpath => $env{'form.folderpath'}, |
folderpath => $env{'form.folderpath'}, |
pagepath => $env{'form.pagepath'}, |
|
cmd => $nextphase, |
cmd => $nextphase, |
newidx => $newidx, |
newidx => $newidx, |
position => $position, |
position => $position, |
Line 2093 sub is_supplemental_title {
|
Line 2085 sub is_supplemental_title {
|
|
|
sub entryline { |
sub entryline { |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
$crstype,$pathitem,$supplementalflag)=@_; |
$crstype,$pathitem,$supplementalflag,$container)=@_; |
my ($foldertitle,$pagetitle,$renametitle); |
my ($foldertitle,$renametitle); |
if (&is_supplemental_title($title)) { |
if (&is_supplemental_title($title)) { |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
$pagetitle = $foldertitle; |
|
} else { |
} else { |
$title=&HTML::Entities::encode($title,'"<>&\''); |
$title=&HTML::Entities::encode($title,'"<>&\''); |
$renametitle=$title; |
$renametitle=$title; |
$foldertitle=$title; |
$foldertitle=$title; |
$pagetitle=$title; |
|
} |
} |
|
|
my $orderidx=$LONCAPA::map::order[$index]; |
my $orderidx=$LONCAPA::map::order[$index]; |
Line 2113 sub entryline {
|
Line 2103 sub entryline {
|
my $line=&Apache::loncommon::start_data_table_row(); |
my $line=&Apache::loncommon::start_data_table_row(); |
my ($form_start,$form_end,$form_common); |
my ($form_start,$form_end,$form_common); |
# Edit commands |
# Edit commands |
my ($container, $type, $esc_path, $path, $symb); |
my ($type, $esc_path, $path, $symb); |
|
if ($container eq 'page') { |
|
$type = 'page'; |
|
} else { |
|
$type = 'folder'; |
|
} |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
$type = 'folder'; |
|
$container = 'sequence'; |
|
$esc_path=&escape($env{'form.folderpath'}); |
$esc_path=&escape($env{'form.folderpath'}); |
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
} |
} |
if ($env{'form.pagepath'}) { |
|
$type = $container = 'page'; |
|
$esc_path=&escape($env{'form.pagepath'}); |
|
$path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"'); |
|
} |
|
my $isexternal; |
my $isexternal; |
if ($residx) { |
if ($residx) { |
my $currurl = $url; |
my $currurl = $url; |
Line 2258 sub entryline {
|
Line 2246 sub entryline {
|
ENDCOPY |
ENDCOPY |
} else { |
} else { |
$copylink=(<<ENDCOPY); |
$copylink=(<<ENDCOPY); |
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a> |
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$folder');" class="LC_docs_copy">$lt{'cp'}</a> |
ENDCOPY |
ENDCOPY |
} |
} |
if ($nocut) { |
if ($nocut) { |
Line 2267 ENDCOPY
|
Line 2255 ENDCOPY
|
ENDCUT |
ENDCUT |
} else { |
} else { |
$cutlink=(<<ENDCUT); |
$cutlink=(<<ENDCUT); |
<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a> |
<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a> |
ENDCUT |
ENDCUT |
} |
} |
if ($noremove) { |
if ($noremove) { |
Line 2276 ENDCUT
|
Line 2264 ENDCUT
|
ENDREM |
ENDREM |
} else { |
} else { |
$removelink=(<<ENDREM); |
$removelink=(<<ENDREM); |
<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a> |
<a href='javascript:removeres("$esc_path","$index","$renametitle",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a> |
ENDREM |
ENDREM |
} |
} |
unless ($isexternal) { |
unless ($isexternal) { |
$renamelink=(<<ENDREN); |
$renamelink=(<<ENDREN); |
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a> |
<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a> |
ENDREN |
ENDREN |
} |
} |
$form_start = ' |
$form_start = ' |
Line 2326 END
|
Line 2314 END
|
my ($extension)=($url=~/\.(\w+)$/); |
my ($extension)=($url=~/\.(\w+)$/); |
my $uploaded=($url=~/^\/*uploaded\//); |
my $uploaded=($url=~/^\/*uploaded\//); |
my $icon=&Apache::loncommon::icon($url); |
my $icon=&Apache::loncommon::icon($url); |
my $isfolder=0; |
my $isfolder; |
my $ispage=0; |
my $ispage; |
my $folderarg; |
my $containerarg; |
my $pagearg; |
|
my $pagefile; |
|
if ($uploaded) { |
if ($uploaded) { |
if (($extension eq 'sequence') || ($extension eq 'page')) { |
if (($extension eq 'sequence') || ($extension eq 'page')) { |
$url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/; |
$url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/; |
my $containerarg = $1; |
$containerarg = $1; |
if ($extension eq 'sequence') { |
if ($extension eq 'sequence') { |
$icon=$iconpath.'navmap.folder.closed.gif'; |
$icon=$iconpath.'navmap.folder.closed.gif'; |
$folderarg=$containerarg; |
|
$isfolder=1; |
$isfolder=1; |
} else { |
} else { |
$icon=$iconpath.'page.gif'; |
$icon=$iconpath.'page.gif'; |
$pagearg=$containerarg; |
|
$ispage=1; |
$ispage=1; |
} |
} |
if ($allowed) { |
if ($allowed) { |
Line 2359 END
|
Line 2343 END
|
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
$url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
if (!$supplementalflag && $residx && $symb) { |
if (!$supplementalflag && $residx && $symb) { |
if ($container eq 'page') { |
|
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]); |
|
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
|
} |
|
if ((!$isfolder) && (!$ispage)) { |
if ((!$isfolder) && (!$ispage)) { |
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
$url=&Apache::lonnet::clutter($url); |
$url=&Apache::lonnet::clutter($url); |
Line 2387 END
|
Line 2367 END
|
} |
} |
} |
} |
my ($rand_pick_text,$rand_order_text); |
my ($rand_pick_text,$rand_order_text); |
if ($isfolder || $extension eq 'sequence') { |
if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') { |
my $foldername=&escape($foldertitle); |
my $foldername=&escape($foldertitle); |
my $folderpath=$env{'form.folderpath'}; |
my $folderpath=$env{'form.folderpath'}; |
if ($folderpath) { $folderpath.='&' }; |
if ($folderpath) { $folderpath.='&' }; |
if (!$allowed && $supplementalflag) { |
if (!$allowed && $supplementalflag) { |
$folderpath.=$folderarg.'&'.$foldername; |
$folderpath.=$containerarg.'&'.$foldername; |
$url.='folderpath='.&escape($folderpath); |
$url.='folderpath='.&escape($folderpath); |
} else { |
} else { |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# so it gets transferred between levels |
# so it gets transferred between levels |
$folderpath.=$folderarg.'&'.$foldername. |
$folderpath.=$containerarg.'&'.$foldername. |
':'.(&LONCAPA::map::getparameter($orderidx, |
':'.(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0] |
'parameter_randompick'))[0] |
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
Line 2405 END
|
Line 2385 END
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_encrypturl'))[0]=~/^yes$/i) |
'parameter_encrypturl'))[0]=~/^yes$/i) |
.':'.((&LONCAPA::map::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_randomorder'))[0]=~/^yes$/i); |
'parameter_randomorder'))[0]=~/^yes$/i) |
|
.':'.$ispage; |
$url.='folderpath='.&escape($folderpath); |
$url.='folderpath='.&escape($folderpath); |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]; |
'parameter_randompick'))[0]; |
Line 2439 $form_common.'
|
Line 2420 $form_common.'
|
$url .= '&idx='.$orderidx; |
$url .= '&idx='.$orderidx; |
} |
} |
} |
} |
if ($ispage) { |
my ($tdalign,$tdwidth); |
my $pagename=&escape($pagetitle); |
|
my $pagepath; |
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath) { $pagepath = $folderpath.'&' }; |
|
$pagepath.=$pagearg.'&'.$pagename; |
|
$url.='pagepath='.&escape($pagepath). |
|
'&pagesymb='.&escape($symb); |
|
} |
|
if ($allowed) { |
if ($allowed) { |
my $fileloc = |
my $fileloc = |
&Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url)); |
&Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url)); |
Line 2471 $form_common.'
|
Line 2444 $form_common.'
|
} |
} |
} |
} |
} |
} |
|
$tdalign = ' align="right" valign="top"'; |
|
$tdwidth = ' width="80%"'; |
} |
} |
my $reinit; |
my $reinit; |
if ($crstype eq 'Community') { |
if ($crstype eq 'Community') { |
$reinit = &mt('(re-initialize community to access)'); |
$reinit = &mt('(re-initialize community to access)'); |
} else { |
} else { |
$reinit = &mt('(re-initialize course to access)'); |
$reinit = &mt('(re-initialize course to access)'); |
} |
} |
$line.='<td class="LC_docs_entry_commands" align="right" valign="top"><span class="LC_nobreak">'.$editlink.$renamelink; |
$line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink; |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>'; |
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>'; |
} elsif ($url) { |
} elsif ($url) { |
Line 2487 $form_common.'
|
Line 2462 $form_common.'
|
} else { |
} else { |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
} |
} |
$line.='</span></td><td width="80%">'; |
$line.='</span></td><td'.$tdwidth.'>'; |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
$line.='<a href="'.$url.'">'.$title.'</a>'; |
$line.='<a href="'.$url.'">'.$title.'</a>'; |
} elsif ($url) { |
} elsif ($url) { |
Line 3038 sub changewarning {
|
Line 3013 sub changewarning {
|
my $pathvar='folderpath'; |
my $pathvar='folderpath'; |
my $path=&escape($env{'form.folderpath'}); |
my $path=&escape($env{'form.folderpath'}); |
if (!defined($url)) { |
if (!defined($url)) { |
if (defined($env{'form.pagepath'})) { |
|
$pathvar='pagepath'; |
|
$path=&escape($env{'form.pagepath'}); |
|
$path.='&pagesymb='.&escape($env{'form.pagesymb'}); |
|
} |
|
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
} |
} |
my $course_type = &Apache::loncommon::course_type(); |
my $course_type = &Apache::loncommon::course_type(); |
Line 3216 sub handler {
|
Line 3186 sub handler {
|
# Get the parameters that may be needed |
# Get the parameters that may be needed |
# |
# |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','pagepath', |
['folderpath', |
'pagesymb','forcesupplement','forcestandard', |
'forcesupplement','forcestandard', |
'tools','symb','command','supppath']); |
'tools','symb','command','supppath']); |
|
|
# standard=1: this is a "new-style" course with an uploaded map as top level |
# standard=1: this is a "new-style" course with an uploaded map as top level |
Line 3232 sub handler {
|
Line 3202 sub handler {
|
|
|
|
|
my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); |
my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); |
if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) { |
if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) { |
$supplementalflag=0; |
$supplementalflag=0; |
} |
} |
if ($env{'form.forcesupplement'}) { $supplementalflag=1; } |
if ($env{'form.forcesupplement'}) { $supplementalflag=1; } |
Line 3284 sub handler {
|
Line 3254 sub handler {
|
':'.$res->randompick(). |
':'.$res->randompick(). |
':'.$res->randomout(). |
':'.$res->randomout(). |
':'.$res->encrypted(). |
':'.$res->encrypted(). |
':'.$res->randomorder(); |
':'.$res->randomorder(). |
|
':'.$res->is_page(); |
} |
} |
} |
} |
} |
} |
Line 3299 sub handler {
|
Line 3270 sub handler {
|
':'.$mapresobj->randompick(). |
':'.$mapresobj->randompick(). |
':'.$mapresobj->randomout(). |
':'.$mapresobj->randomout(). |
':'.$mapresobj->encrypted(). |
':'.$mapresobj->encrypted(). |
':'.$mapresobj->randomorder(); |
':'.$mapresobj->randomorder(). |
|
':'.$mapresobj->is_page(); |
} else { |
} else { |
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
|
my $ispage = (($type eq 'page')? 1 : ''); |
if ($mapurl eq 'default') { |
if ($mapurl eq 'default') { |
$maptitle = 'Main Course Documents'; |
$maptitle = 'Main Course Documents'; |
} |
} |
$path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
$path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
&Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage; |
} |
} |
unless ($mapurl eq 'default') { |
unless ($mapurl eq 'default') { |
$path = 'default&'. |
$path = 'default&'. |
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
'::::&'.$path; |
':::::&'.$path; |
} |
|
if ($type eq 'sequence') { |
|
$env{'form.folderpath'}=$path; |
|
$env{'form.pagepath'}=''; |
|
} else { |
|
$env{'form.pagepath'}=$path; |
|
$env{'form.folderpath'}=''; |
|
} |
} |
|
$env{'form.folderpath'}=$path; |
} elsif ($env{'form.supppath'} ne '') { |
} elsif ($env{'form.supppath'} ne '') { |
$env{'form.folderpath'}=$env{'form.supppath'}; |
$env{'form.folderpath'}=$env{'form.supppath'}; |
} |
} |
} elsif ($env{'form.command'} eq 'editdocs') { |
} elsif ($env{'form.command'} eq 'editdocs') { |
$env{'form.folderpath'} = 'default&'. |
$env{'form.folderpath'} = 'default&'. |
&Apache::lonhtmlcommon::entity_encode('Main Course Content'); |
&Apache::lonhtmlcommon::entity_encode('Main Course Content'). |
$env{'form.pagepath'}=''; |
':::::'; |
} elsif ($env{'form.command'} eq 'editsupp') { |
} elsif ($env{'form.command'} eq 'editsupp') { |
$env{'form.folderpath'} = 'default&'. |
$env{'form.folderpath'} = 'default&'. |
&Apache::lonhtmlcommon::entity_encode('Supplemental Content'); |
&Apache::lonhtmlcommon::entity_encode('Supplemental Content'); |
$env{'form.pagepath'}=''; |
|
} |
} |
|
|
# Where do we store these for when we come back? |
# Where do we store these for when we come back? |
Line 3339 sub handler {
|
Line 3305 sub handler {
|
$stored_folderpath='docs_sup_folderpath'; |
$stored_folderpath='docs_sup_folderpath'; |
} |
} |
|
|
# No folderpath, no pagepath, and in edit mode, see if we have something stored |
# No folderpath, and in edit mode, see if we have something stored |
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'}) && $allowed) { |
if ((!$env{'form.folderpath'}) && $allowed) { |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
{'folderpath' => 'scalar'}); |
{'folderpath' => 'scalar'}); |
} |
} |
|
|
# If we are not allowed to make changes, all we can see are supplemental docs |
# If we are not allowed to make changes, all we can see are supplemental docs |
if (!$allowed) { |
if (!$allowed) { |
$env{'form.pagepath'}=''; |
|
unless ($env{'form.folderpath'} =~ /^supplemental/) { |
unless ($env{'form.folderpath'} =~ /^supplemental/) { |
$env{'form.folderpath'} = &supplemental_base(); |
$env{'form.folderpath'} = &supplemental_base(); |
} |
} |
} |
} |
# If we still not have a folderpath, see if we can resurrect at pagepath |
|
if (!$env{'form.folderpath'} && $allowed) { |
|
&Apache::loncommon::restore_course_settings($stored_folderpath, |
|
{'pagepath' => 'scalar'}); |
|
} |
|
# Make the zeroth entry in supplemental docs page paths, so we can get to top level |
# Make the zeroth entry in supplemental docs page paths, so we can get to top level |
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { |
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { |
$env{'form.folderpath'} = &supplemental_base() |
$env{'form.folderpath'} = &supplemental_base() |
Line 3364 sub handler {
|
Line 3324 sub handler {
|
$env{'form.folderpath'}; |
$env{'form.folderpath'}; |
} |
} |
# If after all of this, we still don't have any paths, make them |
# If after all of this, we still don't have any paths, make them |
unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) { |
unless ($env{'form.folderpath'}) { |
if ($supplementalflag) { |
if ($supplementalflag) { |
$env{'form.folderpath'}=&supplemental_base(); |
$env{'form.folderpath'}=&supplemental_base(); |
} else { |
} else { |
$env{'form.folderpath'}='default'; |
$env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Documents')). |
|
':::::'; |
} |
} |
} |
} |
|
|
Line 3376 sub handler {
|
Line 3337 sub handler {
|
unless ($toolsflag) { |
unless ($toolsflag) { |
if ($allowed) { |
if ($allowed) { |
&Apache::loncommon::store_course_settings($stored_folderpath, |
&Apache::loncommon::store_course_settings($stored_folderpath, |
{'pagepath' => 'scalar', |
{'folderpath' => 'scalar'}); |
'folderpath' => 'scalar'}); |
|
} |
} |
|
my $folderpath; |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
my (@folderpath)=split('&',$env{'form.folderpath'}); |
$folderpath = $env{'form.folderpath'}; |
$env{'form.foldername'}=&unescape(pop(@folderpath)); |
my (@folders)=split('&',$env{'form.folderpath'}); |
$env{'form.folder'}=pop(@folderpath); |
$env{'form.foldername'}=&unescape(pop(@folders)); |
$container='sequence'; |
if ($env{'form.foldername'} =~ /\:1$/) { |
} |
$container = 'page'; |
if ($env{'form.pagepath'}) { |
} else { |
my (@pagepath)=split('&',$env{'form.pagepath'}); |
$container = 'sequence'; |
$env{'form.pagename'}=&unescape(pop(@pagepath)); |
} |
$env{'form.folder'}=pop(@pagepath); |
$env{'form.folder'}=pop(@folders); |
$container='page'; |
|
$containertag = '<input type="hidden" name="pagepath" value="" />'. |
|
'<input type="hidden" name="pagesymb" value="" />'; |
|
$pathitem = |
|
'<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'. |
|
'<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'. |
|
'<input type="hidden" name="folderpath" value="" />'; |
|
} else { |
} else { |
my $folderpath=$env{'form.folderpath'}; |
if ($env{'form.folder'} eq '' || |
if (!$folderpath) { |
$env{'form.folder'} eq 'supplemental') { |
if ($env{'form.folder'} eq '' || |
$folderpath='default&'. |
$env{'form.folder'} eq 'supplemental') { |
&escape(&mt('Main '.$crstype.' Documents')). |
$folderpath='default&'. |
':::::'; |
&escape(&mt('Main '.$crstype.' Documents')); |
|
} |
|
} |
} |
$containertag = '<input type="hidden" name="folderpath" value="" />'; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
|
} |
} |
|
$containertag = '<input type="hidden" name="folderpath" value="" />'; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { |
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { |
$showdoc='/'.$1; |
$showdoc='/'.$1; |
} |
} |
Line 3445 sub handler {
|
Line 3397 sub handler {
|
@tabids = ('002','ee2','ff2'); |
@tabids = ('002','ee2','ff2'); |
} else { |
} else { |
@tabids = ('aa1','bb1','cc1','ff1'); |
@tabids = ('aa1','bb1','cc1','ff1'); |
unless ($env{'form.pagepath'}) { |
unless ($env{'form.folderpath'} =~ /\:1$/) { |
unshift(@tabids,'001'); |
unshift(@tabids,'001'); |
push(@tabids,('dd1','ee1')); |
push(@tabids,('dd1','ee1')); |
} |
} |
Line 3752 HIDDENFORM
|
Line 3704 HIDDENFORM
|
} |
} |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
my $container='sequence'; |
|
if ($env{'form.pagepath'}) { |
|
$container='page'; |
|
} |
|
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
|
|
my $newnavform=(<<NNFORM); |
my $newnavform=(<<NNFORM); |
Line 3913 NGFFORM
|
Line 3861 NGFFORM
|
|
|
|
|
my @importdoc = ( |
my @importdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform}, |
); |
{'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform, |
unless ($container eq 'page') { |
}); |
push(@importdoc, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform} |
|
); |
|
} |
|
push(@importdoc, |
|
{'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform} |
|
); |
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc)); |
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc)); |
|
|
@gradingforma=( |
@gradingforma=( |
Line 3941 my %orderhash = (
|
Line 3895 my %orderhash = (
|
'bb' => ['Published Content',$importpubform], |
'bb' => ['Published Content',$importpubform], |
'cc' => ['Grading Resources',$gradingform], |
'cc' => ['Grading Resources',$gradingform], |
); |
); |
unless ($env{'form.pagepath'}) { |
unless ($container eq 'page') { |
$orderhash{'00'} = ['Newfolder',$newfolderform]; |
$orderhash{'00'} = ['Newfolder',$newfolderform]; |
$orderhash{'dd'} = ['Collaboration',$communityform]; |
$orderhash{'dd'} = ['Collaboration',$communityform]; |
$orderhash{'ee'} = ['Special Pages',$specialdocumentsform]; |
$orderhash{'ee'} = ['Special Pages',$specialdocumentsform]; |
Line 3974 unless ($env{'form.pagepath'}) {
|
Line 3928 unless ($env{'form.pagepath'}) {
|
} elsif ($allowed) { |
} elsif ($allowed) { |
$env{'form.folderpath'} = $savefolderpath; |
$env{'form.folderpath'} = $savefolderpath; |
} |
} |
$env{'form.pagepath'} = ''; |
|
$pathitem = '<input type="hidden" name="folderpath" value="'. |
$pathitem = '<input type="hidden" name="folderpath" value="'. |
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
if ($allowed) { |
if ($allowed) { |
Line 4143 sub decompression_info {
|
Line 4096 sub decompression_info {
|
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $container='sequence'; |
my $container='sequence'; |
my ($pathitem,$hiddenelem); |
my ($pathitem,$hiddenelem); |
my @hiddens = ('newidx','comment','position'); |
my @hiddens = ('newidx','comment','position','folderpath'); |
if ($env{'form.pagepath'}) { |
if ($env{'form.folderpath'} =~ /\:1$/) { |
$container='page'; |
$container='page'; |
$pathitem = 'pagepath'; |
|
} else { |
|
$pathitem = 'folderpath'; |
|
} |
} |
unshift(@hiddens,$pathitem); |
unshift(@hiddens,$pathitem); |
foreach my $item (@hiddens) { |
foreach my $item (@hiddens) { |
Line 4435 sub editing_js {
|
Line 4385 sub editing_js {
|
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"'); |
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"'); |
my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"'); |
|
my $main_container_page; |
my $main_container_page; |
if ($docs_folderpath eq '') { |
if (&HTML::Entities::decode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'}) =~ /\:1$/) { |
if ($docs_pagepath ne '') { |
$main_container_page = 1; |
$main_container_page = 1; |
|
} |
|
} |
} |
my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents'; |
my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A'; |
my $toplevelsupp = &supplemental_base(); |
my $toplevelsupp = &supplemental_base(); |
|
|
my $backtourl = '/adm/navmaps'; |
my $backtourl = '/adm/navmaps'; |
Line 4450 sub editing_js {
|
Line 4397 sub editing_js {
|
$backtourl = '/adm/supplemental'; |
$backtourl = '/adm/supplemental'; |
} |
} |
|
|
my $fieldsets = "'ext','doc','ims'"; |
my $fieldsets = "'ext','doc'"; |
|
unless ($main_container_page) { |
|
$fieldsets .=",'ims'"; |
|
} |
if ($supplementalflag) { |
if ($supplementalflag) { |
$fieldsets = "'suppext','suppdoc'"; |
$fieldsets = "'suppext','suppdoc'"; |
} |
} |
Line 4580 function makeims(imsform) {
|
Line 4530 function makeims(imsform) {
|
imsform.submit(); |
imsform.submit(); |
} |
} |
|
|
function changename(folderpath,index,oldtitle,container,pagesymb) { |
function changename(folderpath,index,oldtitle) { |
var title=prompt('$lt{"p_chn"}',oldtitle); |
var title=prompt('$lt{"p_chn"}',oldtitle); |
if (title) { |
if (title) { |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.title.value=title; |
this.document.forms.renameform.title.value=title; |
this.document.forms.renameform.cmd.value='rename_'+index; |
this.document.forms.renameform.cmd.value='rename_'+index; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) { |
function removeres(folderpath,index,oldtitle,skip_confirm) { |
if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { |
if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) { |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.markcopy.value=-1; |
this.document.forms.renameform.cmd.value='del_'+index; |
this.document.forms.renameform.cmd.value='del_'+index; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) { |
function cutres(folderpath,index,oldtitle,container,folder,skip_confirm) { |
if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { |
if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) { |
this.document.forms.renameform.cmd.value='cut_'+index; |
this.document.forms.renameform.cmd.value='cut_'+index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
} |
} |
|
|
function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) { |
function markcopy(folderpath,index,oldtitle,container,folder) { |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.markcopy.value=index; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
if (container == 'sequence') { |
|
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
|
} |
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
} |
} |
|
|
Line 4735 function showPage(current, pageId, nav,
|
Line 4661 function showPage(current, pageId, nav,
|
toggleMap(); |
toggleMap(); |
if (nav == 'mainnav') { |
if (nav == 'mainnav') { |
var storedpath = "$docs_folderpath"; |
var storedpath = "$docs_folderpath"; |
if (storedpath == '') { |
|
storedpath = "$docs_pagepath"; |
|
} |
|
var storedpage = "$main_container_page"; |
var storedpage = "$main_container_page"; |
var reg = new RegExp("^supplemental"); |
var reg = new RegExp("^supplemental"); |
if (pageId == 'mainCourseDocuments') { |
if (pageId == 'mainCourseDocuments') { |