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

bisitz bisitz@source.lon-capa.org
Mon, 03 Aug 2009 16:26:09 -0000


bisitz		Mon Aug  3 16:26:09 2009 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  XHTML:
  - Properly include javascript
  - Lower case HTML attributes (onClick, onFocus)
  - selected="selected" and optimized spacing
  - Added lost white space between HTML attributes
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.95 loncom/interface/lonuserutils.pm:1.96
--- loncom/interface/lonuserutils.pm:1.95	Mon Aug  3 15:57:25 2009
+++ loncom/interface/lonuserutils.pm	Mon Aug  3 16:26:09 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.95 2009/08/03 15:57:25 bisitz Exp $
+# $Id: lonuserutils.pm,v 1.96 2009/08/03 16:26:09 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -347,10 +347,13 @@
               &mt('Ignore First Line').'</label><br />');
     $r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '.
               'name="Reverse Association" '.
-              'onClick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />');
+              'onclick="javascript:this.form.associate.value=\'Reverse Association\';submit(this.form);" />');
     $r->print("<br /><br />\n".
               '<script type="text/javascript" language="Javascript">'."\n".
-              $javascript."\n".$javascript_validations.'</script>');
+              '// <![CDATA['."\n".
+              $javascript."\n".$javascript_validations."\n".
+              '// ]]>'."\n".
+              '</script>');
 }
 
 ###############################################################
@@ -886,8 +889,8 @@
                .'</p>';
     }
     $Str .= '<p><input type="button"'
-           .'onClick="javascript:verify(this.form,this.form.csec)" '
-           .'value="'.&mt('Update Users').'" />'
+           .' onclick="javascript:verify(this.form,this.form.csec)"'
+           .' value="'.&mt('Update Users').'" />'
            .'</p>'."\n"
            .'</div>';
     $r->print($Str);
@@ -1182,7 +1185,7 @@
                       '<th>'.$lt{'grs'}.'</th>'.
                       &Apache::loncommon::end_data_table_header_row().
                       &Apache::loncommon::start_data_table_row()."\n".
-                      '<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'studentform','dccourse','dcdomain','coursedesc',''".')" /></td>'."\n".
+                      '<td><input type="text" name="coursedesc" value="" onfocus="this.blur();opencrsbrowser('."'studentform','dccourse','dcdomain','coursedesc',''".')" /></td>'."\n".
                       '<td><select name="courserole">'."\n".
                       &default_course_roles($context,$checkpriv,%customroles)."\n".
                       '</select></td><td>'.
@@ -1375,9 +1378,9 @@
                                            'html'  => 'HTML');
         my $output_selector = '<select size="1" name="output" >';
         foreach my $outputformat ('html','csv','excel') {
-            my $option = '<option value="'.$outputformat.'" ';
+            my $option = '<option value="'.$outputformat.'"';
             if ($outputformat eq $env{'form.output'}) {
-                $option .= 'selected ';
+                $option .= ' selected="selected"';
             }
             $option .='>'.$lt{$outputformat}.'</option>';
             $output_selector .= "\n".$option;
@@ -1659,7 +1662,7 @@
             foreach my $option ('all','none',@options) { 
                 $currsel = '';
                 if ($env{'form.'.$name{$item}} eq $option) {
-                    $currsel = ' selected="selected" ';
+                    $currsel = ' selected="selected"';
                 }
                 $markup .= ' <option value="'.$option.'"'.$currsel.'>';
                 if (($option eq 'all') || ($option eq 'none')) {
@@ -2058,6 +2061,7 @@
             if ($env{'course.'.$cid.'.internal.showphoto'}) {
                 $r->print('
 <script type="text/javascript">
+// <![CDATA[
 function photowindow(photolink) {
     var title = "Photo_Viewer";
     var options = "scrollbars=1,resizable=1,menubar=0";
@@ -2065,6 +2069,7 @@
     stdeditbrowser = open(photolink,title,options,"1");
     stdeditbrowser.focus();
 }
+// ]]>
 </script>
                ');
             }
@@ -2081,6 +2086,7 @@
         $r->print(<<END);
 
 <script type="text/javascript" language="Javascript">
+// <![CDATA[
 $check_uncheck_js
 
 $verify_action_js
@@ -2119,6 +2125,7 @@
         }
     }
 }
+// ]]>
 </script>
 $date_sec_selector
 <input type="hidden" name="state" value="$env{'form.state'}" />
@@ -2934,9 +2941,9 @@
         delete => "Check the boxes for any users for whom roles are to be deleted, and click 'Proceed'",
         none   => "Choose an action to take for selected users",
     );  
-    my $output = '
-<script type="text/javascript">'."\n";
-    $output .= <<"ENDONE";
+    my $output = <<"ENDONE";
+<script type="text/javascript">
+// <![CDATA[
     function opendatebrowser(callingform,formname,calledby) {
         var bulkaction = callingform.bulkaction.options[callingform.bulkaction.selectedIndex].value;
         var url = '/adm/createuser?';
@@ -2959,6 +2966,7 @@
         stdeditbrowser = open(url,title,options,'1');
         stdeditbrowser.focus();
     }
+// ]]>
 </script>
 ENDTWO
     return $output;
@@ -2972,6 +2980,7 @@
     my $sec_js = &setsections_javascript($formname,$groupslist);
     my $output = <<"END";
 <script type="text/javascript">
+// <![CDATA[
 
 $sec_js
 
@@ -3040,6 +3049,7 @@
 
 $verify_action_js
 
+// ]]>
 </script>
 ENDJS
     my %lt = &Apache::lonlocal::texthash (
@@ -3316,7 +3326,9 @@
 <input type="hidden" name="action" value="$action" />
 <input type="hidden" name="state"  value="done" />
 <script type="text/javascript" language="Javascript">
+// <![CDATA[
 $check_uncheck_js
+// ]]>
 </script>
 <p>
 <input type="hidden" name="phase" value="four" />