version 1.328, 2009/01/28 13:24:54
|
version 1.484.2.1, 2012/05/07 02:19:44
|
Line 1
|
Line 1
|
# The LearningOnline Network
|
# The LearningOnline Network |
# Documents
|
# Documents |
#
|
# |
# $Id$
|
# $Id$ |
#
|
# |
# Copyright Michigan State University Board of Trustees
|
# Copyright Michigan State University Board of Trustees |
#
|
# |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
|
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
#
|
# |
# LON-CAPA is free software; you can redistribute it and/or modify
|
# LON-CAPA is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or |
# (at your option) any later version.
|
# (at your option) any later version. |
#
|
# |
# LON-CAPA is distributed in the hope that it will be useful,
|
# LON-CAPA is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details.
|
# GNU General Public License for more details. |
#
|
# |
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License |
# along with LON-CAPA; if not, write to the Free Software
|
# along with LON-CAPA; if not, write to the Free Software |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
#
|
# |
# /home/httpd/html/adm/gpl.txt
|
# /home/httpd/html/adm/gpl.txt |
#
|
# |
# http://www.lon-capa.org/
|
# http://www.lon-capa.org/ |
#
|
# |
|
|
|
package Apache::londocs; |
|
|
package Apache::londocs;
|
use strict; |
|
use Apache::Constants qw(:common :http); |
use strict;
|
use Apache::imsexport; |
use Apache::Constants qw(:common :http);
|
use Apache::lonnet; |
use Apache::imsexport;
|
use Apache::loncommon; |
use Apache::lonnet;
|
use Apache::lonhtmlcommon; |
use Apache::loncommon;
|
use LONCAPA::map(); |
use LONCAPA::map();
|
use Apache::lonratedt(); |
use Apache::lonratedt();
|
use Apache::lonxml; |
use Apache::lonxml;
|
use Apache::lonclonecourse; |
use Apache::lonclonecourse;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps;
|
use Apache::lonnavdisplay(); |
use HTML::Entities;
|
use HTML::Entities; |
use GDBM_File;
|
use GDBM_File; |
use Apache::lonlocal;
|
use Apache::lonlocal; |
use Cwd;
|
use Cwd; |
use LONCAPA qw(:DEFAULT :match);
|
use LONCAPA qw(:DEFAULT :match); |
|
|
my $iconpath;
|
my $iconpath; |
|
|
my %hash;
|
my %hash; |
|
|
my $hashtied;
|
my $hashtied; |
my %alreadyseen=();
|
my %alreadyseen=(); |
|
|
my $hadchanges;
|
my $hadchanges; |
|
|
|
|
my %help=();
|
my %help=(); |
|
|
|
|
sub mapread {
|
sub mapread { |
my ($coursenum,$coursedom,$map)=@_;
|
my ($coursenum,$coursedom,$map)=@_; |
return
|
return |
&LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
|
&LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
$map);
|
$map); |
}
|
} |
|
|
sub storemap {
|
sub storemap { |
my ($coursenum,$coursedom,$map)=@_;
|
my ($coursenum,$coursedom,$map)=@_; |
my ($outtext,$errtext)=
|
my ($outtext,$errtext)= |
&LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
|
&LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
$map,1);
|
$map,1); |
if ($errtext) { return ($errtext,2); }
|
if ($errtext) { return ($errtext,2); } |
|
|
$hadchanges=1;
|
$hadchanges=1; |
return ($errtext,0);
|
return ($errtext,0); |
}
|
} |
|
|
|
|
|
|
sub authorhosts {
|
sub authorhosts { |
my %outhash=();
|
my %outhash=(); |
my $home=0;
|
my $home=0; |
my $other=0;
|
my $other=0; |
foreach my $key (keys(%env)) {
|
foreach my $key (keys(%env)) { |
if ($key=~/^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{$key});
|
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,$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'}; |
} else {
|
} else { |
($cd,$ca)=($realm=~/^\/($match_domain)\/($match_username)$/);
|
($cd,$ca)=($realm=~/^\/($match_domain)\/($match_username)$/); |
}
|
} |
my $allowed=0;
|
my $allowed=0; |
my $myhome=&Apache::lonnet::homeserver($ca,$cd);
|
my $myhome=&Apache::lonnet::homeserver($ca,$cd); |
my @ids=&Apache::lonnet::current_machine_ids();
|
my @ids=&Apache::lonnet::current_machine_ids(); |
foreach my $id (@ids) { if ($id eq $myhome) { $allowed=1; } }
|
foreach my $id (@ids) { |
if ($allowed) {
|
if ($id eq $myhome) { |
$home++;
|
$allowed=1; |
$outhash{'home_'.$ca.'@'.$cd}=1;
|
last; |
} else {
|
} |
$outhash{'otherhome_'.$ca.'@'.$cd}=$myhome;
|
} |
$other++;
|
if ($allowed) { |
}
|
$home++; |
}
|
$outhash{'home_'.$ca.':'.$cd}=1; |
}
|
} else { |
return ($home,$other,%outhash);
|
$outhash{'otherhome_'.$ca.':'.$cd}=$myhome; |
}
|
$other++; |
|
} |
|
} |
sub dumpbutton {
|
} |
my ($home,$other,%outhash)=&authorhosts();
|
return ($home,$other,%outhash); |
my $type = &Apache::loncommon::course_type();
|
} |
if ($home+$other==0) { return ''; }
|
|
if ($home) {
|
|
return '<input type="submit" name="dumpcourse" value="'.
|
sub clean { |
&mt('Dump '.$type.' DOCS to Construction Space').'" />'.
|
my ($title)=@_; |
&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
|
$title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs; |
} else {
|
return $title; |
return '<div>'.
|
} |
&mt('Dump '.$type.
|
|
' DOCS to Construction Space: available on other servers').
|
|
'</div>';
|
|
}
|
sub dumpcourse { |
}
|
my ($r) = @_; |
|
my $crstype = &Apache::loncommon::course_type(); |
sub clean {
|
$r->print(&Apache::loncommon::start_page('Dump '.$crstype.' Content to Authoring Space')."\n". |
my ($title)=@_;
|
&Apache::lonhtmlcommon::breadcrumbs('Dump '.$crstype.' Content to Authoring Space')."\n"); |
$title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
|
$r->print(&startContentScreen('tools')); |
return $title;
|
my ($home,$other,%outhash)=&authorhosts(); |
}
|
unless ($home) { |
|
$r->print(&endContentScreen()); |
|
return ''; |
|
} |
sub dumpcourse {
|
my $origcrsid=$env{'request.course.id'}; |
my ($r) = @_;
|
my %origcrsdata=&Apache::lonnet::coursedescription($origcrsid); |
my $type = &Apache::loncommon::course_type();
|
if (($env{'form.authorspace'}) && ($env{'form.authorfolder'}=~/\w/)) { |
$r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
|
# Do the dumping |
'<form name="dumpdoc" method="post">');
|
unless ($outhash{'home_'.$env{'form.authorspace'}}) { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));
|
$r->print(&endContentScreen()); |
my ($home,$other,%outhash)=&authorhosts();
|
return ''; |
unless ($home) { return ''; }
|
} |
my $origcrsid=$env{'request.course.id'};
|
my ($ca,$cd)=split(/\@/,$env{'form.authorspace'}); |
my %origcrsdata=&Apache::lonnet::coursedescription($origcrsid);
|
$r->print('<h3>'.&mt('Copying Files').'</h3>'); |
if (($env{'form.authorspace'}) && ($env{'form.authorfolder'}=~/\w/)) {
|
my $title=$env{'form.authorfolder'}; |
# Do the dumping
|
$title=&clean($title); |
unless ($outhash{'home_'.$env{'form.authorspace'}}) { return ''; }
|
my %replacehash=(); |
my ($ca,$cd)=split(/\@/,$env{'form.authorspace'});
|
foreach my $key (keys(%env)) { |
$r->print('<h3>'.&mt('Copying Files').'</h3>');
|
if ($key=~/^form\.namefor\_(.+)/) { |
my $title=$env{'form.authorfolder'};
|
$replacehash{$1}=$env{$key}; |
$title=&clean($title);
|
} |
my %replacehash=();
|
} |
foreach my $key (keys(%env)) {
|
my $crs='/uploaded/'.$env{'request.course.id'}.'/'; |
if ($key=~/^form\.namefor\_(.+)/) {
|
$crs=~s/\_/\//g; |
$replacehash{$1}=$env{$key};
|
foreach my $item (keys(%replacehash)) { |
}
|
my $newfilename=$title.'/'.$replacehash{$item}; |
}
|
$newfilename=~s/\.(\w+)$//; |
my $crs='/uploaded/'.$env{'request.course.id'}.'/';
|
my $ext=$1; |
$crs=~s/\_/\//g;
|
$newfilename=&clean($newfilename); |
foreach my $item (keys(%replacehash)) {
|
$newfilename.='.'.$ext; |
my $newfilename=$title.'/'.$replacehash{$item};
|
my @dirs=split(/\//,$newfilename); |
$newfilename=~s/\.(\w+)$//;
|
my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca"; |
my $ext=$1;
|
my $makepath=$path; |
$newfilename=&clean($newfilename);
|
my $fail=0; |
$newfilename.='.'.$ext;
|
for (my $i=0;$i<$#dirs;$i++) { |
my @dirs=split(/\//,$newfilename);
|
$makepath.='/'.$dirs[$i]; |
my $path='/home/'.$ca.'/public_html';
|
unless (-e $makepath) { |
my $makepath=$path;
|
unless(mkdir($makepath,0777)) { $fail=1; } |
my $fail=0;
|
} |
for (my $i=0;$i<$#dirs;$i++) {
|
} |
$makepath.='/'.$dirs[$i];
|
$r->print('<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: '); |
unless (-e $makepath) {
|
if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) { |
unless(mkdir($makepath,0777)) { $fail=1; }
|
if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) { |
}
|
print $fh &Apache::lonclonecourse::rewritefile( |
}
|
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item), |
$r->print('<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: ');
|
(%replacehash,$crs => '') |
if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) {
|
); |
if ($item=~/\.(sequence|page|html|htm|xml|xhtml)$/) {
|
} else { |
print $fh &Apache::lonclonecourse::rewritefile(
|
print $fh |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item),
|
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item); |
(%replacehash,$crs => '')
|
} |
);
|
$fh->close(); |
} else {
|
} else { |
print $fh
|
$fail=1; |
&Apache::lonclonecourse::readfile($env{'request.course.id'},$item);
|
} |
}
|
if ($fail) { |
$fh->close();
|
$r->print('<span class="LC_error">'.&mt('fail').'</span>'); |
} else {
|
} else { |
$fail=1;
|
$r->print('<span class="LC_success">'.&mt('ok').'</span>'); |
}
|
} |
if ($fail) {
|
} |
$r->print('<span class="LC_error">'.&mt('fail').'</span>');
|
} else { |
} else {
|
$r->print(&mt('Searching ...').'<br />'); |
$r->print('<span class="LC_success">'.&mt('ok').'</span>');
|
$r->rflush(); |
}
|
# Input form |
}
|
$r->print('<form name="dumpdoc" action="" method="post">'."\n"); |
} else {
|
unless ($home==1) { |
# Input form
|
$r->print('<div class="LC_left_float">'. |
unless ($home==1) {
|
'<fieldset><legend>'. |
$r->print(
|
&mt('Select the Authoring Space'). |
'<h3>'.&mt('Select the Construction Space').'</h3><select name="authorspace">');
|
'</legend><select name="authorspace">'); |
}
|
} |
foreach my $key (sort(keys(%outhash))) {
|
foreach my $key (sort(keys(%outhash))) { |
if ($key=~/^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.'" />'); |
} else {
|
} else { |
$r->print('<option value="'.$1.'">'.$1.' - '.
|
$r->print('<option value="'.$1.'">'.$1.' - '. |
&Apache::loncommon::plainname(split(/\@/,$1)).'</option>');
|
&Apache::loncommon::plainname(split(/\:/,$1)).'</option>'); |
}
|
} |
}
|
} |
}
|
} |
unless ($home==1) {
|
unless ($home==1) { |
$r->print('</select>');
|
$r->print('</select></fieldset></div>'."\n"); |
}
|
} |
my $title=$origcrsdata{'description'};
|
my $title=$origcrsdata{'description'}; |
$title=~s/[\/\s]+/\_/gs;
|
$title=~s/[\/\s]+/\_/gs; |
$title=&clean($title);
|
$title=&clean($title); |
$r->print('<h3>'.&mt('Folder in Construction Space').'</h3>'
|
$r->print('<div class="LC_left_float">'. |
.'<input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');
|
'<fieldset><legend>'.&mt('Folder in Authoring Space').'</legend>'. |
&tiehash();
|
'<input type="text" size="50" name="authorfolder" value="'. |
$r->print('<h3>'.&mt('Filenames in Construction Space').'</h3>'
|
$title.'" />'. |
.&Apache::loncommon::start_data_table()
|
'</fieldset></div><br clear="all" />'."\n"); |
.&Apache::loncommon::start_data_table_header_row()
|
&tiehash(); |
.'<th>'.&mt('Internal Filename').'</th>'
|
$r->print('<h4>'.&mt('Filenames in Authoring Space').'</h4>' |
.'<th>'.&mt('Title').'</th>'
|
.&Apache::loncommon::start_data_table() |
.'<th>'.&mt('Save as ...').'</th>'
|
.&Apache::loncommon::start_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row());
|
.'<th>'.&mt('Internal Filename').'</th>' |
foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) {
|
.'<th>'.&mt('Title').'</th>' |
$r->print(&Apache::loncommon::start_data_table_row()
|
.'<th>'.&mt('Save as ...').'</th>' |
.'<td>'.$file.'</td>');
|
.&Apache::loncommon::end_data_table_header_row()); |
my ($ext)=($file=~/\.(\w+)$/);
|
foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) { |
my $title=$hash{'title_'.$hash{
|
$r->print(&Apache::loncommon::start_data_table_row() |
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}};
|
.'<td>'.$file.'</td>'); |
$r->print('<td>'.($title?$title:' ').'</td>');
|
my ($ext)=($file=~/\.(\w+)$/); |
if (!$title) {
|
my $title=$hash{'title_'.$hash{ |
$title=$file;
|
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}}; |
} else {
|
$r->print('<td>'.($title?$title:' ').'</td>'); |
$title=~s|/|_|g;
|
if (!$title) { |
}
|
$title=$file; |
$title=~s/\.(\w+)$//;
|
} else { |
$title=&clean($title);
|
$title=~s|/|_|g; |
$title.='.'.$ext;
|
} |
$r->print("\n<td><input type='text' size='60' name='namefor_".$file."' value='".$title."' /></td>"
|
$title=~s/\.(\w+)$//; |
.&Apache::loncommon::end_data_table_row());
|
$title=&clean($title); |
}
|
$title.='.'.$ext; |
$r->print(&Apache::loncommon::end_data_table());
|
$r->print("\n<td><input type='text' size='60' name='namefor_".$file."' value='".$title."' /></td>" |
&untiehash();
|
.&Apache::loncommon::end_data_table_row()); |
$r->print(
|
} |
'<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $type DOCS").'" /></p></form>');
|
$r->print(&Apache::loncommon::end_data_table()); |
}
|
&untiehash(); |
}
|
$r->print( |
|
'<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $crstype Content").'" /></p></form>'); |
|
} |
|
$r->print(&endContentScreen()); |
sub exportbutton {
|
} |
my $type = &Apache::loncommon::course_type();
|
|
return '<input type="submit" name="exportcourse" value="'.
|
sub group_import { |
&mt('Export '.$type.' to IMS').'" />'.
|
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
|
|
}
|
while (@files) { |
|
my ($name, $url, $residx) = @{ shift(@files) }; |
|
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) |
|
&& ($caller eq 'londocs') |
sub exportcourse {
|
&& (!&Apache::lonnet::stat_file($url))) { |
my $r=shift;
|
|
my $type = &Apache::loncommon::course_type();
|
my $errtext = ''; |
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
|
my $fatal = 0; |
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
|
my $newmapstr = '<map>'."\n". |
my $numdisc = keys(%discussiontime);
|
'<resource id="1" src="" type="start"></resource>'."\n". |
my $navmap = Apache::lonnavmaps::navmap->new();
|
'<link from="1" to="2" index="1"></link>'."\n". |
if (!defined($navmap)) {
|
'<resource id="2" src="" type="finish"></resource>'."\n". |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package').
|
'</map>'; |
'<h2>IMS Export Failed</h2>'.
|
$env{'form.output'}=$newmapstr; |
'<div class="LC_error">'.
|
my $result=&Apache::lonnet::finishuserfileupload($coursenum,$coursedom, |
&mt('Unable to retrieve information about course contents').
|
'output',$1.$2); |
'</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
|
if ($result != m|^/uploaded/|) { |
&Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
|
$errtext.='Map not saved: A network error occurred when trying to save the new map. '; |
return;
|
$fatal = 2; |
}
|
} |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
|
if ($fatal) { |
my $curRes;
|
return ($errtext,$fatal); |
my $outcome;
|
} |
|
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
|
if ($url) { |
['finishexport']);
|
if (!$residx |
if ($env{'form.finishexport'}) {
|
|| defined($LONCAPA::map::zombies[$residx])) { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
|
$residx = &LONCAPA::map::getresidx($url,$residx); |
['archive','discussion']);
|
push(@LONCAPA::map::order, $residx); |
|
} |
my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
|
my $ext = 'false'; |
my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
|
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } |
if (@exportitems == 0 && @discussions == 0) {
|
$url = &LONCAPA::map::qtunescape($url); |
$outcome = '<br />As you did not select any content items or discussions for export, an IMS package has not been created. Please <a href="javascript:history.go(-1)">go back</a> to select either content items or discussions for export';
|
$name = &LONCAPA::map::qtunescape($name); |
} else {
|
$LONCAPA::map::resources[$residx] = |
my $now = time;
|
join(':', ($name, $url, $ext, 'normal', 'res')); |
my %symbs;
|
} |
my $manifestok = 0;
|
} |
my $imsresources;
|
return &storemap($coursenum, $coursedom, $folder.'.'.$container); |
my $tempexport;
|
} |
my $copyresult;
|
|
my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport);
|
sub breadcrumbs { |
if ($manifestok) {
|
my ($allowed,$crstype)=@_; |
&build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest);
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
close($ims_manifest);
|
my (@folders); |
|
if ($env{'form.pagepath'}) { |
#Create zip file in prtspool
|
@folders = split('&',$env{'form.pagepath'}); |
my $imszipfile = '/prtspool/'.
|
} else { |
$env{'user.name'}.'_'.$env{'user.domain'}.'_'.
|
@folders=split('&',$env{'form.folderpath'}); |
time.'_'.rand(1000000000).'.zip';
|
} |
my $cwd = &Cwd::getcwd();
|
my $folderpath; |
my $imszip = '/home/httpd/'.$imszipfile;
|
my $cpinfo=''; |
chdir $tempexport;
|
my $plain=''; |
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
|
my $randompick=-1; |
close(OUTPUT);
|
my $isencrypted=0; |
chdir $cwd;
|
my $ishidden=0; |
$outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);
|
my $is_random_order=0; |
if ($copyresult) {
|
while (@folders) { |
$outcome .= &mt('The following errors occurred during export - [_1]',$copyresult);
|
my $folder=shift(@folders); |
}
|
my $foldername=shift(@folders); |
} else {
|
if ($folderpath) {$folderpath.='&';} |
$outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'<br />';
|
$folderpath.=$folder.'&'.$foldername; |
}
|
my $url; |
}
|
if ($allowed) { |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
|
$url = '/adm/coursedocs?folderpath='; |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
|
} else { |
$r->print($outcome);
|
$url = '/adm/supplemental?folderpath='; |
$r->print(&Apache::loncommon::end_page());
|
} |
} else {
|
$url .= &escape($folderpath); |
my $display;
|
my $name=&unescape($foldername); |
$display = '<form name="exportdoc" method="post">'."\n";
|
# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername |
$display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');
|
$name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//; |
$display .= '<table border="0" cellspacing="0" cellpadding="3">'.
|
if ($1 ne '') { |
'<tr><td><fieldset><legend> <b>Content items</b></legend>'.
|
$randompick=$1; |
'<input type="button" value="check all" '.
|
} else { |
'onclick="javascript:checkAll(document.exportdoc.archive)" />'.
|
$randompick=-1; |
' <input type="button" value="uncheck all"'.
|
} |
' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'.
|
if ($2) { $ishidden=1; } |
'<td> </td><td> </td>'.
|
if ($3) { $isencrypted=1; } |
'<td align="right"><fieldset><legend> <b>Discussion posts'.
|
if ($4 ne '') { $is_random_order = 1; } |
'</b></legend><input type="button" value="check all"'.
|
if ($folder eq 'supplemental') { |
' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
|
$name = &mt('Supplemental '.$crstype.' Content'); |
' <input type="button" value="uncheck all"'.
|
} |
' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'.
|
&Apache::lonhtmlcommon::add_breadcrumb( |
'</tr></table>';
|
{'href'=>$url.$cpinfo, |
my $curRes;
|
'title'=>$name, |
my $depth = 0;
|
'text'=>$name, |
my $count = 0;
|
'no_mt'=>1, |
my $boards = 0;
|
}); |
my $startcount = 5;
|
$plain.=$name.' > '; |
my %parent = ();
|
} |
my %children = ();
|
$plain=~s/\>\;\s*$//; |
my $lastcontainer = $startcount;
|
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', |
my @bgcolors = ('#F6F6F6','#FFFFFF');
|
undef, undef, 1 ),$randompick,$ishidden, |
$display .= '<table cellspacing="0"><tr>'.
|
$isencrypted,$plain,$is_random_order); |
'<td><b>Export content item?<br /></b></td><td> </td><td align="right">'."\n";
|
} |
if ($numdisc > 0) {
|
|
$display.='<b>Export discussion posts?</b>'."\n";
|
sub log_docs { |
}
|
return &Apache::lonnet::instructor_log('docslog',@_); |
$display.=' </td></tr>';
|
} |
while ($curRes = $it->next()) {
|
|
if (ref($curRes)) {
|
{ |
$count ++;
|
my @oldresources=(); |
}
|
my @oldorder=(); |
if ($curRes == $it->BEGIN_MAP()) {
|
my $parmidx; |
$depth++;
|
my %parmaction=(); |
$parent{$depth} = $lastcontainer;
|
my %parmvalue=(); |
}
|
my $changedflag; |
if ($curRes == $it->END_MAP()) {
|
|
$depth--;
|
sub snapshotbefore { |
$lastcontainer = $parent{$depth};
|
@oldresources=@LONCAPA::map::resources; |
}
|
@oldorder=@LONCAPA::map::order; |
if (ref($curRes)) {
|
$parmidx=undef; |
my $symb = $curRes->symb();
|
%parmaction=(); |
my $ressymb = $symb;
|
%parmvalue=(); |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
|
$changedflag=0; |
unless ($ressymb =~ m|adm/wrapper/adm|) {
|
} |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
|
|
}
|
sub remember_parms { |
}
|
my ($idx,$parameter,$action,$value)=@_; |
my $color = $count%2;
|
$parmidx=$idx; |
$display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n".
|
$parmaction{$parameter}=$action; |
'<input type="checkbox" name="archive" value="'.$count.'" ';
|
$parmvalue{$parameter}=$value; |
if (($curRes->is_sequence()) || ($curRes->is_page())) {
|
$changedflag=1; |
my $checkitem = $count + $boards + $startcount;
|
} |
$display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"';
|
|
}
|
sub log_differences { |
$display .= ' />'."\n";
|
my ($plain)=@_; |
for (my $i=0; $i<$depth; $i++) {
|
my %storehash=('folder' => $plain, |
$display .= '<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" /><img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />'."\n";
|
'currentfolder' => $env{'form.folder'}); |
}
|
if ($parmidx) { |
if ($curRes->is_sequence()) {
|
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
$display .= '<img src="/adm/lonIcons/navmap.folder.open.gif"> '."\n";
|
foreach my $parm (keys(%parmaction)) { |
$lastcontainer = $count + $startcount + $boards;
|
$storehash{'parameter_action_'.$parm}=$parmaction{$parm}; |
} elsif ($curRes->is_page()) {
|
$storehash{'parameter_value_'.$parm}=$parmvalue{$parm}; |
$display .= '<img src="/adm/lonIcons/navmap.page.open.gif"> '."\n";
|
} |
$lastcontainer = $count + $startcount + $boards;
|
} |
}
|
my $maxidx=$#oldresources; |
my $currelem = $count+$boards+$startcount;
|
if ($#LONCAPA::map::resources>$#oldresources) { |
$children{$parent{$depth}} .= $currelem.':';
|
$maxidx=$#LONCAPA::map::resources; |
$display .= ' '.$curRes->title().'</td>';
|
} |
if ($discussiontime{$ressymb} > 0) {
|
for (my $idx=0; $idx<=$maxidx; $idx++) { |
$boards ++;
|
if ($LONCAPA::map::resources[$idx] ne $oldresources[$idx]) { |
$currelem = $count+$boards+$startcount;
|
$storehash{'before_resources_'.$idx}=$oldresources[$idx]; |
$display .= '<td> </td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" /> </td>'."\n";
|
$storehash{'after_resources_'.$idx}=$LONCAPA::map::resources[$idx]; |
} else {
|
$changedflag=1; |
$display .= '<td colspan="2"> </td>'."\n";
|
} |
}
|
if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) { |
}
|
$storehash{'before_order_res_'.$idx}=$oldresources[$oldorder[$idx]]; |
}
|
$storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
my $scripttag = qq|
|
$changedflag=1; |
<script>
|
} |
|
} |
function checkAll(field) {
|
$storehash{'maxidx'}=$maxidx; |
if (field.length > 0) {
|
if ($changedflag) { &log_docs(\%storehash); } |
for (i = 0; i < field.length; i++) {
|
} |
field[i].checked = true ;
|
} |
}
|
|
} else {
|
sub docs_change_log { |
field.checked = true
|
my ($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath)=@_; |
}
|
my $js = '<script type="text/javascript">'."\n". |
}
|
'// <![CDATA['."\n". |
|
&Apache::loncommon::display_filter_js('docslog')."\n". |
function uncheckAll(field) {
|
&history_tab_js()."\n". |
if (field.length > 0) {
|
&Apache::lonratedt::editscript('simple')."\n". |
for (i = 0; i < field.length; i++) {
|
'// ]]>'."\n". |
field[i].checked = false ;
|
'</script>'."\n"; |
}
|
$r->print(&Apache::loncommon::start_page('Content Change Log',$js)); |
} else {
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content Change Log')); |
field.checked = false ;
|
$r->print(&startContentScreen('docs')); |
}
|
my %orderhash; |
}
|
my $container='sequence'; |
|
my $pathitem; |
function propagateCheck(item) {
|
if ($env{'form.pagepath'}) { |
if (document.exportdoc.elements[item].checked == true) {
|
$container='page'; |
containerCheck(item)
|
$pathitem = '<input type="hidden" name="pagepath" value="'. |
}
|
&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'; |
}
|
} else { |
|
my $folderpath=$env{'form.folderpath'}; |
function containerCheck(item) {
|
if ($folderpath eq '') { |
document.exportdoc.elements[item].checked = true
|
$folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents')); |
var numitems = $count + $boards + $startcount
|
} |
var parents = new Array(numitems)
|
$pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
for (var i=$startcount; i<numitems; i++) {
|
} |
parents[i] = new Array
|
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
}
|
my $jumpto = $readfile; |
|;
|
$jumpto =~ s{^/}{}; |
|
my $tid = 1; |
foreach my $container (sort { $a <=> $b } (keys(%children))) {
|
my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype); |
my @contents = split(/:/,$children{$container});
|
$r->print($breadcrumbtrail. |
for (my $i=0; $i<@contents; $i ++) {
|
&generate_edit_table($tid,\%orderhash,undef,$iconpath,$jumpto, |
$scripttag .= ' parents['.$container.']['.$i.'] = '.$contents[$i]."\n";
|
$readfile)); |
}
|
my %docslog=&Apache::lonnet::dump('nohist_docslog', |
}
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$scripttag .= qq|
|
|
if (parents[item].length > 0) {
|
if ((keys(%docslog))[0]=~/^error\:/) { undef(%docslog); } |
for (var j=0; j<parents[item].length; j++) {
|
|
containerCheck(parents[item][j])
|
my %saveable_parameters = ('show' => 'scalar',); |
}
|
&Apache::loncommon::store_course_settings('docs_log', |
}
|
\%saveable_parameters); |
}
|
&Apache::loncommon::restore_course_settings('docs_log', |
|
\%saveable_parameters); |
</script>
|
if (!$env{'form.show'}) { $env{'form.show'}=10; } |
|;
|
# FIXME: internationalization seems wrong here |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package',
|
my %lt=('hiddenresource' => 'Resources hidden', |
$scripttag));
|
'encrypturl' => 'URL hidden', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
|
'randompick' => 'Randomly pick', |
$r->print($display.'</table>'.
|
'randomorder' => 'Randomly ordered', |
'<p><input type="hidden" name="finishexport" value="1">'.
|
'set' => 'set to', |
'<input type="submit" name="exportcourse" value="'.
|
'del' => 'deleted'); |
&mt('Export '.$type.' DOCS').'" /></p></form>');
|
my $filter = &Apache::loncommon::display_filter('docslog')."\n". |
}
|
$pathitem."\n". |
}
|
'<input type="hidden" name="folder" value="'.$env{'form.folder'}.'" />'. |
|
(' 'x2).'<input type="submit" value="'.&mt('Display').'" />'; |
sub create_ims_store {
|
$r->print('<div class="LC_left_float">'. |
my ($now,$manifestok,$outcome,$tempexport) = @_;
|
'<fieldset><legend>'.&mt('Display of Content Changes').'</legend>'."\n". |
$$tempexport = $Apache::lonnet::perlvar{'lonDaemons'}.'/tmp/ims_exports';
|
&makedocslogform($filter,1). |
my $ims_manifest;
|
'</fieldset></div><br clear="all" />'); |
if (!-e $$tempexport) {
|
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
mkdir($$tempexport,0700);
|
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Folder').'</th><th>'.&mt('Before').'</th><th>'. |
}
|
&mt('After').'</th>'. |
$$tempexport .= '/'.$now;
|
&Apache::loncommon::end_data_table_header_row()); |
if (!-e $$tempexport) {
|
my $shown=0; |
mkdir($$tempexport,0700);
|
foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) { |
}
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
$$tempexport .= '/'.$env{'user.domain'}.'_'.$env{'user.name'};
|
if ($docslog{$id}{'logentry'}{'currentfolder'} ne $folder) { next; } |
if (!-e $$tempexport) {
|
} |
mkdir($$tempexport,0700);
|
my @changes=keys(%{$docslog{$id}{'logentry'}}); |
}
|
if ($env{'form.displayfilter'} eq 'containing') { |
if (!-e "$$tempexport/resources") {
|
my $wholeentry=$docslog{$id}{'exe_uname'}.':'.$docslog{$id}{'exe_udom'}.':'. |
mkdir("$$tempexport/resources",0700);
|
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'},$docslog{$id}{'exe_udom'}); |
}
|
foreach my $key (@changes) { |
# open manifest file
|
$wholeentry.=':'.$docslog{$id}{'logentry'}{$key}; |
my $manifest = '/imsmanifest.xml';
|
} |
my $manifestfilename = $$tempexport.$manifest;
|
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
if ($ims_manifest = Apache::File->new('>'.$manifestfilename)) {
|
} |
$$manifestok=1;
|
my $count = 0; |
print $ims_manifest
|
my $time = |
'<?xml version="1.0" encoding="UTF-8"?>'."\n".
|
&Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'}); |
'<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"'.
|
my $plainname = |
' xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2"'.
|
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'}, |
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
|
$docslog{$id}{'exe_udom'}); |
' identifier="MANIFEST-'.$env{'request.course.id'}.'-'.$now.'"'.
|
my $about_me_link = |
' xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1imscp_v1p1.xsd'.
|
&Apache::loncommon::aboutmewrapper($plainname, |
' http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p2.xsd">'."\n".
|
$docslog{$id}{'exe_uname'}, |
' <metadata>
|
$docslog{$id}{'exe_udom'}); |
<schema></schema>
|
my $send_msg_link=''; |
<imsmd:lom>
|
if ((($docslog{$id}{'exe_uname'} ne $env{'user.name'}) |
<imsmd:general>
|
|| ($docslog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
<imsmd:identifier>'.$env{'request.course.id'}.'</imsmd:identifier>
|
$send_msg_link ='<br />'. |
<imsmd:title>
|
&Apache::loncommon::messagewrapper(&mt('Send message'), |
<imsmd:langstring xml:lang="en">'.$env{'course.'.$env{'request.course.id'}.'.description'}.'</imsmd:langstring>
|
$docslog{$id}{'exe_uname'}, |
</imsmd:title>
|
$docslog{$id}{'exe_udom'}); |
</imsmd:general>
|
} |
</imsmd:lom>
|
$r->print(&Apache::loncommon::start_data_table_row()); |
</metadata>'."\n".
|
$r->print('<td>'.$time.'</td> |
' <organizations default="ORG-'.$env{'request.course.id'}.'-'.$now.'">'."\n".
|
<td>'.$about_me_link. |
' <organization identifier="ORG-'.$env{'request.course.id'}.'-'.$now.'"'.
|
'<br /><tt>'.$docslog{$id}{'exe_uname'}. |
' structure="hierarchical">'."\n".
|
':'.$docslog{$id}{'exe_udom'}.'</tt>'. |
' <title>'.$env{'course.'.$env{'request.course.id'}.'.description'}.'</title>'
|
$send_msg_link.'</td><td>'. |
} else {
|
$docslog{$id}{'logentry'}{'folder'}.'</td><td>'); |
$$outcome .= 'An error occurred opening the IMS manifest file.<br />'
|
# Before |
;
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
}
|
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; |
return $ims_manifest;
|
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; |
}
|
if ($oldname ne $newname) { |
|
$r->print(&LONCAPA::map::qtescape($oldname)); |
sub build_package {
|
} |
my ($now,$navmap,$exportitems,$discussions,$outcome,$tempexport,$copyresult,$ims_manifest) = @_;
|
} |
# first iterator to look for dependencies
|
$r->print('<ul>'); |
my $it = $navmap->getIterator(undef,undef,undef,1,undef,undef);
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
my $curRes;
|
if ($docslog{$id}{'logentry'}{'before_order_res_'.$idx}) { |
my $count = 0;
|
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'before_order_res_'.$idx}))[0]).'</li>'); |
my $depth = 0;
|
} |
my $lastcontainer = 0;
|
} |
my %parent = ();
|
$r->print('</ul>'); |
my @dependencies = ();
|
# After |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
|
$r->print('</td><td>'); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
|
|
while ($curRes = $it->next()) {
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
if (ref($curRes)) {
|
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; |
$count ++;
|
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; |
}
|
if ($oldname ne '' && $oldname ne $newname) { |
if ($curRes == $it->BEGIN_MAP()) {
|
$r->print(&LONCAPA::map::qtescape($newname)); |
$depth++;
|
} |
$parent{$depth} = $lastcontainer;
|
} |
}
|
$r->print('<ul>'); |
if ($curRes == $it->END_MAP()) {
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
$depth--;
|
if ($docslog{$id}{'logentry'}{'after_order_res_'.$idx}) { |
$lastcontainer = $parent{$depth};
|
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'after_order_res_'.$idx}))[0]).'</li>'); |
}
|
} |
if (ref($curRes)) {
|
} |
if ($curRes->is_sequence() || $curRes->is_page()) {
|
$r->print('</ul>'); |
$lastcontainer = $count;
|
if ($docslog{$id}{'logentry'}{'parameter_res'}) { |
}
|
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>'); |
if (grep(/^$count$/,@$exportitems)) {
|
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') { |
&get_dependencies($exportitems,\%parent,$depth,\@dependencies);
|
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
}
|
# FIXME: internationalization seems wrong here |
}
|
$r->print('<li>'. |
}
|
&mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]', |
# second iterator to build manifest and store resources
|
$docslog{$id}{'logentry'}{'parameter_value_'.$parameter}) |
$it = $navmap->getIterator(undef,undef,undef,1,undef,undef);
|
.'</li>'); |
$depth = 0;
|
} |
my $prevdepth;
|
} |
$count = 0;
|
$r->print('</ul>'); |
my $imsresources;
|
} |
my $pkgdepth;
|
# End |
while ($curRes = $it->next()) {
|
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
if ($curRes == $it->BEGIN_MAP()) {
|
$shown++; |
$prevdepth = $depth;
|
if (!($env{'form.show'} eq &mt('all') |
$depth++;
|
|| $shown<=$env{'form.show'})) { last; } |
}
|
} |
if ($curRes == $it->END_MAP()) {
|
$r->print(&Apache::loncommon::end_data_table()."\n". |
$prevdepth = $depth;
|
&makesimpleeditform($pathitem)."\n". |
$depth--;
|
'</div></div>'); |
}
|
$r->print(&endContentScreen()); |
|
} |
if (ref($curRes)) {
|
|
$count ++;
|
sub update_paste_buffer { |
if ((grep(/^$count$/,@$exportitems)) || (grep(/^$count$/,@dependencies))) {
|
my ($coursenum,$coursedom) = @_; |
my $symb = $curRes->symb();
|
|
my $isvisible = 'true';
|
return if (!defined($env{'form.markcopy'})); |
my $resourceref;
|
return if (!defined($env{'form.copyfolder'})); |
if ($curRes->randomout()) {
|
return if ($env{'form.markcopy'} < 0); |
$isvisible = 'false';
|
|
}
|
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
unless ($curRes->is_sequence()) {
|
$env{'form.copyfolder'}); |
$resourceref = 'identifierref="RES-'.$env{'request.course.id'}.'-'.$count.'"';
|
|
}
|
return if ($fatal); |
my $step = $prevdepth - $depth;
|
|
if (($step >= 0) && ($count > 1)) {
|
# Mark for copying |
while ($step >= 0) {
|
my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]); |
print $ims_manifest "\n".' </item>'."\n";
|
if (&is_supplemental_title($title)) { |
$step --;
|
&Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title}); |
}
|
($title) = &parse_supplemental_title($title); |
}
|
} elsif ($env{'docs.markedcopy_supplemental'}) { |
$prevdepth = $depth;
|
&Apache::lonnet::delenv('docs.markedcopy_supplemental'); |
|
} |
my $itementry =
|
$url=~s{http(:|:)//https(:|:)//}{https$2//}; |
'<item identifier="ITEM-'.$env{'request.course.id'}.'-'.$count.
|
|
'" isvisible="'.$isvisible.'" '.$resourceref.'>'.
|
&Apache::lonnet::appenv({'docs.markedcopy_title' => $title, |
'<title>'.$curRes->title().'</title>';
|
'docs.markedcopy_url' => $url}); |
print $ims_manifest "\n".$itementry;
|
delete($env{'form.markcopy'}); |
|
} |
unless ($curRes->is_sequence()) {
|
|
my $content_file;
|
sub print_paste_buffer { |
my @hrefs = ();
|
my ($r,$container) = @_; |
&process_content($count,$curRes,$cdom,$cnum,$symb,\$content_file,\@hrefs,$copyresult,$tempexport);
|
return if (!defined($env{'docs.markedcopy_url'})); |
if ($content_file) {
|
|
$imsresources .= "\n".
|
$r->print('<fieldset>' |
' <resource identifier="RES-'.$env{'request.course.id'}.'-'.$count.
|
.'<legend>'.&mt('Clipboard').'</legend>' |
'" type="webcontent" href="'.$content_file.'">'."\n".
|
.'<form name="pasteform" action="/adm/coursedocs" method="post">' |
' <file href="'.$content_file.'" />'."\n";
|
.'<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> ' |
foreach my $item (@hrefs) {
|
); |
$imsresources .=
|
|
' <file href="'.$item.'" />'."\n";
|
my $type; |
}
|
if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) { |
if (grep(/^$count$/,@$discussions)) {
|
$type = &mt('External Resource'); |
my $ressymb = $symb;
|
$r->print($type.': '. |
my $mode;
|
&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('. |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
|
&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}).')'); |
unless ($ressymb =~ m|adm/wrapper/adm|) {
|
} else { |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
|
my $extension = (split(/\./,$env{'docs.markedcopy_url'}))[-1]; |
}
|
my $icon = &Apache::loncommon::icon($extension); |
$mode = 'board';
|
if ($extension eq 'sequence' && |
}
|
$env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) { |
my %extras = (
|
$icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); |
caller => 'imsexport',
|
$icon .= '/navmap.folder.closed.gif'; |
tempexport => $tempexport.'/resources',
|
} |
count => $count
|
$icon = '<img src="'.$icon.'" alt="" class="LC_icon" />'; |
);
|
$r->print($icon.$type.': '. &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}))); |
my $discresult = &Apache::lonfeedback::list_discussion($mode,undef,$ressymb,\%extras);
|
} |
}
|
if ($container eq 'page') { |
$imsresources .= ' </resource>'."\n";
|
$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'},'<>&"').'" /> |
$pkgdepth = $depth;
|
'); |
}
|
} else { |
}
|
$r->print(' |
}
|
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /> |
while ($pkgdepth > 0) {
|
'); |
print $ims_manifest " </item>\n";
|
} |
$pkgdepth --;
|
$r->print('</form></fieldset>'); |
}
|
} |
my $resource_text = qq|
|
|
</organization>
|
sub do_paste_from_buffer { |
</organizations>
|
my ($coursenum,$coursedom,$folder) = @_; |
<resources>
|
|
$imsresources
|
if (!$env{'form.pastemarked'}) { |
</resources>
|
return; |
</manifest>
|
} |
|;
|
|
print $ims_manifest $resource_text;
|
# paste resource to end of list |
}
|
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}); |
|
my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}); |
sub get_dependencies {
|
# Maps need to be copied first |
my ($exportitems,$parent,$depth,$dependencies) = @_;
|
if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) { |
if ($depth > 1) {
|
$title=&mt('Copy of').' '.$title; |
if ((!grep(/^$$parent{$depth}$/,@$exportitems)) && (!grep(/^$$parent{$depth}$/,@$dependencies))) {
|
my $newid=$$.int(rand(100)).time; |
push(@{$dependencies},$$parent{$depth});
|
my ($oldid,$ext) = ($url=~/^(.+)\.(\w+)$/); |
if ($depth > 2) {
|
if ($oldid =~ m{^(/uploaded/\Q$coursedom\E/\Q$coursenum\E/)(\D+)(\d+)$}) { |
&get_dependencies($exportitems,$parent,$depth-1,$dependencies);
|
my $path = $1; |
}
|
my $prefix = $2; |
}
|
my $ancestor = $3; |
}
|
if (length($ancestor) > 10) { |
}
|
$ancestor = substr($ancestor,-10,10); |
|
} |
sub process_content {
|
$oldid = $path.$prefix.$ancestor; |
my ($count,$curRes,$cdom,$cnum,$symb,$content_file,$href,$copyresult,$tempexport) = @_;
|
} |
my $content_type;
|
my $counter = 0; |
my $message;
|
my $newurl=$oldid.$newid.'.'.$ext; |
my @uploads = ();
|
my $is_unique = &uniqueness_check($newurl); |
if ($curRes->is_sequence()) {
|
while (!$is_unique && $counter < 100) { |
$content_type = 'sequence';
|
$counter ++; |
} elsif ($curRes->is_page()) {
|
$newid ++; |
$content_type = 'page'; # need to handle individual items in pages.
|
$newurl = $oldid.$newid; |
} elsif ($symb =~ m-public/$cdom/$cnum/syllabus$-) {
|
$is_unique = &uniqueness_check($newurl); |
$content_type = 'syllabus';
|
} |
my $contents = &Apache::imsexport::templatedpage($content_type);
|
if (!$is_unique) { |
if ($contents) {
|
if ($url=~/\.page$/) { |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
return &mt('Paste failed: an error occurred creating a unique URL for the composite page'); |
}
|
} else { |
} elsif ($symb =~ m-\.sequence___\d+___ext-) {
|
return &mt('Paste failed: an error occurred creating a unique URL for the folder'); |
$content_type = 'external';
|
} |
my $title = $curRes->title;
|
} |
my $contents = &Apache::imsexport::external($symb,$title);
|
my $storefn=$newurl; |
if ($contents) {
|
$storefn=~s{^/\w+/$match_domain/$match_username/}{}; |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
my $paste_map_result = |
}
|
&Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn, |
} elsif ($symb =~ m-adm/navmaps$-) {
|
&Apache::lonnet::getfile($url)); |
$content_type = 'navmap';
|
if ($paste_map_result eq '/adm/notfound.html') { |
} elsif ($symb =~ m-adm/[^/]+/[^/]+/(\d+)/smppg$-) {
|
if ($url=~/\.page$/) { |
$content_type = 'simplepage';
|
return &mt('Paste failed: an error occurred saving the composite page'); |
my $contents = &Apache::imsexport::templatedpage($content_type,$1,$count,\@uploads);
|
} else { |
if ($contents) {
|
return &mt('Paste failed: an error occurred saving the folder'); |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
} |
}
|
} |
} elsif ($symb =~ m-lib/templates/simpleproblem\.problem$-) {
|
$url = $newurl; |
$content_type = 'simpleproblem';
|
} |
my $contents = &Apache::imsexport::simpleproblem($symb);
|
# published maps can only exists once, so remove it from paste buffer when done |
if ($contents) {
|
if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) { |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
&Apache::lonnet::delenv('docs.markedcopy'); |
}
|
} |
} elsif ($symb =~ m-lib/templates/examupload\.problem$-) {
|
if ($url=~ m{/smppg$}) { |
$content_type = 'examupload';
|
my $db_name = &Apache::lonsimplepage::get_db_name($url); |
} elsif ($symb =~ m-adm/($match_domain)/($match_username)/(\d+)/bulletinboard$-) {
|
if ($db_name =~ /^smppage_/) { |
$content_type = 'bulletinboard';
|
#simple pages, need to copy the db contents to a new one. |
my $contents = &Apache::imsexport::templatedpage($content_type,$3,$count,\@uploads,$1,$2);
|
my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum); |
if ($contents) {
|
my $now = time(); |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
$db_name =~ s{_\d*$ }{_$now}x; |
}
|
my $result=&Apache::lonnet::put($db_name,\%contents, |
} elsif ($symb =~ m-adm/([^/]+)/([^/]+)/aboutme$-) {
|
$coursedom,$coursenum); |
$content_type = 'aboutme';
|
$url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; |
my $contents = &Apache::imsexport::templatedpage($content_type,undef,$count,\@uploads,$1,$2);
|
$title=&mt('Copy of').' '.$title; |
if ($contents) {
|
} |
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
|
} |
}
|
$title = &LONCAPA::map::qtunescape($title); |
} elsif ($symb =~ m-\.(sequence|page)___\d+___uploaded/$cdom/$cnum/-) {
|
my $ext='false'; |
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded');
|
if ($url=~m{^http(|s)://}) { $ext='true'; } |
} elsif ($symb =~ m-\.(sequence|page)___\d+___([^/]+)/([^/]+)-) {
|
$url = &LONCAPA::map::qtunescape($url); |
my $canedit = 0;
|
# Now insert the URL at the bottom |
if ($2 eq $env{'user.domain'} && $3 eq $env{'user.name'}) {
|
my $newidx = &LONCAPA::map::getresidx($url); |
$canedit= 1;
|
if ($env{'docs.markedcopy_supplemental'}) { |
}
|
if ($folder =~ /^supplemental/) { |
# only include problem code where current user is author
|
$title = $env{'docs.markedcopy_supplemental'}; |
if ($canedit) {
|
} else { |
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'resource');
|
(undef,undef,$title) = |
} else {
|
&parse_supplemental_title($env{'docs.markedcopy_supplemental'}); |
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'noedit');
|
} |
}
|
} else { |
} elsif ($symb =~ m-uploaded/$cdom/$cnum-) {
|
if ($folder=~/^supplemental/) { |
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded');
|
$title=time.'___&&&___'.$env{'user.name'}.'___&&&___'. |
}
|
$env{'user.domain'}.'___&&&___'.$title; |
if (@uploads > 0) {
|
} |
foreach my $item (@uploads) {
|
} |
my $uploadmsg = '';
|
|
&replicate_content($cdom,$cnum,$tempexport,$item,$count,\$uploadmsg,$href,'templateupload');
|
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; |
if ($uploadmsg) {
|
push(@LONCAPA::map::order, $newidx); |
$$copyresult .= $uploadmsg."\n";
|
return 'ok'; |
}
|
# Store the result |
}
|
} |
}
|
|
if ($message) {
|
sub uniqueness_check { |
$$copyresult .= $message."\n";
|
my ($newurl) = @_; |
}
|
my $unique = 1; |
}
|
foreach my $res (@LONCAPA::map::order) { |
|
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
sub replicate_content {
|
$url=&LONCAPA::map::qtescape($url); |
my ($cdom,$cnum,$tempexport,$symb,$count,$message,$href,$caller) = @_;
|
if ($newurl eq $url) { |
my ($map,$ind,$url);
|
$unique = 0; |
if ($caller eq 'templateupload') {
|
last; |
$url = $symb;
|
} |
$url =~ s#//#/#g;
|
} |
} else {
|
return $unique; |
($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
|
} |
}
|
|
my $content;
|
my %parameter_type = ( 'randompick' => 'int_pos', |
my $filename;
|
'hiddenresource' => 'string_yesno', |
my $repstatus;
|
'encrypturl' => 'string_yesno', |
my $content_name;
|
'randomorder' => 'string_yesno',); |
if ($url =~ m-/([^/]+)$-) {
|
my $valid_parameters_re = join('|',keys(%parameter_type)); |
$filename = $1;
|
# set parameters |
if (!-e $tempexport.'/resources') {
|
sub update_parameter { |
mkdir($tempexport.'/resources',0700);
|
|
}
|
return 0 if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/); |
if (!-e $tempexport.'/resources/'.$count) {
|
|
mkdir($tempexport.'/resources/'.$count,0700);
|
my $which = $env{'form.changeparms'}; |
}
|
my $idx = $env{'form.setparms'}; |
my $destination = $tempexport.'/resources/'.$count.'/'.$filename;
|
if ($env{'form.'.$which.'_'.$idx}) { |
my $copiedfile;
|
my $value = ($which eq 'randompick') ? $env{'form.'.$which.'_'.$idx} |
if ($copiedfile = Apache::File->new('>'.$destination)) {
|
: 'yes'; |
my $content;
|
&LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value, |
if ($caller eq 'resource') {
|
$parameter_type{$which}); |
my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res';
|
&remember_parms($idx,$which,'set',$value); |
my $filepath = &Apache::lonnet::filelocation($respath,$url);
|
} else { |
$content = &Apache::lonnet::getfile($filepath);
|
&LONCAPA::map::delparameter($idx,'parameter_'.$which); |
if ($content eq -1) {
|
|
$$message = 'Could not copy file '.$filename;
|
&remember_parms($idx,$which,'del'); |
} else {
|
} |
&extract_media($url,$cdom,$cnum,\$content,$count,$tempexport,$href,$message,'resource');
|
return 1; |
$repstatus = 'ok';
|
} |
}
|
|
} elsif ($caller eq 'uploaded' || $caller eq 'templateupload') {
|
|
my $rtncode;
|
sub handle_edit_cmd { |
$repstatus = &Apache::lonnet::getuploaded('GET',$url,$cdom,$cnum,\$content,$rtncode);
|
my ($coursenum,$coursedom) =@_; |
if ($repstatus eq 'ok') {
|
my ($cmd,$idx)=split('_',$env{'form.cmd'}); |
if ($url =~ /\.html?$/i) {
|
|
&extract_media($url,$cdom,$cnum,\$content,$count,$tempexport,$href,$message,'uploaded');
|
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
}
|
my ($title, $url, @rrest) = split(':', $ratstr); |
} else {
|
|
$$message = 'Could not render '.$url.' server message - '.$rtncode."<br />\n";
|
if ($cmd eq 'del') { |
}
|
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && |
} elsif ($caller eq 'noedit') {
|
($url!~/$LONCAPA::assess_page_seq_re/)) { |
# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this.
|
&Apache::lonnet::removeuploadedurl($url); |
$repstatus = 'ok';
|
} else { |
$content = 'Not the owner of this resource';
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
}
|
} |
if ($repstatus eq 'ok') {
|
splice(@LONCAPA::map::order, $idx, 1); |
print $copiedfile $content;
|
|
}
|
} elsif ($cmd eq 'cut') { |
close($copiedfile);
|
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
} else {
|
splice(@LONCAPA::map::order, $idx, 1); |
$$message = 'Could not open destination file for '.$filename."<br />\n";
|
|
}
|
} elsif ($cmd eq 'up' |
} else {
|
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
$$message = 'Could not determine name of file for '.$symb."<br />\n";
|
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1]; |
}
|
|
if ($repstatus eq 'ok') {
|
} elsif ($cmd eq 'down' |
$content_name = 'resources/'.$count.'/'.$filename;
|
&& defined($LONCAPA::map::order[$idx+1])) { |
}
|
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1]; |
return $content_name;
|
|
}
|
} elsif ($cmd eq 'rename') { |
|
|
sub extract_media {
|
my $comment = &LONCAPA::map::qtunescape($env{'form.title'}); |
my ($url,$cdom,$cnum,$content,$count,$tempexport,$href,$message,$caller) = @_;
|
if ($comment=~/\S/) { |
my ($dirpath,$container);
|
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
my %allfiles = ();
|
$comment.':'.join(':', $url, @rrest); |
my %codebase = ();
|
} |
if ($url =~ m-(.*/)([^/]+)$-) {
|
# Devalidate title cache |
$dirpath = $1;
|
my $renamed_url=&LONCAPA::map::qtescape($url); |
$container = $2;
|
&Apache::lonnet::devalidate_title_cache($renamed_url); |
} else {
|
} else { |
$dirpath = $url;
|
return 0; |
$container = '';
|
} |
}
|
return 1; |
&Apache::lonnet::extract_embedded_items(undef,\%allfiles,\%codebase,$content);
|
} |
foreach my $embed_file (keys(%allfiles)) {
|
|
my $filename;
|
sub editor { |
if ($embed_file =~ m#([^/]+)$#) {
|
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
$filename = $1;
|
$supplementalflag,$orderhash,$iconpath)=@_; |
} else {
|
my $container= ($env{'form.pagepath'}) ? 'page' |
$filename = $embed_file;
|
: 'sequence'; |
}
|
|
my $newname = 'res/'.$filename;
|
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) = |
my ($rtncode,$embed_content,$repstatus);
|
&breadcrumbs($allowed,$crstype); |
my $embed_url;
|
$r->print($breadcrumbtrail); |
if ($embed_file =~ m-^/-) {
|
|
$embed_url = $embed_file; # points to absolute path
|
my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; |
} else {
|
|
if ($embed_file =~ m-https?://-) {
|
unless ($allowed) { |
next; # points to url
|
$randompick = -1; |
} else {
|
} |
$embed_url = $dirpath.$embed_file; # points to relative path
|
|
}
|
my ($errtext,$fatal) = &mapread($coursenum,$coursedom, |
}
|
$folder.'.'.$container); |
if ($caller eq 'resource') {
|
return $errtext if ($fatal); |
my $respath = $Apache::lonnet::perlvar{'lonDocRoot'}.'/res';
|
|
my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url);
|
if ($#LONCAPA::map::order<1) { |
$embed_content = &Apache::lonnet::getfile($embed_path);
|
my $idx=&LONCAPA::map::getresidx(); |
unless ($embed_content eq -1) {
|
if ($idx<=0) { $idx=1; } |
$repstatus = 'ok';
|
$LONCAPA::map::order[0]=$idx; |
}
|
$LONCAPA::map::resources[$idx]=''; |
} elsif ($caller eq 'uploaded') {
|
} |
|
|
$repstatus = &Apache::lonnet::getuploaded('GET',$embed_url,$cdom,$cnum,\$embed_content,$rtncode);
|
# ------------------------------------------------------------ Process commands |
}
|
|
if ($repstatus eq 'ok') {
|
# ---------------- if they are for this folder and user allowed to make changes |
my $destination = $tempexport.'/resources/'.$count.'/res';
|
if (($allowed) && ($env{'form.folder'} eq $folder)) { |
if (!-e "$destination") {
|
# set parameters and change order |
mkdir($destination,0755);
|
&snapshotbefore(); |
}
|
|
$destination .= '/'.$filename;
|
if (&update_parameter()) { |
my $copiedfile;
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
if ($copiedfile = Apache::File->new('>'.$destination)) {
|
return $errtext if ($fatal); |
print $copiedfile $embed_content;
|
} |
push(@{$href},'resources/'.$count.'/res/'.$filename);
|
|
my $attrib_regexp = '';
|
if ($env{'form.newpos'} && $env{'form.currentpos'}) { |
if (@{$allfiles{$embed_file}} > 1) {
|
# change order |
$attrib_regexp = join('|',@{$allfiles{$embed_file}});
|
my $res = splice(@LONCAPA::map::order,$env{'form.currentpos'}-1,1); |
} else {
|
splice(@LONCAPA::map::order,$env{'form.newpos'}-1,0,$res); |
$attrib_regexp = $allfiles{$embed_file}[0];
|
|
}
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
$$content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$embed_file\E(['"]?)#$1$newname$2#gi;
|
return $errtext if ($fatal); |
if ($caller eq 'resource' && $container =~ /\.(problem|library)$/) {
|
} |
$$content =~ s#\Q$embed_file\E#$newname#gi;
|
|
}
|
if ($env{'form.pastemarked'}) { |
}
|
my $paste_res = |
} else {
|
&do_paste_from_buffer($coursenum,$coursedom,$folder); |
$$message .= 'replication of embedded file - '.$embed_file.' in '.$url.' failed, reason -'.$rtncode."<br />\n";
|
if ($paste_res eq 'ok') { |
}
|
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); |
}
|
return $errtext if ($fatal); |
return;
|
} elsif ($paste_res ne '') { |
}
|
$r->print('<p><span class="LC_error">'.$paste_res.'</span></p>'); |
|
} |
sub store_template {
|
} |
my ($contents,$tempexport,$count,$content_type) = @_;
|
|
if ($contents) {
|
$r->print($upload_output); |
if ($tempexport) {
|
|
if (!-e $tempexport.'/resources') {
|
if (&handle_edit_cmd()) { |
mkdir($tempexport.'/resources',0700);
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
}
|
return $errtext if ($fatal); |
if (!-e $tempexport.'/resources/'.$count) {
|
} |
mkdir($tempexport.'/resources/'.$count,0700);
|
# Group import/search |
}
|
if ($env{'form.importdetail'}) { |
my $destination = $tempexport.'/resources/'.$count.'/'.$content_type.'.xml';
|
my @imports; |
my $storetemplate;
|
foreach my $item (split(/\&/,$env{'form.importdetail'})) { |
if ($storetemplate = Apache::File->new('>'.$destination)) {
|
if (defined($item)) { |
print $storetemplate $contents;
|
my ($name,$url,$residx)= |
close($storetemplate);
|
map {&unescape($_)} split(/\=/,$item); |
}
|
push(@imports, [$name, $url, $residx]); |
if ($content_type eq 'external') {
|
} |
return 'resources/'.$count.'/'.$content_type.'.html';
|
} |
} else {
|
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, |
return 'resources/'.$count.'/'.$content_type.'.xml';
|
$container,'londocs',@imports); |
}
|
return $errtext if ($fatal); |
}
|
} |
}
|
# Loading a complete map |
}
|
if ($env{'form.loadmap'}) { |
|
if ($env{'form.importmap'}=~/\w/) { |
|
foreach my $res (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
sub group_import {
|
my ($title,$url,$ext,$type)=split(/\:/,$res); |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
|
my $idx=&LONCAPA::map::getresidx($url); |
|
$LONCAPA::map::resources[$idx]=$res; |
while (@files) {
|
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
my ($name, $url, $residx) = @{ shift(@files) };
|
} |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$})
|
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
&& ($caller eq 'londocs')
|
$folder.'.'.$container); |
&& (!&Apache::lonnet::stat_file($url))) {
|
return $errtext if ($fatal); |
|
} else { |
my $errtext = '';
|
$r->print('<p><span class="LC_error">'.&mt('No map selected.').'</span></p>'); |
my $fatal = 0;
|
|
my $newmapstr = '<map>'."\n".
|
} |
'<resource id="1" src="" type="start"></resource>'."\n".
|
} |
'<link from="1" to="2" index="1"></link>'."\n".
|
&log_differences($plain); |
'<resource id="2" src="" type="finish"></resource>'."\n".
|
} |
'</map>';
|
# ---------------------------------------------------------------- End commands |
$env{'form.output'}=$newmapstr;
|
# ---------------------------------------------------------------- Print screen |
my $result=&Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
|
my $idx=0; |
'output',$1.$2);
|
my $shown=0; |
if ($result != m|^/uploaded/|) {
|
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) { |
$errtext.='Map not saved: A network error occurred when trying to save the new map. ';
|
$r->print('<div class="LC_Box">'. |
$fatal = 2;
|
'<ol class="LC_docs_parameters"><li class="LC_docs_parameters_title">'.&mt('Parameters:').'</li>'. |
}
|
($randompick>=0?'<li>'.&mt('randomly pick [quant,_1,resource]',$randompick).'</li>':''). |
if ($fatal) {
|
($ishidden?'<li>'.&mt('contents hidden').'</li>':''). |
return ($errtext,$fatal);
|
($isencrypted?'<li>'.&mt('URLs hidden').'</li>':''). |
}
|
($is_random_order?'<li>'.&mt('random order').'</li>':''). |
}
|
'</ol>'); |
if ($url) {
|
if ($randompick>=0) { |
if (!$residx
|
$r->print('<p class="LC_warning">' |
|| defined($LONCAPA::map::zombies[$residx])) {
|
.&mt('Caution: this folder is set to randomly pick a subset' |
$residx = &LONCAPA::map::getresidx($url,$residx);
|
.' of resources. Adding or removing resources from this' |
push(@LONCAPA::map::order, $residx);
|
.' folder will change the set of resources that the' |
}
|
.' students see, resulting in spurious or missing credit' |
my $ext = 'false';
|
.' for completed problems, not limited to ones you' |
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }
|
.' modify. Do not modify the contents of this folder if' |
$url = &LONCAPA::map::qtunescape($url);
|
.' it is in active student use.') |
$name = &LONCAPA::map::qtunescape($name);
|
.'</p>' |
$LONCAPA::map::resources[$residx] =
|
); |
join(':', ($name, $url, $ext, 'normal', 'res'));
|
} |
}
|
if ($is_random_order) { |
}
|
$r->print('<p class="LC_warning">' |
return &storemap($coursenum, $coursedom, $folder.'.'.$container);
|
.&mt('Caution: this folder is set to randomly order its' |
}
|
.' contents. Adding or removing resources from this folder' |
|
.' will change the order of resources shown.') |
sub breadcrumbs {
|
.'</p>' |
my ($where,$allowed,$type)=@_;
|
); |
&Apache::lonhtmlcommon::clear_breadcrumbs();
|
} |
my (@folders);
|
$r->print('</div>'); |
if ($env{'form.pagepath'}) {
|
} |
@folders = split('&',$env{'form.pagepath'});
|
|
} else {
|
my ($to_show,$output); |
@folders=split('&',$env{'form.folderpath'});
|
|
}
|
&Apache::loncommon::start_data_table_count(); #setup a row counter |
my $folderpath;
|
foreach my $res (@LONCAPA::map::order) { |
my $cpinfo='';
|
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
my $plain='';
|
$name=&LONCAPA::map::qtescape($name); |
my $randompick=-1;
|
$url=&LONCAPA::map::qtescape($url); |
my $isencrypted=0;
|
unless ($name) { $name=(split(/\//,$url))[-1]; } |
my $ishidden=0;
|
unless ($name) { $idx++; next; } |
my $is_random_order=0;
|
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
while (@folders) {
|
$coursenum,$crstype); |
my $folder=shift(@folders);
|
$idx++; |
my $foldername=shift(@folders);
|
$shown++; |
if ($folderpath) {$folderpath.='&';}
|
} |
$folderpath.=$folder.'&'.$foldername;
|
&Apache::loncommon::end_data_table_count(); |
my $url='/adm/coursedocs?folderpath='.
|
|
&escape($folderpath);
|
if ($shown) { |
my $name=&unescape($foldername);
|
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') |
# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername
|
.&Apache::loncommon::start_data_table(undef,'contentlist'); |
$name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
|
if ($allowed) { |
if ($1 ne '') {
|
$to_show .= &Apache::loncommon::start_data_table_header_row() |
$randompick=$1;
|
.'<th colspan="2">'.&mt('Move').'</th>' |
} else {
|
.'<th>'.&mt('Actions').'</th>' |
$randompick=-1;
|
.'<th colspan="2">'.&mt('Document').'</th>'; |
}
|
if ($folder !~ /^supplemental/) { |
if ($2) { $ishidden=1; }
|
$to_show .= '<th colspan="4">'.&mt('Settings').'</th>'; |
if ($3) { $isencrypted=1; }
|
} |
if ($4 ne '') { $is_random_order = 1; }
|
$to_show .= &Apache::loncommon::end_data_table_header_row(); |
if ($folder eq 'supplemental') {
|
} |
if ($allowed) {
|
$to_show .= $output.' ' |
$name = &mt('Supplemental '.$type.' Documents');
|
.&Apache::loncommon::end_data_table() |
} else {
|
.'<br style="line-height:2px;" />' |
$name = &mt($type.' Documents');
|
.&Apache::loncommon::end_scrollbox(); |
}
|
} else { |
}
|
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') |
&Apache::lonhtmlcommon::add_breadcrumb(
|
.'<div class="LC_info" id="contentlist">' |
{'href'=>$url.$cpinfo,
|
.&mt('Currently no documents.') |
'title'=>$name,
|
.'</div>' |
'text'=>'<font size="+1">'.
|
.&Apache::loncommon::end_scrollbox(); |
$name.'</font>',
|
} |
'no_mt'=>1,
|
my $tid = 1; |
});
|
if ($supplementalflag) { |
$plain.=$name.' > ';
|
$tid = 2; |
}
|
} |
$plain=~s/\>\;\s*$//;
|
if ($allowed) { |
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
|
my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container"; |
'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
|
$r->print(&generate_edit_table($tid,$orderhash,$to_show,$iconpath,$jumpto, |
}
|
$readfile)); |
|
&print_paste_buffer($r,$container); |
sub log_docs {
|
} else { |
return &Apache::lonnet::instructor_log('docslog',@_);
|
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( |
my @oldresources=();
|
&Apache::loncommon::head_subbox( |
my @oldorder=();
|
&Apache::lonhtmlcommon::start_funclist(). |
my $parmidx;
|
&Apache::lonhtmlcommon::add_item_funclist( |
my %parmaction=();
|
'<a href="/adm/coursedocs?command=direct&forcesupplement=1&'. |
my %parmvalue=();
|
'supppath='.&HTML::Entities::encode($env{'form.folderpath'}).'">'. |
my $changedflag;
|
'<img src="/res/adm/pages/docs.png" alt="'.$funcname.'" class="LC_icon" />'. |
|
'<span class="LC_menubuttons_inline_text">'.$funcname.'</span></a>'). |
sub snapshotbefore {
|
&Apache::lonhtmlcommon::end_funclist())); |
@oldresources=@LONCAPA::map::resources;
|
} |
@oldorder=@LONCAPA::map::order;
|
$r->print($to_show); |
$parmidx=undef;
|
} |
%parmaction=();
|
return; |
%parmvalue=();
|
} |
$changedflag=0;
|
|
}
|
sub process_file_upload { |
|
my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_; |
sub remember_parms {
|
# upload a file, if present |
my ($idx,$parameter,$action,$value)=@_;
|
my ($parseaction,$showupload,$nextphase,$mimetype); |
$parmidx=$idx;
|
if ($env{'form.parserflag'}) { |
$parmaction{$parameter}=$action;
|
$parseaction = 'parse'; |
$parmvalue{$parameter}=$value;
|
} |
$changedflag=1;
|
my $folder=$env{'form.folder'}; |
}
|
if ($folder eq '') { |
|
$folder='default'; |
sub log_differences {
|
} |
my ($plain)=@_;
|
if ( ($folder=~/^$uploadcmd/) || ($uploadcmd eq 'default') ) { |
my %storehash=('folder' => $plain,
|
my $errtext=''; |
'currentfolder' => $env{'form.folder'});
|
my $fatal=0; |
if ($parmidx) {
|
my $container='sequence'; |
$storehash{'parameter_res'}=$oldresources[$parmidx];
|
if ($env{'form.pagepath'}) { |
foreach my $parm (keys(%parmaction)) {
|
$container='page'; |
$storehash{'parameter_action_'.$parm}=$parmaction{$parm};
|
} |
$storehash{'parameter_value_'.$parm}=$parmvalue{$parm};
|
($errtext,$fatal)= |
}
|
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
}
|
if ($#LONCAPA::map::order<1) { |
my $maxidx=$#oldresources;
|
$LONCAPA::map::order[0]=1; |
if ($#LONCAPA::map::resources>$#oldresources) {
|
$LONCAPA::map::resources[1]=''; |
$maxidx=$#LONCAPA::map::resources;
|
} |
}
|
if ($fatal) { |
for (my $idx=0; $idx<=$maxidx; $idx++) {
|
$$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'</div>'; |
if ($LONCAPA::map::resources[$idx] ne $oldresources[$idx]) {
|
return; |
$storehash{'before_resources_'.$idx}=$oldresources[$idx];
|
} |
$storehash{'after_resources_'.$idx}=$LONCAPA::map::resources[$idx];
|
my $destination = 'docs/'; |
$changedflag=1;
|
if ($folder =~ /^supplemental/) { |
}
|
$destination = 'supplemental/'; |
if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) {
|
} |
$storehash{'before_order_res_'.$idx}=$oldresources[$oldorder[$idx]];
|
if (($folder eq 'default') || ($folder eq 'supplemental')) { |
$storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$LONCAPA::map::order[$idx]];
|
$destination .= 'default/'; |
$changedflag=1;
|
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) { |
}
|
$destination .= $2.'/'; |
}
|
} |
$storehash{'maxidx'}=$maxidx;
|
# this is for a course, not a user, so set context to coursedoc. |
if ($changedflag) { &log_docs(\%storehash); }
|
my $newidx=&LONCAPA::map::getresidx(); |
}
|
$destination .= $newidx; |
}
|
my $url=&Apache::lonnet::userfileupload('uploaddoc','coursedoc',$destination, |
|
$parseaction,$allfiles, |
|
$codebase,undef,undef,undef,undef, |
|
undef,undef,\$mimetype); |
|
if ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E.*/([^/]+)$}) { |
|
my $stored = $1; |
sub docs_change_log {
|
$showupload = '<p>'.&mt('Uploaded [_1]','<span class="LC_filename">'. |
my ($r)=@_;
|
$stored.'</span>').'</p>'; |
my $folder=$env{'form.folder'};
|
} else { |
$r->print(&Apache::loncommon::start_page('Course Document Change Log'));
|
my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Document Change Log'));
|
|
my %docslog=&Apache::lonnet::dump('nohist_docslog',
|
$$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('Unable to save file [_1].','<span class="LC_filename">'.$filename.'</span>').'</div>'; |
$env{'course.'.$env{'request.course.id'}.'.domain'},
|
return; |
$env{'course.'.$env{'request.course.id'}.'.num'});
|
} |
|
my $ext='false'; |
if ((keys(%docslog))[0]=~/^error\:/) { undef(%docslog); }
|
if ($url=~m{^http://}) { $ext='true'; } |
|
$url = &LONCAPA::map::qtunescape($url); |
$r->print('<form action="/adm/coursedocs" method="post" name="docslog">'.
|
my $comment=$env{'form.comment'}; |
'<input type="hidden" name="docslog" value="1" />');
|
$comment = &LONCAPA::map::qtunescape($comment); |
|
if ($folder=~/^supplemental/) { |
my %saveable_parameters = ('show' => 'scalar',);
|
$comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'. |
&Apache::loncommon::store_course_settings('docs_log',
|
$env{'user.domain'}.'___&&&___'.$comment; |
\%saveable_parameters);
|
} |
&Apache::loncommon::restore_course_settings('docs_log',
|
|
\%saveable_parameters);
|
$LONCAPA::map::resources[$newidx]= |
if (!$env{'form.show'}) { $env{'form.show'}=10; }
|
$comment.':'.$url.':'.$ext.':normal:res'; |
my %lt=('hiddenresource' => 'Resources hidden',
|
$LONCAPA::map::order[$#LONCAPA::map::order+1]= $newidx; |
'encrypturl' => 'URL hidden',
|
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
'randompick' => 'Randomly pick',
|
$folder.'.'.$container); |
'randomorder' => 'Randomly ordered',
|
if ($fatal) { |
'set' => 'set to',
|
$$upload_output = '<div class="LC_error" id="uploadfileresult">'.$errtext.'</div>'; |
'del' => 'deleted');
|
return; |
$r->print(&Apache::loncommon::display_filter().
|
} else { |
'<input type="hidden" name="folder" value="'.$folder.'" />'.
|
if ($parseaction eq 'parse' && $mimetype eq 'text/html') { |
'<input type="submit" value="'.&mt('Display').'" /></form>');
|
$$upload_output = $showupload; |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
|
my $total_embedded = scalar(keys(%{$allfiles})); |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Folder').'</th><th>'.&mt('Before').'</th><th>'.
|
if ($total_embedded > 0) { |
&mt('After').'</th>'.
|
my $uploadphase = 'upload_embedded'; |
&Apache::loncommon::end_data_table_header_row());
|
my $primaryurl = &HTML::Entities::encode($url,'<>&"'); |
my $shown=0;
|
my $state = &embedded_form_elems($uploadphase,$primaryurl,$newidx); |
foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) {
|
my ($embedded,$num) = |
if ($env{'form.displayfilter'} eq 'currentfolder') {
|
&Apache::loncommon::ask_for_embedded_content( |
if ($docslog{$id}{'logentry'}{'currentfolder'} ne $folder) { next; }
|
'/adm/coursedocs',$state,$allfiles,$codebase,{'docs_url' => $url}); |
}
|
if ($embedded) { |
my @changes=keys(%{$docslog{$id}{'logentry'}});
|
if ($num) { |
if ($env{'form.displayfilter'} eq 'containing') {
|
$$upload_output .= |
my $wholeentry=$docslog{$id}{'exe_uname'}.':'.$docslog{$id}{'exe_udom'}.':'.
|
'<p>'.&mt('This file contains embedded multimedia objects, which need to be uploaded.').'</p>'.$embedded; |
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'},$docslog{$id}{'exe_udom'});
|
$nextphase = $uploadphase; |
foreach my $key (@changes) {
|
} else { |
$wholeentry.=':'.$docslog{$id}{'logentry'}{$key};
|
$$upload_output .= $embedded; |
}
|
} |
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; }
|
} else { |
}
|
$$upload_output .= &mt('Embedded item(s) already present, so no additional upload(s) required').'<br />'; |
my $count = 0;
|
} |
my $time =
|
} else { |
&Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'});
|
$$upload_output .= &mt('No embedded items identified').'<br />'; |
my $plainname =
|
} |
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'},
|
$$upload_output = '<div id="uploadfileresult">'.$$upload_output.'</div>'; |
$docslog{$id}{'exe_udom'});
|
} elsif (&Apache::loncommon::is_archive_file($mimetype)) { |
my $about_me_link =
|
$nextphase = 'decompress_uploaded'; |
&Apache::loncommon::aboutmewrapper($plainname,
|
my $position = scalar(@LONCAPA::map::order)-1; |
$docslog{$id}{'exe_uname'},
|
my $noextract = &return_to_editor(); |
$docslog{$id}{'exe_udom'});
|
my $archiveurl = &HTML::Entities::encode($url,'<>&"'); |
my $send_msg_link='';
|
my %archiveitems = ( |
if ((($docslog{$id}{'exe_uname'} ne $env{'user.name'})
|
folderpath => $env{'form.folderpath'}, |
|| ($docslog{$id}{'exe_udom'} ne $env{'user.domain'}))) {
|
pagepath => $env{'form.pagepath'}, |
$send_msg_link ='<br />'.
|
cmd => $nextphase, |
&Apache::loncommon::messagewrapper(&mt('Send message'),
|
newidx => $newidx, |
$docslog{$id}{'exe_uname'},
|
position => $position, |
$docslog{$id}{'exe_udom'});
|
phase => $nextphase, |
}
|
comment => $comment, |
$r->print(&Apache::loncommon::start_data_table_row());
|
); |
$r->print('<td>'.$time.'</td>
|
my ($destination,$dir_root) = &embedded_destination($coursenum,$coursedom); |
<td>'.$about_me_link.
|
my @current = &get_dir_list($url,$coursenum,$coursedom,$newidx); |
'<br /><tt>'.$docslog{$id}{'exe_uname'}.
|
$$upload_output = $showupload. |
':'.$docslog{$id}{'exe_udom'}.'</tt>'.
|
&Apache::loncommon::decompress_form($mimetype, |
$send_msg_link.'</td><td>'.
|
$archiveurl,'/adm/coursedocs',$noextract, |
$docslog{$id}{'logentry'}{'folder'}.'</td><td>');
|
\%archiveitems,\@current); |
# Before
|
} |
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) {
|
} |
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0];
|
} |
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0];
|
return $nextphase; |
if ($oldname ne $newname) {
|
} |
$r->print(&LONCAPA::map::qtescape($oldname));
|
|
}
|
sub get_dir_list { |
}
|
my ($url,$coursenum,$coursedom,$newidx) = @_; |
$r->print('<ul>');
|
my ($destination,$dir_root) = &embedded_destination(); |
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) {
|
my ($dirlistref,$listerror) = |
if ($docslog{$id}{'logentry'}{'before_order_res_'.$idx}) {
|
&Apache::lonnet::dirlist("$dir_root/$destination/$newidx",$coursedom,$coursenum,1); |
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'before_order_res_'.$idx}))[0]).'</li>');
|
my @dir_lines; |
}
|
my $dirptr=16384; |
}
|
if (ref($dirlistref) eq 'ARRAY') { |
$r->print('</ul>');
|
foreach my $dir_line (sort |
# After
|
{ |
$r->print('</td><td>');
|
my ($afile)=split('&',$a,2); |
|
my ($bfile)=split('&',$b,2); |
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) {
|
return (lc($afile) cmp lc($bfile)); |
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0];
|
} (@{$dirlistref})) { |
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0];
|
my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$dir_line,16); |
if ($oldname ne '' && $oldname ne $newname) {
|
$filename =~ s/\s+$//; |
$r->print(&LONCAPA::map::qtescape($newname));
|
next if ($filename =~ /^\.\.?$/); |
}
|
my $isdir = 0; |
}
|
if ($dirptr&$testdir) { |
$r->print('<ul>');
|
$isdir = 1; |
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) {
|
} |
if ($docslog{$id}{'logentry'}{'after_order_res_'.$idx}) {
|
push(@dir_lines, [$filename,$dom,$isdir,$size,$mtime,$obs]); |
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'after_order_res_'.$idx}))[0]).'</li>');
|
} |
}
|
} |
}
|
return @dir_lines; |
$r->print('</ul>');
|
} |
if ($docslog{$id}{'logentry'}{'parameter_res'}) {
|
|
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>');
|
sub is_supplemental_title { |
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') {
|
my ($title) = @_; |
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {
|
return scalar($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/); |
$r->print('<li>'.
|
} |
&mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]',
|
|
$docslog{$id}{'logentry'}{'parameter_value_'.$parameter})
|
sub parse_supplemental_title { |
.'</li>');
|
my ($title) = @_; |
}
|
|
}
|
my ($foldertitle,$renametitle); |
$r->print('</ul>');
|
if ($title =~ /&&&/) { |
}
|
$title = &HTML::Entites::decode($title); |
# End
|
} |
$r->print('</td>'.&Apache::loncommon::end_data_table_row());
|
if ($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/) { |
$shown++;
|
$renametitle=$4; |
if (!($env{'form.show'} eq &mt('all')
|
my ($time,$uname,$udom) = ($1,$2,$3); |
|| $shown<=$env{'form.show'})) { last; }
|
$foldertitle=&Apache::lontexconvert::msgtexconverted($4); |
}
|
my $name = &Apache::loncommon::plainname($uname,$udom); |
$r->print(&Apache::loncommon::end_data_table());
|
$name = &HTML::Entities::encode($name,'"<>&\''); |
}
|
$renametitle = &HTML::Entities::encode($renametitle,'"<>&\''); |
|
$title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '. |
sub update_paste_buffer {
|
$name.': <br />'.$foldertitle; |
my ($coursenum,$coursedom) = @_;
|
} |
|
if (wantarray) { |
return if (!defined($env{'form.markcopy'}));
|
return ($title,$foldertitle,$renametitle); |
return if (!defined($env{'form.copyfolder'}));
|
} |
return if ($env{'form.markcopy'} < 0);
|
return $title; |
|
} |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
|
|
$env{'form.copyfolder'});
|
# --------------------------------------------------------------- An entry line |
|
|
return if ($fatal);
|
sub entryline { |
|
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_; |
# Mark for copying
|
my ($foldertitle,$pagetitle,$renametitle); |
my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]);
|
if (&is_supplemental_title($title)) { |
if (&is_supplemental_title($title)) {
|
($title,$foldertitle,$renametitle) = &parse_supplemental_title($title); |
&Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title});
|
$pagetitle = $foldertitle; |
($title) = &parse_supplemental_title($title);
|
} else { |
} elsif ($env{'docs.markedcopy_supplemental'}) {
|
$title=&HTML::Entities::encode($title,'"<>&\''); |
&Apache::lonnet::delenv('docs\\.markedcopy_supplemental');
|
$renametitle=$title; |
}
|
$foldertitle=$title; |
$url=~s{http(:|:)//https(:|:)//}{https$2//};
|
$pagetitle=$title; |
|
} |
&Apache::lonnet::appenv({'docs.markedcopy_title' => $title,
|
|
'docs.markedcopy_url' => $url});
|
my $orderidx=$LONCAPA::map::order[$index]; |
delete($env{'form.markcopy'});
|
|
}
|
|
|
$renametitle=~s/\\/\\\\/g; |
sub print_paste_buffer {
|
$renametitle=~s/\"\;/\\\"/g; |
my ($r,$container) = @_;
|
$renametitle=~s/ /%20/g; |
return if (!defined($env{'docs.markedcopy_url'}));
|
my $line=&Apache::loncommon::start_data_table_row(); |
|
my ($form_start,$form_end,$form_common); |
$r->print(<<ENDPASTE);
|
# Edit commands |
<form name="pasteform" action="/adm/coursedocs" method="post"><p>
|
my ($container, $type, $esc_path, $path, $symb); |
ENDPASTE
|
if ($env{'form.folderpath'}) { |
$r->print('<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> ');
|
$type = 'folder'; |
|
$container = 'sequence'; |
my $type;
|
$esc_path=&escape($env{'form.folderpath'}); |
if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) {
|
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
$type = &mt('External Resource');
|
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
$r->print($type.': '.
|
} |
&LONCAPA::map::qtescape($env{'docs.markedcopy_title'}).' ('.
|
if ($env{'form.pagepath'}) { |
&LONCAPA::map::qtescape($env{'docs.markedcopy_url'}).')');
|
$type = $container = 'page'; |
} else {
|
$esc_path=&escape($env{'form.pagepath'}); |
my $extension = (split(/\./,$env{'docs.markedcopy_url'}))[-1];
|
$path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"'); |
my $icon = &Apache::loncommon::icon($extension);
|
$symb=&escape($env{'form.pagesymb'}); |
if ($extension eq 'sequence' &&
|
} |
$env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) {
|
my $cpinfo=''; |
$icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
|
if ($allowed) { |
$icon .= '/folder_closed.gif';
|
my $incindex=$index+1; |
}
|
my $selectbox=''; |
$icon = '<img src="'.$icon.'" alt="" class="LC_icon" />';
|
if (($#LONCAPA::map::order>0) && |
$r->print($icon.$type.': '. &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'})));
|
((split(/\:/, |
}
|
$LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] |
if ($container eq 'page') {
|
ne '') && |
$r->print('
|
((split(/\:/, |
<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />
|
$LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] |
<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />
|
ne '')) { |
');
|
$selectbox= |
} else {
|
'<input type="hidden" name="currentpos" value="'.$incindex.'" />'. |
$r->print('
|
'<select name="newpos" onchange="this.form.submit()">'; |
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
|
for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) { |
');
|
if ($i==$incindex) { |
}
|
$selectbox.='<option value="" selected="selected">('.$i.')</option>'; |
$r->print('</p></form>');
|
} else { |
}
|
$selectbox.='<option value="'.$i.'">'.$i.'</option>'; |
|
} |
sub do_paste_from_buffer {
|
} |
my ($coursenum,$coursedom,$folder) = @_;
|
$selectbox.='</select>'; |
|
} |
if (!$env{'form.pastemarked'}) {
|
my %lt=&Apache::lonlocal::texthash( |
return;
|
'up' => 'Move Up', |
}
|
'dw' => 'Move Down', |
|
'rm' => 'Remove', |
# paste resource to end of list
|
'ct' => 'Cut', |
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'});
|
'rn' => 'Rename', |
my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'});
|
'cp' => 'Copy'); |
# Maps need to be copied first
|
my $nocopy=0; |
if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) {
|
my $nocut=0; |
$title=&mt('Copy of').' '.$title;
|
if ($url=~/\.(page|sequence)$/) { |
my $newid=$$.int(rand(100)).time;
|
if ($url =~ m{/res/}) { |
my ($oldid,$ext) = ($url=~/^(.+)\.(\w+)$/);
|
# no copy for published maps |
if ($oldid =~ m{^(/uploaded/\Q$coursedom\E/\Q$coursenum\E/)(\D+)(\d+)$}) {
|
$nocopy = 1; |
my $path = $1;
|
} else { |
my $prefix = $2;
|
foreach my $item (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url),1)) { |
my $ancestor = $3;
|
my ($title,$url,$ext,$type)=split(/\:/,$item); |
if (length($ancestor) > 10) {
|
if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) { |
$ancestor = substr($ancestor,-10,10);
|
$nocopy=1; |
}
|
last; |
$oldid = $path.$prefix.$ancestor;
|
} |
}
|
} |
my $counter = 0;
|
} |
my $newurl=$oldid.$newid.'.'.$ext;
|
} |
my $is_unique = &uniqueness_check($newurl);
|
if ($url=~/^\/res\/lib\/templates\//) { |
while (!$is_unique && $counter < 100) {
|
$nocopy=1; |
$counter ++;
|
$nocut=1; |
$newid ++;
|
} |
$newurl = $oldid.$newid;
|
my $copylink=' '; |
$is_unique = &uniqueness_check($newurl);
|
my $cutlink=' '; |
}
|
|
if (!$is_unique) {
|
my $skip_confirm = 0; |
if ($url=~/\.page$/) {
|
if ( $folder =~ /^supplemental/ |
return &mt('Paste failed: an error occurred creating a unique URL for the composite page');
|
|| ($url =~ m{( /smppg$ |
} else {
|
|/syllabus$ |
return &mt('Paste failed: an error occurred creating a unique URL for the folder');
|
|/aboutme$ |
}
|
|/navmaps$ |
}
|
|/bulletinboard$ |
my $storefn=$newurl;
|
|\.html$ |
$storefn=~s{^/\w+/$match_domain/$match_username/}{};
|
|^/adm/wrapper/ext)}x)) { |
my $paste_map_result =
|
$skip_confirm = 1; |
&Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn,
|
} |
&Apache::lonnet::getfile($url));
|
|
if ($paste_map_result eq '/adm/notfound.html') {
|
if (!$nocopy) { |
if ($url=~/\.page$/) {
|
$copylink=(<<ENDCOPY); |
return &mt('Paste failed: an error occurred saving the composite page');
|
<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a> |
} else {
|
ENDCOPY |
return &mt('Paste failed: an error occurred saving the folder');
|
} |
}
|
if (!$nocut) { |
}
|
$cutlink=(<<ENDCUT); |
$url = $newurl;
|
<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a> |
}
|
ENDCUT |
# published maps can only exists once, so remove it from paste buffer when done
|
} |
if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) {
|
$form_start = ' |
&Apache::lonnet::delenv('docs\\.markedcopy');
|
<form action="/adm/coursedocs" method="post"> |
}
|
'; |
if ($url=~ m{/smppg$}) {
|
$form_common=(<<END); |
my $db_name = &Apache::lonsimplepage::get_db_name($url);
|
<input type="hidden" name="${type}path" value="$path" /> |
if ($db_name =~ /^smppage_/) {
|
<input type="hidden" name="${type}symb" value="$symb" /> |
#simple pages, need to copy the db contents to a new one.
|
<input type="hidden" name="setparms" value="$orderidx" /> |
my %contents=&Apache::lonnet::dump($db_name,$coursedom,$coursenum);
|
<input type="hidden" name="changeparms" value="0" /> |
my $now = time();
|
END |
$db_name =~ s{_\d*$ }{_$now}x;
|
$form_end = '</form>'; |
my $result=&Apache::lonnet::put($db_name,\%contents,
|
$line.=(<<END); |
$coursedom,$coursenum);
|
<td> |
$url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
|
<div class="LC_docs_entry_move"> |
$title=&mt('Copy of').' '.$title;
|
<a href='/adm/coursedocs?cmd=up_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'> |
}
|
<img src="${iconpath}move_up.gif" alt='$lt{'up'}' class="LC_icon" /> |
}
|
</a> |
$title = &LONCAPA::map::qtunescape($title);
|
</div> |
my $ext='false';
|
<div class="LC_docs_entry_move"> |
if ($url=~m{^http(|s)://}) { $ext='true'; }
|
<a href='/adm/coursedocs?cmd=down_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'> |
$url = &LONCAPA::map::qtunescape($url);
|
<img src="${iconpath}move_down.gif" alt='$lt{'dw'}' class="LC_icon" /> |
# Now insert the URL at the bottom
|
</a> |
my $newidx = &LONCAPA::map::getresidx($url);
|
</div> |
if ($env{'docs.markedcopy_supplemental'}) {
|
</td> |
if ($folder =~ /^supplemental/) {
|
<td> |
$title = $env{'docs.markedcopy_supplemental'};
|
$form_start |
} else {
|
$form_common |
(undef,undef,$title) =
|
$selectbox |
&parse_supplemental_title($env{'docs.markedcopy_supplemental'});
|
$form_end |
}
|
</td> |
} else {
|
<td class="LC_docs_entry_commands"> |
if ($folder=~/^supplemental/) {
|
<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a> |
$title=time.'___&&&___'.$env{'user.name'}.'___&&&___'.
|
$cutlink |
$env{'user.domain'}.'___&&&___'.$title;
|
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a> |
}
|
$copylink |
}
|
</td> |
|
END |
$LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res';
|
|
push(@LONCAPA::map::order, $newidx);
|
} |
return 'ok';
|
# Figure out what kind of a resource this is |
# Store the result
|
my ($extension)=($url=~/\.(\w+)$/); |
}
|
my $uploaded=($url=~/^\/*uploaded\//); |
|
my $icon=&Apache::loncommon::icon($url); |
sub uniqueness_check {
|
my $isfolder=0; |
my ($newurl) = @_;
|
my $ispage=0; |
my $unique = 1;
|
my $folderarg; |
foreach my $res (@LONCAPA::map::order) {
|
my $pagearg; |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
|
my $pagefile; |
$url=&LONCAPA::map::qtescape($url);
|
if ($uploaded) { |
if ($newurl eq $url) {
|
if (($extension eq 'sequence') || ($extension eq 'page')) { |
$unique = 0;
|
$url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/; |
last;
|
my $containerarg = $1; |
}
|
if ($extension eq 'sequence') { |
}
|
$icon=$iconpath.'navmap.folder.closed.gif'; |
return $unique;
|
$folderarg=$containerarg; |
}
|
$isfolder=1; |
|
} else { |
my %parameter_type = ( 'randompick' => 'int_pos',
|
$icon=$iconpath.'page.gif'; |
'hiddenresource' => 'string_yesno',
|
$pagearg=$containerarg; |
'encrypturl' => 'string_yesno',
|
$ispage=1; |
'randomorder' => 'string_yesno',);
|
} |
my $valid_parameters_re = join('|',keys(%parameter_type));
|
if ($allowed) { |
# set parameters
|
$url='/adm/coursedocs?'; |
sub update_parameter {
|
} else { |
|
$url='/adm/supplemental?'; |
return 0 if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/);
|
} |
|
} else { |
my $which = $env{'form.changeparms'};
|
&Apache::lonnet::allowuploaded('/adm/coursedoc',$url); |
my $idx = $env{'form.setparms'};
|
} |
if ($env{'form.'.$which.'_'.$idx}) {
|
} |
my $value = ($which eq 'randompick') ? $env{'form.'.$which.'_'.$idx}
|
|
: 'yes';
|
my $orig_url = $url; |
&LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value,
|
$orig_url=~s{http(:|:)//https(:|:)//}{https$2//}; |
$parameter_type{$which});
|
my $external = ($url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/}); |
&remember_parms($idx,$which,'set',$value);
|
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/) && (!$ispage)) { |
} else {
|
my $symb=&Apache::lonnet::symbclean( |
&LONCAPA::map::delparameter($idx,'parameter_'.$which);
|
&Apache::lonnet::declutter('uploaded/'. |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'. |
&remember_parms($idx,$which,'del');
|
$env{'course.'.$env{'request.course.id'}.'.num'}.'/'.$folder. |
}
|
'.sequence'). |
return 1;
|
'___'.$residx.'___'. |
}
|
&Apache::lonnet::declutter($url)); |
|
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
|
$url=&Apache::lonnet::clutter($url); |
sub handle_edit_cmd {
|
if ($url=~/^\/*uploaded\//) { |
my ($coursenum,$coursedom) =@_;
|
$url=~/\.(\w+)$/; |
|
my $embstyle=&Apache::loncommon::fileembstyle($1); |
my ($cmd,$idx)=split('_',$env{'form.cmd'});
|
if (($embstyle eq 'img') || ($embstyle eq 'emb')) { |
|
$url='/adm/wrapper'.$url; |
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]];
|
} elsif ($embstyle eq 'ssi') { |
my ($title, $url, @rrest) = split(':', $ratstr);
|
#do nothing with these |
|
} elsif ($url!~/\.(sequence|page)$/) { |
if ($cmd eq 'del') {
|
$url='/adm/coursedocs/showdoc'.$url; |
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
|
} |
($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) {
|
} elsif ($url=~m|^/ext/|) { |
&Apache::lonnet::removeuploadedurl($url);
|
$url='/adm/wrapper'.$url; |
} else {
|
$external = 1; |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
|
} |
}
|
if (&Apache::lonnet::symbverify($symb,$url)) { |
splice(@LONCAPA::map::order, $idx, 1);
|
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
|
} else { |
} elsif ($cmd eq 'cut') {
|
$url=''; |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
|
} |
splice(@LONCAPA::map::order, $idx, 1);
|
if ($container eq 'page') { |
|
my $symb=$env{'form.pagesymb'}; |
} elsif ($cmd eq 'up'
|
|
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) {
|
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]); |
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1];
|
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
|
} |
} elsif ($cmd eq 'down'
|
} |
&& defined($LONCAPA::map::order[$idx+1])) {
|
my ($rand_pick_text,$rand_order_text); |
@LONCAPA::map::order[$idx+1,$idx] = @LONCAPA::map::order[$idx,$idx+1];
|
if ($isfolder || $extension eq 'sequence') { |
|
my $foldername=&escape($foldertitle); |
} elsif ($cmd eq 'rename') {
|
my $folderpath=$env{'form.folderpath'}; |
|
if ($folderpath) { $folderpath.='&' }; |
my $comment = &LONCAPA::map::qtunescape($env{'form.title'});
|
# Append randompick number, hidden, and encrypted with ":" to foldername, |
if ($comment=~/\S/) {
|
# so it gets transferred between levels |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]=
|
$folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx, |
$comment.':'.join(':', $url, @rrest);
|
'parameter_randompick'))[0] |
}
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
# Devalidate title cache
|
'parameter_hiddenresource'))[0]=~/^yes$/i) |
my $renamed_url=&LONCAPA::map::qtescape($url);
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
&Apache::lonnet::devalidate_title_cache($renamed_url);
|
'parameter_encrypturl'))[0]=~/^yes$/i) |
} else {
|
.':'.((&LONCAPA::map::getparameter($orderidx, |
return 0;
|
'parameter_randomorder'))[0]=~/^yes$/i); |
}
|
$url.='folderpath='.&escape($folderpath).$cpinfo; |
return 1;
|
my $rpicknum = (&LONCAPA::map::getparameter($orderidx, |
}
|
'parameter_randompick'))[0]; |
|
my $rpckchk; |
sub editor {
|
if ($rpicknum) { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;
|
$rpckchk = ' checked="checked"'; |
|
} |
my $container= ($env{'form.pagepath'}) ? 'page'
|
my $formname = 'edit_rpick_'.$orderidx; |
: 'sequence';
|
$rand_pick_text = |
|
'<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n". |
my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
|
$form_common."\n". |
$folder.'.'.$container);
|
'<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.'" />'; |
return $errtext if ($fatal);
|
if ($rpicknum ne '') { |
|
$rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>'; |
if ($#LONCAPA::map::order<1) {
|
} |
my $idx=&LONCAPA::map::getresidx();
|
$rand_pick_text .= '</span></form>'; |
if ($idx<=0) { $idx=1; }
|
my $ro_set= |
$LONCAPA::map::order[0]=$idx;
|
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); |
$LONCAPA::map::resources[$idx]='';
|
$rand_order_text = |
}
|
$form_start. |
|
$form_common.' |
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
|
<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>'; |
&breadcrumbs($folder,$allowed,$type);
|
} |
$r->print($breadcrumbtrail);
|
if ($ispage) { |
|
my $pagename=&escape($pagetitle); |
# ------------------------------------------------------------ Process commands
|
my $pagepath; |
|
my $folderpath=$env{'form.folderpath'}; |
# ---------------- if they are for this folder and user allowed to make changes
|
if ($folderpath) { $pagepath = $folderpath.'&' }; |
if (($allowed) && ($env{'form.folder'} eq $folder)) {
|
$pagepath.=$pagearg.'&'.$pagename; |
# set parameters and change order
|
my $symb=$env{'form.pagesymb'}; |
&snapshotbefore();
|
if (!$symb) { |
|
my $path='uploaded/'. |
if (&update_parameter()) {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'. |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
|
$env{'course.'.$env{'request.course.id'}.'.num'}.'/'; |
return $errtext if ($fatal);
|
$symb=&Apache::lonnet::encode_symb($path.$folder.'.sequence', |
}
|
$residx, |
|
$path.$pagearg.'.page'); |
if ($env{'form.newpos'} && $env{'form.currentpos'}) {
|
} |
# change order
|
$url.='pagepath='.&escape($pagepath). |
my $res = splice(@LONCAPA::map::order,$env{'form.currentpos'}-1,1);
|
'&pagesymb='.&escape($symb).$cpinfo; |
splice(@LONCAPA::map::order,$env{'form.newpos'}-1,0,$res);
|
} |
|
if (($external) && ($allowed)) { |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
|
my $form = ($folder =~ /^default/)? 'newext' : 'supnewext'; |
return $errtext if ($fatal);
|
$external = ' <a class="LC_docs_ext_edit" href="javascript:edittext(\''.$form.'\',\''.$residx.'\',\''.&escape($title).'\',\''.&escape($orig_url).'\');" >'.&mt('Edit').'</a>'; |
}
|
} else { |
|
undef($external); |
if ($env{'form.pastemarked'}) {
|
} |
my $paste_res =
|
my $reinit; |
&do_paste_from_buffer($coursenum,$coursedom,$folder);
|
if ($crstype eq 'Community') { |
if ($paste_res eq 'ok') {
|
$reinit = &mt('(re-initialize community to access)'); |
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container);
|
} else { |
return $errtext if ($fatal);
|
$reinit = &mt('(re-initialize course to access)'); |
} elsif ($paste_res ne '') {
|
} |
$r->print('<p><span class="LC_error">'.$paste_res.'</span></p>');
|
$line.='<td>'; |
}
|
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
}
|
$line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>'; |
|
} elsif ($url) { |
$r->print($upload_output);
|
$line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes', |
|
'<img src="'.$icon.'" alt="" class="LC_icon" />',600,500); |
if (&handle_edit_cmd()) {
|
} else { |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
|
$line.='<img src="'.$icon.'" alt="" class="LC_icon" />'; |
return $errtext if ($fatal);
|
} |
}
|
$line.='</td><td>'; |
# Group import/search
|
if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { |
if ($env{'form.importdetail'}) {
|
$line.='<a href="'.$url.'">'.$title.'</a>'; |
my @imports;
|
} elsif ($url) { |
foreach my $item (split(/\&/,$env{'form.importdetail'})) {
|
$line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes', |
if (defined($item)) {
|
$title,600,500); |
my ($name,$url,$residx)=
|
} else { |
map {&unescape($_)} split(/\=/,$item);
|
$line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>'; |
push(@imports, [$name, $url, $residx]);
|
} |
}
|
$line.=$external."</td>"; |
}
|
$rand_pick_text = ' ' if ($rand_pick_text eq ''); |
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder,
|
$rand_order_text = ' ' if ($rand_order_text eq ''); |
$container,'londocs',@imports);
|
if (($allowed) && ($folder!~/^supplemental/)) { |
return $errtext if ($fatal);
|
my %lt=&Apache::lonlocal::texthash( |
}
|
'hd' => 'Hidden', |
# Loading a complete map
|
'ec' => 'URL hidden'); |
if ($env{'form.loadmap'}) {
|
my $enctext= |
if ($env{'form.importmap'}=~/\w/) {
|
((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':''); |
foreach my $res (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) {
|
my $hidtext= |
my ($title,$url,$ext,$type)=split(/\:/,$res);
|
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); |
my $idx=&LONCAPA::map::getresidx($url);
|
$line.=(<<ENDPARMS); |
$LONCAPA::map::resources[$idx]=$res;
|
<td class="LC_docs_entry_parameter"> |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx;
|
$form_start |
}
|
$form_common |
($errtext,$fatal)=&storemap($coursenum,$coursedom,
|
<label><input type="checkbox" name="hiddenresource_$orderidx" onclick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label> |
$folder.'.'.$container);
|
$form_end |
return $errtext if ($fatal);
|
<br /> |
} else {
|
$form_start |
$r->print('<p><span class="LC_error">'.&mt('No map selected.').'</span></p>');
|
$form_common |
|
<label><input type="checkbox" name="encrypturl_$orderidx" onclick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label> |
}
|
$form_end |
}
|
</td> |
&log_differences($plain);
|
<td class="LC_docs_entry_parameter">$rand_pick_text<br /> |
}
|
$rand_order_text</td> |
# ---------------------------------------------------------------- End commands
|
ENDPARMS |
# ---------------------------------------------------------------- Print screen
|
} |
my $idx=0;
|
$line.=&Apache::loncommon::end_data_table_row(); |
my $shown=0;
|
return $line; |
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {
|
} |
$r->print('<p>'.&mt('Parameters').':<ul>'.
|
|
($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':'').
|
=pod |
($ishidden?'<li>'.&mt('contents hidden').'</li>':'').
|
|
($isencrypted?'<li>'.&mt('URLs hidden').'</li>':'').
|
=item tiehash() |
'</ul></p>');
|
|
}
|
tie the hash |
if ($randompick>=0) {
|
|
$r->print('<p>'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'</p>');
|
=cut |
}
|
|
if ($is_random_order) {
|
sub tiehash { |
$r->print('<p>'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown.').'</p>');
|
my ($mode)=@_; |
}
|
$hashtied=0; |
$r->print('<table class="LC_docs_editor">');
|
if ($env{'request.course.fn'}) { |
foreach my $res (@LONCAPA::map::order) {
|
if ($mode eq 'write') { |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
|
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db", |
$name=&LONCAPA::map::qtescape($name);
|
&GDBM_WRCREAT(),0640)) { |
$url=&LONCAPA::map::qtescape($url);
|
$hashtied=2; |
unless ($name) { $name=(split(/\//,$url))[-1]; }
|
} |
unless ($name) { $idx++; next; }
|
} else { |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res,
|
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db", |
$coursenum));
|
&GDBM_READER(),0640)) { |
$idx++;
|
$hashtied=1; |
$shown++;
|
} |
}
|
} |
unless ($shown) {
|
} |
$r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>');
|
} |
}
|
|
$r->print("\n</table>\n");
|
sub untiehash { |
if ($allowed) {
|
if ($hashtied) { untie %hash; } |
&print_paste_buffer($r,$container);
|
$hashtied=0; |
}
|
return OK; |
return;
|
} |
}
|
|
|
|
sub process_file_upload {
|
|
my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
|
|
# upload a file, if present
|
sub checkonthis { |
my $parseaction;
|
my ($r,$url,$level,$title)=@_; |
if ($env{'form.parserflag'}) {
|
$url=&unescape($url); |
$parseaction = 'parse';
|
$alreadyseen{$url}=1; |
}
|
$r->rflush(); |
my $phase_status;
|
if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) { |
my $folder=$env{'form.folder'};
|
$r->print("\n<br />"); |
if ($folder eq '') {
|
if ($level==0) { |
$folder='default';
|
$r->print("<br />"); |
}
|
} |
if ( ($folder=~/^$uploadcmd/) || ($uploadcmd eq 'default') ) {
|
for (my $i=0;$i<=$level*5;$i++) { |
my $errtext='';
|
$r->print(' '); |
my $fatal=0;
|
} |
my $container='sequence';
|
$r->print('<a href="'.$url.'" target="cat">'. |
if ($env{'form.pagepath'}) {
|
($title?$title:$url).'</a> '); |
$container='page';
|
if ($url=~/^\/res\//) { |
}
|
my $result=&Apache::lonnet::repcopy( |
($errtext,$fatal)=
|
&Apache::lonnet::filelocation('',$url)); |
&mapread($coursenum,$coursedom,$folder.'.'.$container);
|
if ($result eq 'ok') { |
if ($#LONCAPA::map::order<1) {
|
$r->print('<span class="LC_success">'.&mt('ok').'</span>'); |
$LONCAPA::map::order[0]=1;
|
$r->rflush(); |
$LONCAPA::map::resources[1]='';
|
&Apache::lonnet::countacc($url); |
}
|
$url=~/\.(\w+)$/; |
if ($fatal) {
|
if (&Apache::loncommon::fileembstyle($1) eq 'ssi') { |
return 'failed';
|
$r->print('<br />'); |
}
|
$r->rflush(); |
my $destination = 'docs/';
|
for (my $i=0;$i<=$level*5;$i++) { |
if ($folder =~ /^supplemental/) {
|
$r->print(' '); |
$destination = 'supplemental/';
|
} |
}
|
$r->print('- '.&mt('Rendering:').' '); |
if (($folder eq 'default') || ($folder eq 'supplemental')) {
|
my ($errorcount,$warningcount)=split(/:/, |
$destination .= 'default/';
|
&Apache::lonnet::ssi_body($url, |
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
|
('grade_target'=>'web', |
$destination .= $2.'/';
|
'return_only_error_and_warning_counts' => 1))); |
}
|
if (($errorcount) || |
# this is for a course, not a user, so set coursedoc flag
|
($warningcount)) { |
# probably the only place in the system where this should be "1"
|
if ($errorcount) { |
my $newidx=&LONCAPA::map::getresidx();
|
$r->print('<img src="/adm/lonMisc/bomb.gif" alt="'.&mt('bomb').'" /><span class="LC_error">'. |
$destination .= $newidx;
|
&mt('[quant,_1,error]',$errorcount).'</span>'); |
my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination,
|
} |
$parseaction,$allfiles,
|
if ($warningcount) { |
$codebase);
|
$r->print('<span class="LC_warning">'. |
my $ext='false';
|
&mt('[quant,_1,warning]',$warningcount).'</span>'); |
if ($url=~m{^http://}) { $ext='true'; }
|
} |
$url = &LONCAPA::map::qtunescape($url);
|
} else { |
my $comment=$env{'form.comment'};
|
$r->print('<span class="LC_success">'.&mt('ok').'</span>'); |
$comment = &LONCAPA::map::qtunescape($comment);
|
} |
if ($folder=~/^supplemental/) {
|
$r->rflush(); |
$comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'.
|
} |
$env{'user.domain'}.'___&&&___'.$comment;
|
my $dependencies= |
}
|
&Apache::lonnet::metadata($url,'dependencies'); |
|
foreach my $dep (split(/\,/,$dependencies)) { |
$LONCAPA::map::resources[$newidx]=
|
if (($dep=~/^\/res\//) && (!$alreadyseen{$dep})) { |
$comment.':'.$url.':'.$ext.':normal:res';
|
&checkonthis($r,$dep,$level+1); |
$LONCAPA::map::order[$#LONCAPA::map::order+1]= $newidx;
|
} |
($errtext,$fatal)=&storemap($coursenum,$coursedom,
|
} |
$folder.'.'.$container);
|
} elsif ($result eq 'unavailable') { |
if ($fatal) {
|
$r->print('<span class="LC_error">'.&mt('connection down').'</span>'); |
$$upload_output .= '<p><span class="LC_error">'.$errtext.'</span></p>';
|
} elsif ($result eq 'not_found') { |
return 'failed';
|
unless ($url=~/\$/) { |
} else {
|
$r->print('<span class="LC_error">'.&mt('not found').'</b></span>'); |
if ($parseaction eq 'parse') {
|
} else { |
my $total_embedded = keys(%{$allfiles});
|
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>'); |
if ($total_embedded > 0) {
|
} |
my $num = 0;
|
} else { |
my $state = '
|
$r->print('<span class="LC_error">'.&mt('access denied').'</span>'); |
<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
|
} |
<input type="hidden" name="cmd" value="upload_embedded" />
|
} |
<input type="hidden" name="newidx" value="'.$newidx.'" />
|
} |
<input type="hidden" name="primaryurl" value="'.&escape($url).'" />
|
} |
<input type="hidden" name="phasetwo" value="'.$total_embedded.'" />';
|
|
$phase_status = 'phasetwo';
|
|
|
|
$$upload_output .=
|
=pod |
'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'.
|
|
&Apache::loncommon::ask_for_embedded_content(
|
=item list_symbs() |
'/adm/coursedocs',$state,$allfiles,$codebase);
|
|
} else {
|
List Content Idenifiers |
$$upload_output .= 'No embedded items identified<br />';
|
|
}
|
=cut |
}
|
|
}
|
sub list_symbs { |
}
|
my ($r) = @_; |
return $phase_status;
|
|
}
|
my $crstype = &Apache::loncommon::course_type(); |
|
$r->print(&Apache::loncommon::start_page('List of Content Identifiers')); |
sub process_secondary_uploads {
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content Identifiers')); |
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_;
|
$r->print(&startContentScreen('tools')); |
my $folder=$env{'form.folder'};
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $destination = 'docs/';
|
if (!defined($navmap)) { |
if ($folder =~ /^supplemental/) {
|
$r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'. |
$destination = 'supplemental/';
|
'<div class="LC_error">'. |
}
|
&mt('Unable to retrieve information about course contents'). |
if (($folder eq 'default') || ($folder eq 'supplemental')) {
|
'</div>'); |
$destination .= 'default/';
|
&Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); |
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
|
} else { |
$destination .= $2.'/';
|
$r->print('<h4 class="LC_info">'.&mt("$crstype Content Identifiers").'</h4>'. |
}
|
&Apache::loncommon::start_data_table(). |
$destination .= $newidx;
|
&Apache::loncommon::start_data_table_header_row(). |
my ($url,$filename);
|
'<th>'.&mt('Title').'</th><th>'.&mt('Identifier').'</th>'. |
$url=&Apache::lonnet::userfileupload($formname.$num,1,$destination);
|
&Apache::loncommon::end_data_table_header_row()."\n"); |
($filename) = ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/\Q$destination\E/(.+)$});
|
my $count; |
return $filename;
|
foreach my $res ($navmap->retrieveResources()) { |
}
|
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<td>'.$res->compTitle().'</td>'. |
sub is_supplemental_title {
|
'<td>'.$res->symb().'</td>'. |
my ($title) = @_;
|
&Apache::loncommon::start_data_table_row()); |
return scalar($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/);
|
$count ++; |
}
|
} |
|
if (!$count) { |
sub parse_supplemental_title {
|
$r->print(&Apache::loncommon::start_data_table_row(). |
my ($title) = @_;
|
'<td colspan="2">'.&mt("$crstype is empty").'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
my ($foldertitle,$renametitle);
|
} |
if ($title =~ /&&&/) {
|
$r->print(&Apache::loncommon::end_data_table()); |
$title = &HTML::Entites::decode($title);
|
} |
}
|
} |
if ($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/) {
|
|
$renametitle=$4;
|
|
my ($time,$uname,$udom) = ($1,$2,$3);
|
sub verifycontent { |
$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
|
my ($r) = @_; |
my $name = &Apache::loncommon::plainname($uname,$udom);
|
my $crstype = &Apache::loncommon::course_type(); |
$name = &HTML::Entities::encode($name,'"<>&\'');
|
$r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents')); |
$title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents')); |
$name.': <br />'.$foldertitle;
|
$r->print(&startContentScreen('tools')); |
}
|
$r->print('<h4 class="LC_info">'.&mt($crstype.' content verification').'</h4>'); |
if (wantarray) {
|
$hashtied=0; |
return ($title,$foldertitle,$renametitle);
|
undef %alreadyseen; |
}
|
%alreadyseen=(); |
return $title;
|
&tiehash(); |
}
|
|
|
foreach my $key (keys(%hash)) { |
# --------------------------------------------------------------- An entry line
|
if ($hash{$key}=~/\.(page|sequence)$/) { |
|
if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) { |
sub entryline {
|
$r->print('<hr /><span class="LC_error">'. |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
|
&mt('The following sequence or page is included more than once in your '.$crstype.':').' '. |
|
&unescape($hash{$key}).'</span><br />'. |
my ($foldertitle,$pagetitle,$renametitle);
|
&mt('Note that grading records for problems included in this sequence or folder will overlap.').'<hr />'); |
if (&is_supplemental_title($title)) {
|
} |
($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);
|
} |
$pagetitle = $foldertitle;
|
if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) { |
} else {
|
&checkonthis($r,$hash{$key},0,$hash{'title_'.$1}); |
$title=&HTML::Entities::encode($title,'"<>&\'');
|
} |
$renametitle=$title;
|
} |
$foldertitle=$title;
|
&untiehash(); |
$pagetitle=$title;
|
$r->print('<p class="LC_success">'.&mt('Done').'</p>'); |
}
|
} |
|
|
my $orderidx=$LONCAPA::map::order[$index];
|
|
|
sub devalidateversioncache { |
|
my $src=shift; |
$renametitle=~s/\\/\\\\/g;
|
&Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'. |
$renametitle=~s/\"\;/\\\"/g;
|
&Apache::lonnet::clutter($src)); |
$renametitle=~s/ /%20/g;
|
} |
my $line='<tr>';
|
|
my ($form_start,$form_end);
|
sub checkversions { |
# Edit commands
|
my ($r) = @_; |
my ($container, $type, $esc_path, $path, $symb);
|
my $crstype = &Apache::loncommon::course_type(); |
if ($env{'form.folderpath'}) {
|
$r->print(&Apache::loncommon::start_page("Check $crstype Document Versions")); |
$type = 'folder';
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions")); |
$container = 'sequence';
|
$r->print(&startContentScreen('tools')); |
$esc_path=&escape($env{'form.folderpath'});
|
|
$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
|
my $header=''; |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
|
my $startsel=''; |
}
|
my $monthsel=''; |
if ($env{'form.pagepath'}) {
|
my $weeksel=''; |
$type = $container = 'page';
|
my $daysel=''; |
$esc_path=&escape($path = $env{'form.pagepath'});
|
my $allsel=''; |
$path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
|
my %changes=(); |
$symb=&escape($env{'form.pagesymb'});
|
my $starttime=0; |
}
|
my $haschanged=0; |
my $cpinfo='';
|
my %setversions=&Apache::lonnet::dump('resourceversions', |
if ($allowed) {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
my $incindex=$index+1;
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
my $selectbox='';
|
|
if (($folder!~/^supplemental/) &&
|
$hashtied=0; |
($#LONCAPA::map::order>0) &&
|
&tiehash(); |
((split(/\:/,
|
my %newsetversions=(); |
$LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]
|
if ($env{'form.setmostrecent'}) { |
ne '') &&
|
$haschanged=1; |
((split(/\:/,
|
foreach my $key (keys(%hash)) { |
$LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1]
|
if ($key=~/^ids\_(\/res\/.+)$/) { |
ne '')) {
|
$newsetversions{$1}='mostrecent'; |
$selectbox=
|
&devalidateversioncache($1); |
'<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
|
} |
'<select name="newpos" onChange="this.form.submit()">';
|
} |
for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) {
|
} elsif ($env{'form.setcurrent'}) { |
if ($i==$incindex) {
|
$haschanged=1; |
$selectbox.='<option value="" selected="1">('.$i.')</option>';
|
foreach my $key (keys(%hash)) { |
} else {
|
if ($key=~/^ids\_(\/res\/.+)$/) { |
$selectbox.='<option value="'.$i.'">'.$i.'</option>';
|
my $getvers=&Apache::lonnet::getversion($1); |
}
|
if ($getvers>0) { |
}
|
$newsetversions{$1}=$getvers; |
$selectbox.='</select>';
|
&devalidateversioncache($1); |
}
|
} |
my %lt=&Apache::lonlocal::texthash(
|
} |
'up' => 'Move Up',
|
} |
'dw' => 'Move Down',
|
} elsif ($env{'form.setversions'}) { |
'rm' => 'Remove',
|
$haschanged=1; |
'ct' => 'Cut',
|
foreach my $key (keys(%env)) { |
'rn' => 'Rename',
|
if ($key=~/^form\.set_version_(.+)$/) { |
'cp' => 'Copy');
|
my $src=$1; |
my $nocopy=0;
|
if (($env{$key}) && ($env{$key} ne $setversions{$src})) { |
my $nocut=0;
|
$newsetversions{$src}=$env{$key}; |
if ($url=~/\.(page|sequence)$/) {
|
&devalidateversioncache($src); |
if ($url =~ m{/res/}) {
|
} |
# no copy for published maps
|
} |
$nocopy = 1;
|
} |
} else {
|
} |
foreach my $item (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url),1)) {
|
if ($haschanged) { |
my ($title,$url,$ext,$type)=split(/\:/,$item);
|
if (&Apache::lonnet::put('resourceversions',\%newsetversions, |
if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$nocopy=1;
|
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { |
last;
|
$r->print(&Apache::loncommon::confirmwrapper( |
}
|
&Apache::lonhtmlcommon::confirm_success(&mt('Your Version Settings have been Saved')))); |
}
|
} else { |
}
|
$r->print(&Apache::loncommon::confirmwrapper( |
}
|
&Apache::lonhtmlcommon::confirm_success(&mt('An Error Occured while Attempting to Save your Version Settings'),1))); |
if ($url=~/^\/res\/lib\/templates\//) {
|
} |
$nocopy=1;
|
&mark_hash_old(); |
$nocut=1;
|
} |
}
|
&changewarning($r,''); |
my $copylink=' ';
|
if ($env{'form.timerange'} eq 'all') { |
my $cutlink=' ';
|
# show all documents |
|
$header=&mt('All Documents in '.$crstype); |
my $skip_confirm = 0;
|
$allsel=1; |
if ( $folder =~ /^supplemental/
|
foreach my $key (keys(%hash)) { |
|| ($url =~ m{( /smppg$
|
if ($key=~/^ids\_(\/res\/.+)$/) { |
|/syllabus$
|
my $src=$1; |
|/aboutme$
|
$changes{$src}=1; |
|/navmaps$
|
} |
|/bulletinboard$
|
} |
|\.html$
|
} else { |
|^/adm/wrapper/ext)}x)) {
|
# show documents which changed |
$skip_confirm = 1;
|
%changes=&Apache::lonnet::dump |
}
|
('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
if (!$nocopy) {
|
my $firstkey=(keys(%changes))[0]; |
$copylink=(<<ENDCOPY);
|
unless ($firstkey=~/^error\:/) { |
<a href='javascript:markcopy("$esc_path","$index","$renametitle","$container","$symb","$folder");' class="LC_docs_copy">$lt{'cp'}</a>
|
unless ($env{'form.timerange'}) { |
ENDCOPY
|
$env{'form.timerange'}=604800; |
}
|
} |
if (!$nocut) {
|
my $seltext=&mt('during the last').' '.$env{'form.timerange'}.' ' |
$cutlink=(<<ENDCUT);
|
.&mt('seconds'); |
<a href='javascript:cutres("$esc_path","$index","$renametitle","$container","$symb","$folder",$skip_confirm);' class="LC_docs_cut">$lt{'ct'}</a>
|
if ($env{'form.timerange'}==-1) { |
ENDCUT
|
$seltext='since start of course'; |
}
|
$startsel='selected'; |
$form_start = (<<END);
|
$env{'form.timerange'}=time; |
<form action="/adm/coursedocs" method="post">
|
} |
<input type="hidden" name="${type}path" value="$path" />
|
$starttime=time-$env{'form.timerange'}; |
<input type="hidden" name="${type}symb" value="$symb" />
|
if ($env{'form.timerange'}==2592000) { |
<input type="hidden" name="setparms" value="$orderidx" />
|
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
<input type="hidden" name="changeparms" value="0" />
|
$monthsel='selected'; |
END
|
} elsif ($env{'form.timerange'}==604800) { |
$form_end = '</form>';
|
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
$line.=(<<END);
|
$weeksel='selected'; |
<td>
|
} elsif ($env{'form.timerange'}==86400) { |
<table class="LC_docs_entry_move">
|
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')'; |
<tr>
|
$daysel='selected'; |
<td>
|
} |
<a href='/adm/coursedocs?cmd=up_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'><img src="${iconpath}move_up.gif" alt='$lt{'up'}' class="LC_icon" /></a>
|
$header=&mt('Content changed').' '.$seltext; |
</td>
|
} else { |
</tr>
|
$header=&mt('No content modifications yet.'); |
<tr>
|
} |
<td>
|
} |
<a href='/adm/coursedocs?cmd=down_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'><img src="${iconpath}move_down.gif" alt='$lt{'dw'}' class="LC_icon" /></a>
|
%setversions=&Apache::lonnet::dump('resourceversions', |
</td>
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
</tr>
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
</table>
|
my %lt=&Apache::lonlocal::texthash |
</td>
|
('st' => 'Version changes since start of '.$crstype, |
<td>
|
'lm' => 'Version changes since last Month', |
$form_start
|
'lw' => 'Version changes since last Week', |
$selectbox
|
'sy' => 'Version changes since Yesterday', |
$form_end
|
'al' => 'All Resources (possibly large output)', |
</td>
|
'cd' => 'Change display', |
<td class="LC_docs_entry_commands">
|
'sd' => 'Display', |
<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
|
'fi' => 'File', |
$cutlink
|
'md' => 'Modification Date', |
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a>
|
'mr' => 'Most recently published Version', |
$copylink
|
've' => 'Version used in '.$crstype, |
</td>
|
'vu' => 'Set Version to be used in '.$crstype, |
END
|
'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below', |
|
'sm' => 'Keep all Resources up-to-date with most recent Versions (default)', |
}
|
'sc' => 'Set all Resource Versions to current Version (Fix Versions)', |
# Figure out what kind of a resource this is
|
'di' => 'Differences', |
my ($extension)=($url=~/\.(\w+)$/);
|
'save' => 'Save changes', |
my $uploaded=($url=~/^\/*uploaded\//);
|
'vers' => 'Version choice(s) for specific resources', |
my $icon=&Apache::loncommon::icon($url);
|
'act' => 'Actions'); |
my $isfolder=0;
|
$r->print(<<ENDHEADERS); |
my $ispage=0;
|
<h4 class="LC_info">$header</h4> |
my $folderarg;
|
<form action="/adm/coursedocs" method="post"> |
my $pagearg;
|
<input type="hidden" name="versions" value="1" /> |
my $pagefile;
|
<div class="LC_left_float"> |
if ($uploaded) {
|
<fieldset> |
if ($extension eq 'sequence') {
|
<legend>$lt{'cd'}</legend> |
$icon=$iconpath.'/folder_closed.gif';
|
<select name="timerange"> |
$url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/;
|
<option value='all' $allsel>$lt{'al'}</option> |
$url='/adm/coursedocs?';
|
<option value="-1" $startsel>$lt{'st'}</option> |
$folderarg=$1;
|
<option value="2592000" $monthsel>$lt{'lm'}</option> |
$isfolder=1;
|
<option value="604800" $weeksel>$lt{'lw'}</option> |
} elsif ($extension eq 'page') {
|
<option value="86400" $daysel>$lt{'sy'}</option> |
$icon=$iconpath.'/page.gif';
|
</select> |
$url=~/\Q$coursenum\E\/([\/\w]+)\.page$/;
|
<input type="submit" name="display" value="$lt{'sd'}" /> |
$pagearg=$1;
|
</fieldset> |
$url='/adm/coursedocs?';
|
</div> |
$ispage=1;
|
<div class="LC_left_float"> |
} else {
|
<fieldset> |
&Apache::lonnet::allowuploaded('/adm/coursedoc',$url);
|
<legend>$lt{'act'}</legend> |
}
|
$lt{'sm'}: <input type="submit" name="setmostrecent" value="Go" /><br /> |
}
|
$lt{'sc'}: <input type="submit" name="setcurrent" value="Go" /> |
|
</fieldset> |
my $orig_url = $url;
|
</div> |
my $external = ($url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/});
|
<br clear="all" /> |
if ((!$isfolder) && ($residx) && ($folder!~/supplemental/) && (!$ispage)) {
|
<hr /> |
my $symb=&Apache::lonnet::symbclean(
|
<h4>$lt{'vers'}</h4> |
&Apache::lonnet::declutter('uploaded/'.
|
<input type="submit" name="setversions" value="$lt{'save'}" /> |
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
|
<table border="0"> |
$env{'course.'.$env{'request.course.id'}.'.num'}.'/'.$folder.
|
ENDHEADERS |
'.sequence').
|
#number of columns for version history |
'___'.$residx.'___'.
|
my $num_ver_col = 1; |
&Apache::lonnet::declutter($url));
|
$r->print( |
(undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
|
&Apache::loncommon::start_data_table(). |
$url=&Apache::lonnet::clutter($url);
|
&Apache::loncommon::start_data_table_header_row(). |
if ($url=~/^\/*uploaded\//) {
|
'<th>'.&mt('Resources').'</th>'. |
$url=~/\.(\w+)$/;
|
"<th>$lt{'mr'}</th>". |
my $embstyle=&Apache::loncommon::fileembstyle($1);
|
"<th>$lt{'ve'}</th>". |
if (($embstyle eq 'img') || ($embstyle eq 'emb')) {
|
"<th>$lt{'vu'}</th>". |
$url='/adm/wrapper'.$url;
|
'<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'. |
} elsif ($embstyle eq 'ssi') {
|
'</b>'); |
#do nothing with these
|
foreach my $key (sort(keys(%changes))) { |
} elsif ($url!~/\.(sequence|page)$/) {
|
if ($changes{$key}>$starttime) { |
$url='/adm/coursedocs/showdoc'.$url;
|
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); |
}
|
my $currentversion=&Apache::lonnet::getversion($key); |
} elsif ($url=~m|^/ext/|) {
|
if ($currentversion<0) { |
$url='/adm/wrapper'.$url;
|
$currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>'; |
$external = 1;
|
} |
}
|
my $linkurl=&Apache::lonnet::clutter($key); |
if (&Apache::lonnet::symbverify($symb,$url)) {
|
$r->print( |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
|
&Apache::loncommon::end_data_table_header_row(). |
} else {
|
&Apache::loncommon::start_data_table_row(). |
$url='';
|
'<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'. |
}
|
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'. |
if ($container eq 'page') {
|
'<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('. |
my $symb=$env{'form.pagesymb'};
|
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'. |
|
'<td align="right">'); |
$url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
|
# Used in course |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
|
my $usedversion=$hash{'version_'.$linkurl}; |
}
|
if (($usedversion) && ($usedversion ne 'mostrecent')) { |
}
|
if($usedversion != $currentversion){ |
my ($parameterset,$rand_order_text) = (' ', ' ');
|
$r->print('<span class="LC_warning">'.$usedversion.'</span>'); |
if ($isfolder || $extension eq 'sequence') {
|
}else{ |
my $foldername=&escape($foldertitle);
|
$r->print($usedversion); |
my $folderpath=$env{'form.folderpath'};
|
} |
if ($folderpath) { $folderpath.='&' };
|
} else { |
# Append randompick number, hidden, and encrypted with ":" to foldername,
|
$r->print($currentversion); |
# so it gets transferred between levels
|
} |
$folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx,
|
$r->print('</td><td title="'.$lt{'vu'}.'">'); |
'parameter_randompick'))[0]
|
# Set version |
.':'.((&LONCAPA::map::getparameter($orderidx,
|
$r->print(&Apache::loncommon::select_form($setversions{$linkurl}, |
'parameter_hiddenresource'))[0]=~/^yes$/i)
|
'set_version_'.$linkurl, |
.':'.((&LONCAPA::map::getparameter($orderidx,
|
{'select_form_order' => |
'parameter_encrypturl'))[0]=~/^yes$/i)
|
['',1..$currentversion,'mostrecent'], |
.':'.((&LONCAPA::map::getparameter($orderidx,
|
'' => '', |
'parameter_randomorder'))[0]=~/^yes$/i);
|
'mostrecent' => &mt('most recent'), |
$url.='folderpath='.&escape($folderpath).$cpinfo;
|
map {$_,$_} (1..$currentversion)})); |
$parameterset='<label>'.&mt('Randomly Pick: ').
|
my $lastold=1; |
'<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randompick_'.$orderidx.'" value="'.
|
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { |
(&LONCAPA::map::getparameter($orderidx,
|
my $url=$root.'.'.$prevvers.'.'.$extension; |
'parameter_randompick'))[0].
|
if (&Apache::lonnet::metadata($url,'lastrevisiondate')< |
'" />'.
|
$starttime) { |
'<a href="javascript:void(0)">'.&mt('Save').'</a></label>';
|
$lastold=$prevvers; |
my $ro_set=
|
} |
((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
|
} |
$rand_order_text ='
|
# |
<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>';
|
# Code to figure out how many version entries should go in |
}
|
# each of the four columns |
if ($ispage) {
|
my $entries_per_col = 0; |
my $pagename=&escape($pagetitle);
|
my $num_entries = ($currentversion-$lastold); |
my $pagepath;
|
if ($num_entries % $num_ver_col == 0) { |
my $folderpath=$env{'form.folderpath'};
|
$entries_per_col = $num_entries/$num_ver_col; |
if ($folderpath) { $pagepath = $folderpath.'&' };
|
} else { |
$pagepath.=$pagearg.'&'.$pagename;
|
$entries_per_col = $num_entries/$num_ver_col + 1; |
my $symb=$env{'form.pagesymb'};
|
} |
if (!$symb) {
|
my $entries_count = 0; |
my $path='uploaded/'.
|
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
$env{'course.'.$env{'request.course.id'}.'.domain'}.'/'.
|
my $cols_output = 1; |
$env{'course.'.$env{'request.course.id'}.'.num'}.'/';
|
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) { |
$symb=&Apache::lonnet::encode_symb($path.$folder.'.sequence',
|
my $url=$root.'.'.$prevvers.'.'.$extension; |
$residx,
|
$r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url). |
$path.$pagearg.'.page');
|
'">'.&mt('Version').' '.$prevvers.'</a> ('. |
}
|
&Apache::lonlocal::locallocaltime( |
$url.='pagepath='.&escape($pagepath).
|
&Apache::lonnet::metadata($url, |
'&pagesymb='.&escape($symb).$cpinfo;
|
'lastrevisiondate') |
}
|
). |
if ($external) {
|
')'); |
my $form = ($folder =~ /^default/)? 'newext' : 'supnewext';
|
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') { |
$external = ' <a class="LC_docs_ext_edit" href="javascript:edittext(\''.$form.'\',\''.$residx.'\',\''.&escape($title).'\',\''.&escape($orig_url).'\');" >'.&mt('Edit').'</a>';
|
$r->print(' <a href="/adm/diff?filename='. |
} else {
|
&Apache::lonnet::clutter($root.'.'.$extension). |
undef($external);
|
'&versionone='.$prevvers. |
}
|
'" target="diffs">'.&mt('Diffs').'</a>'); |
$line.='
|
} |
<td class="LC_docs_entry_icon">
|
$r->print('</span><br />'); |
'.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'
|
if (++$entries_count % $entries_per_col == 0) { |
</td>
|
$r->print('</span></td>'); |
<td class="LC_docs_entry_title">
|
if ($cols_output != $num_ver_col) { |
'.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.&mt('(re-initialize course to access)').'</span>').$external."
|
$r->print('<td valign="top"><span class="LC_fontsize_medium">'); |
</td>";
|
$cols_output++; |
if (($allowed) && ($folder!~/^supplemental/)) {
|
} |
my %lt=&Apache::lonlocal::texthash(
|
} |
'hd' => 'Hidden',
|
} |
'ec' => 'URL hidden');
|
while($cols_output++ < $num_ver_col) { |
my $enctext=
|
$r->print('</span></td><td>'); |
((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
|
} |
my $hidtext=
|
} |
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
|
} |
$line.=(<<ENDPARMS);
|
$r->print('</td>'.&Apache::loncommon::end_data_table_row(). |
<td class="LC_docs_entry_parameter">
|
&Apache::loncommon::end_data_table(). |
$form_start
|
'<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'); |
<label><input type="checkbox" name="hiddenresource_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
|
|
$form_end
|
&untiehash(); |
</td>
|
} |
<td class="LC_docs_entry_parameter">
|
|
$form_start
|
sub mark_hash_old { |
<label><input type="checkbox" name="encrypturl_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
|
my $retie_hash=0; |
$form_end
|
if ($hashtied) { |
</td>
|
$retie_hash=1; |
<td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td>
|
&untiehash(); |
<td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td>
|
} |
ENDPARMS
|
&tiehash('write'); |
}
|
$hash{'old'}=1; |
$line.="</tr>";
|
&untiehash(); |
return $line;
|
if ($retie_hash) { &tiehash(); } |
}
|
} |
|
|
=pod
|
sub is_hash_old { |
|
my $untie_hash=0; |
=item tiehash()
|
if (!$hashtied) { |
|
$untie_hash=1; |
tie the hash
|
&tiehash(); |
|
} |
=cut
|
my $return=$hash{'old'}; |
|
if ($untie_hash) { &untiehash(); } |
sub tiehash {
|
return $return; |
my ($mode)=@_;
|
} |
$hashtied=0;
|
|
if ($env{'request.course.fn'}) {
|
sub changewarning { |
if ($mode eq 'write') {
|
my ($r,$postexec,$message,$url)=@_; |
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
|
if (!&is_hash_old()) { return; } |
&GDBM_WRCREAT(),0640)) {
|
my $pathvar='folderpath'; |
$hashtied=2;
|
my $path=&escape($env{'form.folderpath'}); |
}
|
if (!defined($url)) { |
} else {
|
if (defined($env{'form.pagepath'})) { |
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
|
$pathvar='pagepath'; |
&GDBM_READER(),0640)) {
|
$path=&escape($env{'form.pagepath'}); |
$hashtied=1;
|
$path.='&pagesymb='.&escape($env{'form.pagesymb'}); |
}
|
} |
}
|
$url='/adm/coursedocs?'.$pathvar.'='.$path; |
}
|
} |
}
|
my $course_type = &Apache::loncommon::course_type(); |
|
if (!defined($message)) { |
sub untiehash {
|
$message='Changes will become active for your current session after [_1], or the next time you log in.'; |
if ($hashtied) { untie %hash; }
|
} |
$hashtied=0;
|
$r->print("\n\n". |
return OK;
|
'<script type="text/javascript">'."\n". |
}
|
'// <![CDATA['."\n". |
|
'function reinit(tf) { tf.submit();'.$postexec.' }'."\n". |
|
'// ]]>'."\n". |
|
'</script>'."\n". |
|
'<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'. |
sub checkonthis {
|
'<input type="hidden" name="orgurl" value="'.$url. |
my ($r,$url,$level,$title)=@_;
|
'" /><input type="hidden" name="selectrole" value="1" /><p class="LC_warning">'. |
$url=&unescape($url);
|
&mt($message,' <input type="hidden" name="'. |
$alreadyseen{$url}=1;
|
$env{'request.role'}.'" value="1" /><input type="button" value="'. |
$r->rflush();
|
&mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />'). |
if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
|
$help{'Caching'}.'</p></form>'."\n\n"); |
$r->print("\n<br />");
|
} |
if ($level==0) {
|
|
$r->print("<br />");
|
|
}
|
sub init_breadcrumbs { |
for (my $i=0;$i<=$level*5;$i++) {
|
my ($form,$text)=@_; |
$r->print(' ');
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
}
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1", |
$r->print('<a href="'.$url.'" target="cat">'.
|
text=>&Apache::loncommon::course_type().' Editor', |
($title?$title:$url).'</a> ');
|
faq=>273, |
if ($url=~/^\/res\//) {
|
bug=>'Instructor Interface', |
my $result=&Apache::lonnet::repcopy(
|
help => 'Docs_Adding_Course_Doc'}); |
&Apache::lonnet::filelocation('',$url));
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1', |
if ($result eq 'ok') {
|
text=>$text, |
$r->print('<span class="LC_success">'.&mt('ok').'</span>');
|
faq=>273, |
$r->rflush();
|
bug=>'Instructor Interface'}); |
&Apache::lonnet::countacc($url);
|
} |
$url=~/\.(\w+)$/;
|
|
if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
|
# subroutine to list form elements |
$r->print('<br />');
|
sub create_list_elements { |
$r->rflush();
|
my @formarr = @_; |
for (my $i=0;$i<=$level*5;$i++) {
|
my $list = ''; |
$r->print(' ');
|
for my $button (@formarr){ |
}
|
for my $picture(keys %$button) { |
$r->print('- '.&mt('Rendering:').' ');
|
$list .= &Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'}); |
my ($errorcount,$warningcount)=split(/:/,
|
} |
&Apache::lonnet::ssi_body($url,
|
} |
('grade_target'=>'web',
|
return $list; |
'return_only_error_and_warning_counts' => 1)));
|
} |
if (($errorcount) ||
|
|
($warningcount)) {
|
# subroutine to create ul from list elements |
if ($errorcount) {
|
sub create_form_ul { |
$r->print('<img src="/adm/lonMisc/bomb.gif" /><span class="LC_error">'.
|
my $list = shift; |
&mt('[quant,_1,error]',$errorcount).'</span>');
|
my $ul = &Apache::lonhtmlcommon::htmltag('ul',$list, {class => 'LC_ListStyleNormal'}); |
}
|
return $ul; |
if ($warningcount) {
|
} |
$r->print('<span class="LC_warning">'.
|
|
&mt('[quant,_1,warning]',$warningcount).'</span>');
|
# |
}
|
# Start tabs |
} else {
|
# |
$r->print('<span class="LC_success">'.&mt('ok').'</span>');
|
|
}
|
sub startContentScreen { |
$r->rflush();
|
my ($mode) = @_; |
}
|
my $output = '<ul class="LC_TabContentBigger" id="mainnav">'; |
my $dependencies=
|
if (($mode eq 'navmaps') || ($mode eq 'supplemental')) { |
&Apache::lonnet::metadata($url,'dependencies');
|
$output .= '<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b> '.&mt('Content Overview').' </b></a></li>'."\n"; |
foreach my $dep (split(/\,/,$dependencies)) {
|
$output .= '<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b> '.&mt('Content Search').' </b></a></li>'."\n"; |
if (($dep=~/^\/res\//) && (!$alreadyseen{$dep})) {
|
$output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>'; |
&checkonthis($r,$dep,$level+1);
|
} else { |
}
|
$output .= '<li '.(($mode eq 'docs')?' class="active"':'').' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b> '.&mt('Content Editor').' </b></a></li>'."\n"; |
}
|
$output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Content Editor').'</b></a></li>'."\n"; |
} elsif ($result eq 'unavailable') {
|
$output .= '<li '.(($mode eq 'tools')?' class="active"':'').'><a href="/adm/coursedocs?tools=1"><b> '.&mt('Content Utilities').' </b></a></li>'."\n"; |
$r->print('<span class="LC_error">'.&mt('connection down').'</span>');
|
'><a href="/adm/coursedocs?tools=1"><b> '.&mt('Content Utilities').' </b></a></li>'; |
} elsif ($result eq 'not_found') {
|
} |
unless ($url=~/\$/) {
|
$output .= "\n".'</ul>'."\n"; |
$r->print('<span class="LC_error">'.&mt('not found').'</b></span>');
|
$output .= '<div class="LC_DocsBox" style="clear:both;margin:0;" id="contenteditor">'. |
} else {
|
'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">'. |
$r->print('<span class="LC_unknown">'.&mt('unable to verify variable URL').'</span>');
|
'<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">'; |
}
|
return $output; |
} else {
|
} |
$r->print('<span class="LC_error">'.&mt('access denied').'</span>');
|
|
}
|
# |
}
|
# End tabs |
}
|
# |
}
|
|
|
sub endContentScreen { |
|
return '</div></div></div>'; |
|
} |
=pod
|
|
|
sub supplemental_base { |
=item list_symbs()
|
return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content')); |
|
} |
List Symbs
|
|
|
sub handler { |
=cut
|
my $r = shift; |
|
&Apache::loncommon::content_type($r,'text/html'); |
sub list_symbs {
|
$r->send_http_header; |
my ($r) = @_;
|
return OK if $r->header_only; |
|
|
my $type = &Apache::loncommon::course_type();
|
# get course data |
$r->print(&Apache::loncommon::start_page('Symb List'));
|
my $crstype = &Apache::loncommon::course_type(); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
|
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $navmap = Apache::lonnavmaps::navmap->new();
|
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
if (!defined($navmap)) {
|
|
$r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'.
|
# graphics settings |
'<div class="LC_error">'.
|
$iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL').'/'); |
&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'});
|
# --------------------------------------------- Initialize help topics for this |
} else {
|
foreach my $topic ('Adding_Course_Doc','Main_Course_Documents', |
$r->print("<pre>\n");
|
'Adding_External_Resource','Navigate_Content', |
foreach my $res ($navmap->retrieveResources()) {
|
'Adding_Folders','Docs_Overview', 'Load_Map', |
$r->print($res->compTitle()."\t".$res->symb()."\n");
|
'Supplemental','Score_Upload_Form','Adding_Pages', |
}
|
'Importing_LON-CAPA_Resource','Uploading_From_Harddrive', |
$r->print("\n</pre>\n");
|
'Check_Resource_Versions','Verify_Content') { |
}
|
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic); |
$r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');
|
} |
}
|
# Composite help files |
|
$help{'Syllabus'} = &Apache::loncommon::help_open_topic( |
|
'Docs_About_Syllabus,Docs_Editing_Templated_Pages'); |
sub verifycontent {
|
$help{'Simple Page'} = &Apache::loncommon::help_open_topic( |
my ($r) = @_;
|
'Docs_About_Simple_Page,Docs_Editing_Templated_Pages'); |
my $type = &Apache::loncommon::course_type();
|
$help{'Simple Problem'} = &Apache::loncommon::help_open_topic( |
my $loaderror=&Apache::lonnet::overloaderror($r);
|
'Option_Response_Simple'); |
if ($loaderror) { return $loaderror; }
|
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic( |
$r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
|
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));
|
$help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic( |
$hashtied=0;
|
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages'); |
undef %alreadyseen;
|
$help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files'); |
%alreadyseen=();
|
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching'); |
&tiehash();
|
|
foreach my $key (keys(%hash)) {
|
|
if ($hash{$key}=~/\.(page|sequence)$/) {
|
my $allowed; |
if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
|
# URI is /adm/supplemental when viewing supplemental docs in non-edit mode. |
$r->print('<hr /><span class="LC_error">'.
|
unless ($r->uri eq '/adm/supplemental') { |
&mt('The following sequence or page is included more than once in your '.$type.': ').
|
# does this user have privileges to modify content. |
&unescape($hash{$key}).'</span><br />'.
|
$allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
&mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
|
} |
}
|
|
}
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver', |
if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {
|
'inhibitmenu']); |
&checkonthis($r,$hash{$key},0,$hash{'title_'.$1});
|
if ($allowed && $env{'form.chooseserver'}) { |
}
|
&choose_dump_server($r); |
}
|
return OK; |
&untiehash();
|
} elsif ($allowed && $env{'form.verify'}) { |
$r->print('<h1>'.&mt('Done').'.</h1>'.'<a href="/adm/coursedocs">'.
|
&init_breadcrumbs('verify','Verify Content'); |
&mt('Return to DOCS').'</a>');
|
&verifycontent($r); |
}
|
} elsif ($allowed && $env{'form.listsymbs'}) { |
|
&init_breadcrumbs('listsymbs','List Content IDs'); |
|
&list_symbs($r); |
sub devalidateversioncache {
|
} elsif ($allowed && $env{'form.docslog'}) { |
my $src=shift;
|
&init_breadcrumbs('docslog','Show Log'); |
&Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'.
|
my $folder = $env{'form.folder'}; |
&Apache::lonnet::clutter($src));
|
if ($folder eq '') { |
}
|
$folder='default'; |
|
} |
sub checkversions {
|
&docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath); |
my ($r) = @_;
|
} elsif ($allowed && $env{'form.versions'}) { |
my $type = &Apache::loncommon::course_type();
|
&init_breadcrumbs('versions','Check/Set Resource Versions'); |
$r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
|
&checkversions($r); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));
|
} elsif ($allowed && $env{'form.dumpcourse'}) { |
my $header='';
|
&init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Content to Authoring Space'); |
my $startsel='';
|
&dumpcourse($r); |
my $monthsel='';
|
} elsif ($allowed && $env{'form.exportcourse'}) { |
my $weeksel='';
|
&init_breadcrumbs('exportcourse','IMS Export'); |
my $daysel='';
|
&Apache::imsexport::exportcourse($r); |
my $allsel='';
|
} else { |
my %changes=();
|
# |
my $starttime=0;
|
# Done catching special calls |
my $haschanged=0;
|
# The whole rest is for course and supplemental documents and utilities menu |
my %setversions=&Apache::lonnet::dump('resourceversions',
|
# Get the parameters that may be needed |
$env{'course.'.$env{'request.course.id'}.'.domain'},
|
# |
$env{'course.'.$env{'request.course.id'}.'.num'});
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['folderpath','pagepath', |
$hashtied=0;
|
'pagesymb','forcesupplement','forcestandard', |
&tiehash();
|
'tools','symb','command']); |
my %newsetversions=();
|
|
if ($env{'form.setmostrecent'}) {
|
# standard=1: this is a "new-style" course with an uploaded map as top level |
$haschanged=1;
|
# standard=2: this is a "old-style" course, and there is nothing we can do |
foreach my $key (keys(%hash)) {
|
|
if ($key=~/^ids\_(\/res\/.+)$/) {
|
my $standard=($env{'request.course.uri'}=~/^\/uploaded\//); |
$newsetversions{$1}='mostrecent';
|
|
&devalidateversioncache($1);
|
# Decide whether this should display supplemental or main content or utilities |
}
|
# supplementalflag=1: show supplemental documents |
}
|
# supplementalflag=0: show standard documents |
} elsif ($env{'form.setcurrent'}) {
|
# toolsflag=1: show utilities |
$haschanged=1;
|
|
foreach my $key (keys(%hash)) {
|
|
if ($key=~/^ids\_(\/res\/.+)$/) {
|
my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/); |
my $getvers=&Apache::lonnet::getversion($1);
|
if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) { |
if ($getvers>0) {
|
$supplementalflag=0; |
$newsetversions{$1}=$getvers;
|
} |
&devalidateversioncache($1);
|
if ($env{'form.forcesupplement'}) { $supplementalflag=1; } |
}
|
if ($env{'form.forcestandard'}) { $supplementalflag=0; } |
}
|
unless ($allowed) { $supplementalflag=1; } |
}
|
unless ($standard) { $supplementalflag=1; } |
} elsif ($env{'form.setversions'}) {
|
my $toolsflag=0; |
$haschanged=1;
|
if ($env{'form.tools'}) { $toolsflag=1; } |
foreach my $key (keys(%env)) {
|
|
if ($key=~/^form\.set_version_(.+)$/) {
|
my $script=''; |
my $src=$1;
|
my $showdoc=0; |
if (($env{$key}) && ($env{$key} ne $setversions{$src})) {
|
my $addentries = {}; |
$newsetversions{$src}=$env{$key};
|
my $container; |
&devalidateversioncache($src);
|
my $containertag; |
}
|
my $uploadtag; |
}
|
|
}
|
# Do we directly jump somewhere? |
}
|
|
if ($haschanged) {
|
if ($env{'form.command'} eq 'direct') { |
if (&Apache::lonnet::put('resourceversions',\%newsetversions,
|
my ($mapurl,$id,$resurl); |
$env{'course.'.$env{'request.course.id'}.'.domain'},
|
if ($env{'form.symb'} ne '') { |
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
|
($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); |
$r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>');
|
if ($resurl=~/\.(sequence|page)$/) { |
} else {
|
$mapurl=$resurl; |
$r->print('<h1><span class="LC_error">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</span></h1>');
|
} elsif ($resurl eq 'adm/navmaps') { |
}
|
$mapurl=$env{'course.'.$env{'request.course.id'}.'.url'}; |
&mark_hash_old();
|
} |
}
|
my $mapresobj; |
&changewarning($r,'');
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
if ($env{'form.timerange'} eq 'all') {
|
if (ref($navmap)) { |
# show all documents
|
$mapresobj = $navmap->getResourceByUrl($mapurl); |
$header=&mt('All Documents in '.$type);
|
} |
$allsel=1;
|
$mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1}; |
foreach my $key (keys(%hash)) {
|
my $type=$2; |
if ($key=~/^ids\_(\/res\/.+)$/) {
|
my $path; |
my $src=$1;
|
if (ref($mapresobj)) { |
$changes{$src}=1;
|
my $pcslist = $mapresobj->map_hierarchy(); |
}
|
if ($pcslist ne '') { |
}
|
foreach my $pc (split(/,/,$pcslist)) { |
} else {
|
next if ($pc <= 1); |
# show documents which changed
|
my $res = $navmap->getByMapPc($pc); |
%changes=&Apache::lonnet::dump
|
if (ref($res)) { |
('versionupdate',$env{'course.'.$env{'request.course.id'}.'.domain'},
|
my $thisurl = $res->src(); |
$env{'course.'.$env{'request.course.id'}.'.num'});
|
$thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
my $firstkey=(keys(%changes))[0];
|
my $thistitle = $res->title(); |
unless ($firstkey=~/^error\:/) {
|
$path .= '&'. |
unless ($env{'form.timerange'}) {
|
&Apache::lonhtmlcommon::entity_encode($thisurl).'&'. |
$env{'form.timerange'}=604800;
|
&Apache::lonhtmlcommon::entity_encode($thistitle). |
}
|
':'.$res->randompick(). |
my $seltext=&mt('during the last').' '.$env{'form.timerange'}.' '
|
':'.$res->randomout(). |
.&mt('seconds');
|
':'.$res->encrypted(). |
if ($env{'form.timerange'}==-1) {
|
':'.$res->randomorder(); |
$seltext='since start of course';
|
} |
$startsel='selected';
|
} |
$env{'form.timerange'}=time;
|
} |
}
|
$path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
$starttime=time-$env{'form.timerange'};
|
&Apache::lonhtmlcommon::entity_encode($mapresobj->title()). |
if ($env{'form.timerange'}==2592000) {
|
':'.$mapresobj->randompick(). |
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
|
':'.$mapresobj->randomout(). |
$monthsel='selected';
|
':'.$mapresobj->encrypted(). |
} elsif ($env{'form.timerange'}==604800) {
|
':'.$mapresobj->randomorder(); |
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
|
} else { |
$weeksel='selected';
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
} elsif ($env{'form.timerange'}==86400) {
|
$path = '&default&...::::'. |
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
|
'&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
$daysel='selected';
|
&Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; |
}
|
} |
$header=&mt('Content changed').' '.$seltext;
|
$path = 'default&'. |
} else {
|
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
$header=&mt('No content modifications yet.');
|
$path; |
}
|
if ($type eq 'sequence') { |
}
|
$env{'form.folderpath'}=$path; |
%setversions=&Apache::lonnet::dump('resourceversions',
|
$env{'form.pagepath'}=''; |
$env{'course.'.$env{'request.course.id'}.'.domain'},
|
} else { |
$env{'course.'.$env{'request.course.id'}.'.num'});
|
$env{'form.pagepath'}=$path; |
my %lt=&Apache::lonlocal::texthash
|
$env{'form.folderpath'}=''; |
('st' => 'Version changes since start of '.$type,
|
} |
'lm' => 'Version changes since last Month',
|
} elsif ($env{'form.supppath'} ne '') { |
'lw' => 'Version changes since last Week',
|
$env{'form.folderpath'}=$env{'form.supppath'}; |
'sy' => 'Version changes since Yesterday',
|
} |
'al' => 'All Resources (possibly large output)',
|
} elsif ($env{'form.command'} eq 'editdocs') { |
'sd' => 'Display',
|
$env{'form.folderpath'} = 'default&'. |
'fi' => 'File',
|
&Apache::lonhtmlcommon::entity_encode('Main Course Content'); |
'md' => 'Modification Date',
|
$env{'form.pagepath'}=''; |
'mr' => 'Most recently published Version',
|
} elsif ($env{'form.command'} eq 'editsupp') { |
've' => 'Version used in '.$type,
|
$env{'form.folderpath'} = 'default&'. |
'vu' => 'Set Version to be used in '.$type,
|
&Apache::lonhtmlcommon::entity_encode('Supplemental Content'); |
'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
|
$env{'form.pagepath'}=''; |
'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
|
} |
'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
|
|
'di' => 'Differences');
|
# Where do we store these for when we come back? |
$r->print(<<ENDHEADERS);
|
my $stored_folderpath='docs_folderpath'; |
<form action="/adm/coursedocs" method="post">
|
if ($supplementalflag) { |
<input type="hidden" name="versions" value="1" />
|
$stored_folderpath='docs_sup_folderpath'; |
<input type="submit" name="setmostrecent" value="$lt{'sm'}" />
|
} |
<input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
|
|
<select name="timerange">
|
# No folderpath, no pagepath, see if we have something stored |
<option value='all' $allsel>$lt{'al'}</option>
|
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) { |
<option value="-1" $startsel>$lt{'st'}</option>
|
&Apache::loncommon::restore_course_settings($stored_folderpath, |
<option value="2592000" $monthsel>$lt{'lm'}</option>
|
{'folderpath' => 'scalar'}); |
<option value="604800" $weeksel>$lt{'lw'}</option>
|
} |
<option value="86400" $daysel>$lt{'sy'}</option>
|
|
</select>
|
# If we are not allowed to make changes, all we can see are supplemental docs |
<input type="submit" name="display" value="$lt{'sd'}" />
|
if (!$allowed) { |
<h3>$header</h3>
|
$env{'form.pagepath'}=''; |
<input type="submit" name="setversions" value="$lt{'sv'}" />
|
unless ($env{'form.folderpath'} =~ /^supplemental/) { |
<table border="0">
|
$env{'form.folderpath'} = &supplemental_base(); |
ENDHEADERS
|
} |
foreach my $key (sort(keys(%changes))) {
|
} |
if ($changes{$key}>$starttime) {
|
# If we still not have a folderpath, see if we can resurrect at pagepath |
my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
|
if (!$env{'form.folderpath'} && $allowed) { |
my $currentversion=&Apache::lonnet::getversion($key);
|
&Apache::loncommon::restore_course_settings($stored_folderpath, |
if ($currentversion<0) {
|
{'pagepath' => 'scalar'}); |
$currentversion=&mt('Could not be determined.');
|
} |
}
|
# Make the zeroth entry in supplemental docs page paths, so we can get to top level |
my $linkurl=&Apache::lonnet::clutter($key);
|
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) { |
$r->print(
|
$env{'form.folderpath'} = &supplemental_base() |
'<tr><td colspan="5"><br /><br /><font size="+1"><b>'.
|
.'&'. |
&Apache::lonnet::gettitle($linkurl).
|
$env{'form.folderpath'}; |
'</b></font></td></tr>'.
|
} |
'<tr><td> </td>'.
|
# If after all of this, we still don't have any paths, make them |
'<td colspan="4">'.
|
unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) { |
'<a href="'.$linkurl.'" target="cat">'.$linkurl.
|
if ($supplementalflag) { |
'</a></td></tr>'.
|
$env{'form.folderpath'}=&supplemental_base(); |
'<tr><td></td>'.
|
} else { |
'<td title="'.$lt{'md'}.'">'.
|
$env{'form.folderpath'}='default'; |
&Apache::lonlocal::locallocaltime(
|
} |
&Apache::lonnet::metadata($root.'.'.$extension,
|
} |
'lastrevisiondate')
|
|
).
|
# Store this |
'</td>'.
|
unless ($toolsflag) { |
'<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
|
&Apache::loncommon::store_course_settings($stored_folderpath, |
'<font size="+1">'.$currentversion.'</font>'.
|
{'pagepath' => 'scalar', |
'</span></td>'.
|
'folderpath' => 'scalar'}); |
'<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$type.': '.
|
if ($env{'form.folderpath'}) { |
'<font size="+1">');
|
my (@folderpath)=split('&',$env{'form.folderpath'}); |
# Used in course
|
$env{'form.foldername'}=&unescape(pop(@folderpath)); |
my $usedversion=$hash{'version_'.$linkurl};
|
$env{'form.folder'}=pop(@folderpath); |
if (($usedversion) && ($usedversion ne 'mostrecent')) {
|
$container='sequence'; |
$r->print($usedversion);
|
} |
} else {
|
if ($env{'form.pagepath'}) { |
$r->print($currentversion);
|
my (@pagepath)=split('&',$env{'form.pagepath'}); |
}
|
$env{'form.pagename'}=&unescape(pop(@pagepath)); |
$r->print('</font></span></td><td title="'.$lt{'vu'}.'">'.
|
$env{'form.folder'}=pop(@pagepath); |
'<span class="LC_nobreak">Use: ');
|
$container='page'; |
# Set version
|
$containertag = '<input type="hidden" name="pagepath" value="" />'. |
$r->print(&Apache::loncommon::select_form($setversions{$linkurl},
|
'<input type="hidden" name="pagesymb" value="" />'; |
'set_version_'.$linkurl,
|
$uploadtag = |
('select_form_order' =>
|
'<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'. |
['',1..$currentversion,'mostrecent'],
|
'<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'. |
'' => '',
|
'<input type="hidden" name="folderpath" value="" />'; |
'mostrecent' => 'most recent',
|
} else { |
map {$_,$_} (1..$currentversion))));
|
my $folderpath=$env{'form.folderpath'}; |
$r->print('</span></td></tr><tr><td></td>');
|
if (!$folderpath) { |
my $lastold=1;
|
if ($env{'form.folder'} eq '' || |
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
|
$env{'form.folder'} eq 'supplemental') { |
my $url=$root.'.'.$prevvers.'.'.$extension;
|
$folderpath='default&'. |
if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
|
&escape(&mt('Main '.$crstype.' Documents')); |
$starttime) {
|
} |
$lastold=$prevvers;
|
} |
}
|
$containertag = '<input type="hidden" name="folderpath" value="" />'; |
}
|
$uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />'; |
#
|
} |
# Code to figure out how many version entries should go in
|
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) { |
# each of the four columns
|
$showdoc='/'.$1; |
my $entries_per_col = 0;
|
} |
my $num_entries = ($currentversion-$lastold);
|
if ($showdoc) { # got called in sequence from course |
if ($num_entries % 4 == 0) {
|
$allowed=0; |
$entries_per_col = $num_entries/4;
|
} else { |
} else {
|
if ($allowed) { |
$entries_per_col = $num_entries/4 + 1;
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']); |
}
|
$script=&Apache::lonratedt::editscript('simple'); |
my $entries_count = 0;
|
} |
$r->print('<td valign="top"><font size="-2">');
|
} |
my $cols_output = 1;
|
} |
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
|
|
my $url=$root.'.'.$prevvers.'.'.$extension;
|
# get personal data |
$r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url).
|
my $uname=$env{'user.name'}; |
'">'.&mt('Version').' '.$prevvers.'</a> ('.
|
my $udom=$env{'user.domain'}; |
&Apache::lonlocal::locallocaltime(
|
my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom)); |
&Apache::lonnet::metadata($url,
|
|
'lastrevisiondate')
|
if ($allowed) { |
).
|
if ($toolsflag) { |
')');
|
$script .= &inject_data_js(); |
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
|
my ($home,$other,%outhash)=&authorhosts(); |
$r->print(' <a href="/adm/diff?filename='.
|
if (!$home && $other) { |
&Apache::lonnet::clutter($root.'.'.$extension).
|
my @hosts; |
'&versionone='.$prevvers.
|
foreach my $aurole (keys(%outhash)) { |
'">'.&mt('Diffs').'</a>');
|
unless(grep(/^\Q$outhash{$aurole}\E/,@hosts)) { |
}
|
push(@hosts,$outhash{$aurole}); |
$r->print('</span><br />');
|
} |
if (++$entries_count % $entries_per_col == 0) {
|
} |
$r->print('</font></td>');
|
$script .= &dump_switchserver_js(@hosts); |
if ($cols_output != 4) {
|
} |
$r->print('<td valign="top"><font size="-2">');
|
} else { |
$cols_output++;
|
my @tabids; |
}
|
if ($supplementalflag) { |
}
|
@tabids = ('002','ee2','ff2'); |
}
|
} else { |
while($cols_output++ < 4) {
|
@tabids = ('aa1','bb1','cc1','ff1'); |
$r->print('</font></td><td><font>')
|
unless ($env{'form.pagepath'}) { |
}
|
unshift(@tabids,'001'); |
$r->print('</font></td></tr>'."\n");
|
push(@tabids,('dd1','ee1')); |
}
|
} |
}
|
} |
$r->print('</table></form>');
|
my $tabidstr = join("','",@tabids); |
$r->print('<h1>'.&mt('Done').'.</h1>');
|
$script .= &editing_js($udom,$uname,$supplementalflag). |
|
&history_tab_js(). |
&untiehash();
|
&inject_data_js(). |
}
|
&resize_contentdiv_js($tabidstr); |
|
$addentries = { |
sub mark_hash_old {
|
onload => "javascript:resize_contentdiv('contentscroll','1','1');", |
my $retie_hash=0;
|
}; |
if ($hashtied) {
|
} |
$retie_hash=1;
|
} |
&untiehash();
|
# -------------------------------------------------------------------- Body tag |
}
|
$script = '<script type="text/javascript">'."\n" |
&tiehash('write');
|
.'// <![CDATA['."\n" |
$hash{'old'}=1;
|
.$script."\n" |
&untiehash();
|
.'// ]]>'."\n" |
if ($retie_hash) { &tiehash(); }
|
.'</script>'."\n"; |
}
|
|
|
# Breadcrumbs |
sub is_hash_old {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
my $untie_hash=0;
|
unless ($showdoc) { |
if (!$hashtied) {
|
&Apache::lonhtmlcommon::add_breadcrumb({ |
$untie_hash=1;
|
href=>"/adm/coursedocs",text=>"$crstype Contents"}); |
&tiehash();
|
|
}
|
$r->print(&Apache::loncommon::start_page("$crstype Contents", $script, |
my $return=$hash{'old'};
|
{'force_register' => $showdoc, |
if ($untie_hash) { &untiehash(); }
|
'add_entries' => $addentries, |
return $return;
|
}) |
}
|
.&Apache::loncommon::help_open_menu('','',273,'RAT') |
|
.&Apache::lonhtmlcommon::breadcrumbs( |
sub changewarning {
|
'Editing '.$crstype.' Contents', |
my ($r,$postexec,$message,$url)=@_;
|
'Docs_Adding_Course_Doc') |
if (!&is_hash_old()) { return; }
|
); |
my $pathvar='folderpath';
|
} else { |
my $path=&escape($env{'form.folderpath'});
|
$r->print(&Apache::loncommon::start_page("$crstype documents",undef, |
if (!defined($url)) {
|
{'force_register' => $showdoc,})); |
if (defined($env{'form.pagepath'})) {
|
} |
$pathvar='pagepath';
|
|
$path=&escape($env{'form.pagepath'});
|
my %allfiles = (); |
$path.='&pagesymb='.&escape($env{'form.pagesymb'});
|
my %codebase = (); |
}
|
my ($upload_result,$upload_output,$uploadphase); |
$url='/adm/coursedocs?'.$pathvar.'='.$path;
|
if ($allowed) { |
}
|
if (($env{'form.uploaddoc.filename'}) && |
my $course_type = &Apache::loncommon::course_type();
|
($env{'form.cmd'}=~/^upload_(\w+)/)) { |
if (!defined($message)) {
|
my $context = $1; |
$message='Changes will become active for your current session after [_1], or the next time you log in.';
|
# Process file upload - phase one - upload and parse primary file. |
}
|
undef($hadchanges); |
$r->print("\n\n".
|
$uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom, |
'<script type="text/javascript">function reinit(tf) { tf.submit();'.$postexec.' }</script>'."\n".
|
\%allfiles,\%codebase,$context); |
'<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'.
|
if ($hadchanges) { |
'<input type="hidden" name="orgurl" value="'.$url.
|
&mark_hash_old(); |
'" /><input type="hidden" name="selectrole" value="1" /><h3><span class="LC_warning">'.
|
} |
&mt($message,' <input type="hidden" name="'.
|
$r->print($upload_output); |
$env{'request.role'}.'" value="1" /><input type="button" value="'.
|
} elsif ($env{'form.phase'} eq 'upload_embedded') { |
&mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
|
# Process file upload - phase two - upload embedded objects |
$help{'Caching'}.'</span></h3></form>'."\n\n");
|
$uploadphase = 'check_embedded'; |
}
|
my $primaryurl = &HTML::Entities::encode($env{'form.primaryurl'},'<>&"'); |
|
my $state = &embedded_form_elems($uploadphase,$primaryurl, |
|
$env{'form.newidx'}); |
sub init_breadcrumbs {
|
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my ($form,$text)=@_;
|
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
&Apache::lonhtmlcommon::clear_breadcrumbs();
|
my ($destination,$dir_root) = &embedded_destination(); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
|
my $url_root = '/uploaded/'.$docudom.'/'.$docuname; |
text=>"Edit ".&Apache::loncommon::course_type(),
|
my $actionurl = '/adm/coursedocs'; |
faq=>273,
|
my ($result,$flag) = |
bug=>'Instructor Interface',
|
&Apache::loncommon::upload_embedded('coursedoc',$destination, |
help => 'Docs_Adding_Course_Doc'});
|
$docuname,$docudom,$dir_root,$url_root,undef,undef,undef,$state, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
|
$actionurl); |
text=>$text,
|
$r->print($result.&return_to_editor()); |
faq=>273,
|
} elsif ($env{'form.phase'} eq 'check_embedded') { |
bug=>'Instructor Interface'});
|
# Process file upload - phase three - modify references in HTML file |
}
|
$uploadphase = 'modified_orightml'; |
|
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my ($destination,$dir_root) = &embedded_destination(); |
|
my $result = |
sub handler {
|
&Apache::loncommon::modify_html_refs('coursedoc',$destination, |
my $r = shift;
|
$docuname,$docudom,undef, |
&Apache::loncommon::content_type($r,'text/html');
|
$dir_root); |
$r->send_http_header;
|
$r->print($result.&return_to_editor()); |
return OK if $r->header_only;
|
} elsif ($env{'form.phase'} eq 'decompress_uploaded') { |
my $type = &Apache::loncommon::course_type();
|
$uploadphase = 'decompress_phase_one'; |
|
$r->print(&decompression_phase_one(). |
|
&return_to_editor()); |
# --------------------------------------------- Initialize help topics for this
|
} elsif ($env{'form.phase'} eq 'decompress_cleanup') { |
foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
|
$uploadphase = 'decompress_phase_two'; |
'Adding_External_Resource','Navigate_Content',
|
$r->print(&decompression_phase_two(). |
'Adding_Folders','Docs_Overview', 'Load_Map',
|
&return_to_editor()); |
'Supplemental','Score_Upload_Form','Adding_Pages',
|
} |
'Importing_LON-CAPA_Resource','Uploading_From_Harddrive',
|
} |
'Check_Resource_Versions','Verify_Content') {
|
|
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
|
if ($allowed && $toolsflag) { |
}
|
$r->print(&startContentScreen('tools')); |
# Composite help files
|
$r->print(&generate_admin_menu($crstype)); |
$help{'Syllabus'} = &Apache::loncommon::help_open_topic(
|
$r->print(&endContentScreen()); |
'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
|
} elsif ((!$showdoc) && (!$uploadphase)) { |
$help{'Simple Page'} = &Apache::loncommon::help_open_topic(
|
# ----------------------------------------------------------------------------- |
'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
|
my %lt=&Apache::lonlocal::texthash( |
$help{'Simple Problem'} = &Apache::loncommon::help_open_topic(
|
'uplm' => 'Upload a new main '.lc($crstype).' document', |
'Option_Response_Simple');
|
'upls' => 'Upload a new supplemental '.lc($crstype).' document', |
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
|
'impp' => 'Import a document', |
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
|
'copm' => 'All documents out of a published map into this folder', |
$help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
|
'upld' => 'Import Document', |
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
|
'srch' => 'Search', |
$help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
|
'impo' => 'Import', |
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
|
'wish' => 'Import from Wishlist', |
|
'selm' => 'Select Map', |
# does this user have privileges to modify docs
|
'load' => 'Load Map', |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
|
'reco' => 'Recover Deleted Documents', |
if ($allowed && $env{'form.verify'}) {
|
'newf' => 'New Folder', |
&init_breadcrumbs('verify','Verify Content');
|
'newp' => 'New Composite Page', |
&verifycontent($r);
|
'extr' => 'External Resource', |
} elsif ($allowed && $env{'form.listsymbs'}) {
|
'syll' => 'Syllabus', |
&init_breadcrumbs('listsymbs','List Symbs');
|
'navc' => 'Table of Contents', |
&list_symbs($r);
|
'sipa' => 'Simple Course Page', |
} elsif ($allowed && $env{'form.docslog'}) {
|
'sipr' => 'Simple Problem', |
&init_breadcrumbs('docslog','Show Log');
|
'drbx' => 'Drop Box', |
&docs_change_log($r);
|
'scuf' => 'External Scores (handgrade, upload, clicker)', |
} elsif ($allowed && $env{'form.versions'}) {
|
'bull' => 'Discussion Board', |
&init_breadcrumbs('versions','Check/Set Resource Versions');
|
'mypi' => 'My Personal Information Page', |
&checkversions($r);
|
'grpo' => 'Group Portfolio', |
} elsif ($allowed && $env{'form.dumpcourse'}) {
|
'rost' => 'Course Roster', |
&init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
|
'abou' => 'Personal Information Page for a User', |
&dumpcourse($r);
|
'imsf' => 'IMS Import', |
} elsif ($allowed && $env{'form.exportcourse'}) {
|
'imsl' => 'Import IMS package', |
&init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS');
|
'file' => 'File', |
&exportcourse($r);
|
'title' => 'Title', |
} else {
|
'comment' => 'Comment', |
# is this a standard course?
|
'parse' => 'Upload embedded images/multimedia files if HTML file', |
|
'nd' => 'Upload Document', |
my $standard=($env{'request.course.uri'}=~/^\/uploaded\//);
|
'pm' => 'Published Map', |
my $forcestandard = 0;
|
'sd' => 'Special Document', |
my $forcesupplement;
|
'mo' => 'More Options', |
my $script='';
|
); |
my $showdoc=0;
|
# ----------------------------------------------------------------------------- |
my $containertag;
|
my $fileupload=(<<FIUP); |
my $uploadtag;
|
$lt{'file'}:<br /> |
|
<input type="file" name="uploaddoc" size="40" /> |
|
FIUP |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
|
|
['folderpath','pagepath',
|
my $checkbox=(<<CHBO); |
'pagesymb']);
|
<!-- <label>$lt{'parse'}? |
# No folderpath, no pagepath, see if we have something stored
|
<input type="checkbox" name="parserflag" /> |
if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
|
</label> --> |
&Apache::loncommon::restore_course_settings('docs_folderpath',
|
<label> |
{'folderpath' => 'scalar'});
|
<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'} |
}
|
</label> |
if (!$env{'form.folderpath'}) {
|
CHBO |
&Apache::loncommon::restore_course_settings('docs_folderpath',
|
|
{'pagepath' => 'scalar'});
|
my $fileuploada = "<br clear='all' /><input type='submit' value='".$lt{'upld'}."' /> $help{'Uploading_From_Harddrive'}"; |
}
|
my $fileuploadform=(<<FUFORM); |
if ($env{'form.pagepath'}) {
|
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data"> |
$env{'form.folderpath'}='';
|
<input type="hidden" name="active" value="aa" /> |
}
|
$fileupload |
if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
|
<br /> |
$env{'form.folderpath'} = 'supplemental&'.
|
$lt{'title'}:<br /> |
&escape(&mt('Supplemental '.$type.' Documents')).'&'.
|
<input type="text" size="60" name="comment" /> |
$env{'form.folderpath'};
|
$uploadtag |
}
|
<input type="hidden" name="cmd" value="upload_default" /> |
&Apache::loncommon::store_course_settings('docs_folderpath',
|
<br /> |
{'pagepath' => 'scalar',
|
<span class="LC_nobreak" style="float:left"> |
'folderpath' => 'scalar'});
|
$checkbox |
if ($env{'form.folderpath'}) {
|
</span> |
my (@folderpath)=split('&',$env{'form.folderpath'});
|
FUFORM |
$env{'form.foldername'}=&unescape(pop(@folderpath));
|
$fileuploadform .= $fileuploada.'</form>'; |
$env{'form.folder'}=pop(@folderpath);
|
|
}
|
my $simpleeditdefaultform=(<<SEDFFORM); |
if ($env{'form.pagepath'}) {
|
<form action="/adm/coursedocs" method="post" name="simpleeditdefault"> |
my (@pagepath)=split('&',$env{'form.pagepath'});
|
<input type="hidden" name="active" value="bb" /> |
$env{'form.pagename'}=&unescape(pop(@pagepath));
|
SEDFFORM |
$env{'form.folder'}=pop(@pagepath);
|
my @simpleeditdefaultforma = ( |
$containertag = '<input type="hidden" name="pagepath" value="" />'.
|
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => "$uploadtag<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" }, |
'<input type="hidden" name="pagesymb" value="" />';
|
{ '<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'}" }, |
$uploadtag = '<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'.
|
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{wish}.'" onclick="javascript:open_Wishlist_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_Wishlist_Import();'>$lt{'wish'}</a>" }, |
'<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />';
|
); |
}
|
$simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma)); |
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
|
$simpleeditdefaultform .=(<<SEDFFORM); |
$showdoc='/'.$1;
|
<hr id="bb_hrule" style="width:0px;text-align:left;margin-left:0" /> |
}
|
$lt{'copm'}<br /> |
unless ($showdoc) { # got called from remote
|
<input type="text" size="40" name="importmap" /><br /> |
if (($env{'form.folder'}=~/^(?:group|default)_/) ||
|
<span class="LC_nobreak" style="float:left"><input type="button" |
($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
|
onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')" |
$forcestandard = 1;
|
value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" /> |
}
|
$help{'Load_Map'}</span> |
$forcesupplement=($env{'form.folder'}=~/^supplemental_/);
|
</form> |
|
SEDFFORM |
if ($allowed) {
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
|
my $extresourcesform=(<<ERFORM); |
$script=&Apache::lonratedt::editscript('simple');
|
<form action="/adm/coursedocs" method="post" name="newext"> |
}
|
$uploadtag |
} else { # got called in sequence from course
|
<input type="hidden" name="importdetail" value="" /> |
$allowed=0;
|
<a class="LC_menubuttons_link" href="javascript:makenewext('newext');">$lt{'extr'}</a>$help{'Adding_External_Resource'} |
}
|
</form> |
|
ERFORM |
# get course data
|
|
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
|
|
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
|
if ($allowed) { |
|
&update_paste_buffer($coursenum,$coursedom); |
# get personal data
|
$r->print(<<HIDDENFORM); |
my $uname=$env{'user.name'};
|
<form name="renameform" method="post" action="/adm/coursedocs"> |
my $udom=$env{'user.domain'};
|
<input type="hidden" name="title" /> |
my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
|
<input type="hidden" name="cmd" /> |
|
<input type="hidden" name="markcopy" /> |
# graphics settings
|
<input type="hidden" name="copyfolder" /> |
|
$containertag |
$iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
|
</form> |
|
|
if ($allowed) {
|
HIDDENFORM |
$script .= &editing_js($udom,$uname);
|
$r->print(&makesimpleeditform($uploadtag)."\n". |
}
|
&makedocslogform($uploadtag."\n". |
# -------------------------------------------------------------------- Body tag
|
'<input type="hidden" name="folder" value="'. |
$script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
|
$env{'form.folder'}.'" />'."\n")); |
my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
|
} |
$r->print(&Apache::loncommon::start_page("$type Documents", $script,
|
|
{'force_register' => $showdoc,
|
# Generate the tabs |
'bread_crumbs' => $brcrum}).
|
my $mode; |
&Apache::loncommon::help_open_menu('','',273,'RAT'));
|
if (($supplementalflag) && (!$allowed)) { |
|
&Apache::lonnavdisplay::startContentScreen($r,'supplemental'); |
my %allfiles = ();
|
} else { |
my %codebase = ();
|
$r->print(&startContentScreen(($supplementalflag?'suppdocs':'docs'))); |
my ($upload_result,$upload_output);
|
} |
if ($allowed) {
|
|
if (($env{'form.uploaddoc.filename'}) &&
|
# |
($env{'form.cmd'}=~/^upload_(\w+)/)) {
|
|
# Process file upload - phase one - upload and parse primary file.
|
my $savefolderpath; |
undef($hadchanges);
|
|
$upload_result = &process_file_upload(\$upload_output,$coursenum,
|
if ($allowed) { |
$coursedom,\%allfiles,
|
my $folder=$env{'form.folder'}; |
\%codebase,$1);
|
if ($folder eq '' || $supplementalflag) { |
if ($hadchanges) {
|
$folder='default'; |
&mark_hash_old();
|
$savefolderpath = $env{'form.folderpath'}; |
}
|
$env{'form.folderpath'}='default&'.&escape(&mt('Content')); |
if ($upload_result eq 'phasetwo') {
|
$uploadtag = '<input type="hidden" name="folderpath" value="'. |
$r->print($upload_output);
|
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'; |
}
|
} |
} elsif ($env{'form.phasetwo'}) {
|
my $postexec=''; |
my %newname = ();
|
if ($folder eq 'default') { |
my %origname = ();
|
$r->print('<script type="text/javascript">'."\n" |
my %attribs = ();
|
.'// <![CDATA['."\n" |
my $updateflag = 0;
|
.'this.window.name="loncapaclient";'."\n" |
my $residx = $env{'form.newidx'};
|
.'// ]]>'."\n" |
my $primary_url = &unescape($env{'form.primaryurl'});
|
.'</script>'."\n" |
# Process file upload - phase two - gather secondary files.
|
); |
for (my $i=0; $i<$env{'form.phasetwo'}; $i++) {
|
} else { |
if ($env{'form.embedded_item_'.$i.'.filename'}) {
|
#$postexec='self.close();'; |
my $javacodebase;
|
} |
$newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
|
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
$origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
|
'.sequence'; |
if (exists($env{'form.embedded_codebase_'.$i})) {
|
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
$javacodebase = &unescape($env{'form.embedded_codebase_'.$i});
|
'.page'; |
$origname{$i} =~ s#^\Q$javacodebase\E/##;
|
my $container='sequence'; |
}
|
if ($env{'form.pagepath'}) { |
my @attributes = ();
|
$container='page'; |
if ($env{'form.embedded_attrib_'.$i} =~ /:/) {
|
} |
@attributes = split(/:/,$env{'form.embedded_attrib_'.$i});
|
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container; |
} else {
|
|
@attributes = ($env{'form.embedded_attrib_'.$i});
|
my $imspform=(<<IMSPFORM); |
}
|
<form action="/adm/imsimportdocs" method="post" name="ims"> |
foreach my $attr (@attributes) {
|
<input type="hidden" name="folder" value="$folder" /> |
push(@{$attribs{$i}},&unescape($attr));
|
<a class="LC_menubuttons_link" href="javascript:makeims();">$lt{'imsf'}</a> |
}
|
</form> |
if ($javacodebase) {
|
IMSPFORM |
$codebase{$i} = $javacodebase;
|
|
$codebase{$i} =~ s#/$##;
|
my $newnavform=(<<NNFORM); |
$updateflag = 1;
|
<form action="/adm/coursedocs" method="post" name="newnav"> |
}
|
<input type="hidden" name="active" value="cc" /> |
}
|
$uploadtag |
unless ($newname{$i} eq $origname{$i}) {
|
<input type="hidden" name="importdetail" |
$updateflag = 1;
|
value="$lt{'navc'}=/adm/navmaps" /> |
}
|
<a class="LC_menubuttons_link" href="javascript:document.newnav.submit()">$lt{'navc'}</a> |
}
|
$help{'Navigate_Content'} |
# Process file upload - phase three - modify primary file
|
</form> |
if ($updateflag) {
|
NNFORM |
my ($content,$rtncode);
|
my $newsmppageform=(<<NSPFORM); |
my $updateflag = 0;
|
<form action="/adm/coursedocs" method="post" name="newsmppg"> |
my $getstatus = &Apache::lonnet::getuploaded('GET',$primary_url,$coursedom,$coursenum,\$content,\$rtncode);
|
<input type="hidden" name="active" value="cc" /> |
if ($getstatus eq 'ok') {
|
$uploadtag |
foreach my $item (keys(%newname)) {
|
<input type="hidden" name="importdetail" value="" /> |
if ($newname{$item} ne $origname{$item}) {
|
<a class="LC_menubuttons_link" href="javascript:makesmppage();"> $lt{'sipa'}</a> |
my $attrib_regexp = '';
|
$help{'Simple Page'} |
if (@{$attribs{$item}} > 1) {
|
</form> |
$attrib_regexp = join('|',@{$attribs{$item}});
|
NSPFORM |
} else {
|
|
$attrib_regexp = $attribs{$item}[0];
|
my $newsmpproblemform=(<<NSPROBFORM); |
}
|
<form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) {
|
<input type="hidden" name="active" value="cc" /> |
}
|
$uploadtag |
$content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
|
<input type="hidden" name="importdetail" value="" /> |
}
|
<a class="LC_menubuttons_link" href="javascript:makesmpproblem();">$lt{'sipr'}</a> |
if (exists($codebase{$item})) {
|
$help{'Simple Problem'} |
$content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs
|
</form> |
}
|
|
}
|
NSPROBFORM |
# Save edited file.
|
|
my $saveresult;
|
my $newdropboxform=(<<NDBFORM); |
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
|
<form action="/adm/coursedocs" method="post" name="newdropbox"> |
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
|
<input type="hidden" name="active" value="cc" /> |
my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult);
|
$uploadtag |
} else {
|
<input type="hidden" name="importdetail" value="" /> |
&Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
|
<a class="LC_menubuttons_link" href="javascript:makedropbox();">$lt{'drbx'}</a> |
}
|
</form> |
}
|
NDBFORM |
}
|
|
}
|
my $newexuploadform=(<<NEXUFORM); |
|
<form action="/adm/coursedocs" method="post" name="newexamupload"> |
unless ($showdoc || $upload_result eq 'phasetwo') {
|
<input type="hidden" name="active" value="cc" /> |
# -----------------------------------------------------------------------------
|
$uploadtag |
my %lt=&Apache::lonlocal::texthash(
|
<input type="hidden" name="importdetail" value="" /> |
'uplm' => 'Upload a new main '.lc($type).' document',
|
<a class="LC_menubuttons_link" href="javascript:makeexamupload();">$lt{'scuf'}</a> |
'upls' => 'Upload a new supplemental '.lc($type).' document',
|
$help{'Score_Upload_Form'} |
'impp' => 'Import a document',
|
</form> |
'pubd' => 'Published Documents',
|
NEXUFORM |
'copm' => 'All documents out of a published map into this folder',
|
|
'upld' => 'Upload Document',
|
my $newbulform=(<<NBFORM); |
'srch' => 'Search',
|
<form action="/adm/coursedocs" method="post" name="newbul"> |
'impo' => 'Import',
|
<input type="hidden" name="active" value="cc" /> |
'book' => 'Import Bookmarks',
|
$uploadtag |
'selm' => 'Select Map',
|
<input type="hidden" name="importdetail" value="" /> |
'load' => 'Load Map',
|
<a class="LC_menubuttons_link" href="javascript:makebulboard();" >$lt{'bull'}</a> |
'reco' => 'Recover Deleted Resources',
|
$help{'Bulletin Board'} |
'newf' => 'New Folder',
|
</form> |
'newp' => 'New Composite Page',
|
NBFORM |
'extr' => 'External Resource',
|
|
'syll' => 'Syllabus',
|
my $newaboutmeform=(<<NAMFORM); |
'navc' => 'Navigate Contents',
|
<form action="/adm/coursedocs" method="post" name="newaboutme"> |
'sipa' => 'Simple Page',
|
<input type="hidden" name="active" value="cc" /> |
'sipr' => 'Simple Problem',
|
$uploadtag |
'drbx' => 'Drop Box',
|
<input type="hidden" name="importdetail" |
'scuf' => 'Score Upload Form',
|
value="$plainname=/adm/$udom/$uname/aboutme" /> |
'bull' => 'Bulletin Board',
|
<a class="LC_menubuttons_link" href="javascript:document.newaboutme.submit()">$lt{'mypi'}</a> |
'mypi' => 'My Personal Info',
|
$help{'My Personal Information Page'} |
'grpo' => 'Group Files',
|
</form> |
'rost' => 'Course Roster',
|
NAMFORM |
'abou' => 'About User',
|
|
'imsf' => 'Import IMS package',
|
my $newaboutsomeoneform=(<<NASOFORM); |
'file' => 'File',
|
<form action="/adm/coursedocs" method="post" name="newaboutsomeone"> |
'title' => 'Title',
|
<input type="hidden" name="active" value="cc" /> |
'comment' => 'Comment',
|
$uploadtag |
'parse' => 'Upload embedded images/multimedia files if HTML file!',
|
<input type="hidden" name="importdetail" value="" /> |
'nd' => 'New Document',
|
<a class="LC_menubuttons_link" href="javascript:makeabout();">$lt{'abou'}</a> |
'pm' => 'Published Map',
|
</form> |
'sd' => 'Special Document',
|
NASOFORM |
'mo' => 'More Options',
|
|
'hao' => 'Hide all Options'
|
|
);
|
my $newrosterform=(<<NROSTFORM); |
# -----------------------------------------------------------------------------
|
<form action="/adm/coursedocs" method="post" name="newroster"> |
my $fileupload=(<<FIUP);
|
<input type="hidden" name="active" value="cc" /> |
$lt{'file'}:<br />
|
$uploadtag |
<input type="file" name="uploaddoc" size="40" />
|
<input type="hidden" name="importdetail" |
FIUP
|
value="$lt{'rost'}=/adm/viewclasslist" /> |
|
<a class="LC_menubuttons_link" href="javascript:document.newroster.submit()">$lt{'rost'}</a> |
my $checkbox=(<<CHBO);
|
$help{'Course Roster'} |
<!-- <label>$lt{'parse'}?
|
</form> |
<input type="checkbox" name="parserflag" />
|
NROSTFORM |
</label> -->
|
|
<label>
|
my $specialdocumentsform; |
<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'}
|
my @specialdocumentsforma; |
</label>
|
my $gradingform; |
CHBO
|
my @gradingforma; |
|
my $communityform; |
my $fileuploadform=(<<FUFORM);
|
my @communityforma; |
<form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
|
my $newfolderform; |
$fileupload
|
my $newfolderb; |
<br />
|
|
$lt{'title'}:<br />
|
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
<input type="text" size="50" name="comment" />
|
|
$uploadtag
|
my $newpageform=(<<NPFORM); |
<input type="hidden" name="cmd" value="upload_default" />
|
<form action="/adm/coursedocs" method="post" name="newpage"> |
<br />
|
<input type="hidden" name="folderpath" value="$path" /> |
<span class="LC_nobreak">
|
<input type="hidden" name="importdetail" value="" /> |
$checkbox
|
<input type="hidden" name="active" value="cc" /> |
</span>
|
<a class="LC_menubuttons_link" href="javascript:makenewpage(document.newpage,'$pageseq');">$lt{'newp'}</a> |
<br />
|
$help{'Adding_Pages'} |
<br />
|
</form> |
<span class="LC_nobreak">
|
NPFORM |
<input type="submit" value="$lt{'upld'}" />
|
|
$help{'Uploading_From_Harddrive'}
|
|
</span>
|
$newfolderform=(<<NFFORM); |
</form>
|
<form action="/adm/coursedocs" method="post" name="newfolder"> |
FUFORM
|
<input type="hidden" name="folderpath" value="$path" /> |
|
<input type="hidden" name="importdetail" value="" /> |
my $simpleeditdefaultform=(<<SEDFFORM);
|
<input type="hidden" name="active" value="aa" /> |
<form action="/adm/coursedocs" method="post" name="simpleeditdefault">
|
<a href="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'} |
$lt{'pubd'}<br />
|
</form> |
$uploadtag
|
NFFORM |
<input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" />
|
|
<br />
|
my $newsylform=(<<NSYLFORM); |
<span class="LC_nobreak">
|
<form action="/adm/coursedocs" method="post" name="newsyl"> |
<input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" />
|
<input type="hidden" name="active" value="cc" /> |
$help{'Importing_LON-CAPA_Resource'}
|
$uploadtag |
</span>
|
<input type="hidden" name="importdetail" |
<br />
|
value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" /> |
<input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
|
<a class="LC_menubuttons_link" href="javascript:document.newsyl.submit()">$lt{'syll'}</a> |
<hr />
|
$help{'Syllabus'} |
<p>
|
|
$lt{'copm'}<br />
|
</form> |
<input type="text" size="40" name="importmap" /><br />
|
NSYLFORM |
<span class="LC_nobreak"><input type="button"
|
|
onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
|
my $newgroupfileform=(<<NGFFORM); |
value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
|
<form action="/adm/coursedocs" method="post" name="newgroupfiles"> |
$help{'Load_Map'}</span>
|
<input type="hidden" name="active" value="cc" /> |
</p>
|
$uploadtag |
</form>
|
<input type="hidden" name="importdetail" |
SEDFFORM
|
value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" /> |
|
<a class="LC_menubuttons_link" href="javascript:document.newgroupfiles.submit()">$lt{'grpo'}</a> |
my $extresourcesform=(<<ERFORM);
|
$help{'Group Portfolio'} |
<form action="/adm/coursedocs" method="post" name="newext">
|
</form> |
$uploadtag
|
NGFFORM |
<input type="hidden" name="importdetail" value="" />
|
@specialdocumentsforma=( |
<span class="LC_nobreak">
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/page.png" alt="'.$lt{newp}.'" onclick="javascript:makenewpage(document.newpage,\''.$pageseq.'\');" />'=>$newpageform}, |
<input name="newext" type="button" onClick="javascript:makenewext('newext');"
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.newsyl.submit()" />'=>$newsylform}, |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="document.newnav.submit()" />'=>$newnavform}, |
</span>
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simple.png" alt="'.$lt{sipa}.'" onclick="javascript:makesmppage();" />'=>$newsmppageform}, |
</form>
|
); |
ERFORM
|
$specialdocumentsform = &create_form_ul(&create_list_elements(@specialdocumentsforma)); |
|
|
if ($allowed) {
|
|
&update_paste_buffer($coursenum,$coursedom);
|
my @importdoc = ( |
my %lt=&Apache::lonlocal::texthash(
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'newext\');" />'=>$extresourcesform}, |
'vc' => 'Verify Content',
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:makeims();" />'=>$imspform},); |
'cv' => 'Check/Set Resource Versions',
|
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '<hr id="cc_hrule" style="width:0px;text-align:left;margin-left:0" />' . $fileuploadform; |
'ls' => 'List Symbs',
|
|
'sl' => 'Show Log'
|
@gradingforma=( |
);
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{sipr}.'" onclick="javascript:makesmpproblem();" />'=>$newsmpproblemform}, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/dropbox.png" alt="'.$lt{drbx}.'" onclick="javascript:makedropbox();" />'=>$newdropboxform}, |
my $folderpath=$env{'form.folderpath'};
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/scoreupfrm.png" alt="'.$lt{scuf}.'" onclick="javascript:makeexamupload();" />'=>$newexuploadform}, |
if (!$folderpath) {
|
|
if ($env{'form.folder'} eq '' ||
|
); |
$env{'form.folder'} eq 'supplemental') {
|
$gradingform = &create_form_ul(&create_list_elements(@gradingforma)); |
$folderpath='default&'.
|
|
&escape(&mt('Main '.$type.' Documents'));
|
@communityforma=( |
}
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/bchat.png" alt="'.$lt{bull}.'" onclick="javascript:makebulboard();" />'=>$newbulform}, |
}
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="javascript:makebulboard();" />'=>$newaboutmeform}, |
unless ($env{'form.pagepath'}) {
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/aboutme.png" alt="'.$lt{abou}.'" onclick="javascript:makeabout();" />'=>$newaboutsomeoneform}, |
$containertag = '<input type="hidden" name="folderpath" value="" />';
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/clst.png" alt="'.$lt{rost}.'" onclick="document.newroster.submit()" />'=>$newrosterform}, |
$uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/groupportfolio.png" alt="'.$lt{grpo}.'" onclick="document.newgroupfiles.submit()" />'=>$newgroupfileform}, |
}
|
); |
$r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));
|
$communityform = &create_form_ul(&create_list_elements(@communityforma)); |
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
|
|
&mt('Editing the Table of Contents for your '.$type)));
|
my %orderhash = ( |
}
|
'aa' => ['Import Documents',$fileuploadform], |
# --------------------------------------------------------- Standard documents
|
'bb' => ['Published Resources',$simpleeditdefaultform], |
$r->print('<table class="LC_docs_documents">');
|
'cc' => ['Grading Resources',$gradingform], |
|
); |
if (($standard) && ($allowed) && (!$forcesupplement)) {
|
unless ($env{'form.pagepath'}) { |
$r->print('<tr><td class="LC_docs_document">');
|
$orderhash{'00'} = ['Newfolder',$newfolderform]; |
# '<h2>'.&mt('Main Course Documents').
|
$orderhash{'dd'} = ['Collaboration',$communityform]; |
# ($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>');
|
$orderhash{'ee'} = ['Special Documents',$specialdocumentsform]; |
my $folder=$env{'form.folder'};
|
} |
if ($folder eq '' || $folder eq 'supplemental') {
|
|
$folder='default';
|
$hadchanges=0; |
$env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
|
unless (($supplementalflag || $toolsflag)) { |
$uploadtag = '<input type="hidden" name="folderpath" value="'.
|
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
|
$supplementalflag,\%orderhash,$iconpath); |
}
|
if ($error) { |
my $postexec='';
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
if ($folder eq 'default') {
|
} |
$r->print('<script type="text/javascript">this.window.name="loncapaclient";</script>');
|
if ($hadchanges) { |
} else {
|
&mark_hash_old(); |
#$postexec='self.close();';
|
} |
}
|
|
$hadchanges=0;
|
&changewarning($r,''); |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
|
} |
$upload_output,$type);
|
} |
if ($error) {
|
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>');
|
# Supplemental documents start here |
}
|
|
if ($hadchanges) {
|
my $folder=$env{'form.folder'}; |
&mark_hash_old();
|
unless ($supplementalflag) { |
}
|
$folder='supplemental'; |
&changewarning($r,$postexec);
|
} |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
|
if ($folder =~ /^supplemental$/ && |
'.sequence';
|
(($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) { |
my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
|
$env{'form.folderpath'} = &supplemental_base(); |
'.page';
|
} elsif ($allowed) { |
my $container='sequence';
|
$env{'form.folderpath'} = $savefolderpath; |
if ($env{'form.pagepath'}) {
|
} |
$container='page';
|
$env{'form.pagepath'} = ''; |
}
|
if ($allowed) { |
my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
|
my $folderseq= |
|
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time. |
|
'.sequence'; |
|
|
my $recoverform=(<<RFORM);
|
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
<form action="/adm/groupsort" method="post" name="recover">
|
|
<input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
|
my $supupdocformbtn = "<input type='submit' value='".$lt{'upld'}."' />$help{'Uploading_From_Harddrive'}"; |
</form>
|
my $supupdocform=(<<SUPDOCFORM); |
RFORM
|
<form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data"> |
|
<input type="hidden" name="active" value="ee" /> |
my $imspform=(<<IMSPFORM);
|
$fileupload |
<form action="/adm/imsimportdocs" method="post" name="ims">
|
<br /> |
<input type="hidden" name="folder" value="$folder" />
|
<br /> |
<input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" />
|
<span class="LC_nobreak"> |
</form>
|
$checkbox |
IMSPFORM
|
</span> |
|
<br /><br /> |
my $newnavform=(<<NNFORM);
|
$lt{'comment'}:<br /> |
<form action="/adm/coursedocs" method="post" name="newnav">
|
<textarea cols="50" rows="4" name="comment"></textarea> |
$uploadtag
|
<br /> |
<input type="hidden" name="importdetail"
|
<input type="hidden" name="folderpath" value="$path" /> |
value="$lt{'navc'}=/adm/navmaps" />
|
<input type="hidden" name="cmd" value="upload_supplemental" /> |
<span class="LC_nobreak">
|
SUPDOCFORM |
<input name="newnav" type="submit" value="$lt{'navc'}" />
|
$supupdocform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'}))."</form>"; |
$help{'Navigate_Content'}
|
|
</span>
|
my $supnewfolderform=(<<SNFFORM); |
</form>
|
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
NNFORM
|
<input type="hidden" name="active" value="ee" /> |
my $newsmppageform=(<<NSPFORM);
|
<input type="hidden" name="folderpath" value="$path" /> |
<form action="/adm/coursedocs" method="post" name="newsmppg">
|
<input type="hidden" name="importdetail" value="" /> |
$uploadtag
|
<a class="LC_menubuttons_link" href="javascript:makenewfolder(document.supnewfolder,'$folderseq');">$lt{'newf'}</a> |
<input type="hidden" name="importdetail" value="" />
|
$help{'Adding_Folders'} |
<span class="LC_nobreak">
|
</form> |
<input name="newsmppg" type="button" value="$lt{'sipa'}"
|
SNFFORM |
onClick="javascript:makesmppage();" /> $help{'Simple Page'}
|
|
</span>
|
|
</form>
|
my $supnewextform=(<<SNEFORM); |
NSPFORM
|
<form action="/adm/coursedocs" method="post" name="supnewext"> |
|
<input type="hidden" name="active" value="ff" /> |
my $newsmpproblemform=(<<NSPROBFORM);
|
<input type="hidden" name="folderpath" value="$path" /> |
<form action="/adm/coursedocs" method="post" name="newsmpproblem">
|
<input type="hidden" name="importdetail" value="" /> |
$uploadtag
|
<a class="LC_menubuttons_link" href="javascript:makenewext('supnewext');">$lt{'extr'}</a> $help{'Adding_External_Resource'} |
<input type="hidden" name="importdetail" value="" />
|
</form> |
<span class="LC_nobreak">
|
SNEFORM |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}"
|
|
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
|
my $supnewsylform=(<<SNSFORM); |
</span>
|
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
</form>
|
<input type="hidden" name="active" value="ff" /> |
|
<input type="hidden" name="folderpath" value="$path" /> |
NSPROBFORM
|
<input type="hidden" name="importdetail" |
|
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
my $newdropboxform=(<<NDBFORM);
|
<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a> |
<form action="/adm/coursedocs" method="post" name="newdropbox">
|
$help{'Syllabus'} |
$uploadtag
|
</form> |
<input type="hidden" name="importdetail" value="" />
|
SNSFORM |
<span class="LC_nobreak">
|
|
<input name="newdropbox" type="button" value="$lt{'drbx'}"
|
my $supnewaboutmeform=(<<SNAMFORM); |
onClick="javascript:makedropbox();" />
|
<form action="/adm/coursedocs" method="post" name="supnewaboutme"> |
</span>
|
<input type="hidden" name="active" value="ff" /> |
</form>
|
<input type="hidden" name="folderpath" value="$path" /> |
NDBFORM
|
<input type="hidden" name="importdetail" |
|
value="$plainname=/adm/$udom/$uname/aboutme" /> |
my $newexuploadform=(<<NEXUFORM);
|
<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a> |
<form action="/adm/coursedocs" method="post" name="newexamupload">
|
$help{'My Personal Information Page'} |
$uploadtag
|
</form> |
<input type="hidden" name="importdetail" value="" />
|
SNAMFORM |
<span class="LC_nobreak">
|
|
<input name="newexamupload" type="button" value="$lt{'scuf'}"
|
|
onClick="javascript:makeexamupload();" />
|
my @specialdocs = ( |
$help{'Score_Upload_Form'}
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.supnewsyl.submit()" />' |
</span>
|
=>$supnewsylform}, |
</form>
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="document.supnewaboutme.submit()" />' |
NEXUFORM
|
=>$supnewaboutmeform}, |
|
); |
my $newbulform=(<<NBFORM);
|
my @supimportdoc = ( |
<form action="/adm/coursedocs" method="post" name="newbul">
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'supnewext\');" />' |
$uploadtag
|
=>$supnewextform}, |
<input type="hidden" name="importdetail" value="" />
|
); |
<span class="LC_nobreak">
|
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '<hr id="ee_hrule" style="width:0px;text-align:left;margin-left:0" />' . $supupdocform; |
<input name="newbulletin" type="button" value="$lt{'bull'}"
|
my %suporderhash = ( |
onClick="javascript:makebulboard();" />
|
'00' => ['Supnewfolder', $supnewfolderform], |
$help{'Bulletin Board'}
|
'ee' => ['Import Documents',$supupdocform], |
</span>
|
'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] |
</form>
|
); |
NBFORM
|
if ($supplementalflag) { |
|
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
my $newaboutmeform=(<<NAMFORM);
|
$supplementalflag,\%suporderhash,$iconpath); |
<form action="/adm/coursedocs" method="post" name="newaboutme">
|
if ($error) { |
$uploadtag
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
<input type="hidden" name="importdetail"
|
} |
value="$plainname=/adm/$udom/$uname/aboutme" />
|
} |
<span class="LC_nobreak">
|
} elsif ($supplementalflag) { |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
|
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
$help{'My Personal Info'}
|
$supplementalflag,'',$iconpath); |
</span>
|
if ($error) { |
</form>
|
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
NAMFORM
|
} |
|
} |
my $newaboutsomeoneform=(<<NASOFORM);
|
|
<form action="/adm/coursedocs" method="post" name="newaboutsomeone">
|
$r->print(&endContentScreen()); |
$uploadtag
|
|
<input type="hidden" name="importdetail" value="" />
|
if ($allowed) { |
<span class="LC_nobreak">
|
$r->print(' |
<input name="newaboutsomeone" type="button" value="$lt{'abou'}"
|
<form method="post" name="extimport" action="/adm/coursedocs"> |
onClick="javascript:makeabout();" />
|
<input type="hidden" name="title" /> |
</span>
|
<input type="hidden" name="url" /> |
</form>
|
<input type="hidden" name="useform" /> |
NASOFORM
|
<input type="hidden" name="residx" /> |
|
</form>'); |
|
} |
my $newrosterform=(<<NROSTFORM);
|
} elsif ($showdoc) { |
<form action="/adm/coursedocs" method="post" name="newroster">
|
# -------------------------------------------------------- This is showdoc mode |
$uploadtag
|
$r->print("<h1>".&mt('Uploaded Document').' - '. |
<input type="hidden" name="importdetail"
|
&Apache::lonnet::gettitle($r->uri).'</h1><p>'. |
value="$lt{'rost'}=/adm/viewclasslist" />
|
&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><table>". |
<span class="LC_nobreak">
|
&entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table>'); |
<input name="newroster" type="submit" value="$lt{'rost'}" />
|
} |
$help{'Course Roster'}
|
} |
</span>
|
$r->print(&Apache::loncommon::end_page()); |
</form>
|
return OK; |
NROSTFORM
|
} |
|
|
$r->print(<<ENDFORM);
|
sub embedded_form_elems { |
|
my ($phase,$primaryurl,$newidx) = @_; |
<ul class="LC_TabContent">
|
my $folderpath = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); |
<li>$lt{'nd'}</li>
|
return <<STATE; |
<li>$lt{'pm'}</li>
|
<input type="hidden" name="folderpath" value="$folderpath" /> |
<li>$lt{'pubd'}</li>
|
<input type="hidden" name="cmd" value="upload_embedded" /> |
<li>$lt{'sd'}</li>
|
<input type="hidden" name="newidx" value="$newidx" /> |
<li>$lt{'mo'}</li>
|
<input type="hidden" name="phase" value="$phase" /> |
<li>$lt{'hao'}</li>
|
<input type="hidden" name="primaryurl" value="$primaryurl" /> |
</ul>
|
STATE |
|
} |
<table class="LC_docs_adddocs">
|
|
<!-- <tr>
|
sub embedded_destination { |
<th>$lt{'uplm'}</th>
|
my $folder=$env{'form.folder'}; |
<th>$lt{'impp'}</th>
|
my $destination = 'docs/'; |
<th>$lt{'spec'}</th>
|
if ($folder =~ /^supplemental/) { |
</tr> -->
|
$destination = 'supplemental/'; |
<tr>
|
} |
<td>
|
if (($folder eq 'default') || ($folder eq 'supplemental')) { |
$fileuploadform
|
$destination .= 'default/'; |
</td>
|
} elsif ($folder =~ /^(default|supplemental)_(\d+)$/) { |
<td>
|
$destination .= $2.'/'; |
$simpleeditdefaultform
|
} |
<hr />
|
$destination .= $env{'form.newidx'}; |
$recoverform
|
my $dir_root = '/userfiles'; |
ENDFORM
|
return ($destination,$dir_root); |
unless ($env{'form.pagepath'}) {
|
} |
$r->print(<<ENDFORM);
|
|
<hr />
|
sub return_to_editor { |
$extresourcesform
|
my $actionurl = '/adm/coursedocs'; |
<br />
|
return '<p><form name="backtoeditor" method="post" action="'.$actionurl.'" />'."\n". |
$imspform
|
'<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" /></form>'."\n". |
ENDFORM
|
'<a href="javascript:document.backtoeditor.submit();">'.&mt('Return to Editor'). |
}
|
'</a></p>'; |
$r->print('</td><td>');
|
} |
unless ($env{'form.pagepath'}) {
|
|
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
|
sub decompression_info { |
|
my ($destination,$dir_root) = &embedded_destination(); |
|
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $newpageform=(<<NPFORM);
|
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
<form action="/adm/coursedocs" method="post" name="newpage">
|
my $container='sequence'; |
<input type="hidden" name="folderpath" value="$path" />
|
my ($pathitem,$hiddenelem); |
<input type="hidden" name="importdetail" value="" />
|
my @hiddens = ('newidx','comment','position'); |
<span class="LC_nobreak">
|
if ($env{'form.pagepath'}) { |
<input name="newpage" type="button"
|
$container='page'; |
onClick="javascript:makenewpage(this.form,'$pageseq');"
|
$pathitem = 'pagepath'; |
value="$lt{'newp'}" />$help{'Adding_Pages'}
|
} else { |
</span>
|
$pathitem = 'folderpath'; |
</form>
|
} |
NPFORM
|
unshift(@hiddens,$pathitem); |
|
foreach my $item (@hiddens) { |
my $newfolderform=(<<NFFORM);
|
if ($env{'form.'.$item}) { |
<form action="/adm/coursedocs" method="post" name="newfolder">
|
$hiddenelem .= '<input type="hidden" name="'.$item.'" value="'. |
<input type="hidden" name="folderpath" value="$path" />
|
$env{'form.'.$item}.'" />'."\n"; |
<input type="hidden" name="importdetail" value="" />
|
} |
<span class="LC_nobreak">
|
} |
<input name="newfolder" type="button"
|
return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container, |
onClick="javascript:makenewfolder(this.form,'$folderseq');"
|
$hiddenelem); |
value="$lt{'newf'}" />$help{'Adding_Folders'}
|
} |
</span>
|
|
</form>
|
sub decompression_phase_one { |
NFFORM
|
my ($dir,$file,$warning,$error,$output); |
|
my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)= |
my $newsylform=(<<NSYLFORM);
|
&decompression_info(); |
<form action="/adm/coursedocs" method="post" name="newsyl">
|
if ($env{'form.archiveurl'} !~ m{^/uploaded/\Q$docudom/$docuname/docs/\E(?:default|supplemental|\d+).*/([^/]+)$}) { |
$uploadtag
|
$error = &mt('Archive file "[_1]" not in the expected location.',$env{'form.archiveurl'}); |
<input type="hidden" name="importdetail"
|
} else { |
value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
|
my $file = $1; |
<span class="LC_nobreak">
|
$output = |
<input name="newsyl" type="submit" value="$lt{'syll'}" />
|
&Apache::loncommon::process_decompression($docudom,$docuname,$file, |
$help{'Syllabus'}
|
$destination,$dir_root, |
</span>
|
$hiddenelem); |
</form>
|
if ($env{'form.autoextract_camtasia'}) { |
NSYLFORM
|
$output .= &remove_archive($docudom,$docuname,$container); |
|
} |
my $newgroupfileform=(<<NGFFORM);
|
} |
<form action="/adm/coursedocs" method="post" name="newgroupfiles">
|
if ($error) { |
$uploadtag
|
$output .= '<p class="LC_error">'.&mt('Not extracted.').'<br />'. |
<input type="hidden" name="importdetail"
|
$error.'</p>'."\n"; |
value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
|
} |
<span class="LC_nobreak">
|
if ($warning) { |
<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" />
|
$output .= '<p class="LC_warning">'.$warning.'</p>'."\n"; |
$help{'Group Files'}
|
} |
</span>
|
return $output; |
</form>
|
} |
NGFFORM
|
|
|
sub decompression_phase_two { |
|
my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)= |
$r->print(<<ENDFORM);
|
&decompression_info(); |
<br />
|
my $output; |
$newfolderform
|
if ($env{'form.archivedelete'}) { |
<br />
|
$output = &remove_archive($docudom,$docuname,$container); |
$newpageform
|
} |
<br />
|
$output .= |
$newsylform
|
&Apache::loncommon::process_extracted_files('coursedocs',$docudom,$docuname, |
<br />
|
$destination,$dir_root,$hiddenelem); |
$newnavform
|
return $output; |
<br />
|
} |
$newsmppageform
|
|
<br />
|
sub remove_archive { |
$newsmpproblemform
|
my ($docudom,$docuname,$container) = @_; |
<br />
|
my $map = $env{'form.folder'}.'.'.$container; |
$newdropboxform
|
my ($output,$delwarning,$delresult,$url); |
<br />
|
my ($errtext,$fatal) = &mapread($docuname,$docudom,$map); |
$newexuploadform
|
if ($fatal) { |
<br />
|
if ($container eq 'page') { |
$newbulform
|
$delwarning = &mt('An error occurred retrieving the contents of the current page.'); |
<br />
|
} else { |
$newaboutmeform
|
$delwarning = &mt('An error occurred retrieving the contents of the current folder.'); |
<br />
|
} |
$newaboutsomeoneform
|
$delwarning .= &mt('As a result the archive file has not been removed.'); |
<br />
|
} else { |
$newgroupfileform
|
my $currcmd = $env{'form.cmd'}; |
<br />
|
my $position = $env{'form.position'}; |
$newrosterform
|
if ($position > 0) { |
ENDFORM
|
$env{'form.cmd'} = 'del_'.$position; |
}
|
my ($title,$url,@rrest) = |
if ($env{'form.pagepath'}) {
|
split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]); |
$r->print(<<ENDBLOCK);
|
if (&handle_edit_cmd($docuname,$docudom)) { |
$newsmpproblemform
|
($errtext,$fatal) = &storemap($docuname,$docudom,$map); |
<br />
|
if ($fatal) { |
$newexuploadform
|
if ($container eq 'page') { |
ENDBLOCK
|
$delwarning = &mt('An error occurred updating the contents of the current page.'); |
}
|
} else { |
$r->print('</td></tr>'."\n".
|
$delwarning = &mt('An error occurred updating the contents of the current folder.'); |
'</table>');
|
} |
$r->print('</td></tr>');
|
} else { |
}
|
$delresult = &mt('Archive file removed.'); |
# ----------------------------------------------------- Supplemental documents
|
} |
if (!$forcestandard) {
|
} |
$r->print('<tr><td class="LC_docs_document">');
|
} |
# '<h2>'.&mt('Supplemental Course Documents').
|
$env{'form.cmd'} = $currcmd; |
# ($allowed?' '.$help{'Supplemental'}:'').'</h2>');
|
} |
my $folder=$env{'form.folder'};
|
if ($delwarning) { |
unless ($folder=~/^supplemental/) {
|
$output = '<p class="LC_warning">'. |
$folder='supplemental';
|
$delwarning. |
}
|
'</p>'; |
if ($folder =~ /^supplemental$/ &&
|
} |
(($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
|
if ($delresult) { |
$env{'form.folderpath'} = 'supplemental&'.
|
$output .= '<p class="LC_info">'. |
&escape(&mt('Supplemental '.$type.' Documents'));
|
$delresult. |
}
|
'</p>'; |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
|
} |
if ($error) {
|
return $output; |
$r->print('<p><span class="LC_error">'.$error.'</span></p>');
|
} |
}
|
|
if ($allowed) {
|
sub generate_admin_menu { |
my $folderseq=
|
my ($crstype) = @_; |
'/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
|
my $lc_crstype = lc($crstype); |
'.sequence';
|
my ($home,$other,%outhash)=&authorhosts(); |
|
my %lt=&Apache::lonlocal::texthash ( |
my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
|
'vc' => 'Verify Content', |
|
'cv' => 'Check/Set Resource Versions', |
my $supupdocform=(<<SUPDOCFORM);
|
'ls' => 'List Resource Identifiers', |
<form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
|
'imse' => 'Export contents to IMS Archive', |
$fileupload
|
'dcd' => "Dump $crstype Content to Authoring Space", |
<br />
|
); |
<br />
|
my ($candump,$dumpurl); |
<span class="LC_nobreak">
|
if ($home + $other > 0) { |
$checkbox
|
$candump = 'F'; |
</span>
|
if ($home) { |
<br /><br />
|
$dumpurl = "javascript:injectData(document.courseverify,'dummy','dumpcourse','$lt{'dcd'}')"; |
$lt{'comment'}:<br />
|
} else { |
<textarea cols=50 rows=4 name='comment'>
|
my @hosts; |
</textarea>
|
foreach my $aurole (keys(%outhash)) { |
<br />
|
unless(grep(/^\Q$outhash{$aurole}\E/,@hosts)) { |
<input type="hidden" name="folderpath" value="$path" />
|
push(@hosts,$outhash{$aurole}); |
<input type="hidden" name="cmd" value="upload_supplemental" />
|
} |
<span class="LC_nobreak">
|
} |
<input type="submit" value="$lt{'upld'}" />
|
if (@hosts == 1) { |
$help{'Uploading_From_Harddrive'}
|
my $switchto = '/adm/switchserver?otherserver='.$hosts[0]. |
</span>
|
'&role='. |
</form>
|
&HTML::Entities::encode($env{'request.role'},'"<>&').'&origurl='. |
SUPDOCFORM
|
&HTML::Entities::encode('/adm/coursedocs?dumpcourse=1','"<>&'); |
|
$dumpurl = "javascript:dump_needs_switchserver('$switchto')"; |
my $supnewfolderform=(<<SNFFORM);
|
} else { |
<form action="/adm/coursedocs" method="post" name="supnewfolder">
|
$dumpurl = "javascript:choose_switchserver_window()"; |
<input type="hidden" name="folderpath" value="$path" />
|
} |
<input type="hidden" name="importdetail" value="" />
|
} |
<span class="LC_nobreak">
|
} |
<input name="newfolder" type="button"
|
my @menu= |
onClick="javascript:makenewfolder(this.form,'$folderseq');"
|
({ categorytitle=>'Administration', |
value="$lt{'newf'}" /> $help{'Adding_Folders'}
|
items =>[ |
</span>
|
{ linktext => $lt{'vc'}, |
</form>
|
url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')", |
SNFFORM
|
permission => 'F', |
|
help => 'Verify_Content', |
|
icon => 'verify.png', |
my $supnewextform=(<<SNEFORM);
|
linktitle => 'Verify contents can be retrieved/rendered', |
<form action="/adm/coursedocs" method="post" name="supnewext">
|
}, |
<input type="hidden" name="folderpath" value="$path" />
|
{ linktext => $lt{'cv'}, |
<input type="hidden" name="importdetail" value="" />
|
url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')", |
<span class="LC_nobreak">
|
permission => 'F', |
<input name="newext" type="button"
|
help => 'Check_Resource_Versions', |
onClick="javascript:makenewext('supnewext');"
|
icon => 'resversion.png', |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
|
linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions", |
</span>
|
}, |
</form>
|
{ linktext => $lt{'ls'}, |
SNEFORM
|
url => "javascript:injectData(document.courseverify,'dummy','listsymbs','$lt{'ls'}')", |
|
permission => 'F', |
my $supnewsylform=(<<SNSFORM);
|
#help => '', |
<form action="/adm/coursedocs" method="post" name="supnewsyl">
|
icon => 'symbs.png', |
<input type="hidden" name="folderpath" value="$path" />
|
linktitle => "List the unique identifier used for each resource instance in your $lc_crstype" |
<input type="hidden" name="importdetail"
|
}, |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
|
] |
<span class="LC_nobreak">
|
}, |
<input name="newsyl" type="submit" value="$lt{'syll'}" />
|
{ categorytitle=>'Export', |
$help{'Syllabus'}
|
items =>[ |
</span>
|
{ linktext => $lt{'imse'}, |
</form>
|
url => "javascript:injectData(document.courseverify,'dummy','exportcourse','$lt{'imse'}')", |
SNSFORM
|
permission => 'F', |
|
help => 'Docs_Export_Course_Docs', |
my $supnewaboutmeform=(<<SNAMFORM);
|
icon => 'imsexport.png', |
<form action="/adm/coursedocs" method="post" name="subnewaboutme">
|
linktitle => $lt{'imse'}, |
<input type="hidden" name="folderpath" value="$path" />
|
}, |
<input type="hidden" name="importdetail"
|
{ linktext => $lt{'dcd'}, |
value="$plainname=/adm/$udom/$uname/aboutme" />
|
url => $dumpurl, |
<span class="LC_nobreak">
|
permission => $candump, |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" />
|
#help => '', |
$help{'My Personal Info'}
|
icon => 'dump.png', |
</span>
|
linktitle => $lt{'dcd'}, |
</form>
|
}, |
SNAMFORM
|
] |
|
}); |
$r->print(<<ENDSUPFORM);
|
return '<form action="/adm/coursedocs" method="post" name="courseverify">'."\n". |
<ul class="LC_TabContent">
|
'<input type="hidden" id="dummy" />'."\n". |
<li>$lt{'nd'}</li>
|
&Apache::lonhtmlcommon::generate_menu(@menu)."\n". |
<li>$lt{'sd'}</li>
|
'</form>'; |
<li>$lt{'hao'}</li>
|
} |
</ul>
|
|
<table class="LC_docs_adddocs">
|
sub generate_edit_table { |
<tr><td>
|
my ($tid,$orderhash_ref,$to_show,$iconpath,$jumpto,$readfile) = @_; |
$supupdocform
|
return unless(ref($orderhash_ref) eq 'HASH'); |
</td>
|
my %orderhash = %{$orderhash_ref}; |
<td>
|
my $form; |
$supnewfolderform
|
my $activetab; |
<br />
|
my $active; |
$supnewextform
|
if($env{'form.active'} ne ''){ |
<br />
|
$activetab = $env{'form.active'}; |
$supnewsylform
|
} |
<br />
|
my $backicon = $iconpath.'clickhere.gif'; |
$supnewaboutmeform
|
my $backtext = &mt('To Overview'); |
</td></tr>
|
$form = '<div class="LC_Box" style="margin:0;">'. |
</table></td></tr>
|
'<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n". |
ENDSUPFORM
|
'<li class="goback">'. |
}
|
'<a href="javascript:toContents('."'$jumpto'".');">'. |
}
|
'<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'. |
$r->print('</table>');
|
' alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n"; |
if ($allowed) {
|
if ($tid == 1) { |
$r->print('
|
$form .= '<li>'. |
<form method="post" name="extimport" action="/adm/coursedocs">
|
'<a href="javascript:groupopen('."'$readfile'".',1);">'. |
<input type="hidden" name="title" />
|
&mt('Undo Delete').'</a></li>'."\n"; |
<input type="hidden" name="url" />
|
if ($env{'form.docslog'}) { |
<input type="hidden" name="useform" />
|
$form .= '<li class="active">'; |
<input type="hidden" name="residx" />
|
} else { |
</form>');
|
$form .= '<li>'; |
}
|
} |
} else {
|
$form .= '<a href="javascript:toggleHistoryDisp(1);">'. |
unless ($upload_result eq 'phasetwo') {
|
&mt('History').'</a></li>'."\n"; |
# -------------------------------------------------------- This is showdoc mode
|
if ($env{'form.docslog'}) { |
$r->print("<h1>".&mt('Uploaded Document').' - '.
|
$form .= '<li><a href="javascript:toggleHistoryDisp(0);">'. |
&Apache::lonnet::gettitle($r->uri).'</h1><p>'.
|
&mt('Edit').'</a></li>'."\n"; |
&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><table>".
|
} |
&entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table>');
|
} |
}
|
foreach my $name (reverse(sort(keys(%orderhash)))) { |
}
|
if($name ne '00'){ |
}
|
if($activetab eq '' || $activetab ne $name){ |
$r->print(&Apache::loncommon::end_page());
|
$active = ''; |
return OK;
|
}elsif($activetab eq $name){ |
}
|
$active = 'class="active"'; |
|
} |
sub generate_admin_options {
|
$form .= '<li style="float:right" '.$active |
my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_;
|
.' onmouseover="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');"' |
my %lt = %{$lt_ref};
|
.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');"><a href="javascript:;"><b>'.&mt(${$orderhash{$name}}[0]).'</b></a></li>'."\n"; |
my %help = %{$help_ref};
|
} else { |
my %env = %{$env_ref};
|
$form .= '<li '.$active.' style="float:right">'.${$orderhash{$name}}[1].'</li>'."\n"; |
my $dumpbut=&dumpbutton();
|
|
my $exportbut=&exportbutton();
|
} |
return (<<ENDOPTIONFORM);
|
} |
<form name="renameform" method="post" action="/adm/coursedocs">
|
$form .= '</ul>'."\n"; |
<input type="hidden" name="title" />
|
$form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0; overflow: hidden; clear:right">'."\n"; |
<input type="hidden" name="cmd" />
|
|
<input type="hidden" name="markcopy" />
|
if ($to_show ne '') { |
<input type="hidden" name="copyfolder" />
|
$form .= '<div style="padding:0;margin:0;float:left">'.$to_show.'</div>'."\n"; |
$containertag
|
} |
</form>
|
foreach my $field (keys(%orderhash)){ |
<form name="simpleedit" method="post" action="/adm/coursedocs">
|
if($field ne '00'){ |
<input type="hidden" name="importdetail" value="" />
|
if($activetab eq '' || $activetab ne $field){ |
$uploadtag
|
$active = 'style="display: none;float:left"'; |
</form>
|
}elsif($activetab eq $field){ |
<form action="/adm/coursedocs" method="post" name="courseverify">
|
$active = 'style="display:block;float:left"'; |
<ul style="list-style-type:none">
|
} |
<li>
|
$form .= '<div id="'.$field.$tid.'"' |
<input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
|
.' class="LC_ContentBox" '.$active.'>'.${$orderhash{$field}}[1] |
</li>
|
.'</div>'."\n"; |
<li>
|
} |
<input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
|
} |
</li>
|
unless ($env{'form.docslog'}) { |
<li>
|
$form .= '</div></div>'."\n"; |
$dumpbut
|
} |
</li>
|
return $form; |
<li>
|
} |
$exportbut
|
|
</li>
|
sub editing_js { |
<li>
|
my ($udom,$uname,$supplementalflag) = @_; |
<input type="submit" name="listsymbs" value="$lt{'ls'}" />
|
my $now = time(); |
</li>
|
my %lt = &Apache::lonlocal::texthash( |
<li>
|
p_mnf => 'Name of New Folder', |
<input type="hidden" name="folder" value="$env{'form.folder'}" />
|
t_mnf => 'New Folder', |
<input type="submit" name="docslog" value="$lt{'sl'}" />
|
p_mnp => 'Name of New Page', |
</li>
|
t_mnp => 'New Page', |
</ul>
|
p_mxu => 'Title for the External Score', |
</form>
|
p_msp => 'Name of Simple Course Page', |
<div style="clear: both; height: 0px;"> </div>
|
p_msb => 'Title for the Problem', |
ENDOPTIONFORM
|
p_mdb => 'Title for the Drop Box', |
}
|
p_mbb => 'Title for the Discussion Board', |
|
p_mab => "Enter user:domain for User's Personal Information Page", |
sub generate_edit_table {
|
p_mab2 => 'Personal Information Page of ', |
my ($optionhash_ref,$namehash_ref,$orderhash_ref) = @_;
|
p_mab_alrt1 => 'Not a valid user:domain', |
my %optionhash = %{$optionhash_ref}; #id verlinkt mit inhalt
|
p_mab_alrt2 => 'Please enter both user and domain in the format user:domain', |
my %namehash = %{$namehash_ref}; #name verlinkt mit id
|
p_chn => 'New Title', |
my %orderhash = %{$orderhash_ref}; #name mit kürzel verlinkt mit name
|
p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!', |
my $form;
|
p_rmr2a => 'Remove[_99]', |
$form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt('Upload Course Documents').'<h4>';
|
p_rmr2b => '?[_99]', |
$form .= '<ul class="LC_TabContent">';
|
p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!', |
foreach my $name (sort(keys(%orderhash))){
|
p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.', |
if($name eq 'zz_hide'){
|
p_ctr2a => 'Cut[_98]', |
$form .= '<li><a onclick="hideAllSection();" href="#">'.&mt($orderhash{$name}).'</a></li>';
|
p_ctr2b => '?[_98]', |
}else{
|
rpck => 'Enter number to pick (e.g., 3)', |
$form .= '<li><a onclick="popUpSection(\''.$namehash{$orderhash{$name}}.'\');" href="#">'.&mt($orderhash{$name}).'</a></li>';
|
); |
}
|
|
}
|
my $crstype = &Apache::loncommon::course_type(); |
foreach my $field (keys(%optionhash)){
|
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"'); |
$form .= '<div id="'.$field.'" class="LC_ContentBox LC_hideThis">'.$optionhash{$field}.'</div>';
|
my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"'); |
}
|
my $main_container_page; |
$form .= '</div>';
|
if ($docs_folderpath eq '') { |
return $form;
|
if ($docs_pagepath ne '') { |
}
|
$main_container_page = 1; |
|
} |
sub editing_js {
|
} |
my ($udom,$uname) = @_;
|
my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents'; |
my $now = time();
|
my $toplevelsupp = &supplemental_base(); |
my %lt = &Apache::lonlocal::texthash(
|
|
p_mnf => 'Name of New Folder',
|
my $backtourl = '/adm/navmaps'; |
t_mnf => 'New Folder',
|
if ($supplementalflag) { |
p_mnp => 'Name of New Page',
|
$backtourl = '/adm/supplemental'; |
t_mnp => 'New Page',
|
} |
p_mxu => 'Title for the Uploaded Score',
|
|
p_msp => 'Title for the Page',
|
return <<ENDNEWSCRIPT; |
p_msb => 'Title for the Problem',
|
function makenewfolder(targetform,folderseq) { |
p_mdb => 'Title for the Drop Box',
|
var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}'); |
p_mbb => 'Title for the Bulletin Board',
|
if (foldername) { |
p_mab => "Enter user:domain for User's 'About Me' Page",
|
targetform.importdetail.value=escape(foldername)+"="+folderseq; |
p_mab2 => "About [_99]",
|
targetform.submit(); |
p_mab_alrt1 => 'Not a valid user:domain',
|
} |
p_mab_alrt2 => 'Please enter both user and domain in the format user:domain',
|
} |
p_chn => 'New Title',
|
|
p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
|
function makenewpage(targetform,folderseq) { |
p_rmr2a => 'Remove[_99]',
|
var pagename=prompt('$lt{"p_mnp"}','$lt{"t_mnp"}'); |
p_rmr2b => '?[_99]',
|
if (pagename) { |
p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
|
targetform.importdetail.value=escape(pagename)+"="+folderseq; |
p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
|
targetform.submit(); |
p_ctr2a => 'Cut[_98]',
|
} |
p_ctr2b => '?[_98]'
|
} |
);
|
|
|
function makenewext(targetname) { |
return <<ENDNEWSCRIPT;
|
this.document.forms.extimport.useform.value=targetname; |
function makenewfolder(targetform,folderseq) {
|
this.document.forms.extimport.title.value=''; |
var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}');
|
this.document.forms.extimport.url.value=''; |
if (foldername) {
|
this.document.forms.extimport.residx.value=''; |
targetform.importdetail.value=escape(foldername)+"="+folderseq;
|
window.open('/adm/rat/extpickframe.html'); |
targetform.submit();
|
} |
}
|
|
}
|
function edittext(targetname,residx,title,url) { |
|
this.document.forms.extimport.useform.value=targetname; |
function makenewpage(targetform,folderseq) {
|
this.document.forms.extimport.residx.value=residx; |
var pagename=prompt('$lt{"p_mnp"}','$lt{"t_mnp"}');
|
this.document.forms.extimport.url.value=url; |
if (pagename) {
|
this.document.forms.extimport.title.value=title; |
targetform.importdetail.value=escape(pagename)+"="+folderseq;
|
window.open('/adm/rat/extpickframe.html'); |
targetform.submit();
|
} |
}
|
|
}
|
function makeexamupload() { |
|
var title=prompt('$lt{"p_mxu"}'); |
function makenewext(targetname) {
|
if (title) { |
this.document.forms.extimport.useform.value=targetname;
|
this.document.forms.newexamupload.importdetail.value= |
this.document.forms.extimport.title.value='';
|
escape(title)+'=/res/lib/templates/examupload.problem'; |
this.document.forms.extimport.url.value='';
|
this.document.forms.newexamupload.submit(); |
this.document.forms.extimport.residx.value='';
|
} |
window.open('/adm/rat/extpickframe.html');
|
} |
}
|
|
|
function makesmppage() { |
function edittext(targetname,residx,title,url) {
|
var title=prompt('$lt{"p_msp"}'); |
this.document.forms.extimport.useform.value=targetname;
|
if (title) { |
this.document.forms.extimport.residx.value=residx;
|
this.document.forms.newsmppg.importdetail.value= |
this.document.forms.extimport.url.value=url;
|
escape(title)+'=/adm/$udom/$uname/$now/smppg'; |
this.document.forms.extimport.title.value=title;
|
this.document.forms.newsmppg.submit(); |
window.open('/adm/rat/extpickframe.html');
|
} |
}
|
} |
|
|
function makeexamupload() {
|
function makesmpproblem() { |
var title=prompt('$lt{"p_mxu"}');
|
var title=prompt('$lt{"p_msb"}'); |
if (title) {
|
if (title) { |
this.document.forms.newexamupload.importdetail.value=
|
this.document.forms.newsmpproblem.importdetail.value= |
escape(title)+'=/res/lib/templates/examupload.problem';
|
escape(title)+'=/res/lib/templates/simpleproblem.problem'; |
this.document.forms.newexamupload.submit();
|
this.document.forms.newsmpproblem.submit(); |
}
|
} |
}
|
} |
|
|
function makesmppage() {
|
function makedropbox() { |
var title=prompt('$lt{"p_msp"}');
|
var title=prompt('$lt{"p_mdb"}'); |
if (title) {
|
if (title) { |
this.document.forms.newsmppg.importdetail.value=
|
this.document.forms.newdropbox.importdetail.value= |
escape(title)+'=/adm/$udom/$uname/$now/smppg';
|
escape(title)+'=/res/lib/templates/DropBox.problem'; |
this.document.forms.newsmppg.submit();
|
this.document.forms.newdropbox.submit(); |
}
|
} |
}
|
} |
|
|
function makesmpproblem() {
|
function makebulboard() { |
var title=prompt('$lt{"p_msb"}');
|
var title=prompt('$lt{"p_mbb"}'); |
if (title) {
|
if (title) { |
this.document.forms.newsmpproblem.importdetail.value=
|
this.document.forms.newbul.importdetail.value= |
escape(title)+'=/res/lib/templates/simpleproblem.problem';
|
escape(title)+'=/adm/$udom/$uname/$now/bulletinboard'; |
this.document.forms.newsmpproblem.submit();
|
this.document.forms.newbul.submit(); |
}
|
} |
}
|
} |
|
|
function makedropbox() {
|
function makeabout() { |
var title=prompt('$lt{"p_mdb"}');
|
var user=prompt("$lt{'p_mab'}"); |
if (title) {
|
if (user) { |
this.document.forms.newdropbox.importdetail.value=
|
var comp=new Array(); |
escape(title)+'=/res/lib/templates/DropBox.problem';
|
comp=user.split(':'); |
this.document.forms.newdropbox.submit();
|
if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) { |
}
|
if ((comp[0]) && (comp[1])) { |
}
|
this.document.forms.newaboutsomeone.importdetail.value= |
|
'$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme'; |
function makebulboard() {
|
this.document.forms.newaboutsomeone.submit(); |
var title=prompt('$lt{"p_mbb"}');
|
} else { |
if (title) {
|
alert("$lt{'p_mab_alrt1'}"); |
this.document.forms.newbul.importdetail.value=
|
} |
escape(title)+'=/adm/$udom/$uname/$now/bulletinboard';
|
} else { |
this.document.forms.newbul.submit();
|
alert("$lt{'p_mab_alrt2'}"); |
}
|
} |
}
|
} |
|
} |
function makeabout() {
|
|
var user=prompt("$lt{'p_mab'}");
|
function makeims() { |
if (user) {
|
var caller = document.forms.ims.folder.value; |
var comp=new Array();
|
var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; |
comp=user.split(':');
|
newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); |
if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
|
newWindow.location.href = newlocation; |
if ((comp[0]) && (comp[1])) {
|
} |
this.document.forms.newaboutsomeone.importdetail.value=
|
|
'$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
|
function finishpick() { |
this.document.forms.newaboutsomeone.submit();
|
var title=this.document.forms.extimport.title.value; |
} else {
|
var url=this.document.forms.extimport.url.value; |
alert("$lt{'p_mab_alrt1'}");
|
var form=this.document.forms.extimport.useform.value; |
}
|
var residx=this.document.forms.extimport.residx.value; |
} else {
|
eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();'); |
alert("$lt{'p_mab_alrt2'}");
|
} |
}
|
|
}
|
function changename(folderpath,index,oldtitle,container,pagesymb) { |
}
|
var title=prompt('$lt{"p_chn"}',oldtitle); |
|
if (title) { |
function makeims() {
|
this.document.forms.renameform.markcopy.value=-1; |
var caller = document.forms.ims.folder.value;
|
this.document.forms.renameform.title.value=title; |
var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one";
|
this.document.forms.renameform.cmd.value='rename_'+index; |
newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes");
|
if (container == 'sequence') { |
newWindow.location.href = newlocation;
|
this.document.forms.renameform.folderpath.value=folderpath; |
}
|
} |
|
if (container == 'page') { |
|
this.document.forms.renameform.pagepath.value=folderpath; |
function finishpick() {
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
var title=this.document.forms.extimport.title.value;
|
} |
var url=this.document.forms.extimport.url.value;
|
this.document.forms.renameform.submit(); |
var form=this.document.forms.extimport.useform.value;
|
} |
var residx=this.document.forms.extimport.residx.value;
|
} |
eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
|
|
}
|
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"}')) { |
function changename(folderpath,index,oldtitle,container,pagesymb) {
|
this.document.forms.renameform.markcopy.value=-1; |
var title=prompt('$lt{"p_chn"}',oldtitle);
|
this.document.forms.renameform.cmd.value='del_'+index; |
if (title) {
|
if (container == 'sequence') { |
this.document.forms.renameform.markcopy.value=-1;
|
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.title.value=title;
|
} |
this.document.forms.renameform.cmd.value='rename_'+index;
|
if (container == 'page') { |
if (container == 'sequence') {
|
this.document.forms.renameform.pagepath.value=folderpath; |
this.document.forms.renameform.folderpath.value=folderpath;
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
}
|
} |
if (container == 'page') {
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.pagepath.value=folderpath;
|
} |
this.document.forms.renameform.pagesymb.value=pagesymb;
|
} |
}
|
|
this.document.forms.renameform.submit();
|
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"}')) { |
}
|
this.document.forms.renameform.cmd.value='cut_'+index; |
|
this.document.forms.renameform.markcopy.value=index; |
function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {
|
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
|
if (container == 'sequence') { |
this.document.forms.renameform.markcopy.value=-1;
|
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.cmd.value='del_'+index;
|
} |
if (container == 'sequence') {
|
if (container == 'page') { |
this.document.forms.renameform.folderpath.value=folderpath;
|
this.document.forms.renameform.pagepath.value=folderpath; |
}
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
if (container == 'page') {
|
} |
this.document.forms.renameform.pagepath.value=folderpath;
|
this.document.forms.renameform.submit(); |
this.document.forms.renameform.pagesymb.value=pagesymb;
|
} |
}
|
} |
this.document.forms.renameform.submit();
|
|
}
|
function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) { |
}
|
this.document.forms.renameform.markcopy.value=index; |
|
this.document.forms.renameform.copyfolder.value=folder+'.'+container; |
function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {
|
if (container == 'sequence') { |
if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
|
this.document.forms.renameform.folderpath.value=folderpath; |
this.document.forms.renameform.cmd.value='cut_'+index;
|
} |
this.document.forms.renameform.markcopy.value=index;
|
if (container == 'page') { |
this.document.forms.renameform.copyfolder.value=folder+'.'+container;
|
this.document.forms.renameform.pagepath.value=folderpath; |
if (container == 'sequence') {
|
this.document.forms.renameform.pagesymb.value=pagesymb; |
this.document.forms.renameform.folderpath.value=folderpath;
|
} |
}
|
this.document.forms.renameform.submit(); |
if (container == 'page') {
|
} |
this.document.forms.renameform.pagepath.value=folderpath;
|
|
this.document.forms.renameform.pagesymb.value=pagesymb;
|
function updatePick(targetform,index,caller) { |
}
|
var pickitem = document.getElementById('rpick_'+index); |
this.document.forms.renameform.submit();
|
var picknumitem = document.getElementById('rpicknum_'+index); |
}
|
if (pickitem.checked) { |
}
|
var picknum=prompt('$lt{"rpck"}',picknumitem.value); |
|
if (picknum == '' || picknum == null) { |
function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {
|
if (caller == 'check') { |
this.document.forms.renameform.markcopy.value=index;
|
pickitem.checked=false; |
this.document.forms.renameform.copyfolder.value=folder+'.'+container;
|
return; |
if (container == 'sequence') {
|
} |
this.document.forms.renameform.folderpath.value=folderpath;
|
} else { |
}
|
picknum.toString(); |
if (container == 'page') {
|
var regexdigit=/^\\d+\$/; |
this.document.forms.renameform.pagepath.value=folderpath;
|
if (regexdigit.test(picknum)) { |
this.document.forms.renameform.pagesymb.value=pagesymb;
|
picknumitem.value = picknum; |
}
|
targetform.changeparms.value='randompick'; |
this.document.forms.renameform.submit();
|
targetform.submit(); |
}
|
} else { |
|
if (caller == 'check') { |
|
pickitem.checked=false; |
ENDNEWSCRIPT
|
} |
}
|
return; |
1;
|
} |
__END__
|
} |
|
} else { |
|
picknumitem.value = 0; |
=head1 NAME
|
targetform.changeparms.value='randompick'; |
|
targetform.submit(); |
Apache::londocs.pm
|
} |
|
} |
=head1 SYNOPSIS
|
|
|
function unselectInactive(nav) { |
This is part of the LearningOnline Network with CAPA project
|
currentNav = document.getElementById(nav); |
described at http://www.lon-capa.org.
|
currentLis = currentNav.getElementsByTagName('LI'); |
|
for (i = 0; i < currentLis.length; i++) { |
=head1 SUBROUTINES
|
if (currentLis[i].className == 'goback') { |
|
currentLis[i].className = 'goback'; |
=over
|
} else { |
|
if (currentLis[i].className == 'right active' || currentLis[i].className == 'right') { |
=item %help=()
|
currentLis[i].className = 'right'; |
|
} else { |
Available help topics
|
currentLis[i].className = 'i'; |
|
} |
=item mapread()
|
} |
|
} |
Mapread read maps into LONCAPA::map:: global arrays
|
} |
@order and @resources, determines status
|
|
sets @order - pointer to resources in right order
|
function hideAll(current, nav, data) { |
sets @resources - array with the resources with correct idx
|
unselectInactive(nav); |
|
if(current.className == 'right'){ |
=item authorhosts()
|
current.className = 'right active' |
|
}else{ |
Return hash with valid author names
|
current.className = 'active'; |
|
} |
=item dumpbutton()
|
currentData = document.getElementById(data); |
|
currentDivs = currentData.getElementsByTagName('DIV'); |
Generate "dump" button
|
for (i = 0; i < currentDivs.length; i++) { |
|
if(currentDivs[i].className == 'LC_ContentBox'){ |
=item clean()
|
currentDivs[i].style.display = 'none'; |
|
} |
=item dumpcourse()
|
} |
|
} |
Actually dump course
|
|
|
function openTabs(pageId) { |
|
tabnav = document.getElementById(pageId).getElementsByTagName('UL'); |
=item exportbutton()
|
if(tabnav.length > 2 ){ |
|
currentNav = document.getElementById(tabnav[1].id); |
Generate "export" button
|
currentLis = currentNav.getElementsByTagName('LI'); |
|
for(i = 0; i< currentLis.length; i++){ |
=item exportcourse()
|
if(currentLis[i].className == 'active') { |
|
funcString = currentLis[i].onclick.toString(); |
=item create_ims_store()
|
tab = funcString.split('"'); |
|
if(tab.length < 2) { |
=item build_package()
|
tab = funcString.split("'"); |
|
} |
=item get_dependencies()
|
currentData = document.getElementById(tab[1]); |
|
currentData.style.display = 'block'; |
=item process_content()
|
} |
|
} |
=item replicate_content()
|
} |
|
} |
=item extract_media()
|
|
|
function showPage(current, pageId, nav, data) { |
=item store_template()
|
hideAll(current, nav, data); |
|
openTabs(pageId); |
=item group_import()
|
unselectInactive(nav); |
|
current.className = 'active'; |
Imports the given (name, url) resources into the course
|
currentData = document.getElementById(pageId); |
coursenum, coursedom, and folder must precede the list
|
currentData.style.display = 'block'; |
|
activeTab = pageId; |
=item breadcrumbs()
|
if (nav == 'mainnav') { |
|
var storedpath = "$docs_folderpath"; |
=item log_docs()
|
if (storedpath == '') { |
|
storedpath = "$docs_pagepath"; |
=item docs_change_log()
|
} |
|
var storedpage = "$main_container_page"; |
=item update_paste_buffer()
|
var reg = new RegExp("^supplemental"); |
|
if (pageId == 'mainCourseDocuments') { |
=item print_paste_buffer()
|
if (storedpage == 1) { |
|
document.simpleedit.folderpath.value = ''; |
=item do_paste_from_buffer()
|
document.uploaddocument.folderpath.value = ''; |
|
} else { |
=item update_parameter()
|
if (reg.test(storedpath)) { |
|
document.simpleedit.folderpath.value = '$toplevelmain'; |
=item handle_edit_cmd()
|
document.uploaddocument.folderpath.value = '$toplevelmain'; |
|
document.newext.folderpath.value = '$toplevelmain'; |
=item editor()
|
} else { |
|
document.simpleedit.folderpath.value = storedpath; |
=item process_file_upload()
|
document.uploaddocument.folderpath.value = storedpath; |
|
document.newext.folderpath.value = storedpath; |
=item process_secondary_uploads()
|
} |
|
} |
=item is_supplemental_title()
|
} else { |
|
if (reg.test(storedpath)) { |
=item parse_supplemental_title()
|
document.simpleedit.folderpath.value = storedpath; |
|
document.supuploaddocument.folderpath.value = storedpath; |
=item entryline()
|
document.supnewext.folderpath.value = storedpath; |
|
} else { |
=item tiehash()
|
document.simpleedit.folderpath.value = '$toplevelsupp'; |
|
document.supuploaddocument.folderpath.value = '$toplevelsupp'; |
=item untiehash()
|
document.supnewext.folderpath.value = '$toplevelsupp'; |
|
} |
=item checkonthis()
|
} |
|
} |
check on this
|
resize_contentdiv('contentscroll','1','0'); |
|
return false; |
=item verifycontent()
|
} |
|
|
Verify Content
|
function toContents(jumpto) { |
|
var newurl = '$backtourl'; |
=item devalidateversioncache() & checkversions()
|
if (jumpto != '') { |
|
newurl = newurl+'?postdata='+jumpto; |
Check Versions
|
; |
|
} |
=item mark_hash_old()
|
location.href=newurl; |
|
} |
=item is_hash_old()
|
|
|
ENDNEWSCRIPT |
=item changewarning()
|
} |
|
|
=item init_breadcrumbs()
|
sub history_tab_js { |
|
return <<"ENDHIST"; |
Breadcrumbs for special functions
|
function toggleHistoryDisp(choice) { |
|
document.docslogform.docslog.value = choice; |
=back
|
document.docslogform.submit(); |
|
return; |
=cut
|
} |
|
|
|
ENDHIST |
|
} |
|
|
|
sub inject_data_js { |
|
return <<ENDINJECT; |
|
|
|
function injectData(current, hiddenField, name, value) { |
|
currentElement = document.getElementById(hiddenField); |
|
currentElement.name = name; |
|
currentElement.value = value; |
|
current.submit(); |
|
} |
|
|
|
ENDINJECT |
|
} |
|
|
|
sub dump_switchserver_js { |
|
my @hosts = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
|
dump => 'Dumping to Authoring Space requires switching server.', |
|
swit => 'Switch server?', |
|
duco => 'Dump content to Authoring Space', |
|
yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.', |
|
chos => 'Choose server', |
|
); |
|
my $role = $env{'request.role'}; |
|
my $js = <<"ENDSWJS"; |
|
<script type="text/javascript"> |
|
function write_switchserver() { |
|
var server; |
|
if (document.setserver.posshosts.length > 0) { |
|
for (var i=0; i<document.setserver.posshosts.length; i++) { |
|
if (document.setserver.posshosts[i].checked) { |
|
server = document.setserver.posshosts[i].value; |
|
} |
|
} |
|
opener.document.location.href="/adm/switchserver?otherserver="+server+"&role=$role&origurl=/adm/coursedocs"; |
|
} |
|
window.close(); |
|
} |
|
</script> |
|
|
|
ENDSWJS |
|
|
|
my $startpage = &Apache::loncommon::start_page('Choose server',$js, |
|
{'only_body' => 1, |
|
'js_ready' => 1,}); |
|
my $endpage = &Apache::loncommon::end_page({'js_ready' => 1}); |
|
|
|
my $hostpicker; |
|
my $count = 0; |
|
foreach my $host (sort(@hosts)) { |
|
my $checked; |
|
if ($count == 0) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$hostpicker .= '<label><input type="radio" name="posshosts" value="'. |
|
$host.'"'.$checked.' />'.$host.'</label> '; |
|
$count++; |
|
} |
|
|
|
return <<"ENDSWITCHJS"; |
|
|
|
function dump_needs_switchserver(url) { |
|
if (url!='' && url!= null) { |
|
if (confirm("$lt{'dump'}\\n$lt{'swit'}")) { |
|
go(url); |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function choose_switchserver_window() { |
|
newWindow = window.open('','ChooseServer','height=400,width=500,scrollbars=yes') |
|
newWindow.document.open(); |
|
newWindow.document.writeln('$startpage'); |
|
newWindow.document.write('<h3>$lt{'duco'}<\\/h3>\\n'+ |
|
'<p>$lt{'yone'}<\\/p>\\n'+ |
|
'<div class="LC_left_float"><fieldset><legend>$lt{'chos'}<\\/legend>\\n'+ |
|
'<form name="setserver" method="post" action="" \\/>\\n'+ |
|
'$hostpicker\\n'+ |
|
'<br \\/><br \\/>\\n'+ |
|
'<input type="button" name="makeswitch" value="$lt{'swit'}" '+ |
|
'onclick="write_switchserver();" \\/>\\n'+ |
|
'<\\/form><\\/fieldset><\\/div><br clear="all" \\/>\\n'); |
|
newWindow.document.writeln('$endpage'); |
|
newWindow.document.close(); |
|
newWindow.focus(); |
|
} |
|
|
|
ENDSWITCHJS |
|
} |
|
|
|
sub resize_contentdiv_js { |
|
my ($tabidstr) = @_; |
|
my $viewport_js = &Apache::loncommon::viewport_geometry_js(); |
|
return <<ENDRESIZESCRIPT; |
|
|
|
window.onresize=resizeContentEditor; |
|
|
|
var activeTab; |
|
|
|
$viewport_js |
|
|
|
function resize_contentdiv(scrollboxname,chkw,chkh) { |
|
var scrollboxid = 'div_'+scrollboxname; |
|
var scrolltableid = 'table_'+scrollboxname; |
|
var scrollbox; |
|
var scrolltable; |
|
|
|
if (document.getElementById("contenteditor") == null) { |
|
return; |
|
} |
|
|
|
if (document.getElementById(scrollboxid) == null) { |
|
return; |
|
} else { |
|
scrollbox = document.getElementById(scrollboxid); |
|
} |
|
|
|
if (document.getElementById(scrolltableid) == null) { |
|
return; |
|
} else { |
|
scrolltable = document.getElementById(scrolltableid); |
|
} |
|
|
|
init_geometry(); |
|
var vph = Geometry.getViewportHeight(); |
|
var vpw = Geometry.getViewportWidth(); |
|
|
|
var alltabs = ['$tabidstr']; |
|
var listwchange; |
|
if (chkw == 1) { |
|
var contenteditorw = document.getElementById("contenteditor").offsetWidth; |
|
var contentlistw; |
|
var contentlistid = document.getElementById("contentlist"); |
|
if (contentlistid != null) { |
|
contentlistw = document.getElementById("contentlist").offsetWidth; |
|
} |
|
var contentlistwstart = contentlistw; |
|
|
|
var scrollboxw = scrollbox.offsetWidth; |
|
var scrollboxscrollw = scrollbox.scrollWidth; |
|
|
|
var offsetw = parseInt(vpw * 0.015); |
|
var paddingw = parseInt(vpw * 0.09); |
|
|
|
var minscrollboxw = 250; |
|
|
|
var maxtabw = 0; |
|
var actabw = 0; |
|
for (var i=0; i<alltabs.length; i++) { |
|
if (activeTab == alltabs[i]) { |
|
actabw = document.getElementById(alltabs[i]).offsetWidth; |
|
if (actabw > maxtabw) { |
|
maxtabw = actabw; |
|
} |
|
} else { |
|
if (document.getElementById(alltabs[i]) != null) { |
|
var thistab = document.getElementById(alltabs[i]); |
|
thistab.style.visibility = 'hidden'; |
|
thistab.style.display = 'block'; |
|
var tabw = document.getElementById(alltabs[i]).offsetWidth; |
|
thistab.style.display = 'none'; |
|
thistab.style.visibility = ''; |
|
if (tabw > maxtabw) { |
|
maxtabw = tabw; |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (maxtabw > 0) { |
|
var newscrollboxw; |
|
if (maxtabw+paddingw+scrollboxscrollw<contenteditorw) { |
|
newscrollboxw = contenteditorw-paddingw-maxtabw; |
|
if (newscrollboxw < minscrollboxw) { |
|
newscrollboxw = minscrollboxw; |
|
} |
|
scrollbox.style.width = newscrollboxw+"px"; |
|
if (newscrollboxw != scrollboxw) { |
|
var newcontentlistw = newscrollboxw-offsetw; |
|
contentlistid.style.width = newcontentlistw+"px"; |
|
} |
|
} else { |
|
newscrollboxw = contenteditorw-paddingw-maxtabw; |
|
if (newscrollboxw < minscrollboxw) { |
|
newscrollboxw = minscrollboxw; |
|
} |
|
scrollbox.style.width = newscrollboxw+"px"; |
|
if (newscrollboxw != scrollboxw) { |
|
var newcontentlistw = newscrollboxw-offsetw; |
|
contentlistid.style.width = newcontentlistw+"px"; |
|
} |
|
} |
|
|
|
if (newscrollboxw != scrollboxw) { |
|
var newscrolltablew = newscrollboxw+offsetw; |
|
scrolltable.style.width = newscrolltablew+"px"; |
|
} |
|
} |
|
|
|
if (contentlistid.offsetWidth != contentlistwstart) { |
|
listwchange = 1; |
|
} |
|
|
|
if (activeTab == 'cc1') { |
|
if (document.getElementById('cc_hrule') != null) { |
|
document.getElementById('cc_hrule').style.width=actabw+"px"; |
|
} |
|
} else { |
|
if (activeTab == 'bb1') { |
|
if (document.getElementById('bb_hrule') != null) { |
|
document.getElementById('bb_hrule').style.width=actabw+"px"; |
|
} |
|
} else { |
|
if (activeTab == 'ee2') { |
|
if (document.getElementById('ee_hrule') != null) { |
|
document.getElementById('ee_hrule').style.width=actabw+"px"; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ((chkh == 1) || (listwchange)) { |
|
var primaryheight = document.getElementById("LC_nav_bar").offsetHeight; |
|
var secondaryheight = document.getElementById("LC_secondary_menu").offsetHeight; |
|
var crumbsheight = document.getElementById("LC_breadcrumbs").offsetHeight; |
|
var dccidheight = document.getElementById("dccid").offsetHeight; |
|
|
|
var uploadresultheight = 0; |
|
if (document.getElementById("uploadfileresult") != null) { |
|
uploadresultheight = document.getElementById("uploadfileresult").offsetHeight; |
|
} |
|
var tabbedheight = document.getElementById("tabbededitor").offsetHeight; |
|
var contenteditorheight = document.getElementById("contenteditor").offsetHeight; |
|
var scrollboxheight = scrollbox.offsetHeight; |
|
var scrollboxscrollheight = scrollbox.scrollHeight; |
|
var freevspace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+uploadresultheight+tabbedheight+contenteditorheight); |
|
|
|
var minvscrollbox = 200; |
|
var offsetv = 20; |
|
var newscrollboxheight; |
|
if (freevspace < 0) { |
|
newscrollboxheight = scrollboxheight+freevspace-offsetv; |
|
if (newscrollboxheight < minvscrollbox) { |
|
newscrollboxheight = minvscrollbox; |
|
} |
|
scrollbox.style.height = newscrollboxheight + "px"; |
|
} else { |
|
if (scrollboxscrollheight > scrollboxheight) { |
|
if (freevspace > offsetv) { |
|
newscrollboxheight = scrollboxheight+freevspace-offsetv; |
|
if (newscrollboxheight < minvscrollbox) { |
|
newscrollboxheight = minvscrollbox; |
|
} |
|
scrollbox.style.height = newscrollboxheight+"px"; |
|
} |
|
} |
|
} |
|
scrollboxheight = scrollbox.offsetHeight; |
|
var contentlistheight = document.getElementById("contentlist").offsetHeight; |
|
|
|
if (scrollboxscrollheight <= scrollboxheight) { |
|
if ((contentlistheight+offsetv)<scrollboxheight) { |
|
newscrollheight = contentlistheight+offsetv; |
|
scrollbox.style.height = newscrollheight+"px"; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function resizeContentEditor() { |
|
var timer; |
|
clearTimeout(timer) |
|
timer=setTimeout('resize_contentdiv("contentscroll","1","1")',500); |
|
} |
|
|
|
ENDRESIZESCRIPT |
|
return; |
|
} |
|
|
|
sub makedocslogform { |
|
my ($formelems,$docslog) = @_; |
|
return <<"LOGSFORM"; |
|
<form action="/adm/coursedocs" method="post" name="docslogform"> |
|
<input type="hidden" name="docslog" value="$docslog" /> |
|
$formelems |
|
</form> |
|
LOGSFORM |
|
} |
|
|
|
sub makesimpleeditform { |
|
my ($formelems) = @_; |
|
return <<"SIMPFORM"; |
|
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
|
<input type="hidden" name="importdetail" value="" /> |
|
$formelems |
|
</form> |
|
SIMPFORM |
|
} |
|
|
|
1; |
|
__END__ |
|
|
|
|
|
=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 clean() |
|
|
|
=item dumpcourse() |
|
|
|
Actually dump course |
|
|
|
=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 |
|
|
|
=item create_list_elements() |
|
|
|
=item create_form_ul() |
|
|
|
=item startContentScreen() |
|
|
|
=item endContentScreen() |
|
|
|
=item supplemental_base() |
|
|
|
=item embedded_form_elems() |
|
|
|
=item embedded_destination() |
|
|
|
=item return_to_editor() |
|
|
|
=item decompression_info() |
|
|
|
=item decompression_phase_one() |
|
|
|
=item decompression_phase_two() |
|
|
|
=item remove_archive() |
|
|
|
=item generate_admin_menu() |
|
|
|
=item generate_edit_table() |
|
|
|
=item editing_js() |
|
|
|
=item history_tab_js() |
|
|
|
=item inject_data_js() |
|
|
|
=item dump_switchserver_js() |
|
|
|
=item resize_contentdiv_js() |
|
|
|
=item makedocslogform() |
|
|
|
=back |
|
|
|
=cut |