Annotation of loncom/publisher/lonpubdir.pm, revision 1.114

1.1       www         1: # The LearningOnline Network with CAPA
1.32      www         2: # Construction Space Directory Lister
1.16      albertel    3: #
1.114   ! jms         4: # $Id: lonpubdir.pm,v 1.113 2008/11/17 13:41:10 schafran Exp $
1.16      albertel    5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
1.1       www        27: #
1.17      harris41   28: ###
1.1       www        29: 
                     30: package Apache::lonpubdir;
                     31: 
                     32: use strict;
                     33: use Apache::File;
                     34: use File::Copy;
                     35: use Apache::Constants qw(:common :http :methods);
1.6       www        36: use Apache::loncacc;
1.17      harris41   37: use Apache::loncommon();
1.48      www        38: use Apache::lonhtmlcommon();
1.91      www        39: use Apache::londiff();
1.39      www        40: use Apache::lonlocal;
1.50      www        41: use Apache::lonmsg;
1.64      raeburn    42: use Apache::lonmenu;
                     43: use Apache::lonnet;
1.98      albertel   44: use LONCAPA;
1.1       www        45: 
                     46: sub handler {
                     47: 
                     48:   my $r=shift;
                     49: 
                     50:   my $fn;
                     51: 
1.23      foxr       52: 
                     53: 
                     54:   $fn = getEffectiveUrl($r);
                     55: 
                     56:   # Validate access to the construction space and get username@domain.
1.6       www        57: 
                     58:   my $uname;
                     59:   my $udom;
                     60: 
1.9       www        61:   ($uname,$udom)=
1.6       www        62:     &Apache::loncacc::constructaccess(
1.9       www        63:              $fn,$r->dir_config('lonDefDomain')); 
                     64:   unless (($uname) && ($udom)) {
1.6       www        65:      $r->log_reason($uname.' at '.$udom.
1.78      albertel   66:          ' trying to list directory '.$env{'form.filename'}.
1.6       www        67:          ' ('.$fn.') - not authorized', 
                     68:          $r->filename); 
                     69:      return HTTP_NOT_ACCEPTABLE;
                     70:   }
1.23      foxr       71: 
1.32      www        72:   # Remove trailing / from directory name.
1.23      foxr       73: 
1.3       www        74:   $fn=~s/\/$//;
1.1       www        75: 
                     76:   unless ($fn) { 
1.78      albertel   77:      $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
1.2       www        78:          ' trying to list empty directory', $r->filename); 
1.1       www        79:      return HTTP_NOT_FOUND;
                     80:   } 
                     81: 
                     82: # ----------------------------------------------------------- Start page output
                     83: 
1.23      foxr       84:   my $thisdisfn=$fn;
                     85:   $thisdisfn=~s/^\/home\/$uname\/public_html//;	# subdirectory part of
                     86:                                                 # construction space. 
                     87:   my $docroot=$r->dir_config('lonDocRoot');     # Apache  londocument root.
1.1       www        88: 
1.23      foxr       89:   my $resdir=$docroot.'/res/'.$udom.'/'.$uname.$thisdisfn; # Resource directory
                     90:   my $targetdir=$udom.'/'.$uname.$thisdisfn; # Publiction target directory.
1.25      www        91:   my $linkdir='/priv/'.$uname.$thisdisfn;      # Full URL name of constr space.
1.1       www        92: 
1.50      www        93:   my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
1.1       www        94: 
1.26      www        95:   &startpage($r, $uname, $udom, $thisdisfn);   # Put out the start of page.
1.78      albertel   96:   if ($env{'environment.remote'} eq 'off') {
1.65      albertel   97:       &dircontrols($r,$uname,$udom,$thisdisfn);    # Put out actions for directory, 
1.64      raeburn    98:                                                # browse/upload + new file page.
1.72      raeburn    99:   } else {
                    100:       &pubbuttons($r,$uname,$thisdisfn);
1.65      albertel  101:   }
1.64      raeburn   102:   &resourceactions($r,$uname,$udom,$thisdisfn); #Put out form used for printing/deletion etc.
                    103: 
                    104:   my $numdir = 0;
                    105:   my $numres = 0;
1.6       www       106:   
1.50      www       107:   # Start off the directory table.
1.106     bisitz    108:   $r->print('<h3>'.&mt('Directory Contents:').'</h3>');
1.92      albertel  109:   $r->print('<table id="LC_browser"><tr>'.
                    110:             '<th>'.&mt('Type').'</th>'.
                    111:             '<th>'.&mt('Actions').'</th>'.
                    112:             '<th>'.&mt('Name').'</th>'.
                    113:             '<th>'.&mt('Title').'</th>'.
                    114: 	    '<th>'.&mt('Status').'</th>'.
                    115:             '<th>'.&mt('Last Modified').
1.85      albertel  116: 	    '</th></tr>'."\n");
1.1       www       117: 
1.2       www       118:   my $filename;
1.23      foxr      119:   my $dirptr=16384;		# Mask indicating a directory in stat.cmode.
1.1       www       120: 
1.2       www       121:   opendir(DIR,$fn);
1.44      albertel  122:   my @files=sort {uc($a) cmp uc($b)} (readdir(DIR));
1.11      albertel  123:   foreach my $filename (@files) {
1.2       www       124:      my ($cdev,$cino,$cmode,$cnlink,
                    125:          $cuid,$cgid,$crdev,$csize,
                    126:          $catime,$cmtime,$cctime,
                    127:          $cblksize,$cblocks)=stat($fn.'/'.$filename);
1.12      www       128: 
1.10      albertel  129:      my $extension='';
                    130:      if ($filename=~/\.(\w+)$/) { $extension=$1; }
1.15      matthew   131:      if ($cmode&$dirptr) {
1.64      raeburn   132: 	 putdirectory($r, $thisdisfn, $linkdir, $filename, $cmtime,$targetdir,\%bombs,\$numdir);
1.17      harris41  133:      } elsif (&Apache::loncommon::fileembstyle($extension) ne 'hdn') {
1.64      raeburn   134: 	 putresource($r, $udom, $uname, $filename, $thisdisfn, $resdir, 
                    135: 		     $targetdir, $linkdir, $cmtime,\%bombs,\$numres);
1.14      albertel  136:      } else {
1.15      matthew   137: 	# "hidden" extension and not a directory, so hide it away.
1.2       www       138:      }
                    139:   }
                    140:   closedir(DIR);
                    141: 
