version 1.484.2.18, 2012/12/13 04:15:30
|
version 1.484.2.19, 2012/12/13 04:51:41
|
Line 41 use Apache::lonclonecourse;
|
Line 41 use Apache::lonclonecourse;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonnavdisplay(); |
use Apache::lonnavdisplay(); |
use Apache::lonuserstate(); |
use Apache::lonuserstate(); |
|
use Apache::lonextresedit(); |
use HTML::Entities; |
use HTML::Entities; |
use HTML::TokeParser; |
use HTML::TokeParser; |
use GDBM_File; |
use GDBM_File; |
Line 390 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 409 sub docs_change_log {
|
Line 407 sub docs_change_log {
|
if ($supplementalflag) { |
if ($supplementalflag) { |
$tid = 2; |
$tid = 2; |
} |
} |
my ($breadcrumbtrail) = |
my ($breadcrumbtrail) = |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
&Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1); |
$r->print($breadcrumbtrail. |
$r->print($breadcrumbtrail. |
&generate_edit_table($tid,\%orderhash,undef,$iconpath,$jumpto, |
&generate_edit_table($tid,\%orderhash,undef,$iconpath,$jumpto, |
Line 484 sub docs_change_log {
|
Line 482 sub docs_change_log {
|
':'.$docslog{$id}{'exe_udom'}.'</tt>'. |
':'.$docslog{$id}{'exe_udom'}.'</tt>'. |
$send_msg_link.'</td><td>'. |
$send_msg_link.'</td><td>'. |
$docslog{$id}{'logentry'}{'folder'}.'</td><td>'); |
$docslog{$id}{'logentry'}{'folder'}.'</td><td>'); |
my $is_supp = 0; |
my $is_supp = 0; |
if ($docslog{$id}{'logentry'}{'currentfolder'} =~ /^supplemental/) { |
if ($docslog{$id}{'logentry'}{'currentfolder'} =~ /^supplemental/) { |
$is_supp = 1; |
$is_supp = 1; |
} |
} |
Line 507 sub docs_change_log {
|
Line 505 sub docs_change_log {
|
if ($is_supp) { |
if ($is_supp) { |
$shown = &Apache::loncommon::parse_supplemental_title($shown); |
$shown = &Apache::loncommon::parse_supplemental_title($shown); |
} |
} |
$r->print('<li>'.$shown.'</li>'); |
$r->print('<li>'.$shown.'</li>'); |
} |
} |
} |
} |
$r->print('</ul>'); |
$r->print('</ul>'); |
Line 658 sub print_paste_buffer {
|
Line 656 sub print_paste_buffer {
|
$canpaste = &supp_pasteable($env{'docs.markedcopy_url'}); |
$canpaste = &supp_pasteable($env{'docs.markedcopy_url'}); |
unless ($canpaste) { |
unless ($canpaste) { |
$nopaste = &mt('Paste into Supplemental Content unavailable for this type of content.'); |
$nopaste = &mt('Paste into Supplemental Content unavailable for this type of content.'); |
} |
} |
} else { |
} else { |
$canpaste = 1; |
$canpaste = 1; |
} |
} |
Line 672 sub print_paste_buffer {
|
Line 670 sub print_paste_buffer {
|
$othercourse = 1; |
$othercourse = 1; |
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
if ($canpaste) { |
if ($canpaste) { |
$othercrs = '<br />'.&mt('(from another course).'); |
$othercrs = '<br />'.&mt('(from another course).'); |
} |
} |
} else { |
} else { |
$canpaste = 0; |
$canpaste = 0; |
$nopaste = &mt('Paste from another course unavailable.') |
$nopaste = &mt('Paste from another course unavailable.') |
} |
} |
} |
} |
if ($rem =~ m{^(default|supplemental)_?(\d*)\.(?:page|sequence)$}) { |
if ($rem =~ m{^(default|supplemental)_?(\d*)\.(?:page|sequence)$}) { |
Line 694 sub print_paste_buffer {
|
Line 692 sub print_paste_buffer {
|
.'<legend>'.&mt('Clipboard').'</legend>'); |
.'<legend>'.&mt('Clipboard').'</legend>'); |
my ($type,$buffer); |
my ($type,$buffer); |
if ($is_external) { |
if ($is_external) { |
$type = &mt('External Resource'); |
$type = &mt('External Resource'); |
$buffer = $type.': '. |
$buffer = $type.': '. |
&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('. |
&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('. |
&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}).')'; |
&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}).')'; |
} else { |
} else { |
my $icon = &Apache::loncommon::icon($extension); |
my $icon = &Apache::loncommon::icon($extension); |
if ($extension eq 'sequence' && |
if ($extension eq 'sequence' && |
$env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) { |
$env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) { |
$icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); |
$icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); |
$icon .= '/navmap.folder.closed.gif'; |
$icon .= '/navmap.folder.closed.gif'; |
} |
} |
$icon = '<img src="'.$icon.'" alt="" class="LC_icon" />'; |
$icon = '<img src="'.$icon.'" alt="" class="LC_icon" />'; |
$buffer = $icon.$type.': '. &Apache::loncommon::parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'})); |
$buffer = $icon.$type.': '. &Apache::loncommon::parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'})); |
} |
} |
if ($canpaste) { |
if ($canpaste) { |
Line 719 sub print_paste_buffer {
|
Line 717 sub print_paste_buffer {
|
'<label>'. |
'<label>'. |
'<input type="radio" name="docs.markedcopy_options" value="new" checked="checked" />'. |
'<input type="radio" name="docs.markedcopy_options" value="new" checked="checked" />'. |
&mt('Copy to new folder').'</label>'.(' ' x2). |
&mt('Copy to new folder').'</label>'.(' ' x2). |
'<label>'. |
'<label>'. |
'<input type="radio" name="docs.markedcopy_options" value="move" />'. |
'<input type="radio" name="docs.markedcopy_options" value="move" />'. |
&mt('Move old folder').'</label><br />'); |
&mt('Move old folder').'</label><br />'); |
if ($env{'docs.markedcopy_nested'}) { |
if ($env{'docs.markedcopy_nested'}) { |
Line 731 sub print_paste_buffer {
|
Line 729 sub print_paste_buffer {
|
my %depths = ( |
my %depths = ( |
$lastdir => 0, |
$lastdir => 0, |
); |
); |
my (%display,%deps); |
my (%display,%deps); |
for (my $i=0; $i<@pastemaps; $i++) { |
for (my $i=0; $i<@pastemaps; $i++) { |
($lastdir,my $subfolderstr) = split(/\:/,$pastemaps[$i]); |
($lastdir,my $subfolderstr) = split(/\:/,$pastemaps[$i]); |
my ($namedir,$esctitlestr) = split(/\:/,$titles[$i]); |
my ($namedir,$esctitlestr) = split(/\:/,$titles[$i]); |
Line 743 sub print_paste_buffer {
|
Line 741 sub print_paste_buffer {
|
my $indent = (' ' x $offset); |
my $indent = (' ' x $offset); |
for (my $j=0; $j<@subfolders; $j++) { |
for (my $j=0; $j<@subfolders; $j++) { |
$depths{$subfolders[$j]} = $depth; |
$depths{$subfolders[$j]} = $depth; |
$display{$subfolders[$j]} = |
$display{$subfolders[$j]} = |
'<tr><td>'.$indent.$subfoldertitles[$j].' </td>'. |
'<tr><td>'.$indent.$subfoldertitles[$j].' </td>'. |
'<td><label>'. |
'<td><label>'. |
'<input type="radio" name="docs.markedcopy_'.$subfolders[$j].'" value="new" checked="checked" />'.&mt('Copy to new').'</label>'.(' ' x2). |
'<input type="radio" name="docs.markedcopy_'.$subfolders[$j].'" value="new" checked="checked" />'.&mt('Copy to new').'</label>'.(' ' x2). |
Line 760 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 848 sub do_paste_from_buffer {
|
Line 839 sub do_paste_from_buffer {
|
|
|
my ($is_map,$srcdom,$srcnum,$prefixchg,%before,%after,%mapchanges,%tomove); |
my ($is_map,$srcdom,$srcnum,$prefixchg,%before,%after,%mapchanges,%tomove); |
if ($url=~/\.(page|sequence)$/) { |
if ($url=~/\.(page|sequence)$/) { |
$is_map = 1; |
$is_map = 1; |
} |
} |
if ($url =~ m{^/uploaded/($match_domain)/($match_courseid)/([^/]+)}) { |
if ($url =~ m{^/uploaded/($match_domain)/($match_courseid)/([^/]+)}) { |
$srcdom = $1; |
$srcdom = $1; |
$srcnum = $2; |
$srcnum = $2; |
my $oldprefix = $3; |
my $oldprefix = $3; |
# When paste buffer was populated using an active role in a different course |
# When paste buffer was populated using an active role in a different course |
# check for mdc privilege in the course from which the resource was pasted |
# check for mdc privilege in the course from which the resource was pasted |
if (($srcdom ne $coursedom) || ($srcnum ne $coursenum)) { |
if (($srcdom ne $coursedom) || ($srcnum ne $coursenum)) { |
unless ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
unless ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) { |
return (&mt('Paste failed: Item is from a different course which you do not have rights to edit.')); |
return (&mt('Paste failed: Item is from a different course which you do not have rights to edit.')); |
} |
} |
} |
} |
# When pasting content from Main Content to Supplemental Content and vice versa |
# When pasting content from Main Content to Supplemental Content and vice versa |
# URLs will contain different paths (which depend on whether pasted item is |
# URLs will contain different paths (which depend on whether pasted item is |
# a folder/page or a document. |
# a folder/page or a document. |
if (($folder =~ /^supplemental/) && (($oldprefix =~ /^default/) || ($oldprefix eq 'docs'))) { |
if (($folder =~ /^supplemental/) && (($oldprefix =~ /^default/) || ($oldprefix eq 'docs'))) { |
$prefixchg = 1; |
$prefixchg = 1; |
%before = ( map => 'default', |
%before = ( map => 'default', |
Line 907 sub do_paste_from_buffer {
|
Line 898 sub do_paste_from_buffer {
|
if ($folder =~ /^default/) { |
if ($folder =~ /^default/) { |
my $lastchange = &Apache::lonnet::get_coursechange($coursedom,$coursenum); |
my $lastchange = &Apache::lonnet::get_coursechange($coursedom,$coursenum); |
if ($lastchange > $env{'request.course.tied'}) { |
if ($lastchange > $env{'request.course.tied'}) { |
&reinit_role($coursedom,$coursenum,$env{"course.$env{'request.course.id'}.home"}); |
&reinit_role($coursedom,$coursenum,$env{"course.$env{'request.course.id'}.home"}); |
} |
} |
} |
} |
# If pasting a map, check if map contains other maps |
# If pasting a map, check if map contains other maps |
Line 925 sub do_paste_from_buffer {
|
Line 916 sub do_paste_from_buffer {
|
if ($url=~ m{^/uploaded/}) { |
if ($url=~ m{^/uploaded/}) { |
my $newurl; |
my $newurl; |
unless ($env{'form.docs.markedcopy_options'} eq 'move') { |
unless ($env{'form.docs.markedcopy_options'} eq 'move') { |
($newurl,my $error) = |
($newurl,my $error) = |
&get_newmap_url($url,$folder,$prefixchg,$coursedom,$coursenum, |
&get_newmap_url($url,$folder,$prefixchg,$coursedom,$coursenum, |
$srcdom,$srcnum,\$title,\%allmaps,\%newurls); |
$srcdom,$srcnum,\$title,\%allmaps,\%newurls); |
if ($error) { |
if ($error) { |
Line 952 sub do_paste_from_buffer {
|
Line 943 sub do_paste_from_buffer {
|
} elsif ($env{'docs.markedcopy_nested'}) { |
} elsif ($env{'docs.markedcopy_nested'}) { |
&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum,\%allmaps,\%rewrites, |
&url_paste_fixups($url,$folder,$prefixchg,$coursedom,$coursenum,\%allmaps,\%rewrites, |
\%retitles,\%copies,\%dbcopies,\%zombies,\%params,\%mapmoves, |
\%retitles,\%copies,\%dbcopies,\%zombies,\%params,\%mapmoves, |
\%mapchanges,\%tomove,\%newsubdir,\%newurls); |
\%mapchanges,\%tomove,\%newsubdir,\%newurls); |
} |
} |
} elsif ($url=~m {^/res/}) { |
} elsif ($url=~m {^/res/}) { |
# published maps can only exists once, so remove it from paste buffer when done |
# published maps can only exists once, so remove it from paste buffer when done |
Line 966 sub do_paste_from_buffer {
|
Line 957 sub do_paste_from_buffer {
|
} |
} |
} |
} |
if ($url=~ m{/smppg$}) { |
if ($url=~ m{/smppg$}) { |
my $db_name = &Apache::lonsimplepage::get_db_name($url); |
my $db_name = &Apache::lonsimplepage::get_db_name($url); |
if ($db_name =~ /^smppage_/) { |
if ($db_name =~ /^smppage_/) { |
#simple pages, need to copy the db contents to a new one. |
#simple pages, need to copy the db contents to a new one. |
my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum); |
my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum); |
my $now = time(); |
my $now = time(); |
$db_name =~ s{_\d*$ }{_$now}x; |
$db_name =~ s{_\d*$ }{_$now}x; |
my $dbresult=&Apache::lonnet::put($db_name,\%contents, |
my $dbresult=&Apache::lonnet::put($db_name,\%contents, |
$coursedom,$coursenum); |
$coursedom,$coursenum); |
if ($dbresult eq 'ok') { |
if ($dbresult eq 'ok') { |
$url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; |
$url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; |
$title=&mt('Copy of').' '.$title; |
$title=&mt('Copy of').' '.$title; |
} else { |
} else { |
return (&mt('Paste failed: An error occurred when copying the simple page.')); |
return (&mt('Paste failed: An error occurred when copying the simple page.')); |
} |
} |
} |
} |
} |
} |
$title = &LONCAPA::map::qtunescape($title); |
$title = &LONCAPA::map::qtunescape($title); |
my $ext='false'; |
my $ext='false'; |
Line 1023 sub do_paste_from_buffer {
|
Line 1014 sub do_paste_from_buffer {
|
} |
} |
} |
} |
} |
} |
# Apply any changes to maps, or copy dependencies for uploaded HTML pages |
# Apply any changes to maps, or copy dependencies for uploaded HTML pages |
my ($result,$save_err); |
my ($result,$save_err); |
$result = |
$result = |
&apply_fixups($folder,$is_map,$prefixchg,$coursedom,$coursenum,$oldurl, |
&apply_fixups($folder,$is_map,$prefixchg,$coursedom,$coursenum,$oldurl, |
Line 1031 sub do_paste_from_buffer {
|
Line 1022 sub do_paste_from_buffer {
|
\%copies,\%dbcopies,\%zombies,\%params,\%docmoves, |
\%copies,\%dbcopies,\%zombies,\%params,\%docmoves, |
\%mapmoves,\%newsubdir,$errors,\%before,\%after); |
\%mapmoves,\%newsubdir,$errors,\%before,\%after); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if ($is_map) { |
if ($is_map) { |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
$folder.'.'.$container); |
$folder.'.'.$container); |
return $errtext if ($fatal); |
return $errtext if ($fatal); |
Line 1055 sub do_paste_from_buffer {
|
Line 1046 sub do_paste_from_buffer {
|
$env{'user.domain'}.'___&&&___'.$title; |
$env{'user.domain'}.'___&&&___'.$title; |
} |
} |
} |
} |
$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 |
my ($errtext,$fatal) = |
my ($errtext,$fatal) = |
&storemap($coursenum,$coursedom,$folder.'.'.$container,1); |
&storemap($coursenum,$coursedom,$folder.'.'.$container,1); |
if ($fatal) { |
if ($fatal) { |
$save_err = $errtext; |
$save_err = $errtext; |
} |
} |
} |
} |
|
|
if ($env{'form.docs.markedcopy_options'} eq 'move') { |
if ($env{'form.docs.markedcopy_options'} eq 'move') { |
&Apache::lonnet::delenv('docs.markedcopy'); |
&Apache::lonnet::delenv('docs.markedcopy'); |
&Apache::lonnet::delenv('docs.markedcopy_nested'); |
&Apache::lonnet::delenv('docs.markedcopy_nested'); |
Line 1189 sub contained_map_check {
|
Line 1180 sub contained_map_check {
|
$titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'}; |
$titles->{$url}{$token->[2]->{'id'}} = $token->[2]->{'title'}; |
} else { |
} else { |
if ($allmaps->{$ressrc}) { |
if ($allmaps->{$ressrc}) { |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
} elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') { |
} elsif (ref($addedmaps->{$ressrc}) eq 'ARRAY') { |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
$removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc; |
} else { |
} else { |
Line 1204 sub contained_map_check {
|
Line 1195 sub contained_map_check {
|
if (ref($removeparam->{$url}{$token->[2]->{'to'}}) eq 'ARRAY') { |
if (ref($removeparam->{$url}{$token->[2]->{'to'}}) eq 'ARRAY') { |
push(@{$removeparam->{$url}{$token->[2]->{'to'}}},$token->[2]->{'name'}); |
push(@{$removeparam->{$url}{$token->[2]->{'to'}}},$token->[2]->{'name'}); |
} else { |
} else { |
$removeparam->{$url}{$token->[2]->{'to'}} = [$token->[2]->{'name'}]; |
$removeparam->{$url}{$token->[2]->{'to'}} = [$token->[2]->{'name'}]; |
} |
} |
} |
} |
} |
} |
Line 1256 sub url_paste_fixups {
|
Line 1247 sub url_paste_fixups {
|
} |
} |
next if ($token->[2]->{'type'} eq 'external'); |
next if ($token->[2]->{'type'} eq 'external'); |
if ($token->[2]->{'type'} eq 'zombie') { |
if ($token->[2]->{'type'} eq 'zombie') { |
next if ($skip); |
next if ($skip); |
$zombies->{$oldurl}{$ressrc} = $id; |
$zombies->{$oldurl}{$ressrc} = $id; |
$changed = 1; |
$changed = 1; |
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { |
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { |
Line 1288 sub url_paste_fixups {
|
Line 1279 sub url_paste_fixups {
|
} |
} |
if (($srcdom ne $cdom) || ($srcnum ne $cnum) || ($prefixchg) || |
if (($srcdom ne $cdom) || ($srcnum ne $cnum) || ($prefixchg) || |
($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) { |
($mapchanges->{$oldurl}) || (($newurl ne '') && ($newurl ne $oldurl))) { |
|
|
if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) { |
if ($rem =~ /^(default|supplemental)(_?\d*).(sequence|page)$/) { |
$rewrites->{$oldurl}{$ressrc} = $id; |
$rewrites->{$oldurl}{$ressrc} = $id; |
$mapchanges->{$ressrc} = 1; |
$mapchanges->{$ressrc} = 1; |
Line 1306 sub url_paste_fixups {
|
Line 1297 sub url_paste_fixups {
|
} |
} |
} |
} |
} elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) { |
} elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) { |
next if ($skip); |
next if ($skip); |
my $srcdom = $1; |
my $srcdom = $1; |
my $srcnum = $2; |
my $srcnum = $2; |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) { |
Line 1326 sub url_paste_fixups {
|
Line 1317 sub url_paste_fixups {
|
} |
} |
} elsif ($token->[1] eq 'param') { |
} elsif ($token->[1] eq 'param') { |
next if ($skip); |
next if ($skip); |
my $to = $token->[2]->{'to'}; |
my $to = $token->[2]->{'to'}; |
if ($to ne '') { |
if ($to ne '') { |
if (ref($params->{$oldurl}{$to}) eq 'ARRAY') { |
if (ref($params->{$oldurl}{$to}) eq 'ARRAY') { |
push(@{$params->{$oldurl}{$to}},$token->[2]->{'name'}); |
push(@{$params->{$oldurl}{$to}},$token->[2]->{'name'}); |
Line 1364 sub apply_fixups {
|
Line 1355 sub apply_fixups {
|
} |
} |
if (@allcopies > 0) { |
if (@allcopies > 0) { |
foreach my $item (@allcopies) { |
foreach my $item (@allcopies) { |
my ($relpath,$oldsubdir,$fname) = |
my ($relpath,$oldsubdir,$fname) = |
($item =~ m{^(/uploaded/$match_domain/$match_courseid/(?:docs|supplemental)/(default|\d+)/.*/)([^/]+)$}); |
($item =~ m{^(/uploaded/$match_domain/$match_courseid/(?:docs|supplemental)/(default|\d+)/.*/)([^/]+)$}); |
if ($fname ne '') { |
if ($fname ne '') { |
my $content = &Apache::lonnet::getfile($item); |
my $content = &Apache::lonnet::getfile($item); |
Line 1383 sub apply_fixups {
|
Line 1374 sub apply_fixups {
|
} |
} |
} |
} |
©_dependencies($item,$storefn,$relpath,$errors,\$content); |
©_dependencies($item,$storefn,$relpath,$errors,\$content); |
my $copyurl = |
my $copyurl = |
&Apache::lonclonecourse::writefile($env{'request.course.id'}, |
&Apache::lonclonecourse::writefile($env{'request.course.id'}, |
$storefn.$fname,$content); |
$storefn.$fname,$content); |
if ($copyurl eq '/adm/notfound.html') { |
if ($copyurl eq '/adm/notfound.html') { |
Line 1529 sub apply_fixups {
|
Line 1520 sub apply_fixups {
|
} |
} |
foreach my $idx (keys(%remparam)) { |
foreach my $idx (keys(%remparam)) { |
if (ref($remparam{$idx}) eq 'ARRAY') { |
if (ref($remparam{$idx}) eq 'ARRAY') { |
foreach my $name (@{$remparam{$idx}}) { |
foreach my $name (@{$remparam{$idx}}) { |
&LONCAPA::map::delparameter($idx,'parameter_'.$name); |
&LONCAPA::map::delparameter($idx,'parameter_'.$name); |
} |
} |
} |
} |
Line 1691 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'; |
if ($allowed) { |
|
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain, |
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) = |
$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 1742 sub editor {
|
Line 1738 sub editor {
|
&do_paste_from_buffer($coursenum,$coursedom,$folder,$container, |
&do_paste_from_buffer($coursenum,$coursedom,$folder,$container, |
\%paste_errors); |
\%paste_errors); |
if ($save_error ne '') { |
if ($save_error ne '') { |
return $save_error; |
return $save_error; |
} |
} |
if ($paste_res ne 'ok') { |
if ($paste_res ne 'ok') { |
$r->print('<p><span class="LC_error">'.$paste_res.'</span></p>'); |
$r->print('<p><span class="LC_error">'.$paste_res.'</span></p>'); |
Line 1776 sub editor {
|
Line 1772 sub editor {
|
my ($name,$url,$residx)= |
my ($name,$url,$residx)= |
map {&unescape($_)} split(/\=/,$item); |
map {&unescape($_)} split(/\=/,$item); |
if ($url=~ m{^\Q/uploaded/$coursedom/$coursenum/\E(default|supplemental)_new\.(sequence|page)$}) { |
if ($url=~ m{^\Q/uploaded/$coursedom/$coursenum/\E(default|supplemental)_new\.(sequence|page)$}) { |
my ($suffix,$errortxt,$locknotfreed) = |
my ($suffix,$errortxt,$locknotfreed) = |
&newmap_suffix($1,$2,$coursedom,$coursenum); |
&newmap_suffix($1,$2,$coursedom,$coursenum); |
if ($locknotfreed) { |
if ($locknotfreed) { |
$r->print($locknotfreed); |
$r->print($locknotfreed); |
} |
} |
if ($suffix) { |
if ($suffix) { |
$url =~ s/_new\./_$suffix./; |
$url =~ s/_new\./_$suffix./; |
} else { |
} else { |
return $errortxt; |
return $errortxt; |
} |
} |
Line 1859 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++; |
} |
} |
&Apache::loncommon::end_data_table_count(); |
&Apache::loncommon::end_data_table_count(); |
|
|
if ($shown) { |
if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) { |
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') |
my $toolslink = '<table><tr><td>' |
.&Apache::loncommon::start_data_table(undef,'contentlist'); |
.&Apache::loncommon::help_open_menu('Navigation Screen', |
if ($allowed) { |
'Navigation_Screen',undef,'RAT') |
$to_show .= &Apache::loncommon::start_data_table_header_row() |
.'</td><td class="LC_middle">'.&mt('Tools:').'</td>' |
.'<th colspan="2">'.&mt('Move').'</th>' |
.'<td align="left"><ul id="LC_toolbar">' |
.'<th>'.&mt('Actions').'</th>' |
.'<li><a href="/adm/coursedocs?forcesupplement=1" ' |
.'<th colspan="2">'.&mt('Document').'</th>'; |
.'id="LC_content_toolbar_edittoplevel" ' |
if ($folder !~ /^supplemental/) { |
.'class="LC_toolbarItem" ' |
$to_show .= '<th colspan="4">'.&mt('Settings').'</th>'; |
.'title="'.&mt('Supplemental Content Editor').'">' |
|
.'</a></li></ul></td></tr></table><br />'; |
|
if ($shown) { |
|
if ($allowed) { |
|
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') |
|
.&Apache::loncommon::start_data_table(undef,'contentlist') |
|
.&Apache::loncommon::start_data_table_header_row() |
|
.'<th colspan="2">'.&mt('Move').'</th>' |
|
.'<th>'.&mt('Actions').'</th>' |
|
.'<th colspan="2">'.&mt('Document').'</th>'; |
|
if ($folder !~ /^supplemental/) { |
|
$to_show .= '<th colspan="4">'.&mt('Settings').'</th>'; |
|
} |
|
$to_show .= &Apache::loncommon::end_data_table_header_row() |
|
.$output.' ' |
|
.&Apache::loncommon::end_data_table() |
|
.'<br style="line-height:2px;" />' |
|
.&Apache::loncommon::end_scrollbox(); |
|
} else { |
|
$to_show .= $toolslink |
|
.&Apache::loncommon::start_data_table('LC_tableOfContent') |
|
.$output.' ' |
|
.&Apache::loncommon::end_data_table(); |
} |
} |
$to_show .= &Apache::loncommon::end_data_table_header_row(); |
} else { |
|
if (!$allowed) { |
|
$to_show .= $toolslink; |
|
} |
|
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') |
|
.'<div class="LC_info" id="contentlist">' |
|
.&mt('Currently no documents.') |
|
.'</div>' |
|
.&Apache::loncommon::end_scrollbox(); |
} |
} |
$to_show .= $output.' ' |
|
.&Apache::loncommon::end_data_table() |
|
.'<br style="line-height:2px;" />' |
|
.&Apache::loncommon::end_scrollbox(); |
|
} else { |
} else { |
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') |
if ($shown) { |
.'<div class="LC_info" id="contentlist">' |
$to_show = '<div>' |
.&mt('Currently no documents.') |
.&Apache::loncommon::start_data_table('LC_tableOfContent') |
.'</div>' |
.$output |
.&Apache::loncommon::end_scrollbox(); |
.&Apache::loncommon::end_data_table() |
|
.'</div>'; |
|
} else { |
|
$to_show = '<div class="LC_info" id="contentlist">' |
|
.&mt('Currently no documents.') |
|
.'</div>' |
|
} |
} |
} |
my $tid = 1; |
my $tid = 1; |
if ($supplementalflag) { |
if ($supplementalflag) { |
Line 1899 sub editor {
|
Line 1927 sub editor {
|
$readfile)); |
$readfile)); |
&print_paste_buffer($r,$container,$folder,$coursedom,$coursenum); |
&print_paste_buffer($r,$container,$folder,$coursedom,$coursenum); |
} else { |
} else { |
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { |
|
#Function Box for Supplemental Content for users with mdc priv. |
|
my $funcname = &mt('Folder Editor'); |
|
$r->print( |
|
&Apache::loncommon::head_subbox( |
|
&Apache::lonhtmlcommon::start_funclist(). |
|
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="/adm/coursedocs?command=direct&forcesupplement=1&'. |
|
'supppath='.&HTML::Entities::encode($env{'form.folderpath'}).'">'. |
|
'<img src="/res/adm/pages/docs-22x22.png" alt="'.$funcname.'" class="LC_icon" />'. |
|
'<span class="LC_menubuttons_inline_text">'.$funcname.'</span></a>'). |
|
&Apache::lonhtmlcommon::end_funclist())); |
|
} |
|
$r->print($to_show); |
$r->print($to_show); |
} |
} |
return; |
return; |
Line 1932 sub process_file_upload {
|
Line 1947 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 2022 sub process_file_upload {
|
Line 2037 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 2077 sub is_supplemental_title {
|
Line 2091 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 2097 sub entryline {
|
Line 2109 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 (!$supplementalflag && $residx) { |
if ($residx) { |
my $currurl = $url; |
my $currurl = $url; |
$currurl =~ s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
$currurl =~ s{^http(|s)(:|:)//}{/adm/wrapper/ext/}; |
if ($currurl =~ m{^/adm/wrapper/ext/}) { |
if ($currurl =~ m{^/adm/wrapper/ext/}) { |
$isexternal = 1; |
$isexternal = 1; |
} |
} |
my $path = 'uploaded/'. |
if (!$supplementalflag) { |
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'. |
my $path = 'uploaded/'. |
$env{'course.'.$env{'request.course.id'}.'.num'}.'/'; |
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'. |
$symb = &Apache::lonnet::encode_symb($path.$folder.".$container", |
$env{'course.'.$env{'request.course.id'}.'.num'}.'/'; |
$residx, |
$symb = &Apache::lonnet::encode_symb($path.$folder.".$container", |
&Apache::lonnet::declutter($currurl)); |
$residx, |
|
&Apache::lonnet::declutter($currurl)); |
|
} |
} |
} |
my %lt; |
my ($renamelink,%lt); |
if ($allowed) { |
if ($allowed) { |
my $incindex=$index+1; |
my $incindex=$index+1; |
my $selectbox=''; |
my $selectbox=''; |
Line 2165 sub entryline {
|
Line 2177 sub entryline {
|
my $nocut=0; |
my $nocut=0; |
my $noremove=0; |
my $noremove=0; |
if ($url=~ m{^/res/.+\.(page|sequence)$}) { |
if ($url=~ m{^/res/.+\.(page|sequence)$}) { |
# no copy for published maps |
# no copy for published maps |
$nocopy=1; |
$nocopy=1; |
} |
} |
if ($url=~/^\/res\/lib\/templates\//) { |
if ($url=~/^\/res\/lib\/templates\//) { |
$nocopy=1; |
$nocopy=1; |
$nocut=1; |
$nocut=1; |
Line 2221 sub entryline {
|
Line 2233 sub entryline {
|
$nocopy=1; |
$nocopy=1; |
} |
} |
} |
} |
my ($copylink,$cutlink,$removelink,$renamelink); |
my ($copylink,$cutlink,$removelink); |
|
|
my $skip_confirm = 0; |
my $skip_confirm = 0; |
if ( $folder =~ /^supplemental/ |
if ( $folder =~ /^supplemental/ |
|| ($url =~ m{( /smppg$ |
|| ($url =~ m{( /smppg$ |
Line 2231 sub entryline {
|
Line 2242 sub entryline {
|
|/navmaps$ |
|/navmaps$ |
|/bulletinboard$ |
|/bulletinboard$ |
|\.html$)}x) |
|\.html$)}x) |
|| $isexternal) { |
|| $isexternal) { |
$skip_confirm = 1; |
$skip_confirm = 1; |
} |
} |
if ($nocopy) { |
|
|
if ($nocopy) { |
$copylink=(<<ENDCOPY); |
$copylink=(<<ENDCOPY); |
<span style="visibility: hidden;">$lt{'cp'}</span> |
<span style="visibility: hidden;">$lt{'cp'}</span> |
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) { |
$cutlink=(<<ENDCUT); |
$cutlink=(<<ENDCUT); |
<span style="visibility: hidden;">$lt{'ct'}</span> |
<span style="visibility: hidden;">$lt{'ct'}</span> |
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 2258 ENDCUT
|
Line 2270 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 |
} |
} |
$renamelink=(<<ENDREN); |
unless ($isexternal) { |
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a> |
$renamelink=(<<ENDREN); |
|
<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a> |
ENDREN |
ENDREN |
|
} |
$form_start = ' |
$form_start = ' |
<form action="/adm/coursedocs" method="post"> |
<form action="/adm/coursedocs" method="post"> |
'; |
'; |
Line 2295 END
|
Line 2309 END
|
</td> |
</td> |
<td class="LC_docs_entry_commands"><span class="LC_nobreak"> |
<td class="LC_docs_entry_commands"><span class="LC_nobreak"> |
$removelink |
$removelink |
$renamelink |
|
$cutlink |
$cutlink |
$copylink |
$copylink |
</span> |
</span> |
Line 2307 END
|
Line 2320 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 2335 END
|
Line 2344 END
|
} |
} |
} |
} |
|
|
my $editlink; |
my ($editlink,$extresform); |
my $orig_url = $url; |
my $orig_url = $url; |
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
my $external = ($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 2359 END
|
Line 2364 END
|
} |
} |
} elsif ($url=~m|^/ext/|) { |
} elsif ($url=~m|^/ext/|) { |
$url='/adm/wrapper'.$url; |
$url='/adm/wrapper'.$url; |
$external = 1; |
} |
} |
|
if (&Apache::lonnet::symbverify($symb,$url)) { |
if (&Apache::lonnet::symbverify($symb,$url)) { |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
} else { |
} else { |
$url=''; |
$url=''; |
} |
} |
} |
} |
} |
} |
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) { |
|
$folderpath.=$containerarg.'&'.$foldername; |
|
$url.='folderpath='.&escape($folderpath); |
|
} 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.':'.(&LONCAPA::map::getparameter($orderidx, |
$folderpath.=$containerarg.'&'.$foldername. |
|
':'.(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0] |
'parameter_randompick'))[0] |
.':'.((&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, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_randomorder'))[0]=~/^yes$/i); |
'parameter_randomorder'))[0]=~/^yes$/i) |
$url.='folderpath='.&escape($folderpath); |
.':'.$ispage; |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
$url.='folderpath='.&escape($folderpath); |
'parameter_randompick'))[0]; |
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
my $rpckchk; |
'parameter_randompick'))[0]; |
if ($rpicknum) { |
my $rpckchk; |
$rpckchk = ' checked="checked"'; |
if ($rpicknum) { |
} |
$rpckchk = ' checked="checked"'; |
my $formname = 'edit_rpick_'.$orderidx; |
} |
$rand_pick_text = |
my $formname = 'edit_rpick_'.$orderidx; |
|
$rand_pick_text = |
'<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n". |
'<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n". |
$form_common."\n". |
$form_common."\n". |
'<span class="LC_nobreak"><label><input type="checkbox" name="randpickon_'.$orderidx.'" id="rpick_'.$orderidx.'" onclick="'."updatePick(this.form,'$orderidx','check');".'"'.$rpckchk.' /> '.&mt('Randomly Pick').'</label><input type="hidden" name="randompick_'.$orderidx.'" id="rpicknum_'.$orderidx.'" value="'.$rpicknum.'" />'; |
'<span class="LC_nobreak"><label><input type="checkbox" name="randpickon_'.$orderidx.'" id="rpick_'.$orderidx.'" onclick="'."updatePick(this.form,'$orderidx','check');".'"'.$rpckchk.' /> '.&mt('Randomly Pick').'</label><input type="hidden" name="randompick_'.$orderidx.'" id="rpicknum_'.$orderidx.'" value="'.$rpicknum.'" />'; |
if ($rpicknum ne '') { |
if ($rpicknum ne '') { |
$rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>'; |
$rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>'; |
} |
} |
$rand_pick_text .= '</span></form>'; |
$rand_pick_text .= '</span></form>'; |
my $ro_set= |
my $ro_set= |
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); |
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); |
$rand_order_text = |
$rand_order_text = |
$form_start. |
$form_start. |
$form_common.' |
$form_common.' |
<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="'."this.form.changeparms.value='randomorder';this.form.submit()".'" '.$ro_set.' /> '.&mt('Random Order').' </label></span></form>'; |
<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="'."this.form.changeparms.value='randomorder';this.form.submit()".'" '.$ro_set.' /> '.&mt('Random Order').' </label></span></form>'; |
|
} |
} elsif ($supplementalflag && !$allowed) { |
} elsif ($supplementalflag && !$allowed) { |
$url .= ($url =~ /\?/) ? 'amp;':'?'; |
$url .= ($url =~ /\?/) ? '&':'?'; |
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"'); |
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"'); |
|
if ($title) { |
|
$url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"'); |
|
} |
|
if ($isexternal && $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)); |
|
if ($isexternal) { |
if ($external) { |
($editlink,$extresform) = |
$editlink = <<"EXTLNK"; |
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); |
|
} elsif (!$isfolder && !$ispage) { |
<a class="LC_docs_ext_edit" href="javascript:editext('$residx');"> |
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
$lt{'ed'}</a> |
|
<form action="/adm/coursedocs" method="post" name="editext_$residx"> |
|
<fieldset id="uploadext$residx" style="display: none;" /> |
|
<input type="hidden" name="active" value="aa" /> |
|
<span class="LC_nobreak"> |
|
<span class="LC_docs_ext_edit">$lt{'ul'} </span> |
|
<input type="text" size="40" name="exturl" id="exturl_$residx" value="$orig_url" /> |
|
<a class="LC_docs_ext_edit" href="javascript:extUrlPreview('exturl_$residx');">$lt{'pr'}</a></span> |
|
</span><br /> |
|
<span class="LC_nobreak"> |
|
<span class="LC_docs_ext_edit">$lt{'ti'} </span> |
|
<input type="text" size="40" name="exttitle" value="$title" /> |
|
$pathitem |
|
<input type="hidden" name="importdetail" value="" /> |
|
<input type="button" value="$lt{'sv'}" onclick="javascript:setExternal(this.form,'$residx')" /> |
|
</span> |
|
</fieldset> |
|
</form> |
|
EXTLNK |
|
} else { |
|
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
|
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); |
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); |
my $geteditlink; |
if (($cfile ne '') && ($symb ne '' || $supplementalflag)) { |
if ($supplementalflag) { |
my $jscall = |
if ($orig_url eq "/adm/$env{'user.domain'}/$env{'user.name'}/aboutme") { |
|
$geteditlink = 1; |
|
} |
|
} elsif (($cfile ne '') && ($symb ne '')) { |
|
$geteditlink = 1; |
|
} |
|
if ($geteditlink) { |
|
my $jscall = |
|
&Apache::lonhtmlcommon::jump_to_editres($cfile,$home, |
&Apache::lonhtmlcommon::jump_to_editres($cfile,$home, |
$switchserver, |
$switchserver, |
$forceedit, |
$forceedit, |
undef,$symb); |
undef,$symb, |
|
&escape($env{'form.folderpath'}), |
|
$renametitle,'','',1); |
if ($jscall) { |
if ($jscall) { |
$editlink = ' <a class="LC_docs_ext_edit" href="javascript:'. |
$editlink = '<a class="LC_docs_ext_edit" href="javascript:'. |
$jscall.'" >'.&mt('Edit').'</a>'; |
$jscall.'" >'.&mt('Edit').'</a> '."\n"; |
} |
} |
} |
} |
} |
} |
|
$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>'; |
$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 2484 EXTLNK
|
Line 2468 EXTLNK
|
} else { |
} else { |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
} |
} |
$line.='</td><td>'; |
$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 2493 EXTLNK
|
Line 2477 EXTLNK
|
} else { |
} else { |
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>'; |
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>'; |
} |
} |
$line.=$editlink."</td>"; |
$line.="$extresform</td>"; |
$rand_pick_text = ' ' if ($rand_pick_text eq ''); |
$rand_pick_text = ' ' if ($rand_pick_text eq ''); |
$rand_order_text = ' ' if ($rand_order_text eq ''); |
$rand_order_text = ' ' if ($rand_order_text eq ''); |
if (($allowed) && ($folder!~/^supplemental/)) { |
if (($allowed) && ($folder!~/^supplemental/)) { |
Line 2643 sub checkonthis {
|
Line 2627 sub checkonthis {
|
$r->print('<span class="LC_error">'.&mt('connection down').'</span>'); |
$r->print('<span class="LC_error">'.&mt('connection down').'</span>'); |
} elsif ($result eq 'not_found') { |
} elsif ($result eq 'not_found') { |
unless ($url=~/\$/) { |
unless ($url=~/\$/) { |
$r->print('<span class="LC_error">'.&mt('not found').'</b></span>'); |
$r->print('<span class="LC_error">'.&mt('not found').'</span>'); |
} else { |
} else { |
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>'); |
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>'); |
} |
} |
Line 2689 sub list_symbs {
|
Line 2673 sub list_symbs {
|
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<td>'.$res->compTitle().'</td>'. |
'<td>'.$res->compTitle().'</td>'. |
'<td>'.$res->symb().'</td>'. |
'<td>'.$res->symb().'</td>'. |
&Apache::loncommon::start_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
$count ++; |
$count ++; |
} |
} |
if (!$count) { |
if (!$count) { |
Line 2699 sub list_symbs {
|
Line 2683 sub list_symbs {
|
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
|
|
Line 2729 sub verifycontent {
|
Line 2714 sub verifycontent {
|
} |
} |
&untiehash(); |
&untiehash(); |
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
|
|
Line 2808 sub checkversions {
|
Line 2794 sub checkversions {
|
if ($env{'form.timerange'} eq 'all') { |
if ($env{'form.timerange'} eq 'all') { |
# show all documents |
# show all documents |
$header=&mt('All Documents in '.$crstype); |
$header=&mt('All Documents in '.$crstype); |
$allsel=1; |
$allsel=' selected="selected"'; |
foreach my $key (keys(%hash)) { |
foreach my $key (keys(%hash)) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
my $src=$1; |
my $src=$1; |
Line 2829 sub checkversions {
|
Line 2815 sub checkversions {
|
.&mt('seconds'); |
.&mt('seconds'); |
if ($env{'form.timerange'}==-1) { |
if ($env{'form.timerange'}==-1) { |
$seltext='since start of course'; |
$seltext='since start of course'; |
$startsel='selected'; |
$startsel=' selected="selected"'; |
$env{'form.timerange'}=time; |
$env{'form.timerange'}=time; |
} |
} |
$starttime=time-$env{'form.timerange'}; |
$starttime=time-$env{'form.timerange'}; |
if ($env{'form.timerange'}==2592000) { |
if ($env{'form.timerange'}==2592000) { |
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$monthsel='selected'; |
$monthsel=' selected="selected"'; |
} elsif ($env{'form.timerange'}==604800) { |
} elsif ($env{'form.timerange'}==604800) { |
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$weeksel='selected'; |
$weeksel=' selected="selected"'; |
} elsif ($env{'form.timerange'}==86400) { |
} elsif ($env{'form.timerange'}==86400) { |
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$daysel='selected'; |
$daysel=' selected="selected"'; |
} |
} |
$header=&mt('Content changed').' '.$seltext; |
$header=&mt('Content changed').' '.$seltext; |
} else { |
} else { |
Line 2879 sub checkversions {
|
Line 2865 sub checkversions {
|
<fieldset> |
<fieldset> |
<legend>$lt{'cd'}</legend> |
<legend>$lt{'cd'}</legend> |
<select name="timerange"> |
<select name="timerange"> |
<option value='all' $allsel>$lt{'al'}</option> |
<option value='all'$allsel>$lt{'al'}</option> |
<option value="-1" $startsel>$lt{'st'}</option> |
<option value="-1"$startsel>$lt{'st'}</option> |
<option value="2592000" $monthsel>$lt{'lm'}</option> |
<option value="2592000"$monthsel>$lt{'lm'}</option> |
<option value="604800" $weeksel>$lt{'lw'}</option> |
<option value="604800"$weeksel>$lt{'lw'}</option> |
<option value="86400" $daysel>$lt{'sy'}</option> |
<option value="86400"$daysel>$lt{'sy'}</option> |
</select> |
</select> |
<input type="submit" name="display" value="$lt{'sd'}" /> |
<input type="submit" name="display" value="$lt{'sd'}" /> |
</fieldset> |
</fieldset> |
Line 2899 $lt{'sc'}: <input type="submit" name="se
|
Line 2885 $lt{'sc'}: <input type="submit" name="se
|
<hr /> |
<hr /> |
<h4>$lt{'vers'}</h4> |
<h4>$lt{'vers'}</h4> |
<input type="submit" name="setversions" value="$lt{'save'}" /> |
<input type="submit" name="setversions" value="$lt{'save'}" /> |
<table border="0"> |
|
ENDHEADERS |
ENDHEADERS |
#number of columns for version history |
#number of columns for version history |
my $num_ver_col = 1; |
|
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Resources').'</th>'. |
'<th>'.&mt('Resources').'</th>'. |
"<th>$lt{'mr'}</th>". |
"<th>$lt{'mr'}</th>". |
"<th>$lt{'ve'}</th>". |
"<th>$lt{'ve'}</th>". |
"<th>$lt{'vu'}</th>". |
"<th>$lt{'vu'}</th>". |
'<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'. |
'<th>'.&mt('History').'</th>'. |
'</b>'); |
&Apache::loncommon::end_data_table_header_row() |
|
); |
foreach my $key (sort(keys(%changes))) { |
foreach my $key (sort(keys(%changes))) { |
#excludes not versionable problems from resource version history: |
#excludes not versionable problems from resource version history: |
next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); |
next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my $currentversion=&Apache::lonnet::getversion($key); |
my $currentversion=&Apache::lonnet::getversion($key); |
if ($currentversion<0) { |
if ($currentversion<0) { |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
} |
} |
my $linkurl=&Apache::lonnet::clutter($key); |
my $linkurl=&Apache::lonnet::clutter($key); |
$r->print( |
$r->print( |
&Apache::loncommon::end_data_table_header_row(). |
|
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'. |
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('. |
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('. |
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
'<td align="right">'); |
'<td align="right">' |
# Used in course |
); |
my $usedversion=$hash{'version_'.$linkurl}; |
# Used in course |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
my $usedversion=$hash{'version_'.$linkurl}; |
if($usedversion != $currentversion){ |
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
|
if ($usedversion != $currentversion) { |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
}else{ |
} else { |
$r->print($usedversion); |
$r->print($usedversion); |
} |
} |
} else { |
|
$r->print($currentversion); |
|
} |
|
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
|
# Set version |
|
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
|
'set_version_'.$linkurl, |
|
{'select_form_order' => |
|
['',1..$currentversion,'mostrecent'], |
|
'' => '', |
|
'mostrecent' => &mt('most recent'), |
|
map {$_,$_} (1..$currentversion)})); |
|
my $lastold=1; |
|
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
|
my $url=$root.'.'.$prevvers.'.'.$extension; |
|
if (&Apache::lonnet::metadata($url,'lastrevisiondate')< |
|
$starttime) { |
|
$lastold=$prevvers; |
|
} |
|
} |
|
# |
|
# Code to figure out how many version entries should go in |
|
# each of the four columns |
|
my $entries_per_col = 0; |
|
my $num_entries = ($currentversion-$lastold); |
|
if ($num_entries % $num_ver_col == 0) { |
|
$entries_per_col = $num_entries/$num_ver_col; |
|
} else { |
} else { |
$entries_per_col = $num_entries/$num_ver_col + 1; |
$r->print($currentversion); |
} |
} |
my $entries_count = 0; |
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
# Set version |
my $cols_output = 1; |
$r->print(&Apache::loncommon::select_form( |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
$setversions{$linkurl}, |
my $url=$root.'.'.$prevvers.'.'.$extension; |
'set_version_'.$linkurl, |
$r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url). |
{'select_form_order' => ['',1..$currentversion,'mostrecent'], |
'">'.&mt('Version').' '.$prevvers.'</a> ('. |
'' => '', |
&Apache::lonlocal::locallocaltime( |
'mostrecent' => &mt('most recent'), |
&Apache::lonnet::metadata($url, |
map {$_,$_} (1..$currentversion)})); |
'lastrevisiondate') |
my $lastold=1; |
). |
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
')'); |
my $url=$root.'.'.$prevvers.'.'.$extension; |
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { |
if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) { |
$r->print(' <a href="/adm/diff?filename='. |
$lastold=$prevvers; |
&Apache::lonnet::clutter($root.'.'.$extension). |
} |
'&versionone='.$prevvers. |
} |
'" target="diffs">'.&mt('Diffs').'</a>'); |
$r->print('</td>'); |
} |
# List all available versions |
$r->print('</span><br />'); |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
if (++$entries_count % $entries_per_col == 0) { |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
$r->print('</span></td>'); |
my $url=$root.'.'.$prevvers.'.'.$extension; |
if ($cols_output != $num_ver_col) { |
$r->print( |
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
'<span class="LC_nobreak">' |
$cols_output++; |
.'<a href="'.&Apache::lonnet::clutter($url).'">' |
} |
.&mt('Version [_1]',$prevvers).'</a>' |
} |
.' ('.&Apache::lonlocal::locallocaltime( |
} |
&Apache::lonnet::metadata($url,'lastrevisiondate')) |
while($cols_output++ < $num_ver_col) { |
.')'); |
$r->print('</span></td><td>'); |
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { |
|
$r->print( |
|
' <a href="/adm/diff?filename='. |
|
&Apache::lonnet::clutter($root.'.'.$extension). |
|
&HTML::Entities::encode('&versionone='.$prevvers,'"<>&'). |
|
'" target="diffs">'.&mt('Diffs').'</a>'); |
} |
} |
} |
$r->print('</span><br />'); |
|
} |
|
$r->print('</span></td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print('</td>'.&Apache::loncommon::end_data_table_row(). |
$r->print( |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'); |
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'. |
|
'</form>' |
|
); |
|
|
&untiehash(); |
&untiehash(); |
|
$r->print(&endContentScreen()); |
} |
} |
|
|
sub mark_hash_old { |
sub mark_hash_old { |
Line 3035 sub changewarning {
|
Line 3003 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 3151 sub handler {
|
Line 3114 sub handler {
|
'Adding_External_Resource','Navigate_Content', |
'Adding_External_Resource','Navigate_Content', |
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Adding_Folders','Docs_Overview', 'Load_Map', |
'Supplemental','Score_Upload_Form','Adding_Pages', |
'Supplemental','Score_Upload_Form','Adding_Pages', |
'Importing_LON-CAPA_Resource','Importing_IMS_Course', |
'Importing_LON-CAPA_Resource','Importing_IMS_Course', |
'Uploading_From_Harddrive', |
'Uploading_From_Harddrive', |
'Check_Resource_Versions','Verify_Content') { |
'Check_Resource_Versions','Verify_Content') { |
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
Line 3212 sub handler {
|
Line 3175 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']); |
'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 |
# standard=2: this is a "old-style" course, and there is nothing we can do |
# standard=2: this is a "old-style" course, and there is nothing we can do |
Line 3228 sub handler {
|
Line 3191 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 3250 sub handler {
|
Line 3213 sub handler {
|
if ($env{'form.command'} eq 'direct') { |
if ($env{'form.command'} eq 'direct') { |
my ($mapurl,$id,$resurl); |
my ($mapurl,$id,$resurl); |
if ($env{'form.symb'} ne '') { |
if ($env{'form.symb'} ne '') { |
($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); |
$env{'form.folderpath'}= |
if ($resurl=~/\.(sequence|page)$/) { |
&Apache::loncommon::symb_to_docspath($env{'form.symb'}); |
$mapurl=$resurl; |
|
} elsif ($resurl eq 'adm/navmaps') { |
|
$mapurl=$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
} |
|
my $mapresobj; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$mapresobj = $navmap->getResourceByUrl($mapurl); |
|
} |
|
$mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1}; |
|
my $type=$2; |
|
my $path; |
|
if (ref($mapresobj)) { |
|
my $pcslist = $mapresobj->map_hierarchy(); |
|
if ($pcslist ne '') { |
|
foreach my $pc (split(/,/,$pcslist)) { |
|
next if ($pc <= 1); |
|
my $res = $navmap->getByMapPc($pc); |
|
if (ref($res)) { |
|
my $thisurl = $res->src(); |
|
$thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
|
my $thistitle = $res->title(); |
|
$path .= '&'. |
|
&Apache::lonhtmlcommon::entity_encode($thisurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($thistitle). |
|
':'.$res->randompick(). |
|
':'.$res->randomout(). |
|
':'.$res->encrypted(). |
|
':'.$res->randomorder(); |
|
} |
|
} |
|
} |
|
$path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($mapresobj->title()). |
|
':'.$mapresobj->randompick(). |
|
':'.$mapresobj->randomout(). |
|
':'.$mapresobj->encrypted(). |
|
':'.$mapresobj->randomorder(); |
|
} else { |
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
|
$path = '&default&...::::'. |
|
'&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
|
} |
|
$path = 'default&'. |
|
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
|
$path; |
|
if ($type eq 'sequence') { |
|
$env{'form.folderpath'}=$path; |
|
$env{'form.pagepath'}=''; |
|
} else { |
|
$env{'form.pagepath'}=$path; |
|
$env{'form.folderpath'}=''; |
|
} |
|
} 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 3325 sub handler {
|
Line 3233 sub handler {
|
$stored_folderpath='docs_sup_folderpath'; |
$stored_folderpath='docs_sup_folderpath'; |
} |
} |
|
|
# No folderpath, no pagepath, 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'})) { |
if ((!$env{'form.folderpath'}) && $allowed) { |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
&Apache::loncommon::restore_course_settings($stored_folderpath, |
{'folderpath' => 'scalar'}); |
{'folderpath' => 'scalar'}); |
|
unless (&unescape($env{'form.folderpath'}) =~ m{^(default|supplemental)&}) { |
|
undef($env{'form.folderpath'}); |
|
} |
} |
} |
|
|
# 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 3350 sub handler {
|
Line 3255 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')). |
|
':::::'; |
} |
} |
} |
} |
|
|
# Store this |
# Store this |
unless ($toolsflag) { |
unless ($toolsflag) { |
&Apache::loncommon::store_course_settings($stored_folderpath, |
if ($allowed) { |
{'pagepath' => 'scalar', |
&Apache::loncommon::store_course_settings($stored_folderpath, |
'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 3429 sub handler {
|
Line 3328 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 3438 sub handler {
|
Line 3337 sub handler {
|
$script .= &editing_js($udom,$uname,$supplementalflag). |
$script .= &editing_js($udom,$uname,$supplementalflag). |
&history_tab_js(). |
&history_tab_js(). |
&inject_data_js(). |
&inject_data_js(). |
&Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr); |
&Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr). |
|
&Apache::lonextresedit::extedit_javascript(); |
$addentries = { |
$addentries = { |
onload => "javascript:resize_scrollbox('contentscroll','1','1');", |
onload => "javascript:resize_scrollbox('contentscroll','1','1');", |
}; |
}; |
} |
} |
if ($env{'docs.markedcopy_url'}) { |
if ($env{'docs.markedcopy_url'}) { |
$script .= &paste_popup_js(); |
$script .= &paste_popup_js(); |
} |
} |
my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'. |
my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'. |
&mt('Switch server?'); |
&mt('Switch server?'); |
|
|
|
|
} |
} |
# -------------------------------------------------------------------- Body tag |
# -------------------------------------------------------------------- Body tag |
$script = '<script type="text/javascript">'."\n" |
$script = '<script type="text/javascript">'."\n" |
Line 3458 sub handler {
|
Line 3360 sub handler {
|
|
|
# Breadcrumbs |
# Breadcrumbs |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
unless ($showdoc) { |
|
|
if ($showdoc) { |
|
$r->print(&Apache::loncommon::start_page("$crstype documents",undef, |
|
{'force_register' => $showdoc,})); |
|
} elsif ($r->uri eq '/adm/supplemental') { |
|
my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype); |
|
$r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef, |
|
{'bread_crumbs' => $brcrum,})); |
|
} else { |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
href=>"/adm/coursedocs",text=>"$crstype Contents"}); |
href=>"/adm/coursedocs",text=>"$crstype Contents"}); |
|
|
$r->print(&Apache::loncommon::start_page("$crstype Contents", $script, |
$r->print(&Apache::loncommon::start_page("$crstype Contents", $script, |
{'force_register' => $showdoc, |
{'add_entries' => $addentries} |
'add_entries' => $addentries, |
) |
}) |
|
.&Apache::loncommon::help_open_menu('','',273,'RAT') |
.&Apache::loncommon::help_open_menu('','',273,'RAT') |
.&Apache::lonhtmlcommon::breadcrumbs( |
.&Apache::lonhtmlcommon::breadcrumbs( |
'Editing '.$crstype.' Contents', |
'Editing '.$crstype.' Contents', |
'Docs_Adding_Course_Doc') |
'Docs_Adding_Course_Doc') |
); |
); |
} else { |
|
$r->print(&Apache::loncommon::start_page("$crstype documents",undef, |
|
{'force_register' => $showdoc,})); |
|
} |
} |
|
|
my %allfiles = (); |
my %allfiles = (); |
Line 3544 sub handler {
|
Line 3450 sub handler {
|
'upld' => 'Import Content', |
'upld' => 'Import Content', |
'srch' => 'Search', |
'srch' => 'Search', |
'impo' => 'Import', |
'impo' => 'Import', |
'lnks' => 'Import from Stored Links', |
'lnks' => 'Import from Stored Links', |
'impm' => 'Import from Assembled Map', |
'impm' => 'Import from Assembled Map', |
'selm' => 'Select Map', |
'selm' => 'Select Map', |
'load' => 'Load Map', |
'load' => 'Load Map', |
Line 3566 sub handler {
|
Line 3472 sub handler {
|
'imsf' => 'IMS Import', |
'imsf' => 'IMS Import', |
'imsl' => 'Import IMS package', |
'imsl' => 'Import IMS package', |
'cms' => 'Origin of IMS package', |
'cms' => 'Origin of IMS package', |
'file' => 'File', |
|
'se' => 'Select', |
'se' => 'Select', |
|
'file' => 'File', |
'title' => 'Title', |
'title' => 'Title', |
'comment' => 'Comment', |
'comment' => 'Comment', |
'url' => 'URL', |
'url' => 'URL', |
'prev' => 'Preview', |
'prev' => 'Preview', |
'lnk' => 'Add Link', |
'lnk' => 'Add Link', |
'parse' => 'Upload embedded images/multimedia files if HTML file', |
'parse' => 'Upload embedded images/multimedia files if HTML file', |
'nd' => 'Upload Document', |
|
'pm' => 'Published Map', |
|
'sd' => 'Special Document', |
|
'mo' => 'More Options', |
|
); |
); |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
my $fileupload=(<<FIUP); |
my $fileupload=(<<FIUP); |
Line 3595 FIUP
|
Line 3497 FIUP
|
CHBO |
CHBO |
my $imsfolder = $env{'form.folder'}; |
my $imsfolder = $env{'form.folder'}; |
if ($imsfolder eq '') { |
if ($imsfolder eq '') { |
$imsfolder = 'default'; |
$imsfolder = 'default'; |
} |
} |
my $imspform=(<<IMSFORM); |
my $imspform=(<<IMSFORM); |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('ims');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('ims');"> |
$lt{'imsf'}</a> $help{'Importing_IMS_Course'} |
$lt{'imsf'}</a> $help{'Importing_IMS_Course'} |
<form name="uploadims" action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" target="IMSimport"> |
<form name="uploadims" action="/adm/imsimportdocs" method="post" enctype="multipart/form-data" target="IMSimport"> |
<fieldset id="uploadimsform" style="display: none;" /> |
<fieldset id="uploadimsform" style="display: none;"> |
<legend>$lt{'imsf'}</legend> |
<legend>$lt{'imsf'}</legend> |
$fileupload |
$fileupload |
<br /> |
<br /> |
<p> |
<p> |
$lt{'cms'}: |
$lt{'cms'}: |
<select name="source"> |
<select name="source"> |
<option value="-1" selected="selected">$lt{'se'}</option> |
<option value="-1" selected="selected">$lt{'se'}</option> |
<option value="bb5">Blackboard 5</option> |
<option value="bb5">Blackboard 5</option> |
Line 3622 CHBO
|
Line 3524 CHBO
|
</form> |
</form> |
IMSFORM |
IMSFORM |
|
|
my $fileuploadform=(<<FUFORM); |
my $fileuploadform=(<<FUFORM); |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('doc');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('doc');"> |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<fieldset id="uploaddocform" style="display: none;" /> |
<fieldset id="uploaddocform" style="display: none;"> |
<legend>$lt{'upfi'}</legend> |
<legend>$lt{'upfi'}</legend> |
<input type="hidden" name="active" value="aa" /> |
<input type="hidden" name="active" value="aa" /> |
$fileupload |
$fileupload |
Line 3645 IMSFORM
|
Line 3547 IMSFORM
|
</form> |
</form> |
FUFORM |
FUFORM |
|
|
my $importpubform=(<<SEDFFORM); |
my $importpubform=(<<SEDFFORM); |
<a class="LC_menubuttons_link" href="javascript:toggleMap();"> |
<a class="LC_menubuttons_link" href="javascript:toggleMap('map');"> |
$lt{'impm'}</a>$help{'Load_Map'} |
$lt{'impm'}</a>$help{'Load_Map'} |
<form action="/adm/coursedocs" method="post" name="mapimportform"> |
<form action="/adm/coursedocs" method="post" name="mapimportform"> |
<fieldset id="importmapform" style="display: none;" /> |
<fieldset id="importmapform" style="display: none;"> |
<legend>$lt{'impm'}</legend> |
<legend>$lt{'impm'}</legend> |
<input type="hidden" name="active" value="bb" /> |
<input type="hidden" name="active" value="bb" /> |
$lt{'copm'}<br /> |
$lt{'copm'}<br /> |
<span class="LC_nobreak"> |
<span class="LC_nobreak"> |
<input type="text" name="importmap" size="40" value="" |
<input type="text" name="importmap" size="40" value="" |
onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" /> |
onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" /> |
<a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a><br /> |
<a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a></span><br /> |
<input type="submit" name="loadmap" value="$lt{'load'}" /> |
<input type="submit" name="loadmap" value="$lt{'load'}" /> |
</fieldset> |
</fieldset> |
</form> |
</form> |
|
|
SEDFFORM |
SEDFFORM |
|
my @importpubforma = ( |
my @simpleeditdefaultforma = ( |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => "$pathitem<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" }, |
|
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" }, |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap();" />' => $importpubform } |
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap(\'map\');" />' => $importpubform } |
); |
); |
$importpubform = &create_form_ul(&create_list_elements(@importpubforma)); |
$importpubform = &create_form_ul(&create_list_elements(@importpubforma)); |
|
my $extresourcesform = |
my $extresourcesform=(<<ERFORM); |
&Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem, |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('ext');">$lt{'extr'}</a>$help{'Adding_External_Resource'} |
$help{'Adding_External_Resource'}); |
<form action="/adm/coursedocs" method="post" name="newext"> |
|
<fieldset id="uploadextform" style="display: none;" /> |
|
<legend>$lt{'extr'}</legend> |
|
<input type="hidden" name="active" value="aa" /> |
|
$lt{'url'}:<br /> |
|
<input type="text" size="60" name="exturl" id="exturl" value="http://" /> |
|
<input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br /> |
|
$lt{'title'}:<br /> |
|
<input type="text" size="60" name="exttitle" value="$lt{'extr'}" /> |
|
$pathitem |
|
<br /> |
|
<input type="hidden" name="importdetail" value="" /> |
|
<input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" /> |
|
</fieldset> |
|
</form> |
|
ERFORM |
|
|
|
|
|
if ($allowed) { |
if ($allowed) { |
my $folder = $env{'form.folder'}; |
my $folder = $env{'form.folder'}; |
if ($folder eq '') { |
if ($folder eq '') { |
Line 3714 HIDDENFORM
|
Line 3597 HIDDENFORM
|
} |
} |
|
|
# Generate the tabs |
# Generate the tabs |
my $mode; |
my ($mode,$needs_end); |
if (($supplementalflag) && (!$allowed)) { |
if (($supplementalflag) && (!$allowed)) { |
&Apache::lonnavdisplay::startContentScreen($r,'supplemental'); |
my @folders = split('&',$env{'form.folderpath'}); |
|
unless (@folders > 2) { |
|
&Apache::lonnavdisplay::startContentScreen($r,'supplemental'); |
|
$needs_end = 1; |
|
} |
} else { |
} else { |
$r->print(&startContentScreen(($supplementalflag?'suppdocs':'docs'))); |
$r->print(&startContentScreen(($supplementalflag?'suppdocs':'docs'))); |
|
$needs_end = 1; |
} |
} |
|
|
# |
# |
Line 3746 HIDDENFORM
|
Line 3634 HIDDENFORM
|
#$postexec='self.close();'; |
#$postexec='self.close();'; |
} |
} |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence'; |
'.sequence'; |
|
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page'; |
'.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 3871 NPFORM
|
Line 3753 NPFORM
|
|
|
$newfolderform=(<<NFFORM); |
$newfolderform=(<<NFFORM); |
<form action="/adm/coursedocs" method="post" name="newfolder"> |
<form action="/adm/coursedocs" method="post" name="newfolder"> |
<input type="hidden" name="folderpath" value="$path" /> |
$pathitem |
<input type="hidden" name="importdetail" value="" /> |
<input type="hidden" name="importdetail" value="" /> |
<input type="hidden" name="active" value="aa" /> |
<input type="hidden" name="active" value="aa" /> |
<a href="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'} |
<a href="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'} |
Line 3909 NGFFORM
|
Line 3791 NGFFORM
|
$specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma)); |
$specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma)); |
|
|
|
|
|
|
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 3939 my %orderhash = (
|
Line 3826 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 Documents',$specialdocumentsform]; |
$orderhash{'ee'} = ['Special Pages',$specialdocumentsform]; |
} |
} |
|
|
$hadchanges=0; |
$hadchanges=0; |
Line 3972 unless ($env{'form.pagepath'}) {
|
Line 3859 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 3983 unless ($env{'form.pagepath'}) {
|
Line 3869 unless ($env{'form.pagepath'}) {
|
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');"> |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppdoc');"> |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
$lt{'upfi'}</a> $help{'Uploading_From_Harddrive'} |
<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data"> |
<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data"> |
<fieldset id="uploadsuppdocform" style="display: none;" /> |
<fieldset id="uploadsuppdocform" style="display: none;"> |
<legend>$lt{'upfi'}</legend> |
<legend>$lt{'upfi'}</legend> |
<input type="hidden" name="active" value="ee" /> |
<input type="hidden" name="active" value="ee" /> |
$fileupload |
$fileupload |
Line 3996 unless ($env{'form.pagepath'}) {
|
Line 3882 unless ($env{'form.pagepath'}) {
|
$lt{'comment'}:<br /> |
$lt{'comment'}:<br /> |
<textarea cols="50" rows="4" name="comment"></textarea> |
<textarea cols="50" rows="4" name="comment"></textarea> |
<br /> |
<br /> |
$pathitem |
$pathitem |
<input type="hidden" name="cmd" value="upload_supplemental" /> |
<input type="hidden" name="cmd" value="upload_supplemental" /> |
<input type='submit' value="$lt{'upld'}" /> |
<input type='submit' value="$lt{'upld'}" /> |
</form> |
</form> |
|
SUPDOCFORM |
|
|
my $supnewfolderform=(<<SNFFORM); |
my $supnewfolderform=(<<SNFFORM); |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
Line 4011 unless ($env{'form.pagepath'}) {
|
Line 3898 unless ($env{'form.pagepath'}) {
|
</form> |
</form> |
SNFFORM |
SNFFORM |
|
|
my $supextform=(<<ERFORM); |
my $supextform = |
<a class="LC_menubuttons_link" href="javascript:toggleUpload('suppext');">$lt{'extr'}</a>$help{'Adding_External_Resource'} |
&Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem, |
<form action="/adm/coursedocs" method="post" name="newsuppext"> |
$help{'Adding_External_Resource'}); |
<fieldset id="uploadsuppextform" style="display: none;" /> |
|
<legend>$lt{'extr'}</legend> |
|
<input type="hidden" name="active" value="ee" /> |
|
$lt{'url'}:<br /> |
|
<input type="text" size="60" name="exturl" id="exturl" value="http://" /> |
|
<input type="button" name="view" value="$lt{'prev'}" onclick="javascript:extUrlPreview('exturl');" /><br /> |
|
$lt{'title'}:<br /> |
|
<input type="text" size="60" name="exttitle" value="$lt{'extr'}" /> |
|
$pathitem |
|
<br /> |
|
<input type="hidden" name="importdetail" value="" /> |
|
<input type="button" value="$lt{'lnk'}" onclick="javascript:setExternal(this.form,0)" /> |
|
</fieldset> |
|
</form> |
|
ERFORM |
|
|
|
my $supnewsylform=(<<SNSFORM); |
my $supnewsylform=(<<SNSFORM); |
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<input type="hidden" name="active" value="ff" /> |
<input type="hidden" name="active" value="ff" /> |
<input type="hidden" name="folderpath" value="$path" /> |
$pathitem |
<input type="hidden" name="importdetail" |
<input type="hidden" name="importdetail" |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a> |
<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a> |
Line 4044 SNSFORM
|
Line 3916 SNSFORM
|
my $supnewaboutmeform=(<<SNAMFORM); |
my $supnewaboutmeform=(<<SNAMFORM); |
<form action="/adm/coursedocs" method="post" name="supnewaboutme"> |
<form action="/adm/coursedocs" method="post" name="supnewaboutme"> |
<input type="hidden" name="active" value="ff" /> |
<input type="hidden" name="active" value="ff" /> |
<input type="hidden" name="folderpath" value="$path" /> |
$pathitem |
<input type="hidden" name="importdetail" |
<input type="hidden" name="importdetail" |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a> |
<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a> |
Line 4060 my @specialdocs = (
|
Line 3932 my @specialdocs = (
|
=>$supnewaboutmeform}, |
=>$supnewaboutmeform}, |
); |
); |
my @supimportdoc = ( |
my @supimportdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'supext\');" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />' |
=>$supextform}, |
=>$supextform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
=>$supupdocform}, |
=>$supupdocform}, |
); |
); |
|
|
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)); |
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)); |
my %suporderhash = ( |
my %suporderhash = ( |
'00' => ['Supnewfolder', $supnewfolderform], |
'00' => ['Supnewfolder', $supnewfolderform], |
'ee' => ['Import Content',$supupdocform], |
'ee' => ['Import Content',$supupdocform], |
'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] |
'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))] |
); |
); |
if ($supplementalflag) { |
if ($supplementalflag) { |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
Line 4086 my %suporderhash = (
|
Line 3959 my %suporderhash = (
|
} |
} |
} |
} |
|
|
$r->print(&endContentScreen()); |
if ($needs_end) { |
|
$r->print(&endContentScreen()); |
|
} |
|
|
if ($allowed) { |
if ($allowed) { |
$r->print(' |
$r->print(' |
Line 4152 sub decompression_info {
|
Line 4027 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 4351 sub generate_edit_table {
|
Line 4223 sub generate_edit_table {
|
$activetab = $env{'form.active'}; |
$activetab = $env{'form.active'}; |
} |
} |
my $backicon = $iconpath.'clickhere.gif'; |
my $backicon = $iconpath.'clickhere.gif'; |
my $backtext = &mt('To Overview'); |
my $backtext = &mt('Exit'); |
$form = '<div class="LC_Box" style="margin:0;">'. |
$form = '<div class="LC_Box" style="margin:0;">'. |
'<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n". |
'<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n". |
'<li class="goback">'. |
'<li class="goback">'. |
'<a href="javascript:toContents('."'$jumpto'".');">'. |
'<a href="javascript:toContents('."'$jumpto'".');">'. |
'<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'. |
'<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'. |
' alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n". |
' alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n". |
'<li>'. |
'<li>'. |
'<a href="javascript:groupopen('."'$readfile'".',1);">'. |
'<a href="javascript:groupopen('."'$readfile'".',1);">'. |
&mt('Undo Delete').'</a></li>'."\n"; |
&mt('Undo Delete').'</a></li>'."\n"; |
if ($env{'form.docslog'}) { |
if ($env{'form.docslog'}) { |
$form .= '<li class="active">'; |
$form .= '<li class="active">'; |
} else { |
} else { |
Line 4444 sub editing_js {
|
Line 4316 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 4459 sub editing_js {
|
Line 4328 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'"; |
} |
} |
|
|
my $urlregexp = <<'ENDREGEXP'; |
|
/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i |
|
ENDREGEXP |
|
|
|
return <<ENDNEWSCRIPT; |
return <<ENDNEWSCRIPT; |
function makenewfolder(targetform,folderseq) { |
function makenewfolder(targetform,folderseq) { |
var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}'); |
var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}'); |
Line 4485 function makenewpage(targetform,folderse
|
Line 4353 function makenewpage(targetform,folderse
|
} |
} |
} |
} |
|
|
function editext(residx) { |
|
if (document.getElementById('uploadext'+residx)) { |
|
var curr = document.getElementById('uploadext'+residx).style.display; |
|
if (curr == 'none') { |
|
disp = 'block'; |
|
} else { |
|
disp = 'none'; |
|
} |
|
document.getElementById('uploadext'+residx).style.display=disp; |
|
} |
|
resize_scrollbox('contentscroll','1','1'); |
|
return; |
|
} |
|
|
|
function makeexamupload() { |
function makeexamupload() { |
var title=prompt('$lt{"p_mxu"}'); |
var title=prompt('$lt{"p_mxu"}'); |
if (title) { |
if (title) { |
Line 4579 function toggleUpload(caller) {
|
Line 4433 function toggleUpload(caller) {
|
return; |
return; |
} |
} |
|
|
function toggleMap() { |
function toggleMap(caller) { |
var disp = 'none'; |
var disp = 'none'; |
var curr = document.getElementById('importmapform').style.display; |
if (document.getElementById('importmapform')) { |
if (curr == 'none') { |
if (caller == 'map') { |
disp='block'; |
var curr = document.getElementById('importmapform').style.display; |
} |
if (curr == 'none') { |
document.getElementById('importmapform').style.display=disp; |
disp='block'; |
resize_scrollbox('contentscroll','1','1'); |
} |
return; |
|
} |
|
|
|
|
|
function extUrlPreview(caller) { |
|
if (document.getElementById(caller)) { |
|
var url = document.getElementById(caller).value; |
|
var regexp = $urlregexp; |
|
if (regexp.test(url)) { |
|
openMyModal(url,500,400,'yes'); |
|
} else { |
|
alert("$lt{'invurl'}"); |
|
} |
} |
|
document.getElementById('importmapform').style.display=disp; |
|
resize_scrollbox('contentscroll','1','1'); |
} |
} |
|
return; |
} |
} |
|
|
function makeims(imsform) { |
function makeims(imsform) { |
Line 4616 function makeims(imsform) {
|
Line 4461 function makeims(imsform) {
|
imsform.submit(); |
imsform.submit(); |
} |
} |
|
|
function setExternal(extform,residx) { |
function changename(folderpath,index,oldtitle) { |
var title=extform.exttitle.value; |
|
if (!String.trim) { |
|
String.prototype.trim = function() {return this.replace(\/^\\s+|\\s+$\/g, "");}; } |
|
var url=extform.exturl.value; |
|
var regexp = $urlregexp; |
|
if (title == null || title.trim()=="") { |
|
alert("$lt{'titbl'}"); |
|
extform.exttitle.focus(); |
|
return; |
|
} |
|
if (regexp.test(url)) { |
|
url = escape(url); |
|
if (residx > 0) { |
|
eval("extform.importdetail.value=title+'='+url+'='+residx;extform.submit();"); |
|
} else { |
|
eval("extform.importdetail.value=title+'='+url;extform.submit();"); |
|
} |
|
} else { |
|
alert("$lt{'invurl'}"); |
|
extform.exturl.focus(); |
|
return; |
|
} |
|
} |
|
|
|
function changename(folderpath,index,oldtitle,container,pagesymb) { |
|
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 4796 function showPage(current, pageId, nav,
|
Line 4592 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') { |