[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm lonparmset.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 19 Mar 2002 19:55:52 -0000


matthew		Tue Mar 19 14:55:52 2002 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm lonparmset.pm 
  Log:
  Changes to allow lonparmset to call lonindexer.  lonindexer now has a 
  'parmset' mode as well as the earlier added 'edit' mode.  Hopefully these
  will be sufficient.  If another mode is needed perhaps a more generalized
  interface should be developed.
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.38 loncom/interface/lonindexer.pm:1.39
--- loncom/interface/lonindexer.pm:1.38	Thu Mar 14 16:37:04 2002
+++ loncom/interface/lonindexer.pm	Tue Mar 19 14:55:52 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.38 2002/03/14 21:37:04 matthew Exp $
+# $Id: lonindexer.pm,v 1.39 2002/03/19 19:55:52 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -171,7 +171,7 @@
 
 	my $mode = $ENV{'form.mode'};
 	my ($form,$element);
-	if ($mode eq 'edit') {
+	if ($mode eq 'edit' || $mode eq 'parmset') {
 	    $form    = $ENV{'form.form'};
 	    $element = $ENV{'form.element'};
 	}
@@ -184,7 +184,7 @@
 	    # by default (ie. if $mode is undefined).  This is the easy
 	    # way out.  Hopefully in the future I'll find a way to get 
 	    # the calls dealt with in a more comprehensive manner.
-	    if (!defined($mode) || $mode ne 'edit') {
+	    if (!defined($mode) || ($mode ne 'edit' && $mode ne 'parmset')) {
 		$catalogmodefunctions=<<"END";
 function select_data(title,url) {
     changeTitle(title);
@@ -209,7 +209,7 @@
     }
 }
 END
-            } else { # we are in 'edit' mode
+            } elsif ($mode eq 'edit') { # we are in 'edit' mode
 		$catalogmodefunctions=<<END;
 // mode = $mode
 function select_data(title,url) {
@@ -230,7 +230,31 @@
 }
 
 END
-             }
+            } elsif ($mode eq 'parmset') {
+		$catalogmodefunctions=<<END;
+// mode = $mode
+function select_data(title,url) {
+    changeURL(url);
+    self.close();
+}
+
+function select_group() {
+    window.location="/adm/groupsort?catalogmode=interactive&form=$form&element=$element&mode=parmset&acts="+document.forms.fileattr.acts.value;
+}
+
+function changeURL(val) {
+    if (window.opener.document) {
+        var elementname  = "$element"+"_value";
+        var checkboxname = "$element"+"_setparmval";
+	window.opener.document.forms["$form"].elements[elementname].value=val;
+        window.opener.document.forms["$form"].elements[checkboxname].checked=true;
+    } else {
+	    alert("The file you selected is: "+val);
+    }
+}
+
+END
+            }
         }
         $catalogmodefunctions.=<<END;
 var acts='';
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.45 loncom/interface/lonparmset.pm:1.46
--- loncom/interface/lonparmset.pm:1.45	Wed Mar 13 16:24:24 2002
+++ loncom/interface/lonparmset.pm	Tue Mar 19 14:55:52 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.45 2002/03/13 21:24:24 matthew Exp $
+# $Id: lonparmset.pm,v 1.46 2002/03/19 19:55:52 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -730,7 +730,10 @@
     my $output='';
     if (! exists($values{'con_lost'})) {
         my %descriptions=
-	    ('url'            => '<b>Top Level Map</b><br><font color=red> '.
+	    ('url'            => '<b>Top Level Map</b>'.
+                                 '<a href="javascript:openbrowser'.
+                                 "('envform','url')\">".
+                                 'Browse</a><br><font color=red> '.
                                  'Modification may make assessment data '.
                                  'inaccessible</font>',
              'description'    => '<b>Course Description</b>',
@@ -769,6 +772,24 @@
     }
     $r->print(<<ENDENV);
 <html>
+<script type="text/javascript" language="Javascript" >
+    var editbrowser;
+    function openbrowser(formname,elementname) {
+        var url = '/res/?';
+        if (editbrowser == null) {
+            url += 'launch=1&';
+        }
+        url += 'catalogmode=interactive&';
+        url += 'mode=parmset&';
+        url += 'form=' + formname + '&';
+        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();
+    }
+</script>
 <head>
 <title>LON-CAPA Course Environment</title>
 </head>