1.89      albertel  142:   $r->print('</table>'.&Apache::loncommon::end_page());
1.1       www       143:   return OK;  
                    144: }
1.21      foxr      145: #
1.23      foxr      146: #  Gets the effective URL of the request and returns it:
                    147: #    $effn = getEffectiveUrl($r);
                    148: #       $r  - The Apache Request object.
                    149: sub getEffectiveUrl {
                    150:     my $r = shift;
                    151:     my $fn;
                    152:     
1.78      albertel  153:     if ($env{'form.filename'}) {	# If a form filename is defined.
                    154: 	$fn=$env{'form.filename'};
1.23      foxr      155: 	#
                    156: 	#   Replace the ~username of the URL with /home/username/public_html
                    157: 	#   so that we don't have to worry about ~ expansion internally.
                    158: 	#
1.32      www       159: 	$fn=~s/^http\:\/\/[^\/]+\///;
                    160:         $fn=~s/^\///;
1.98      albertel  161:         $fn=~s{~($LONCAPA::username_re)}{/home/$1/public_html};
1.23      foxr      162: 	
                    163: 	#  Remove trailing / strings (?) 
                    164: 	
                    165: 	$fn=~s/\/[^\/]+$//;
1.24      albertel  166:     } else {
                    167: 	#   If no form is defined, use request filename.
                    168: 	$fn = $r->filename();
                    169: 	my $lonDocRoot=$r->dir_config('lonDocRoot');
                    170: 	if ( $fn =~ /$lonDocRoot/ ) {
                    171: 	    #internal authentication, needs fixup.
                    172: 	    $fn = $r->uri(); # non users do not get the full path request
                    173:                              # through SCRIPT_FILENAME
1.98      albertel  174: 	    $fn=~s{^/~($LONCAPA::username_re)}{/home/$1/public_html};
1.24      albertel  175: 	}
1.23      foxr      176:     }
1.37      www       177:     $fn=~s/\/+/\//g;
1.23      foxr      178:     return $fn;
                    179: }
                    180: #
                    181: #   Output the header of the page.  This includes:
                    182: #   - The HTML header 
                    183: #   - The H1/H3  stuff which includes the directory.
                    184: #
                    185: #     startpage($r, $uame, $udom, $thisdisfn);
                    186: #      $r     - The apache request object.
                    187: #      $uname - User name.
                    188: #      $udom  - Domain name the user is logged in under.
                    189: #      $thisdisfn - Displayable version of the filename.
1.26      www       190: 
1.23      foxr      191: sub startpage {
                    192:     my ($r, $uname, $udom, $thisdisfn) = @_;
1.64      raeburn   193:     my $currdir = '/priv/'.$uname.$thisdisfn;
1.39      www       194:     &Apache::loncommon::content_type($r,'text/html');
1.23      foxr      195:     $r->send_http_header;
1.64      raeburn   196: 
1.68      raeburn   197:     my $formaction='/priv/'.$uname.$thisdisfn.'/';
1.89      albertel  198:     $formaction=~s|/+|/|g;
1.94      albertel  199:     my $pagetitle .= &Apache::loncommon::help_open_menu('','',3,'Authoring').
1.106     bisitz    200:         '<font face="Arial, Helvetica, sans-serif" size="+1"><b>'.&mt('Construction Space').'</b>:</font>&nbsp;'.
1.66      raeburn   201:         '<form name="dirs" method="post" action="'.$formaction.
1.68      raeburn   202:         '" target="_parent"><tt><b>'.
                    203:         &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."</b></tt><br />".
1.64      raeburn   204:         &Apache::lonhtmlcommon::select_recent('construct','recent',
                    205:                  'this.form.action=this.form.recent.value;this.form.submit()').
1.66      raeburn   206:               '</form>';
                    207:     &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction);
1.78      albertel  208:     if ($env{'environment.remote'} eq 'off') {
                    209: 	$env{'request.noversionuri'}=$currdir.'/';
1.108     raeburn   210: 	$r->print(&Apache::loncommon::start_page('Construction Space',undef,
1.89      albertel  211: 						 {'body_title' =>
                    212: 						      $pagetitle,}));
1.65      albertel  213:     } else {
1.108     raeburn   214: 	$r->print(&Apache::loncommon::start_page('Construction Space',undef,
1.102     albertel  215: 						 { 'only_body' => 1,}));
1.65      albertel  216: 	$r->print($pagetitle);
                    217:     }
1.90      albertel  218: 
1.101     albertel  219:     my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn);
1.108     raeburn   220:     my $doctitle = 'LON-CAPA '.&mt('Construction Space');
1.109     bisitz    221:     my $newname = &mt('New Name');
1.29      www       222:     my $pubdirscript=(<<ENDPUBDIRSCRIPT);
1.77      albertel  223: <script type="text/javascript">
1.107     bisitz    224: top.document.title = '$esc_thisdisfn/ - $doctitle';
1.37      www       225: // Store directory location for menu bar to find
                    226: 
1.101     albertel  227: parent.lastknownpriv='/~$uname$esc_thisdisfn/';
1.37      www       228: 
                    229: // Confirmation dialogues
                    230: 
1.64      raeburn   231:     function currdiract(theform) {
                    232:         if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'publish') {
1.79      www       233:             document.publishdir.filename.value = theform.filename.value;
                    234: 	    document.publishdir.submit();
1.64      raeburn   235:         }
1.113     schafran  236:         if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'editmeta') {
1.66      raeburn   237:             top.location=theform.filename.value+'default.meta'
1.64      raeburn   238:         }
                    239:         if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'printdir' ) {
                    240:             document.printdir.postdata.value=theform.filename.value
                    241:             document.printdir.submit();
                    242:         }
