version 1.42, 2006/07/07 19:17:19
|
version 1.44, 2006/07/07 19:50:21
|
Line 1197 sub general_settings_form {
|
Line 1197 sub general_settings_form {
|
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
3,$tools,$stored,$toolprivs,$fixedprivs, |
3,$tools,$stored,$toolprivs,$fixedprivs, |
\@available,$formname,$gpterm,$ucgpterm); |
\@available,$formname,$gpterm,$ucgpterm); |
&mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount, |
&mapping_options($r,$action,$formname,$page,$sectioncount, |
$states,$stored,$navbuttons,4,5,$rowColor1, |
$states,$stored,$navbuttons,4,5, |
$rowColor2,$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
$nexttext = $$navbuttons{'mose'}; |
$nexttext = $$navbuttons{'mose'}; |
} |
} |
$prevtext = $$navbuttons{'gtpp'}; |
$prevtext = $$navbuttons{'gtpp'}; |
Line 1491 sub choose_members_form {
|
Line 1491 sub choose_members_form {
|
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
$specimg,$tools,$stored,$toolprivs, |
$specimg,$tools,$stored,$toolprivs, |
$fixedprivs,\@available,$formname,$gpterm,$ucgpterm); |
$fixedprivs,\@available,$formname,$gpterm,$ucgpterm); |
my $newusers = &pick_new_members($r,$action,$formname,$tabcol,$rowColor1, |
my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx, |
$rowColor2,\@available,$idx,$stored, |
$stored,$memimg,$users,$userdata, |
$memimg,$users,$userdata,$granularity, |
$granularity,\%origmembers,$gpterm, |
\%origmembers,$gpterm,$ucgpterm); |
$ucgpterm); |
if ($newusers || $action eq 'create') { |
if ($newusers || $action eq 'create') { |
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
$$navbuttons{'gtps'},$$states{$action}[$page+1], |
$$navbuttons{'gtps'},$$states{$action}[$page+1], |
Line 1632 END
|
Line 1632 END
|
} |
} |
|
|
sub pick_new_members { |
sub pick_new_members { |
my ($r,$action,$formname,$tabcol,$rowColor1,$rowColor2,$available,$idx, |
my ($r,$action,$formname,$available,$idx,$stored,$img,$users,$userdata, |
$stored,$img,$users,$userdata,$granularity,$origmembers,$gpterm, |
$granularity,$origmembers,$gpterm,$ucgpterm) = @_; |
$ucgpterm) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'gpme' => "$ucgpterm membership", |
'gpme' => "$ucgpterm membership", |
'addm' => 'Add members', |
'addm' => 'Add members', |
Line 1688 sub pick_new_members {
|
Line 1687 sub pick_new_members {
|
} |
} |
$r->print('</tr></table> |
$r->print('</tr></table> |
'); |
'); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row()); |
$r->print(' |
$r->print(' |
<table border="0" cellpadding="4" cellspacing="1"> |
<th>'.&mt('Add?').'</b></td> |
<tr bgcolor="'.$tabcol.'" align="center"> |
<th><a href="javascript:changeSort('."'fullname'".')">'.&mt('Name').'</a></td> |
<td><b>'.&mt('Add?').'</b></td> |
<th><a href="javascript:changeSort('."'username'".')">'.&mt('Username').'</a></td> |
<td><b><a href="javascript:changeSort('."'fullname'".')">'.&mt('Name').'</a></b></td> |
<th><a href="javascript:changeSort('."'domain'".')">'.&mt('Domain').'</a></td> |
<td><b><a href="javascript:changeSort('."'username'".')">'.&mt('Username').'</a></b> |
<th><a href="javascript:changeSort('."'id'".')">'.&mt('ID').'</a></td> |
</td> |
<th><a href="javascript:changeSort('."'section'".')">'.&mt('Section').'</a></td> |
<td><b><a href="javascript:changeSort('."'domain'".')">'.&mt('Domain').'</a></b></td> |
|
<td><b><a href="javascript:changeSort('."'id'".')">ID</a></b></td> |
|
<td><b><a href="javascript:changeSort('."'section'".')">Section</a></b></td> |
|
'); |
'); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
$r->print('<td><b>'.$lt{'func'}.'</b></td>'); |
$r->print('<th>'.$lt{'func'}.'</th>'); |
} |
} |
$r->print('</tr>'); |
$r->print(&Apache::loncommon::end_data_table_header_row()); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<tr bgcolor="#cccccc"> |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' |
<td colspan="6"> </td> |
<td colspan="6"> </td> |
<td align="center"><small><nobr><b>'.&mt('All:').'</b> '); |
<td align="center"><nobr><b>'.&mt('All:').'</b> '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
} |
} |
$r->print('</nobr></small></td></tr>'); |
$r->print('</nobr></td></tr>'); |
} |
} |
} |
} |
my %Sortby = (); |
my %Sortby = (); |
Line 1733 sub pick_new_members {
|
Line 1730 sub pick_new_members {
|
push(@{$Sortby{$members{$user}[$$idx{fullname}]}},$user); |
push(@{$Sortby{$members{$user}[$$idx{fullname}]}},$user); |
} |
} |
} |
} |
my $rowNum = 0; |
|
my $rowColor; |
|
foreach my $key (sort(keys(%Sortby))) { |
foreach my $key (sort(keys(%Sortby))) { |
foreach my $user (@{$Sortby{$key}}) { |
foreach my $user (@{$Sortby{$key}}) { |
if ($rowNum %2 == 1) { |
|
$rowColor = $rowColor1; |
|
} else { |
|
$rowColor = $rowColor2; |
|
} |
|
my $id = $members{$user}[$$idx{id}]; |
my $id = $members{$user}[$$idx{id}]; |
my $fullname = $members{$user}[$$idx{fullname}]; |
my $fullname = $members{$user}[$$idx{fullname}]; |
my $udom = $members{$user}[$$idx{udom}]; |
my $udom = $members{$user}[$$idx{udom}]; |
my $uname = $members{$user}[$$idx{uname}]; |
my $uname = $members{$user}[$$idx{uname}]; |
my $section = $members{$user}[$$idx{section}]; |
my $section = $members{$user}[$$idx{section}]; |
$r->print('<tr bgcolor="'.$rowColor.'"><td align="right"> |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense'). |
<input type="checkbox" name="member" value="'.$user.'" /></td><td><small>'. |
'<td align="right"><input type="checkbox" name="member" value="'.$user.'" /></td>'. |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
'<td>'.$fullname.'</td>'. |
$udom.'</small></td><td><small>'.$id.'</small></td>'. |
'<td>'.$uname.'</td>'. |
'<td><small>'.$section.'</small></td>'); |
'<td>'.$udom.'</td>'. |
|
'<td>'.$id.'</td>'. |
|
'<td>'.$section.'</td>'); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
$r->print('<td align="center"><nobr><small>'. |
$r->print('<td align="center"><nobr>'. |
' '); |
' '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
Line 1764 sub pick_new_members {
|
Line 1756 sub pick_new_members {
|
$tool.'" value="'.$user.'" />'.$tool.' '); |
$tool.'" value="'.$user.'" />'.$tool.' '); |
} |
} |
} |
} |
$r->print('</small></nobr></td>'); |
$r->print('</nobr></td>'); |
} |
} |
$r->print('</tr>'."\n"); |
$r->print(&Apache::loncommon::end_data_table_row()."\n"); |
$rowNum ++; |
|
} |
} |
} |
} |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::loncommon::end_data_table()); |
} else { |
} else { |
if ($totalusers > 0) { |
if ($totalusers > 0) { |
$r->print($lt{'nnew'}.'<br /><br />'.$lt{'yoma'}); |
$r->print($lt{'nnew'}.'<br /><br />'.$lt{'yoma'}); |
Line 2446 sub choose_privs_form {
|
Line 2437 sub choose_privs_form {
|
if (keys(%{$sectioncount}) > 0) { |
if (keys(%{$sectioncount}) > 0) { |
my $img1 = 7; |
my $img1 = 7; |
my $img2 = 8; |
my $img2 = 8; |
&mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount, |
&mapping_options($r,$action,$formname,$page,$sectioncount, |
$states,$stored,$navbuttons,$img1,$img2, |
$states,$stored,$navbuttons,$img1,$img2, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
} |
} |
} |
} |
my $prevtext = $$navbuttons{'gtps'}; |
my $prevtext = $$navbuttons{'gtps'}; |
Line 2596 sub member_privileges_form {
|
Line 2587 sub member_privileges_form {
|
my %total; |
my %total; |
if (keys(%{$usertools}) > 1) { |
if (keys(%{$usertools}) > 1) { |
$r->print(' |
$r->print(' |
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
<table border="0" cellspacing="2" cellpadding="2" border="0"> |
<table border="0" cellspacing="2" cellpadding="2" border="0"> |
<tr> |
<tr> |
'); |
'); |
Line 2663 END
|
Line 2651 END
|
\@excluded); |
\@excluded); |
$r->print('</td>'); |
$r->print('</td>'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</td></tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
'); |
|
} else { |
} else { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'forf'}. |
$r->print($lt{'forf'}.'<br />'); |
'<br />'); |
|
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
$toolprivs,\@defprivs); |
$toolprivs,\@defprivs); |
} |
} |
} else { |
} else { |
if (keys(%{$usertools}) > 0) { |
if (keys(%{$usertools}) > 0) { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'algr'}. |
$r->print($lt{'algr'}.'<br /><br />'); |
'<br /><br />'); |
|
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
$toolprivs,\@defprivs); |
$toolprivs,\@defprivs); |
} else { |
} else { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'asno'}. |
$r->print($lt{'asno'}.'<br />'); |
'<br />'); |
|
} |
} |
} |
} |
} else { |
} else { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'asng'}); |
$r->print($lt{'asng'}); |
} |
} |
return $numchgs; |
return $numchgs; |
} |
} |
Line 3089 sub process_membership {
|
Line 3069 sub process_membership {
|
} |
} |
|
|
sub mapping_options { |
sub mapping_options { |
my ($r,$action,$formname,$page,$tabcol,$sectioncount,$states,$stored, |
my ($r,$action,$formname,$page,$sectioncount,$states,$stored, |
$navbuttons,$img1,$img2,$rowColor1,$rowColor2,$gpterm,$ucgpterm, |
$navbuttons,$img1,$img2,$gpterm,$ucgpterm,$crstype) = @_; |
$crstype) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'auto' => "Settings for automatic $gpterm enrollment", |
'auto' => "Settings for automatic $gpterm enrollment", |
'gmma' => "$ucgpterm membership mapping to specific sections/roles", |
'gmma' => "$ucgpterm membership mapping to specific sections/roles", |
Line 3107 sub mapping_options {
|
Line 3086 sub mapping_options {
|
'auex' => "Automatically expire $gpterm membership when roles are removed?", |
'auex' => "Automatically expire $gpterm membership when roles are removed?", |
'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.", |
'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.", |
); |
); |
&automapping($r,$action,$tabcol,$stored,\%lt,$img1); |
&automapping($r,$action,$stored,\%lt,$img1); |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td colspan="4"> </td> |
<td colspan="4"> </td> |
</tr>'); |
</tr>'); |
&mapping_settings($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,\%lt, |
&mapping_settings($r,$sectioncount,\%lt,$stored,$img2,$crstype); |
$stored,$img2,$crstype); |
|
return; |
return; |
} |
} |
|
|
sub automapping { |
sub automapping { |
my ($r,$action,$tabcol,$stored,$lt,$image) = @_; |
my ($r,$action,$stored,$lt,$image) = @_; |
my $add = 'off'; |
my $add = 'off'; |
my $drop = 'off'; |
my $drop = 'off'; |
if (exists($$stored{'autoadd'})) { |
if (exists($$stored{'autoadd'})) { |
Line 3129 sub automapping {
|
Line 3107 sub automapping {
|
} |
} |
&topic_bar($r,$image,$$lt{'endi'}); |
&topic_bar($r,$image,$$lt{'endi'}); |
$r->print(' |
$r->print(' |
<tr> |
<b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br /> |
<td> </td> |
|
<td colspan="3"> |
|
<b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
<nobr>'.$$lt{'auad'}.': |
<nobr>'.$$lt{'auad'}.': |
<label><input type="radio" name="autoadd" value="on" />on </label><label><input type="radio" name="autoadd" value="off" checked="checked" />off</label>'); |
<label><input type="radio" name="autoadd" value="on" />on </label><label><input type="radio" name="autoadd" value="off" checked="checked" />off</label>'); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)'); |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)'); |
} |
} |
$r->print(' |
$r->print(' |
</nobr> |
</nobr><br /> |
</td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
<nobr>'.$$lt{'auex'}.': |
<nobr>'.$$lt{'auex'}.': |
<label><input type="radio" name="autodrop" value="on" />on </label><label><input type="radio" name="autodrop" value="off" checked="checked" />off</label>'); |
<label><input type="radio" name="autodrop" value="on" />on </label><label><input type="radio" name="autodrop" value="off" checked="checked" />off</label>'); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)'); |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)'); |
} |
} |
$r->print('</nobr> |
$r->print('</nobr><br /><br />'.$$lt{'mapr'}); |
</td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3">'.$$lt{'mapr'}.' |
|
</td> |
|
</tr> |
|
'); |
|
} |
} |
|
|
sub mapping_settings { |
sub mapping_settings { |
my ($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,$lt,$stored,$image, |
my ($r,$sectioncount,$lt,$stored,$image,$crstype) = @_; |
$crstype) = @_; |
|
my @sections = keys(%{$sectioncount}); |
my @sections = keys(%{$sectioncount}); |
if (@sections > 0) { |
if (@sections > 0) { |
@sections = sort {$a cmp $b} @sections; |
@sections = sort {$a cmp $b} @sections; |
Line 3182 sub mapping_settings {
|
Line 3132 sub mapping_settings {
|
unshift(@sections,'all'); # Put 'all' at the front of the list |
unshift(@sections,'all'); # Put 'all' at the front of the list |
} |
} |
&topic_bar($r,$image,$$lt{'pirs'}); |
&topic_bar($r,$image,$$lt{'pirs'}); |
$r->print(' |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
my @roles = &standard_roles(); |
my @roles = &standard_roles(); |
my %customroles = &my_custom_roles(); |
my %customroles = &my_custom_roles(); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row()); |
$r->print(' |
$r->print(' |
<tr bgcolor="'.$tabcol.'"> |
|
<th>'.&mt('Active?').'</th> |
<th>'.&mt('Active?').'</th> |
<th>'.&mt('Role').'</th>'); |
<th>'.&mt('Role').'</th>'); |
if (@sections > 0) { |
if (@sections > 0) { |
$r->print('<th>'.&mt('Sections').'</th></tr>'."\n"); |
$r->print('<th>'.&mt('Sections').'</th>'); |
} |
} |
my $rowNum = 0; |
$r->print(&Apache::loncommon::end_data_table_header_row()."\n"); |
my $rowColor; |
|
foreach my $role (@roles) { |
foreach my $role (@roles) { |
my $plrole=&Apache::lonnet::plaintext($role,$crstype); |
my $plrole=&Apache::lonnet::plaintext($role,$crstype); |
my $sections_sel; |
my $sections_sel; |
Line 3213 sub mapping_settings {
|
Line 3157 sub mapping_settings {
|
'</td>'; |
'</td>'; |
} |
} |
} |
} |
if ($rowNum %2 == 1) { |
$r->print(&Apache::loncommon::start_data_table_row(). |
$rowColor = $rowColor1; |
'<td><input type="checkbox" '. |
} else { |
|
$rowColor = $rowColor2; |
|
} |
|
$r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '. |
|
'name="autorole" value="'.$role.'"></td><td>'.$plrole. |
'name="autorole" value="'.$role.'"></td><td>'.$plrole. |
'</td>'.$sections_sel.'</tr>'); |
'</td>'.$sections_sel. |
$rowNum ++; |
&Apache::loncommon::end_data_table_row()); |
} |
} |
foreach my $role (sort(keys(%customroles))) { |
foreach my $role (sort(keys(%customroles))) { |
my $sections_sel; |
my $sections_sel; |
if (@sections > 0) { |
if (@sections > 0) { |
$sections_sel = '<td>'.§ions_selection(\@sections,'sec_'.$role). |
$sections_sel = |
'</td>'; |
'<td>'.§ions_selection(\@sections,'sec_'.$role).'</td>'; |
} |
} |
if ($rowNum %2 == 1) { |
$r->print(&Apache::loncommon::start_data_table_row(). |
$rowColor = $rowColor1; |
'<td><input type="checkbox" '. |
} else { |
|
$rowColor = $rowColor2; |
|
} |
|
$r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '. |
|
'value="'.$role.'"></td><td>'.$role.'</td>'. |
'value="'.$role.'"></td><td>'.$role.'</td>'. |
$sections_sel.'</tr>'); |
$sections_sel. |
$rowNum ++; |
&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::loncommon::end_data_table()); |
return; |
return; |
} |
} |
|
|