--- loncom/publisher/lonpubdir.pm 2005/05/20 18:28:22 1.81 +++ loncom/publisher/lonpubdir.pm 2006/04/18 22:38:08 1.90 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Directory Lister # -# $Id: lonpubdir.pm,v 1.81 2005/05/20 18:28:22 www Exp $ +# $Id: lonpubdir.pm,v 1.90 2006/04/18 22:38:08 albertel 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. @@ -137,7 +137,7 @@ sub handler { } closedir(DIR); - $r->print(''); + $r->print(''.&Apache::loncommon::end_page()); return OK; } # @@ -191,13 +191,10 @@ sub startpage { my $currdir = '/priv/'.$uname.$thisdisfn; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'LON-CAPA Construction Space'); - my $pagetitle; my $formaction='/priv/'.$uname.$thisdisfn.'/'; - $formaction=~s/\/+/\//g; - $pagetitle .= &Apache::loncommon::help_open_menu('','','','',3,'Authoring'). + $formaction=~s|/+|/|g; + my $pagetitle .= &Apache::loncommon::help_open_menu('','','','',3,'Authoring'). 'Construction Space: '. '
'. @@ -208,10 +205,14 @@ sub startpage { &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction); if ($env{'environment.remote'} eq 'off') { $env{'request.noversionuri'}=$currdir.'/'; - $r->print(&Apache::loncommon::bodytag('Construction Space',undef,undef,undef,undef,undef,$pagetitle)); + $r->print(&Apache::loncommon::start_page('Construction Space',undef, + {'body_title' => + $pagetitle,})); } else { + $r->print(&Apache::loncommon::start_page('Construction Space',undef)); $r->print($pagetitle); } + my $pubdirscript=(< top.document.title = '$thisdisfn/ - LON-CAPA Construction Space'; @@ -233,6 +234,11 @@ parent.lastknownpriv='/~$uname$thisdisfn document.printdir.postdata.value=theform.filename.value document.printdir.submit(); } + if (theform.dirtask.options[theform.dirtask.selectedIndex].value == "delete") { + var delform = document.delresource + delform.filename.value = theform.filename.value + delform.submit() + } } function checkUpload(theform) { @@ -259,6 +265,11 @@ parent.lastknownpriv='/~$uname$thisdisfn theform.postdata.value = theform.filename.value theform.submit() } + if (theform.diraction.options[theform.diraction.selectedIndex].value == "delete") { + var delform = document.delresource + delform.filename.value = theform.filename.value + delform.submit() + } return } function SetResChoice(theform) { @@ -290,6 +301,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) { @@ -315,21 +330,54 @@ 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', + dedr => 'Delete Directory', + rtrv => 'Retrieve Old Version', + 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'} - + + + + + @@ -345,23 +393,24 @@ sub dircontrols {
- +
- + + + + + + + + + +   
@@ -377,7 +426,7 @@ sub pubbuttons { '
'. ''. -'
'); } @@ -404,6 +453,9 @@ sub resourceactions {
+
+ +
END } @@ -473,15 +525,15 @@ sub putdirectory { $actionitem = '
'. - ''. ''. ''. ''. - ''. ''. ''. + ''. ''. - ''. + ''. ''. ''. '
'; @@ -489,9 +541,9 @@ sub putdirectory { } $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'}.' '. @@ -557,7 +609,7 @@ sub putresource { } } $title.="\n".'
'. - ($$bombs{$targetdir.'/'.$filename}?'':'Edit Metadata').''; + ($$bombs{$targetdir.'/'.$filename}?'bomb':'Edit Metadata').''; $status.="\n".'
'.&mt('Retrieve').''; } @@ -570,6 +622,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').')'; @@ -578,7 +634,7 @@ sub putresource { &create_pubselect($r,\$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres); $r->print(''. ''.($filename=~/[\#\~]$/?' ': - ''). + '').''. ''.$pub_select.''. ''. ''. @@ -595,7 +651,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') { @@ -615,10 +671,11 @@ sub create_pubselect { } $$pub_select .= ' '. +''. ''. '
'; + &HTML::Entities::encode($uname.$thisdisfn.'/'.$filename,'<>&"').'" />'; $$numres ++; }