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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 16 Mar 2006 20:38:20 -0000


This is a MIME encoded message

--albertel1142541500
Content-Type: text/plain

albertel		Thu Mar 16 15:38:20 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - generalizing page starts/end
  
  
--albertel1142541500
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060316153820.txt"

Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.279 loncom/interface/lonparmset.pm:1.280
--- loncom/interface/lonparmset.pm:1.279	Tue Mar  7 16:36:19 2006
+++ loncom/interface/lonparmset.pm	Thu Mar 16 15:38:19 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.279 2006/03/07 21:36:19 www Exp $
+# $Id: lonparmset.pm,v 1.280 2006/03/16 20:38:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -580,20 +580,13 @@
 		&valout($value,$type).'</a></td></tr></table>';
 }
 
-sub startpage {
-    my $r=shift;
-    my $loaditems = qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|;
-    my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',
-                                            $loaditems);
-    my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting');
+sub page_js {
+
     my $selscript=&Apache::loncommon::studentbrowser_javascript();
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
-    my $html=&Apache::lonxml::xmlbegin();
-    $r->print(<<ENDHEAD);
-$html
-<head>
-<title>LON-CAPA Course Parameters</title>
-<script>
+
+    return(<<ENDJS);
+<script type="text/javascript">
 
     function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
@@ -635,14 +628,32 @@
     }
 </script>
 $selscript
-</head>
+ENDJS
+
+}
+sub startpage {
+    my ($r) = @_;
+    my $html = &Apache::lonxml::xmlbegin();
+    my $head = &Apache::loncommon::head('LON-CAPA Course Parameters',
+					&page_js());
+    my $loaditems = 
+	qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|;
+
+    my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',
+                                            $loaditems);
+    my $breadcrumbs = 
+	&Apache::lonhtmlcommon::breadcrumbs(undef,
+					    'Table Mode Parameter Setting');
+    $r->print(<<ENDHEAD);
+$html
+$head
 $bodytag
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=settable" name="parmform">
-<input type="hidden" value='' name="pres_value">
-<input type="hidden" value='' name="pres_type">
-<input type="hidden" value='' name="pres_marker">
-<input type="hidden" value='1' name="prevvisit">
+<input type="hidden" value='' name="pres_value" />
+<input type="hidden" value='' name="pres_type" />
+<input type="hidden" value='' name="pres_marker" />
+<input type="hidden" value='1' name="prevvisit" />
 ENDHEAD
 }
 
@@ -1947,7 +1958,7 @@
             $r->print("</table></center>");
         } # end of $parmlev eq general
     }
-    $r->print('</form></body></html>');
+    $r->print('</form>'.&Apache::loncommon::end_page());
 } # end sub assessparms
 
 
@@ -1972,8 +1983,7 @@
 sub crsenv {
     my $r=shift;
     my $setoutput='';
-    my $bodytag=&Apache::loncommon::bodytag(
-                             'Set Course Environment Parameters');
+
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,
 						    'Edit Course Environment');
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -2282,17 +2292,19 @@
     my $Parameter=&mt('Parameter');
     my $Value=&mt('Value');
     my $Set=&mt('Set');
-    my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset');
+    my $browse_js=
+	'<script type="text/javascript" language="Javascript">'.
+	&Apache::loncommon::browser_and_searcher_javascript('parmset').
+	'</script>';
+    
     my $html=&Apache::lonxml::xmlbegin();
-    $r->print(<<ENDenv);
-$html
-<head>
-<script type="text/javascript" language="Javascript" >
-$browse_js
-</script>
-<title>LON-CAPA Course Environment</title>
-</head>
-$bodytag
+    my $start_page = 
+	&Apache::loncommon::start_page('Set Course Environment Parameters',
+				       $browse_js);
+    my $end_page = 
+	&Apache::loncommon::end_page();
+    $r->print(<<ENDENV);
+$start_page
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=crsenv" name="envform">
 $setoutput
