[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages menu.html /interface mydesk.tab /xml lonxml.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 04 Apr 2002 17:35:57 -0000


matthew		Thu Apr  4 12:35:57 2002 EDT

  Modified files:              
    /loncom/html/res/adm/pages	menu.html 
    /loncom/interface	mydesk.tab 
    /loncom/xml	lonxml.pm 
  Log:
  changes for bug #227.  Tested for authors but not for co-authors.
            http://bugs.loncapa.org/show_bug.cgi?id=227
  Added javascript function cstrgo.  This requires setting currentURL=null
  by default in lonxml.pm.
  
  
Index: loncom/html/res/adm/pages/menu.html
diff -u loncom/html/res/adm/pages/menu.html:1.46 loncom/html/res/adm/pages/menu.html:1.47
--- loncom/html/res/adm/pages/menu.html:1.46	Tue Mar 19 16:06:24 2002
+++ loncom/html/res/adm/pages/menu.html	Thu Apr  4 12:35:57 2002
@@ -4,7 +4,7 @@
 Remote Control
 
 //
-// $Id: menu.html,v 1.46 2002/03/19 21:06:24 www Exp $
+// $Id: menu.html,v 1.47 2002/04/04 17:35:57 matthew Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -141,6 +141,8 @@
 function display(utext,ltext) {
   var i; var ch;
   this.window.focus();
+  if (utext == null) { utext = '';}
+  if (ltext == null) { ltext = '';}
   if (typeof(utext)=="undefined") { utext=''; }
   if (typeof(ltext)=="undefined") { ltext=''; }
   if ((utext=='') && (ltext=='')) {
@@ -196,10 +198,33 @@
    endsend();
 }
 
+function cstrgo(currenturl,defaulturl) {
+   windowcheck();
+   var url;
+   if (currenturl != null && currenturl != '') {
+      url = currenturl;
+      var priv_pattern  = /^\/priv/;
+      var tilda_pattern = /^\/~/;
+      if (priv_pattern.test(url) || tilda_pattern.test(url)) {
+         url = defaulturl;
+      } else {
+         // map /res/103/turtle -> /priv/turtle
+         url = url.replace(/^\/res\/[A-z0-9]+\//,'/priv/');
+      }
+   } else {
+      url = defaulturl;
+   }
+   this.document['led'].src="ledsend.gif";
+   if (url != '') {
+       clientwindow.window.location.href="http://"+clienthost+url;
+   }
+}
+
 function go(url) {
    windowcheck();
    this.document['led'].src="ledsend.gif";
    if (url!='') {
+       currentURL = null;
        clientwindow.window.location.href="http://"+clienthost+url;
    }
 }
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.16 loncom/interface/mydesk.tab:1.17
--- loncom/interface/mydesk.tab:1.16	Tue Mar 19 14:00:04 2002
+++ loncom/interface/mydesk.tab	Thu Apr  4 12:35:57 2002
@@ -27,8 +27,8 @@
 5:3:pccc:$udom:ccrs.gif:create:course:go('/adm/createcourse');
 5:3:popa:$crs:parm.gif:course:parms:go('/adm/parmset');
 6:1:clear
-6:1:author:any:cstr.gif:con-:struct:go('/priv/$uname/');
-6:1:author:rca:cstr.gif:co con-:struct:go('/priv/$uname/');
+6:1:author:any:cstr.gif:con-:struct:cstrgo(currentURL,'/priv/$uname/');
+6:1:author:rca:cstr.gif:co con-:struct:cstrgo(currentURL,'/priv/$uname/');
 6:2:clear
 6:2:author:any:res.gif:resource:space:go('/res/$udom/$uname/?launch=1');
 6:2:author:rca:res.gif:co res:space:go('/res/$udom/$uname/?launch=1');
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.164 loncom/xml/lonxml.pm:1.165
--- loncom/xml/lonxml.pm:1.164	Wed Apr  3 13:47:39 2002
+++ loncom/xml/lonxml.pm	Thu Apr  4 12:35:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.164 2002/04/03 18:47:39 www Exp $
+# $Id: lonxml.pm,v 1.165 2002/04/04 17:35:57 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -446,8 +446,13 @@
 	# Inputs are the name of the html form being used
 	# and the name of the element the selected URL should
 	# be placed in.
+        # openbrowser also takes arguments only and omit, which are
+        # comma deliminated lists of file extensions to (only) show 
+        # or omit.
+        # Here we also set currentURL=null.
         $result .=<<"ENDBROWSERSCRIPT";
 <script>
+    menu.currentURL=null;
     var editbrowser;
     function openbrowser(formname,elementname,only,omit) {
         var url = '/res/?';