[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /publisher lonpubdir.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 10 19:55:41 EDT 2023


raeburn		Sat Jun 10 23:55:41 2023 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  - Move "Quick search" box to be left-most of three boxes above directory
    listing
  - Move "Actions for current directory" into row above, between select box
    for recently accessed diretories, and disk spce utilization display. 
  
  
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1405 loncom/interface/loncommon.pm:1.1406
--- loncom/interface/loncommon.pm:1.1405	Mon May 22 21:10:55 2023
+++ loncom/interface/loncommon.pm	Sat Jun 10 23:55:36 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1405 2023/05/22 21:10:55 raeburn Exp $
+# $Id: loncommon.pm,v 1.1406 2023/06/10 23:55:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6376,7 +6376,7 @@
 =cut
 
 sub CSTR_pageheader {
-    my ($trailfile,$frameset) = @_;
+    my ($trailfile,$frameset,$title,$diraction) = @_;
     if ($trailfile eq '') {
         $trailfile = $env{'request.filename'};
     }
@@ -6399,13 +6399,15 @@
         $lastitem = $thisdisfn;
     }
 
-    my ($crsauthor,$title);
+    my $crsauthor;
     if (($env{'request.course.id'}) &&
         ($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&
         ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {
         $crsauthor = 1;
-        $title = &mt('Course Authoring Space');
-    } else {
+        if ($title eq '') {
+            $title = &mt('Course Authoring Space');
+        }
+    } elsif ($title eq '') {
         $title = &mt('Authoring Space');
     }
 
@@ -6422,7 +6424,7 @@
     }
 
     my $output =
-         '<div>'
+         '<div style="display:inline-block">'
         .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
         .'<b>'.$title.'</b> '
         .'<form name="dirs" method="post" action="'.$formaction.'"'.$target.'>'
@@ -6445,7 +6447,7 @@
             .'</form>'
             .&Apache::lonmenu::constspaceform($frameset);
     }
-    $output .= '</div>';
+    $output .= '</div>'.$diraction;
 
     return $output;
 }
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.175 loncom/publisher/lonpubdir.pm:1.176
--- loncom/publisher/lonpubdir.pm:1.175	Sat Jun 10 23:01:15 2023
+++ loncom/publisher/lonpubdir.pm	Sat Jun 10 23:55:41 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Authoring Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.175 2023/06/10 23:01:15 raeburn Exp $
+# $Id: lonpubdir.pm,v 1.176 2023/06/10 23:55:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,9 +104,14 @@
                                 "$londocroot/priv/$udom/$uname"); # expressed in kB
     my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,
                                                  $cstr,$crstype); # expressed in MB
+    my $diraction;
+    if (-d $fn) {
+        $diraction = &diractions($thisdisfn);
+    }
 
     # Put out the start of page.
-    &startpage($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota, $crsauthor);
+    
+    &startpage($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota, $crsauthor, $diraction);
 
     if (!-d $fn) {
         if (-e $fn) {
@@ -361,7 +366,7 @@
 #      $crstype - Course type, if this is for "course author"
 
 sub startpage {
-    my ($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota, $crsauthor) = @_;
+    my ($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota, $crsauthor, $diraction) = @_;
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
 
@@ -391,12 +396,13 @@
 
     $disk_quota = 1024 * $disk_quota; # convert from MB to kB
 
+    my $heading = &mt('Directory');
     $r->print(&Apache::loncommon::head_subbox(
                      '<div style="float:right;padding-top:0;margin-top;0">'
                     .&Apache::lonhtmlcommon::display_usage($current_disk_usage,
                                                            $disk_quota,'authoring')
                     .'</div>'
-                    .&Apache::loncommon::CSTR_pageheader()));
+                    .&Apache::loncommon::CSTR_pageheader('','',$heading,$diraction)));
 
     my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn);
     my $doctitle = 'LON-CAPA '.&mt($title);
@@ -511,6 +517,41 @@
     $r->print($pubdirscript);
 }
 
+sub diractions {
+    my ($thisdisfn) = @_;
+    my %lt=&Apache::lonlocal::texthash(
+                                       acti => 'Actions for current directory',
+                                       sela => 'Select Action',
+                                       pubd => 'Publish this Directory',
+                                       prnt => 'Print contents of directory',
+                                       edit => 'Edit Metadata',
+                                       dedr => 'Delete Directory',
+    );
+    return <<END;
+<div style="display:inline-block;padding-left:20px">
+<b>$lt{'acti'}</b><br />
+<form name="curractions" method="post" action="">
+    <select name="dirtask" onchange="currdiract(this.form)">
+        <option>$lt{'sela'}</option>
+        <option value="publish">$lt{'pubd'}</option>
+        <option value="editmeta">$lt{'edit'}</option>
+        <option value="printdir">$lt{'prnt'}</option>
+        <option value="delete">$lt{'dedr'}</option>
+    </select>
+    <input type="hidden" name="filename" value="/priv$thisdisfn/" />
+</form>
+<form name="publishdir" method="post" action="/adm/publish">
+  <input type="hidden" name="pubrec" value="" />
+  <input type="hidden" name="filename" value="" />
+</form>
+<form name="printdir" method="post" action="/adm/printout">
+  <input type="hidden" name="postdata" value="" />
+</form>
+</div>
+END
+
+}
+
 sub dircontrols {
     my ($r,$uname,$udom,$thisdisfn, $current_disk_usage, $disk_quota) = @_;
     my %lt=&Apache::lonlocal::texthash(
@@ -518,13 +559,10 @@
                                        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',
@@ -541,12 +579,10 @@
                                        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',
-                                       qs   => 'Quick Search',
+                                       crea => 'Create a new subdirectory or document',
+                                       qs   => 'Quick name search',
                                        cs   => 'Case Sensitive',
                                        re   => 'Regular Expression',
-				       acti => 'Actions for current directory',
 				       updc => 'Upload a new document',
 				       pick => 'Please select an action to perform using the new filename',
                                        shcu => 'Shortcuts',
@@ -563,29 +599,20 @@
     my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
     $r->printf(<<END,&Apache::loncommon::help_open_topic('Quicksearch'));
 <div class="LC_columnSection">
-  <div>
-    <form name="curractions" method="post" action="">
-      <fieldset>
-        <legend>$lt{'acti'}</legend>
-        <select name="dirtask" onchange="currdiract(this.form)">
-            <option>$lt{'sela'}</option>
-            <option value="publish">$lt{'pubd'}</option>
-            <option value="editmeta">$lt{'edit'}</option>
-            <option value="printdir">$lt{'prnt'}</option>
-            <option value="delete">$lt{'dedr'}</option>
-        </select>
-        <input type="hidden" name="filename" value="/priv$thisdisfn/" />
-      </fieldset>
-    </form>
-    <form name="publishdir" method="post" action="/adm/publish">
-      <input type="hidden" name="pubrec" value="" />
-      <input type="hidden" name="filename" value="" />
-    </form>
-    <form name="printdir" method="post" action="/adm/printout">
-      <input type="hidden" name="postdata" value="" />
-    </form>
+    <div>
+      <fieldset style="display:inline">
+            <legend>$lt{'qs'}</legend>
+                <script type="text/javascript" src="/adm/quicksearch/quicksearch.js"></script>
+                <input type="text" id="quickfilter" placeholder="Enter search term" onkeyup="applyFilter()"/>
+                <input type="button" value="Clear" onclick="document.getElementById(\'quickfilter\').value=\'\'; applyFilter()" />
+                %s
+                <br />
+                <label><input type="checkbox" id="casesens" onchange="applyFilter()"/>$lt{'cs'}  </label>
+                <label><input type="checkbox" id="regex" onchange="applyFilter()"/>$lt{'re'}  </label>
+        </fieldset>
   </div>
-
+END
+    $r->print(<<END);
   <div style="padding-bottom: 2px">
     <form name="upublisher" enctype="multipart/form-data" method="post" action="/adm/upload">
       <fieldset>
@@ -678,18 +705,6 @@
       </fieldset>
     </form>
     </div>
-    <div>
-      <fieldset style="display:inline">
-            <legend>$lt{'qs'}</legend>
-                <script type="text/javascript" src="/adm/quicksearch/quicksearch.js"></script>
-                <input type="text" id="quickfilter" placeholder="Enter search term" onkeyup="applyFilter()"/>
-                <input type="button" value="Clear" onclick="document.getElementById(\'quickfilter\').value=\'\'; applyFilter()" />
-                %s
-                <br />
-                <label><input type="checkbox" id="casesens" onchange="applyFilter()"/>$lt{'cs'}  </label>
-                <label><input type="checkbox" id="regex" onchange="applyFilter()"/>$lt{'re'}  </label>
-        </fieldset>
-  </div>
 </div>
 END
 }


More information about the LON-CAPA-cvs mailing list