1.88      raeburn   243:         if (theform.dirtask.options[theform.dirtask.selectedIndex].value == "delete") {
                    244:               var delform = document.delresource
                    245:               delform.filename.value = theform.filename.value
                    246:               delform.submit()
                    247:         }
1.64      raeburn   248:     }
                    249:   
                    250:     function checkUpload(theform) {
                    251:         if (theform.file == '') {
                    252:             alert("Please use 'Browse..' to choose a file first, before uploading")
                    253:             return 
                    254:         }
                    255:         theform.submit()  
                    256:     }
                    257: 
                    258:     function SetPubDir(theform,printForm) {
                    259:         if (theform.diraction.options[theform.diraction.selectedIndex].value == "open") {
1.75      albertel  260:             top.location = theform.openname.value
1.64      raeburn   261:             return
                    262:         }
                    263:         if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") {
1.79      www       264:             theform.submit();
1.64      raeburn   265:         }
1.113     schafran  266:         if (theform.diraction.options[theform.diraction.selectedIndex].value == "editmeta") {
1.66      raeburn   267:             top.location=theform.filename.value+'default.meta'
1.64      raeburn   268:         }
1.68      raeburn   269:         if (theform.diraction.options[theform.diraction.selectedIndex].value == "printdir") {
1.64      raeburn   270:             theform.action = '/adm/printout'
                    271:             theform.postdata.value = theform.filename.value
                    272:             theform.submit()
                    273:         }
1.88      raeburn   274:         if (theform.diraction.options[theform.diraction.selectedIndex].value == "delete") {
                    275:               var delform = document.delresource
                    276:               delform.filename.value = theform.filename.value
                    277:               delform.submit()
                    278:         }
1.64      raeburn   279:         return
                    280:     }
                    281:     function SetResChoice(theform) {
                    282:       var activity = theform.reschoice.options[theform.reschoice.selectedIndex].value
                    283:       if ((activity == 'rename') || (activity == 'copy') || (activity == 'move')) {
                    284:           changename(theform,activity)
                    285:       }
                    286:       if (activity == 'publish') {
                    287:           var pubform = document.pubresource
                    288:           pubform.filename.value = theform.filename.value
                    289:           pubform.submit()
                    290:       }
                    291:       if (activity == 'delete') {
                    292:           var delform = document.delresource
                    293:           delform.filename.value = theform.filename.value
1.71      raeburn   294:           delform.submit()
1.64      raeburn   295:       }
                    296:       if (activity == 'obsolete') {
1.68      raeburn   297:           var pubform = document.pubresource
                    298:           pubform.filename.value = theform.filename.value
1.80      www       299:           pubform.makeobsolete.value=1;
1.68      raeburn   300:           pubform.submit()
1.64      raeburn   301:       }
                    302:       if (activity == 'print') {
1.68      raeburn   303:           document.printresource.postdata.value = theform.filename.value
1.64      raeburn   304:           document.printresource.submit()
                    305:       }
                    306:       if (activity == 'retrieve') {
1.68      raeburn   307:           document.retrieveres.filename.value = theform.filename.value
                    308:           document.retrieveres.submit()
1.64      raeburn   309:       }
1.82      www       310:       if (activity == 'cleanup') {
                    311:           document.cleanup.filename.value = theform.filename.value
                    312:           document.cleanup.submit()
                    313:       }
1.64      raeburn   314:       return
                    315:     }
                    316:     function changename(theform,activity) {
1.96      banghart  317:         var oldname=theform.dispfilename.value;
1.109     bisitz    318:         var newname=prompt('$newname',oldname);
1.97      banghart  319:         if (newname == "" || !newname || newname == oldname)  {
1.64      raeburn   320:             return
                    321:         }
                    322:         document.moveresource.newfilename.value = newname
                    323:         document.moveresource.filename.value = theform.filename.value
                    324:         document.moveresource.action.value = activity
                    325:         document.moveresource.submit();
                    326:     }
1.29      www       327: </script>
                    328: ENDPUBDIRSCRIPT
