WebGUI 2.4.0 release
This commit is contained in:
parent
2a61818564
commit
6286f9bfaf
74 changed files with 2332 additions and 548 deletions
48
lib/WebGUI/MessageLog.pm
Normal file
48
lib/WebGUI/MessageLog.pm
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package WebGUI::MessageLog;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub addEntry {
|
||||
my ($user, %userLanguage, $messageLogId, %message);
|
||||
$messageLogId = getNextId("messageLogId");
|
||||
if ($_[0] ne "") {
|
||||
($userLanguage{$_[0]}) = WebGUI::SQL->quickArray("select language from users where userId=$_[0]",$session{dbh});
|
||||
}
|
||||
if ($_[1] ne "") {
|
||||
%userLanguage = (WebGUI::SQL->buildHash("select users.userId,users.language from groupings,users where groupings.groupId=$_[1] and groupings.userId=users.userId",$session{dbh}),%userLanguage);
|
||||
}
|
||||
%message = WebGUI::SQL->buildHash("select language,message from international where internationalId=$_[3] and namespace='$_[4]'",$session{dbh});
|
||||
foreach $user (keys %userLanguage) {
|
||||
WebGUI::SQL->write("insert into messageLog values ($messageLogId,$user,".quote($message{$userLanguage{$user}}).",".quote($_[2]).",".time().")",$session{dbh});
|
||||
# here is where we'll trigger communication with external systems like email
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub completeEntry {
|
||||
my ($sth, @data, $completeMessage);
|
||||
$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]",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
WebGUI::SQL->write("update messageLog set message=".quote($completeMessage.": ".$data[0]).", dateOfEntry=".time()." where messageLogId='$_[0]' and userId=$data[1]",$session{dbh});
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue