show if group is online, filter out empty groups in redirect and visitor selector, captcha checkbox in settings

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@592 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-07-19 00:07:34 +00:00
parent a7f2464ba6
commit 2efea86167
12 changed files with 73 additions and 17 deletions

View File

@ -8,5 +8,5 @@
Your username:$username Your username:$username
Your new password:$password Your new password:$password
click here to confirm the changes." click here to confirm the changes."
Mail($to, $subj, $message); # mail($to, $subj, $message);
?> ?>

View File

@ -282,10 +282,23 @@ function setup_survey($name, $email, $groupid, $info, $referrer) {
$page['referrer'] = urlencode(topage($referrer)); $page['referrer'] = urlencode(topage($referrer));
if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") {
$allgroups = get_groups(false); $link = connect();
$allgroups = get_groups($link,true,true);
mysql_close($link);
$val = ""; $val = "";
foreach($allgroups as $k) { foreach($allgroups as $k) {
$val .= "<option value=\"".$k['groupid']."\"".($k['groupid'] == $groupid ? " selected=\"selected\"" : "").">".$k['vclocalname']."</option>"; $groupname = $k['vclocalname'];
if($k['inumofagents'] == 0) {
continue;
}
if($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) {
$groupname .= " (online)";
if(!$groupid) {
$groupid = $k['groupid'];
}
}
$isselected = $k['groupid'] == $groupid;
$val .= "<option value=\"".$k['groupid']."\"".($isselected ? " selected=\"selected\"" : "").">$groupname</option>";
} }
$page['groups'] = $val; $page['groups'] = $val;
} }

View File

@ -211,8 +211,7 @@ function setup_redirect_links($threadid,$token) {
$operators = select_multi_assoc($query, $link); $operators = select_multi_assoc($query, $link);
if($settings['enablegroups'] == "1") { if($settings['enablegroups'] == "1") {
$query = "select groupid, vclocalname, vccommonname from chatgroup order by vclocalname $limit"; $groups = get_groups($link, true, true);
$groups = select_multi_assoc($query, $link);
} }
mysql_close($link); mysql_close($link);
@ -233,11 +232,15 @@ function setup_redirect_links($threadid,$token) {
if($settings['enablegroups'] == "1") { if($settings['enablegroups'] == "1") {
$params = array('thread' => $threadid, 'token' => $token); $params = array('thread' => $threadid, 'token' => $token);
foreach($groups as $group) { foreach($groups as $group) {
if($group['inumofagents'] == 0) {
continue;
}
$params['nextGroup'] = $group['groupid']; $params['nextGroup'] = $group['groupid'];
$online = $group['ilastseen'] < $settings['online_timeout'] ? getlocal("char.redirect.operator.online_suff") : "";
$group_list .= "<li><a href=\"".add_params($webimroot."/operator/redirect.php",$params). $group_list .= "<li><a href=\"".add_params($webimroot."/operator/redirect.php",$params).
"\" title=\"".topage(get_group_name($group))."\">". "\" title=\"".topage(get_group_name($group))."\">".
topage(get_group_name($group)). topage(get_group_name($group)).
"</a></li>"; "</a> $online</li>";
} }
} }
$page['redirectToGroup'] = $group_list; $page['redirectToGroup'] = $group_list;
@ -276,16 +279,19 @@ function prepare_menu($operator,$hasright=true) {
} }
} }
function get_groups($countagents) { function get_groups($link,$countagents, $checkonline=false) {
$link = connect();
$query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription". $query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription".
($countagents ($countagents
? ", (SELECT count(*) from chatgroupoperator where chatgroup.groupid = chatgroupoperator.groupid) as inumofagents" ? ", (SELECT count(*) from chatgroupoperator where chatgroup.groupid = chatgroupoperator.groupid) as inumofagents"
: ""). : "").
($checkonline
? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
"from chatgroupoperator, chatoperator where chatgroup.groupid = chatgroupoperator.groupid ".
"and chatgroupoperator.operatorid = chatoperator.operatorid) as ilastseen"
: "").
" from chatgroup order by vclocalname"; " from chatgroup order by vclocalname";
$result = select_multi_assoc($query, $link); return select_multi_assoc($query, $link);
mysql_close($link);
return $result;
} }
function get_operator_groupids($operatorid) { function get_operator_groupids($operatorid) {

View File

@ -390,6 +390,8 @@ settings.geolinkparams.description=Window size and toolbars hiding
settings.geolinkparams=Geolocation window options settings.geolinkparams=Geolocation window options
settings.host.description=Destination for you company name or logo link settings.host.description=Destination for you company name or logo link
settings.host=URL of your website settings.host=URL of your website
settings.leavemessage_captcha.description=Protection against automated spam (captcha)
settings.leavemessage_captcha=Force visitor to enter verification code when leaving message
settings.logo.description=Enter http address of your company logo settings.logo.description=Enter http address of your company logo
settings.logo=Your company logo settings.logo=Your company logo
settings.no.title=Please enter your company title settings.no.title=Please enter your company title

View File

@ -386,6 +386,8 @@ settings.geolinkparams.description=
settings.geolinkparams=Опции для окна с геоинформацией settings.geolinkparams=Опции для окна с геоинформацией
settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне
settings.host=Ссылка на ваш веб сайт settings.host=Ссылка на ваш веб сайт
settings.leavemessage_captcha.description=Защита от автоматизированного спама (captcha)
settings.leavemessage_captcha=Разрешать оставлять сообщение только после ввода специального кода с картинки
settings.logo.description=Введите ссылку на логотип компании settings.logo.description=Введите ссылку на логотип компании
settings.logo=Лого компании settings.logo=Лого компании
settings.no.title=Введите имя Вашей компании settings.no.title=Введите имя Вашей компании

View File

@ -81,7 +81,9 @@ if($settings['enablegroups'] == '1') {
} }
} }
$allgroups = get_groups(false); $link = connect();
$allgroups = get_groups($link, false);
mysql_close($link);
$page['groups'] = array(); $page['groups'] = array();
$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach($allgroups as $g) { foreach($allgroups as $g) {

View File

@ -25,7 +25,8 @@ $options = array(
'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', 'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics',
'enablessl', 'forcessl', 'enablessl', 'forcessl',
'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage',
'enablepopupnotification'); 'enablepopupnotification',
'enablecaptcha');
loadsettings(); loadsettings();
$params = array(); $params = array();

View File

@ -92,7 +92,9 @@ $page['availableLocales'] = $image_locales;
$page['availableStyles'] = $stylelist; $page['availableStyles'] = $stylelist;
if($settings['enablegroups'] == '1') { if($settings['enablegroups'] == '1') {
$allgroups = get_groups(false); $link = connect();
$allgroups = get_groups($link,false);
mysql_close($link);
$page['groups'] = array(); $page['groups'] = array();
$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
foreach($allgroups as $g) { foreach($allgroups as $g) {

View File

@ -40,8 +40,15 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
} }
} }
function is_online($group) {
global $settings;
return $group['ilastseen'] && $group['ilastseen'] < $settings['online_timeout'] ? "1" : "";
}
$page = array(); $page = array();
$page['groups'] = get_groups(true); $link = connect();
$page['groups'] = get_groups($link, true, true);
mysql_close($link);
$page['canmodify'] = is_capable($can_administrate, $operator); $page['canmodify'] = is_capable($can_administrate, $operator);
prepare_menu($operator); prepare_menu($operator);

View File

@ -27,9 +27,12 @@ function update_operator_groups($operatorid,$newvalue) {
mysql_close($link); mysql_close($link);
} }
$opId = verifyparam( "op","/^\d{1,9}$/"); $opId = verifyparam( "op","/^\d{1,9}$/");
$page = array('opid' => $opId); $page = array('opid' => $opId);
$page['groups'] = get_groups(false); $link = connect();
$page['groups'] = get_groups($link, false);
mysql_close($link);
$errors = array(); $errors = array();
$canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator)) $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))