1.64      raeburn   329:     $r->print($pubdirscript);
1.29      www       330: 
1.78      albertel  331:     if ((($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) &&
                    332: 	$env{'environment.remote'} ne 'off') {
1.39      www       333: 	$r->print('<h3>'.&mt('Co-Author').': '.$uname.' at '.$udom.
1.23      foxr      334: 		  '</h3>');
                    335:     }
1.64      raeburn   336: }
                    337: 
                    338: sub dircontrols {
                    339:     my ($r,$uname,$udom,$thisdisfn) = @_;
1.84      www       340:     my %lt=&Apache::lonlocal::texthash(
                    341:                                        cnpd => 'Cannot publish directory',
                    342:                                        cnrd => 'Cannot retrieve directory',
                    343:                                        mcdi => 'Must create new subdirectory inside a directory',
                    344:                                        pubr => 'Publish this Resource',
                    345:                                        pubd => 'Publish this Directory',
1.88      raeburn   346:                                        dedr => 'Delete Directory',
1.84      www       347:                                        rtrv => 'Retrieve Old Version',
                    348:                                        list => 'List Directory',
                    349:                                        uplo => 'Upload file',  
                    350:                                        dele => 'Delete',
1.113     schafran  351:                                        edit => 'Edit Metadata', 
1.84      www       352:                                        sela => 'Select Action',
                    353:                                        nfil => 'New file',
                    354:                                        nhtm => 'New HTML file',
                    355:                                        nprb => 'New problem',
                    356:                                        npag => 'New assembled page',
                    357:                                        nseq => 'New assembled sequence',
                    358:                                        ncrf => 'New custom rights file',
                    359:                                        nsty => 'New style file',
                    360:                                        nlib => 'New library file',
1.103     albertel  361:                                        nbt  => 'New bridgetask file',
1.84      www       362:                                        nsub => 'New subdirectory',
                    363:                                        renm => 'Rename current file to',
                    364:                                        move => 'Move current file to',
                    365:                                        copy => 'Copy current file to',
                    366:                                        type => 'Type Name Here',
1.105     albertel  367:                                        go   => 'Go',
1.84      www       368:                                        prnt => 'Print contents of directory',
                    369:                                        crea => 'Create a new directory or LON-CAPA document',
                    370: 				       acti => 'Actions for current directory',
1.105     albertel  371: 				       updc => 'Upload a new document',
                    372: 				       pick => 'Please select an action to perform using the new filename',
1.84      www       373:                                       );
1.106     bisitz    374:     my $mytype = $lt{'type'}; # avoid conflict with " and ' in javascript
1.64      raeburn   375:     $r->print(<<END);
1.93      albertel  376:         <table id="LC_cstr_controls">
1.64      raeburn   377:          <tr>
1.93      albertel  378:           <th>$lt{'acti'}</th>
                    379:           <th>$lt{'updc'}</th>
                    380:           <th>$lt{'crea'}</th>
1.64      raeburn   381:         </tr>
                    382:         <tr>
1.93      albertel  383:          <td>
1.64      raeburn   384:           <form name="curractions" method="post" action="">
1.85      albertel  385:            <select name="dirtask" onchange="currdiract(this.form)">
1.84      www       386:             <option>$lt{'sela'}</option>
                    387:             <option value="publish">$lt{'pubd'}</option>
1.113     schafran  388:             <option value="editmeta">$lt{'edit'}</option>
1.84      www       389:             <option value="printdir">$lt{'prnt'}</option>
1.88      raeburn   390:             <option value="delete">$lt{'dedr'}</option>
1.64      raeburn   391:            </select>
                    392:            <input type="hidden" name="filename" value="/~$uname$thisdisfn/" />
                    393:           </form>
                    394:           <form name="publishdir" method="post" action="/adm/publish" target="_parent">
                    395:            <input type="hidden" name="pubrec" value="" />
                    396:            <input type="hidden" name="filename" value="" />
                    397:           </form>
                    398:           <form name="printdir" method="post" action="/adm/printout" target="_parent">
                    399:            <input type="hidden" name="postdata" value="" />
                    400:           </form>
                    401:          </td>
1.93      albertel  402:          <td>
1.64      raeburn   403: 	    <form name="upublisher" enctype="multipart/form-data" method="post" action="/adm/upload" target="_parent">
                    404: 	      <input type="hidden" name="filename" value="/~$uname$thisdisfn/" />
                    405: 	      <input type="file" name="upfile" size="20" />
1.84      www       406: 	      <input type="button" value="$lt{'uplo'}"  onclick="checkUpload(this.form)" />
1.64      raeburn   407: 	    </form>
                    408: 	 </td>
1.93      albertel  409: 	 <td>
1.64      raeburn   410: 	    <form name="fileaction" method="post" action="/adm/cfile" target="_parent">
1.92      albertel  411: 	      <span style="white-space: nowrap">
1.64      raeburn   412: 		<input type="hidden" name="filename" value="/~$uname$thisdisfn/" />
1.105     albertel  413:                   <script type="text/javascript">
                    414:                     function validate_go() {
                    415:                         var selected = document.fileaction.action.selectedIndex;
                    416:                         if (selected == 0) {
                    417:                             alert('$lt{'pick'}');
                    418:                         } else {
                    419:                             document.fileaction.submit();
                    420:                         }
                    421:                     }
                    422:                   </script>
                    423: 		  <select name="action">
                    424: 		    <option value="none">$lt{'sela'}</option>
                    425: 		    <option value="newfile">$lt{'nfil'}:</option>
                    426: 		    <option value="newhtmlfile">$lt{'nhtm'}:</option>
                    427: 		    <option value="newproblemfile">$lt{'nprb'}:</option>
                    428:                     <option value="newpagefile">$lt{'npag'}:</option>
                    429:                     <option value="newsequencefile">$lt{'nseq'}:</option>
                    430:                     <option value="newrightsfile">$lt{'ncrf'}:</option>
                    431:                     <option value="newstyfile">$lt{'nsty'}:</option>
                    432:                     <option value="newtaskfile">$lt{'nbt'}:</option>
                    433:                     <option value="newlibraryfile">$lt{'nlib'}:</option>
                    434: 	            <option value="newdir">$lt{'nsub'}:</option>
1.106     bisitz    435: 		  </select>&nbsp;<input type="text" name="newfilename" value="$lt{'type'}" onfocus="if (this.value == '$mytype') this.value=''" />&nbsp;<input type="button" value="Go" onclick="validate_go();" />
1.92      albertel  436: 		 </span>
1.64      raeburn   437: 		</form>
                    438: 	  </td>
                    439:          </tr>
                    440:         </table>
                    441: END
                    442: }
                    443: 
1.72      raeburn   444: sub pubbuttons {
                    445:     my ($r,$uname,$thisdisfn) = @_;
                    446:     $r->print('<form method="post" action="/adm/publish" target="_parent">'.
                    447:               '<table><tr><td><input type="hidden" name="filename" value="/~'.
                    448:                $uname.$thisdisfn.'/" />'.
1.79      www       449:               '<input type="submit" value="'.&mt('Publish Directory').'" /></td><td>'.
1.85      albertel  450: '<input type="button" onclick="window.location='."'/~".
1.72      raeburn   451:                $uname.$thisdisfn."/default.meta'".'" value="'.
                    452: &mt('Edit Directory Catalog Information').'" /></td></tr></table></form>');
                    453: }
                    454: 
