--- loncom/publisher/lonpubdir.pm 2005/04/07 06:56:26 1.78 +++ loncom/publisher/lonpubdir.pm 2005/07/14 18:27:35 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Directory Lister # -# $Id: lonpubdir.pm,v 1.78 2005/04/07 06:56:26 albertel Exp $ +# $Id: lonpubdir.pm,v 1.87 2005/07/14 18:27:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -111,7 +111,7 @@ sub handler { ''.&mt('Title').''. ''.&mt('Status').''. ''.&mt('Last Modified'). - ''); + ''."\n"); my $filename; my $dirptr=16384; # Mask indicating a directory in stat.cmode. @@ -223,12 +223,8 @@ parent.lastknownpriv='/~$uname$thisdisfn function currdiract(theform) { if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'publish') { - document.publishdir.filename.value = theform.filename.value - pubdir(document.publishdir) - } - if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'publishsub') { - document.publishdir.filename.value = theform.filename.value - pubrecdir(document.publishdir) + document.publishdir.filename.value = theform.filename.value; + document.publishdir.submit(); } if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'editcat') { top.location=theform.filename.value+'default.meta' @@ -239,26 +235,6 @@ parent.lastknownpriv='/~$uname$thisdisfn } } - function pubdir(theform) { - if (confirm('Publish complete directory?')) { - forcepub(theform) - theform.submit(); - } - } - function pubrecdir(theform) { - if (confirm('Publish directory and all subdirectories?')) { - forcepub(theform); - theform.pubrec.value='1'; - theform.submit(); - } - } - - function forcepub(theform) { - if (confirm('Force publication of unmodified files? - Cancel=No; OK=yes.')) { - theform.forcerepub.value="ON"; - } - } - function checkUpload(theform) { if (theform.file == '') { alert("Please use 'Browse..' to choose a file first, before uploading") @@ -273,10 +249,7 @@ parent.lastknownpriv='/~$uname$thisdisfn return } if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") { - pubdir(theform) - } - if (theform.diraction.options[theform.diraction.selectedIndex].value == "publishsub") { - pubrecdir(theform) + theform.submit(); } if (theform.diraction.options[theform.diraction.selectedIndex].value == "editcat") { top.location=theform.filename.value+'default.meta' @@ -306,7 +279,7 @@ parent.lastknownpriv='/~$uname$thisdisfn if (activity == 'obsolete') { var pubform = document.pubresource pubform.filename.value = theform.filename.value - alert("You will be taken to the publication page.\\nCheck the 'Obsolete' checkbox at the bottom of the page, and click 'Finalize Publication'.") + pubform.makeobsolete.value=1; pubform.submit() } if (activity == 'print') { @@ -317,6 +290,10 @@ parent.lastknownpriv='/~$uname$thisdisfn document.retrieveres.filename.value = theform.filename.value document.retrieveres.submit() } + if (activity == 'cleanup') { + document.cleanup.filename.value = theform.filename.value + document.cleanup.submit() + } return } function changename(theform,activity) { @@ -342,29 +319,59 @@ ENDPUBDIRSCRIPT sub dircontrols { my ($r,$uname,$udom,$thisdisfn) = @_; + my %lt=&Apache::lonlocal::texthash( + cnpd => 'Cannot publish directory', + cnrd => 'Cannot retrieve directory', + mcdi => 'Must create new subdirectory inside a directory', + pubr => 'Publish this Resource', + pubd => 'Publish this Directory', + rtrv => 'Retrieve Old Version', + pubs => 'Publish with Subdirectories', + list => 'List Directory', + uplo => 'Upload file', + dele => 'Delete', + edit => 'Edit Catalog Information', + sela => 'Select Action', + nfil => 'New file', + nhtm => 'New HTML file', + nprb => 'New problem', + npag => 'New assembled page', + nseq => 'New assembled sequence', + ncrf => 'New custom rights file', + nsty => 'New style file', + nlib => 'New library file', + nsub => 'New subdirectory', + renm => 'Rename current file to', + move => 'Move current file to', + copy => 'Copy current file to', + type => 'Type Name Here', + go => 'Go', + prnt => 'Print contents of directory', + crea => 'Create a new directory or LON-CAPA document', + acti => 'Actions for current directory', + updc => 'Upload a new document' + ); $r->print(< - Actions for current directory - Upload a new document - Create a new directory or LON-CAPA document + $lt{'acti'} + $lt{'updc'} + $lt{'crea'}
- + + + +
-
@@ -374,23 +381,24 @@ sub dircontrols { - +
- + + + + + + + + + +   
@@ -405,13 +413,8 @@ sub pubbuttons { $r->print('
'. '
'. - ''. - ''. - ''. - ''. -''. +'
'); } @@ -429,9 +432,8 @@ sub resourceactions {
- - +
@@ -439,6 +441,9 @@ sub resourceactions {
+
+ +
END } @@ -508,27 +513,24 @@ sub putdirectory { $actionitem = '
'. - ''. ''. ''. ''. - ''. ''. ''. ''. - ''. + ''. ''. - ''. - ''. ''. '
'; $$numdir ++; } $r->print(''. ''. + $Apache::lonnet::perlvar{'lonIconsURL'}.'/folder_closed.gif" alt="folder" />'. ''.$actionitem.''. - ''. + ''. $disfilename.''. ''.($kaputt?&Apache::lonhtmlcommon::authorbombs($resdir.'/'.$disfilename.'/'):'').$Apache::lonpublisher::metadatafields{'title'}.' '. $Apache::lonpublisher::metadatafields{'subject'}.' '. @@ -545,6 +547,7 @@ sub putresource { my ($r, $udom, $uname, $filename, $thisdisfn, $resdir, $targetdir, $linkdir, $cmtime,$bombs,$numres) = @_; + &Apache::lonnet::devalidate_cache_new('meta',$targetdir.'/'.$filename); my $pubstatus = 'unpublished'; my $status=&mt('Unpublished'); my $bgcolor='#FFAA99'; @@ -593,7 +596,7 @@ sub putresource { } } $title.="\n".'
'. - ($$bombs{$targetdir.'/'.$filename}?'':'Edit Metadata').''; + ($$bombs{$targetdir.'/'.$filename}?'bomb':'Edit Metadata').''; $status.="\n".'
'.&mt('Retrieve').''; } @@ -606,6 +609,10 @@ sub putresource { $editlink=' ('.&mt('EditXML').')'; $editlink2='
('.&mt('Edit').')'; } + if ($filename=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm|sty)$/) { + $editlink.=' ('.&mt('Clean Up').')'; + } if ($filename=~/\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/) { $editlink=' ('.&mt('Decompress').')'; @@ -614,7 +621,7 @@ sub putresource { &create_pubselect($r,\$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres); $r->print(''. ''.($filename=~/[\#\~]$/?' ': - ''). + '').''. ''.$pub_select.''. ''. ''. @@ -631,7 +638,7 @@ sub create_pubselect { my ($r,$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres) = @_; $$pub_select = '
- '. ''; if ($pubstatus eq 'obsolete' || $pubstatus eq 'unpublished') { @@ -651,10 +658,11 @@ sub create_pubselect { } $$pub_select .= ' '. +''. ''. '
'; + &HTML::Entities::encode($uname.$thisdisfn.'/'.$filename,'<>&"').'" />'; $$numres ++; }