--- loncom/publisher/lonpubdir.pm 2024/08/22 18:32:56 1.160.2.5.2.5 +++ loncom/publisher/lonpubdir.pm 2024/07/03 21:05:49 1.160.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Authoring Space Directory Lister # -# $Id: lonpubdir.pm,v 1.160.2.5.2.5 2024/08/22 18:32:56 raeburn Exp $ +# $Id: lonpubdir.pm,v 1.160.2.6 2024/07/03 21:05:49 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -290,7 +290,6 @@ sub handler { } # Print the sorted resources - my %editors = &Apache::loncommon::permitted_editors(); foreach my $filename (@sorted_files) { if ($filehash->{$filename}->{"cmode"}&$dirptr) { # Directories &putdirectory($r, $thisdisfn, $linkdir, $filename, @@ -303,8 +302,7 @@ sub handler { $filehash->{$filename}->{"linkfilename"}, $filehash->{$filename}->{"fulltitle"}, $filehash->{$filename}->{"status"}, - $filehash->{$filename}->{"pubstatus"}, - \%editors); + $filehash->{$filename}->{"pubstatus"}); } } @@ -354,14 +352,12 @@ sub startpage { my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); #expressed in MB $disk_quota = 1024 * $disk_quota; # convert from MB to kB - my $headertext = &mt('Directory'); - $r->print(&Apache::loncommon::head_subbox( '
' .&Apache::lonhtmlcommon::display_usage($current_disk_usage, $disk_quota,'authoring') .'
' - .&Apache::loncommon::CSTR_pageheader('','',$headertext))); + .&Apache::loncommon::CSTR_pageheader())); my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn); my $doctitle = 'LON-CAPA '.&mt('Authoring Space'); @@ -375,6 +371,25 @@ parent.lastknownpriv='/priv$esc_thisdisf // Confirmation dialogues + function currdiract(theform) { + if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'publish') { + document.publishdir.filename.value = theform.filename.value; + document.publishdir.submit(); + } + if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'editmeta') { + top.location=theform.filename.value+'default.meta' + } + if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'printdir' ) { + 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) { if (theform.file == '') { alert("Please use 'Browse..' to choose a file first, before uploading") @@ -458,16 +473,19 @@ ENDPUBDIRSCRIPT } sub dircontrols { - my ($r,$uname,$udom,$thisdisfn,$current_disk_usage,$disk_quota) = @_; + my ($r,$uname,$udom,$thisdisfn, $current_disk_usage, $disk_quota) = @_; 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 Metadata', sela => 'Select Action', nfil => 'New file', nhtm => 'New HTML file', @@ -484,7 +502,9 @@ sub dircontrols { copy => 'Copy current file to', type => 'Type Name Here', go => 'Go', - crea => 'Create a new subdirectory or document', + prnt => 'Print contents of directory', + crea => 'Create a new directory or LON-CAPA document', + acti => 'Actions for current directory', updc => 'Upload a new document', pick => 'Please select an action to perform using the new filename', shcu => 'Shortcuts', @@ -499,25 +519,31 @@ sub dircontrols { # Calculate free space in bytes. # $disk_quota is in MB and $current_disk_usage is in kB my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage); - $r->print("\n".'
'."\n"); - my %fileoptions = ( - none => "$lt{'sela'}:", - newfile => "$lt{'nfil'}:", - newhtmlfile => "$lt{'nhtm'}:", - newproblemfile => "$lt{'nprb'}:", - newdir => "$lt{'nsub'}:", - newpagefile => "$lt{'npag'}:", - newsequencefile => "$lt{'nseq'}:", - newrightsfile => "$lt{'ncrf'}:", - newstyfile => "$lt{'nsty'}:", - newtaskfile => "$lt{'nbt'}:", - newlibraryfile => "$lt{'nlib'}:", - ); - $fileoptions{'select_form_order'} = ['none','newfile','newhtmlfile','newproblemfile', - 'newpagefile','newsequencefile','newrightsfile', - 'newstyfile','newtaskfile','newlibraryfile','newdir']; - my $selectbox = &Apache::loncommon::select_form('none','action',\%fileoptions); $r->print(< +
+
+
+ $lt{'acti'} + + +
+
+
+ + +
+
+ +
+
+
@@ -534,8 +560,8 @@ sub dircontrols {
$lt{'crea'} - - + + - $selectbox   +   
$lt{'shcu'}: - file icon + - problem icon + - web page icon + - folder icon + -
+
-
+
END } @@ -701,8 +739,7 @@ sub putdirectory { $disfilename = ''.&mt('Parent Directory').''; } else { $actionitem = - '
'. + ''. '