@@ -2303,9 +2315,8 @@
 </table>
 <input type="submit" name="crsenv" value="$lt{'sce'}">
 </form>
-</body>
-</html>    
-ENDenv
+$end_page
+ENDENV
 }
 ##################################################
 # Overview mode
@@ -2623,18 +2634,14 @@
 }
 
 sub newoverview {
-    my $r=shift;
-    my $bodytag=&Apache::loncommon::bodytag('Set Parameters');
+    my ($r) = @_;
+
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my $start_page = &Apache::loncommon::start_page('Set Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');
-    my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDOVER);
-$html
-<head>
-<title>LON-CAPA Parameters</title>
-</head>
-$bodytag
+$start_page
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=newoverview" name="parmform">
 ENDOVER
@@ -2742,7 +2749,7 @@
     }
     $r->print(&tableend().
 	     ((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':'').
-	      '</form></body></html>');
+	      '</form>'.&Apache::loncommon::end_page());
 }
 
 sub secgroup_lister {
@@ -2781,18 +2788,14 @@
 }
 
 sub overview {
-    my $r=shift;
-    my $bodytag=&Apache::loncommon::bodytag('Modify Parameters');
+    my ($r) = @_;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+
+    my $start_page=&Apache::loncommon::start_page('Modify Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');
-    my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDOVER);
-$html
-<head>
-<title>LON-CAPA Parameters</title>
-</head>
-$bodytag
+$start_page
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=setoverview" name="parmform">
 ENDOVER
@@ -2814,7 +2817,8 @@
     my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder);
 
     $r->print(&tableend().'<p>'.
-	($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>');
+	($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'.
+	      &Apache::loncommon::end_page());
 }
 
 ##################################################
@@ -2963,16 +2967,7 @@
 ##################################################
 ##################################################
 sub header {
-    my $html=&Apache::lonxml::xmlbegin();
-    my $bodytag=&Apache::loncommon::bodytag('Parameter Manager');
-    my $title = &mt('LON-CAPA Parameter Manager');
-    return(<<ENDHEAD);
-$html
-<head>
-<title>$title</title>
-</head>
-$bodytag
-ENDHEAD
+    return &Apache::loncommon::start_page('Parameter Manager');
 }
 ##################################################
 ##################################################
@@ -3082,11 +3077,8 @@
     my $output;
     my $item_num;
     my $put_result;
-    $r->print(&Apache::lonxml::xmlbegin());
-    $r->print('<head>
-            <title>LON-CAPA Restrict Metadata</title>
-            </head>');
-    $r->print(&Apache::loncommon::bodytag('Restrict Metadata'));
+    
+    $r->print(&Apache::loncommon::start_page('Restrict Metadata'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs(undef,
 						    'Restrict Metadata'));
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -3134,28 +3126,25 @@
         <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">
         </form>
 ENDenv
-    $r->print('</body>
-                </html>');
+    $r->print(&Apache::loncommon::end_page());
     return 'ok';
 }
 ##################################################
 
 sub defaultsetter {
-    my $r=shift;
-    my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions');
-    my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-    my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+    my ($r) = @_;
+
+    my $start_page = 
+	&Apache::loncommon::start_page('Parameter Setting Default Actions');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults');
-    my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDDEFHEAD);
-$html
-<head>
-<title>LON-CAPA Parameters</title>
-</head>
-$bodytag
+$start_page
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">
 ENDDEFHEAD
+
+    my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     my @ids=();
     my %typep=();
     my %keyp=();
@@ -3292,7 +3281,8 @@
         $r->print('</td></tr>');
     }
     $r->print("</table>\n<input type='submit' name='storerules' value='".
-	      &mt('Store Rules')."' /></form>\n</body>\n</html>");
+	      &mt('Store Rules')."' /></form>\n".
+	      &Apache::loncommon::end_page());
     return;
 }
 

--albertel1142541500--