1.64      raeburn   455: sub resourceactions {
                    456:     my ($r,$uname,$udom,$thisdisfn) = @_;
                    457:     $r->print(<<END);
                    458:        <form name="moveresource" action="/adm/cfile" target="_parent" method="post">
                    459:          <input type="hidden" name="filename" value="" />
                    460:          <input type="hidden" name="newfilename" value="" />
                    461:          <input type="hidden" name="action" value="" />
                    462:        </form>
                    463:        <form name="delresource" action="/adm/cfile" target="_parent" method="post">
                    464:          <input type="hidden" name="filename" value="" />
                    465:          <input type="hidden" name="action" value="delete" />
                    466:        </form>
                    467:        <form name="pubresource" action="/adm/publish" target="_parent" method="post">
                    468:          <input type="hidden" name="filename" value="" />
1.80      www       469:          <input type="hidden" name="makeobsolete" value="0" />
1.64      raeburn   470:        </form>
                    471:        <form name="printresource" action="/adm/printout" target="_parent" method="post">
                    472:            <input type="hidden" name="postdata" value="" />
                    473:        </form>
                    474:        <form name="retrieveres" action="/adm/retrieve" target="_parent" method="post">
                    475:            <input type="hidden" name="filename" value="" />
                    476:        </form>
1.82      www       477:        <form name="cleanup" action="/adm/cleanup" target="_parent" method="post">
                    478:            <input type="hidden" name="filename" value="" />
                    479:        </form>
1.64      raeburn   480: END
1.23      foxr      481: }
                    482: 
                    483: #
                    484: #   Get the title string or "[untitled]" if the file has no title metadata:
                    485: #   Without the latter substitution, it's impossible to examine metadata for
                    486: #   untitled resources.  Resources may be legitimately untitled, to prevent
                    487: #   searches from locating them.
                    488: #
                    489: #   $str = getTitleString($fullname);
                    490: #       $fullname - Fully qualified filename to check.
                    491: #
                    492: sub getTitleString {
                    493:     my $fullname = shift;
                    494:     my $title    = &Apache::lonnet::metadata($fullname, 'title');
                    495: 
                    496:     unless ($title) {
1.40      www       497: 	$title = "[".&mt('untitled')."]";
1.23      foxr      498:     }
                    499:     return $title;
                    500: }
                    501: 
1.55      www       502: sub getCopyRightString {
                    503:     my $fullname = shift;
                    504:     return &Apache::lonnet::metadata($fullname, 'copyright');
                    505: }
1.61      www       506: 
                    507: sub getSourceRightString {
                    508:     my $fullname = shift;
                    509:     return &Apache::lonnet::metadata($fullname, 'sourceavail');
                    510: }
1.23      foxr      511: #
1.21      foxr      512: #  Put out a directory table row:
                    513: #    putdirectory(r, base, here, dirname, modtime)
                    514: #      r       - Apache request object.
                    515: #      reqfile - File in request.
                    516: #      here    - Where we are in directory tree.
                    517: #      dirname - Name of directory special file.
                    518: #      modtime - Encoded modification time.
                    519: # 
                    520: sub putdirectory {
1.64      raeburn   521:     my ($r, $reqfile, $here, $dirname, $modtime, $resdir, $bombs, $numdir) = @_;
1.21      foxr      522:     # construct the display filename: the directory name unless ..:
                    523:     
                    524:     my $disfilename = $dirname;
                    525:     if ($dirname eq '..') {
1.39      www       526: 	$disfilename = '<i>'.&mt('Parent Directory').'</i>';
1.21      foxr      527:     }
1.64      raeburn   528:     unless ( (($dirname eq '..') && ($reqfile eq '')) || ($dirname eq '.')) {
1.50      www       529: 	my $kaputt=0;
                    530: 	foreach (keys %{$bombs}) {
1.56      albertel  531: 	    if ($_=~m:^\Q$resdir\E/\Q$disfilename\E/:) { $kaputt=1; last; }
1.50      www       532: 	}
1.52      www       533: 	%Apache::lonpublisher::metadatafields=();
                    534: 	%Apache::lonpublisher::metadatakeys=();
                    535: 	my $construct=$here;
1.98      albertel  536: 	$construct=~s{^/priv/($LONCAPA::username_re)$}{/home/$1/public_html};
1.67      raeburn   537:         my $dirpath = $here;
1.98      albertel  538:         $dirpath=~s{^/priv/}{/~};
1.52      www       539: 	&Apache::lonpublisher::metaeval(&Apache::lonnet::getfile(
                    540:        				 $construct.'/'.$dirname.'/default.meta'
                    541: 								 ));
1.64      raeburn   542:         my $actionitem = '';
                    543:         if ($dirname eq '..') {
1.109     bisitz    544:             $actionitem = &mt('Go to ...');
1.64      raeburn   545:         } else {
                    546:             $actionitem = 
                    547:                     '<form name="dirselect_'.$$numdir.
                    548:                     '" action="/adm/publish" target="_parent">'.
1.85      albertel  549:                     '<select name="diraction" onchange="SetPubDir(this.form,document)">'.
1.64      raeburn   550:                       '<option selected="selected">'.&mt('Select action').'</option>'.
                    551:                       '<option value="open">'.&mt('Open').'</option>'.
                    552:                       '<option value="publish">'.&mt('Publish').'</option>'.
1.113     schafran  553:                       '<option value="editmeta">'.&mt('Edit Metadata').'</option>'.
1.77      albertel  554:                       '<option value="printdir">'.&mt('Print directory').'</option>'.
1.88      raeburn   555:                       '<option value="delete">'.&mt('Delete directory').'</option>'.
1.64      raeburn   556:                     '</select>'.
1.86      albertel  557:                      '<input type="hidden" name="filename" value="'.&HTML::Entities::encode($dirpath.'/'.$dirname,'<>&"').'/" />'.
1.75      albertel  558:                      '<input type="hidden" name="openname" value="'.$here.'/'.$dirname.'/" />'.
1.64      raeburn   559:                      '<input type="hidden" name="postdata" value="" />'.
                    560:                    '</form>';
                    561:             $$numdir ++;
                    562:         }
1.92      albertel  563: 	$r->print('<tr class="LC_browser_folder">'.
1.53      www       564: 		  '<td><img src="'.
1.86      albertel  565: 		  $Apache::lonnet::perlvar{'lonIconsURL'}.'/folder_closed.gif" alt="folder" /></td>'.
1.64      raeburn   566: 		  '<td>'.$actionitem.'</td>'.
1.92      albertel  567: 		  '<td><span class="LC_filename"><a href="'.&HTML::Entities::encode($here.'/'.$dirname,'<>&"').'/" target="_parent">'.
                    568: 		  $disfilename.'</a></span></td>'.
                    569: 		        '<td colspan="2">'.($kaputt?&Apache::lonhtmlcommon::authorbombs($resdir.'/'.$disfilename.'/'):'').$Apache::lonpublisher::metadatafields{'title'});
                    570: 	if ($Apache::lonpublisher::metadatafields{'subject'} ne '') {
                    571: 	    $r->print(' <i>'.
                    572: 		      $Apache::lonpublisher::metadatafields{'subject'}.
                    573: 		      '</i> ');
                    574: 	}
                    575: 	$r->print($Apache::lonpublisher::metadatafields{'keywords'}.'</td>'.
1.42      www       576: 		  '<td>'.&Apache::lonlocal::locallocaltime($modtime).'</td>'.
1.25      www       577: 		  "</tr>\n");
1.64      raeburn   578:     }
1.21      foxr      579:     return OK;
                    580: }
