version 1.315, 2008/11/17 14:46:10
|
version 1.335, 2009/02/03 18:31:59
|
Line 27
|
Line 27
|
# |
# |
|
|
|
|
=head1 NAME |
|
|
|
Apache::londocs |
|
|
|
=head1 SYNOPSIS |
|
|
|
This is part of the LearningOnline Network with CAPA project |
|
described at http://www.lon-capa.org. |
|
|
|
=head1 SUBROUTINES |
|
|
|
=over |
|
|
|
=cut |
|
|
|
package Apache::londocs; |
package Apache::londocs; |
|
|
Line 70 my %alreadyseen=();
|
Line 56 my %alreadyseen=();
|
my $hadchanges; |
my $hadchanges; |
|
|
|
|
=pod |
|
|
|
=item %help=() |
|
|
|
Available help topics |
|
|
|
=cut |
|
|
|
my %help=(); |
my %help=(); |
|
|
=pod |
|
|
|
=item mapread() |
|
|
|
Mapread read maps into LONCAPA::map:: global arrays |
|
@order and @resources, determines status |
|
sets @order - pointer to resources in right order |
|
sets @resources - array with the resources with correct idx |
|
|
|
=cut |
|
|
|
sub mapread { |
sub mapread { |
my ($coursenum,$coursedom,$map)=@_; |
my ($coursenum,$coursedom,$map)=@_; |
Line 110 sub storemap {
|
Line 78 sub storemap {
|
} |
} |
|
|
|
|
=pod |
|
|
|
=item authorhosts() |
|
|
|
Return hash with valid author names |
|
|
|
=cut |
|
|
|
sub authorhosts { |
sub authorhosts { |
my %outhash=(); |
my %outhash=(); |
my $home=0; |
my $home=0; |
my $other=0; |
my $other=0; |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^user\.role\.(au|ca)\.(.+)$/) { |
if ($key=~/^user\.role\.(au|ca)\.(.+)$/) { |
my $role=$1; |
my $role=$1; |
my $realm=$2; |
my $realm=$2; |
my ($start,$end)=split(/\./,$env{$_}); |
my ($start,$end)=split(/\./,$env{$key}); |
if (($start) && ($start>time)) { next; } |
if (($start) && ($start>time)) { next; } |
if (($end) && (time>$end)) { next; } |
if (($end) && (time>$end)) { next; } |
my $ca; my $cd; |
my ($ca,$cd); |
if ($1 eq 'au') { |
if ($1 eq 'au') { |
$ca=$env{'user.name'}; |
$ca=$env{'user.name'}; |
$cd=$env{'user.domain'}; |
$cd=$env{'user.domain'}; |
Line 151 sub authorhosts {
|
Line 112 sub authorhosts {
|
} |
} |
return ($home,$other,%outhash); |
return ($home,$other,%outhash); |
} |
} |
=pod |
|
|
|
=item dumpbutton() |
|
|
|
Generate "dump" button |
|
|
|
=cut |
|
|
|
sub dumpbutton { |
sub dumpbutton { |
my ($home,$other,%outhash)=&authorhosts(); |
my ($home,$other,%outhash)=&authorhosts(); |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
if ($home+$other==0) { return ''; } |
if ($home+$other==0) { return ''; } |
if ($home) { |
if ($home) { |
return '<div>'. |
return '<input type="submit" name="dumpcourse" value="'. |
'<input type="submit" name="dumpcourse" value="'. |
|
&mt('Dump '.$type.' DOCS to Construction Space').'" />'. |
&mt('Dump '.$type.' DOCS to Construction Space').'" />'. |
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'). |
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs'); |
'</div>'; |
|
} else { |
} else { |
return '<div>'. |
return '<div>'. |
&mt('Dump '.$type. |
&mt('Dump '.$type. |
Line 183 sub clean {
|
Line 136 sub clean {
|
return $title; |
return $title; |
} |
} |
|
|
=pod |
|
|
|
=item dumpcourse() |
|
|
|
Actually dump course |
|
|
|
=cut |
|
|
|
sub dumpcourse { |
sub dumpcourse { |
my ($r) = @_; |
my ($r) = @_; |
Line 209 sub dumpcourse {
|
Line 156 sub dumpcourse {
|
my $title=$env{'form.authorfolder'}; |
my $title=$env{'form.authorfolder'}; |
$title=&clean($title); |
$title=&clean($title); |
my %replacehash=(); |
my %replacehash=(); |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.namefor\_(.+)/) { |
if ($key=~/^form\.namefor\_(.+)/) { |
$replacehash{$1}=$env{$_}; |
$replacehash{$1}=$env{$key}; |
} |
} |
} |
} |
my $crs='/uploaded/'.$env{'request.course.id'}.'/'; |
my $crs='/uploaded/'.$env{'request.course.id'}.'/'; |
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
foreach (keys %replacehash) { |
foreach my $item (keys(%replacehash)) { |
my $newfilename=$title.'/'.$replacehash{$_}; |
my $newfilename=$title.'/'.$replacehash{$item}; |
$newfilename=~s/\.(\w+)$//; |
$newfilename=~s/\.(\w+)$//; |
my $ext=$1; |
my $ext=$1; |
$newfilename=&clean($newfilename); |
$newfilename=&clean($newfilename); |
Line 232 sub dumpcourse {
|
Line 179 sub dumpcourse {
|
unless(mkdir($makepath,0777)) { $fail=1; } |
unless(mkdir($makepath,0777)) { $fail=1; } |
} |
} |
} |
} |
$r->print('<br /><tt>'.$_.'</tt> => <tt>'.$newfilename.'</tt>: '); |
$r->print('<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: '); |
if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { |
if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { |
if ($_=~/\.(sequence|page|html|htm|xml|xhtml)$/) { |
if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) { |
print $fh &Apache::lonclonecourse::rewritefile( |
print $fh &Apache::lonclonecourse::rewritefile( |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$_), |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item), |
(%replacehash,$crs => '') |
(%replacehash,$crs => '') |
); |
); |
} else { |
} else { |
print $fh |
print $fh |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$_); |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item); |
} |
} |
$fh->close(); |
$fh->close(); |
} else { |
} else { |
Line 259 sub dumpcourse {
|
Line 206 sub dumpcourse {
|
$r->print( |
$r->print( |
'<h3>'.&mt('Select the Construction Space').'</h3><select name="authorspace">'); |
'<h3>'.&mt('Select the Construction Space').'</h3><select name="authorspace">'); |
} |
} |
foreach (sort keys %outhash) { |
foreach my $key (sort(keys(%outhash))) { |
if ($_=~/^home_(.+)$/) { |
if ($key=~/^home_(.+)$/) { |
if ($home==1) { |
if ($home==1) { |
$r->print( |
$r->print( |
'<input type="hidden" name="authorspace" value="'.$1.'" />'); |
'<input type="hidden" name="authorspace" value="'.$1.'" />'); |
Line 286 sub dumpcourse {
|
Line 233 sub dumpcourse {
|
.'<th>'.&mt('Title').'</th>' |
.'<th>'.&mt('Title').'</th>' |
.'<th>'.&mt('Save as ...').'</th>' |
.'<th>'.&mt('Save as ...').'</th>' |
.&Apache::loncommon::end_data_table_header_row()); |
.&Apache::loncommon::end_data_table_header_row()); |
foreach (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { |
foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print(&Apache::loncommon::start_data_table_row() |
.'<td>'.$_.'</td>'); |
.'<td>'.$file.'</td>'); |
my ($ext)=($_=~/\.(\w+)$/); |
my ($ext)=($file=~/\.(\w+)$/); |
my $title=$hash{'title_'.$hash{ |
my $title=$hash{'title_'.$hash{ |
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; |
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}}; |
$r->print('<td>'.($title?$title:' ').'</td>'); |
$r->print('<td>'.($title?$title:' ').'</td>'); |
if (!$title) { |
if (!$title) { |
$title=$_; |
$title=$file; |
} else { |
} else { |
$title=~s|/|_|g; |
$title=~s|/|_|g; |
} |
} |
$title=~s/\.(\w+)$//; |
$title=~s/\.(\w+)$//; |
$title=&clean($title); |
$title=&clean($title); |
$title.='.'.$ext; |
$title.='.'.$ext; |
$r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td>" |
$r->print("\n<td><input type='text' size='60' name='namefor_".$file."' value='".$title."' /></td>" |
.&Apache::loncommon::end_data_table_row()); |
.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
Line 311 sub dumpcourse {
|
Line 258 sub dumpcourse {
|
} |
} |
} |
} |
|
|
=pod |
|
|
|
=item exportbutton() |
|
|
|
Generate "export" button |
|
|
|
=cut |
|
|
|
sub exportbutton { |
sub exportbutton { |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
return '<div>'. |
return '<input type="submit" name="exportcourse" value="'. |
'<input type="submit" name="exportcourse" value="'. |
|
&mt('Export '.$type.' to IMS').'" />'. |
&mt('Export '.$type.' to IMS').'" />'. |
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'</div>'; |
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs'); |
} |
} |
|
|
=pod |
|
|
|
=item exportcourse() |
|
|
|
=cut |
|
|
|
sub exportcourse { |
sub exportcourse { |
my $r=shift; |
my $r=shift; |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); |
my $numdisc = keys %discussiontime; |
my $numdisc = keys(%discussiontime); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (!defined($navmap)) { |
|
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'). |
|
'<h2>IMS Export Failed</h2>'. |
|
'<div class="LC_error">'. |
|
&mt('Unable to retrieve information about course contents'). |
|
'</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>'); |
|
&Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); |
|
return; |
|
} |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $curRes; |
my $curRes; |
my $outcome; |
my $outcome; |
Line 508 function containerCheck(item) {
|
Line 453 function containerCheck(item) {
|
} |
} |
|; |
|; |
|
|
foreach my $container (sort { $a <=> $b } keys %children) { |
foreach my $container (sort { $a <=> $b } (keys(%children))) { |
my @contents = split/:/,$children{$container}; |
my @contents = split(/:/,$children{$container}); |
for (my $i=0; $i<@contents; $i ++) { |
for (my $i=0; $i<@contents; $i ++) { |
$scripttag .= ' parents['.$container.']['.$i.'] = '.$contents[$i]."\n"; |
$scripttag .= ' parents['.$container.']['.$i.'] = '.$contents[$i]."\n"; |
} |
} |
Line 531 function containerCheck(item) {
|
Line 476 function containerCheck(item) {
|
$r->print($display.'</table>'. |
$r->print($display.'</table>'. |
'<p><input type="hidden" name="finishexport" value="1">'. |
'<p><input type="hidden" name="finishexport" value="1">'. |
'<input type="submit" name="exportcourse" value="'. |
'<input type="submit" name="exportcourse" value="'. |
&mt('Export '.$type.' DOCS').'" /></p></form>'. |
&mt('Export '.$type.' DOCS').'" /></p></form>'); |
&Apache::loncommon::end_page()); |
|
} |
} |
} |
} |
|
|
Line 617 sub build_package {
|
Line 561 sub build_package {
|
if ($curRes->is_sequence() || $curRes->is_page()) { |
if ($curRes->is_sequence() || $curRes->is_page()) { |
$lastcontainer = $count; |
$lastcontainer = $count; |
} |
} |
if (grep/^$count$/,@$exportitems) { |
if (grep(/^$count$/,@$exportitems)) { |
&get_dependencies($exportitems,\%parent,$depth,\@dependencies); |
&get_dependencies($exportitems,\%parent,$depth,\@dependencies); |
} |
} |
} |
} |
Line 641 sub build_package {
|
Line 585 sub build_package {
|
|
|
if (ref($curRes)) { |
if (ref($curRes)) { |
$count ++; |
$count ++; |
if ((grep/^$count$/,@$exportitems) || (grep/^$count$/,@dependencies)) { |
if ((grep(/^$count$/,@$exportitems)) || (grep(/^$count$/,@dependencies))) { |
my $symb = $curRes->symb(); |
my $symb = $curRes->symb(); |
my $isvisible = 'true'; |
my $isvisible = 'true'; |
my $resourceref; |
my $resourceref; |
Line 675 sub build_package {
|
Line 619 sub build_package {
|
' <resource identifier="RES-'.$env{'request.course.id'}.'-'.$count. |
' <resource identifier="RES-'.$env{'request.course.id'}.'-'.$count. |
'" type="webcontent" href="'.$content_file.'">'."\n". |
'" type="webcontent" href="'.$content_file.'">'."\n". |
' <file href="'.$content_file.'" />'."\n"; |
' <file href="'.$content_file.'" />'."\n"; |
foreach (@hrefs) { |
foreach my $item (@hrefs) { |
$imsresources .= |
$imsresources .= |
' <file href="'.$_.'" />'."\n"; |
' <file href="'.$item.'" />'."\n"; |
} |
} |
if (grep/^$count$/,@$discussions) { |
if (grep(/^$count$/,@$discussions)) { |
my $ressymb = $symb; |
my $ressymb = $symb; |
my $mode; |
my $mode; |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) { |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) { |
Line 720 sub build_package {
|
Line 664 sub build_package {
|
sub get_dependencies { |
sub get_dependencies { |
my ($exportitems,$parent,$depth,$dependencies) = @_; |
my ($exportitems,$parent,$depth,$dependencies) = @_; |
if ($depth > 1) { |
if ($depth > 1) { |
if ((!grep/^$$parent{$depth}$/,@$exportitems) && (!grep/^$$parent{$depth}$/,@$dependencies)) { |
if ((!grep(/^$$parent{$depth}$/,@$exportitems)) && (!grep(/^$$parent{$depth}$/,@$dependencies))) { |
push @$dependencies, $$parent{$depth}; |
push(@{$dependencies},$$parent{$depth}); |
if ($depth > 2) { |
if ($depth > 2) { |
&get_dependencies($exportitems,$parent,$depth-1,$dependencies); |
&get_dependencies($exportitems,$parent,$depth-1,$dependencies); |
} |
} |
Line 927 sub extract_media {
|
Line 871 sub extract_media {
|
my $copiedfile; |
my $copiedfile; |
if ($copiedfile = Apache::File->new('>'.$destination)) { |
if ($copiedfile = Apache::File->new('>'.$destination)) { |
print $copiedfile $embed_content; |
print $copiedfile $embed_content; |
push @{$href}, 'resources/'.$count.'/res/'.$filename; |
push(@{$href},'resources/'.$count.'/res/'.$filename); |
my $attrib_regexp = ''; |
my $attrib_regexp = ''; |
if (@{$allfiles{$embed_file}} > 1) { |
if (@{$allfiles{$embed_file}} > 1) { |
$attrib_regexp = join('|',@{$allfiles{$embed_file}}); |
$attrib_regexp = join('|',@{$allfiles{$embed_file}}); |
Line 971 sub store_template {
|
Line 915 sub store_template {
|
} |
} |
} |
} |
|
|
=pod |
|
|
|
=item group_import() |
|
|
|
Imports the given (name, url) resources into the course |
|
coursenum, coursedom, and folder must precede the list |
|
|
|
=cut |
|
|
|
sub group_import { |
sub group_import { |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
Line 1114 sub log_docs {
|
Line 1050 sub log_docs {
|
'currentfolder' => $env{'form.folder'}); |
'currentfolder' => $env{'form.folder'}); |
if ($parmidx) { |
if ($parmidx) { |
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
foreach my $parm (keys %parmaction) { |
foreach my $parm (keys(%parmaction)) { |
$storehash{'parameter_action_'.$parm}=$parmaction{$parm}; |
$storehash{'parameter_action_'.$parm}=$parmaction{$parm}; |
$storehash{'parameter_value_'.$parm}=$parmvalue{$parm}; |
$storehash{'parameter_value_'.$parm}=$parmvalue{$parm}; |
} |
} |
Line 1140 sub log_docs {
|
Line 1076 sub log_docs {
|
} |
} |
} |
} |
|
|
=pod |
|
|
|
=item docs_change_log() |
|
|
|
=cut |
|
|
|
sub docs_change_log { |
sub docs_change_log { |
my ($r)=@_; |
my ($r)=@_; |
Line 1340 ENDPASTE
|
Line 1274 ENDPASTE
|
sub do_paste_from_buffer { |
sub do_paste_from_buffer { |
my ($coursenum,$coursedom,$folder) = @_; |
my ($coursenum,$coursedom,$folder) = @_; |
|
|
return 0 if (!$env{'form.pastemarked'}); |
if (!$env{'form.pastemarked'}) { |
|
return; |
|
} |
|
|
# paste resource to end of list |
# paste resource to end of list |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); |
Line 1348 sub do_paste_from_buffer {
|
Line 1284 sub do_paste_from_buffer {
|
# Maps need to be copied first |
# Maps need to be copied first |
if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) { |
if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) { |
$title=&mt('Copy of').' '.$title; |
$title=&mt('Copy of').' '.$title; |
my $newid=$$.time; |
my $newid=$$.int(rand(100)).time; |
$url=~/^(.+)\.(\w+)$/; |
my ($oldid,$ext) = ($url=~/^(.+)\.(\w+)$/); |
my $newurl=$1.$newid.'.'.$2; |
if ($oldid =~ m{^(/uploaded/\Q$coursedom\E/\Q$coursenum\E/)(\D+)(\d+)$}) { |
|
my $path = $1; |
|
my $prefix = $2; |
|
my $ancestor = $3; |
|
if (length($ancestor) > 10) { |
|
$ancestor = substr($ancestor,-10,10); |
|
} |
|
$oldid = $path.$prefix.$ancestor; |
|
} |
|
my $counter = 0; |
|
my $newurl=$oldid.$newid.'.'.$ext; |
|
my $is_unique = &uniqueness_check($newurl); |
|
while (!$is_unique && $counter < 100) { |
|
$counter ++; |
|
$newid ++; |
|
$newurl = $oldid.$newid; |
|
$is_unique = &uniqueness_check($newurl); |
|
} |
|
if (!$is_unique) { |
|
if ($url=~/\.page$/) { |
|
return &mt('Paste failed: an error occurred creating a unique URL for the composite page'); |
|
} else { |
|
return &mt('Paste failed: an error occurred creating a unique URL for the folder'); |
|
} |
|
} |
my $storefn=$newurl; |
my $storefn=$newurl; |
$storefn=~s{^/\w+/$match_domain/$match_username/}{}; |
$storefn=~s{^/\w+/$match_domain/$match_username/}{}; |
&Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn, |
my $paste_map_result = |
&Apache::lonnet::getfile($url)); |
&Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn, |
|
&Apache::lonnet::getfile($url)); |
|
if ($paste_map_result eq '/adm/notfound.html') { |
|
if ($url=~/\.page$/) { |
|
return &mt('Paste failed: an error occurred saving the composite page'); |
|
} else { |
|
return &mt('Paste failed: an error occurred saving the folder'); |
|
} |
|
} |
$url = $newurl; |
$url = $newurl; |
} |
} |
# 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 1396 sub do_paste_from_buffer {
|
Line 1364 sub do_paste_from_buffer {
|
|
|
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; |
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; |
push(@LONCAPA::map::order, $newidx); |
push(@LONCAPA::map::order, $newidx); |
|
return 'ok'; |
# Store the result |
# Store the result |
} |
} |
|
|
|
sub uniqueness_check { |
|
my ($newurl) = @_; |
|
my $unique = 1; |
|
foreach my $res (@LONCAPA::map::order) { |
|
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
|
$url=&LONCAPA::map::qtescape($url); |
|
if ($newurl eq $url) { |
|
$unique = 0; |
|
last; |
|
} |
|
} |
|
return $unique; |
|
} |
|
|
my %parameter_type = ( 'randompick' => 'int_pos', |
my %parameter_type = ( 'randompick' => 'int_pos', |
'hiddenresource' => 'string_yesno', |
'hiddenresource' => 'string_yesno', |
'encrypturl' => 'string_yesno', |
'encrypturl' => 'string_yesno', |
Line 1514 sub editor {
|
Line 1497 sub editor {
|
} |
} |
|
|
if ($env{'form.pastemarked'}) { |
if ($env{'form.pastemarked'}) { |
&do_paste_from_buffer($coursenum,$coursedom,$folder); |
my $paste_res = |
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); |
&do_paste_from_buffer($coursenum,$coursedom,$folder); |
return $errtext if ($fatal); |
if ($paste_res eq 'ok') { |
|
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
return $errtext if ($fatal); |
|
} elsif ($paste_res ne '') { |
|
$r->print('<p><span class="LC_error">'.$paste_res.'</span></p>'); |
|
} |
} |
} |
|
|
$r->print($upload_output); |
$r->print($upload_output); |
Line 1528 sub editor {
|
Line 1516 sub editor {
|
# Group import/search |
# Group import/search |
if ($env{'form.importdetail'}) { |
if ($env{'form.importdetail'}) { |
my @imports; |
my @imports; |
foreach (split(/\&/,$env{'form.importdetail'})) { |
foreach my $item (split(/\&/,$env{'form.importdetail'})) { |
if (defined($_)) { |
if (defined($item)) { |
my ($name,$url,$residx)= |
my ($name,$url,$residx)= |
map {&unescape($_)} split(/\=/,$_); |
map {&unescape($_)} split(/\=/,$item); |
push(@imports, [$name, $url, $residx]); |
push(@imports, [$name, $url, $residx]); |
} |
} |
} |
} |
Line 1808 sub entryline {
|
Line 1796 sub entryline {
|
# no copy for published maps |
# no copy for published maps |
$nocopy = 1; |
$nocopy = 1; |
} else { |
} else { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url),1)) { |
foreach my $item (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url),1)) { |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
my ($title,$url,$ext,$type)=split(/\:/,$item); |
if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) { |
if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) { |
$nocopy=1; |
$nocopy=1; |
last; |
last; |
Line 1973 END
|
Line 1961 END
|
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 =' |
<nobr><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></nobr>'; |
<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>'; |
} |
} |
if ($ispage) { |
if ($ispage) { |
my $pagename=&escape($pagetitle); |
my $pagename=&escape($pagetitle); |
Line 2066 sub untiehash {
|
Line 2054 sub untiehash {
|
} |
} |
|
|
|
|
=pod |
|
|
|
=item checkonthis() |
|
|
|
check on this |
|
|
|
=cut |
|
|
|
|
|
sub checkonthis { |
sub checkonthis { |
Line 2126 sub checkonthis {
|
Line 2107 sub checkonthis {
|
} |
} |
my $dependencies= |
my $dependencies= |
&Apache::lonnet::metadata($url,'dependencies'); |
&Apache::lonnet::metadata($url,'dependencies'); |
foreach (split(/\,/,$dependencies)) { |
foreach my $dep (split(/\,/,$dependencies)) { |
if (($_=~/^\/res\//) && (!$alreadyseen{$_})) { |
if (($dep=~/^\/res\//) && (!$alreadyseen{$dep})) { |
&checkonthis($r,$_,$level+1); |
&checkonthis($r,$dep,$level+1); |
} |
} |
} |
} |
} elsif ($result eq 'unavailable') { |
} elsif ($result eq 'unavailable') { |
Line 2159 List Symbs
|
Line 2140 List Symbs
|
sub list_symbs { |
sub list_symbs { |
my ($r) = @_; |
my ($r) = @_; |
|
|
|
my $type = &Apache::loncommon::course_type(); |
$r->print(&Apache::loncommon::start_page('Symb List')); |
$r->print(&Apache::loncommon::start_page('Symb List')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List')); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$r->print("<pre>\n"); |
if (!defined($navmap)) { |
foreach my $res ($navmap->retrieveResources()) { |
$r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'. |
$r->print($res->compTitle()."\t".$res->symb()."\n"); |
'<div class="LC_error">'. |
|
&mt('Unable to retrieve information about course contents'). |
|
'</div>'); |
|
&Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); |
|
} else { |
|
$r->print("<pre>\n"); |
|
foreach my $res ($navmap->retrieveResources()) { |
|
$r->print($res->compTitle()."\t".$res->symb()."\n"); |
|
} |
|
$r->print("\n</pre>\n"); |
} |
} |
$r->print("\n</pre>\n"); |
|
$r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>'); |
$r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>'); |
} |
} |
|
|
|
|
=pod |
|
|
|
=item verifycontent() |
|
|
|
Verify Content |
|
|
|
=cut |
|
|
|
sub verifycontent { |
sub verifycontent { |
my ($r) = @_; |
my ($r) = @_; |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
Line 2190 sub verifycontent {
|
Line 2172 sub verifycontent {
|
undef %alreadyseen; |
undef %alreadyseen; |
%alreadyseen=(); |
%alreadyseen=(); |
&tiehash(); |
&tiehash(); |
foreach (keys %hash) { |
foreach my $key (keys(%hash)) { |
if ($hash{$_}=~/\.(page|sequence)$/) { |
if ($hash{$key}=~/\.(page|sequence)$/) { |
if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) { |
if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) { |
$r->print('<hr /><span class="LC_error">'. |
$r->print('<hr /><span class="LC_error">'. |
&mt('The following sequence or page is included more than once in your '.$type.': '). |
&mt('The following sequence or page is included more than once in your '.$type.': '). |
&unescape($hash{$_}).'</span><br />'. |
&unescape($hash{$key}).'</span><br />'. |
&mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />')); |
&mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />')); |
} |
} |
} |
} |
if (($_=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$_})})) { |
if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) { |
&checkonthis($r,$hash{$_},0,$hash{'title_'.$1}); |
&checkonthis($r,$hash{$key},0,$hash{'title_'.$1}); |
} |
} |
} |
} |
&untiehash(); |
&untiehash(); |
Line 2208 sub verifycontent {
|
Line 2190 sub verifycontent {
|
&mt('Return to DOCS').'</a>'); |
&mt('Return to DOCS').'</a>'); |
} |
} |
|
|
=pod |
|
|
|
=item devalidateversioncache() & checkversions() |
|
|
|
Check Versions |
|
|
|
=cut |
|
|
|
sub devalidateversioncache { |
sub devalidateversioncache { |
my $src=shift; |
my $src=shift; |
Line 2245 sub checkversions {
|
Line 2220 sub checkversions {
|
my %newsetversions=(); |
my %newsetversions=(); |
if ($env{'form.setmostrecent'}) { |
if ($env{'form.setmostrecent'}) { |
$haschanged=1; |
$haschanged=1; |
foreach (keys %hash) { |
foreach my $key (keys(%hash)) { |
if ($_=~/^ids\_(\/res\/.+)$/) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
$newsetversions{$1}='mostrecent'; |
$newsetversions{$1}='mostrecent'; |
&devalidateversioncache($1); |
&devalidateversioncache($1); |
} |
} |
} |
} |
} elsif ($env{'form.setcurrent'}) { |
} elsif ($env{'form.setcurrent'}) { |
$haschanged=1; |
$haschanged=1; |
foreach (keys %hash) { |
foreach my $key (keys(%hash)) { |
if ($_=~/^ids\_(\/res\/.+)$/) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
my $getvers=&Apache::lonnet::getversion($1); |
my $getvers=&Apache::lonnet::getversion($1); |
if ($getvers>0) { |
if ($getvers>0) { |
$newsetversions{$1}=$getvers; |
$newsetversions{$1}=$getvers; |
Line 2264 sub checkversions {
|
Line 2239 sub checkversions {
|
} |
} |
} elsif ($env{'form.setversions'}) { |
} elsif ($env{'form.setversions'}) { |
$haschanged=1; |
$haschanged=1; |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.set_version_(.+)$/) { |
if ($key=~/^form\.set_version_(.+)$/) { |
my $src=$1; |
my $src=$1; |
if (($env{$_}) && ($env{$_} ne $setversions{$src})) { |
if (($env{$key}) && ($env{$key} ne $setversions{$src})) { |
$newsetversions{$src}=$env{$_}; |
$newsetversions{$src}=$env{$key}; |
&devalidateversioncache($src); |
&devalidateversioncache($src); |
} |
} |
} |
} |
Line 2289 sub checkversions {
|
Line 2264 sub checkversions {
|
# show all documents |
# show all documents |
$header=&mt('All Documents in '.$type); |
$header=&mt('All Documents in '.$type); |
$allsel=1; |
$allsel=1; |
foreach (keys %hash) { |
foreach my $key (keys(%hash)) { |
if ($_=~/^ids\_(\/res\/.+)$/) { |
if ($key=~/^ids\_(\/res\/.+)$/) { |
my $src=$1; |
my $src=$1; |
$changes{$src}=1; |
$changes{$src}=1; |
} |
} |
Line 2300 sub checkversions {
|
Line 2275 sub checkversions {
|
%changes=&Apache::lonnet::dump |
%changes=&Apache::lonnet::dump |
('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'}, |
('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
my $firstkey=(keys %changes)[0]; |
my $firstkey=(keys(%changes))[0]; |
unless ($firstkey=~/^error\:/) { |
unless ($firstkey=~/^error\:/) { |
unless ($env{'form.timerange'}) { |
unless ($env{'form.timerange'}) { |
$env{'form.timerange'}=604800; |
$env{'form.timerange'}=604800; |
Line 2364 sub checkversions {
|
Line 2339 sub checkversions {
|
<input type="submit" name="setversions" value="$lt{'sv'}" /> |
<input type="submit" name="setversions" value="$lt{'sv'}" /> |
<table border="0"> |
<table border="0"> |
ENDHEADERS |
ENDHEADERS |
foreach (sort keys %changes) { |
foreach my $key (sort(keys(%changes))) { |
if ($changes{$_}>$starttime) { |
if ($changes{$key}>$starttime) { |
my ($root,$extension)=($_=~/^(.*)\.(\w+)$/); |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
my $currentversion=&Apache::lonnet::getversion($_); |
my $currentversion=&Apache::lonnet::getversion($key); |
if ($currentversion<0) { |
if ($currentversion<0) { |
$currentversion=&mt('Could not be determined.'); |
$currentversion=&mt('Could not be determined.'); |
} |
} |
my $linkurl=&Apache::lonnet::clutter($_); |
my $linkurl=&Apache::lonnet::clutter($key); |
$r->print( |
$r->print( |
'<tr><td colspan="5"><br /><br /><font size="+1"><b>'. |
'<tr><td colspan="5"><br /><br /><font size="+1"><b>'. |
&Apache::lonnet::gettitle($linkurl). |
&Apache::lonnet::gettitle($linkurl). |
Line 2518 sub changewarning {
|
Line 2493 sub changewarning {
|
$help{'Caching'}.'</span></h3></form>'."\n\n"); |
$help{'Caching'}.'</span></h3></form>'."\n\n"); |
} |
} |
|
|
=pod |
|
|
|
=item init_breadcrumbs() |
|
|
|
Breadcrumbs for special functions |
|
|
|
=cut |
|
|
|
sub init_breadcrumbs { |
sub init_breadcrumbs { |
my ($form,$text)=@_; |
my ($form,$text)=@_; |
Line 2541 sub init_breadcrumbs {
|
Line 2509 sub init_breadcrumbs {
|
} |
} |
|
|
|
|
=pod |
|
|
|
=item handler() |
|
|
|
Main Handler |
|
|
|
=cut |
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 2556 sub handler {
|
Line 2518 sub handler {
|
return OK if $r->header_only; |
return OK if $r->header_only; |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
|
|
|
|
# --------------------------------------------- Initialize help topics for this |
# --------------------------------------------- Initialize help topics for this |
foreach ('Adding_Course_Doc','Main_Course_Documents', |
foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', |
'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','Uploading_From_Harddrive', |
'Importing_LON-CAPA_Resource','Uploading_From_Harddrive', |
'Check_Resource_Versions','Verify_Content') { |
'Check_Resource_Versions','Verify_Content') { |
$help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_); |
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
} |
} |
# Composite help files |
# Composite help files |
$help{'Syllabus'} = &Apache::loncommon::help_open_topic( |
$help{'Syllabus'} = &Apache::loncommon::help_open_topic( |
Line 2609 sub handler {
|
Line 2572 sub handler {
|
my $showdoc=0; |
my $showdoc=0; |
my $containertag; |
my $containertag; |
my $uploadtag; |
my $uploadtag; |
|
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','pagepath', |
['folderpath','pagepath', |
'pagesymb']); |
'pagesymb']); |
Line 2682 sub handler {
|
Line 2647 sub handler {
|
} |
} |
# -------------------------------------------------------------------- Body tag |
# -------------------------------------------------------------------- Body tag |
$script = '<script type="text/javascript">'."\n".$script."\n".'</script>'; |
$script = '<script type="text/javascript">'."\n".$script."\n".'</script>'; |
|
my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}]; |
$r->print(&Apache::loncommon::start_page("$type Documents", $script, |
$r->print(&Apache::loncommon::start_page("$type Documents", $script, |
{'force_register' => $showdoc,}). |
{'force_register' => $showdoc, |
|
'bread_crumbs' => $brcrum}). |
&Apache::loncommon::help_open_menu('','',273,'RAT')); |
&Apache::loncommon::help_open_menu('','',273,'RAT')); |
|
|
my %allfiles = (); |
my %allfiles = (); |
Line 2722 sub handler {
|
Line 2689 sub handler {
|
} |
} |
my @attributes = (); |
my @attributes = (); |
if ($env{'form.embedded_attrib_'.$i} =~ /:/) { |
if ($env{'form.embedded_attrib_'.$i} =~ /:/) { |
@attributes = split/:/,$env{'form.embedded_attrib_'.$i}; |
@attributes = split(/:/,$env{'form.embedded_attrib_'.$i}); |
} else { |
} else { |
@attributes = ($env{'form.embedded_attrib_'.$i}); |
@attributes = ($env{'form.embedded_attrib_'.$i}); |
} |
} |
foreach (@attributes) { |
foreach my $attr (@attributes) { |
push(@{$attribs{$i}},&unescape($_)); |
push(@{$attribs{$i}},&unescape($attr)); |
} |
} |
if ($javacodebase) { |
if ($javacodebase) { |
$codebase{$i} = $javacodebase; |
$codebase{$i} = $javacodebase; |
Line 2745 sub handler {
|
Line 2712 sub handler {
|
my $updateflag = 0; |
my $updateflag = 0; |
my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode); |
my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode); |
if ($getstatus eq 'ok') { |
if ($getstatus eq 'ok') { |
foreach my $item (keys %newname) { |
foreach my $item (keys(%newname)) { |
if ($newname{$item} ne $origname{$item}) { |
if ($newname{$item} ne $origname{$item}) { |
my $attrib_regexp = ''; |
my $attrib_regexp = ''; |
if (@{$attribs{$item}} > 1) { |
if (@{$attribs{$item}} > 1) { |
Line 2779 sub handler {
|
Line 2746 sub handler {
|
'uplm' => 'Upload a new main '.lc($type).' document', |
'uplm' => 'Upload a new main '.lc($type).' document', |
'upls' => 'Upload a new supplemental '.lc($type).' document', |
'upls' => 'Upload a new supplemental '.lc($type).' document', |
'impp' => 'Import a document', |
'impp' => 'Import a document', |
'pubd' => 'Published documents', |
'pubd' => 'Published Documents', |
'copm' => 'All documents out of a published map into this folder', |
'copm' => 'All documents out of a published map into this folder', |
'spec' => 'Special documents', |
|
'upld' => 'Upload Document', |
'upld' => 'Upload Document', |
'srch' => 'Search', |
'srch' => 'Search', |
'impo' => 'Import', |
'impo' => 'Import', |
Line 2807 sub handler {
|
Line 2773 sub handler {
|
'file' => 'File', |
'file' => 'File', |
'title' => 'Title', |
'title' => 'Title', |
'comment' => 'Comment', |
'comment' => 'Comment', |
'parse' => 'If HTML file, upload embedded images/multimedia files' |
'parse' => 'Upload embedded images/multimedia files if HTML file!', |
|
'nd' => 'New Document', |
|
'pm' => 'Published Map', |
|
'sd' => 'Special Document', |
|
'mo' => 'More Options', |
|
'hao' => 'Hide all Options' |
); |
); |
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
|
my $fileupload=(<<FIUP); |
|
$lt{'file'}:<br /> |
|
<input type="file" name="uploaddoc" size="40" /> |
|
FIUP |
|
|
|
my $checkbox=(<<CHBO); |
|
<!-- <label>$lt{'parse'}? |
|
<input type="checkbox" name="parserflag" /> |
|
</label> --> |
|
<label> |
|
<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'} |
|
</label> |
|
CHBO |
|
|
|
my $fileuploadform=(<<FUFORM); |
|
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
|
$fileupload |
|
<br /> |
|
$lt{'title'}:<br /> |
|
<input type="text" size="50" name="comment" /> |
|
$uploadtag |
|
<input type="hidden" name="cmd" value="upload_default" /> |
|
<br /> |
|
<span class="LC_nobreak"> |
|
$checkbox |
|
</span> |
|
<br /> |
|
<br /> |
|
<span class="LC_nobreak"> |
|
<input type="submit" value="$lt{'upld'}" /> |
|
$help{'Uploading_From_Harddrive'} |
|
</span> |
|
</form> |
|
FUFORM |
|
|
|
my $simpleeditdefaultform=(<<SEDFFORM); |
|
<form action="/adm/coursedocs" method="post" name="simpleeditdefault"> |
|
$lt{'pubd'}<br /> |
|
$uploadtag |
|
<input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" /> |
|
<br /> |
|
<span class="LC_nobreak"> |
|
<input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" /> |
|
$help{'Importing_LON-CAPA_Resource'} |
|
</span> |
|
<br /> |
|
<input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" /> |
|
<hr /> |
|
<p> |
|
$lt{'copm'}<br /> |
|
<input type="text" size="40" name="importmap" /><br /> |
|
<span class="LC_nobreak"><input type="button" |
|
onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')" |
|
value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" /> |
|
$help{'Load_Map'}</span> |
|
</p> |
|
</form> |
|
SEDFFORM |
|
|
|
my $extresourcesform=(<<ERFORM); |
|
<form action="/adm/coursedocs" method="post" name="newext"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newext" type="button" onClick="javascript:makenewext('newext');" |
|
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
|
</span> |
|
</form> |
|
ERFORM |
|
|
if ($allowed) { |
if ($allowed) { |
&update_paste_buffer($coursenum,$coursedom); |
&update_paste_buffer($coursenum,$coursedom); |
my $dumpbut=&dumpbutton(); |
|
my $exportbut=&exportbutton(); |
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'vc' => 'Verify Content', |
'vc' => 'Verify Content', |
'cv' => 'Check/Set Resource Versions', |
'cv' => 'Check/Set Resource Versions', |
Line 2834 sub handler {
|
Line 2873 sub handler {
|
$uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
$uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
} |
} |
|
|
$r->print(<<ENDCOURSEVERIFY); |
$r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env)); |
<form name="renameform" method="post" action="/adm/coursedocs"> |
} |
<input type="hidden" name="title" /> |
# --------------------------------------------------------- Main tab structure |
<input type="hidden" name="cmd" /> |
my $activeClass = 1; |
<input type="hidden" name="markcopy" /> |
$r->print('<div class="LC_ContentBoxSpecial"><ul class="LC_TabContent" id="mainnav">'); |
<input type="hidden" name="copyfolder" /> |
if (($standard) && ($allowed) && (!$forcesupplement)) { |
$containertag |
my $active = ''; |
</form> |
if($activeClass == 1){ |
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
$active = 'class="active"'; |
<input type="hidden" name="importdetail" value="" /> |
$activeClass = 0; |
$uploadtag |
} |
</form> |
$r->print('<li '.$active.'onclick="javascript:showPage(this,\'Main Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>'); |
<form action="/adm/coursedocs" method="post" name="courseverify"> |
} |
<div class="LC_docs_course_commands"> |
if (!$forcestandard) { |
|
my $active = ''; |
<div> |
if($activeClass == 1){ |
<input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'} |
$active = 'class="active"'; |
</div> |
} |
<div> |
$r->print('<li '.$active.'onclick="javascript:showPage(this,\'Supplemental Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>'); |
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'} |
|
</div> |
|
$dumpbut |
|
$exportbut |
|
<div> |
|
<input type="submit" name="listsymbs" value="$lt{'ls'}" /> |
|
</div> |
|
<div> |
|
<input type="hidden" name="folder" value="$env{'form.folder'}" /> |
|
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
|
</div> |
|
</div> |
|
</form> |
|
<div style="clear: both; height: 0px;"> </div> |
|
ENDCOURSEVERIFY |
|
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', |
|
&mt('Editing the Table of Contents for your '.$type))); |
|
} |
} |
|
$r->print('</ul><div id="maincoursedoc" style="margin:0 0;padding:0 0;">'); |
# --------------------------------------------------------- Standard documents |
# --------------------------------------------------------- Standard documents |
$r->print('<table class="LC_docs_documents">'); |
|
|
|
if (($standard) && ($allowed) && (!$forcesupplement)) { |
if (($standard) && ($allowed) && (!$forcesupplement)) { |
$r->print('<tr><td class="LC_docs_document">'); |
my $active = 'style="display: none;"'; |
# '<h2>'.&mt('Main Course Documents'). |
if($activeClass == 0){ |
# ($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>'); |
$active = 'style="display: block;"'; |
|
} |
|
$r->print('<div class="LC_ContentBox" id="Main Course Documents" '.$active.'>'); |
|
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc', |
|
&mt('Editing the Table of Contents for your '.$type))); |
my $folder=$env{'form.folder'}; |
my $folder=$env{'form.folder'}; |
if ($folder eq '' || $folder eq 'supplemental') { |
if ($folder eq '' || $folder eq 'supplemental') { |
$folder='default'; |
$folder='default'; |
Line 2892 ENDCOURSEVERIFY
|
Line 2917 ENDCOURSEVERIFY
|
#$postexec='self.close();'; |
#$postexec='self.close();'; |
} |
} |
$hadchanges=0; |
$hadchanges=0; |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed, |
|
$upload_output,$type); |
|
if ($error) { |
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
|
} |
|
if ($hadchanges) { |
if ($hadchanges) { |
&mark_hash_old() |
&mark_hash_old(); |
} |
} |
&changewarning($r,$postexec); |
&changewarning($r,$postexec); |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
Line 2910 ENDCOURSEVERIFY
|
Line 2930 ENDCOURSEVERIFY
|
$container='page'; |
$container='page'; |
} |
} |
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
$r->print(<<ENDFORM); |
|
<table class="LC_docs_adddocs"> |
|
<tr> |
|
<th>$lt{'uplm'}</th> |
my $recoverform=(<<RFORM); |
<th>$lt{'impp'}</th> |
<form action="/adm/groupsort" method="post" name="recover"> |
<th>$lt{'spec'}</th> |
<input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" /> |
</tr> |
</form> |
<tr> |
RFORM |
<td> |
|
$lt{'file'}:<br /> |
my $imspform=(<<IMSPFORM); |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<form action="/adm/imsimportdocs" method="post" name="ims"> |
<input type="file" name="uploaddoc" size="40" /> |
<input type="hidden" name="folder" value="$folder" /> |
<br /> |
<input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" /> |
$lt{'title'}:<br /> |
</form> |
<input type="text" size="50" name="comment" /> |
IMSPFORM |
$uploadtag |
|
<input type="hidden" name="cmd" value="upload_default" /> |
my $newnavform=(<<NNFORM); |
<br /> |
<form action="/adm/coursedocs" method="post" name="newnav"> |
<span class="LC_nobreak"> |
$uploadtag |
<label>$lt{'parse'}? |
<input type="hidden" name="importdetail" |
<input type="checkbox" name="parserflag" checked="checked" /> |
value="$lt{'navc'}=/adm/navmaps" /> |
</label> |
<span class="LC_nobreak"> |
</span> |
<input name="newnav" type="submit" value="$lt{'navc'}" /> |
<br /> |
$help{'Navigate_Content'} |
<br /> |
</span> |
<span class="LC_nobreak"> |
</form> |
<input type="submit" value="$lt{'upld'}" /> |
NNFORM |
$help{'Uploading_From_Harddrive'} |
my $newsmppageform=(<<NSPFORM); |
</span> |
<form action="/adm/coursedocs" method="post" name="newsmppg"> |
</form> |
$uploadtag |
</td> |
<input type="hidden" name="importdetail" value="" /> |
<td> |
<span class="LC_nobreak"> |
<form action="/adm/coursedocs" method="post" name="simpleeditdefault"> |
<input name="newsmppg" type="button" value="$lt{'sipa'}" |
$lt{'pubd'}<br /> |
onClick="javascript:makesmppage();" /> $help{'Simple Page'} |
$uploadtag |
</span> |
<input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" /> |
</form> |
<br /> |
NSPFORM |
<span class="LC_nobreak"> |
|
<input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" /> |
my $newsmpproblemform=(<<NSPROBFORM); |
$help{'Importing_LON-CAPA_Resource'} |
<form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
</span> |
$uploadtag |
<br /> |
<input type="hidden" name="importdetail" value="" /> |
<input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" /> |
<span class="LC_nobreak"> |
<hr /> |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
<p> |
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
$lt{'copm'}<br /> |
</span> |
<input type="text" size="40" name="importmap" /><br /> |
</form> |
<span class="LC_nobreak"><input type="button" |
|
onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')" |
NSPROBFORM |
value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" /> |
|
$help{'Load_Map'}</span> |
my $newdropboxform=(<<NDBFORM); |
</p> |
<form action="/adm/coursedocs" method="post" name="newdropbox"> |
</form> |
$uploadtag |
<hr /> |
<input type="hidden" name="importdetail" value="" /> |
<form action="/adm/groupsort" method="post" name="recover"> |
<span class="LC_nobreak"> |
<input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" /> |
<input name="newdropbox" type="button" value="$lt{'drbx'}" |
</form> |
onClick="javascript:makedropbox();" /> |
ENDFORM |
</span> |
unless ($env{'form.pagepath'}) { |
</form> |
$r->print(<<ENDFORM); |
NDBFORM |
<hr /> |
|
<form action="/adm/coursedocs" method="post" name="newext"> |
my $newexuploadform=(<<NEXUFORM); |
$uploadtag |
<form action="/adm/coursedocs" method="post" name="newexamupload"> |
<input type="hidden" name="importdetail" value="" /> |
$uploadtag |
<span class="LC_nobreak"> |
<input type="hidden" name="importdetail" value="" /> |
<input name="newext" type="button" onClick="javascript:makenewext('newext');" |
<span class="LC_nobreak"> |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
</span> |
onClick="javascript:makeexamupload();" /> |
</form> |
$help{'Score_Upload_Form'} |
<br /><form action="/adm/imsimportdocs" method="post" name="ims"> |
</span> |
<input type="hidden" name="folder" value="$folder" /> |
</form> |
<input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" /> |
NEXUFORM |
</form> |
|
ENDFORM |
my $newbulform=(<<NBFORM); |
} |
<form action="/adm/coursedocs" method="post" name="newbul"> |
$r->print('</td><td>'); |
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newbulletin" type="button" value="$lt{'bull'}" |
|
onClick="javascript:makebulboard();" /> |
|
$help{'Bulletin Board'} |
|
</span> |
|
</form> |
|
NBFORM |
|
|
|
my $newaboutmeform=(<<NAMFORM); |
|
<form action="/adm/coursedocs" method="post" name="newaboutme"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="$plainname=/adm/$udom/$uname/aboutme" /> |
|
<span class="LC_nobreak"> |
|
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
|
$help{'My Personal Info'} |
|
</span> |
|
</form> |
|
NAMFORM |
|
|
|
my $newaboutsomeoneform=(<<NASOFORM); |
|
<form action="/adm/coursedocs" method="post" name="newaboutsomeone"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
|
onClick="javascript:makeabout();" /> |
|
</span> |
|
</form> |
|
NASOFORM |
|
|
|
|
|
my $newrosterform=(<<NROSTFORM); |
|
<form action="/adm/coursedocs" method="post" name="newroster"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="$lt{'rost'}=/adm/viewclasslist" /> |
|
<span class="LC_nobreak"> |
|
<input name="newroster" type="submit" value="$lt{'rost'}" /> |
|
$help{'Course Roster'} |
|
</span> |
|
</form> |
|
NROSTFORM |
|
|
unless ($env{'form.pagepath'}) { |
unless ($env{'form.pagepath'}) { |
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
$r->print(<<ENDFORM); |
|
<br /><form action="/adm/coursedocs" method="post" name="newfolder"> |
my $newpageform=(<<NPFORM); |
<input type="hidden" name="folderpath" value="$path" /> |
<form action="/adm/coursedocs" method="post" name="newpage"> |
<input type="hidden" name="importdetail" value="" /> |
<input type="hidden" name="folderpath" value="$path" /> |
<span class="LC_nobreak"> |
<input type="hidden" name="importdetail" value="" /> |
<input name="newfolder" type="button" |
<span class="LC_nobreak"> |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
<input name="newpage" type="button" |
value="$lt{'newf'}" />$help{'Adding_Folders'} |
onClick="javascript:makenewpage(this.form,'$pageseq');" |
</span> |
value="$lt{'newp'}" />$help{'Adding_Pages'} |
</form> |
</span> |
<br /><form action="/adm/coursedocs" method="post" name="newpage"> |
</form> |
<input type="hidden" name="folderpath" value="$path" /> |
NPFORM |
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
my $newfolderform=(<<NFFORM); |
<input name="newpage" type="button" |
<form action="/adm/coursedocs" method="post" name="newfolder"> |
onClick="javascript:makenewpage(this.form,'$pageseq');" |
<input type="hidden" name="folderpath" value="$path" /> |
value="$lt{'newp'}" />$help{'Adding_Pages'} |
<input type="hidden" name="importdetail" value="" /> |
</span> |
<span class="LC_nobreak"> |
</form> |
<input name="newfolder" type="button" |
<br /><form action="/adm/coursedocs" method="post" name="newsyl"> |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
$uploadtag |
value="$lt{'newf'}" />$help{'Adding_Folders'} |
<input type="hidden" name="importdetail" |
</span> |
value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" /> |
</form> |
<span class="LC_nobreak"> |
NFFORM |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
|
$help{'Syllabus'} |
my $newsylform=(<<NSYLFORM); |
</span> |
<form action="/adm/coursedocs" method="post" name="newsyl"> |
</form> |
$uploadtag |
<br /><form action="/adm/coursedocs" method="post" name="newnav"> |
<input type="hidden" name="importdetail" |
$uploadtag |
value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" /> |
<input type="hidden" name="importdetail" |
<span class="LC_nobreak"> |
value="$lt{'navc'}=/adm/navmaps" /> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
<span class="LC_nobreak"> |
$help{'Syllabus'} |
<input name="newnav" type="submit" value="$lt{'navc'}" /> |
</span> |
$help{'Navigate_Content'} |
</form> |
</span> |
NSYLFORM |
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newsmppg"> |
my $newgroupfileform=(<<NGFFORM); |
$uploadtag |
<form action="/adm/coursedocs" method="post" name="newgroupfiles"> |
<input type="hidden" name="importdetail" value="" /> |
$uploadtag |
<span class="LC_nobreak"> |
<input type="hidden" name="importdetail" |
<input name="newsmppg" type="button" value="$lt{'sipa'}" |
value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" /> |
onClick="javascript:makesmppage();" /> $help{'Simple Page'} |
<span class="LC_nobreak"> |
</span> |
<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" /> |
</form> |
$help{'Group Files'} |
<br /><form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
</span> |
$uploadtag |
</form> |
<input type="hidden" name="importdetail" value="" /> |
NGFFORM |
<span class="LC_nobreak"> |
|
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
|
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
my $specialdocumentsform=(<<SPDOFORM); |
</span> |
<br />$newfolderform |
</form> |
<br />$newpageform |
<br /><form action="/adm/coursedocs" method="post" name="newdropbox"> |
<br />$newsylform |
$uploadtag |
<br />$newnavform |
<input type="hidden" name="importdetail" value="" /> |
<br />$newsmppageform |
<span class="LC_nobreak"> |
<br />$newsmpproblemform |
<input name="newdropbox" type="button" value="$lt{'drbx'}" |
<br />$newdropboxform |
onClick="javascript:makedropbox();" /> |
<br />$newexuploadform |
</span> |
<br />$newbulform |
</form> |
<br />$newaboutmeform |
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
<br />$newaboutsomeoneform |
$uploadtag |
<br />$newgroupfileform |
<input type="hidden" name="importdetail" value="" /> |
<br />$newrosterform |
<span class="LC_nobreak"> |
SPDOFORM |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
|
onClick="javascript:makeexamupload();" /> |
|
$help{'Score_Upload_Form'} |
my %orderhash = ( |
</span> |
'aa' => 'New Document', |
</form> |
'bb' => 'Published Documents', |
<br /><form action="/adm/coursedocs" method="post" name="newbul"> |
'cc' => 'Special Documents', |
$uploadtag |
'dd' => 'More Options', |
<input type="hidden" name="importdetail" value="" /> |
'zz' => 'Hide all Options', |
<span class="LC_nobreak"> |
); |
<input name="newbulletin" type="button" value="$lt{'bull'}" |
my %namehash = ( |
onClick="javascript:makebulboard();" /> |
'New Document' => $fileuploadform, |
$help{'Bulletin Board'} |
'Published Documents' => $simpleeditdefaultform, |
</span> |
'Special Documents' => $specialdocumentsform, |
</form> |
'More Options' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform, |
<br /><form action="/adm/coursedocs" method="post" name="newaboutme"> |
); |
$uploadtag |
my $tid='1'; |
<input type="hidden" name="importdetail" |
my $content='content'; |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
my $navigation='navigation'; |
<span class="LC_nobreak"> |
my $varcd = 'Main Course Documents'; |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
$r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash)); |
$help{'My Personal Info'} |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); |
</span> |
if ($error) { |
</form> |
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
<br /><form action="/adm/coursedocs" method="post" name="newaboutsomeone"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
|
onClick="javascript:makeabout();" /> |
|
</span> |
|
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newgroupfiles"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" /> |
|
<span class="LC_nobreak"> |
|
<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" /> |
|
$help{'Group Files'} |
|
</span> |
|
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newroster"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="$lt{'rost'}=/adm/viewclasslist" /> |
|
<span class="LC_nobreak"> |
|
<input name="newroster" type="submit" value="$lt{'rost'}" /> |
|
$help{'Course Roster'} |
|
</span> |
|
</form> |
|
ENDFORM |
|
} |
} |
|
$r->print('</div>'); |
|
} |
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
$r->print(<<ENDBLOCK); |
|
<form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
|
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
|
</span> |
|
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" value="" /> |
|
<span class="LC_nobreak"> |
|
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
|
onClick="javascript:makeexamupload();" /> |
|
$help{'Score_Upload_Form'} |
|
</span> |
|
</form> |
|
ENDBLOCK |
|
} |
} |
$r->print('</td></tr>'."\n". |
|
'</table>'); |
|
$r->print('</td></tr>'); |
|
} |
} |
# ----------------------------------------------------- Supplemental documents |
# ----------------------------------------------------- Supplemental documents |
if (!$forcestandard) { |
if (!$forcestandard) { |
$r->print('<tr><td class="LC_docs_document">'); |
my $active = 'style="display: none;"'; |
# '<h2>'.&mt('Supplemental Course Documents'). |
if($activeClass == 1){ |
# ($allowed?' '.$help{'Supplemental'}:'').'</h2>'); |
$active = 'style="display: block;"'; |
|
} |
|
$r->print('<div class="LC_ContentBox" id="Supplemental Course Documents" '.$active.'>'); |
my $folder=$env{'form.folder'}; |
my $folder=$env{'form.folder'}; |
unless ($folder=~/^supplemental/) { |
unless ($folder=~/^supplemental/) { |
$folder='supplemental'; |
$folder='supplemental'; |
Line 3143 ENDBLOCK
|
Line 3163 ENDBLOCK
|
$env{'form.folderpath'} = 'supplemental&'. |
$env{'form.folderpath'} = 'supplemental&'. |
&escape(&mt('Supplemental '.$type.' Documents')); |
&escape(&mt('Supplemental '.$type.' Documents')); |
} |
} |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); |
|
if ($error) { |
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
|
} |
|
if ($allowed) { |
if ($allowed) { |
my $folderseq= |
my $folderseq= |
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. |
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. |
'.sequence'; |
'.sequence'; |
|
|
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
$r->print(<<ENDSUPFORM); |
|
<table class="LC_docs_adddocs"><tr> |
my $supupdocform=(<<SUPDOCFORM); |
<th>$lt{'upls'}</th> |
<form action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<th>$lt{'spec'}</th> |
$fileupload |
</tr> |
<br /> |
<tr><td> |
<br /> |
<form action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
<span class="LC_nobreak"> |
<input type="file" name="uploaddoc" size="40" /> |
$checkbox |
<br /> |
</span> |
<br /> |
<br /><br /> |
<span class="LC_nobreak"> |
$lt{'comment'}:<br /> |
<label>$lt{'parse'}? |
<textarea cols=50 rows=4 name='comment'> |
<input type="checkbox" name="parserflag" /> |
</textarea> |
</label> |
<br /> |
</span> |
<input type="hidden" name="folderpath" value="$path" /> |
<br /><br /> |
<input type="hidden" name="cmd" value="upload_supplemental" /> |
$lt{'comment'}:<br /> |
<span class="LC_nobreak"> |
<textarea cols=50 rows=4 name='comment'> |
<input type="submit" value="$lt{'upld'}" /> |
</textarea> |
$help{'Uploading_From_Harddrive'} |
<br /> |
</span> |
<input type="hidden" name="folderpath" value="$path" /> |
</form> |
<input type="hidden" name="cmd" value="upload_supplemental" /> |
SUPDOCFORM |
<span class="LC_nobreak"> |
|
<input type="submit" value="$lt{'upld'}" /> |
my $supnewfolderform=(<<SNFFORM); |
$help{'Uploading_From_Harddrive'} |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
</span> |
<input type="hidden" name="folderpath" value="$path" /> |
</form> |
<input type="hidden" name="importdetail" value="" /> |
</td> |
<span class="LC_nobreak"> |
<td> |
<input name="newfolder" type="button" |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
<input type="hidden" name="folderpath" value="$path" /> |
value="$lt{'newf'}" /> $help{'Adding_Folders'} |
<input type="hidden" name="importdetail" value="" /> |
</span> |
<span class="LC_nobreak"> |
</form> |
<input name="newfolder" type="button" |
SNFFORM |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
|
value="$lt{'newf'}" /> $help{'Adding_Folders'} |
|
</span> |
my $supnewextform=(<<SNEFORM); |
</form> |
<form action="/adm/coursedocs" method="post" name="supnewext"> |
<br /><form action="/adm/coursedocs" method="post" name="supnewext"> |
<input type="hidden" name="folderpath" value="$path" /> |
<input type="hidden" name="folderpath" value="$path" /> |
<input type="hidden" name="importdetail" value="" /> |
<input type="hidden" name="importdetail" value="" /> |
<span class="LC_nobreak"> |
<span class="LC_nobreak"> |
<input name="newext" type="button" |
<input name="newext" type="button" |
onClick="javascript:makenewext('supnewext');" |
onClick="javascript:makenewext('supnewext');" |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
</span> |
</span> |
</form> |
</form> |
SNEFORM |
<br /><form action="/adm/coursedocs" method="post" name="supnewsyl"> |
|
<input type="hidden" name="folderpath" value="$path" /> |
my $supnewsylform=(<<SNSFORM); |
<input type="hidden" name="importdetail" |
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
<input type="hidden" name="folderpath" value="$path" /> |
<span class="LC_nobreak"> |
<input type="hidden" name="importdetail" |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
$help{'Syllabus'} |
<span class="LC_nobreak"> |
</span> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
</form> |
$help{'Syllabus'} |
<br /><form action="/adm/coursedocs" method="post" name="subnewaboutme"> |
</span> |
<input type="hidden" name="folderpath" value="$path" /> |
</form> |
<input type="hidden" name="importdetail" |
SNSFORM |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
|
<span class="LC_nobreak"> |
my $supnewaboutmeform=(<<SNAMFORM); |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
<form action="/adm/coursedocs" method="post" name="subnewaboutme"> |
$help{'My Personal Info'} |
<input type="hidden" name="folderpath" value="$path" /> |
</span> |
<input type="hidden" name="importdetail" |
</form> |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
</td></tr> |
<span class="LC_nobreak"> |
</table></td></tr> |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
ENDSUPFORM |
$help{'My Personal Info'} |
|
</span> |
|
</form> |
|
SNAMFORM |
|
|
|
|
|
|
|
my %suporderhash = ( |
|
'ee' => 'New Document', |
|
'ff' => 'Special Documents', |
|
'zz' => 'Hide all Options', |
|
); |
|
|
|
my %supnamehash = ( |
|
'New Document' => $supupdocform, |
|
'Special Documents' => $supnewfolderform.'<br />'.$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform, |
|
); |
|
|
|
my $tid='2'; |
|
my $content='content'; |
|
my $navigation='navigation'; |
|
my $varscd = 'Supplemental Course Documents'; |
|
|
|
$r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%suporderhash)); |
|
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type); |
|
if ($error) { |
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
} |
} |
} |
$r->print('</div)'); |
$r->print('</table>'); |
} |
|
} |
|
$r->print('</div>'); |
if ($allowed) { |
if ($allowed) { |
$r->print(' |
$r->print(' |
<form method="post" name="extimport" action="/adm/coursedocs"> |
<form method="post" name="extimport" action="/adm/coursedocs"> |
Line 3247 ENDSUPFORM
|
Line 3291 ENDSUPFORM
|
return OK; |
return OK; |
} |
} |
|
|
|
sub generate_admin_options { |
|
my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_; |
|
my %lt = %{$lt_ref}; |
|
my %help = %{$help_ref}; |
|
my %env = %{$env_ref}; |
|
my $dumpbut=&dumpbutton(); |
|
my $exportbut=&exportbutton(); |
|
return (<<ENDOPTIONFORM); |
|
<form name="renameform" method="post" action="/adm/coursedocs"> |
|
<input type="hidden" name="title" /> |
|
<input type="hidden" name="cmd" /> |
|
<input type="hidden" name="markcopy" /> |
|
<input type="hidden" name="copyfolder" /> |
|
$containertag |
|
</form> |
|
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
|
<input type="hidden" name="importdetail" value="" /> |
|
$uploadtag |
|
</form> |
|
<form action="/adm/coursedocs" method="post" name="courseverify"> |
|
<ul style="list-style-type:none"> |
|
<li> |
|
<input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'} |
|
</li> |
|
<li> |
|
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'} |
|
</li> |
|
<li> |
|
$dumpbut |
|
</li> |
|
<li> |
|
$exportbut |
|
</li> |
|
<li> |
|
<input type="submit" name="listsymbs" value="$lt{'ls'}" /> |
|
</li> |
|
<li> |
|
<input type="hidden" name="folder" value="$env{'form.folder'}" /> |
|
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
|
</li> |
|
</ul> |
|
</form> |
|
<div style="clear: both; height: 0px;"> </div> |
|
ENDOPTIONFORM |
|
|
|
} |
|
|
|
|
|
sub generate_edit_table { |
|
my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_; |
|
my %namehash = %{$namehash_ref}; #name verlinkt mit id |
|
my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name |
|
my $form; |
|
|
|
|
|
|
|
$form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt($varcd).'</h4>'; |
|
$form .= '<ul id="'.$navigation.$tid.'" class="LC_TabContent">'; |
|
foreach my $name (sort(keys(%orderhash))){ |
|
if($name eq 'zz'){ |
|
$form .= '<li onclick="javascript:hideAll(this, \''.$navigation.$tid.'\' ,\''.$content.$tid.'\');" class="active">'.&mt($orderhash{$name}).'</li>'; |
|
}else{ |
|
$form .= '<li onclick="javascript:showPage(this, \''.$tid.$orderhash{$name}.'\', \''.$navigation.$tid.'\',\''.$content.$tid.'\');">'.&mt($orderhash{$name}).'</li>'; |
|
} |
|
} |
|
$form .= '<div id="'.$content.$tid.'" style="padding: 0 0; margin: 0 0;">'; |
|
foreach my $field (keys(%namehash)){ |
|
$form .= '<div id="'.$tid.$field.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>'; |
|
} |
|
$form .= '</div></div>'; |
|
|
|
return $form; |
|
} |
|
|
sub editing_js { |
sub editing_js { |
my ($udom,$uname) = @_; |
my ($udom,$uname) = @_; |
Line 3362 function makeabout() {
|
Line 3479 function makeabout() {
|
if ((comp[0]) && (comp[1])) { |
if ((comp[0]) && (comp[1])) { |
this.document.forms.newaboutsomeone.importdetail.value= |
this.document.forms.newaboutsomeone.importdetail.value= |
'$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme'; |
'$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme'; |
this.document.forms.newaboutsomeone.submit(); |
this.document.forms.newaboutsomeone.submit(); |
} else { |
} else { |
alert("$lt{'p_mab_alrt1'}"); |
alert("$lt{'p_mab_alrt1'}"); |
} |
|
} else { |
|
alert("$lt{'p_mab_alrt2'}"); |
|
} |
|
} |
} |
|
} else { |
|
alert("$lt{'p_mab_alrt2'}"); |
|
} |
|
} |
} |
} |
|
|
function makeims() { |
function makeims() { |
var caller = document.forms.ims.folder.value; |
var caller = document.forms.ims.folder.value; |
var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; |
var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; |
newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); |
newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); |
newWindow.location.href = newlocation; |
newWindow.location.href = newlocation; |
} |
} |
|
|
|
|
function finishpick() { |
function finishpick() { |
var title=this.document.forms.extimport.title.value; |
var title=this.document.forms.extimport.title.value; |
var url=this.document.forms.extimport.url.value; |
var url=this.document.forms.extimport.url.value; |
var form=this.document.forms.extimport.useform.value; |
var form=this.document.forms.extimport.useform.value; |
var residx=this.document.forms.extimport.residx.value; |
var residx=this.document.forms.extimport.residx.value; |
eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); |
eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); |
} |
} |
|
|
function changename(folderpath,index,oldtitle,container,pagesymb) { |
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') { |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
} |
if (container == 'page') { |
if (container == 'page') { |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagesymb.value=pagesymb; |
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,container,pagesymb,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') { |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
} |
if (container == 'page') { |
if (container == 'page') { |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagesymb.value=pagesymb; |
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,pagesymb,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') { |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
} |
if (container == 'page') { |
if (container == 'page') { |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagesymb.value=pagesymb; |
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,pagesymb,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') { |
if (container == 'sequence') { |
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath; |
} |
} |
if (container == 'page') { |
if (container == 'page') { |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.pagesymb.value=pagesymb; |
this.document.forms.renameform.pagesymb.value=pagesymb; |
} |
} |
this.document.forms.renameform.submit(); |
this.document.forms.renameform.submit(); |
|
} |
|
|
|
function unselectInactive(nav) { |
|
currentNav = document.getElementById(nav); |
|
currentLis = currentNav.getElementsByTagName('LI'); |
|
for (i = 0; i < currentLis.length; i++) { |
|
currentLis[i].className = 'i'; |
|
} |
|
} |
|
|
|
function hideAll(current, nav, data) { |
|
unselectInactive(nav); |
|
current.className = 'active'; |
|
currentData = document.getElementById(data); |
|
currentDivs = currentData.getElementsByTagName('DIV'); |
|
for (i = 0; i < currentDivs.length; i++) { |
|
if(currentDivs[i].className == 'LC_ContentBox'){ |
|
currentDivs[i].style.display = 'none'; |
|
} |
|
} |
|
} |
|
|
|
function showPage(current, pageId, nav, data) { |
|
hideAll(current, nav, data); |
|
unselectInactive(nav); |
|
current.className = 'active'; |
|
currentData = document.getElementById(pageId); |
|
currentData.style.display = 'block'; |
|
return false; |
} |
} |
|
|
ENDNEWSCRIPT |
ENDNEWSCRIPT |
Line 3454 ENDNEWSCRIPT
|
Line 3600 ENDNEWSCRIPT
|
1; |
1; |
__END__ |
__END__ |
|
|
=pod |
|
|
=head1 NAME |
|
|
|
Apache::londocs.pm |
|
|
|
=head1 SYNOPSIS |
|
|
|
This is part of the LearningOnline Network with CAPA project |
|
described at http://www.lon-capa.org. |
|
|
|
=head1 SUBROUTINES |
|
|
|
=over |
|
|
|
=item %help=() |
|
|
|
Available help topics |
|
|
|
=item mapread() |
|
|
|
Mapread read maps into LONCAPA::map:: global arrays |
|
@order and @resources, determines status |
|
sets @order - pointer to resources in right order |
|
sets @resources - array with the resources with correct idx |
|
|
|
=item authorhosts() |
|
|
|
Return hash with valid author names |
|
|
|
=item dumpbutton() |
|
|
|
Generate "dump" button |
|
|
|
=item clean() |
|
|
|
=item dumpcourse() |
|
|
|
Actually dump course |
|
|
|
|
|
=item exportbutton() |
|
|
|
Generate "export" button |
|
|
|
=item exportcourse() |
|
|
|
=item create_ims_store() |
|
|
|
=item build_package() |
|
|
|
=item get_dependencies() |
|
|
|
=item process_content() |
|
|
|
=item replicate_content() |
|
|
|
=item extract_media() |
|
|
|
=item store_template() |
|
|
|
=item group_import() |
|
|
|
Imports the given (name, url) resources into the course |
|
coursenum, coursedom, and folder must precede the list |
|
|
|
=item breadcrumbs() |
|
|
|
=item log_docs() |
|
|
|
=item docs_change_log() |
|
|
|
=item update_paste_buffer() |
|
|
|
=item print_paste_buffer() |
|
|
|
=item do_paste_from_buffer() |
|
|
|
=item update_parameter() |
|
|
|
=item handle_edit_cmd() |
|
|
|
=item editor() |
|
|
|
=item process_file_upload() |
|
|
|
=item process_secondary_uploads() |
|
|
|
=item is_supplemental_title() |
|
|
|
=item parse_supplemental_title() |
|
|
|
=item entryline() |
|
|
|
=item tiehash() |
|
|
|
=item untiehash() |
|
|
|
=item checkonthis() |
|
|
|
check on this |
|
|
|
=item verifycontent() |
|
|
|
Verify Content |
|
|
|
=item devalidateversioncache() & checkversions() |
|
|
|
Check Versions |
|
|
|
=item mark_hash_old() |
|
|
|
=item is_hash_old() |
|
|
|
=item changewarning() |
|
|
|
=item init_breadcrumbs() |
|
|
|
Breadcrumbs for special functions |
|
|
=back |
=back |
|
|