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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 13:40:19 -0000


This is a MIME encoded message

--albertel1152279619
Content-Type: text/plain

albertel		Fri Jul  7 09:40:19 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonhtmlcommon.pm 
  Log:
  - css pick box
  - adjust header to the data_tables
  - add ability for blank row data tables
  
  
--albertel1152279619
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060707094019.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.420 loncom/interface/loncommon.pm:1.421
--- loncom/interface/loncommon.pm:1.420	Tue Jul  4 18:02:14 2006
+++ loncom/interface/loncommon.pm	Fri Jul  7 09:40:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.420 2006/07/04 22:02:14 albertel Exp $
+# $Id: loncommon.pm,v 1.421 2006/07/07 13:40:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3268,15 +3268,21 @@
 table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th {
   font-weight: bold;
   background-color: $data_table_head;
+  font-size: smaller;
 }
 table.LC_data_table tr td {
   background-color: $data_table_light;
+  padding: 0px;
 }
 table.LC_data_table tr.LC_even_row td {
   background-color: $data_table_dark;
 }
-table.LC_data_table tr.LC_empty td {
+table.LC_data_table tr.LC_empty_row td {
   background-color: #FFFFFF;
+  font-weight: bold;
+  font-style: italic;
+  text-align: center;
+  padding: 8px;
 }
 
 table.LC_calendar {
@@ -3474,6 +3480,40 @@
   background: #CCCCFF;
 }
 
+table.LC_pick_box {
+  width: 100%;
+  border-collapse: separate;
+  background: white;
+  border: 1px solid black;
+  border-spacing: 1px;
+}
+table.LC_pick_box td.LC_pick_box_title {
+  background: $tabbg;
+  font-weight: bold;
+  text-align: right;
+  width: 184px;
+}
+table.LC_pick_box td {
+  padding: 8px;
+}
+table.LC_pick_box td.LC_pick_box_seperator {
+  padding: 0px;
+  height: 1px;
+  background: black;
+}
+table.LC_pick_box td.LC_pick_box_submit {
+  text-align: right;
+}
+
+table.LC_notify_front_page {
+  background: white;
+  border: 1px solid black;
+  padding: 8px;
+}
+table.LC_notify_front_page td {
+  padding: 8px;
+}
+
 END
 }
 
@@ -3862,6 +3902,15 @@
 	return '</tr>'."\n";;
     }
 
+    sub start_data_table_empty_row {
+	$row_count++;
+	return  '<tr class="LC_empty_row" >'."\n";;
+    }
+
+    sub end_data_table_empty_row {
+	return '</tr>'."\n";;
+    }
+
     sub start_data_table_header_row {
 	return  '<tr class="LC_header_row">'."\n";;
     }
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.141 loncom/interface/lonhtmlcommon.pm:1.142
--- loncom/interface/lonhtmlcommon.pm:1.141	Thu Jul  6 18:51:34 2006
+++ loncom/interface/lonhtmlcommon.pm	Fri Jul  7 09:40:16 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.141 2006/07/06 22:51:34 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.142 2006/07/07 13:40:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1361,15 +1361,14 @@
 # needs that are not accommodated by the *_select_row() routines.    
 
 sub start_pick_box {
-    my ($table_width) = @_;
+    my ($css_class) = @_;
+    if (defined($css_class)) {
+	$css_class = 'class="'.$css_class.'"';
+    } else {
+	$css_class= 'class="LC_pick_box"';
+    }
     my $output = <<"END";
- <table width="$table_width" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
-  <tr>
-      <td>
-       <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
-        <tr>
-         <td>
-          <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#ffffff">
+ <table $css_class>
 END
     return $output;
 }
