[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface loncommon.pm

raeburn raeburn@source.lon-capa.org
Fri, 14 Aug 2009 07:49:02 -0000


raeburn		Fri Aug 14 07:49:02 2009 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	loncommon.pm 
  Log:
  - Backport 1.872, 1.873, 1.874.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.692.4.6 loncom/interface/loncommon.pm:1.692.4.7
--- loncom/interface/loncommon.pm:1.692.4.6	Fri Aug 14 07:40:50 2009
+++ loncom/interface/loncommon.pm	Fri Aug 14 07:49:01 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.692.4.6 2009/08/14 07:40:50 raeburn Exp $
+# $Id: loncommon.pm,v 1.692.4.7 2009/08/14 07:49:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -524,6 +524,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;
         }
@@ -1791,7 +1796,7 @@
 
 =pod
 
-=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$autosubmit)
+=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange)
 
 Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select the domain to preform an operation in.  
@@ -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 argument 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="'.$onchange.'"';
     }
     my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
     if ($includeempty) { @domains=('',@domains); }