ability to override notification email for group

This commit is contained in:
Evgeny Gryaznov 2011-03-01 23:56:27 +01:00
parent 10e676e05f
commit dd595fc4f7
6 changed files with 44 additions and 10 deletions

View File

@ -13,6 +13,16 @@
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="php">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />

View File

@ -51,6 +51,7 @@ function store_message($name, $email, $info, $message,$groupid,$referrer) {
$groupid = "";
$groupname = "";
$group = NULL;
loadsettings();
if($settings['enablegroups'] == '1') {
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
@ -108,7 +109,11 @@ store_message($visitor_name, $email, $info, $message, $groupid, $referrer);
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale);
$inbox_mail = $settings['email'];
if (isset($group) && !empty($group['vcemail'])) {
$inbox_mail = $group['vcemail'];
} else {
$inbox_mail = $settings['email'];
}
if($inbox_mail) {
$link = connect();

View File

@ -144,6 +144,7 @@ form.field.groupcommonname.description=Name in English.
form.field.groupcommonname=International name
form.field.groupdesc.description=Description of the group.
form.field.groupdesc=Description
form.field.groupemail.description=Group email for notifications. Leave empty to use the default address.
form.field.groupname.description=Name to identify the group.
form.field.groupname=Name
form.field.login.description=Login can consist of small Latin letters and underscore.

View File

@ -144,6 +144,7 @@ form.field.groupcommonname.description=
form.field.groupcommonname=Интернациональное название
form.field.groupdesc.description=Будет доступно посетителям при выборе группы.
form.field.groupdesc=Описание
form.field.groupemail.description=Адрес для извещений. Оставьте пустым, чтобы использовать глобальный адрес.
form.field.groupname.description=Может быть названием отдела в вашей компании.
form.field.groupname=Название группы
form.field.login.description=Логин может состоять из маленьких латинских букв и знака подчеркивания.

View File

@ -39,16 +39,17 @@ function group_by_name($name)
return $group;
}
function create_group($name, $descr, $commonname, $commondescr)
function create_group($name, $descr, $commonname, $commondescr, $email)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(
"insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
"insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription,vcemail) values ('%s','%s','%s','%s','%s')",
mysql_real_escape_string($name),
mysql_real_escape_string($descr),
mysql_real_escape_string($commonname),
mysql_real_escape_string($commondescr));
mysql_real_escape_string($commondescr),
mysql_real_escape_string($email));
perform_query($query, $link);
$id = mysql_insert_id($link);
@ -58,16 +59,17 @@ function create_group($name, $descr, $commonname, $commondescr)
return $newdep;
}
function update_group($groupid, $name, $descr, $commonname, $commondescr)
function update_group($groupid, $name, $descr, $commonname, $commondescr, $email)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(
"update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where groupid = %s",
"update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s', vcemail = '%s' where groupid = %s",
mysql_real_escape_string($name),
mysql_real_escape_string($descr),
mysql_real_escape_string($commonname),
mysql_real_escape_string($commondescr),
mysql_real_escape_string($email),
$groupid);
perform_query($query, $link);
@ -81,10 +83,14 @@ if (isset($_POST['name'])) {
$description = getparam('description');
$commonname = getparam('commonname');
$commondescription = getparam('commondescription');
$email = getparam('email');
if (!$name)
$errors[] = no_field("form.field.groupname");
if ($email != '' && !is_valid_email($email))
$errors[] = wrong_field("form.field.mail");
$existing_group = group_by_name($name);
if ((!$groupid && $existing_group) ||
($groupid && $existing_group && $groupid != $existing_group['groupid']))
@ -92,11 +98,11 @@ if (isset($_POST['name'])) {
if (count($errors) == 0) {
if (!$groupid) {
$newdep = create_group($name, $description, $commonname, $commondescription);
$newdep = create_group($name, $description, $commonname, $commondescription, $email);
header("Location: $webimroot/operator/groupmembers.php?gid=" . $newdep['groupid']);
exit;
} else {
update_group($groupid, $name, $description, $commonname, $commondescription);
update_group($groupid, $name, $description, $commonname, $commondescription, $email);
header("Location: $webimroot/operator/group.php?gid=$groupid&stored");
exit;
}
@ -105,6 +111,7 @@ if (isset($_POST['name'])) {
$page['formdescription'] = topage($description);
$page['formcommonname'] = topage($commonname);
$page['formcommondescription'] = topage($commondescription);
$page['formemail'] = topage($email);
$page['grid'] = topage($groupid);
}
@ -120,6 +127,7 @@ if (isset($_POST['name'])) {
$page['formdescription'] = topage($group['vclocaldescription']);
$page['formcommonname'] = topage($group['vccommonname']);
$page['formcommondescription'] = topage($group['vccommondescription']);
$page['formemail'] = topage($group['vcemail']);
$page['grid'] = topage($group['groupid']);
}
}
@ -129,4 +137,4 @@ prepare_menu($operator);
setup_group_settings_tabs($groupid, 0);
start_html_output();
require('../view/group.php');
?>
?>

View File

@ -85,7 +85,16 @@ require_once('inc_errors.php');
<div class="fdescr"> &mdash; <?php echo getlocal('form.field.groupcommondesc.description') ?></div>
<br clear="all"/>
</div>
<div class="field">
<div class="flabel"><?php echo getlocal('form.field.mail') ?></div>
<div class="fvalue">
<input type="text" name="email" size="40" value="<?php echo form_value('email') ?>" class="formauth"/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('form.field.groupemail.description') ?></div>
<br clear="all"/>
</div>
<div class="fbutton">
<input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/>
</div>