1.22      foxr      581: #
                    582: #   Put a table row for a file resource.
                    583: #
                    584: sub putresource {
1.64      raeburn   585:     my ($r, $udom, $uname, $filename, $thisdisfn, 
1.22      foxr      586: 	$resdir, $targetdir, $linkdir,
1.64      raeburn   587: 	$cmtime,$bombs,$numres) = @_;
1.81      www       588:     &Apache::lonnet::devalidate_cache_new('meta',$targetdir.'/'.$filename);
1.64      raeburn   589:     my $pubstatus = 'unpublished';
1.47      sakharuk  590:     my $status=&mt('Unpublished');
1.92      albertel  591:     my $css_class='LC_browser_file';
1.22      foxr      592:     my $title='&nbsp;';
1.60      albertel  593:     my $publish_button=&mt('Publish');
1.95      albertel  594:     my $cstr_dir = '/home/'.$uname.'/public_html/'.$thisdisfn.'/';
1.64      raeburn   595: #    my $action_buttons=
                    596: #        '<br /><a target="_parent" href="/adm/cfile?action=delete&filename=/~'.
                    597: #	$uname.'/'.$thisdisfn.'/'.$filename.'">'.
                    598: #	&mt('Delete').'</a>';
1.22      foxr      599:     if (-e $resdir.'/'.$filename) {
1.91      www       600:         my $same=0;
1.22      foxr      601: 	my ($rdev,$rino,$rmode,$rnlink,
                    602: 	    $ruid,$rgid,$rrdev,$rsize,
                    603: 	    $ratime,$rmtime,$rctime,
                    604: 	    $rblksize,$rblocks)=stat($resdir.'/'.$filename);
1.91      www       605:         if ($rmtime>=$cmtime) {
                    606:            $same=1;
                    607:         } else {
                    608:            if (&Apache::londiff::are_different_files($resdir.'/'.$filename,
1.95      albertel  609: 						     $cstr_dir.'/'.$filename)) {
1.91      www       610:               $same=0;
                    611:            } else {
                    612:               $same=1;
                    613:            }
                    614:         }
1.95      albertel  615: 	my $meta_cmtime = (stat($cstr_dir.'/'.$filename.'.meta'))[9];
                    616: 	my $meta_rmtime = (stat($resdir.'/'.$filename.'.meta'))[9];
                    617: 	my $meta_same = 1;
                    618: 	if ($meta_rmtime < $meta_cmtime
                    619: 	    && &Apache::londiff::are_different_files($resdir.'/'.$filename.'.meta',
                    620: 						     $cstr_dir.'/'.$filename.'.meta')) {
                    621: 	    $meta_same = 0;
                    622: 	}
1.64      raeburn   623: 	$publish_button=&mt('Re-publish');
1.95      albertel  624: 	my $rights_status =
                    625: 	    &mt(&getCopyRightString($targetdir.'/'.$filename)).' '.
                    626: 	    &mt(&getSourceRightString($targetdir.'/'.$filename));
                    627: 	$title = '<a href="/res/'.$targetdir.'/'.$filename.
                    628: 	    '.meta" target="cat">'.
                    629: 	    &getTitleString($targetdir.'/'.$filename).'</a>';
1.91      www       630: 	if ($same) {
1.40      www       631: 	    if (&Apache::lonnet::metadata($targetdir.'/'.$filename,'obsolete')) {
1.64      raeburn   632:                 $pubstatus = 'obsolete';
1.41      www       633: 		$status=&mt('Obsolete');
1.95      albertel  634:             } else {
                    635: 		if (!$meta_same) {
                    636: 		    $pubstatus = 'metamodified';
                    637: 		} else {
                    638: 		    $pubstatus = 'published';
                    639: 		}
                    640: 		$status=&mt('Published').
                    641: 		    '<br />'. $rights_status;
                    642: 	    }
1.64      raeburn   643: #	    } else {
                    644: #		$action_buttons='';
                    645: #	    }
1.22      foxr      646: 	} else {
1.64      raeburn   647:             $pubstatus = 'modified';
1.95      albertel  648: 	    $status=&mt('Modified').
                    649: 		'<br />'. $rights_status;
1.64      raeburn   650: #	    $action_buttons='';
1.22      foxr      651: 	    if (&Apache::loncommon::fileembstyle(($filename=~/\.(\w+)$/)) eq 'ssi') {
1.57      www       652: 		$status.='<br /><a href="/adm/diff?filename=/~'.$uname.
1.22      foxr      653: 		    $thisdisfn.'/'.$filename.
1.77      albertel  654: 		    '&amp;versiontwo=priv" target="cat">'.&mt('Diffs').'</a>';
1.22      foxr      655: 	    }
1.95      albertel  656: 	} 
                    657: 
1.77      albertel  658: 	$title.="\n".'<br /><a href="/~'.$uname.$thisdisfn.'/'.$filename.'.meta">'. 
1.110     bisitz    659: 	    ($$bombs{$targetdir.'/'.$filename}?'<img src="/adm/lonMisc/bomb.gif" border="0" alt="'.&mt('bomb').'" />':&mt('Edit Metadata')).'</a>';
1.95      albertel  660: 
                    661: 	if (!$meta_same) {
                    662: 	    $title = &mt('Metadata Modified').'<br />'.$title.
                    663: 		'<br /><a href="/adm/diff?filename=/~'.$uname.
                    664: 		$thisdisfn.'/'.$filename.'.meta'.
                    665: 		'&amp;versiontwo=priv" target="cat">'.&mt('Metadata Diffs').'</a>';
                    666: 	    $title.="\n".'<br /><a href="/adm/retrieve?filename=/~'.$uname.
                    667: 		$thisdisfn.'/'.$filename.'.meta" target="_parent">'.&mt('Retrieve Metadata').'</a>';
                    668: 	}
1.77      albertel  669: 	$status.="\n".'<br /><a href="/adm/retrieve?filename=/~'.$uname.
1.64      raeburn   670: 	    $thisdisfn.'/'.$filename.'" target="_parent">'.&mt('Retrieve').'</a>';
1.22      foxr      671:     }
1.33      www       672:     my $editlink='';
1.38      taceyjo1  673:     my $editlink2='';
1.36      www       674:     if ($filename=~/\.(xml|html|htm|xhtml|xhtm|sty)$/) {
1.64      raeburn   675: 	$editlink=' <br />(<a href="'.$linkdir.'/'.$filename.'?forceedit=1" target="_parent">'.&mt('Edit').'</a>)';
1.34      www       676:     }
                    677:     if ($filename=~/\.(problem|exam|quiz|assess|survey|form|library)$/) {
1.64      raeburn   678: 	$editlink=' (<a href="'.$linkdir.'/'.$filename.'?forceedit=1" target="_parent">'.&mt('EditXML').'</a>)';
                    679: 	$editlink2=' <br />(<a href="'.$linkdir.'/'.$filename.'?forceColoredit=1" target="_parent">'.&mt('Edit').'</a>)';
1.43      taceyjo1  680:     }
1.82      www       681:     if ($filename=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm|sty)$/) {
1.83      www       682: 	$editlink.=' (<a href="/adm/cleanup?filename=/~'.$uname.
                    683: 	    $thisdisfn.'/'.$filename.'" target="_parent">'.&mt('Clean Up').')</a>';
1.82      www       684:     }
1.43      taceyjo1  685:     if ($filename=~/\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/) {
1.46      taceyjo1  686: 	$editlink=' (<a target="_parent" href="/adm/cfile?decompress=/~'.
                    687: 	      $uname.$thisdisfn.'/'.$filename.'">'.&mt('Decompress').'</a>)';
1.33      www       688:     }
1.64      raeburn   689:     my $pub_select = '';
                    690:     &create_pubselect($r,\$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres);
