[LON-CAPA-cvs] cvs: loncom /homework grades.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 11 Apr 2006 20:20:54 -0000


albertel		Tue Apr 11 16:20:54 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - start_page 
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.349 loncom/homework/grades.pm:1.350
--- loncom/homework/grades.pm:1.349	Mon Apr 10 02:34:07 2006
+++ loncom/homework/grades.pm	Tue Apr 11 16:20:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.349 2006/04/10 06:34:07 albertel Exp $
+# $Id: grades.pm,v 1.350 2006/04/11 20:20:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1142,6 +1142,56 @@
     my $request = shift;
     my $iconpath = $request->dir_config('lonIconsURL');
     &commonJSfunctions($request);
+
+    my $inner_js=<<INNERJS;
+    <script text="text/javascript">
+    function checkInput() {
+      opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value);
+      var nmsg   = opener.document.SCORE.savemsgN.value;
+      var usrctr = document.msgcenter.usrctr.value;
+      var newval = opener.document.SCORE["newmsg"+usrctr];
+      newval.value = opener.checkEntities(document.msgcenter.newmsg.value);
+
+      var msgchk = "";
+      if (document.msgcenter.subchk.checked) {
+         msgchk = "msgsub,";
+      }
+      var includemsg = 0;
+      for (var i=1; i<=nmsg; i++) {
+          var opnmsg = opener.document.SCORE["savemsg"+i];
+          var frmmsg = document.msgcenter["msg"+i];
+          opnmsg.value = opener.checkEntities(frmmsg.value);
+          var showflg = opener.document.SCORE["shownOnce"+i];
+          showflg.value = "1";
+          var chkbox = document.msgcenter["msgn"+i];
+          if (chkbox.checked) {
+             msgchk += "savemsg"+i+",";
+             includemsg = 1;
+          }
+      }
+      if (document.msgcenter.newmsgchk.checked) {
+         msgchk += "newmsg"+usrctr;
+         includemsg = 1;
+      }
+      imgformname = opener.document.SCORE["mailicon"+usrctr];
+      imgformname.src = "$iconpath/"+((includemsg) ? "mailto.gif" : "mailbkgrd.gif");
+      var includemsg = opener.document.SCORE["includemsg"+usrctr];
+      includemsg.value = msgchk;
+
+      self.close()
+
+    }
+    </script>
+INNERJS
+
+    my $start_page = 
+        &Apache::loncommon::start_page('MessageCentral',$inner_js,
+				       {'js_ready'  => 1,
+					'only_body' => 1,
+					'bgcolor'   =>'#FFFFFF',});
+    my $end_page = 
+	&Apache::loncommon::end_page({'js_ready' => 1});
+
     my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
     $docopen=~s/^document\.//;
     $request->print(<<SUBJAVASCRIPT);
@@ -1257,51 +1307,7 @@
     pWin.focus();
     pDoc = pWin.document;
     pDoc.$docopen;
-    pDoc.write("<html><head>");
-    pDoc.write("<title>Message Central</title>");
-
-    pDoc.write("<script language=javascript>");
-    pDoc.write("function checkInput() {");
-    pDoc.write("  opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value);");
-    pDoc.write("  var nmsg   = opener.document.SCORE.savemsgN.value;");
-    pDoc.write("  var usrctr = document.msgcenter.usrctr.value;");
-    pDoc.write("  var newval = opener.document.SCORE[\\"newmsg\\"+usrctr];");
-    pDoc.write("  newval.value = opener.checkEntities(document.msgcenter.newmsg.value);");
-
-    pDoc.write("  var msgchk = \\"\\";");
-    pDoc.write("  if (document.msgcenter.subchk.checked) {");
-    pDoc.write("     msgchk = \\"msgsub,\\";");
-    pDoc.write("  }");
-    pDoc.write("  var includemsg = 0;");
-    pDoc.write("  for (var i=1; i<=nmsg; i++) {");
-    pDoc.write("      var opnmsg = opener.document.SCORE[\\"savemsg\\"+i];");
-    pDoc.write("      var frmmsg = document.msgcenter[\\"msg\\"+i];");
-    pDoc.write("      opnmsg.value = opener.checkEntities(frmmsg.value);");
-    pDoc.write("      var showflg = opener.document.SCORE[\\"shownOnce\\"+i];");
-    pDoc.write("      showflg.value = \\"1\\";");
-    pDoc.write("      var chkbox = document.msgcenter[\\"msgn\\"+i];");
-    pDoc.write("      if (chkbox.checked) {");
-    pDoc.write("         msgchk += \\"savemsg\\"+i+\\",\\";");
-    pDoc.write("         includemsg = 1;");
-    pDoc.write("      }");
-    pDoc.write("  }");
-    pDoc.write("  if (document.msgcenter.newmsgchk.checked) {");
-    pDoc.write("     msgchk += \\"newmsg\\"+usrctr;");
-    pDoc.write("     includemsg = 1;");
-    pDoc.write("  }");
-    pDoc.write("  imgformname = opener.document.SCORE[\\"mailicon\\"+usrctr];");
-    pDoc.write("  imgformname.src = \\"$iconpath/\\"+((includemsg) ? \\"mailto.gif\\" : \\"mailbkgrd.gif\\");");
-    pDoc.write("  var includemsg = opener.document.SCORE[\\"includemsg\\"+usrctr];");
-    pDoc.write("  includemsg.value = msgchk;");
-
-    pDoc.write("  self.close()");
-
-    pDoc.write("}");
-
-    pDoc.write("<");
-    pDoc.write("/script>");
-
-    pDoc.write("</head><body bgcolor=white>");
+    pDoc.write('$start_page');
 
     pDoc.write("<form action=\\"inactive\\" name=\\"msgcenter\\">");
     pDoc.write("<input value=\\""+usrctr+"\\" name=\\"usrctr\\" type=\\"hidden\\">");
@@ -1342,7 +1348,7 @@
     pDoc.write("<input type=\\"button\\" value=\\"Save\\" onClick=\\"javascript:checkInput()\\">&nbsp;&nbsp;");
     pDoc.write("<input type=\\"button\\" value=\\"Cancel\\" onClick=\\"self.close()\\"><br /><br />");
     pDoc.write("</form>");
-    pDoc.write("</body></html>");
+    pDoc.write('$end_page');
     pDoc.close();
 }
 
@@ -1953,8 +1959,8 @@
 	    '<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n";
 	$result.='&nbsp;<a href="javascript:msgCenter(document.SCORE,'.$counter.
 	    ',\''.$msgfor.'\')"; TARGET=_self>'.
-	    &mt('Compose message to student').(scalar(@col_fullnames) >= 1 ? 's' : '').'</a> ('.
-	    &mt('incl. grades').' <input type="checkbox" name="withgrades'.$counter.'" />)'.
+	    &mt('Compose message to student').(scalar(@col_fullnames) >= 1 ? 's' : '').'</a><label> ('.
+	    &mt('incl. grades').' <input type="checkbox" name="withgrades'.$counter.'" /></label>)'.
 	    '<img src="'.$request->dir_config('lonIconsURL').
 	    '/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n".
 	    '<br />&nbsp;('.