Added notifications preferences, and connectors to email, pager, and icq.
This commit is contained in:
parent
c85c90ae3b
commit
9b2a05de03
3 changed files with 65 additions and 13 deletions
|
|
@ -84,7 +84,7 @@ INSERT INTO international VALUES (16,'FAQ','English','[top]');
|
|||
INSERT INTO international VALUES (509,'WebGUI','English','Discussion Layout');
|
||||
INSERT INTO international VALUES (510,'WebGUI','English','Flat');
|
||||
INSERT INTO international VALUES (511,'WebGUI','English','Threaded');
|
||||
INSERT INTO userProfileField VALUES ('discussionLayout','WebGUI::International::get(509)',1,0,'select','{\r\n threaded=>WebGUI::International::get(511),\r\n flat=>WebGUI::International::get(510)\r\n}','[threaded]',5,4,0);
|
||||
INSERT INTO userProfileField VALUES ('discussionLayout','WebGUI::International::get(509)',1,0,'select','{\r\n threaded=>WebGUI::International::get(511),\r\n flat=>WebGUI::International::get(510)\r\n}','[\'threaded\']',5,4,0);
|
||||
INSERT INTO international VALUES (512,'WebGUI','English','Next Thread');
|
||||
INSERT INTO international VALUES (513,'WebGUI','English','Previous Thread');
|
||||
delete from international where internationalId=10 and namespace='MessageBoard';
|
||||
|
|
@ -682,6 +682,13 @@ INSERT INTO international VALUES (496,'WebGUI','Dansk','Hvilken editor bruges');
|
|||
INSERT INTO international VALUES (497,'WebGUI','Dansk','Start dato');
|
||||
INSERT INTO international VALUES (498,'WebGUI','Dansk','Slut dato');
|
||||
INSERT INTO international VALUES (499,'WebGUI','Dansk','Wobject ID');
|
||||
INSERT INTO international VALUES (518,'WebGUI','English','INBOX Notifications');
|
||||
INSERT INTO international VALUES (519,'WebGUI','English','I would not like to be notified.');
|
||||
INSERT INTO international VALUES (520,'WebGUI','English','I would like to be notified via email.');
|
||||
INSERT INTO international VALUES (521,'WebGUI','English','I would like to be notified via email to pager.');
|
||||
INSERT INTO international VALUES (522,'WebGUI','English','I would like to be notified via ICQ.');
|
||||
INSERT INTO userProfileField VALUES ('INBOXNotifications','WebGUI::International::get(518)',1,0,'select','{ \r\n none=>WebGUI::International::get(519),\r\n email=>WebGUI::International::get(520),\r\n emailToPager=>WebGUI::International::get(521),\r\n icq=>WebGUI::International::get(522)\r\n}','[\'email\']', 6,4,0);
|
||||
INSERT INTO international VALUES (523,'WebGUI','English','Notification');
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,23 +11,68 @@ package WebGUI::MessageLog;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Mail;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getUserInfo {
|
||||
my (%default, $key, %user, %profile, $value);
|
||||
tie %user, 'Tie::CPHash';
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId='$_[0]'");
|
||||
if ($user{userId} ne "") {
|
||||
%profile = WebGUI::SQL->buildHash("select userProfileField.fieldName, userProfileData.fieldData
|
||||
from userProfileData, userProfileField
|
||||
where userProfileData.fieldName=userProfileField.fieldName and userProfileData.userId=$user{userId}");
|
||||
%user = (%user, %profile);
|
||||
%default = WebGUI::SQL->buildHash("select fieldName, dataDefault from userProfileField where profileCategoryId=4");
|
||||
foreach $key (keys %default) {
|
||||
if ($user{$key} eq "") {
|
||||
$value = eval($default{$key});
|
||||
if (ref $value eq "ARRAY") {
|
||||
$user{$key} = $$value[0];
|
||||
} else {
|
||||
$user{$key} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%user;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub addEntry {
|
||||
my ($user, %userLanguage, $messageLogId, %message);
|
||||
my (@users, $messageLogId,$sth, $user, %message, %subject, $message, $subject);
|
||||
$messageLogId = getNextId("messageLogId");
|
||||
if ($_[0] ne "") {
|
||||
($userLanguage{$_[0]}) = WebGUI::SQL->quickArray("select language from users where userId=$_[0]");
|
||||
}
|
||||
if ($_[1] ne "") {
|
||||
%userLanguage = (WebGUI::SQL->buildHash("select users.userId,users.language from groupings,users where groupings.groupId=$_[1] and groupings.userId=users.userId"),%userLanguage);
|
||||
}
|
||||
%message = WebGUI::SQL->buildHash("select language,message from international where internationalId=$_[3] and namespace='$_[4]'");
|
||||
foreach $user (keys %userLanguage) {
|
||||
WebGUI::SQL->write("insert into messageLog values ($messageLogId,$user,".quote($message{$userLanguage{$user}}).",".quote($_[2]).",".time().")");
|
||||
# here is where we'll trigger communication with external systems like email
|
||||
%subject = WebGUI::SQL->buildHash("select language,message from international where internationalId=523 and namespace='WebGUI'");
|
||||
if ($_[1] ne "") {
|
||||
@users = WebGUI::SQL->quickArray("select userId from groupings where groupId=$_[1]");
|
||||
}
|
||||
@users = ($_[0],@users);
|
||||
foreach $user (@users) {
|
||||
$user = _getUserInfo($user);
|
||||
if (${$user}{userId} ne "") {
|
||||
WebGUI::SQL->write("insert into messageLog values ($messageLogId,".${$user}{userId}.",
|
||||
".quote($message{${$user}{language}}).",".quote($_[2]).",".time().")");
|
||||
$subject = $subject{${$user}{language}};
|
||||
$message = $message{${$user}{language}}."\n".WebGUI::URL::append('http://'.$session{env}{HTTP_HOST}.$_[2],'mlog='.$messageLogId);
|
||||
if (${$user}{INBOXNotifications} = "email") {
|
||||
if (${$user}{email} ne "") {
|
||||
WebGUI::Mail::send(${$user}{email},$subject,$message);
|
||||
}
|
||||
} elsif (${$user}{INBOXNotifications} = "emailToPager") {
|
||||
if (${$user}{emailToPagerGateway} ne "") {
|
||||
WebGUI::Mail::send(${$user}{emailToPagerGateway},$subject,$message);
|
||||
}
|
||||
} elsif (${$user}{INBOXNotifications} = "icq") {
|
||||
if (${$user}{icq}) {
|
||||
WebGUI::Mail::send(${$user}{icq}.'@pager.icq.com',$subject,$message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +82,7 @@ sub completeEntry {
|
|||
$completeMessage = WebGUI::International::get(350);
|
||||
# unfortunately had to loop through reading and writing because I couldn't
|
||||
# find a concatination function that worked the same in all DB servers
|
||||
$sth = WebGUI::SQL->read("select message,userId from messageLog where messageLogId=$_[0]");
|
||||
$sth = WebGUI::SQL->read("select message,userId from messageLog where messageLogId='$_[0]'");
|
||||
while (@data = $sth->array) {
|
||||
WebGUI::SQL->write("update messageLog set message=".quote($completeMessage.": ".$data[0]).", dateOfEntry=".time()." where messageLogId='$_[0]' and userId=$data[1]");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ sub _weblogView {
|
|||
$p = WebGUI::Paginator->new(WebGUI::URL::page(),\@row,$_[0]->get("submissionsPerPage"));
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarSimple($session{form}{pn});
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue