version 1.29, 2006/06/28 23:38:09
|
version 1.47, 2006/07/07 21:04:57
|
Line 89 sub handler {
|
Line 89 sub handler {
|
$idx{fullname} = &Apache::loncoursedata::CL_FULLNAME(); |
$idx{fullname} = &Apache::loncoursedata::CL_FULLNAME(); |
$idx{udom} = &Apache::loncoursedata::CL_SDOM(); |
$idx{udom} = &Apache::loncoursedata::CL_SDOM(); |
$idx{uname} = &Apache::loncoursedata::CL_SNAME(); |
$idx{uname} = &Apache::loncoursedata::CL_SNAME(); |
|
$idx{section} = &Apache::loncoursedata::CL_SECTION(); |
|
|
my $rowColor1 = "#dddddd"; |
my $rowColor1 = "#dddddd"; |
my $rowColor2 = "#eeeeee"; |
my $rowColor2 = "#eeeeee"; |
Line 102 sub handler {
|
Line 103 sub handler {
|
} |
} |
if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { |
if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { |
if ($view_permission || $manage_permission) { |
if ($view_permission || $manage_permission) { |
&group_administration($r,$action,$state,$cdom,$cnum,$function, |
&group_administration($r,$action,$state,$cdom,$cnum, |
$tabcol,\%functions,\%idx,$view_permission, |
$tabcol,\%functions,\%idx,$view_permission, |
$manage_permission,$rowColor1,$rowColor2, |
$manage_permission,$rowColor1,$rowColor2, |
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
Line 111 sub handler {
|
Line 112 sub handler {
|
'privileges in this [_2]',$gpterm,lc($crstype))); |
'privileges in this [_2]',$gpterm,lc($crstype))); |
} |
} |
} else { |
} else { |
&print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, |
&print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission, |
$view_permission,$manage_permission,$action,$state, |
$manage_permission,$action,$state,$gpterm,$ucgpterm, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$crstype); |
} |
} |
return OK; |
return OK; |
} |
} |
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
my ($r,$cdom,$cnum,$functions,$idx,$view_permission,$manage_permission, |
$manage_permission,$action,$state,$rowColor1,$rowColor2,$gpterm, |
$action,$state,$gpterm,$ucgpterm,$crstype) = @_; |
$ucgpterm,$crstype) = @_; |
|
my $pagename = "$crstype $ucgpterm".'s'; |
my $pagename = "$crstype $ucgpterm".'s'; |
my $jscript = qq| |
my $jscript = qq| |
function changeSort(caller) { |
function changeSort(caller) { |
document.$state.sortby.value = caller; |
document.$state.sortby.value = caller; |
document.$state.submit(); |
document.$state.submit(); |
}\n|; |
}\n|; |
$r->print(&header($pagename,$jscript,$action,$state, |
$r->print(&header($pagename,$jscript,$action,$state)); |
undef,$function)); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/coursegroups", |
({href=>"/adm/coursegroups", |
text=>"$pagename"}); |
text=>"$pagename"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs($pagename)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs($pagename)); |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission, |
$view_permission,$manage_permission,$action,$state, |
$manage_permission,$action,$state,$gpterm,$ucgpterm, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$crstype); |
$r->print(&footer()); |
$r->print(&footer()); |
return; |
return; |
} |
} |
|
|
sub display_groups { |
sub display_groups { |
my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, |
my ($r,$cdom,$cnum,$functions,$idx,$view_permission, |
$manage_permission,$action,$state,$rowColor1,$rowColor2,$gpterm, |
$manage_permission,$action,$state,$gpterm,$ucgpterm,$crstype) = @_; |
$ucgpterm,$crstype) = @_; |
|
my %curr_groups = (); |
my %curr_groups = (); |
my %grp_info = (); |
my %grp_info = (); |
my %actionlinks = ( |
my %actionlinks = ( |
Line 187 sub display_groups {
|
Line 185 sub display_groups {
|
$r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>'); |
$r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>'); |
} |
} |
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row()); |
|
|
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="4" cellspacing="1"> |
<th>$lt{'act'}</th> |
<tr bgcolor="$tabcol" align="center"> |
<th><a href="javascript:changeSort('groupname')">$lt{'gname'}</a></th> |
<td><b>$lt{'act'}</b></td> |
<th><a href="javascript:changeSort('description')">$lt{'desc'}</a></th> |
<td><b><a href="javascript:changeSort('groupname')">$lt{'gname'}</a></b></td> |
<th><a href="javascript:changeSort('creator')">$lt{'crea'}</a></th> |
<td><b><a href="javascript:changeSort('description')">$lt{'desc'}</a></b></td> |
<th><a href="javascript:changeSort('creation')">$lt{'crtd'}</a></th> |
<td><b><a href="javascript:changeSort('creator')">$lt{'crea'}</a></b> |
<th><a href="javascript:changeSort('modified')">$lt{'last'}</a></th> |
</td> |
<th>$lt{'func'}</b></td> |
<td><b><a href="javascript:changeSort('creation')">$lt{'crtd'}</a></b> |
<th><a href="javascript:changeSort('quota')">$lt{'quot'}</a></th> |
</td> |
<th><a href="javascript:changeSort('totalmembers')">$lt{'memb'}</a></th> |
<td><b><a href="javascript:changeSort('modified')">$lt{'last'}</a></b> |
<th><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></th> |
</td> |
<th><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></th> |
<td><b>$lt{'func'}</b> |
<th><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></th> |
</td> |
|
<td><b><a href="javascript:changeSort('quota')">$lt{'quot'}</a></b></td> |
|
<td><b><a href="javascript:changeSort('totalmembers')">$lt{'memb'}</a></b></td> |
|
<td><b><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></b></td> |
|
<td><b><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></b></td> |
|
<td><b><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></b></td> |
|
</tr> |
|
END |
END |
|
$r->print(&Apache::loncommon::end_data_table_header_row()); |
my %Sortby = (); |
my %Sortby = (); |
foreach my $group (sort(keys(%curr_groups))) { |
foreach my $group (sort(keys(%curr_groups))) { |
%{$grp_info{$group}} = |
%{$grp_info{$group}} = |
Line 229 END
|
Line 223 END
|
$grp_info{$group}{'diskuse'} = sprintf("%.0f",$pct_use); |
$grp_info{$group}{'diskuse'} = sprintf("%.0f",$pct_use); |
} else { |
} else { |
$grp_info{$group}{'diskuse'} = 'N/A'; |
$grp_info{$group}{'diskuse'} = 'N/A'; |
} |
} |
|
my ($groupboards,$boardshash)=&Apache::longroup::get_group_bbinfo( |
|
$cdom,$cnum,$group); |
|
$grp_info{$group}{'boards'} = scalar(@{$groupboards}); |
if ($env{'form.sortby'} eq 'groupname') { |
if ($env{'form.sortby'} eq 'groupname') { |
push(@{$Sortby{$group}},$group); |
push(@{$Sortby{$group}},$group); |
} elsif ($env{'form.sortby'} eq 'description') { |
} elsif ($env{'form.sortby'} eq 'description') { |
Line 255 END
|
Line 252 END
|
push(@{$Sortby{$group}},$group); |
push(@{$Sortby{$group}},$group); |
} |
} |
} |
} |
my $rowNum = 0; |
|
my $rowColor; |
|
foreach my $key (sort(keys(%Sortby))) { |
foreach my $key (sort(keys(%Sortby))) { |
foreach my $group (@{$Sortby{$key}}) { |
foreach my $group (@{$Sortby{$key}}) { |
if ($rowNum %2 == 1) { |
|
$rowColor = $rowColor1; |
|
} else { |
|
$rowColor = $rowColor2; |
|
} |
|
my $description = |
my $description = |
&unescape($grp_info{$group}{'description'}); |
&unescape($grp_info{$group}{'description'}); |
my $creator = $grp_info{$group}{'creator'}; |
my $creator = $grp_info{$group}{'creator'}; |
my $creation = $grp_info{$group}{'creation'}; |
my $creation = $grp_info{$group}{'creation'}; |
my $modified = $grp_info{$group}{'modified'}; |
my $modified = $grp_info{$group}{'modified'}; |
Line 298 END
|
Line 288 END
|
$group.'">'.$lt{'modify'}.'</a>'; |
$group.'">'.$lt{'modify'}.'</a>'; |
} |
} |
} |
} |
$r->print('<tr bgcolor="'.$rowColor.'"><td><small>'.$link.'</small></td><td><small>'.$group.'</small></td><td><small>'.$description.'</small></td><td><small>'.$creator.'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($creation).'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($modified).'</small></td><td><small>'.$functionality.'</small></td><td><small>'.$quota.'</small></td><td><small>'.$totalmembers.'</small></td><td><small><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></small></td><td><small>'.$boards.'</small></td><td><small>'.$diskuse.'</small></td></tr>'); |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense'). |
$rowNum ++; |
'<td>'.$link.'</td>'. |
|
'<td>'.$group.'</td>'. |
|
'<td>'.$description.'</td>'. |
|
'<td>'.$creator.'</td>'. |
|
'<td>'. &Apache::lonnavmaps::timeToHumanString($creation).'</td>'. |
|
'<td>'. &Apache::lonnavmaps::timeToHumanString($modified).'</td>'. |
|
'<td>'.$functionality.'</td>'. |
|
'<td align="right">'.$quota.'</td>'. |
|
'<td align="right">'.$totalmembers.'</td>'. |
|
'<td align="right"><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></td>'. |
|
'<td align="right">'.$boards.'</td>'. |
|
'<td align="right">'.$diskuse.'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
$r->print('</table>'); |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print('<input type="hidden" name="refpage" '. |
$r->print('<input type="hidden" name="refpage" '. |
'value="'.$env{'form.refpage'}.'" />'); |
'value="'.$env{'form.refpage'}.'" />'); |
if ($action eq 'view') { |
if ($action eq 'view') { |
Line 347 END
|
Line 348 END
|
} |
} |
|
|
sub group_administration { |
sub group_administration { |
my ($r,$action,$state,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
my ($r,$action,$state,$cdom,$cnum,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$rowColor1,$rowColor2,$gpterm, |
$view_permission,$manage_permission,$rowColor1,$rowColor2,$gpterm, |
$ucgpterm,$crstype) = @_; |
$ucgpterm,$crstype) = @_; |
my %sectioncount = (); |
my %sectioncount = (); |
Line 364 sub group_administration {
|
Line 365 sub group_administration {
|
my @member_changes = ('deletion','expire','activate','reenable', |
my @member_changes = ('deletion','expire','activate','reenable', |
'changefunc','changepriv'); |
'changefunc','changepriv'); |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity, |
my ($groupname,$description,$startdate,$enddate,$granularity,$specificity, |
$quota); |
$quota,$validate_script); |
|
|
if (defined($env{'form.groupname'})) { |
if (defined($env{'form.groupname'})) { |
$groupname = $env{'form.groupname'}; |
$groupname = $env{'form.groupname'}; |
Line 434 sub group_administration {
|
Line 435 sub group_administration {
|
} |
} |
} |
} |
|
|
my %toolprivs = |
my $toolprivs = &Apache::longroup::get_tool_privs($gpterm); |
( |
|
email => { |
|
sgm => 'Send '.$gpterm.' mail', |
|
sgb => 'Broadcast mail', |
|
}, |
|
discussion => { |
|
cgb => 'Create boards', |
|
pgd => 'Post', |
|
pag => 'Anon. posts', |
|
rgi => 'Get identities', |
|
vgb => 'View boards', |
|
}, |
|
chat => { |
|
pgc => 'Chat', |
|
}, |
|
files => { |
|
rgf => 'Retrieve', |
|
ugf => 'Upload', |
|
mgf => 'Modify', |
|
dgf => 'Delete', |
|
agf => 'Control Access', |
|
}, |
|
roster => { |
|
vgm => 'View', |
|
}, |
|
homepage => { |
|
vgh => 'View page', |
|
mgh => 'Modify page', |
|
}, |
|
); |
|
|
|
my %fixedprivs = |
my $fixedprivs = &Apache::longroup::get_fixed_privs(); |
( |
|
email => {sgm => 1}, |
|
discussion => {vgb => 1}, |
|
chat => {pgc => 1}, |
|
files => {rgf => 1}, |
|
roster => {vgm => 1}, |
|
homepage => {vgh => 1}, |
|
); |
|
|
|
my %elements = |
my %elements = |
( |
( |
Line 682 sub group_administration {
|
Line 645 sub group_administration {
|
} |
} |
my @currtools = (); |
my @currtools = (); |
if (@userprivs > 0) { |
if (@userprivs > 0) { |
foreach my $tool (sort(keys(%fixedprivs))) { |
foreach my $tool (sort(keys(%{$fixedprivs}))) { |
foreach my $priv (keys(%{$fixedprivs{$tool}})) { |
foreach my $priv (keys(%{$$fixedprivs{$tool}})) { |
if (grep/^$priv$/,@userprivs) { |
if (grep/^$priv$/,@userprivs) { |
push(@currtools,$tool); |
push(@currtools,$tool); |
last; |
last; |
Line 753 sub group_administration {
|
Line 716 sub group_administration {
|
&& ($specificity eq 'Yes')) { |
&& ($specificity eq 'Yes')) { |
foreach my $user (sort(keys(%usertools))) { |
foreach my $user (sort(keys(%usertools))) { |
foreach my $tool (keys(%{$usertools{$user}})) { |
foreach my $tool (keys(%{$usertools{$user}})) { |
foreach my $priv (keys(%{$toolprivs{$tool}})) { |
foreach my $priv (keys(%{$$toolprivs{$tool}})) { |
unless (exists($fixedprivs{$tool}{$priv})) { |
unless (exists($$fixedprivs{$tool}{$priv})) { |
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
$elements{$action}{$state}{'userpriv_'.$priv} = 'checkbox'; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
|
if (($action eq 'create' && $state eq 'pick_name') || |
|
($action eq 'modify' && $state eq 'change_settings')) { |
|
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,\%stored); |
|
my $space_trim = '/^\s*|\s*\$/g,""'; |
|
my $float_check = '/^([0-9]*\.?[0-9]*)$/'; |
|
$validate_script = ' |
|
var newquota = document.'.$state.'.quota.value; |
|
newquota.replace('.$space_trim.'); |
|
if (newquota == "" ) { |
|
document.'.$state.'.quota.value = 0; |
|
newquota = 0; |
|
} |
|
var maxposs = '.$maxposs.'; |
|
if (newquota > maxposs) { |
|
alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number."); |
|
return; |
|
} |
|
var re_quota = '.$float_check.'; |
|
var check_quota = newquota.match(re_quota); |
|
if (check_quota == null) { |
|
alert("The quota you entered contains invalid characters, the quota should only include numbers, with or without a decimal point."); |
|
return; |
|
} |
|
if (newquota == 0) { |
|
var warn_zero = 0; |
|
for (var i=0; i<document.'.$state.'.tool.length; i++) { |
|
if (document.'.$state.'.tool[i].value == "files") { |
|
if (document.'.$state.'.tool[i].checked) { |
|
warn_zero = 1; |
|
} |
|
} |
|
} |
|
if (warn_zero == 1) { |
|
alert("You have indicated that the file repository should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); |
|
return; |
|
} |
|
} |
|
'; |
|
} |
my $jscript = &Apache::loncommon::check_uncheck_jscript(); |
my $jscript = &Apache::loncommon::check_uncheck_jscript(); |
$jscript .= qq| |
$jscript .= qq| |
function nextPage(formname,nextstate) { |
function nextPage(formname,nextstate) { |
formname.state.value= nextstate; |
formname.state.value= nextstate; |
|
$validate_script |
formname.submit(); |
formname.submit(); |
} |
} |
function backPage(formname,prevstate) { |
function backPage(formname,prevstate) { |
Line 811 function changeSort(caller) {
|
Line 814 function changeSort(caller) {
|
my $loaditems = &onload_action($action,$state); |
my $loaditems = &onload_action($action,$state); |
my $crumbtitle = "$crstype $ucgpterm".'s'; |
my $crumbtitle = "$crstype $ucgpterm".'s'; |
$r->print(&header("$crumbtitle Manager", |
$r->print(&header("$crumbtitle Manager", |
$jscript,$action,$state,$page,$function,$loaditems)); |
$jscript,$action,$state,$page,$loaditems)); |
|
|
if ($env{'form.refpage'} eq 'enrl') { |
if ($env{'form.refpage'} eq 'enrl') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 864 function changeSort(caller) {
|
Line 867 function changeSort(caller) {
|
("$crumbtitle Manager")); |
("$crumbtitle Manager")); |
&display_control($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&display_control($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
\%sectioncount,$groupname,$description,$functions, |
\%sectioncount,$groupname,$description,$functions, |
\@tools,\%toolprivs,\%fixedprivs,$startdate,$enddate, |
\@tools,$toolprivs,$fixedprivs,$startdate,$enddate, |
\%users,\%userdata,$idx,\%memchg,\%usertools, |
\%users,\%userdata,$idx,\%memchg,\%usertools, |
$function,$view_permission,$manage_permission, |
$view_permission,$manage_permission, |
\%stored,$granularity,$quota,$specificity,\@types,\@roles, |
\%stored,$granularity,$quota,$specificity,\@types,\@roles, |
\@sections,\%states,\%navbuttons,$rowColor1,$rowColor2, |
\@sections,\%states,\%navbuttons,$rowColor1,$rowColor2, |
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
Line 889 function changeSort(caller) {
|
Line 892 function changeSort(caller) {
|
my $crumbtitle = "$crstype $ucgpterm".'s Manager'; |
my $crumbtitle = "$crstype $ucgpterm".'s Manager'; |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(&mt($crumbtitle))); |
(&mt($crumbtitle))); |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission, |
$view_permission,$manage_permission,$action,$state, |
$manage_permission,$action,$state,$gpterm,$ucgpterm, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$crstype); |
|
|
} |
} |
$r->print(&footer()); |
$r->print(&footer()); |
Line 959 sub retrieve_settings {
|
Line 962 sub retrieve_settings {
|
sub display_control { |
sub display_control { |
my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$sectioncount,$groupname, |
my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$sectioncount,$groupname, |
$description,$functions,$tools,$toolprivs,$fixedprivs,$startdate, |
$description,$functions,$tools,$toolprivs,$fixedprivs,$startdate, |
$enddate,$users,$userdata,$idx,$memchg,$usertools,$function, |
$enddate,$users,$userdata,$idx,$memchg,$usertools, |
$view_permission,$manage_permission,$stored,$granularity,$quota, |
$view_permission,$manage_permission,$stored,$granularity,$quota, |
$specificity,$types,$roles,$sections,$states,$navbuttons,$rowColor1, |
$specificity,$types,$roles,$sections,$states,$navbuttons,$rowColor1, |
$rowColor2,$gpterm,$ucgpterm,$crstype) = @_; |
$rowColor2,$gpterm,$ucgpterm,$crstype) = @_; |
if ($action eq 'create') { |
if ($action eq 'create') { |
if ($state eq 'pick_name') { |
if ($state eq 'pick_name') { |
&general_settings_form($r,$cdom,$cnum,$action,$tabcol,$state,$page, |
&general_settings_form($r,$cdom,$cnum,$action,$state,$page, |
$functions,$tools,$toolprivs,$fixedprivs, |
$functions,$tools,$toolprivs,$fixedprivs, |
$sectioncount,$stored,$states,$navbuttons, |
$sectioncount,$stored,$states,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm, |
$gpterm,$ucgpterm,$crstype); |
$crstype); |
|
} elsif ($state eq 'pick_members') { |
} elsif ($state eq 'pick_members') { |
&choose_members_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&choose_members_form($r,$cdom,$cnum,$action,$state,$page, |
$groupname,$description,$granularity,$quota, |
$groupname,$description,$granularity,$quota, |
$startdate,$enddate,$tools,$fixedprivs, |
$startdate,$enddate,$tools,$fixedprivs, |
$toolprivs,$functions,$users,$userdata,$idx, |
$toolprivs,$functions,$users,$userdata,$idx, |
$stored,$states,$navbuttons,$rowColor1, |
$stored,$states,$navbuttons,$gpterm,$ucgpterm, |
$rowColor2,$gpterm,$ucgpterm,$crstype); |
$crstype); |
} elsif ($state eq 'pick_privs') { |
} elsif ($state eq 'pick_privs') { |
&choose_privs_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&choose_privs_form($r,$cdom,$cnum,$action,$state,$page, |
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$idx,$states,$stored,$sectioncount,$navbuttons, |
$idx,$states,$stored,$sectioncount,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm, |
$gpterm,$ucgpterm,$crstype); |
$crstype); |
|
} elsif ($state eq 'result') { |
} elsif ($state eq 'result') { |
&process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&process_request($r,$cdom,$cnum,$action,$state,$page, |
$groupname,$description,$specificity,$userdata, |
$groupname,$description,$specificity,$userdata, |
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$usertools,$idx,$types,$roles, |
$toolprivs,$usertools,$idx,$types,$roles, |
$sections,$states,$navbuttons,$memchg, |
$sections,$states,$navbuttons,$memchg, |
$sectioncount,$stored,$rowColor1,$rowColor2, |
$sectioncount,$stored,$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
|
} |
} |
} elsif ($action eq 'modify') { |
} elsif ($action eq 'modify') { |
my $groupname = $env{'form.groupname'}; |
my $groupname = $env{'form.groupname'}; |
if ($state eq 'pick_group') { |
if ($state eq 'pick_group') { |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission, |
$view_permission,$manage_permission,$action,$state, |
$manage_permission,$action,$state,$gpterm, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$ucgpterm,$crstype); |
} elsif ($state eq 'pick_task') { |
} elsif ($state eq 'pick_task') { |
&modify_menu($r,$groupname,$page,$gpterm); |
&modify_menu($r,$groupname,$page,$gpterm); |
} elsif ($state eq 'change_settings') { |
} elsif ($state eq 'change_settings') { |
&general_settings_form($r,$cdom,$cnum,$action,$tabcol,$state,$page, |
&general_settings_form($r,$cdom,$cnum,$action,$state,$page, |
$functions,$tools,$toolprivs,$fixedprivs, |
$functions,$tools,$toolprivs,$fixedprivs, |
$sectioncount,$stored,$states,$navbuttons, |
$sectioncount,$stored,$states,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm, |
$gpterm,$ucgpterm,$crstype); |
$crstype); |
|
} elsif ($state eq 'change_members') { |
} elsif ($state eq 'change_members') { |
&change_members_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&change_members_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
$groupname,$description,$startdate,$enddate, |
$groupname,$description,$startdate,$enddate, |
Line 1015 sub display_control {
|
Line 1014 sub display_control {
|
$idx,$states,$navbuttons,$rowColor1,$rowColor2, |
$idx,$states,$navbuttons,$rowColor1,$rowColor2, |
$gpterm,$ucgpterm); |
$gpterm,$ucgpterm); |
} elsif ($state eq 'add_members') { |
} elsif ($state eq 'add_members') { |
&add_members_form($r,$tabcol,$action,$state,$page,$startdate, |
&add_members_form($r,$action,$state,$page,$startdate, |
$enddate,$groupname,$description,$granularity, |
$enddate,$groupname,$description,$granularity, |
$quota,$sectioncount,$tools,$functions,$stored, |
$quota,$sectioncount,$tools,$functions,$stored, |
$states,$navbuttons,$rowColor1,$rowColor2,$gpterm, |
$states,$navbuttons,$gpterm,$ucgpterm); |
$ucgpterm); |
|
} elsif ($state eq 'pick_members') { |
} elsif ($state eq 'pick_members') { |
&choose_members_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&choose_members_form($r,$cdom,$cnum,$action,$state,$page, |
$groupname,$description,$granularity,$quota, |
$groupname,$description,$granularity,$quota, |
$startdate,$enddate,$tools,$fixedprivs, |
$startdate,$enddate,$tools,$fixedprivs, |
$toolprivs,$functions,$users,$userdata,$idx, |
$toolprivs,$functions,$users,$userdata,$idx, |
$stored,$states,$navbuttons,$rowColor1, |
$stored,$states,$navbuttons,$gpterm,$ucgpterm, |
$rowColor2,$gpterm,$ucgpterm,$crstype); |
$crstype); |
} elsif ($state eq 'pick_privs') { |
} elsif ($state eq 'pick_privs') { |
&choose_privs_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&choose_privs_form($r,$cdom,$cnum,$action,$state,$page, |
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$idx,$states,$stored,$sectioncount,$navbuttons, |
$idx,$states,$stored,$sectioncount,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
} elsif ($state eq 'change_privs') { |
} elsif ($state eq 'change_privs') { |
&change_privs_form($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&change_privs_form($r,$cdom,$cnum,$action,$state,$page, |
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$toolprivs,$fixedprivs,$userdata,$usertools, |
$memchg,$idx,$states,$stored,$sectioncount, |
$memchg,$idx,$states,$stored,$sectioncount, |
$navbuttons,$rowColor1,$rowColor2,$gpterm, |
$navbuttons,$gpterm,$ucgpterm); |
$ucgpterm); |
|
} elsif ($state eq 'chgresult' || $state eq 'memresult' || |
} elsif ($state eq 'chgresult' || $state eq 'memresult' || |
$state eq 'addresult') { |
$state eq 'addresult') { |
&process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page, |
&process_request($r,$cdom,$cnum,$action,$state,$page, |
$groupname,$description,$specificity,$userdata, |
$groupname,$description,$specificity,$userdata, |
$startdate,$enddate,$tools,$functions, |
$startdate,$enddate,$tools,$functions, |
$toolprivs,$usertools,$idx,$types,$roles, |
$toolprivs,$usertools,$idx,$types,$roles, |
$sections,$states,$navbuttons,$memchg, |
$sections,$states,$navbuttons,$memchg, |
$sectioncount,$stored,$rowColor1,$rowColor2, |
$sectioncount,$stored,$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
|
} |
} |
} |
} |
} |
} |
|
|
sub header { |
sub header { |
my ($bodytitle,$jscript,$action,$state,$page,$function,$loaditems) = @_; |
my ($bodytitle,$jscript,$action,$state,$page,$loaditems) = @_; |
my $start_page= |
my $start_page= |
&Apache::loncommon::start_page($bodytitle, |
&Apache::loncommon::start_page($bodytitle, |
'<script type="text/javascript">'. |
'<script type="text/javascript">'. |
$jscript.'</script>', |
$jscript.'</script>', |
{'function' => $function, |
{'add_entries' => $loaditems,}); |
'add_entries' => $loaditems,}); |
|
my $output = <<"END"; |
my $output = <<"END"; |
$start_page |
$start_page |
<form method="POST" name="$state"> |
<form method="POST" name="$state"> |
Line 1169 sub group_members {
|
Line 1164 sub group_members {
|
if ($totalmembers == 0) { |
if ($totalmembers == 0) { |
$$group_info{$group}{'totalmembers'} = 'None'; |
$$group_info{$group}{'totalmembers'} = 'None'; |
} else { |
} else { |
$$group_info{$group}{'totalmembers'} = $active.' - active<br />'.$previous.' -previous<br />'.$future.' -future'; |
$$group_info{$group}{'totalmembers'} = '<nobr>'.$active. |
|
' - active</nobr><br /><nobr>'.$previous. |
|
' - previous</nobr><br /><nobr>'.$future. |
|
' - future</nobr>'; |
} |
} |
return 'ok'; |
return 'ok'; |
} |
} |
|
|
|
|
sub general_settings_form { |
sub general_settings_form { |
my ($r,$cdom,$cnum,$action,$tabcol,$formname,$page,$functions,$tools, |
my ($r,$cdom,$cnum,$action,$formname,$page,$functions,$tools, |
$toolprivs,$fixedprivs,$sectioncount,$stored,$states,$navbuttons, |
$toolprivs,$fixedprivs,$sectioncount,$stored,$states,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype) = @_; |
$gpterm,$ucgpterm,$crstype) = @_; |
my ($nexttext,$prevtext); |
my ($nexttext,$prevtext); |
$r->print(' <br /> |
&groupsettings_options($r,$functions,$action,$formname,$stored,1, |
<table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
'); |
|
&groupsettings_options($r,$tabcol,$functions,$action,$formname,$stored,1, |
|
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
$r->print(' |
&access_date_settings($r,$action,$formname,$stored,2,$gpterm,$ucgpterm); |
<tr> |
|
<td colspan="4"> </td> |
|
</tr>'); |
|
&access_date_settings($r,$tabcol,$action,$formname,$stored,2,$gpterm, |
|
$ucgpterm); |
|
$r->print(' |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr>'); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
&membership_options($r,$action,$formname,$tabcol,$sectioncount,3, |
&membership_options($r,$action,$formname,$sectioncount,3,$gpterm, |
$gpterm,$ucgpterm); |
$ucgpterm); |
$nexttext = $$navbuttons{'gtns'}; |
$nexttext = $$navbuttons{'gtns'}; |
} else { |
} else { |
my @available = (); |
my @available = (); |
my @unavailable = (); |
my @unavailable = (); |
&check_tools($functions,$tools,\@available,\@unavailable); |
&check_tools($functions,$tools,\@available,\@unavailable); |
@{$tools} = sort(keys(%{$functions})); |
@{$tools} = sort(keys(%{$functions})); |
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
&privilege_specificity($r,$action,3,$tools,$stored,$toolprivs, |
3,$tools,$stored,$toolprivs,$fixedprivs, |
$fixedprivs,\@available,$formname, |
\@available,$formname,$gpterm,$ucgpterm); |
$gpterm,$ucgpterm); |
$r->print(' |
&mapping_options($r,$action,$formname,$page,$sectioncount, |
<tr> |
$states,$stored,$navbuttons,4,5, |
<td colspan="4"> </td> |
$gpterm,$ucgpterm,$crstype); |
</tr>'); |
|
&mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount, |
|
$states,$stored,$navbuttons,4,5,$rowColor1, |
|
$rowColor2,$gpterm,$ucgpterm,$crstype); |
|
$nexttext = $$navbuttons{'mose'}; |
$nexttext = $$navbuttons{'mose'}; |
} |
} |
$prevtext = $$navbuttons{'gtpp'}; |
$prevtext = $$navbuttons{'gtpp'}; |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
$$states{$action}[$page+1],$nexttext); |
$$states{$action}[$page+1],$nexttext); |
$r->print(' |
|
</table>'); |
|
return; |
return; |
} |
} |
|
|
sub groupsettings_options { |
sub groupsettings_options { |
my ($r,$tabcol,$functions,$action,$formname,$stored,$image,$gpterm, |
my ($r,$functions,$action,$formname,$stored,$image,$gpterm, |
$ucgpterm,$crstype) = @_; |
$ucgpterm,$crstype) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'gdat' => "$ucgpterm open and close dates", |
'gdat' => "$ucgpterm open and close dates", |
Line 1238 sub groupsettings_options {
|
Line 1218 sub groupsettings_options {
|
'doyo' => "Do you want to assign different functionality ". |
'doyo' => "Do you want to assign different functionality ". |
"to different $gpterm members?", |
"to different $gpterm members?", |
); |
); |
my $crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'}; |
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored); |
if ($crsquota eq '') { |
&topic_bar($r,$image,$lt{'gnde'}); |
$crsquota = 20; |
|
} |
|
my $freespace = $crsquota - &Apache::longroup::sum_quotas(); |
|
my $maxposs = $$stored{'quota'} + $freespace; |
|
&topic_bar($r,$tabcol,$image,$lt{'gnde'}); |
|
$r->print(' |
$r->print(' |
<tr> |
<table class="LC_descriptive_input"> |
<td> </td> |
|
<td colspan="3"> |
|
<table border="0" cellpadding="2" cellspacing="2"> |
|
<tr> |
<tr> |
<td><b>'.$lt{'gnam'}.':</b></td> |
<td class="LC_description">'.$lt{'gnam'}.':</td> |
<td colspan="5"> |
<td colspan="5"> |
'); |
'); |
if ($action eq 'create') { |
if ($action eq 'create') { |
Line 1264 sub groupsettings_options {
|
Line 1236 sub groupsettings_options {
|
</td> |
</td> |
<tr> |
<tr> |
<tr> |
<tr> |
<td><b>$lt{'desc'}:</b></td> |
<td class="LC_description">$lt{'desc'}:</td> |
<td colspan="5"><input type="text" name="description" size="40" |
<td colspan="5"><input type="text" name="description" size="40" |
value="" /> |
value="" /> |
</td> |
</td> |
<tr> |
<tr> |
<tr> |
<tr> |
<td><b>$lt{'func'}:</b></td> |
<td class="LC_description">$lt{'func'}:</td> |
END |
END |
my $numitems = keys(%{$functions}); |
my $numitems = keys(%{$functions}); |
my $halfnum = int($numitems/2); |
my $halfnum = int($numitems/2); |
Line 1304 END
|
Line 1276 END
|
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td><b>'.&mt('Granularity:').'</b></td> |
<td class="LC_description">'.&mt('Granularity:').'</td> |
<td colspan="10">'.$lt{'doyo'}.' <label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label> <label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>'); |
<td colspan="10">'.$lt{'doyo'}.' <label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label> <label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>'); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.&mt('Currently set to "[_1]"', |
$r->print(' ('.&mt('Currently set to "[_1]"', |
Line 1314 END
|
Line 1286 END
|
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td valign="top">'.&mt('<b>Disk quota:</b> ').'</td><td colspan="10">'); |
<td class="LC_description">'.&mt('Disk quota: ').'</td><td colspan="10">'); |
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print(&mt('If you enable the file repository for the [_1], allocate a disk quota.',$gpterm)); |
$r->print(&mt('If you enable the file repository for the [_1], allocate a disk quota.',$gpterm)); |
} else { |
} else { |
Line 1338 END
|
Line 1310 END
|
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
</td> |
|
</tr> |
|
'); |
'); |
return; |
return; |
} |
} |
|
|
|
sub get_quota_constraints { |
|
my ($action,$stored) = @_; |
|
my ($crsquota,$freespace,$maxposs); |
|
$crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'}; |
|
if ($crsquota eq '') { |
|
$crsquota = 20; |
|
} |
|
$freespace = $crsquota - &Apache::longroup::sum_quotas(); |
|
if ($action eq 'create') { |
|
$maxposs = $freespace; |
|
} else { |
|
$maxposs = $$stored{'quota'} + $freespace; |
|
} |
|
return ($crsquota,$freespace,$maxposs); |
|
} |
|
|
sub membership_options { |
sub membership_options { |
my ($r,$action,$state,$tabcol,$sectioncount,$image,$gpterm,$ucgpterm) = @_; |
my ($r,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm) = @_; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'pipa' => 'Pick parameters to generate membership list', |
'pipa' => 'Pick parameters to generate membership list', |
Line 1367 sub membership_options {
|
Line 1353 sub membership_options {
|
future => &mt('Will have future access'), |
future => &mt('Will have future access'), |
); |
); |
|
|
my @roles = ('st','cc','in','ta','ep','cr'); |
#FIXME need to plumb around for the various cr roles defined by the user |
|
my @roles = ('st','cc','in','ta','ep'); |
|
|
my @sections = keys(%{$sectioncount}); |
my @sections = keys(%{$sectioncount}); |
|
|
&topic_bar($r,$tabcol,$image,$lt{'pipa'}); |
&topic_bar($r,$image,$lt{'pipa'}); |
$r->print(' |
$r->print(' |
<tr> |
<b>'.$lt{'gmem'}.'</b><br />'.$lt{'picr'}); |
<td> </td> |
|
<td colspan="3"> |
|
<b>'.$lt{'gmem'}.'</b><br/>'.$lt{'picr'}); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}.'<br />'.$lt{'asub'}); |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}.'<br />'.$lt{'asub'}); |
} else { |
} else { |
Line 1385 sub membership_options {
|
Line 1369 sub membership_options {
|
$r->print(' |
$r->print(' |
<br /> |
<br /> |
<br /> |
<br /> |
<table border="0"> |
<table class="LC_status_selector"> |
<tr> |
<tr> |
<td><b>'.$lt{'acty'}.'</b></td> |
<th>'.$lt{'acty'}.'</th> |
<td> </td> |
<th>'.$lt{'coro'}.'</th>'); |
<td><b>'.$lt{'coro'}.'</b></td>'); |
|
if (@sections >0) { |
if (@sections >0) { |
$r->print(' |
$r->print(' |
<td> </td> |
<th>'.$lt{'cose'}.'</th>'); |
<td><b>'.$lt{'cose'}.'</b></td> |
|
<td> </td>'); |
|
} |
} |
$r->print('</tr><tr>'); |
$r->print('</tr><tr><td>'); |
$r->print(&Apache::lonhtmlcommon::status_select_row(\%status_types)); |
$r->print(&Apache::lonhtmlcommon::status_select_row(\%status_types)); |
$r->print('<td> </td>'); |
$r->print('</td><td>'); |
$r->print(&Apache::lonhtmlcommon::role_select_row(\@roles)); |
$r->print(&Apache::lonhtmlcommon::role_select_row(\@roles)); |
if (@sections > 0) { |
if (@sections > 0) { |
@sections = sort {$a cmp $b} @sections; |
@sections = sort {$a cmp $b} @sections; |
unshift(@sections,'all'); # Put 'all' at the front of the list |
|
unshift(@sections,'none'); # Put 'no sections' next |
unshift(@sections,'none'); # Put 'no sections' next |
$r->print('<td> </td> |
unshift(@sections,'all'); # Put 'all' at the front of the list |
<td colspan="3" align="center" valign="top">'. |
$r->print('</td><td>'. |
§ions_selection(\@sections,'sectionpick').'</td>'); |
§ions_selection(\@sections,'sectionpick').'</td>'); |
} |
} |
$r->print(' |
$r->print(' |
</tr> |
</tr> |
</table> |
</table>'); |
</td> |
|
</tr>'); |
|
return; |
return; |
} |
} |
|
|
Line 1425 sub sections_selection {
|
Line 1403 sub sections_selection {
|
} |
} |
foreach my $sec (@{$sections}) { |
foreach my $sec (@{$sections}) { |
if ($sec eq 'all') { |
if ($sec eq 'all') { |
$section_sel .= ' <option value="'.$sec.'" />all sections'."\n"; |
$section_sel .= ' <option value="'.$sec.'" selected="selected">'.&mt('all sections').'</option>'."\n"; |
} elsif ($sec eq 'none') { |
} elsif ($sec eq 'none') { |
$section_sel .= ' <option value="'.$sec.'" />no section'."\n"; |
$section_sel .= ' <option value="'.$sec.'">'.&mt('no section').'</option>'."\n"; |
} else { |
} else { |
$section_sel .= ' <option value="'.$sec.'" />'.$sec."\n"; |
$section_sel .= ' <option value="'.$sec.'">'.$sec."</option>\n"; |
} |
} |
} |
} |
my $output = ' |
my $output = ' |
Line 1440 sub sections_selection {
|
Line 1418 sub sections_selection {
|
} |
} |
|
|
sub access_date_settings { |
sub access_date_settings { |
my ($r,$tabcol,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_; |
my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'sten' => "Default start and end dates for $gpterm access", |
'sten' => "Default start and end dates for $gpterm access", |
); |
); |
Line 1452 sub access_date_settings {
|
Line 1430 sub access_date_settings {
|
$endtime = $$stored{'enddate'}; |
$endtime = $$stored{'enddate'}; |
} |
} |
} |
} |
my ($start_table,$end_table) = &date_setting_table |
my ($table) = &date_setting_table($starttime,$endtime,$formname); |
($starttime,$endtime,$formname); |
&topic_bar($r,$image,$lt{'sten'}); |
&topic_bar($r,$tabcol,$image,$lt{'sten'}); |
|
$r->print(' |
$r->print(' |
<tr> |
'.$table.' |
<td> </td> |
'); |
<td colspan="3">'.$start_table.'</td> |
|
<tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3">'.$end_table.'</td> |
|
<tr>'); |
|
return; |
return; |
} |
} |
|
|
sub choose_members_form { |
sub choose_members_form { |
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$groupname,$description, |
my ($r,$cdom,$cnum,$action,$formname,$page,$groupname,$description, |
$granularity,$quota,$startdate,$enddate,$tools,$fixedprivs,$toolprivs, |
$granularity,$quota,$startdate,$enddate,$tools,$fixedprivs,$toolprivs, |
$functions,$users,$userdata,$idx,$stored,$states,$navbuttons, |
$functions,$users,$userdata,$idx,$stored,$states,$navbuttons, |
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype) = @_; |
$gpterm,$ucgpterm,$crstype) = @_; |
my @regexps = ('user_','userpriv_','sec_'); |
my @regexps = ('user_','userpriv_','sec_'); |
my %origmembers; |
my %origmembers; |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
Line 1483 sub choose_members_form {
|
Line 1451 sub choose_members_form {
|
\@regexps)); |
\@regexps)); |
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum,$gpterm, |
my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum,$gpterm, |
$ucgpterm,$crstype); |
$ucgpterm,$crstype); |
$r->print(' |
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
if ($earlyout) { |
if ($earlyout) { |
$r->print($earlyout.'</td></tr>'); |
$r->print($earlyout); |
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
$$navbuttons{'gtps'}); |
$$navbuttons{'gtps'}); |
$r->print('</table>'); |
|
return; |
return; |
} |
} |
my ($specimg,$memimg); |
my ($specimg,$memimg); |
Line 1501 sub choose_members_form {
|
Line 1462 sub choose_members_form {
|
my @unavailable = (); |
my @unavailable = (); |
&check_tools($functions,$tools,\@available,\@unavailable); |
&check_tools($functions,$tools,\@available,\@unavailable); |
if ($action eq 'create') { |
if ($action eq 'create') { |
&print_current_settings($r,$action,$tabcol,$rowColor1,$rowColor2, |
&print_current_settings($r,$action,$functions,$startdate,$enddate, |
$functions,$startdate,$enddate,$groupname, |
$groupname,$description,$granularity,$quota, |
$description,$granularity,$quota,\@available, |
\@available,\@unavailable,$gpterm,$ucgpterm); |
\@unavailable,$gpterm,$ucgpterm); |
|
$specimg = 4; |
$specimg = 4; |
$memimg = 5; |
$memimg = 5; |
} else { |
} else { |
Line 1524 sub choose_members_form {
|
Line 1484 sub choose_members_form {
|
} |
} |
} |
} |
} |
} |
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action, |
&privilege_specificity($r,$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 1539 sub choose_members_form {
|
Line 1498 sub choose_members_form {
|
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
&display_navbuttons($r,$formname,$$states{$action}[$page-1], |
$$navbuttons{'gtps'}); |
$$navbuttons{'gtps'}); |
} |
} |
$r->print('</table>'); |
|
return; |
return; |
} |
} |
|
|
sub display_navbuttons { |
sub display_navbuttons { |
my ($r,$formname,$prev,$prevtext,$next,$nexttext) = @_; |
my ($r,$formname,$prev,$prevtext,$next,$nexttext) = @_; |
$r->print(' |
$r->print('<div class="LC_navbuttons">'); |
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3">'); |
|
if ($prev) { |
if ($prev) { |
$r->print(' |
$r->print(' |
<input type="button" name="previous" value = "'.$prevtext.'" |
<input type="button" name="previous" value = "'.$prevtext.'" |
Line 1563 sub display_navbuttons {
|
Line 1515 sub display_navbuttons {
|
<input type="button" name="next" value="'.$nexttext.'" |
<input type="button" name="next" value="'.$nexttext.'" |
onclick="javascript:nextPage(document.'.$formname.','."'".$next."'".')" />'); |
onclick="javascript:nextPage(document.'.$formname.','."'".$next."'".')" />'); |
} |
} |
$r->print(' |
$r->print('</div>'); |
</td> |
|
</tr> |
|
'); |
|
} |
} |
|
|
sub check_tools { |
sub check_tools { |
Line 1582 sub check_tools {
|
Line 1531 sub check_tools {
|
} |
} |
|
|
sub print_current_settings { |
sub print_current_settings { |
my ($r,$action,$tabcol,$rowColor1,$rowColor2,$functions,$startdate,$enddate, |
my ($r,$action,$functions,$startdate,$enddate,$groupname,$description, |
$groupname,$description,$granularity,$quota,$available,$unavailable, |
$granularity,$quota,$available,$unavailable,$gpterm,$ucgpterm) = @_; |
$gpterm,$ucgpterm) = @_; |
|
|
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
grna => "$ucgpterm Name", |
grna => "$ucgpterm Name", |
Line 1606 sub print_current_settings {
|
Line 1554 sub print_current_settings {
|
} else { |
} else { |
$showend = &Apache::lonlocal::locallocaltime($enddate); |
$showend = &Apache::lonlocal::locallocaltime($enddate); |
} |
} |
$r->print('<table border="0" cellpadding="0" cellspacing="20">'); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print(' |
$r->print(' |
<tr> |
<div><span style="font-size: larger">'.$lt{'ygrs'}.'</span> |
<td><font face="arial,helvetica,sans-serif"><b>'.$lt{'ygrs'}.'</b></font> |
|
<br />'.$lt{'tfwa'}.' |
<br />'.$lt{'tfwa'}.' |
</td> |
</div>'); |
</tr>'); |
|
} |
} |
$r->print('<tr><td>'); |
$r->print(&Apache::loncommon::start_data_table('LC_course_group_status'). |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&Apache::loncommon::start_data_table_header_row()); |
$r->print(' |
$r->print(' |
<tr> |
<th>'.$lt{'grna'}.'</th> |
<td> |
<th>'.$lt{'desc'}.'</th> |
<table cellspacing="1" cellpadding="4"> |
<th>'.$lt{'grfn'}.'</th> |
<tr bgcolor="'.$tabcol.'" align="center"> |
<th>'.$lt{'gran'}.'</th> |
<td><b>'.$lt{'grna'}.'</b></td> |
<th>'.$lt{'quot'}.'</th> |
<td><b>'.$lt{'desc'}.'</b></td> |
<th>'.$lt{'dfac'}.'</th> |
<td><b>'.$lt{'grfn'}.'</b></td> |
'); |
<td><b>'.$lt{'gran'}.'</b></td> |
$r->print(&Apache::loncommon::end_data_table_header_row(). |
<td><b>'.$lt{'quot'}.'</b></td> |
&Apache::loncommon::start_data_table_row('LC_data_table_dense')); |
<td><b>'.$lt{'dfac'}.'</b></td> |
$r->print(' |
</tr> |
<td valign="top">'.$groupname.'</td> |
<tr bgcolor="'.$rowColor2.'"> |
<td valign="top">'.$description.'</td> |
<td valign="top"><small>'.$groupname.'</small></td> |
|
<td valign="top"><small>'.$description.'</small></td> |
|
<td> |
<td> |
'); |
'); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
$r->print('<small><b>Available:</b></small> |
$r->print('<b>Available:</b> |
<table cellpadding="" cellspacing="1"><tr>'); |
<table cellpadding="" cellspacing="1"><tr>'); |
my $rowcell = int(@{$available}/2) + @{$available}%2; |
my $rowcell = int(@{$available}/2) + @{$available}%2; |
for (my $i=0; $i<@{$available}; $i++) { |
for (my $i=0; $i<@{$available}; $i++) { |
Line 1644 sub print_current_settings {
|
Line 1587 sub print_current_settings {
|
$r->print('</tr><tr>'); |
$r->print('</tr><tr>'); |
} |
} |
} |
} |
$r->print('<td><small>'.$$functions{$$available[$i]}. |
$r->print('<td>'.$$functions{$$available[$i]}. |
'</small></td><td> </td>'); |
'</td><td> </td>'); |
} |
} |
if ((@{$available} > 3) && (@{$available}%2)) { |
if ((@{$available} > 3) && (@{$available}%2)) { |
$r->print('<td> </td><td> </td>'); |
$r->print('<td> </td><td> </td>'); |
Line 1653 sub print_current_settings {
|
Line 1596 sub print_current_settings {
|
$r->print('</tr></table><br />'); |
$r->print('</tr></table><br />'); |
} |
} |
if (@{$unavailable} > 0) { |
if (@{$unavailable} > 0) { |
$r->print('<small><b>Unavailable:</b></small> |
$r->print('<b>Unavailable:</b> |
<table cellpadding="0" cellspacing="1" border="0"><tr>'); |
<table cellpadding="0" cellspacing="1" border="0"><tr>'); |
my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2; |
my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2; |
for (my $j=0; $j<@{$unavailable}; $j++) { |
for (my $j=0; $j<@{$unavailable}; $j++) { |
Line 1662 sub print_current_settings {
|
Line 1605 sub print_current_settings {
|
$r->print('</tr><tr>'); |
$r->print('</tr><tr>'); |
} |
} |
} |
} |
$r->print('<td><small>'.$$functions{$$unavailable[$j]}. |
$r->print('<td>'.$$functions{$$unavailable[$j]}. |
'</small></td><td> </td>'); |
'</td><td> </td>'); |
} |
} |
if ((@{$unavailable} > 3) && (@{$unavailable}%2)) { |
if ((@{$unavailable} > 3) && (@{$unavailable}%2)) { |
$r->print('<td> </td><td> </td>'); |
$r->print('<td> </td><td> </td>'); |
Line 1672 sub print_current_settings {
|
Line 1615 sub print_current_settings {
|
} |
} |
$r->print(<<"END"); |
$r->print(<<"END"); |
</td> |
</td> |
<td valign="top"><small><b>$lt{'difn'} |
<td valign="top"><b>$lt{'difn'}</b> $granularity</td> |
</b> $granularity</small></td> |
<td valign="top">$quota Mb</td> |
<td valign="top"><small>$quota Mb</small></td> |
<td valign="top"><b>$lt{'stda'}</b> $showstart<br /> |
<td valign="top"><small><b>$lt{'stda'}</b> $showstart<br /> |
<b>$lt{'enda'}</b> $showend |
<b>$lt{'enda'}</b> $showend</small> |
|
</td> |
</td> |
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
END |
END |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::loncommon::end_data_table_row(). |
$r->print('</td></tr></table><br />'); |
&Apache::loncommon::end_data_table()); |
return; |
return; |
} |
} |
|
|
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 1727 sub pick_new_members {
|
Line 1664 sub pick_new_members {
|
$r->print(&check_uncheck_tools($r,$available)); |
$r->print(&check_uncheck_tools($r,$available)); |
} |
} |
} |
} |
&topic_bar($r,$tabcol,$img,$lt{'gpme'}); |
&topic_bar($r,$img,$lt{'gpme'}); |
if (keys(%members) > 0) { |
if (keys(%members) > 0) { |
$r->print(' |
$r->print(' |
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
<table> |
<table> |
<tr>'); |
<tr>'); |
&check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); |
&check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); |
Line 1747 sub pick_new_members {
|
Line 1681 sub pick_new_members {
|
</fieldset></nobr></td>'); |
</fieldset></nobr></td>'); |
} |
} |
$r->print('</tr></table> |
$r->print('</tr></table> |
</td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
'); |
$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(' |
<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> |
|
'); |
'); |
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="5"> </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 1794 sub pick_new_members {
|
Line 1719 sub pick_new_members {
|
push(@{$Sortby{$members{$user}[$$idx{udom}]}},$user); |
push(@{$Sortby{$members{$user}[$$idx{udom}]}},$user); |
} elsif ($env{'form.sortby'} eq 'id') { |
} elsif ($env{'form.sortby'} eq 'id') { |
push(@{$Sortby{$members{$user}[$$idx{id}]}},$user); |
push(@{$Sortby{$members{$user}[$$idx{id}]}},$user); |
|
} elsif ($env{'form.sortby'} eq 'section') { |
|
push(@{$Sortby{$members{$user}[$$idx{section}]}},$user); |
} else { |
} else { |
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}]; |
$r->print('<tr bgcolor="'.$rowColor.'"><td align="right"> |
my $section = $members{$user}[$$idx{section}]; |
<input type="checkbox" name="member" value="'.$user.'" /></td><td><small>'. |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense'). |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
'<td align="right"><input type="checkbox" name="member" value="'.$user.'" /></td>'. |
$udom.'</small></td><td><small>'.$id.'</small></td>'); |
'<td>'.$fullname.'</td>'. |
|
'<td>'.$uname.'</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 1827 sub pick_new_members {
|
Line 1751 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()); |
$r->print(' |
|
</td> |
|
</tr>'); |
|
} else { |
} else { |
$r->print(' |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
if ($totalusers > 0) { |
if ($totalusers > 0) { |
$r->print($lt{'nnew'}.'<br /><br />'.$lt{'yoma'}); |
$r->print($lt{'nnew'}.'<br /><br />'.$lt{'yoma'}); |
} else { |
} else { |
$r->print($lt{'nome'}); |
$r->print($lt{'nome'}); |
} |
} |
$r->print(' |
|
</td> |
|
</tr>'); |
|
} |
} |
return $newusers; |
return $newusers; |
} |
} |
|
|
sub privilege_specificity { |
sub privilege_specificity { |
my ($r,$tabcol,$rowColor1,$rowColor2,$action,$img,$tools,$stored, |
my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available, |
$toolprivs,$fixedprivs,$available,$formname,$gpterm,$ucgpterm) = @_; |
$formname,$gpterm,$ucgpterm) = @_; |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
'uprv' => 'User privileges', |
'uprv' => 'User privileges', |
'frty' => 'For each type of functionality you have chosen to include, '. |
'frty' => 'For each type of functionality you have chosen to include, '. |
Line 1898 sub privilege_specificity {
|
Line 1810 sub privilege_specificity {
|
} |
} |
} |
} |
} |
} |
&topic_bar($r,$tabcol,$img,$lt{'uprv'}); |
&topic_bar($r,$img,$lt{'uprv'}); |
$r->print(' |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
if ((($action eq 'create') && (@{$available} > 0)) || |
if ((($action eq 'create') && (@{$available} > 0)) || |
(($action eq 'modify') && ($formname eq 'change_settings'))) { |
(($action eq 'modify') && ($formname eq 'change_settings'))) { |
my %specific = ( |
my %specific = ( |
Line 1929 sub privilege_specificity {
|
Line 1836 sub privilege_specificity {
|
} |
} |
if ($totaloptionalprivs) { |
if ($totaloptionalprivs) { |
$r->print(' |
$r->print(' |
<br /><br /><label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' /> '.$lt{'algm'}.'</nobr></label><br/> |
<br /><br /> |
<label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' /> '.$lt{'smgp'}.'</nobr></label> |
<label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' /> '.$lt{'algm'}.'</nobr></label><br /> |
</td> |
<label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' /> '.$lt{'smgp'}.'</nobr></label>'); |
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr>'); |
|
} else { |
} else { |
$r->print('<input type="hidden" name="specificity" value="No" />'); |
$r->print('<input type="hidden" name="specificity" value="No" />'); |
} |
} |
if ($totaloptionalprivs) { |
if ($totaloptionalprivs) { |
$r->print(' |
$r->print($lt{'plin'}); |
<tr> |
|
<td> </td> |
|
<td colspan="3">'.$lt{'plin'}); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print(' '.$lt{'thwi'}); |
$r->print(' '.$lt{'thwi'}); |
} |
} |
Line 1954 sub privilege_specificity {
|
Line 1854 sub privilege_specificity {
|
$r->print('('.&mt('if enabled below').').'); |
$r->print('('.&mt('if enabled below').').'); |
} |
} |
$r->print('<br /><br /> |
$r->print('<br /><br /> |
</td> |
<table><tr>'); |
</tr> |
|
<tr> |
|
<td> </td> |
|
<td colspan="2"><table><tr>'); |
|
&check_uncheck_buttons($r,$formname,'defpriv',$lt{'oppr'}); |
&check_uncheck_buttons($r,$formname,'defpriv',$lt{'oppr'}); |
$r->print(' |
$r->print(' |
</tr> |
</tr> |
</table> |
</table> |
</td> |
|
<td width="100%"> </td> |
|
</tr><tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
<br /> |
<br /> |
'); |
'); |
} else { |
} else { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'algm'}.'<br /><br />'); |
$r->print($lt{'algm'}.'<br /><br />'); |
} |
} |
&default_privileges($r,$action,$tabcol,$rowColor1,$rowColor2, |
&default_privileges($r,$action,$tools,$toolprivs,$fixedprivs, |
$tools,$toolprivs,$fixedprivs,$available); |
$available); |
} else { |
} else { |
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'asyo'}); |
$r->print($lt{'asyo'}); |
Line 1990 sub privilege_specificity {
|
Line 1881 sub privilege_specificity {
|
$r->print($lt{'sall'}); |
$r->print($lt{'sall'}); |
} |
} |
$r->print(' '.$lt{'defp'}.'<br /><br />'); |
$r->print(' '.$lt{'defp'}.'<br /><br />'); |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
&display_defprivs($r,$tools,$toolprivs,\@defprivs); |
$toolprivs,\@defprivs); |
|
} |
} |
} |
} |
$r->print(' |
|
</td> |
|
</tr> |
|
'); |
|
return; |
return; |
} |
} |
|
|
sub default_privileges { |
sub default_privileges { |
my ($r,$action,$tabcol,$rowColor1,$rowColor2,$tools,$toolprivs, |
my ($r,$action,$tools,$toolprivs,$fixedprivs,$available) = @_; |
$fixedprivs,$available) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'addp' => 'Additional privileges', |
'addp' => 'Additional privileges', |
'fixp' => 'Fixed privileges', |
'fixp' => 'Fixed privileges', |
'oppr' => 'Optional privileges', |
'oppr' => 'Optional privileges', |
'func' => 'Function', |
'func' => 'Function', |
); |
); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box'). |
$r->print('<tr> |
&Apache::lonhtmlcommon::row_title($lt{'func'},undef, |
<td bgcolor="'.$tabcol.'" valign="top"> |
'LC_groups_functionality')); |
<table cellspacing="0" cellpadding="1"> |
$r->print(join('</td><td class="LC_groups_functionality">',@{$tools})); |
<tr> |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
<td valign="top"><b>'.$lt{'func'}.'</b></td> |
my $fixed = ''; |
</tr> |
my $dynamic = ''; |
<tr> |
|
<td valign="top"><b>'.$lt{'fixp'}.'</b></td> |
|
</tr> |
|
<tr> |
|
<td valign="top"><b>'.$lt{'oppr'}.'</b></td> |
|
</tr> |
|
</table> |
|
</td> |
|
'); |
|
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
$r->print('<td align="center" valign="top"> |
|
<table cellspacing="0" cellpadding="1"> |
|
<tr bgcolor="#cccccc"> |
|
<td colspan="2" align="center"><b>'.$tool.'</b></td> |
|
</tr> |
|
'); |
|
my $privcount = 0; |
my $privcount = 0; |
my $fixed = ''; |
if ($dynamic ne '') { |
my $dynamic = ''; |
$dynamic .= '</td><td class="LC_groups_optional">'; |
|
} |
|
$dynamic .= '<table class="LC_group_priv"><tr>'; |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
if (exists($$fixedprivs{$tool}{$priv})) { |
if (exists($$fixedprivs{$tool}{$priv})) { |
|
if ($fixed ne '') { |
|
$fixed .= '</td><td class="LC_groups_fixed">'; |
|
} |
$fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.' '; |
$fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.' '; |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
if (grep/^$tool$/,@{$available}) { |
if (grep(/^$tool$/,@{$available})) { |
$fixed .= '<small>'.&mt('(on)').'<small> '; |
$fixed .= '<small>'.&mt('(on)').'<small> '; |
} else { |
} else { |
$fixed .= '<small>'.&mt('(off)').'<small> '; |
$fixed .= '<small>'.&mt('(off)').'<small> '; |
} |
} |
} |
} |
} else { |
} else { |
$privcount ++; |
$privcount++; |
if ($privcount == 3) { |
if ($privcount == 3) { |
$dynamic .= '</tr> |
$dynamic .= '</tr> |
<tr bgcolor="'.$rowColor1.'">'."\n"; |
<tr>'."\n"; |
} |
} |
$dynamic .= '<td><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></td>'."\n"; |
$dynamic .= '<td><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></td>'."\n"; |
} |
} |
} |
} |
if ($dynamic eq '') { |
if ($privcount == 0) { |
$dynamic = '<td>None</td>'."\n"; |
$dynamic .= '<td>None</td>'."\n"; |
} |
} |
if ($privcount < 3) { |
if ($privcount < 3) { |
$dynamic .= '</tr> |
$dynamic .= '</td> |
<tr bgcolor="'.$rowColor1.'"> |
<td> </td>'."\n"; |
<td colspan="2"> </td>'."\n"; |
|
} elsif ($privcount%2) { |
} elsif ($privcount%2) { |
$dynamic = '<td> </td>'."\n"; |
$dynamic = '<td> </td>'."\n"; |
} |
} |
$r->print('<tr bgcolor="'.$rowColor2.'"> |
$dynamic .= '</tr></table>'; |
<td colspan="2" align="center"><nobr>'.$fixed.'</nobr></td> |
|
</tr> |
|
<tr bgcolor="'.$rowColor1.'">'."\n".$dynamic.'</tr>'."\n".'</table>'."\n".'</td> |
|
'); |
|
} |
} |
$r->print('</tr>'."\n"); |
$r->print(&Apache::lonhtmlcommon::row_title($lt{'fixp'},undef, |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
'LC_groups_fixed'). |
|
$fixed. |
|
&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::row_title($lt{'oppr'},undef, |
|
'LC_groups_optional'). |
|
$dynamic. |
|
&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('<br />'); |
$r->print('<br />'); |
return; |
return; |
|
|
} |
} |
|
|
sub display_defprivs { |
sub display_defprivs { |
my ($r,$tabcol,$rowColor1,$rowColor2,$tools,$toolprivs,$defprivs) = @_; |
my ($r,$tools,$toolprivs,$defprivs) = @_; |
|
my $function = &Apache::loncommon::get_users_function(); |
|
my $tabcol = &Apache::loncommon::designparm($function.'.tabbg'); |
|
my $rowColor1 = "#dddddd"; |
|
my $rowColor2 = "#eeeeee"; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'priv' => 'Privileges', |
'priv' => 'Privileges', |
'func' => 'Function', |
'func' => 'Function', |
Line 2091 sub display_defprivs {
|
Line 1972 sub display_defprivs {
|
@{$currprivs{$tool}} = (); |
@{$currprivs{$tool}} = (); |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
if (ref($defprivs) eq 'ARRAY') { |
if (ref($defprivs) eq 'ARRAY') { |
if (grep/^\Q$priv\E$/,@{$defprivs}) { |
if (grep(/^\Q$priv\E$/,@{$defprivs})) { |
push(@{$currprivs{$tool}},$priv); |
push(@{$currprivs{$tool}},$priv); |
} |
} |
} |
} |
Line 2168 sub change_members_form {
|
Line 2049 sub change_members_form {
|
my $prevtext = $$navbuttons{'gtpp'}; |
my $prevtext = $$navbuttons{'gtpp'}; |
$r->print(' |
$r->print(' |
<br /> |
<br /> |
<table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
'); |
|
&topic_bar($r,$tabcol,1,$lt{'grse'}); |
|
$r->print(' |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
&print_current_settings($r,$action,$tabcol,$rowColor1,$rowColor2, |
|
$functions,$startdate,$enddate,$groupname, |
|
$description,$granularity,$quota,\@available, |
|
\@unavailable,$gpterm,$ucgpterm); |
|
$r->print(' |
|
</td></tr><tr><td colspan="4"> </td></tr>'); |
|
&topic_bar($r,$tabcol,2,$lt{'mogm'}); |
|
$r->print(' |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
'); |
|
&topic_bar($r,1,$lt{'grse'}); |
|
&print_current_settings($r,$action,$functions,$startdate,$enddate, |
|
$groupname,$description,$granularity,$quota, |
|
\@available,\@unavailable,$gpterm,$ucgpterm); |
|
&topic_bar($r,2,$lt{'mogm'}); |
¤t_membership($r,$cdom,$cnum,$formname,$tabcol,$rowColor1, |
¤t_membership($r,$cdom,$cnum,$formname,$tabcol,$rowColor1, |
$rowColor2,$groupname,\@available,\@unavailable, |
$rowColor2,$groupname,\@available,\@unavailable, |
$fixedprivs,$granularity,$specificity); |
$fixedprivs,$granularity,$specificity); |
$r->print('</td>'); |
|
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
$$states{$action}[$page+1],$nexttext); |
$$states{$action}[$page+1],$nexttext); |
$r->print('</table>'); |
|
return; |
return; |
} |
} |
|
|
Line 2217 sub current_membership {
|
Line 2082 sub current_membership {
|
'curf' => 'Current Functionality', |
'curf' => 'Current Functionality', |
'chpr' => 'Change Privileges' |
'chpr' => 'Change Privileges' |
); |
); |
if (keys(%membership) > 0) { |
my ($current,$hastools,$addtools,$num_reenable,$num_activate,$num_expire) = |
my %current = (); |
&Apache::longroup::group_memberlist($cdom,$cnum,$groupname,$fixedprivs, |
my %allnames = (); |
$available); |
my $hastools = 0; |
if (keys(%{$current}) > 0) { |
my $addtools = 0; |
$r->print(' |
my $num_reenable = 0; |
|
my $num_activate = 0; |
|
my $num_expire = 0; |
|
foreach my $key (sort(keys(%membership))) { |
|
if ($key =~ /^\Q$groupname\E:([^:]+):([^:]+)$/) { |
|
my $uname = $1; |
|
my $udom = $2; |
|
my $user = $uname.':'.$udom; |
|
my($end,$start,@userprivs) = split(/:/,$membership{$key}); |
|
unless ($start == -1) { |
|
$allnames{$udom}{$uname} = 1; |
|
$current{$user} = { |
|
uname => $uname, |
|
udom => $udom, |
|
start => &Apache::lonlocal::locallocaltime($start), |
|
currtools => [], |
|
newtools => [], |
|
}; |
|
|
|
if ($end == 0) { |
|
$current{$user}{end} = 'No end date'; |
|
} else { |
|
$current{$user}{end} = |
|
&Apache::lonlocal::locallocaltime($end); |
|
} |
|
my $now = time; |
|
if (($end > 0) && ($end < $now)) { |
|
$current{$user}{changestate} = 'reenable'; |
|
$num_reenable++; |
|
} elsif (($start > $now)) { |
|
$current{$user}{changestate} = 'activate'; |
|
$num_activate ++; |
|
} else { |
|
$current{$user}{changestate} = 'expire'; |
|
$num_expire ++; |
|
} |
|
if (@userprivs > 0) { |
|
foreach my $tool (sort(keys(%{$fixedprivs}))) { |
|
foreach my $priv (keys(%{$$fixedprivs{$tool}})) { |
|
if (grep/^$priv$/,@userprivs) { |
|
push(@{$current{$user}{currtools}},$tool); |
|
last; |
|
} |
|
} |
|
} |
|
$hastools = 1; |
|
} |
|
if (@{$available} > 0) { |
|
if (@{$current{$user}{currtools}} > 0) { |
|
if ("@{$available}" ne "@{$current{$user}{currtools}}") { |
|
foreach my $tool (@{$available}) { |
|
unless (grep/^$tool$/,@{$current{$user}{currtools}}) { |
|
push(@{$current{$user}{newtools}},$tool); |
|
} |
|
} |
|
} |
|
} else { |
|
@{$current{$user}{newtools}} = @{$available}; |
|
} |
|
if (@{$current{$user}{newtools}} > 0) { |
|
$addtools = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (keys(%current) > 0) { |
|
my %idhash; |
|
foreach my $udom (keys(%allnames)) { |
|
%{$idhash{$udom}} = &Apache::lonnet::idrget($udom, |
|
keys(%{$allnames{$udom}})); |
|
foreach my $uname (keys(%{$idhash{$udom}})) { |
|
$current{$uname.':'.$udom}{'id'} = $idhash{$udom}{$uname}; |
|
} |
|
foreach my $uname (keys(%{$allnames{$udom}})) { |
|
$current{$uname.':'.$udom}{'fullname'} = |
|
&Apache::loncommon::plainname($uname,$udom, |
|
'lastname'); |
|
} |
|
} |
|
$r->print(' |
|
<tr> |
<tr> |
<td> </td> |
<td> </td> |
<td colspan="2"> |
<td colspan="2"> |
<table> |
<table> |
<tr>'); |
<tr>'); |
if ($num_expire) { |
if ($num_expire) { |
&check_uncheck_buttons($r,$formname,'expire',$lt{'expi'}); |
&check_uncheck_buttons($r,$formname,'expire',$lt{'expi'}); |
} |
} |
if ($num_reenable) { |
if ($num_reenable) { |
&check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'}); |
&check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'}); |
} |
} |
if ($num_activate) { |
if ($num_activate) { |
&check_uncheck_buttons($r,$formname,'activate',$lt{'acti'}); |
&check_uncheck_buttons($r,$formname,'activate',$lt{'acti'}); |
|
} |
|
&check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'}); |
|
if (@{$available} > 0) { |
|
if ($specificity eq 'Yes') { |
|
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
} |
} |
&check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'}); |
if ($granularity eq 'Yes') { |
if (@{$available} > 0) { |
$r->print(&check_uncheck_tools($r,$available)); |
if ($specificity eq 'Yes') { |
$r->print(' |
&check_uncheck_buttons($r,$formname,'changepriv',$lt{'chpr'}); |
|
} |
|
if ($granularity eq 'Yes') { |
|
$r->print(&check_uncheck_tools($r,$available)); |
|
$r->print(' |
|
<td> |
<td> |
<nobr> |
<nobr> |
<fieldset><legend><b>'.$lt{'curf'}.'</b></legend> |
<fieldset><legend><b>'.$lt{'curf'}.'</b></legend> |
Line 2337 sub current_membership {
|
Line 2121 sub current_membership {
|
</nobr> |
</nobr> |
</td> |
</td> |
'); |
'); |
} |
|
} |
} |
$r->print(<<"END"); |
} |
|
$r->print(<<"END"); |
</tr> |
</tr> |
</table> |
</table> |
</td> |
</td> |
Line 2352 sub current_membership {
|
Line 2136 sub current_membership {
|
<td> </td> |
<td> </td> |
<td colspan="3"> |
<td colspan="3"> |
END |
END |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<table border="0" cellpadding="4" cellspacing="1"> |
<table border="0" cellpadding="4" cellspacing="1"> |
<tr bgcolor="$tabcol" align="center"> |
<tr bgcolor="$tabcol" align="center"> |
<td><b>$lt{'actn'}</b></td> |
<td><b>$lt{'actn'}</b></td> |
Line 2365 END
|
Line 2149 END
|
<td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td> |
<td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td> |
<td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td> |
<td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td> |
END |
END |
my $colspan = 0; |
my $colspan = 0; |
if ($hastools) { |
if ($hastools) { |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
$r->print('<td><b>'.$lt{'curf'}.'</b></td>'); |
$colspan ++; |
$colspan ++; |
} |
} |
if ($addtools) { |
if ($addtools) { |
$r->print('<td><b>Additional Functionality</b></td>'); |
$r->print('<td><b>Additional Functionality</b></td>'); |
$colspan ++; |
$colspan ++; |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
if ($colspan) { |
if ($colspan) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<tr bgcolor="#cccccc"> |
$r->print('<tr bgcolor="#cccccc"> |
<td colspan="7"> </td> |
<td colspan="7"> </td> |
<td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:'). |
<td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:'). |
'</b> '); |
'</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></small></td></tr>'); |
} |
} |
my %Sortby = (); |
} |
foreach my $user (sort(keys(%current))) { |
my %Sortby = (); |
if ($env{'form.sortby'} eq 'fullname') { |
foreach my $user (sort(keys(%{$current}))) { |
push(@{$Sortby{$current{$user}{fullname}}},$user); |
if ($env{'form.sortby'} eq 'fullname') { |
} elsif ($env{'form.sortby'} eq 'username') { |
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
push(@{$Sortby{$current{$user}{uname}}},$user); |
} elsif ($env{'form.sortby'} eq 'username') { |
} elsif ($env{'form.sortby'} eq 'domain') { |
push(@{$Sortby{$$current{$user}{uname}}},$user); |
push(@{$Sortby{$current{$user}{udom}}},$user); |
} elsif ($env{'form.sortby'} eq 'domain') { |
} elsif ($env{'form.sortby'} eq 'id') { |
push(@{$Sortby{$$current{$user}{udom}}},$user); |
push(@{$Sortby{$current{$user}{id}}},$user); |
} elsif ($env{'form.sortby'} eq 'id') { |
|
push(@{$Sortby{$$current{$user}{id}}},$user); |
|
} else { |
|
push(@{$Sortby{$$current{$user}{fullname}}},$user); |
|
} |
|
} |
|
my $rowNum = 0; |
|
my $rowColor; |
|
foreach my $key (sort(keys(%Sortby))) { |
|
foreach my $user (@{$Sortby{$key}}) { |
|
if ($rowNum %2 == 1) { |
|
$rowColor = $rowColor1; |
} else { |
} else { |
push(@{$Sortby{$current{$user}{fullname}}},$user); |
$rowColor = $rowColor2; |
} |
} |
} |
my $id = $$current{$user}{id}; |
my $rowNum = 0; |
my $fullname = $$current{$user}{fullname}; |
my $rowColor; |
my $udom = $$current{$user}{udom}; |
foreach my $key (sort(keys(%Sortby))) { |
my $uname = $$current{$user}{uname}; |
foreach my $user (@{$Sortby{$key}}) { |
my $start = $$current{$user}{start}; |
if ($rowNum %2 == 1) { |
my $end = $$current{$user}{end}; |
$rowColor = $rowColor1; |
$r->print('<tr bgcolor="'.$rowColor.'"> |
} else { |
<td><small>'); |
$rowColor = $rowColor2; |
if ($$current{$user}{changestate} eq 'reenable') { |
} |
$r->print('<nobr><label>'. |
my $id = $current{$user}{id}; |
|
my $fullname = $current{$user}{fullname}; |
|
my $udom = $current{$user}{udom}; |
|
my $uname = $current{$user}{uname}; |
|
my $start = $current{$user}{start}; |
|
my $end = $current{$user}{end}; |
|
$r->print('<tr bgcolor="'.$rowColor.'"> |
|
<td><small>'); |
|
if ($current{$user}{changestate} eq 'reenable') { |
|
$r->print('<nobr><label>'. |
|
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
$lt{'reen'}.'</label></nobr><br />'); |
$lt{'reen'}.'</label></nobr><br />'); |
} elsif ($current{$user}{changestate} eq 'expire') { |
} elsif ($$current{$user}{changestate} eq 'expire') { |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
$lt{'expi'}.'</label></nobr><br />'); |
$lt{'expi'}.'</label></nobr><br />'); |
} elsif ($current{$user}{changestate} eq 'activate') { |
} elsif ($$current{$user}{changestate} eq 'activate') { |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
$lt{'acti'}.'</label></nobr><br />'); |
$lt{'acti'}.'</label></nobr><br />'); |
} |
} |
$r->print('<nobr><label>'. |
$r->print('<nobr><label>'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
$lt{'dele'}.'</label></nobr>'); |
$lt{'dele'}.'</label></nobr>'); |
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
$r->print('<br /><nobr><label>'. |
$r->print('<br /><nobr><label>'. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'</label></nobr>'); |
'</label></nobr>'); |
} |
} |
$r->print(' |
$r->print(' |
</td> |
</td> |
<td><small>'. |
<td><small>'. |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
$fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'. |
$udom.'</small></td><td><small>'.$id.'</small></td><td><small>'.$start. |
$udom.'</small></td><td><small>'.$id.'</small></td><td><small>'.$start. |
'</small></td><td><small>'.$end.'</small></td>'); |
'</small></td><td><small>'.$end.'</small></td>'); |
if ($hastools) { |
if ($hastools) { |
$r->print('<td align="left"><small><nobr>'. |
$r->print('<td align="left"><small><nobr>'. |
' '); |
' '); |
foreach my $tool (@{$current{$user}{currtools}}) { |
foreach my $tool (@{$$current{$user}{currtools}}) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print('<label><input type="checkbox" '. |
$r->print('<label><input type="checkbox" '. |
'checked="checked" '. |
'checked="checked" '. |
'name="user_'.$tool.'" value="'. |
'name="user_'.$tool.'" value="'. |
$user.'" />'.$tool.'</label>'); |
$user.'" />'.$tool.'</label>'); |
} else { |
} else { |
$r->print('<input type="hidden" '. |
$r->print('<input type="hidden" '. |
'checked="checked" '. |
'checked="checked" '. |
'name="user_'.$tool.'" value="'. |
'name="user_'.$tool.'" value="'. |
$user.'" />'.$tool); |
$user.'" />'.$tool); |
} |
} |
$r->print(' '); |
$r->print(' '); |
} |
|
$r->print('</nobr></small></td>'); |
|
} |
} |
if ($addtools) { |
$r->print('</nobr></small></td>'); |
$r->print('<td align="left"><small>'); |
} |
if ($granularity eq 'Yes') { |
if ($addtools) { |
foreach my $tool (@{$current{$user}{newtools}}) { |
$r->print('<td align="left"><small>'); |
$r->print('<nobr><label><input type="checkbox" |
if ($granularity eq 'Yes') { |
|
foreach my $tool (@{$$current{$user}{newtools}}) { |
|
$r->print('<nobr><label><input type="checkbox" |
name="user_'.$tool.'" value="'. |
name="user_'.$tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</label></nobr> '); |
'</label></nobr> '); |
} |
} |
} else { |
} else { |
foreach my $tool (@{$current{$user}{newtools}}) { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
$r->print('<nobr><input type="hidden" |
$r->print('<nobr><input type="hidden" |
name="user_'. $tool.'" value="'. |
name="user_'. $tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</nobr> '); |
'</nobr> '); |
} |
|
} |
} |
$r->print('</small></td>'); |
|
} |
} |
$r->print('</tr>'."\n"); |
$r->print('</small></td>'); |
$rowNum ++; |
|
} |
} |
|
$r->print('</tr>'."\n"); |
|
$rowNum ++; |
} |
} |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
} |
$r->print(' |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print(' |
</td> |
</td> |
</tr>'); |
</tr>'); |
} |
|
} |
} |
return; |
return; |
} |
} |
Line 2518 sub check_uncheck_buttons {
|
Line 2301 sub check_uncheck_buttons {
|
|
|
|
|
sub change_privs_form { |
sub change_privs_form { |
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate, |
my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate, |
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools, |
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools, |
$memchg,$idx,$states,$stored,$sectioncount,$navbuttons,$rowColor1, |
$memchg,$idx,$states,$stored,$sectioncount,$navbuttons,$gpterm, |
$rowColor2,$gpterm,$ucgpterm) = @_; |
$ucgpterm) = @_; |
my @regexps = ('userpriv_'); |
my @regexps = ('userpriv_'); |
my $nexttext; |
my $nexttext; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
Line 2536 sub change_privs_form {
|
Line 2319 sub change_privs_form {
|
} else { |
} else { |
$nexttext = $$navbuttons{'mose'}; |
$nexttext = $$navbuttons{'mose'}; |
} |
} |
$r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">'); |
&topic_bar($r,3,&mt('Members to delete or expire')); |
&topic_bar($r,$tabcol,3,&mt('Members to delete or expire')); |
|
my $exp_or_del = 0; |
my $exp_or_del = 0; |
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
if (@{$$memchg{'deletion'}} > 0) { |
if (@{$$memchg{'deletion'}} > 0) { |
Line 2546 sub change_privs_form {
|
Line 2328 sub change_privs_form {
|
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
' ('.$user.')</li>'); |
' ('.$user.')</li>'); |
} |
} |
$r->print('</ul></td><tr><td colspan="4"> </td></tr>'); |
$r->print('</ul>'); |
$exp_or_del += @{$$memchg{'deletion'}}; |
$exp_or_del += @{$$memchg{'deletion'}}; |
} |
} |
} |
} |
Line 2557 sub change_privs_form {
|
Line 2339 sub change_privs_form {
|
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}]. |
' ('.$user.')</li>'); |
' ('.$user.')</li>'); |
} |
} |
$r->print('</ul></td><tr><td colspan="4"> </td></tr>'); |
$r->print('</ul>'); |
$exp_or_del += @{$$memchg{'expire'}}; |
$exp_or_del += @{$$memchg{'expire'}}; |
} |
} |
} |
} |
if (!$exp_or_del) { |
if (!$exp_or_del) { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'nome'}. |
$r->print($lt{'nome'}.'<br />'); |
'</td></tr><tr><td colspan="4"> </td></tr>'); |
|
} |
} |
|
|
&topic_bar($r,$tabcol,4,&mt('[_1] member privileges',$ucgpterm)); |
&topic_bar($r,4,&mt('[_1] member privileges',$ucgpterm)); |
|
|
my $numchgs = &member_privileges_form($r,$tabcol,$action,$formname,$tools, |
my $numchgs = &member_privileges_form($r,$action,$formname,$tools, |
$toolprivs,$fixedprivs,$userdata, |
$toolprivs,$fixedprivs,$userdata, |
$usertools,$idx,$memchg,$states, |
$usertools,$idx,$memchg,$states, |
$stored,$rowColor1,$rowColor2, |
$stored,$gpterm); |
$gpterm); |
|
$r->print('</td></tr><tr><td colspan="4"> </td></tr>'); |
|
my $prevtext = $$navbuttons{'gtps'}; |
my $prevtext = $$navbuttons{'gtps'}; |
if ($numchgs || $exp_or_del) { |
if ($numchgs || $exp_or_del) { |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
Line 2581 sub change_privs_form {
|
Line 2360 sub change_privs_form {
|
} else { |
} else { |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext); |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext); |
} |
} |
$r->print('</table>'); |
|
return; |
return; |
} |
} |
|
|
sub add_members_form { |
sub add_members_form { |
my ($r,$tabcol,$action,$formname,$page,$startdate,$enddate,$groupname, |
my ($r,$action,$formname,$page,$startdate,$enddate,$groupname, |
$description,$granularity,$quota,$sectioncount,$tools,$functions, |
$description,$granularity,$quota,$sectioncount,$tools,$functions, |
$stored,$states,$navbuttons,$rowColor1,$rowColor2,$gpterm,$ucgpterm)=@_; |
$stored,$states,$navbuttons,$gpterm,$ucgpterm)=@_; |
$r->print(' <br /> |
$r->print(' <br />'); |
<table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
<tr> |
|
<td> </td> |
|
<td colspan="3"> |
|
'); |
|
my @available = (); |
my @available = (); |
my @unavailable = (); |
my @unavailable = (); |
&check_tools($functions,$tools,\@available,\@unavailable); |
&check_tools($functions,$tools,\@available,\@unavailable); |
&print_current_settings($r,$action,$tabcol,$rowColor1,$rowColor2, |
&print_current_settings($r,$action,$functions,$startdate,$enddate, |
$functions,$startdate,$enddate,$groupname, |
$groupname,$description,$granularity,$quota, |
$description,$granularity,$quota,\@available, |
\@available,\@unavailable,$gpterm,$ucgpterm); |
\@unavailable,$gpterm,$ucgpterm); |
&membership_options($r,$action,$formname,$sectioncount,1,$gpterm,$ucgpterm); |
$r->print(' |
|
</td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr>'); |
|
|
|
&membership_options($r,$action,$formname,$tabcol,$sectioncount,1,$gpterm, |
|
$ucgpterm); |
|
my $nexttext = $$navbuttons{'gtns'}; |
my $nexttext = $$navbuttons{'gtns'}; |
my $prevtext = $$navbuttons{'gtpp'}; |
my $prevtext = $$navbuttons{'gtpp'}; |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
$$states{$action}[$page+1],$nexttext); |
$$states{$action}[$page+1],$nexttext); |
$r->print(' |
|
</table>'); |
|
return; |
return; |
} |
} |
|
|
sub choose_privs_form { |
sub choose_privs_form { |
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate, |
my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate, |
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,$idx, |
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,$idx, |
$states,$stored,$sectioncount,$navbuttons,$rowColor1,$rowColor2, |
$states,$stored,$sectioncount,$navbuttons,$gpterm,$ucgpterm, |
$gpterm,$ucgpterm,$crstype) = @_; |
$crstype) = @_; |
|
|
my @regexps = ('userpriv_'); |
my @regexps = ('userpriv_'); |
my $nexttext; |
my $nexttext; |
Line 2641 sub choose_privs_form {
|
Line 2403 sub choose_privs_form {
|
$nexttext = $$navbuttons{'adme'}; |
$nexttext = $$navbuttons{'adme'}; |
} |
} |
|
|
$r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">'); |
&topic_bar($r,6,&mt('[_1] member privileges',$ucgpterm)); |
&topic_bar($r,$tabcol,6,&mt('[_1] member privileges',$ucgpterm)); |
|
|
|
&member_privileges_form($r,$tabcol,$action,$formname,$tools,$toolprivs, |
&member_privileges_form($r,$action,$formname,$tools,$toolprivs, |
$fixedprivs,$userdata,$usertools,$idx,undef, |
$fixedprivs,$userdata,$usertools,$idx,undef, |
$states,$stored,$rowColor1,$rowColor2,$gpterm); |
$states,$stored,$gpterm); |
|
|
$r->print('</td></tr><tr><td colspan="4"> </td></tr>'); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
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'}; |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
$$states{$action}[$page+1],$nexttext); |
$$states{$action}[$page+1],$nexttext); |
$r->print('</table>'); |
|
return; |
return; |
} |
} |
|
|
Line 2724 function uncheckAllTools(formname) {
|
Line 2483 function uncheckAllTools(formname) {
|
} |
} |
|
|
sub member_privileges_form { |
sub member_privileges_form { |
my ($r,$tabcol,$action,$formname,$tools,$toolprivs,$fixedprivs,$userdata, |
my ($r,$action,$formname,$tools,$toolprivs,$fixedprivs,$userdata, |
$usertools,$idx,$memchg,$states,$stored,$rowColor1,$rowColor2, |
$usertools,$idx,$memchg,$states,$stored,$gpterm) = @_; |
$gpterm) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'addp' => 'Additional privileges', |
'addp' => 'Additional privileges', |
'fixp' => 'Fixed privileges', |
'fixp' => 'Fixed privileges', |
Line 2787 sub member_privileges_form {
|
Line 2545 sub member_privileges_form {
|
} |
} |
$numchgs = @currmembers; |
$numchgs = @currmembers; |
if (!$numchgs) { |
if (!$numchgs) { |
$r->print('<tr><td> </td><td colspan="3">'.$lt{'nogm'}); |
$r->print($lt{'nogm'}); |
return $numchgs; |
return $numchgs; |
} |
} |
} |
} |
Line 2803 sub member_privileges_form {
|
Line 2561 sub member_privileges_form {
|
my %total; |
my %total; |
if (keys(%{$usertools}) > 1) { |
if (keys(%{$usertools}) > 1) { |
$r->print(' |
$r->print(' |
<tr> |
<table border="0" cellspacing="2" cellpadding="2"> |
<td> </td> |
|
<td colspan="3"> |
|
<table border="0" cellspacing="2" cellpadding="2" border="0"> |
|
<tr> |
<tr> |
'); |
'); |
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
if (@{$showboxes{$tool}} > 0) { |
if (@{$showboxes{$tool}} > 0) { |
$r->print('<td valign="top">'); |
$r->print('<td valign="top">'); |
$r->print('<table class="thinborder"><tr bgcolor="'. |
$r->print('<table class="thinborder"><tr>'. |
$tabcol.'"><th colspan="'.$colspan.'">'. |
'<th colspan="'.$colspan.'">'. |
$tool.'</th></tr><tr>'); |
$tool.'</th></tr><tr>'); |
my $privcount = 0; |
my $privcount = 0; |
foreach my $priv (@{$showboxes{$tool}}) { |
foreach my $priv (@{$showboxes{$tool}}) { |
Line 2851 sub member_privileges_form {
|
Line 2606 sub member_privileges_form {
|
$r->print('</tr></table></td><td> </td>'); |
$r->print('</tr></table></td><td> </td>'); |
} |
} |
} |
} |
$r->print('</tr></table></td></tr>'); |
$r->print('</tr></table>'); |
$r->print('<tr><td colspan="4"> </td></tr>'); |
|
} |
} |
$r->print('<tr><td> </td><td colspan="3">'); |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&Apache::loncommon::start_data_table_header_row()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<tr bgcolor="$tabcol"> |
<th>$lt{'full'}</th> |
<th><b>$lt{'full'}</th> |
<th>$lt{'user'}</th> |
<th><b>$lt{'user'}</th> |
|
<th>$lt{'doma'}</th> |
<th>$lt{'doma'}</th> |
<th colspan="$numtools">$lt{'addp'}</th> |
<th colspan="$numtools">$lt{'addp'}</th> |
</tr> |
|
END |
END |
&member_privs_entries($r,$tabcol,$rowColor1,$rowColor2, |
$r->print(&Apache::loncommon::end_data_table_header_row()); |
$usertools,$toolprivs,$fixedprivs, |
&member_privs_entries($r,$usertools,$toolprivs,$fixedprivs, |
$userdata,$idx,\@showtools,\@defprivs, |
$userdata,$idx,\@showtools,\@defprivs, |
\@excluded); |
\@excluded); |
$r->print('</td>'); |
$r->print(&Apache::loncommon::end_data_table()); |
$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,$tools,$toolprivs,\@defprivs); |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
|
$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,$tools,$toolprivs,\@defprivs); |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
|
$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; |
} |
} |
|
|
sub process_request { |
sub process_request { |
my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$groupname,$description, |
my ($r,$cdom,$cnum,$action,$state,$page,$groupname,$description, |
$specificity,$userdata,$startdate,$enddate,$tools,$functions,$toolprivs, |
$specificity,$userdata,$startdate,$enddate,$tools,$functions,$toolprivs, |
$usertools,$idx,$types,$roles,$sections,$states,$navbuttons,$memchg, |
$usertools,$idx,$types,$roles,$sections,$states,$navbuttons,$memchg, |
$sectioncount,$stored,$rowColor1,$rowColor2,$gpterm,$ucgpterm, |
$sectioncount,$stored,$gpterm,$ucgpterm,$crstype) = @_; |
$crstype) = @_; |
|
|
|
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
$r->print(&Apache::lonhtmlcommon::echo_form_input( |
['origin','action','state','page','sortby'])); |
['origin','action','state','page','sortby'])); |
Line 2985 sub write_group_data {
|
Line 2725 sub write_group_data {
|
'specificity','autoadd','autodrop','quota'); |
'specificity','autoadd','autodrop','quota'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
|
|
|
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action, |
|
$stored); |
|
my $quota = $env{'form.quota'}; |
|
|
|
$quota =~ s/^\s*([^\s]*)\s*$/$1/; |
|
if ($quota eq '') { |
|
$quota = 0; |
|
} |
|
if ($quota !~ /^\d*\.?\d*$/) { |
|
$quota = 0; |
|
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] contained invalid characters, so it has been set to 0 Mb. You can change this by modifying the [_1] settings.<br />',$gpterm)); |
|
} |
|
if ($quota > $maxposs) { |
|
$quota = $maxposs; |
|
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).<br />',$gpterm,$maxposs)); |
|
} |
my %groupinfo = ( |
my %groupinfo = ( |
description => $esc_description, |
description => $esc_description, |
startdate => $startdate, |
startdate => $startdate, |
Line 2996 sub write_group_data {
|
Line 2752 sub write_group_data {
|
specificity => $specificity, |
specificity => $specificity, |
autoadd => $env{'form.autoadd'}, |
autoadd => $env{'form.autoadd'}, |
autodrop => $env{'form.autodrop'}, |
autodrop => $env{'form.autodrop'}, |
quota => $env{'form.quota'}, |
quota => $quota, |
); |
); |
|
|
foreach my $func (keys(%{$functions})) { |
foreach my $func (keys(%{$functions})) { |
my $status; |
my $status; |
if (grep(/^$func$/,@{$tools})) { |
if (grep(/^$func$/,@{$tools})) { |
Line 3044 sub write_group_data {
|
Line 2801 sub write_group_data {
|
|
|
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if ($action eq 'create') { |
if ($action eq 'create') { |
my $put_result = &create_homepage($cdom,$cnum,$groupname, |
my $result = &add_group_folder($cdom,$cnum,$now,$groupname,$action, |
\%groupinfo,$tools,$gpterm, |
$description,$tools,\%groupinfo, |
$ucgpterm); |
$gpterm,$ucgpterm,$crstype); |
|
if ($result ne 'ok') { |
|
$r->print(&mt('A problem occurred when creating folders for the new [_1]. [_2].<br />',$gpterm,$result)); |
|
} |
$r->print(&mt('[_1] [_2] was created.<br />',$ucgpterm,$groupname)); |
$r->print(&mt('[_1] [_2] was created.<br />',$ucgpterm,$groupname)); |
} else { |
} else { |
$r->print(&mt('[_1] [_2] was updated.<br />',$ucgpterm,$groupname)); |
$r->print(&mt('[_1] [_2] was updated.<br />',$ucgpterm,$groupname)); |
Line 3059 sub write_group_data {
|
Line 2819 sub write_group_data {
|
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
'in '.lc($crstype).': '.$cnum. |
'in '.lc($crstype).': '.$cnum. |
' in domain: '.$cdom); |
' in domain: '.$cdom); |
$r->print(&mt('An error occurred when [_1] the new [_2]. '. |
$r->print(&mt('An error occurred when [_1] the [_2]. '. |
'Please try again.',$actiontype{$action},$gpterm)); |
'Please try again.',$actiontype{$action},$gpterm)); |
} |
} |
return $result; |
return $result; |
Line 3179 sub process_membership {
|
Line 2939 sub process_membership {
|
my $start = $startdate; |
my $start = $startdate; |
my $end = $enddate; |
my $end = $enddate; |
if ($state eq 'memresult') { |
if ($state eq 'memresult') { |
if ($curr_privs{$user} eq $group_privs{$user}) { |
|
push(@unchanged,$user); |
|
next; |
|
} |
|
if (exists($curr_start{$user})) { |
|
$start = $curr_start{$user}; |
|
} |
|
if (exists($curr_end{$user})) { |
|
$end = $curr_end{$user}; |
|
} |
|
$type = 'modified'; |
|
if (@activate > 0) { |
if (@activate > 0) { |
if (grep/^$user$/,@activate) { |
if (grep/^$user$/,@activate) { |
$start = $now; |
$start = $now; |
Line 3204 sub process_membership {
|
Line 2953 sub process_membership {
|
$type = 'reenabled'; |
$type = 'reenabled'; |
} |
} |
} |
} |
|
if ($type eq '') { |
|
if ($curr_privs{$user} eq $group_privs{$user}) { |
|
push(@unchanged,$user); |
|
next; |
|
} |
|
if (exists($curr_start{$user})) { |
|
$start = $curr_start{$user}; |
|
} |
|
if (exists($curr_end{$user})) { |
|
$end = $curr_end{$user}; |
|
} |
|
$type = 'modified'; |
|
} |
} else { |
} else { |
$type = 'added'; |
$type = 'added'; |
} |
} |
Line 3266 sub process_membership {
|
Line 3028 sub process_membership {
|
} |
} |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
$r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm)); |
$r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm)); |
|
$r->print('<p>'.&mt("For full access to all of [_1]'s privileges, users will need to log out and log back in.",$groupname).'</p>'); |
} else { |
} else { |
$r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />'); |
$r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />'); |
} |
} |
Line 3273 sub process_membership {
|
Line 3036 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 3291 sub mapping_options {
|
Line 3053 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(' |
&mapping_settings($r,$sectioncount,\%lt,$stored,$img2,$crstype); |
<tr> |
|
<td colspan="4"> </td> |
|
</tr>'); |
|
&mapping_settings($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,\%lt, |
|
$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 3311 sub automapping {
|
Line 3068 sub automapping {
|
if (exists($$stored{'autodrop'})) { |
if (exists($$stored{'autodrop'})) { |
$drop = $$stored{'autodrop'}; |
$drop = $$stored{'autodrop'}; |
} |
} |
&topic_bar($r,$tabcol,$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; |
unshift(@sections,'none'); # Put 'no sections' next |
unshift(@sections,'none'); # Put 'no sections' next |
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,$tabcol,$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 3397 sub mapping_settings {
|
Line 3120 sub mapping_settings {
|
'</td>'; |
'</td>'; |
} |
} |
} |
} |
if ($rowNum %2 == 1) { |
$r->print(&Apache::loncommon::start_data_table_row(). |
$rowColor = $rowColor1; |
'<td><input type="checkbox" '. |
} else { |
'name="autorole" value="'.$role.'" /></td><td>'.$plrole. |
$rowColor = $rowColor2; |
'</td>'.$sections_sel. |
} |
&Apache::loncommon::end_data_table_row()); |
$r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '. |
|
'name="autorole" value="'.$role.'"></td><td>'.$plrole. |
|
'</td>'.$sections_sel.'</tr>'); |
|
$rowNum ++; |
|
} |
} |
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) { |
|
$rowColor = $rowColor1; |
|
} else { |
|
$rowColor = $rowColor2; |
|
} |
} |
$r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '. |
$r->print(&Apache::loncommon::start_data_table_row(). |
'value="'.$role.'"></td><td>'.$role.'</td>'. |
'<td><input type="checkbox" '. |
$sections_sel.'</tr>'); |
'value="'.$role.'" /></td><td>'.$role.'</td>'. |
$rowNum ++; |
$sections_sel. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::loncommon::end_data_table()); |
return; |
return; |
} |
} |
|
|
Line 3480 sub modify_menu {
|
Line 3195 sub modify_menu {
|
} |
} |
|
|
sub member_privs_entries { |
sub member_privs_entries { |
my ($r,$tabcol,$rowColor1,$rowColor2,$usertools,$toolprivs, |
my ($r,$usertools,$toolprivs,$fixedprivs,$userdata,$idx,$showtools, |
$fixedprivs,$userdata,$idx,$showtools,$defprivs,$excluded) = @_; |
$defprivs,$excluded) = @_; |
my $rowColor; |
|
my $rowNum = 0; |
|
foreach my $user (sort(keys(%{$usertools}))) { |
foreach my $user (sort(keys(%{$usertools}))) { |
if (defined($excluded)) { |
if (defined($excluded)) { |
if (ref($excluded) eq 'ARRAY') { |
if (ref($excluded) eq 'ARRAY') { |
Line 3493 sub member_privs_entries {
|
Line 3206 sub member_privs_entries {
|
} |
} |
} |
} |
my ($uname,$udom) = split(/:/,$user); |
my ($uname,$udom) = split(/:/,$user); |
if ($rowNum %2 == 1) { |
$r->print(&Apache::loncommon::start_data_table_row().' |
$rowColor = $rowColor1; |
|
} else { |
|
$rowColor = $rowColor2; |
|
} |
|
$r->print('<tr bgcolor="'.$rowColor.'"> |
|
<td>'.$$userdata{$user}[$$idx{fullname}].'</td> |
<td>'.$$userdata{$user}[$$idx{fullname}].'</td> |
<td>'.$uname.'</td> |
<td>'.$uname.'</td> |
<td>'.$udom.'</td> |
<td>'.$udom.'</td> |
<td valign="top"><table><tr><td><b>Function</b></td></tr><tr><td><b>Fixed</b></td></tr><tr><td><b>Optional</b></td></tr></table></td>'); |
<td valign="top"><table><tr><td><b>Function</b></td></tr><tr><td><b>Fixed</b></td></tr><tr><td><b>Optional</b></td></tr></table></td>'); |
foreach my $tool (@{$showtools}) { |
foreach my $tool (@{$showtools}) { |
if (exists($$usertools{$user}{$tool})) { |
if (exists($$usertools{$user}{$tool})) { |
$r->print('<td valign="top"><table><tr bgcolor="'.$tabcol.'"><td colspan="2" align="center"><b>'.$tool.'</b></td></tr>'); |
$r->print('<td valign="top"><table><tr><th colspan="2">'.$tool.'</th></tr>'); |
my $privcount = 0; |
my $privcount = 0; |
my $fixed = ''; |
my $fixed = ''; |
my $dynamic = ''; |
my $dynamic = ''; |
Line 3528 sub member_privs_entries {
|
Line 3236 sub member_privs_entries {
|
} |
} |
$r->print('<tr><td colspan="2"><nobr>'.$fixed.'</nobr></td></tr><tr>'.$dynamic.'</tr></table></td>'); |
$r->print('<tr><td colspan="2"><nobr>'.$fixed.'</nobr></td></tr><tr>'.$dynamic.'</tr></table></td>'); |
} else { |
} else { |
$r->print('<td valign="top"><table width="100%"><tr bgcolor="'.$tabcol.'"><td colspan="2" align="center"><b>'.$tool.'</b></td></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>'); |
$r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>'); |
} |
} |
} |
} |
$rowNum ++; |
$r->print(&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
|
|
Line 3552 sub date_setting_table {
|
Line 3260 sub date_setting_table {
|
'startdate',$starttime); |
'startdate',$starttime); |
my $endform = &Apache::lonhtmlcommon::date_setter($formname, |
my $endform = &Apache::lonhtmlcommon::date_setter($formname, |
'enddate',$endtime); |
'enddate',$endtime); |
my $perpetual = '<nobr><label><input type="checkbox" name="no_end_date" /> |
my $perpetual = |
no ending date</label></nobr>'; |
'<nobr><label><input type="checkbox" name="no_end_date" />'. |
my $start_table = ''; |
&mt('None').'</label></nobr>'; |
$start_table .= "<table>\n"; |
my $table = "<table class=\"LC_descriptive_input\">\n". |
$start_table .= '<tr><td align="right">Default starting date for |
'<tr><td class="LC_description">'.&mt('Start:').'</td>'. |
member access</td>'. |
|
'<td>'.$startform.'</td>'. |
'<td>'.$startform.'</td>'. |
'<td> </td>'."</tr>\n"; |
'<td> </td>'."</tr>\n". |
$start_table .= "</table>"; |
'<tr><td class="LC_description">'.&mt('End:').'</td>'. |
my $end_table = ''; |
|
$end_table .= "<table>\n"; |
|
$end_table .= '<tr><td align="right">Default ending date for |
|
member access</td>'. |
|
'<td>'.$endform.'</td>'. |
'<td>'.$endform.'</td>'. |
'<td>'.$perpetual.'</td>'."</tr>\n"; |
'<td>'.$perpetual.'</td>'."</tr>\n". |
$end_table .= "</table>\n"; |
"</table>\n"; |
return ($start_table, $end_table); |
return $table; |
|
} |
|
|
|
sub add_group_folder { |
|
my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo, |
|
$gpterm,$ucgpterm,$crstype) = @_; |
|
if ($cdom eq '' || $cnum eq '') { |
|
return &mt('Error: invalid course domain or number - group folder creation failed'); |
|
} |
|
my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage); |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
|
$allgrpsmap = $crspath.'group_allfolders.sequence'; |
|
my $topmap = $navmap->getResourceByUrl($allgrpsmap); |
|
undef($navmap); |
|
if ($action eq 'create') { |
|
# check if group_allfolders.sequence exists. |
|
if (!$topmap) { |
|
my $grpstitle = &mt('[_1] [_2]',$crstype,$ucgpterm); |
|
my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
$topmap_url =~ s|/+|/|g; |
|
if ($topmap_url =~ m|^/uploaded|) { |
|
$outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence', |
|
'toplevelgroup',$grpstitle,$topmap_url); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
} else { |
|
$outcome = &mt('Non-standard course - folder for all groups not added.'); |
|
return $outcome; |
|
} |
|
} |
|
my $grpfolder = &mt('[_1] Folder -',$ucgpterm,).$description; |
|
$grppage='/adm/'.$cdom.'/'.$cnum.'/'.$groupname.'/grppg'; |
|
my $grptitle = &mt('Group homepage').' - '.$description; |
|
my ($seqid,$discussions,$disctitle); |
|
my $outcome = &map_updater($cdom,$cnum,'group_folder_'.$groupname.'.sequence', |
|
'grpseq',$grpfolder,$allgrpsmap,$grppage, |
|
$grptitle); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
my $pageout = &create_homepage($cdom,$cnum,$groupname,$groupinfo, |
|
$tools,$gpterm,$ucgpterm,$now); |
|
# Link to folder for bulletin boards |
|
$grpmap = $crspath.'group_folder_'.$groupname.'.sequence'; |
|
if (grep/^discussion$/,@{$tools}) { |
|
$seqid = $now + 1; |
|
$disctitle = &mt('Discussion Boards'); |
|
my $outcome = &map_updater($cdom,$cnum,'group_boards_'.$groupname. |
|
'.sequence','bbseq',$disctitle,$grpmap); |
|
if ($outcome ne 'ok') { |
|
return $outcome; |
|
} |
|
$boardsmap = $crspath.'group_boards_'.$groupname.'.sequence'; |
|
} |
|
} else { |
|
#modify group folder if status of discussions tools is changed |
|
} |
|
my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
|
$navmap = Apache::lonnavmaps::navmap->new(); |
|
# modify parameters |
|
my $parm_result; |
|
if ($action eq 'create') { |
|
if ($allgrpsmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$allgrpsmap,$groupname); |
|
} |
|
if ($grpmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$grpmap,$groupname); |
|
} |
|
if ($grppage) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$grppage,$groupname); |
|
} |
|
if ($boardsmap) { |
|
$parm_result .= &parm_setter($navmap,$cdom,$boardsmap,$groupname); |
|
} |
|
} |
|
if ($parm_result) { |
|
return $parm_result; |
|
} else { |
|
return 'ok'; |
|
} |
|
} |
|
|
|
sub map_updater { |
|
my ($cdom,$cnum,$newfile,$itemname,$itemtitle,$parentmap,$startsrc, |
|
$starttitle,$endsrc,$endtitle) = @_; |
|
my $outcome; |
|
$env{'form.'.$itemname} = &new_map($startsrc,$starttitle,$endsrc, |
|
$endtitle); |
|
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
|
$newfile); |
|
if ($newmapurl !~ m|^/uploaded|) { |
|
$outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'<br />'; |
|
return $outcome; |
|
} |
|
my ($errtext,$fatal)=&Apache::lonratedt::mapread($parentmap); |
|
if ($fatal) { |
|
$outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'<br />'; |
|
return $outcome; |
|
} else { |
|
my $newidx=&Apache::lonratedt::getresidx($newmapurl); |
|
$Apache::lonratedt::resources[$newidx] = $itemtitle.':'.$newmapurl. |
|
':false:normal:res'; |
|
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
|
my ($outtext,$errtext) = &Apache::lonratedt::storemap($parentmap,1); |
|
if ($errtext) { |
|
$outcome = &mt('Error storing updated parent folder')." ($parentmap): $errtext".'<br />'; |
|
return $outcome; |
|
} |
|
} |
|
return 'ok'; |
|
} |
|
|
|
sub new_map { |
|
my ($startsrc,$starttitle,$endsrc,$endtitle) = @_; |
|
my $newmapstr = ' |
|
<map> |
|
<resource id="1" src="'.$startsrc.'" type="start" title="'.$starttitle.'"></resource> |
|
<link from="1" to="2" index="1"></link> |
|
<resource id="2" src="'.$endsrc.'" type="finish" title="'.$endtitle.'"></resource> |
|
</map> |
|
'; |
|
return $newmapstr; |
|
} |
|
|
|
sub parm_setter { |
|
my ($navmap,$cdom,$url,$groupname) = @_; |
|
my $allresults; |
|
my %hide_settings = ( |
|
'course' => { |
|
'num' => 13, |
|
'set' => 'yes', |
|
}, |
|
'group' => { |
|
'num' => 5, |
|
'set' => 'no', |
|
'extra' => $groupname, |
|
}, |
|
); |
|
my $res = $navmap->getResourceByUrl($url); |
|
my $symb = $res->symb(); |
|
foreach my $level (keys(%hide_settings)) { |
|
my $parmresult = &Apache::lonparmset::storeparm_by_symb($symb, |
|
'0_hiddenresource', |
|
$hide_settings{$level}{'num'}, |
|
$hide_settings{$level}{'set'}, |
|
'string_yesno',undef,$cdom, |
|
undef,undef, |
|
$hide_settings{$level}{'extra'}); |
|
if ($parmresult) { |
|
$allresults .= $level.': '.$parmresult; |
|
} |
|
} |
|
return $allresults; |
} |
} |
|
|
sub create_homepage { |
sub create_homepage { |
my ($cdom,$cnum,$name,$groupinfo,$tools,$gpterm,$ucgpterm) = @_; |
my ($cdom,$cnum,$name,$groupinfo,$tools,$gpterm,$ucgpterm,$now) = @_; |
my $functionality = join(',',@{$tools}); |
my $functionality = join(',',@{$tools}); |
my $content = &unescape($$groupinfo{description}); |
my $content = &unescape($$groupinfo{description}); |
$content=~s/\s+$//s; |
$content=~s/\s+$//s; |
Line 3585 sub create_homepage {
|
Line 3442 sub create_homepage {
|
'abb_links' => $functionality, |
'abb_links' => $functionality, |
'bbb_content' => $content, |
'bbb_content' => $content, |
'ccc_webreferences' => '', |
'ccc_webreferences' => '', |
'uploaded.lastmodified' => time, |
'uploaded.lastmodified' => $now, |
); |
); |
my $putresult = &Apache::lonnet::put('grppage_'.$name,\%pageinfo,$cdom,$cnum); |
my $putresult = &Apache::lonnet::put('grppage_'.$name,\%pageinfo,$cdom,$cnum); |
return $putresult; |
return $putresult; |
Line 3645 sub validate_groupname {
|
Line 3502 sub validate_groupname {
|
"existing $gpterm", |
"existing $gpterm", |
); |
); |
|
|
my $exitmsg = '<b>'.$lt{'igna'}.'</b><br /><br />'.$lt{'tgne'}.' "'. |
my $exitmsg = '<span class="LC_error">'.$lt{'igna'}.'</span><br /><br />'. |
$groupname.'" '; |
$lt{'tgne'}.' "'.$groupname.'" '; |
my $dupmsg = $lt{'grna'}; |
my $dupmsg = $lt{'grna'}; |
my $earlyout; |
my $earlyout; |
if (($groupname eq '') || ($groupname =~ /\W/)) { |
if (($groupname eq '') || ($groupname =~ /\W/)) { |
Line 3674 sub validate_groupname {
|
Line 3531 sub validate_groupname {
|
} |
} |
|
|
sub topic_bar { |
sub topic_bar { |
my ($r,$tabcol,$imgnum,$title) = @_; |
my ($r,$imgnum,$title) = @_; |
$r->print(' |
$r->print(' |
<tr bgcolor="'.$tabcol.'"> |
<div class="LC_topic_bar"> |
<td> </td> |
<img alt="'.&mt('Step [_1]',$imgnum). |
<td valign="middle" align="left"> |
'"src="/res/adm/pages/bl_step'.$imgnum.'.gif" /> |
<nobr> |
<span>'.$title.'</span> |
<img src="/res/adm/pages/bl_step'.$imgnum.'.gif" valign="middle"> |
</div> |
</nobr> |
|
</td> |
|
<th align="left"><nobr>'.$title.'<nobr> |
|
</th> |
|
<td width="100%"> </td> |
|
</tr> |
|
<tr> |
|
<td colspan="4"> </td> |
|
</tr> |
|
'); |
'); |
return; |
return; |
} |
} |