--- loncom/interface/londocs.pm 2005/03/02 22:26:36 1.169 +++ loncom/interface/londocs.pm 2005/04/04 23:51:54 1.173 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.169 2005/03/02 22:26:36 raeburn Exp $ +# $Id: londocs.pm,v 1.173 2005/04/04 23:51:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1093,6 +1093,13 @@ sub editor { $Apache::lonratedt::order[$i+1]; } $#Apache::lonratedt::order--; + } elsif ($cmd eq 'cut') { + my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); + for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { + $Apache::lonratedt::order[$i]= + $Apache::lonratedt::order[$i+1]; + } + $#Apache::lonratedt::order--; } elsif ($cmd eq 'up') { if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) { my $i=$Apache::lonratedt::order[$idx-1]; @@ -1280,6 +1287,7 @@ sub entryline { 'up' => 'Move Up', 'dw' => 'Move Down', 'rm' => 'Remove', + 'ct' => 'Cut', 'rn' => 'Rename', 'cp' => 'Copy'); if ($ENV{'form.pagepath'}) { @@ -1302,6 +1310,8 @@ sub entryline { $lt{'rm'} + +$lt{'ct'} $lt{'rn'} @@ -1326,6 +1336,8 @@ END $lt{'rm'} + +$lt{'ct'} $lt{'rn'} @@ -1489,7 +1501,7 @@ sub checkonthis { if ($url=~/^\/res\//) { my $result=&Apache::lonnet::repcopy( &Apache::lonnet::filelocation('',$url)); - if ($result eq 'OK') { + if ($result eq 'ok') { $r->print(''.&mt('ok').''); $r->rflush(); &Apache::lonnet::countacc($url); @@ -1501,23 +1513,20 @@ sub checkonthis { $r->print(' '); } $r->print('- '.&mt('Rendering').': '); - my $oldpath=$ENV{'request.filename'}; - $ENV{'request.filename'}=&Apache::lonnet::filelocation('',$url); - &Apache::lonxml::xmlparse($r,'web', - &Apache::lonnet::getfile( - &Apache::lonnet::filelocation('',$url))); - undef($Apache::lonhomework::parsing_a_problem); - $ENV{'request.filename'}=$oldpath; - if (($Apache::lonxml::errorcount) || - ($Apache::lonxml::warningcount)) { - if ($Apache::lonxml::errorcount) { + my ($errorcount,$warningcount)=split(/:/, + &Apache::lonnet::ssi_body($url, + ('grade_target'=>'web', + 'return_only_error_and_warning_counts' => 1))); + if (($errorcount) || + ($warningcount)) { + if ($errorcount) { $r->print(''. - $Apache::lonxml::errorcount.' '. + $errorcount.' '. &mt('error(s)').' '); } - if ($Apache::lonxml::warningcount) { + if ($warningcount) { $r->print(''. - $Apache::lonxml::warningcount.' '. + $warningcount.' '. &mt('warning(s)').''); } } else { @@ -1532,9 +1541,9 @@ sub checkonthis { &checkonthis($r,$_,$level+1); } } - } elsif ($result eq 'HTTP_SERVICE_UNAVAILABLE') { + } elsif ($result eq 'unavailable') { $r->print(''.&mt('connection down').''); - } elsif ($result eq 'HTTP_NOT_FOUND') { + } elsif ($result eq 'not_found') { unless ($url=~/\$/) { $r->print(''.&mt('not found').''); } else { @@ -2098,11 +2107,26 @@ function changename(folderpath,index,old } function removeres(folderpath,index,oldtitle,container,pagesymb) { - if (confirm('Remove "'+oldtitle+'"?')) { + if (confirm('WARNING: Removing a resource makes associated grades and scores inaccessible!\\nRemove "'+oldtitle+'"?')) { this.document.forms.renameform.cmd.value='del_'+index; if (container == 'sequence') { this.document.forms.renameform.folderpath.value=folderpath; } + if (container == 'page') { + this.document.forms.renameform.pagepath.value=folderpath; + this.document.forms.renameform.pagesymb.value=pagesymb; + } + this.document.forms.renameform.submit(); + } +} + +function cutres(folderpath,index,oldtitle,container,pagesymb) { + if (confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible,\\neven if it is pasted in again elsewhere!\\nCut "'+oldtitle+'"?')) { + this.document.forms.renameform.cmd.value='cut_'+index; + this.document.forms.renameform.markcopy.value=index; + if (container == 'sequence') { + this.document.forms.renameform.folderpath.value=folderpath; + } if (container == 'page') { this.document.forms.renameform.pagepath.value=folderpath; this.document.forms.renameform.pagesymb.value=pagesymb;