@@ -1377,44 +1376,34 @@
 sub end_pick_box {
     my $output = <<"END";
        </table>
-      </td>
-     </tr>
-    </table>
-   </td>
-  </tr>
- </table>
 END
     return $output;
 }
 
 sub row_title {
-    my ($col_width,$tablecolor,$title) = @_;
+    my ($title,$css_title_class,$css_value_class) = @_;
+    $css_title_class ||= 'LC_pick_box_title';
+    $css_title_class = 'class="'.$css_title_class.'"';
+
+    $css_value_class ||= 'LC_pick_box_value';
+    $css_value_class = 'class="'.$css_value_class.'"';
+
     my $output = <<"ENDONE";
-           <tr>
-            <td width="$col_width" bgcolor="$tablecolor">
-             <table width="$col_width" border="0" cellpadding="8" cellspacing="0">
-              <tr>
-               <td align="right"><b>$title:</b>
-               </td>
-              </tr>
-             </table>
+           <tr class="LC_pick_box_row">
+            <td $css_title_class>
+	       $title:
             </td>
-            <td width="100%" valign="top">
-             <table width="100%" border="0" cellpadding="8" cellspacing="0">
-              <tr>
+            <td $css_value_class>
 ENDONE
     return $output;
 }
 
 sub row_closure {
     my $output = <<"ENDTWO";
-              </tr>
-             </table>
             </td>
            </tr>
            <tr>
-            <td width="100%" colspan="2" bgcolor="#000000">
-             <img src="/adm/lonMisc/blackdot.gif" /><br />
+            <td colspan="2" class="LC_pick_box_seperator">
             </td>
            </tr>
 ENDTWO
@@ -1422,12 +1411,12 @@
 }
 
 sub role_select_row {
-    my ($roles,$col_width,$tablecolor,$title) = @_;
+    my ($roles,$title,$css_class) = @_;
     my $output;
     if (defined($title)) {
-        $output = &row_title($col_width,$tablecolor,$title);
+        $output = &row_title($title,$css_class);
     }
-    $output .= qq|               <td valign="top">
+    $output .= qq|
                                   <select name="roles" multiple >\n|;
     foreach my $role (@$roles) {
         my $plrole;
@@ -1438,8 +1427,7 @@
         }
         $output .= '  <option value="'.$role.'">'.$plrole.'</option>';
     }
-    $output .= qq|                </select>
-                                 </td>\n|;
+    $output .= qq|                </select>\n|;
     if (defined($title)) {
         $output .= &row_closure();
     }
@@ -1447,11 +1435,11 @@
 }
 
 sub course_select_row {
-    my ($col_width,$tablecolor,$title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles) = @_;
-    my $output = &row_title($col_width,$tablecolor,$title);
-    $output .= "          <td>\n";
+    my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles,
+	$css_class) = @_;
+    my $output = &row_title($title,$css_class);
     $output .= qq|
