[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm loncreateuser.pm londropadd.pm lonhtmlcommon.pm lonparmset.pm lonpreferences.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 30 Apr 2003 15:49:45 -0000


This is a MIME encoded message

--matthew1051717785
Content-Type: text/plain

matthew		Wed Apr 30 11:49:45 2003 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm loncreateuser.pm londropadd.pm 
                     	lonhtmlcommon.pm lonparmset.pm lonpreferences.pm 
  Log:
  Added &Apache::lonhtmlcommon::pjump_javascript_definition() because the
  javascript function pjump was cut and pasted five times in the source
  code and I just could not sleep at night if I had made it six.
  
  
--matthew1051717785
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20030430114945.txt"

Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.7 loncom/interface/lonannounce.pm:1.8
--- loncom/interface/lonannounce.pm:1.7	Wed Sep 11 11:01:43 2002
+++ loncom/interface/lonannounce.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.7 2002/09/11 15:01:43 matthew Exp $
+# $Id: lonannounce.pm,v 1.8 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,6 +31,7 @@
 use strict;
 use Apache::Constants qw(:common);
 use Apache::loncommon;
+use Apache::lonhtmlcommon();
 
 sub readcalendar {
     my $courseid=shift;
@@ -120,6 +121,7 @@
                                      'dlsav' => $todayhash{'dlsav'} ));
     my $weekday=$firstday{'weekday'};
 # ------------------------------------------------------------ Print the screen
+    my $pjump_function = &Apache::lonhtmlcommon::pjump_javascript_definition();
     $r->print(<<ENDDOCUMENT);
 <html>
 <head>
@@ -131,14 +133,7 @@
         parmwin.close();
     }
 
-    function pjump(type,dis,value,marker,ret,call) {
-        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
-                 +"&value="+escape(value)+"&marker="+escape(marker)
-                 +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
-                 "height=350,width=350,scrollbars=no,menubar=no");
-
-    }
+    $pjump_function
 
     function dateset() {
         if (document.anno.pres_marker.value=='end') {
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.51 loncom/interface/loncreateuser.pm:1.52
--- loncom/interface/loncreateuser.pm:1.51	Sun Mar 23 04:06:08 2003
+++ loncom/interface/loncreateuser.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.51 2003/03/23 09:06:08 albertel Exp $
+# $Id: loncreateuser.pm,v 1.52 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,7 +46,7 @@
 # 05/10,10/16 Gerd Kortemeyer 
 # 02/11/02 Matthew Hall
 #
-# $Id: loncreateuser.pm,v 1.51 2003/03/23 09:06:08 albertel Exp $
+# $Id: loncreateuser.pm,v 1.52 2003/04/30 15:49:45 matthew Exp $
 ###
 
 package Apache::loncreateuser;
@@ -149,6 +149,7 @@
 
     $ccuname=~s/\W//g;
     $ccdomain=~s/\W//g;
+    my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dochead =<<"ENDDOCHEAD";
 <html>
 <head>
@@ -161,14 +162,7 @@
         parmwin.close();
     }
 
-    function pjump(type,dis,value,marker,ret,call) {
-        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
-                 +"&value="+escape(value)+"&marker="+escape(marker)
-                 +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
-                 "height=350,width=350,scrollbars=no,menubar=no");
-
-    }
+    $pjump_def
 
     function dateset() {
         eval("document.cu."+document.cu.pres_marker.value+
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.64 loncom/interface/londropadd.pm:1.65
--- loncom/interface/londropadd.pm:1.64	Thu Feb 13 16:35:50 2003
+++ loncom/interface/londropadd.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.64 2003/02/13 21:35:50 albertel Exp $
+# $Id: londropadd.pm,v 1.65 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -213,6 +213,7 @@
     my %param = ( formname => 'studentform',
                   kerb_def_dom => $krbdefdom );
     my $authheader = &Apache::loncommon::authform_header(%param);
+    my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     return (<<ENDPICK);
 function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec) {
     var foundatype=0;
@@ -286,14 +287,7 @@
         parmwin.close();
     }
 
-    function pjump(type,dis,value,marker,ret,call) {
-        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
-                 +"&value="+escape(value)+"&marker="+escape(marker)
-                 +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
-                 "height=350,width=350,scrollbars=no,menubar=no");
-
-    }
+    $pjump_def
 
     function dateset() {
         if (document.studentform.pres_marker.value=='end') {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.19 loncom/interface/lonhtmlcommon.pm:1.20
--- loncom/interface/lonhtmlcommon.pm:1.19	Fri Mar 21 10:59:14 2003
+++ loncom/interface/lonhtmlcommon.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.19 2003/03/21 15:59:14 matthew Exp $
+# $Id: lonhtmlcommon.pm,v 1.20 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -244,6 +244,33 @@
     } else {
         return undef;
     }
+}
+
+##############################################
+##############################################
+
+=pod
+
+=item &pjump_javascript_definition()
+
+Returns javascript defining the 'pjump' function, which opens up a
+parameter setting wizard.
+
+=cut
+
+##############################################
+##############################################
+sub pjump_javascript_definition {
+    my $Str = <<END;
+    function pjump(type,dis,value,marker,ret,call) {
+        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
+                 +"&value="+escape(value)+"&marker="+escape(marker)
+                 +"&return="+escape(ret)
+                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
+                 "height=350,width=350,scrollbars=no,menubar=no");
+    }
+END
+    return $Str;
 }
 
 ##############################################
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.87 loncom/interface/lonparmset.pm:1.88
--- loncom/interface/lonparmset.pm:1.87	Fri Apr 18 11:24:53 2003
+++ loncom/interface/lonparmset.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.87 2003/04/18 15:24:53 www Exp $
+# $Id: lonparmset.pm,v 1.88 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -56,6 +56,7 @@
 use strict;
 use Apache::lonnet;
 use Apache::Constants qw(:common :http REDIRECT);