1.92      albertel  691:     $r->print('<tr class="LC_browser_file_'.$pubstatus.'">'.
1.53      www       692: 	      '<td>'.($filename=~/[\#\~]$/?'&nbsp;':
1.86      albertel  693: 		      '<img src="'.&Apache::loncommon::icon($filename).'" alt="" />').'</td>'.
1.64      raeburn   694:               '<td>'.$pub_select.'</td>'.
1.104     albertel  695: 	      '<td><span class="LC_filename">'.
1.64      raeburn   696: 	      '<a href="'.$linkdir.'/'.$filename.'" target="_parent">'.
1.92      albertel  697:                $filename.'</a></span>'.$editlink2.$editlink.
1.22      foxr      698: 	      '</td>'.
                    699: 	      '<td>'.$title.'</td>'.
1.41      www       700: 	      '<td>'.$status.'</td>'.
1.42      www       701: 	      '<td>'.&Apache::lonlocal::locallocaltime($cmtime).'</td>'.
1.25      www       702: 	      "</tr>\n");
1.22      foxr      703:     return OK;
1.23      foxr      704: }
1.64      raeburn   705: 
                    706: sub create_pubselect {
                    707:     my ($r,$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres) = @_;
                    708:     $$pub_select = '
                    709: <form name="resselect_'.$$numres.'" action="">
1.85      albertel  710: <select name="reschoice"  onchange="SetResChoice(this.form)">
1.77      albertel  711: <option>'.&mt('Select action').'</option>'.
                    712: '<option value="copy">'.&mt('Copy').'</option>';
1.68      raeburn   713:     if ($pubstatus eq 'obsolete' || $pubstatus eq 'unpublished') {
                    714:         $$pub_select .= 
1.77      albertel  715: '<option value="rename">'.&mt('Rename').'</option>'.
                    716: '<option value="move">'.&mt('Move').'</option>'.
                    717: '<option value="delete">'.&mt('Delete').'</option>';
1.64      raeburn   718:     } else {
                    719:         $$pub_select .= '
1.77      albertel  720: <option value="obsolete">'.&mt('Mark obsolete').'</option>';
1.64      raeburn   721:     }
                    722: # check for versions
                    723:     my $versions = &check_for_versions($r,'/'.$filename,$udom,$uname);
                    724:     if ($versions > 0) {
                    725:         $$pub_select .='
1.77      albertel  726: <option value="retrieve">'.&mt('Retrieve old version').'</option>';
1.64      raeburn   727:     }
                    728:     $$pub_select .= '
1.77      albertel  729: <option value="publish">'.$publish_button.'</option>'.
1.82      www       730: '<option value="cleanup">'.&mt('Clean up').'</option>'.
1.77      albertel  731: '<option value="print">'.&mt('Print').'</option>'.
1.68      raeburn   732: '</select>
1.64      raeburn   733: <input type="hidden" name="filename" value="/~'.
1.96      banghart  734:  &HTML::Entities::encode($uname.$thisdisfn.'/'.$filename,'<>&"').'" />
                    735:  <input type="hidden" name="dispfilename" value="'.
1.99      albertel  736:  &HTML::Entities::encode($filename).'" /></form>';
1.64      raeburn   737:     $$numres ++;
                    738: }
                    739: 
                    740: sub check_for_versions {
                    741:     my ($r,$fn,$udom,$uname) = @_;
                    742:     my $versions = 0;
                    743:     my $docroot=$r->dir_config('lonDocRoot');
                    744:     my $resfn=$docroot.'/res/'.$udom.'/'.$uname.$fn;
                    745:     my $resdir=$resfn;
                    746:     $resdir=~s/\/[^\/]+$/\//;
                    747:     $fn=~/\/([^\/]+)\.(\w+)$/;
                    748:     my $main=$1;
                    749:     my $suffix=$2;
                    750:     opendir(DIR,$resdir);
                    751:     while (my $filename=readdir(DIR)) {
                    752:         if ($filename=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/) {
                    753:             $versions ++;        
                    754:         }
                    755:     }
                    756:     return $versions;
                    757: }
                    758: 