-<script type="text/javascript" language="Javascript" >
+<script type="text/javascript">
     function coursePick (formname) {
         for  (var i=0; i<formname.coursepick.length; i++) {
             if (formname.coursepick[i].value == 'category') {
@@ -1523,24 +1511,23 @@
             $output .= '</tr></table><br />';
         }
     }
-    $output .= '<input type="radio" name="coursepick" value="specific" onclick="coursePick(this.form);opencrsbrowser('."'".$formname."'".','."'".'dccourse'."'".','."'".'dcdomain'."'".','."'".'coursedesc'."','','1'".')" />'.&mt('Pick specific course(s):').' '.$courseform.'&nbsp;&nbsp;<input type="text" value="0" size="4" name="coursetotal" /><input type="hidden" name="courselist" value="" />selected.<br /></td>'."\n";
+    $output .= '<input type="radio" name="coursepick" value="specific" onclick="coursePick(this.form);opencrsbrowser('."'".$formname."'".','."'".'dccourse'."'".','."'".'dcdomain'."'".','."'".'coursedesc'."','','1'".')" />'.&mt('Pick specific course(s):').' '.$courseform.'&nbsp;&nbsp;<input type="text" value="0" size="4" name="coursetotal" /><input type="hidden" name="courselist" value="" />selected.<br />'."\n";
     $output .= &row_closure();
     return $output;
 }
 
 sub status_select_row {
-    my ($types,$col_width,$tablecolor,$title) = @_;
+    my ($types,$title,$css_class) = @_;
     my $output; 
     if (defined($title)) {
-        $output = &row_title($col_width,$tablecolor,$title);
+        $output = &row_title($title,$css_class,'LC_pick_box_select');
     }
-    $output .= qq|              <td valign="top">
+    $output .= qq|
                                     <select name="types" multiple>\n|;
     foreach my $status_type (sort(keys(%{$types}))) {
         $output .= '  <option value="'.$status_type.'">'.$$types{$status_type}.'</option>';
     }
-    $output .= qq|                   </select>
-                                    </td>\n|; 
+    $output .= qq|                   </select>\n|; 
     if (defined($title)) {
         $output .= &row_closure();
     }
@@ -1548,18 +1535,18 @@
 }
 
 sub email_default_row {
-    my ($authtypes,$col_width,$tablecolor,$title,$descrip) = @_;
-    my $output = &row_title($col_width,$tablecolor,$title);
+    my ($authtypes,$title,$descrip,$css_class) = @_;
+    my $output = &row_title($title,$css_class);
     my @rowcols = ('#eeeeee','#dddddd');
-    $output .= '              <td>'.$descrip;
-    $output .= &start_pick_box(''); 
-    $output .= '                <tr bgcolor="'.$tablecolor.'">
-                                 <td><b>'.&mt('Authentication Method').'</b></td><td align="right"><b>'.&mt('Username -> e-mail conversion').'</b></td>
-                                </tr>'."\n";
+    $output .= $descrip.
+	&Apache::loncommon::start_data_table().
+	&Apache::loncommon::start_data_table_header_row().
+	'<th>'.&mt('Authentication Method').'</th>'.
+	'<th align="right">'.&mt('Username -> e-mail conversion').'</th>'."\n".
+	&Apache::loncommon::end_data_table_header_row();
     my $rownum = 0;
     foreach my $auth (sort(keys(%{$authtypes}))) {
         my ($userentry,$size);
-        my $rowiter = $rownum%2;
         if ($auth =~ /^krb/) {
             $userentry = '';
             $size = 25;
@@ -1567,26 +1554,27 @@
             $userentry = 'username@';
             $size = 15;
         }
-        $output .= '<tr bgcolor="'.$rowcols[$rowiter].'"><td>  '.$$authtypes{$auth}.'</td><td align="right">'.$userentry.'<input type="text" name="'.$auth.'" size="'.$size.'" /></td></tr>';
-        $rownum ++;
+        $output .= &Apache::loncommon::start_data_table_row().
+	    '<td>  '.$$authtypes{$auth}.'</td>'.
+	    '<td align="right">'.$userentry.
+	    '<input type="text" name="'.$auth.'" size="'.$size.'" /></td>'.
+	    &Apache::loncommon::end_data_table_row();
     }
-    $output .= &end_pick_box();
-    $output .= "                   <br /></td>\n"; 
+    $output .= &Apache::loncommon::end_data_table();
     $output .= &row_closure();
     return $output;
 }
 
 
 sub submit_row {
-    my ($col_width,$tablecolor,$title,$cmd,$submit_text) = @_;
-    my $output = &row_title($col_width,$tablecolor,$title);
+    my ($title,$cmd,$submit_text,$css_class) = @_;
+    my $output = &row_title($title,$css_class,'LC_pick_box_submit');
     $output .= qq|
-            <td width="100%" valign="top" align="right">
              <br />
              <input type="hidden" name="command" value="$cmd" />
              <input type="submit" value="$submit_text"/> &nbsp;
              <br /><br />
-            </td>\n|;
+            \n|;
     return $output;
 }
 

--albertel1152279619--