[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonhtmlcommon.pm lonnotify.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 13 Oct 2005 22:37:41 -0000
This is a MIME encoded message
--raeburn1129243061
Content-Type: text/plain
raeburn Thu Oct 13 18:37:41 2005 EDT
Modified files:
/loncom/interface lonnotify.pm loncommon.pm lonhtmlcommon.pm
Log:
Allow course owner to be selected as a role on 'Select audience' page.
Display users for whom e-mail addresses could not be identified on 'Compose Page'.
Convert returns to <br /> when displaying sent messages.
--raeburn1129243061
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20051013183741.txt"
Index: loncom/interface/lonnotify.pm
diff -u loncom/interface/lonnotify.pm:1.4 loncom/interface/lonnotify.pm:1.5
--- loncom/interface/lonnotify.pm:1.4 Tue Oct 11 17:29:39 2005
+++ loncom/interface/lonnotify.pm Thu Oct 13 18:37:40 2005
@@ -176,9 +176,7 @@
$output .= '<td>';
my @domcc = ();
foreach my $server (keys %personnel) {
- print STDERR "key level 1 is $server\n";
foreach my $user (sort(keys %{$personnel{$server}})) {
- print STDERR "key level 2 is $user\n";
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
unless (grep/^$uname:$udom$/,@domcc) {
my %userinfo = &Apache::lonnet::get('environment',['lastname','firstname'],$udom,$uname);
@@ -289,7 +287,7 @@
$recipients .= $dcmail{$msgid}{recipients}{$user}.', ';
}
$recipients =~ s/,\s$//;
- $output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.$dcmail{$msgid}{subject}.'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.$dcmail{$msgid}{message}.'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n";
+ $output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{subject}).'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{message}).'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n";
$rowNum ++;
}
} else {
@@ -328,9 +326,10 @@
}
$recipients =~ s/,\s$//;
}
+
my ($date,$subj,$sname,$sdom,$cdom) = split(/:/,$msgid,5);
$date = &Apache::lonlocal::locallocaltime($date);
- $output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.$dcmail{$msgid}{subject}.'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.$dcmail{$msgid}{message}.'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n";
+ $output .= '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{subject}).'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{message}).'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n";
$rowNum ++;
}
}
@@ -413,7 +412,7 @@
<form method="post" name="$formname">
ENDONE
$output .= &Apache::lonhtmlcommon::start_pick_box($table_width);
- my @roles = ('cc','in','ta','ep','ad','st','cr');
+ my @roles = ('ow','cc','in','ta','ep','ad','st','cr');
my %longtypes = ();
my %authtypes = ();
&form_elements(\%longtypes,\%authtypes);
@@ -581,7 +580,15 @@
$output .= '<tr><td><input type="checkbox" name="recipient" value="'.$value.'" checked="checked" /></td><td>'.$username.'</td><td> </td><td>'.$recipients{$username}.'</td></tr>';
}
}
- $output .= '</table></td>';
+ $output .= '</table>';
+ if (@unmatched) {
+ $output .= '<br /><br />'.&mt('Could not determine e-mail addresses for the following users:').'<ul>';
+ foreach my $username (sort @unmatched) {
+ $output .= '<li>'.$username.'</li>';
+ }
+ $output .= '</ul>';
+ }
+ $output .= '</td>';
$output .= &Apache::lonhtmlcommon::row_closure();
$output .= &Apache::lonhtmlcommon::row_title($col_width,$tablecolor,&mt('Sender e-mail address'));
$output .= '<td><input type="text" name="sender" value="'.$sender.'" /></td>';
@@ -638,6 +645,7 @@
my @deliveries = ();
&broadcast_email(\@recipients,$subject,$from,$message,\@deliveries);
if (@deliveries > 0) {
+ &store_mail($subject,$message,$dom,\@deliveries);
$output .= '<tr>
<td>
<table cellpadding="4" cellspacing="2" width="100%">
@@ -649,8 +657,8 @@
</tr>
<tr bgcolor="#eeeeee">
<td valign="middle">Sent</td>
- <td valign="middle">'.$subject.'</td>
- <td valign="middle">'.$message.'</td>
+ <td valign="middle">'.&cr_to_br($subject).'</td>
+ <td valign="middle">'.&cr_to_br($message).'</td>
<td>';
foreach my $person (@deliveries) {
my ($username,$email) = split(/:/,$person);
@@ -696,7 +704,7 @@
}
sub get_user_info {
- my ($user,%email_defaults,$ltext) = @_;
+ my ($user,%email_defaults) = @_;
my ($uname,$udom) = split(/:/,$user);
my @emailtypes = ('permanentemail','critnotification','notification');
my %userinfo = &Apache::lonnet::get('environment',\@emailtypes,$udom,$uname);
@@ -715,7 +723,7 @@
$email = $uname.'@'.$email_defaults{$authtype}{$autharg};
}
} else {
- if (defined($email_defaults{$authtype})) {
+ if ((defined($email_defaults{$authtype})) && ($email_defaults{$authtype} ne '')) {
$email = $uname.'@'.$email_defaults{$authtype};
}
}
@@ -733,7 +741,7 @@
%{$authtypes} = (
krb4 => 'Kerberos 4',
krb5 => 'Kerberos 5',
- int => 'Internal (LON-CAPA)',
+ internal => 'Internal (LON-CAPA)',
unix => 'Filesystem (UNIX)',
local => 'Local/Customized',
);
@@ -857,4 +865,11 @@
return $output;
}
+sub cr_to_br {
+ my $incoming = shift;
+ $incoming =~ s/\n/\<br \/\>/g;
+ return $incoming;
+}
+
+
1;
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.278 loncom/interface/loncommon.pm:1.279
--- loncom/interface/loncommon.pm:1.278 Tue Oct 4 14:49:32 2005
+++ loncom/interface/loncommon.pm Thu Oct 13 18:37:40 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.278 2005/10/04 18:49:32 raeburn Exp $
+# $Id: loncommon.pm,v 1.279 2005/10/13 22:37:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3118,6 +3118,15 @@
}
}
}
+ if (grep/^ow$/,@{$roles}) {
+ if ((defined($cdom)) && (defined($cnum))) {
+ my %csettings = &Apache::lonnet::get('environment',['internal.courseowner'],$cdom,$cnum);
+ if ( defined($csettings{'internal.courseowner'}) ) {
+ my $owner = $csettings{'internal.courseowner'};
+ $$users{'ow'}{$owner.':'.$cdom} = 'any';
+ }
+ }
+ }
}
return;
}
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.113 loncom/interface/lonhtmlcommon.pm:1.114
--- loncom/interface/lonhtmlcommon.pm:1.113 Thu Oct 13 14:31:06 2005
+++ loncom/interface/lonhtmlcommon.pm Thu Oct 13 18:37:40 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.113 2005/10/13 18:31:06 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.114 2005/10/13 22:37:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1337,7 +1337,12 @@
$output .= qq| <td>
<select name="roles" multiple >\n|;
foreach my $role (@$roles) {
- my $plrole=&Apache::lonnet::plaintext($role);
+ my $plrole;
+ if ($role eq 'ow') {
+ $plrole = &mt('Course Owner');
+ } else {
+ $plrole=&Apache::lonnet::plaintext($role);
+ }
$output .= ' <option value="'.$role.'">'.$plrole.'</option>';
}
$output .= qq| </select>
@@ -1354,10 +1359,10 @@
<script type="text/javascript" language="Javascript" >
function coursePick (formname) {
for (var i=0; i<formname.coursepick.length; i++) {
+ if (formname.coursepick[i].value == 'category') {
+ courseSet('');
+ }
if (!formname.coursepick[i].checked) {
- if (formname.coursepick[i].value == 'category') {
- courseSet('');
- }
if (formname.coursepick[i].value == 'specific') {
formname.coursetotal.value = 0;
formname.courselist = '';
@@ -1365,6 +1370,15 @@
}
}
}
+ function setPick (formname) {
+ for (var i=0; i<formname.coursepick.length; i++) {
+ if (formname.coursepick[i].value == 'category') {
+ formname.coursepick[i].checked = true;
+ }
+ formname.coursetotal.value = 0;
+ formname.courselist = '';
+ }
+ }
</script>
|;
my $courseform='<b>'.&Apache::loncommon::selectcourse_link
@@ -1376,7 +1390,7 @@
$output .= '<br /><input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />';
$output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n".
'<select name="'.$$codetitles[0].
- '" onChange="courseSet('."'$$codetitles[0]'".')">'."\n".
+ '" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n".
' <option value="-1" />Select'."\n";
my @items = ();
my @longitems = ();
--raeburn1129243061--