version 1.33, 2002/10/18 14:50:22
|
version 1.41, 2002/12/12 18:14:32
|
Line 35 use Apache::loncommon;
|
Line 35 use Apache::loncommon;
|
use Apache::lonratedt; |
use Apache::lonratedt; |
use Apache::lonratsrv; |
use Apache::lonratsrv; |
use Apache::lonxml; |
use Apache::lonxml; |
|
use HTML::Entities; |
use GDBM_File; |
use GDBM_File; |
|
|
my $iconpath; |
my $iconpath; |
Line 44 my %hash;
|
Line 45 my %hash;
|
my $hashtied; |
my $hashtied; |
my %alreadyseen=(); |
my %alreadyseen=(); |
|
|
|
my $hadchanges; |
|
|
# Mapread read maps into lonratedt::global arrays |
# Mapread read maps into lonratedt::global arrays |
# @order and @resources, determines status |
# @order and @resources, determines status |
# sets @order - pointer to resources in right order |
# sets @order - pointer to resources in right order |
Line 59 sub mapread {
|
Line 62 sub mapread {
|
|
|
sub storemap { |
sub storemap { |
my ($coursenum,$coursedom,$map)=@_; |
my ($coursenum,$coursedom,$map)=@_; |
|
$hadchanges=1; |
return |
return |
&Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
&Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
$map,1); |
$map,1); |
Line 118 sub editor {
|
Line 122 sub editor {
|
} |
} |
$#Apache::lonratedt::order--; |
$#Apache::lonratedt::order--; |
} elsif ($cmd eq 'up') { |
} elsif ($cmd eq 'up') { |
|
if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) { |
my $i=$Apache::lonratedt::order[$idx-1]; |
my $i=$Apache::lonratedt::order[$idx-1]; |
$Apache::lonratedt::order[$idx-1]= |
$Apache::lonratedt::order[$idx-1]= |
$Apache::lonratedt::order[$idx]; |
$Apache::lonratedt::order[$idx]; |
$Apache::lonratedt::order[$idx]=$i; |
$Apache::lonratedt::order[$idx]=$i; |
|
} |
} elsif ($cmd eq 'down') { |
} elsif ($cmd eq 'down') { |
|
if (defined($Apache::lonratedt::order[$idx+1])) { |
my $i=$Apache::lonratedt::order[$idx+1]; |
my $i=$Apache::lonratedt::order[$idx+1]; |
$Apache::lonratedt::order[$idx+1]= |
$Apache::lonratedt::order[$idx+1]= |
$Apache::lonratedt::order[$idx]; |
$Apache::lonratedt::order[$idx]; |
$Apache::lonratedt::order[$idx]=$i; |
$Apache::lonratedt::order[$idx]=$i; |
|
} |
|
} elsif ($cmd eq 'rename') { |
|
my ($rtitle,@rrest)=split(/\:/, |
|
$Apache::lonratedt::resources[ |
|
$Apache::lonratedt::order[$idx]]); |
|
my $comment= |
|
&HTML::Entities::decode($ENV{'form.title'}); |
|
$comment=~s/\</\<\;/g; |
|
$comment=~s/\>/\>\;/g; |
|
$comment=~s/\:/\:/g; |
|
$Apache::lonratedt::resources[ |
|
$Apache::lonratedt::order[$idx]]= |
|
$comment.':'.join(':',@rrest); |
|
|
} |
} |
# Store the changed version |
# Store the changed version |
&storemap($coursenum,$coursedom,$folder.'.sequence'); |
&storemap($coursenum,$coursedom,$folder.'.sequence'); |
Line 161 sub editor {
|
Line 182 sub editor {
|
foreach (@Apache::lonratedt::order) { |
foreach (@Apache::lonratedt::order) { |
my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); |
my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name='EMPTY'; } |
unless ($name) { $name='NO RESOURCE'; $url='/adm/notfound.html'; } |
$r->print(&entryline($idx,$name,$url,$folder,$allowed)); |
$r->print(&entryline($idx,$name,$url,$folder,$allowed)); |
$idx++; |
$idx++; |
} |
} |
Line 173 sub editor {
|
Line 194 sub editor {
|
|
|
sub entryline { |
sub entryline { |
my ($index,$title,$url,$folder,$allowed)=@_; |
my ($index,$title,$url,$folder,$allowed)=@_; |
|
$title=~s/\&colon\;/\:/g; |
|
$title=&HTML::Entities::encode(&HTML::Entities::decode( |
|
&Apache::lonnet::unescape($title)),'\"\<\>\&\''); |
|
my $renametitle=$title; |
|
my $foldertitle=$title; |
|
if ($title=~ |
|
/^(\d+)\_\_\_\&\;\&\;\&\;\_\_\_(\w+)\_\_\_\&\;\&\;\&\;\_\_\_(\w+)\_\_\_\&\;\&\;\&\;\_\_\_(.*)$/ |
|
) { |
|
$foldertitle=&Apache::lontexconvert::msgtexconverted($4); |
|
$renametitle=$4; |
|
$title='<i>'.localtime($1).'</i> '. |
|
&Apache::loncommon::plainname($2,$3).': <br>'. |
|
$foldertitle; |
|
} |
|
$renametitle=~s/\"\;/\\\"/g; |
my $line='<tr>'; |
my $line='<tr>'; |
# Edit commands |
# Edit commands |
if ($allowed) { |
if ($allowed) { |
Line 183 sub entryline {
|
Line 219 sub entryline {
|
<tr><td><a href='/adm/coursedocs?folder=$folder&cmd=down_$index'> |
<tr><td><a href='/adm/coursedocs?folder=$folder&cmd=down_$index'> |
<img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr> |
<img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr> |
</table></td><td> |
</table></td><td> |
<a href='/adm/coursedocs?folder=$folder&cmd=del_$index'>Remove</td> |
<a href='/adm/coursedocs?folder=$folder&cmd=del_$index'> |
|
<font size="-2">Remove</font></a> |
|
<a href='javascript:changename("$folder","$index","$renametitle");'> |
|
<font size="-2">Rename</font></a></td> |
END |
END |
} |
} |
# Figure out what kind of a resource this is |
# Figure out what kind of a resource this is |
Line 205 END
|
Line 244 END
|
} |
} |
} |
} |
$url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; |
$url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//; |
# Title |
|
$title=&Apache::lonnet::unescape($title); |
|
my $foldertitle=$title; |
|
if ($title=~ |
|
/^(\d+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(.*)$/ |
|
) { |
|
$foldertitle=&Apache::lontexconvert::msgtexconverted($4); |
|
$title='<i>'.localtime($1).'</i> '. |
|
&Apache::loncommon::plainname($2,$3).': <br>'. |
|
$foldertitle; |
|
} |
|
if ($isfolder) { $url.='&foldername='.$foldertitle; } |
if ($isfolder) { $url.='&foldername='.$foldertitle; } |
$line.='<td bgcolor="#FFFFBB"><a href="'.$url.'" target="cat_'.$folder. |
$line.='<td bgcolor="#FFFFBB"><a href="'.$url.'" target="cat_'.$folder. |
'"><img src="/adm/lonIcons/'. |
'"><img src="/adm/lonIcons/'. |
Line 247 sub checkonthis {
|
Line 275 sub checkonthis {
|
my ($r,$url,$level,$title)=@_; |
my ($r,$url,$level,$title)=@_; |
$alreadyseen{$url}=1; |
$alreadyseen{$url}=1; |
$r->rflush(); |
$r->rflush(); |
if ($url) { |
if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) { |
$r->print('<br />'); |
$r->print('<br />'); |
for (my $i=0;$i<=$level*5;$i++) { |
for (my $i=0;$i<=$level*5;$i++) { |
$r->print(' '); |
$r->print(' '); |
Line 260 sub checkonthis {
|
Line 288 sub checkonthis {
|
if ($result==OK) { |
if ($result==OK) { |
$r->print('<font color="green">ok</font>'); |
$r->print('<font color="green">ok</font>'); |
$r->rflush(); |
$r->rflush(); |
|
&Apache::lonnet::countacc($url); |
|
$url=~/\.(\w+)$/; |
|
if (&Apache::loncommon::fileembstyle($1) eq 'ssi') { |
|
$r->print('<br />'); |
|
$r->rflush(); |
|
for (my $i=0;$i<=$level*5;$i++) { |
|
$r->print(' '); |
|
} |
|
$r->print('- Rendering: '); |
|
&Apache::lonxml::xmlparse($r,'web', |
|
&Apache::lonnet::getfile( |
|
&Apache::lonnet::filelocation('',$url))); |
|
if (($Apache::lonxml::errorcount) || |
|
($Apache::lonxml::warningcount)) { |
|
if ($Apache::lonxml::errorcount) { |
|
$r->print('<font color="red"><b>'. |
|
$Apache::lonxml::errorcount.' error(s)</b></font> '); |
|
} |
|
if ($Apache::lonxml::warningcount) { |
|
$r->print('<font color="blue">'. |
|
$Apache::lonxml::warningcount.' warning(s)</font>'); |
|
} |
|
} else { |
|
$r->print('<font color="green">ok</font>'); |
|
} |
|
$r->rflush(); |
|
} |
my $dependencies= |
my $dependencies= |
&Apache::lonnet::metadata($url,'dependencies'); |
&Apache::lonnet::metadata($url,'dependencies'); |
foreach (split(/\,/,$dependencies)) { |
foreach (split(/\,/,$dependencies)) { |
Line 469 function makenewext(targetname) {
|
Line 524 function makenewext(targetname) {
|
} |
} |
|
|
function makesmppage() { |
function makesmppage() { |
var title=prompt('Listed Title for the Page'); |
var title=prompt('Listed Title for the Page'); |
|
if (title) { |
this.document.forms.newsmppg.importdetail.value= |
this.document.forms.newsmppg.importdetail.value= |
title+'=/adm/$udom/$uname/$now/smppg'; |
title+'=/adm/$udom/$uname/$now/smppg'; |
this.document.forms.newsmppg.submit(); |
this.document.forms.newsmppg.submit(); |
|
} |
} |
} |
|
|
function makebulboard() { |
function makebulboard() { |
var title=prompt('Listed Title for the Bulletin Board'); |
var title=prompt('Listed Title for the Bulletin Board'); |
|
if (title) { |
this.document.forms.newbul.importdetail.value= |
this.document.forms.newbul.importdetail.value= |
title+'=/adm/$udom/$uname/$now/bulletinboard'; |
title+'=/adm/$udom/$uname/$now/bulletinboard'; |
this.document.forms.newbul.submit(); |
this.document.forms.newbul.submit(); |
|
} |
} |
} |
|
|
function finishpick() { |
function finishpick() { |
Line 490 function finishpick() {
|
Line 549 function finishpick() {
|
('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+ |
('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+ |
'";this.document.forms.'+form+'.submit();'); |
'";this.document.forms.'+form+'.submit();'); |
} |
} |
|
|
|
function changename(folder,index,oldtitle) { |
|
var title=prompt('New Title',oldtitle); |
|
if (title) { |
|
this.document.forms.renameform.title.value=title; |
|
this.document.forms.renameform.cmd.value='rename_'+index; |
|
this.document.forms.renameform.folder.value=folder; |
|
this.document.forms.renameform.submit(); |
|
} |
|
} |
</script> |
</script> |
|
<form name="renameform" method="post" action="/adm/coursedocs"> |
|
<input type="hidden" name="title" /> |
|
<input type="hidden" name="cmd" /> |
|
<input type="hidden" name="folder" /> |
|
</form> |
|
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
|
<input type=hidden name="importdetail" value=""> |
|
<input type="hidden" name="folder" /> |
|
</form> |
|
|
ENDNEWSCRIPT |
ENDNEWSCRIPT |
} |
} |
# -------------------------------------------------------------------- Body tag |
# -------------------------------------------------------------------- Body tag |
Line 511 ENDCOURSEVERIFY
|
Line 590 ENDCOURSEVERIFY
|
$r->print('<tr><td bgcolor="#FFFFBB"><h2>Main Course Documents</h2>'); |
$r->print('<tr><td bgcolor="#FFFFBB"><h2>Main Course Documents</h2>'); |
my $folder=$ENV{'form.folder'}; |
my $folder=$ENV{'form.folder'}; |
unless ($folder=~/^default/) { $folder='default'; } |
unless ($folder=~/^default/) { $folder='default'; } |
|
$hadchanges=0; |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
&editor($r,$coursenum,$coursedom,$folder,$allowed); |
|
if ($hadchanges) { |
|
$r->print('<h3><font color="red">Changes will become active after <a href="/adm/roles">re-initializing course</a> or at next login.</font></h3>'); |
|
} |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time. |
'.sequence'; |
'.sequence'; |
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |
Line 534 Title:<br />
|
Line 617 Title:<br />
|
</form> |
</form> |
</td> |
</td> |
<td bgcolor="#DDDDDD"> |
<td bgcolor="#DDDDDD"> |
<form action="/adm/coursedocs" method="post" name="simpleedit"> |
<form action="/adm/coursedocs" method="post" name="simpleeditdefault"> |
<input type="hidden" name="folder" value="$folder"> |
|
<input type=hidden name="importdetail" value=""> |
|
<input type=button onClick= |
<input type=button onClick= |
"javascript:groupsearch()" value="Search"> |
"javascript:document.forms.simpleedit.folder.value='$folder';groupsearch()" value="Search"> |
<input type=button onClick= |
<input type=button onClick= |
"javascript:groupimport();" value="Import"> |
"javascript:document.forms.simpleedit.folder.value='$folder';groupimport();" value="Import"> |
</form> |
</form> |
</td><td bgcolor="#DDDDDD"> |
</td><td bgcolor="#DDDDDD"> |
<form action="/adm/coursedocs" method="post" name="newfolder"> |
<form action="/adm/coursedocs" method="post" name="newfolder"> |
Line 629 ENDFORM
|
Line 710 ENDFORM
|
</form> |
</form> |
</td> |
</td> |
<td bgcolor="#DDDDDD"> |
<td bgcolor="#DDDDDD"> |
<form action="/adm/coursedocs" method="post" name="simpleedit"> |
<form action="/adm/coursedocs" method="post" name="simpleeditsupplement"> |
<input type="hidden" name="folder" value="$folder"> |
|
<input type=hidden name="importdetail" value=""> |
<input type=hidden name="importdetail" value=""> |
<input type=button onClick= |
<input type=button onClick= |
"javascript:groupsearch()" value="Search"> |
"javascript:document.forms.simpleedit.folder.value='$folder';groupsearch()" value="Search"> |
<input type=button onClick= |
<input type=button onClick= |
"javascript:groupimport();" value="Import"> |
"javascript:document.forms.simpleedit.folder.value='$folder';groupimport();" value="Import"> |
</form> |
</form> |
</td><td bgcolor="#DDDDDD"> |
</td><td bgcolor="#DDDDDD"> |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |