version 1.104, 2008/12/14 02:45:48
|
version 1.107, 2009/01/04 17:43:19
|
Line 555 sub discourse {
|
Line 555 sub discourse {
|
} |
} |
|
|
sub disgroup { |
sub disgroup { |
my ($cdom,$cnum,$group,$access_status) = @_; |
my ($r,$cdom,$cnum,$group,$access_status) = @_; |
my $result; |
my $hasfloat; |
# Needs to be in a course |
# Needs to be in a course |
if (!($env{'request.course.fn'})) { |
if (!($env{'request.course.fn'})) { |
$result = &mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.'); |
$r->print('<span class="LC_error">'.&mt('Error: you must have a course role selected to be able to send a broadcast message to a group in the course.').'</span>'); |
return $result; |
return; |
} |
} |
if ($cdom eq '' || $cnum eq '') { |
if ($cdom eq '' || $cnum eq '') { |
$result = &mt('Error: could not determine domain or number of course'); |
$r->print('<span class="LC_error">'.&mt('Error: could not determine domain or number of course').'</span>'); |
return $result; |
return; |
} |
} |
my ($memberinfo,$numitems) = |
my ($memberinfo,$numitems) = |
&Apache::longroup::group_memberlist($cdom,$cnum,$group,{},[]); |
&Apache::longroup::group_memberlist($cdom,$cnum,$group,{},[]); |
Line 577 sub disgroup {
|
Line 577 sub disgroup {
|
push(@statustypes,('future','previous')); |
push(@statustypes,('future','previous')); |
} |
} |
if (keys(%{$memberinfo}) == 0) { |
if (keys(%{$memberinfo}) == 0) { |
$result = &mt('As this group has no members, there are no '. |
$r->print('<span class="LC_warning">'. |
'recipients to select.'); |
&mt('As this group has no members, there are no recipients to select'). |
return $result; |
'</span>'); |
|
return; |
} else { |
} else { |
|
$hasfloat = 1; |
|
$r->print('<div class="LC_left_float">'); |
my %Sortby = ( |
my %Sortby = ( |
active => {}, |
active => {}, |
previous => {}, |
previous => {}, |
Line 606 sub disgroup {
|
Line 609 sub disgroup {
|
push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user); |
push(@{$Sortby{$status}{$$memberinfo{$user}{fullname}}},$user); |
} |
} |
} |
} |
$result .= &group_check_uncheck(); |
$r->print(&group_check_uncheck()); |
foreach my $status (@statustypes) { |
foreach my $status (@statustypes) { |
if (ref($numitems) eq 'HASH') { |
if (ref($numitems) eq 'HASH') { |
if ((defined($$numitems{$status})) && ($$numitems{$status})) { |
if ((defined($$numitems{$status})) && ($$numitems{$status})) { |
Line 614 sub disgroup {
|
Line 617 sub disgroup {
|
if (ref($access_status) eq 'HASH') { |
if (ref($access_status) eq 'HASH') { |
$access_status->{$status} = $$numitems{$status}; |
$access_status->{$status} = $$numitems{$status}; |
} |
} |
$result.='<fieldset><legend><b>'.$lt{$status}. |
$r->print('<fieldset><legend><b>'.$lt{$status}. |
'</b></legend><form name="'.$formname.'">'. |
'</b></legend><form name="'.$formname.'">'. |
'<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'. |
'<input type="button" value="'.&mt('Check All').'" '. |
'<input type="button" value="'.&mt('Check All').'" '. |
'onclick="javascript:toggleAll('."this.form,'check'".')" />'. |
'onclick="javascript:toggleAll('."this.form,'check'".')" />'. |
' '. |
' '. |
'<input type="button" value="'.&mt('Uncheck All').'" '. |
'<input type="button" value="'.&mt('Uncheck All').'" '. |
'onclick="javascript:toggleAll('."this.form,'uncheck'".')" />'. |
'onclick="javascript:toggleAll('."this.form,'uncheck'".')" />'. |
'</span>'; |
'</span>'); |
if ($status eq 'active') { |
if ($status eq 'active') { |
$result .= ' <select name="groupmail">'. |
$r->print((' 'x3).'<select name="groupmail">'. |
'<option value="bcc" selected="selected">'.&mt('Bcc').'</option>'. |
'<option value="bcc" selected="selected">'.&mt('Bcc').'</option>'. |
'<option value="cc">'.&mt('Cc').'</option>'. |
'<option value="cc">'.&mt('Cc').'</option>'. |
'</select>'; |
'</select>'); |
} |
} |
$result .= '<br />'.&Apache::loncommon::start_data_table(). |
$r->print('<br />'.&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
"<th>$lt{'name'}</a></th>". |
"<th>$lt{'name'}</th>". |
"<th>$lt{'usnm'}</a></th>". |
"<th>$lt{'usnm'}</th>". |
"<th>$lt{'doma'}</a></th>". |
"<th>$lt{'doma'}</th>". |
&Apache::loncommon::end_data_table_header_row(); |
&Apache::loncommon::end_data_table_header_row()); |
foreach my $key (sort(keys(%{$Sortby{$status}}))) { |
foreach my $key (sort(keys(%{$Sortby{$status}}))) { |
foreach my $user (@{$Sortby{$status}{$key}}) { |
foreach my $user (@{$Sortby{$status}{$key}}) { |
$result .= |
$r->print(&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><span class="LC_nobreak"><input type="checkbox" '. |
'<td><input type="checkbox" '. |
|
'name="selectedusers_forminput" value="'. |
'name="selectedusers_forminput" value="'. |
$user.':'.$status.'" />'. |
$user.':'.$status.'" />'. |
$$memberinfo{$user}{'fullname'}.'</td>'. |
$$memberinfo{$user}{'fullname'}.'</span></td>'. |
'<td>'.$$memberinfo{$user}{'uname'}.'</td>'. |
'<td>'.$$memberinfo{$user}{'uname'}.'</td>'. |
'<td>'.$$memberinfo{$user}{'udom'}.'</td>'. |
'<td>'.$$memberinfo{$user}{'udom'}.'</td>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
$result .= &Apache::loncommon::end_data_table().'</form></fieldset><br />'; |
$r->print(&Apache::loncommon::end_data_table().'</form>'. |
|
'</fieldset><br /></div>'); |
} |
} |
} |
} |
} |
} |
} |
} |
return $result; |
return $hasfloat; |
} |
} |
|
|
sub group_check_uncheck { |
sub group_check_uncheck { |
Line 1322 sub compout {
|
Line 1325 sub compout {
|
} else { |
} else { |
$can_grp_broadcast = &check_group_priv($group); |
$can_grp_broadcast = &check_group_priv($group); |
if ($can_grp_broadcast) { |
if ($can_grp_broadcast) { |
$r->print('<div class="LC_left_float">'. |
$hasfloat = &disgroup($r,$cdom,$cnum,$group,\%access_status); |
&disgroup($cdom,$cnum,$group,\%access_status). |
|
'</div>'); |
|
$hasfloat = 1; |
|
} |
} |
} |
} |
if ($hasfloat) { |
if ($hasfloat) { |
Line 1813 $content{'sendername'}.':'.
|
Line 1813 $content{'sendername'}.':'.
|
} |
} |
# Check to see if there were any messages. |
# Check to see if there were any messages. |
if ($result eq '') { |
if ($result eq '') { |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = &mt(lc(&Apache::loncommon::course_type())); |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$r->print("<p><b>".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."</b></p>"); |
$r->print("<p><b>".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."</b></p>"); |
} else { |
} else { |
Line 2377 sub displaymessage {
|
Line 2377 sub displaymessage {
|
$bcclist = join(', ',@{$recipients{'bcc'}}); |
$bcclist = join(', ',@{$recipients{'bcc'}}); |
} |
} |
} |
} |
if (!$tolist && ref($content{'recuser'}) eq 'ARRAY') { |
|
|
my $broadcast_link; |
|
if (($content{'courseid'}) && ($content{'recipid'} && |
|
(ref($recipients{'course_broadcast'}) eq 'ARRAY') || |
|
(ref($recipients{'group_cc_broadcast'}) eq 'ARRAY') || |
|
(ref($recipients{'group_bcc_broadcast'}) eq 'ARRAY'))) { |
|
$broadcast_link = &recipients_link($r,\%content,\%recipients); |
|
} |
|
|
|
if (((!$tolist) && (!$broadcast_link)) && ref($content{'recuser'}) eq 'ARRAY') { |
my @recipients; |
my @recipients; |
for (my $i=0; $i<@{$content{'recuser'}}; $i++) { |
for (my $i=0; $i<@{$content{'recuser'}}; $i++) { |
$recipients[$i] = &Apache::loncommon::aboutmewrapper( |
$recipients[$i] = &Apache::loncommon::aboutmewrapper( |
Line 2404 sub displaymessage {
|
Line 2413 sub displaymessage {
|
$r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}).'</br>'); |
$r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}).'</br>'); |
} |
} |
|
|
my $broadcast_link; |
|
if (($content{'courseid'}) && ($content{'recipid'} && |
|
(ref($recipients{'course_broadcast'}) eq 'ARRAY') || |
|
(ref($recipients{'group_cc_broadcast'}) eq 'ARRAY') || |
|
(ref($recipients{'group_bcc_broadcast'}) eq 'ARRAY'))) { |
|
$broadcast_link = &recipients_link($r,\%content,\%recipients); |
|
} |
|
|
|
# Display LON-CAPA Message (Start) |
# Display LON-CAPA Message (Start) |
# Subject |
# Subject |
$r->print('</div>' |
$r->print('</div>' |
Line 2422 sub displaymessage {
|
Line 2423 sub displaymessage {
|
); |
); |
if ($folder eq 'sent') { |
if ($folder eq 'sent') { |
# To |
# To |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('To')) |
if ($tolist) { |
.$tolist |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('To')) |
.&Apache::lonhtmlcommon::row_closure() |
.$tolist |
); |
.&Apache::lonhtmlcommon::row_closure() |
|
); |
|
} |
if ($cclist) { |
if ($cclist) { |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Cc')) |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Cc')) |
.$cclist |
.$cclist |