version 1.9, 2006/03/19 22:31:41
|
version 1.15, 2006/05/09 14:38:09
|
Line 37 sub handler {
|
Line 37 sub handler {
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
if ($r->header_only) { |
if ($r->header_only) { |
return OK; |
return OK; |
} |
} |
Line 106 sub print_main_menu {
|
Line 106 sub print_main_menu {
|
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/coursegroups", |
({href=>"/adm/coursegroups", |
text=>"Course Groups",}); |
text=>"Course Groups",}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Groups')); |
(undef,'Course Groups')); |
|
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$action,$rowColor1, |
$view_permission,$manage_permission,$action,$rowColor1, |
$rowColor2); |
$rowColor2); |
Line 155 sub display_groups {
|
Line 154 sub display_groups {
|
if (!defined($action)) { |
if (!defined($action)) { |
$action = 'view'; |
$action = 'view'; |
} |
} |
my %curr_groups; |
my %curr_groups = &Apache::loncommon::coursegroups($cdom,$cnum); |
if (&Apache::loncommon::coursegroups(\%curr_groups,$cdom,$cnum)) { |
if (%curr_groups) { |
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(<<"END"); |
$r->print(<<"END"); |
Line 268 END
|
Line 267 END
|
my @coursegroups = split(/:/,$env{'request.course.groups'}); |
my @coursegroups = split(/:/,$env{'request.course.groups'}); |
if (@coursegroups > 0) { |
if (@coursegroups > 0) { |
$r->print('<br /><br />'); |
$r->print('<br /><br />'); |
my %curr_groups; |
my %curr_groups = &Apache::loncommon::coursegroups($cdom,$cnum); |
if (&Apache::loncommon::coursegroups(\%curr_groups,$cdom,$cnum)) { |
if (%curr_groups) { |
foreach my $group (@coursegroups) { |
foreach my $group (@coursegroups) { |
my %group_info = &Apache::loncommon::get_group_settings( |
my %group_info = &Apache::loncommon::get_group_settings( |
$curr_groups{$group}); |
$curr_groups{$group}); |
Line 464 sub group_administration {
|
Line 463 sub group_administration {
|
} |
} |
} |
} |
|
|
if ($action eq 'create') { |
if (($action eq 'create') || |
|
($action eq 'modify' && $state eq 'pick_members')) { |
if (defined($env{'form.types'})) { |
if (defined($env{'form.types'})) { |
@types=&Apache::loncommon::get_env_multiple('form.types'); |
@types=&Apache::loncommon::get_env_multiple('form.types'); |
} |
} |
Line 688 function changeSort(caller) {
|
Line 688 function changeSort(caller) {
|
document.$state.sortby.value = caller; |
document.$state.sortby.value = caller; |
document.$state.submit(); |
document.$state.submit(); |
} |
} |
|
|
|; |
|; |
$jscript .= &Apache::lonhtmlcommon::set_form_elements( |
$jscript .= &Apache::lonhtmlcommon::set_form_elements( |
\%{$elements{$action}{$state}},\%stored); |
\%{$elements{$action}{$state}},\%stored); |
Line 771 function changeSort(caller) {
|
Line 771 function changeSort(caller) {
|
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{text=>"$trail{$action}{$state}"}); |
{text=>"$trail{$action}{$state}"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,'Course Groups Manager')); |
('Course Groups 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, |
Line 796 function changeSort(caller) {
|
Line 796 function changeSort(caller) {
|
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{text=>"View groups"}); |
{text=>"View groups"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
(undef,'Course Groups Manager')); |
('Course Groups Manager')); |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
&display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, |
$view_permission,$manage_permission,$action, |
$view_permission,$manage_permission,$action, |
$rowColor1,$rowColor2); |
$rowColor1,$rowColor2); |
Line 808 function changeSort(caller) {
|
Line 808 function changeSort(caller) {
|
|
|
sub retrieve_settings { |
sub retrieve_settings { |
my ($cdom,$cnum,$groupname) = @_; |
my ($cdom,$cnum,$groupname) = @_; |
my %groupinfo; |
my %curr_groups = &Apache::loncommon::coursegroups($cdom,$cnum,$groupname); |
|
|
|
return if (!%curr_groups); |
|
|
|
my %groupinfo = |
|
&Apache::loncommon::get_group_settings($curr_groups{$groupname}); |
|
|
my %stored; |
my %stored; |
my %curr_groups; |
|
my $numgroups = &Apache::loncommon::coursegroups(\%curr_groups,$cdom, |
$stored{'description'} = |
$cnum,$groupname); |
&Apache::lonnet::unescape($groupinfo{'description'}); |
if ($numgroups > 0) { |
$stored{'startdate'} = $groupinfo{'startdate'}; |
%groupinfo = &Apache::loncommon::get_group_settings( |
$stored{'enddate'} = $groupinfo{'enddate'}; |
$curr_groups{$groupname}); |
if ($stored{'enddate'} == 0) { |
$stored{'description'} = &Apache::lonnet::unescape( |
$stored{'no_end_date'} = 1; |
$groupinfo{'description'}); |
} |
$stored{'startdate'} = $groupinfo{'startdate'}; |
$stored{'granularity'} = $groupinfo{'granularity'}; |
$stored{'enddate'} = $groupinfo{'enddate'}; |
$stored{'specificity'} = $groupinfo{'specificity'}; |
if ($stored{'enddate'} == 0) { |
$stored{'creation'} = $groupinfo{'creation'}; |
$stored{'no_end_date'} = 1; |
$stored{'creator'} = $groupinfo{'creator'}; |
} |
|
$stored{'granularity'} = $groupinfo{'granularity'}; |
foreach my $tool (sort(keys(%{$groupinfo{'functions'}}))) { |
$stored{'specificity'} = $groupinfo{'specificity'}; |
if ($groupinfo{functions}{$tool} eq 'on') { |
$stored{'creation'} = $groupinfo{'creation'}; |
push(@{$stored{tool}},$tool); |
$stored{'creator'} = $groupinfo{'creator'}; |
} |
|
} |
foreach my $tool (sort(keys(%{$groupinfo{'functions'}}))) { |
foreach my $role (@{$groupinfo{'roles'}}) { |
if ($groupinfo{functions}{$tool} eq 'on') { |
push(@{$stored{roles}},$role); |
push(@{$stored{tool}},$tool); |
} |
} |
foreach my $type (@{$groupinfo{'types'}}) { |
} |
push(@{$stored{types}},$type); |
foreach my $role (@{$groupinfo{'roles'}}) { |
} |
push(@{$stored{roles}},$role); |
foreach my $section (@{$groupinfo{'sectionpick'}}) { |
} |
push(@{$stored{sectionpick}},$section); |
foreach my $type (@{$groupinfo{'types'}}) { |
} |
push(@{$stored{types}},$type); |
foreach my $defpriv (@{$groupinfo{'defpriv'}}) { |
} |
push(@{$stored{defpriv}},$defpriv); |
foreach my $section (@{$groupinfo{'sectionpick'}}) { |
} |
push(@{$stored{sectionpick}},$section); |
$stored{'autoadd'} = $groupinfo{'autoadd'}; |
} |
$stored{'autodrop'} = $groupinfo{'autodrop'}; |
foreach my $defpriv (@{$groupinfo{'defpriv'}}) { |
if (exists($groupinfo{'autosec'})) { |
push(@{$stored{defpriv}},$defpriv); |
foreach my $role (sort(keys(%{$groupinfo{'autosec'}}))) { |
} |
foreach my $section (@{$groupinfo{'autosec'}{$role}}) { |
$stored{'autoadd'} = $groupinfo{'autoadd'}; |
push (@{$stored{'sec_'.$role}},$section); |
$stored{'autodrop'} = $groupinfo{'autodrop'}; |
} |
if (exists($groupinfo{'autosec'})) { |
if (@{$groupinfo{'autosec'}{$role}} > 0) { |
foreach my $role (sort(keys(%{$groupinfo{'autosec'}}))) { |
push(@{$stored{'autorole'}},$role); |
foreach my $section (@{$groupinfo{'autosec'}{$role}}) { |
} |
push (@{$stored{'sec_'.$role}},$section); |
} |
} |
|
if (@{$groupinfo{'autosec'}{$role}} > 0) { |
|
push(@{$stored{'autorole'}},$role); |
|
} |
|
} |
|
} |
|
} |
} |
return %stored; |
return %stored; |
} |
} |
Line 952 sub display_control {
|
Line 952 sub display_control {
|
sub header { |
sub header { |
my ($bodytitle,$jscript,$action,$state,$page,$function,$loaditems) = @_; |
my ($bodytitle,$jscript,$action,$state,$page,$function,$loaditems) = @_; |
my $start_page= |
my $start_page= |
&Apache::loncommon::start_page($bodytitle,$jscript, |
&Apache::loncommon::start_page($bodytitle, |
{'function' => $function, |
'<script type="text/javascript">'. |
|
$jscript.'</script>', |
|
{'function' => $function, |
'add_entries' => $loaditems,}); |
'add_entries' => $loaditems,}); |
my $output = <<"END"; |
my $output = <<"END"; |
$bodytag |
$start_page |
<form method="POST" name="$state"> |
<form method="POST" name="$state"> |
|
|
END |
END |
Line 973 END
|
Line 975 END
|
|
|
sub onload_action { |
sub onload_action { |
my ($action,$state) = @_; |
my ($action,$state) = @_; |
my $loaditems; |
my %loaditems; |
if ((defined($env{'form.origin'})) && ($action eq 'create') && |
if ((defined($env{'form.origin'})) && ($action eq 'create') && |
($state eq 'pick_name' || $state eq 'pick_members' || |
($state eq 'pick_name' || $state eq 'pick_members' || |
$state eq 'pick_privs')) { |
$state eq 'pick_privs')) { |
unless ($env{'form.origin'} eq '') { |
unless ($env{'form.origin'} eq '') { |
$loaditems = |
$loaditems{'onload'} = |
'onload="javascript:setFormElements(document.'.$state.')"'; |
'javascript:setFormElements(document.'.$state.')'; |
} |
} |
} |
} |
if (($action eq 'modify') && |
if (($action eq 'modify') && |
($state eq 'change_settings' || $state eq 'change_members' || |
($state eq 'change_settings' || $state eq 'change_members' || |
$state eq 'change_privs' || $state eq 'add_members' || |
$state eq 'change_privs' || $state eq 'add_members' || |
$state eq 'pick_members')) { |
$state eq 'pick_members')) { |
$loaditems = |
$loaditems{'onload'} = |
'onload="javascript:setFormElements(document.'.$state.')"'; |
'javascript:setFormElements(document.'.$state.')'; |
} |
} |
return $loaditems; |
return \%loaditems; |
} |
} |
|
|
sub footer { |
sub footer { |
Line 1210 sub membership_options {
|
Line 1212 sub membership_options {
|
previous => &mt('Previously had access'), |
previous => &mt('Previously had access'), |
future => &mt('Will have future access'), |
future => &mt('Will have future access'), |
); |
); |
|
|
my @roles = ('st','cc','in','ta','ep','cr'); |
my @roles = ('st','cc','in','ta','ep','cr'); |
|
|
my @sections = keys(%{$sectioncount}); |
my @sections = keys(%{$sectioncount}); |
Line 2306 END
|
Line 2308 END
|
$r->print('<td align="left"><small>'); |
$r->print('<td align="left"><small>'); |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
foreach my $tool (@{$current{$user}{newtools}}) { |
foreach my $tool (@{$current{$user}{newtools}}) { |
$r->print('<nobr><label><input type="checkbox" |
$r->print('<nobr><label><input type="checkbox" |
name="user_'.$tool.'" value="'. |
name="user_'.$tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</label></nobr> '); |
'</label></nobr> '); |
Line 2709 END
|
Line 2711 END
|
'<br />'); |
'<br />'); |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
&display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, |
$toolprivs,\@defprivs); |
$toolprivs,\@defprivs); |
|
|
} |
} |
} else { |
} else { |
if (keys(%{$usertools}) > 0) { |
if (keys(%{$usertools}) > 0) { |
Line 2808 sub write_group_data {
|
Line 2809 sub write_group_data {
|
'creation','modified','creator','granularity', |
'creation','modified','creator','granularity', |
'specificity','autoadd','autodrop'); |
'specificity','autoadd','autodrop'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
my @mult_attributes = ('roles','types','sectionpick','defpriv'); |
|
|
my %groupinfo = ( |
my %groupinfo = ( |
description => $esc_description, |
description => $esc_description, |
startdate => $startdate, |
startdate => $startdate, |
Line 2847 sub write_group_data {
|
Line 2848 sub write_group_data {
|
} |
} |
my $autosec; |
my $autosec; |
my @autorole = &Apache::loncommon::get_env_multiple('form.autorole'); |
my @autorole = &Apache::loncommon::get_env_multiple('form.autorole'); |
|
|
foreach my $role (@autorole) { |
foreach my $role (@autorole) { |
if (defined($env{'form.sec_'.$role})) { |
if (defined($env{'form.sec_'.$role})) { |
my @autosections=&Apache::loncommon::get_env_multiple('form.sec_'. |
my @autosections=&Apache::loncommon::get_env_multiple('form.sec_'. |
Line 3411 sub validate_groupname {
|
Line 3412 sub validate_groupname {
|
my ($groupname,$action,$cdom,$cnum) = @_; |
my ($groupname,$action,$cdom,$cnum) = @_; |
my %sectioncount; |
my %sectioncount; |
my $numsec=&Apache::loncommon::get_sections($cdom,$cnum,\%sectioncount); |
my $numsec=&Apache::loncommon::get_sections($cdom,$cnum,\%sectioncount); |
my %curr_groups; |
my %curr_groups = &Apache::loncommon::coursegroups($cdom,$cnum); |
my $numgroups=&Apache::loncommon::coursegroups(\%curr_groups,$cdom,$cnum); |
|
|
|
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
igna => 'Invalid group name', |
igna => 'Invalid group name', |
tgne => 'The group name entered ', |
tgne => 'The group name entered ', |
Line 3427 sub validate_groupname {
|
Line 3427 sub validate_groupname {
|
thgr => '- does not correspond to the name of an existing'. |
thgr => '- does not correspond to the name of an existing'. |
' group ', |
' group ', |
); |
); |
|
|
my $exitmsg = '<b>'.$lt{'igna'}.'</b><br /><br />'.$lt{'tgne'}.' "'. |
my $exitmsg = '<b>'.$lt{'igna'}.'</b><br /><br />'.$lt{'tgne'}.' "'. |
$groupname.'" '; |
$groupname.'" '; |
my $dupmsg = $lt{'grna'}; |
my $dupmsg = $lt{'grna'}; |
Line 3443 sub validate_groupname {
|
Line 3443 sub validate_groupname {
|
return $earlyout; |
return $earlyout; |
} |
} |
} |
} |
if ($action eq 'create') { |
if ($action eq 'create' |
if ($numgroups) { |
&& exists($curr_groups{$groupname})) { |
if (exists($curr_groups{$groupname})) { |
|
$earlyout = $exitmsg.$lt{'cnnb'}.&mt('an existing group'). |
return $exitmsg.$lt{'cnnb'}.&mt('an existing group'). |
$lt{'inth'}.'<br />'.$lt{'grna'}; |
$lt{'inth'}.'<br />'.$lt{'grna'}; |
return $earlyout; |
|
} |
|
} |
|
} elsif ($action eq 'modify') { |
} elsif ($action eq 'modify') { |
unless(exists($curr_groups{$groupname})) { |
unless(exists($curr_groups{$groupname})) { |
$earlyout = &mt('Group name:').' '.$groupname.$lt{'thgr'}.$lt{'inth'}; |
$earlyout = &mt('Group name:').' '.$groupname.$lt{'thgr'}.$lt{'inth'}; |