View File

@ -177,6 +177,15 @@ require_once('inc_errors.php');
<br clear="all"/> <br clear="all"/>
</div> </div>
<div class="field">
<div class="flabel"><?php echo getlocal('settings.leavemessage_captcha') ?></div>
<div class="fvalue">
<input type="checkbox" name="enablecaptcha" value="on"<?php echo form_value_cb('enablecaptcha') ? " checked=\"checked\"" : "" ?>/>
</div>
<div class="fdescr"> &mdash; <?php echo getlocal('settings.leavemessage_captcha.description') ?></div>
<br clear="all"/>
</div>
<div class="fbutton"> <div class="fbutton">
<input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/> <input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/>
</div> </div>

View File

@ -49,6 +49,8 @@ require_once('inc_errors.php');
<?php echo getlocal("form.field.groupname") ?> <?php echo getlocal("form.field.groupname") ?>
</th><th> </th><th>
<?php echo getlocal("form.field.groupdesc") ?> <?php echo getlocal("form.field.groupdesc") ?>
</th><th>
<?php echo getlocal("page_agents.status") ?>
</th><th> </th><th>
<?php echo getlocal("page.group.membersnum") ?> <?php echo getlocal("page.group.membersnum") ?>
<?php if($page['canmodify']) { ?> <?php if($page['canmodify']) { ?>
@ -70,6 +72,13 @@ if(count($page['groups']) > 0) {
<td class="notlast"> <td class="notlast">
<?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "&lt;none&gt;" ?> <?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "&lt;none&gt;" ?>
</td> </td>
<td class="notlast">
<?php if(is_online($grp)) { ?>
<?php echo getlocal("page_agents.isonline") ?>
<?php } else { ?>
<?php echo date_to_text(time() - ($grp['ilastseen'] ? $grp['ilastseen'] : time())) ?>
<?php } ?>
</td>
<td> <td>
<a href="<?php echo $webimroot ?>/operator/groupmembers.php?gid=<?php echo $grp['groupid'] ?>"> <a href="<?php echo $webimroot ?>/operator/groupmembers.php?gid=<?php echo $grp['groupid'] ?>">
<?php echo htmlspecialchars(topage($grp['inumofagents'])) ?> <?php echo htmlspecialchars(topage($grp['inumofagents'])) ?>