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

raeburn raeburn@source.lon-capa.org
Fri, 31 Jul 2009 02:13:06 -0000


raeburn		Fri Jul 31 02:13:06 2009 EDT

  Modified files:              
    /loncom/interface	loncommon.pm coursecatalog.pm 
  Log:
  loncommon.pm
  - Rename fifth arg to &select_dom_form() from $autosubmit to $onchange;
  - More flexibility - $onchange arg now includes the javascript call executed following an 
    onchange event.
  
  coursecatalog.pm 
  - Replace $nochange arg in loncommon::select_dom_form() with function to execute.  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.871 loncom/interface/loncommon.pm:1.872
--- loncom/interface/loncommon.pm:1.871	Mon Jul 27 22:35:12 2009
+++ loncom/interface/loncommon.pm	Fri Jul 31 02:13:05 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.871 2009/07/27 22:35:12 raeburn Exp $
+# $Id: loncommon.pm,v 1.872 2009/07/31 02:13:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -529,6 +529,11 @@
                 }
             }     
         }
+        if (formname == 'ccrs') {
+            var ownername = document.forms[formid].ccuname.value;
+            var ownerdom =  document.forms[formid].ccdomain.options[document.forms[formid].ccdomain.selectedIndex].value;
+            url += '&cloner='+ownername+':'+ownerdom;
+        }
         if (multflag !=null && multflag != '') {
             url += '&multiple='+multflag;
         }
@@ -1802,16 +1807,15 @@
 
 If the $showdomdesc flag is set, the domain name is followed by the domain description.
 
-If the $autosubmit flag is set, the form containing the domain selector will be auto-submitted by an onchange action.  
+The optional $onchange argumnet specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted.  
 
 =cut
 
 #-------------------------------------------
 sub select_dom_form {
-    my ($defdom,$name,$includeempty,$showdomdesc,$autosubmit) = @_;
-    my $onchange;
-    if ($autosubmit) {
-        $onchange = ' onchange="this.form.submit()"';
+    my ($defdom,$name,$includeempty,$showdomdesc,$onchange) = @_;
+    if ($onchange) {
+        ' onchange="'.$onchange.'";
     }
     my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
     if ($includeempty) { @domains=('',@domains); }
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.52 loncom/interface/coursecatalog.pm:1.53
--- loncom/interface/coursecatalog.pm:1.52	Wed May 27 16:54:57 2009
+++ loncom/interface/coursecatalog.pm	Fri Jul 31 02:13:05 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.52 2009/05/27 16:54:57 www Exp $
+# $Id: coursecatalog.pm,v 1.53 2009/07/31 02:13:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -307,7 +307,7 @@
     }
     my $onchange;
     unless ($env{'form.interface'} eq 'textual') {
-        $onchange = 1;
+        $onchange = 'this.form.submit()';
     }
     $r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
               '<table border="0"><tr><td><b>'.&mt('Domain:').'</b></td><td>'.