--- loncom/interface/portfolio.pm 2006/06/22 15:33:35 1.109 +++ loncom/interface/portfolio.pm 2006/06/22 15:46:28 1.111 @@ -547,11 +547,11 @@ sub update_access { 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 @@ sub access_setting_table { $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 @@ sub access_setting_table { $r->print('</td><td width="40"> </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 @@ sub display_access_row { 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 @@ sub display_access_row { } 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, @@ -951,10 +952,11 @@ sub display_access_row { } } $r->print(&Apache::loncommon::end_data_table_row()); - $r->print(&Apache::loncommon::start_data_table_row()); if ($status eq 'old') { + $r->print(&Apache::loncommon::start_data_table_row()); $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 { @@ -964,15 +966,8 @@ sub display_access_row { 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 @@ function getIndex(name,value) { } </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 @@ function getIndex(name,value) { $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 @@ sub domains_row { } $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 @@ sub users_row { $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 {