[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 01 Jul 2002 15:29:23 -0000


matthew		Mon Jul  1 11:29:23 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Fixes BUG 571 - 'browse' and 'search' buttons failed to work because the
  javascript was not being output.  The javascript is now output via a call to
  &Apache::loncommon::browser_and_searcher_javascript().  This bug was
  introduced by the fix to BUG 232, which has *not* been reintroduced.
  The function name "registerurl" should be changed to reflect its larger
  role but this fix should go in the next stable release as is.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.178 loncom/xml/lonxml.pm:1.179
--- loncom/xml/lonxml.pm:1.178	Sat Jun 15 14:59:26 2002
+++ loncom/xml/lonxml.pm	Mon Jul  1 11:29:23 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.178 2002/06/15 18:59:26 www Exp $
+# $Id: lonxml.pm,v 1.179 2002/07/01 15:29:23 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -331,10 +331,15 @@
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
+    if ($target eq 'edit') {
+        $result .="<script>\n    menu.currentURL=null;\n".
+            &Apache::loncommon::browser_and_searcher_javascript().
+                "\n</script>\n";
+    }
     if ((($ENV{'request.publicaccess'}) || 
          (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
         (!$forcereg)) {
-	return 
+	return $result.
          '<script>function LONCAPAreg(){} function LONCAPAstale(){}</script>';
     }
     if ($Apache::lonxml::registered && !$forcereg) { return ''; }
@@ -445,61 +450,6 @@
 // END LON-CAPA Internal
 </script>
 ENDDONOTREGTHIS
-    }
-    if ($target eq 'edit') {
-	# Javascript routines for construction space:
-	# openbrowser and opensearcher will start the file browser
-	# (lonindexer) and searcher (lonsearchcat) respectively.
-	# 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/?';
-        if (editbrowser == null) {
-            url += 'launch=1&';
-        }
-        url += 'catalogmode=interactive&';
-        url += 'mode=edit&';
-        url += 'form=' + formname + '&';
-        if (only != null) {
-            url += 'only=' + only + '&';
-        } 
-        if (omit != null) {
-            url += 'omit=' + omit + '&';
-        }
-        url += 'element=' + elementname + '';
-        var title = 'Browser';
-        var options = 'scrollbars=1,resizable=1,menubar=0';
-        options += ',width=700,height=600';
-        editbrowser = open(url,title,options,'1');
-        editbrowser.focus();
-    }
-    var editsearcher;
-    function opensearcher(formname,elementname) {
-        var url = '/adm/searchcat?';
-        if (editsearcher == null) {
-            url += 'launch=1&';
-        }
-        url += 'catalogmode=interactive&';
-        url += 'mode=edit&';
-        url += 'form=' + formname + '&';
-        url += 'element=' + elementname + '';
-        var title = 'Search';
-        var options = 'scrollbars=1,resizable=1,menubar=0';
-        options += ',width=700,height=600';
-        editsearcher = open(url,title,options,'1');
-        editsearcher.focus();
-    }
-</script>
-ENDBROWSERSCRIPT
     }
     return $result;
 }