mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 10:31:07 +03:00 
			
		
		
		
	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:
		
							parent
							
								
									a7f2464ba6
								
							
						
					
					
						commit
						2efea86167
					
				| @ -8,5 +8,5 @@ | ||||
| 	Your username:$username  | ||||
| 	Your new password:$password  | ||||
| 	click here to confirm the changes." | ||||
| Mail($to, $subj, $message); | ||||
| # mail($to, $subj, $message);
 | ||||
| 	?>
 | ||||
| @ -282,10 +282,23 @@ function setup_survey($name, $email, $groupid, $info, $referrer) { | ||||
| 	$page['referrer'] = urlencode(topage($referrer)); | ||||
| 
 | ||||
| 	if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { | ||||
| 		$allgroups = get_groups(false); | ||||
| 		$link = connect(); | ||||
| 		$allgroups = get_groups($link,true,true); | ||||
| 		mysql_close($link); | ||||
| 		$val = ""; | ||||
| 		foreach($allgroups as $k) {  | ||||
| 			$val .= "<option value=\"".$k['groupid']."\"".($k['groupid'] == $groupid ? " selected=\"selected\"" : "").">".$k['vclocalname']."</option>"; | ||||
| 		foreach($allgroups as $k) { | ||||
| 			$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; | ||||
| 	} | ||||
|  | ||||
| @ -211,8 +211,7 @@ function setup_redirect_links($threadid,$token) { | ||||
| 	$operators = select_multi_assoc($query, $link); | ||||
| 
 | ||||
| 	if($settings['enablegroups'] == "1") { | ||||
| 		$query = "select groupid, vclocalname, vccommonname from chatgroup order by vclocalname $limit"; | ||||
| 		$groups = select_multi_assoc($query, $link); | ||||
| 		$groups = get_groups($link, true, true); | ||||
| 	} | ||||
| 	 | ||||
| 	mysql_close($link); | ||||
| @ -233,11 +232,15 @@ function setup_redirect_links($threadid,$token) { | ||||
| 	if($settings['enablegroups'] == "1") { | ||||
| 		$params = array('thread' => $threadid, 'token' => $token); | ||||
| 		foreach($groups as $group) { | ||||
| 			if($group['inumofagents'] == 0) { | ||||
| 				continue; | ||||
| 			} | ||||
| 			$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). | ||||
| 								"\" title=\"".topage(get_group_name($group))."\">". | ||||
| 								topage(get_group_name($group)). | ||||
| 							"</a></li>"; | ||||
| 							"</a> $online</li>"; | ||||
| 		} | ||||
| 	} | ||||
| 	$page['redirectToGroup'] = $group_list; | ||||
| @ -276,16 +279,19 @@ function prepare_menu($operator,$hasright=true) { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function get_groups($countagents) { | ||||
| 	$link = connect(); | ||||
| function get_groups($link,$countagents, $checkonline=false) { | ||||
| 	$query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription". | ||||
| 			($countagents  | ||||
| 					? ", (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"; | ||||
| 	$result = select_multi_assoc($query, $link); | ||||
| 	mysql_close($link); | ||||
| 	return $result; | ||||
| 	return select_multi_assoc($query, $link); | ||||
| } | ||||
| 
 | ||||
| function get_operator_groupids($operatorid) { | ||||
|  | ||||
| @ -390,6 +390,8 @@ settings.geolinkparams.description=Window size and toolbars hiding | ||||
| settings.geolinkparams=Geolocation window options | ||||
| settings.host.description=Destination for you company name or logo link | ||||
| 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=Your company logo | ||||
| settings.no.title=Please enter your company title | ||||
|  | ||||
| @ -386,6 +386,8 @@ settings.geolinkparams.description= | ||||
| settings.geolinkparams=Опции для окна с геоинформацией | ||||
| settings.host.description=Будет открываться по нажатию на логотип или название компании в чат окне | ||||
| settings.host=Ссылка на ваш веб сайт | ||||
| settings.leavemessage_captcha.description=Защита от автоматизированного спама (captcha) | ||||
| settings.leavemessage_captcha=Разрешать оставлять сообщение только после ввода специального кода с картинки | ||||
| settings.logo.description=Введите ссылку на логотип компании | ||||
| settings.logo=Лого компании | ||||
| settings.no.title=Введите имя Вашей компании | ||||
|  | ||||
| @ -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('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); | ||||
| 	foreach($allgroups as $g) { | ||||
|  | ||||
| @ -25,7 +25,8 @@ $options = array( | ||||
| 		'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', | ||||
| 		'enablessl', 'forcessl',   | ||||
| 		'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', | ||||
| 		'enablepopupnotification'); | ||||
| 		'enablepopupnotification', | ||||
| 		'enablecaptcha'); | ||||
| 
 | ||||
| loadsettings(); | ||||
| $params = array(); | ||||
|  | ||||
| @ -92,7 +92,9 @@ $page['availableLocales'] = $image_locales; | ||||
| $page['availableStyles'] = $stylelist; | ||||
| 
 | ||||
| if($settings['enablegroups'] == '1') { | ||||
| 	$allgroups = get_groups(false); | ||||
| 	$link = connect(); | ||||
| 	$allgroups = get_groups($link,false); | ||||
| 	mysql_close($link); | ||||
| 	$page['groups'] = array(); | ||||
| 	$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); | ||||
| 	foreach($allgroups as $g) { | ||||
|  | ||||
| @ -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['groups'] = get_groups(true); | ||||
| $link = connect(); | ||||
| $page['groups'] = get_groups($link, true, true); | ||||
| mysql_close($link); | ||||
| $page['canmodify'] = is_capable($can_administrate, $operator); | ||||
| 
 | ||||
| prepare_menu($operator); | ||||
|  | ||||
| @ -27,9 +27,12 @@ function update_operator_groups($operatorid,$newvalue) { | ||||
| 	mysql_close($link); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| $opId = verifyparam( "op","/^\d{1,9}$/"); | ||||
| $page = array('opid' => $opId); | ||||
| $page['groups'] = get_groups(false); | ||||
| $link = connect(); | ||||
| $page['groups'] = get_groups($link, false); | ||||
| mysql_close($link); | ||||
| $errors = array(); | ||||
| 
 | ||||
| $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator))  | ||||
|  | ||||
| @ -177,6 +177,15 @@ require_once('inc_errors.php'); | ||||
| 			<br clear="all"/> | ||||
| 		</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"> — <?php echo getlocal('settings.leavemessage_captcha.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> | ||||
|  | ||||
| @ -49,6 +49,8 @@ require_once('inc_errors.php'); | ||||
| 	<?php echo getlocal("form.field.groupname") ?>
 | ||||
| </th><th> | ||||
| 	<?php echo getlocal("form.field.groupdesc") ?>
 | ||||
| </th><th> | ||||
| 	<?php echo getlocal("page_agents.status") ?>
 | ||||
| </th><th> | ||||
| 	<?php echo getlocal("page.group.membersnum") ?>
 | ||||
| <?php if($page['canmodify']) { ?>
 | ||||
| @ -70,6 +72,13 @@ if(count($page['groups']) > 0) { | ||||
| 	<td class="notlast"> | ||||
|    		<?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "<none>" ?>
 | ||||
| 	</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> | ||||
|    		<a href="<?php echo $webimroot ?>/operator/groupmembers.php?gid=<?php echo $grp['groupid'] ?>"> | ||||
| 	   		<?php echo htmlspecialchars(topage($grp['inumofagents'])) ?>
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user