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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 22 Jun 2006 15:42:38 -0000


albertel		Thu Jun 22 11:42:38 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  - correcting some udage of the data_table
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.109 loncom/interface/portfolio.pm:1.110
--- loncom/interface/portfolio.pm:1.109	Thu Jun 22 11:33:35 2006
+++ loncom/interface/portfolio.pm	Thu Jun 22 11:42:38 2006
@@ -547,11 +547,11 @@
             my $updated_controls = $access_controls{$file_name};
             my ($showstart,$showend);
             $r->print(&Apache::loncommon::start_data_table());
-            $r->print(&Apache::loncommon::start_data_table_row());
+            $r->print(&Apache::loncommon::start_data_table_header_row());
             $r->print('<th>'.&mt('Type of change').'</th><th>'.
                       &mt('Access control').'</th><th>'.&mt('Dates available').
                       '</th><th>'.&mt('Additional information').'</th>');
-            $r->print(&Apache::loncommon::end_data_table_row());
+            $r->print(&Apache::loncommon::end_data_table_header_row());
             foreach my $chg (sort(keys(%processing))) {
                 if (@{$processing{$chg}} > 0) {
                     if ($chg eq 'delete') {
@@ -830,9 +830,9 @@
     $r->print('<table border="0"><tr><td valign="top">');
     $r->print('<h3>'.&mt('Public access:').' '.$publictext.'</h3>');
     $r->print(&Apache::loncommon::start_data_table());
-    $r->print(&Apache::loncommon::start_data_table_row());
+    $r->print(&Apache::loncommon::start_data_table_header_row());
     $r->print('<th>'.&mt('Action').'</th><th>'.&mt('Dates available').'</th>');
-    $r->print(&Apache::loncommon::end_data_table_row());
+    $r->print(&Apache::loncommon::end_data_table_header_row());
     $r->print(&Apache::loncommon::start_data_table_row());
     if ($public) {
         $r->print('<td>'.&actionbox('old',$publicnum,'public').'</td><td>'.
@@ -846,10 +846,10 @@
     $r->print('</td><td width="40">&nbsp;</td><td valign="top">');
     $r->print('<h3>'.&mt('Password-protected access:').' '.$guesttext.'</h3>');
     $r->print(&Apache::loncommon::start_data_table());
-    $r->print(&Apache::loncommon::start_data_table_row());
+    $r->print(&Apache::loncommon::start_data_table_header_row());
     $r->print('<th>'.&mt('Action').'</th><th>'.&mt('Dates available').
               '</th><th>'. &mt('Password').'</th>');
-    $r->print(&Apache::loncommon::end_data_table_row());
+    $r->print(&Apache::loncommon::end_data_table_header_row());
     $r->print(&Apache::loncommon::start_data_table_row());
     my $passwd;
     if ($guest) {
@@ -926,8 +926,8 @@
         my $uctype = $type;
         $uctype =~ s/^(\w)/uc($1)/e;
         $r->print(&Apache::loncommon::start_data_table());
-        $r->print(&Apache::loncommon::start_data_table_row());
-        $r->print('<th>'.&mt('Action?').'</th><th>'.&mt($uctype).'</td><th>'.
+        $r->print(&Apache::loncommon::start_data_table_header_row());
+        $r->print('<th>'.&mt('Action?').'</th><th>'.&mt($uctype).'</th><th>'.
               &mt('Dates available').'</th>');
         if (($type eq 'course') || ($type eq 'group')) {
             $r->print('<th>'.&mt('Allowed [_1] member affiliations',$type).
@@ -938,7 +938,8 @@
         } elsif ($type eq 'domains') {
             @all_doms = &Apache::loncommon::get_domains();
         }
-        $r->print(&Apache::loncommon::end_data_table_row());
+        $r->print(&Apache::loncommon::end_data_table_header_row());
+	$r->print(&Apache::loncommon::start_data_table_row());
         foreach my $key (@{$items}) {
             if (($type eq 'course') || ($type eq 'group')) {
                 &course_row($r,$status,$type,$key,$access_controls,
@@ -956,6 +957,7 @@
             $r->print('<td colspan="',$colspan.'">'.&additional_item($type).
                       '</td>');
         }
+        $r->print(&Apache::loncommon::end_data_table_row());
         $r->print(&Apache::loncommon::end_data_table());
     } else {
         $r->print(&mt('No [_1]-based conditions defined.<br />',$type).
@@ -964,15 +966,8 @@
     return;
 }
 
-sub course_row {
-    my ($r,$status,$type,$item,$access_controls,$tablecolor,$now,$then) = @_;
-    my %content;
-    my $defdom = $env{'user.domain'};
-    if ($status eq 'old') {
-        $defdom =  $$access_controls{$item}{'domain'}; 
-    }
-    $r->print(&Apache::loncommon::coursebrowser_javascript($defdom));
-    $r->print(qq|
+sub course_js {
+    return qq|
 <script type="text/javascript">
 function setRoleOptions(caller,num,cdom,cnum,type) {
     addIndexnum = getCallerIndex(caller);
@@ -1011,15 +1006,25 @@
 }
 
 </script>
-|);
-    $r->print(&Apache::loncommon::start_data_table_row());
+|;
+}
+
+sub course_row {
+    my ($r,$status,$type,$item,$access_controls,$tablecolor,$now,$then) = @_;
+    my %content;
+    my $defdom = $env{'user.domain'};
+    if ($status eq 'old') {
+        $defdom =  $$access_controls{$item}{'domain'}; 
+    }
+    my $js = &Apache::loncommon::coursebrowser_javascript($defdom)
+	.&course_js();
     my $crsgrptext = 'Groups';
     if ($type eq 'group') {
         $crsgrptext = 'Teams';
     }
     my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
                                                     $type);
-    $r->print('<td>'.&actionbox($status,$num,$scope).'</td>');
+    $r->print('<td>'.$js.&actionbox($status,$num,$scope).'</td>');
     if ($status eq 'old') {
         my $cid = $content{'domain'}.'_'.$content{'number'};
         my %course_description = &Apache::lonnet::coursedescription($cid);
@@ -1051,18 +1056,15 @@
         $r->print('<tr><td><input type="checkbox" name="add_role_'.$num.'" value="'.$role_id.'" checked="checked" />'.&mt('Add').'<input type="hidden" name="grplist_'.$num.'_'.$role_id.'" /></td>'.$role_selects);
         $r->print('</tr></table></td>');
     }
-    $r->print(&Apache::loncommon::end_data_table_row());
     return;
 }
 
 sub domains_row {
     my ($r,$status,$item,$all_doms,$access_controls,$now,$then) = @_;
-    $r->print(&Apache::loncommon::start_data_table_row());
     my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
                                                     'domains');
     my $dom_select = '<select name="dom_'.$num.'" size="4" multiple="true"/>'.
                      ' <option value="">'.&mt('Please select').'</option>';
-    $r->print(&Apache::loncommon::start_data_table_row());
     if ($status eq 'old') {
         my $content =  $$access_controls{$item};
 	foreach my $dom (@{$all_doms}) {
@@ -1081,13 +1083,10 @@
     }
     $r->print('<td>'.&actionbox($status,$num,$scope).'</td><td>'.$dom_select.
               '</td><td>'.&dateboxes($num,$start,$end).'</td>');
-    $r->print(&Apache::loncommon::end_data_table_row());
-    $r->print(&Apache::loncommon::start_data_table_row());
 }
 
 sub users_row {
     my ($r,$status,$item,$access_controls,$now,$then) = @_;
-    $r->print(&Apache::loncommon::start_data_table_row());
     my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
                                                     'users');
     my $curr_user_list;
@@ -1096,7 +1095,6 @@
         $curr_user_list = &sort_users($content->{'users'});
     }
     $r->print('<td>'.&actionbox($status,$num,$scope).'</td><td>'.&mt("Format for users' username:domain information:").'<br /><tt>sparty:msu,illini:uiuc  ... etc.</tt><br /><textarea name="users_'.$num.'" cols="30"  rows="5">'.$curr_user_list.'</textarea></td><td>'.&dateboxes($num,$start,$end).'</td>');
-    $r->print(&Apache::loncommon::end_data_table_row());
 }
 
 sub additional_item {