[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages del.gif list.gif pub.gif rtrv.gif /interface lonmenu.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 01 Nov 2004 04:31:03 -0000


raeburn		Sun Oct 31 23:31:03 2004 EDT

  Added files:                 
    /loncom/html/res/adm/pages	list.gif pub.gif del.gif rtrv.gif 

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  Inline menu buttons for construction space.  Fixes to lonmenu.pm so functions work correctly. New buttons (gif images).
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.120 loncom/interface/lonmenu.pm:1.121
--- loncom/interface/lonmenu.pm:1.120	Fri Oct 29 14:40:40 2004
+++ loncom/interface/lonmenu.pm	Sun Oct 31 23:31:03 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.120 2004/10/29 18:40:40 raeburn Exp $
+# $Id: lonmenu.pm,v 1.121 2004/11/01 04:31:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -255,13 +255,34 @@
     if ($textual && $const_space) {
         my $formaction='/priv/'.$uname.'/'.$thisdisfn;
         $formaction=~s/\/+/\//g;
-        $newmail .= ('<form name="dirs" method="post" action="'.$formaction
+        my $titleinfo = '<form name="dirs" method="post" action="'.$formaction
               .'" target="_top">'.
         &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn,'_top','/priv','','-1').
         &Apache::lonhtmlcommon::select_recent('construct','recent',
                  'this.form.action=this.form.recent.value;this.form.submit()').
-              '</form>');
+              '</form>';
         &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction);
+        $newmail .= &constspaceform();
+# role and realm
+        my ($role,$realm) = &Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]);
+        unless ($realm) { $realm='&nbsp;'; }
+        $newmail .= <<END;
+<table width="100%" cellspacing="0" border="0" cellpadding="0">
+<tr>
+<td>
+$titleinfo
+</td>
+<td align="right">
+<font size="2" face="Arial, Helvetica, sans-serif">
+    $ENV{'environment.firstname'}
+    $ENV{'environment.middlename'}
+    $ENV{'environment.lastname'}
+    $ENV{'environment.generation'}
+    </font>&nbsp;<br />
+    <font size="2" face="Arial, Helvetica, sans-serif">$role</font>&nbsp;
+</td></tr>
+</table>
+END
     }
     if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) {
 	my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'});
@@ -380,13 +401,14 @@
 # Prepare the rest of the buttons
         my $menuitems;
         if ($const_space) {
-            my $dir_catalog = '/priv/'.$uname.'/'.$thisdisfn.'/default.meta';
+            my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
+            $currdir =~ s#[^/]+$##;
             $menuitems=(<<ENDMENUITEMS);
-s&2&1&mcrs.gif&list[_1]&dir[_1]&gopost('/adm/pubdir',currentURL)&List current directory
-s&2&3&mcrs.gif&retrieve[_1]&version[_1]&gopost('/adm/retrieve',currentURL)&Retreive old version
-s&6&1&mcrs.gif&publish[_1]&resource[_1]&gopost('/adm/publish',currentURL)&Publish this resource
-s&6&3&mcrs.gif&delete[_1]&resource[_2]&gopost('/adm/cfile?action=delete',currentURL)&Delete this resource
-s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
+s&6&1&list.gif&list[_1]&dir[_1]&go('$currdir')&List current directory
+s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retreive old version
+s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource
+s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource
+s&7&2&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document
 ENDMENUITEMS
         } else {
 	    $menuitems=(<<ENDMENUITEMS);
@@ -974,6 +996,20 @@
    }
 }
 
+function gocstr(url,filename) {
+    if (url == '/adm/cfile?action=delete') {
+        this.document.cstrdelete.filename.value = filename
+        this.document.cstrdelete.submit();
+        return;
+    }
+    if (url !='') {
+        this.document.constspace.filename.value = filename;
+        this.document.constspace.action = url;
+        this.document.constspace.submit();
+    }
+}
+
+
 function catalog_info() {
    loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
 }
@@ -996,6 +1032,19 @@
 ENDSERVERFORM
 }
 
+sub constspaceform {
+    return(<<ENDCONSTSPACEFORM);
+<form name="constspace" action="/adm/logout" method="post" target="_top">
+<input type="hidden" name="filename" value="" />
+</form>
+<form name="cstrdelete" action="/adm/cfile" method="post" target="_top">
+<input type="hidden" name="action" value="delete" /> 
+<input type="hidden" name="filename" value="" />
+</form>
+ENDCONSTSPACEFORM
+}
+
+
 sub get_nav_status {
     my $navstatus="swmenu.w_loncapanav_flag=";
     if ($ENV{'environment.remotenavmap'} eq 'on') {