+use Apache::lonhtmlcommon();
 use Apache::loncommon;
 use GDBM_File;
 use Apache::lonhomework;
@@ -291,7 +292,7 @@
     my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
         &Apache::loncommon::selectstudent_link('parmform','uname','udom');
     my $selscript=&Apache::loncommon::studentbrowser_javascript();
-
+    my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     $r->print(<<ENDHEAD);
 <html>
 <head>
@@ -304,15 +305,7 @@
         parmwin.close();
     }
 
-    function pjump(type,dis,value,marker,ret,call) {
-        document.parmform.pres_marker.value='';
-        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
-                 +"&value="+escape(value)+"&marker="+escape(marker)
-                 +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
-                 "height=350,width=350,scrollbars=no,menubar=no");
-
-    }
+    $pjump_def
 
     function psub() {
         pclose();
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.22 loncom/interface/lonpreferences.pm:1.23
--- loncom/interface/lonpreferences.pm:1.22	Wed Apr 30 11:12:29 2003
+++ loncom/interface/lonpreferences.pm	Wed Apr 30 11:49:45 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.22 2003/04/30 15:12:29 matthew Exp $
+# $Id: lonpreferences.pm,v 1.23 2003/04/30 15:49:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,7 @@
 use Crypt::DES;
 use DynaLoader; # for Crypt::DES version
 use Apache::loncommon();
+use Apache::lonhtmlcommon();
 
 #
 # Write lonnet::passwd to do the call below.
@@ -304,6 +305,7 @@
 "','".$curcol."','"
 	    .$item."','parmform.pres','psub'".');">Select</a></td></tr>';
     }
+    my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     $r->print(<<ENDCOL);
 <html>
 <script>
@@ -314,14 +316,7 @@
         parmwin.close();
     }
 
-    function pjump(type,dis,value,marker,ret,call) {
-        parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
-                 +"&value="+escape(value)+"&marker="+escape(marker)
-                 +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
-                 "height=350,width=350,scrollbars=no,menubar=no");
-
-    }
+    $pjump_def
 
     function psub() {
         pclose();

--matthew1051717785--