1.23      foxr      759: #
                    760: #   Categorize files in the directory.
                    761: #   For each file in a list of files in a file directory, 
                    762: #   the  file categorized as one of:
                    763: #    - directory  
                    764: #    - sequence
                    765: #    - problem 
                    766: #    - Other resource.
                    767: #
                    768: #   For each file the modification date is determined as well.
                    769: #   Returned is a list of sublists:
                    770: #    (directories, sequences, problems, other)
                    771: #   each of the sublists contains entries of the following form (sorted by
                    772: #   filename):
                    773: #     (filename, typecode, lastmodtime)
                    774: #
                    775: #   $list = CategorizeFiles($location, $files)
                    776: #       $location   - Directory in which the files live (relative to our
                    777: #                     execution.
                    778: #       $files      - list of files.
                    779: #
                    780: sub CategorizeFiles {
                    781:     my $location = shift;
                    782:     my $files    = shift;
1.22      foxr      783: }
                    784: 
1.4       www       785: 1;
                    786: __END__
1.17      harris41  787: 
                    788: 
1.114   ! jms       789: =head1 NAME
        !           790: 
        !           791: Apache::lonpubdir - Construction space directory lister
        !           792: 
        !           793: =head1 SYNOPSIS
        !           794: 
        !           795: Invoked (for various locations) by /etc/httpd/conf/srm.conf:
        !           796: 
        !           797:  <LocationMatch "^/\~.*/$">
        !           798:  PerlAccessHandler       Apache::loncacc
        !           799:  SetHandler perl-script
        !           800:  PerlHandler Apache::lonpubdir
        !           801:  ErrorDocument     403 /adm/login
        !           802:  ErrorDocument     404 /adm/notfound.html
        !           803:  ErrorDocument     406 /adm/unauthorized.html
        !           804:  ErrorDocument	  500 /adm/errorhandler
        !           805:  </LocationMatch>
        !           806: 
        !           807:  <Location /adm/pubdir>
        !           808:  PerlAccessHandler       Apache::lonacc
        !           809:  SetHandler perl-script
        !           810:  PerlHandler Apache::lonpubdir
        !           811:  ErrorDocument     403 /adm/login
        !           812:  ErrorDocument     404 /adm/notfound.html
        !           813:  ErrorDocument     406 /adm/unauthorized.html
        !           814:  ErrorDocument	  500 /adm/errorhandler
        !           815:  </Location>
        !           816: 
        !           817: =head1 INTRODUCTION
        !           818: 
        !           819: This module publishes a directory of files.
        !           820: 
        !           821: This is part of the LearningOnline Network with CAPA project
        !           822: described at http://www.lon-capa.org.
        !           823: 
        !           824: =head1 HANDLER SUBROUTINE
        !           825: 
        !           826: This routine is called by Apache and mod_perl.
        !           827: 
        !           828: =over 4
        !           829: 
        !           830: =item *
        !           831: 
        !           832: read in information
        !           833: 
        !           834: =item *
        !           835: 
        !           836: start page output
        !           837: 
        !           838: =item *
        !           839: 
        !           840: run through list of files and attempt to publish unhidden files
        !           841: 
        !           842: =back
        !           843: 
        !           844: =head1 SUBROUTINES:
        !           845: 
        !           846: =over
        !           847: 
        !           848: =item startpage($r, $uame, $udom, $thisdisfn)
        !           849: 
        !           850: Output the header of the page.  This includes:
        !           851:  - The HTML header 
        !           852:  - The H1/H3  stuff which includes the directory.
        !           853:  
        !           854:     startpage($r, $uame, $udom, $thisdisfn);
        !           855:         $r     - The apache request object.
        !           856:         $uname - User name.
        !           857:         $udom  - Domain name the user is logged in under.
        !           858:         $thisdisfn - Displayable version of the filename.
        !           859: 
        !           860: =item getTitleString($fullname)
        !           861: 
        !           862:     Get the title string or "[untitled]" if the file has no title metadata:
        !           863:     Without the latter substitution, it's impossible to examine metadata for
        !           864:     untitled resources.  Resources may be legitimately untitled, to prevent
        !           865:     searches from locating them.
        !           866:     
        !           867:     $str = getTitleString($fullname);
        !           868:         $fullname - Fully qualified filename to check.
        !           869: 
        !           870: =item putdirectory(r, base, here, dirname, modtime)
        !           871: 
        !           872:     Put out a directory table row:
        !           873:     
        !           874:     putdirectory($r, $base, $here, $dirname, $modtime)
        !           875:         $r       - Apache request object.
        !           876:         $reqfile - File in request.
        !           877:         $here    - Where we are in directory tree.
        !           878:         $dirname - Name of directory special file.
        !           879:         $modtime - Encoded modification time.
        !           880: 
        !           881: =item CategorizeFiles($location, $files)
        !           882:     
        !           883:     Categorize files in the directory.
        !           884:     For each file in a list of files in a file directory, 
        !           885:     the  file categorized as one of:
        !           886:         - directory  
        !           887:         - sequence
        !           888:         - problem 
        !           889:         - Other resource.
        !           890: 
        !           891:     For each file the modification date is determined as well.
        !           892:     Returned is a list of sublists:
        !           893:         (directories, sequences, problems, other)
        !           894:     each of the sublists contains entries of the following form (sorted by filename):
        !           895:     (filename, typecode, lastmodtime)
        !           896:     
        !           897:         $list = CategorizeFiles($location, $files)
        !           898:         $location   - Directory in which the files live (relative to our execution)
        !           899:         $files      - list of files.
        !           900: 
        !           901: =back
        !           902: 
        !           903: =cut
        !           904: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.