--- loncom/interface/londocs.pm 2004/02/12 19:20:40 1.105 +++ loncom/interface/londocs.pm 2004/03/31 05:23:59 1.111 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.105 2004/02/12 19:20:40 albertel Exp $ +# $Id: londocs.pm,v 1.111 2004/03/31 05:23:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -97,13 +97,15 @@ sub authorhosts { } else { ($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/); } - if (&Apache::lonnet::homeserver($ca,$cd) eq - $Apache::lonnet::perlvar{'lonHostID'}) { + my $allowed=0; + my $myhome=&Apache::lonnet::homeserver($ca,$cd); + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $myhome) { $allowed=1; } } + if ($allowed) { $home++; $outhash{'home_'.$ca.'@'.$cd}=1; } else { - $outhash{'otherhome_'.$ca.'@'.$cd}= - &Apache::lonnet::homeserver($ca,$cd); + $outhash{'otherhome_'.$ca.'@'.$cd}=$myhome; $other++; } } @@ -395,7 +397,7 @@ sub editor { foreach (@Apache::lonratedt::order) { my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); unless ($name) { $name=(split(/\//,$url))[-1]; } - unless ($name) { $name='NO RESOURCE'; $url='/adm/notfound.html'; } + unless ($name) { next; } $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_)); $idx++; } @@ -409,38 +411,42 @@ sub entryline { my ($index,$title,$url,$folder,$allowed,$residx)=@_; $title=~s/\&colon\;/\:/g; $title=&HTML::Entities::encode(&HTML::Entities::decode( - &Apache::lonnet::unescape($title)),'\"\<\>\&\''); + &Apache::lonnet::unescape($title)),'"<>&\''); my $renametitle=$title; my $foldertitle=$title; - if ($title=~ - /^(\d+)\_\_\_\&\;\&\;\&\;\_\_\_(\w+)\_\_\_\&\;\&\;\&\;\_\_\_(\w+)\_\_\_\&\;\&\;\&\;\_\_\_(.*)$/ - ) { - $foldertitle=&Apache::lontexconvert::msgtexconverted($4); - $renametitle=$4; - $title=''.&Apache::lonlocal::locallocaltime($1).' '. - &Apache::loncommon::plainname($2,$3).':
'. - $foldertitle; - } + if ($title=~ /^(\d+)___&&&___(\w+)___&&&___(\w+)___&&&___(.*)$/ ) { + $foldertitle=&Apache::lontexconvert::msgtexconverted($4); + $renametitle=$4; + $title=''.&Apache::lonlocal::locallocaltime($1).' '. + &Apache::loncommon::plainname($2,$3).':
'. + $foldertitle; + } $renametitle=~s/\"\;/\\\"/g; my $line=''; # Edit commands - if ($allowed) { - my %lt=('up' => 'Move Up', - 'dw' => 'Move Down', - 'rm' => 'Remove', - 'rn' => 'Rename'); - $line.=(< 'Move Up', + 'dw' => 'Move Down', + 'rm' => 'Remove', + 'rn' => 'Rename'); + my ($foldername,$htmlfoldername); + if ($ENV{'form.foldername'}) { + $foldername='&foldername='. + &Apache::lonnet::escape($ENV{'form.foldername'}); + $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"'); + } + $line.=(<
- + $lt{
- + $lt{
- + $lt{'rm'} - + $lt{'rn'} END } @@ -502,7 +508,7 @@ sub checkonthis { $alreadyseen{$url}=1; $r->rflush(); if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) { - $r->print('
'); + $r->print("\n
"); for (my $i=0;$i<=$level*5;$i++) { $r->print(' '); } @@ -590,7 +596,8 @@ sub verifycontent { } } &untiehash(); - $r->print('

'.&mt('Done').'.

'); + $r->print('

'.&mt('Done').'.

'.''. + &mt('Return to DOCS').''); } # -------------------------------------------------------------- Check Versions @@ -1006,6 +1013,14 @@ function makeabout() { } } +function makeims() { + var caller = document.forms.ims.folder.value + var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one" + newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes") + newWindow.location.href = newlocation +} + + function finishpick() { var title=this.document.forms.extimport.title.value; var url=this.document.forms.extimport.url.value; @@ -1015,20 +1030,22 @@ function finishpick() { '";this.document.forms.'+form+'.submit();'); } -function changename(folder,index,oldtitle) { +function changename(folder,index,oldtitle,foldername) { 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.foldername.value=foldername; this.document.forms.renameform.submit(); } } -function removeres(folder,index,oldtitle) { - if ((oldtitle=='NO RESOURCE') || (confirm('Remove "'+oldtitle+'"?'))) { +function removeres(folder,index,oldtitle,foldername) { + if (confirm('Remove "'+oldtitle+'"?')) { this.document.forms.renameform.cmd.value='del_'+index; this.document.forms.renameform.folder.value=folder; + this.document.forms.renameform.foldername.value=foldername; this.document.forms.renameform.submit(); } } @@ -1064,6 +1081,7 @@ ENDNEWSCRIPT 'bull' => 'Bulletin Board', 'mypi' => 'My Personal Info', 'abou' => 'About User', + 'imsf' => 'Import IMS package', 'file' => 'File', 'title' => 'Title', 'comment' => 'Comment' @@ -1080,10 +1098,12 @@ ENDNEWSCRIPT +
+
@@ -1099,6 +1119,7 @@ ENDCOURSEVERIFY &mt('Editing the Table of Contents for your Course'))); } # --------------------------------------------------------- Standard documents + my $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"'); $r->print('
'); if (($standard) && ($allowed) && (!$forcesupplement)) { $r->print('

'.&mt('Main Course Documents'). @@ -1132,7 +1153,7 @@ $lt{'file'}:
$lt{'title'}:
- + @@ -1143,7 +1164,7 @@ $lt{'title'}:

- + @@ -1163,7 +1184,7 @@ $help{'Load_Map'} - + $help{'Adding_Fold
- + $help{'Adding_Ext
- + @@ -1192,7 +1213,7 @@ value="Syllabus=/public/$coursedom/$cour
- + @@ -1202,7 +1223,7 @@ $help{'Navigate_Content'}
- + $
- + - + - + - + @@ -1250,13 +1271,18 @@ $help{'My Personal Info'}
- +
+
+ + + +
ENDFORM @@ -1287,7 +1313,7 @@ ENDFORM - + @@ -1298,7 +1324,7 @@ ENDFORM
- + $help{'Adding_Fol
- + $help{'Adding_Ext
- + @@ -1328,7 +1354,7 @@ $help{'Syllabus'}
- +