mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 18:41:09 +03:00 
			
		
		
		
	Added groups weight
This commit is contained in:
		
							parent
							
								
									ee756d06b9
								
							
						
					
					
						commit
						cf374158a8
					
				| @ -27,6 +27,7 @@ $dbtables = array( | ||||
| 		"vccommonname" => "varchar(64) NOT NULL", | ||||
| 		"vclocaldescription" => "varchar(1024) NOT NULL", | ||||
| 		"vccommondescription" => "varchar(1024) NOT NULL", | ||||
| 		"iweight" => "int NOT NULL DEFAULT 0", | ||||
| 	), | ||||
| 
 | ||||
| 	"${mysqlprefix}chatthread" => array( | ||||
| @ -163,7 +164,7 @@ $dbtables_can_update = array( | ||||
| 	"${mysqlprefix}chatmessage" => array("agentId"), | ||||
| 	"${mysqlprefix}chatoperator" => array("vcavatar", "vcjabbername", "iperm", "istatus", "idisabled", "vcemail", "dtmrestore", "vcrestoretoken"), | ||||
| 	"${mysqlprefix}chatban" => array(), | ||||
| 	"${mysqlprefix}chatgroup" => array("vcemail"), | ||||
| 	"${mysqlprefix}chatgroup" => array("vcemail", "iweight"), | ||||
| 	"${mysqlprefix}chatgroupoperator" => array(), | ||||
| 	"${mysqlprefix}chatresponses" => array("vctitle"), | ||||
| 	"${mysqlprefix}chatsitevisitor" => array(), | ||||
|  | ||||
| @ -167,6 +167,10 @@ if ($act == "silentcreateall") { | ||||
| 			runsql("ALTER TABLE ${mysqlprefix}chatgroup ADD vcemail varchar(64)", $link); | ||||
| 		} | ||||
| 
 | ||||
| 		if (in_array("${mysqlprefix}chatgroup.iweight", $absent)) { | ||||
| 			runsql("ALTER TABLE ${mysqlprefix}chatgroup ADD iweight int DEFAULT 0", $link); | ||||
| 		} | ||||
| 
 | ||||
| 		$res = mysql_query("select null from information_schema.statistics where table_schema = '$mysqldb' and table_name = '${mysqlprefix}chatmessage' and index_name = 'idx_agentid'", $link); | ||||
| 		if ($res && mysql_num_rows($res) == 0) { | ||||
| 			runsql("ALTER TABLE ${mysqlprefix}chatmessage ADD INDEX idx_agentid (agentid)", $link); | ||||
|  | ||||
| @ -397,7 +397,7 @@ function get_all_groups($link) | ||||
| function get_groups($link, $checkaway) | ||||
| { | ||||
| 	global $mysqlprefix; | ||||
| 	$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription" . | ||||
| 	$query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription, iweight" . | ||||
| 			 ", (SELECT count(*) from ${mysqlprefix}chatgroupoperator where ${mysqlprefix}chatgroup.groupid = " . | ||||
| 			 "${mysqlprefix}chatgroupoperator.groupid) as inumofagents" . | ||||
| 			 ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . | ||||
| @ -411,7 +411,7 @@ function get_groups($link, $checkaway) | ||||
| 					   "and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseenaway" | ||||
| 					 : "" | ||||
| 			 ) . | ||||
| 			 " from ${mysqlprefix}chatgroup order by vclocalname"; | ||||
| 			 " from ${mysqlprefix}chatgroup order by iweight, vclocalname"; | ||||
| 	return select_multi_assoc($query, $link); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -154,6 +154,8 @@ 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.groupweight=Weight | ||||
| form.field.groupweight.description=Groups with lower weight display higher in groups list. Group weight is a positive integer value. | ||||
| form.field.login.description=Login can consist of small Latin letters and underscore. | ||||
| form.field.login=Login | ||||
| form.field.mail.description=For notifications and password retrieval. | ||||
| @ -297,6 +299,7 @@ page.groups.isaway=Away | ||||
| page.groups.isonline=Online | ||||
| page.groups.new=Create new group | ||||
| page.groups.title=Groups | ||||
| page.groups.weight=Weight | ||||
| page.preview.agentchat=Chat window (operator-mode) | ||||
| page.preview.agentrochat=View Chat window (operator in read-only mode) | ||||
| page.preview.chatsimple=Simple chat window. Refresh to post messages (IE 5, Opera 7) | ||||
|  | ||||
| @ -152,6 +152,8 @@ form.field.groupdesc= | ||||
| form.field.groupemail.description=Адрес для извещений. Оставьте пустым, чтобы использовать глобальный адрес. | ||||
| form.field.groupname.description=Может быть названием отдела в вашей компании. | ||||
| form.field.groupname=Название группы | ||||
| form.field.groupweight=Вес группы | ||||
| form.field.groupweight.description=Группы с меньшим весом отображаются выше в списке групп. Вес - это целое положительное число. | ||||
| form.field.login.description=Логин может состоять из маленьких латинских букв и знака подчеркивания. | ||||
| form.field.login=Логин | ||||
| form.field.mail.description=Для уведомлений и восстановления пароля. | ||||
| @ -295,6 +297,7 @@ page.groups.isaway=Away | ||||
| page.groups.isonline=Доступна | ||||
| page.groups.new=Добавить группу... | ||||
| page.groups.title=Группы | ||||
| page.groups.weight=Вес | ||||
| page.preview.agentchat=Окно чата (со стороны оператора) | ||||
| page.preview.agentrochat=Окно просмотра чата (для оператора) | ||||
| page.preview.chatsimple=Simple chat window, refresh to post messages (IE 5, Opera 7) | ||||
|  | ||||
| @ -39,16 +39,17 @@ function group_by_name($name) | ||||
| 	return $group; | ||||
| } | ||||
| 
 | ||||
| function create_group($name, $descr, $commonname, $commondescr, $email) | ||||
| function create_group($name, $descr, $commonname, $commondescr, $weight ,$email) | ||||
| { | ||||
| 	global $mysqlprefix; | ||||
| 	$link = connect(); | ||||
| 	$query = sprintf( | ||||
| 		"insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription,vcemail) values ('%s','%s','%s','%s','%s')", | ||||
| 		"insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription,iweight,vcemail) values ('%s','%s','%s','%s',%u,'%s')", | ||||
| 		db_escape_string($name), | ||||
| 		db_escape_string($descr), | ||||
| 		db_escape_string($commonname), | ||||
| 		db_escape_string($commondescr), | ||||
| 		$weight, | ||||
| 		db_escape_string($email)); | ||||
| 
 | ||||
| 	perform_query($query, $link); | ||||
| @ -59,16 +60,17 @@ function create_group($name, $descr, $commonname, $commondescr, $email) | ||||
| 	return $newdep; | ||||
| } | ||||
| 
 | ||||
| function update_group($groupid, $name, $descr, $commonname, $commondescr, $email) | ||||
| function update_group($groupid, $name, $descr, $commonname, $commondescr, $weight, $email) | ||||
| { | ||||
| 	global $mysqlprefix; | ||||
| 	$link = connect(); | ||||
| 	$query = sprintf( | ||||
| 		"update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s', vcemail = '%s' where groupid = %s", | ||||
| 		"update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s', iweight = %u, vcemail = '%s' where groupid = %s", | ||||
| 		db_escape_string($name), | ||||
| 		db_escape_string($descr), | ||||
| 		db_escape_string($commonname), | ||||
| 		db_escape_string($commondescr), | ||||
| 		$weight, | ||||
| 		db_escape_string($email), | ||||
| 		$groupid); | ||||
| 
 | ||||
| @ -83,11 +85,15 @@ if (isset($_POST['name'])) { | ||||
| 	$description = getparam('description'); | ||||
| 	$commonname = getparam('commonname'); | ||||
| 	$commondescription = getparam('commondescription'); | ||||
| 	$weight = getparam('weight'); | ||||
| 	$email = getparam('email'); | ||||
| 
 | ||||
| 	if (!$name) | ||||
| 		$errors[] = no_field("form.field.groupname"); | ||||
| 
 | ||||
| 	if (! preg_match("/^\d{1,9}$/", $weight)) | ||||
| 		$errors[] = wrong_field("form.field.groupweight"); | ||||
| 
 | ||||
| 	if ($email != '' && !is_valid_email($email)) | ||||
| 		$errors[] = wrong_field("form.field.mail"); | ||||
| 
 | ||||
| @ -98,11 +104,11 @@ if (isset($_POST['name'])) { | ||||
| 
 | ||||
| 	if (count($errors) == 0) { | ||||
| 		if (!$groupid) { | ||||
| 			$newdep = create_group($name, $description, $commonname, $commondescription, $email); | ||||
| 			$newdep = create_group($name, $description, $commonname, $commondescription, $weight, $email); | ||||
| 			header("Location: $webimroot/operator/groupmembers.php?gid=" . $newdep['groupid']); | ||||
| 			exit; | ||||
| 		} else { | ||||
| 			update_group($groupid, $name, $description, $commonname, $commondescription, $email); | ||||
| 			update_group($groupid, $name, $description, $commonname, $commondescription, $weight, $email); | ||||
| 			header("Location: $webimroot/operator/group.php?gid=$groupid&stored"); | ||||
| 			exit; | ||||
| 		} | ||||
| @ -111,6 +117,7 @@ if (isset($_POST['name'])) { | ||||
| 		$page['formdescription'] = topage($description); | ||||
| 		$page['formcommonname'] = topage($commonname); | ||||
| 		$page['formcommondescription'] = topage($commondescription); | ||||
| 		$page['formweight'] = topage($weight); | ||||
| 		$page['formemail'] = topage($email); | ||||
| 		$page['grid'] = topage($groupid); | ||||
| 	} | ||||
| @ -127,6 +134,7 @@ if (isset($_POST['name'])) { | ||||
| 		$page['formdescription'] = topage($group['vclocaldescription']); | ||||
| 		$page['formcommonname'] = topage($group['vccommonname']); | ||||
| 		$page['formcommondescription'] = topage($group['vccommondescription']); | ||||
| 		$page['formweight'] = topage($group['iweight']); | ||||
| 		$page['formemail'] = topage($group['vcemail']); | ||||
| 		$page['grid'] = topage($group['groupid']); | ||||
| 	} | ||||
|  | ||||
| @ -85,7 +85,16 @@ require_once('inc_errors.php'); | ||||
| 			<div class="fdescr"> — <?php echo getlocal('form.field.groupcommondesc.description') ?></div>
 | ||||
| 			<br clear="all"/> | ||||
| 		</div> | ||||
| 		 | ||||
| 
 | ||||
| 		<div class="field"> | ||||
| 			<div class="flabel"><?php echo getlocal('form.field.groupweight') ?></div>
 | ||||
| 			<div class="fvalue"> | ||||
| 				<input type="text" name="weight" size="40" value="<?php echo form_value('weight') ?>" class="formauth"/> | ||||
| 			</div> | ||||
| 			<div class="fdescr"> — <?php echo getlocal('form.field.groupweight.description') ?></div>
 | ||||
| 			<br clear="all"/> | ||||
| 		</div> | ||||
| 
 | ||||
| 		<div class="field"> | ||||
| 			<div class="flabel"><?php echo getlocal('form.field.mail') ?></div>
 | ||||
| 			<div class="fvalue"> | ||||
|  | ||||
| @ -60,6 +60,8 @@ require_once('inc_errors.php'); | ||||
| 	<?php echo getlocal("page_agents.status") ?>
 | ||||
| </th><th> | ||||
| 	<?php echo getlocal("page.group.membersnum") ?>
 | ||||
| </th><th> | ||||
| 	<?php echo getlocal("page.groups.weight") ?>
 | ||||
| <?php if($page['canmodify']) { ?>
 | ||||
| </th><th> | ||||
| <?php } ?>
 | ||||
| @ -93,6 +95,9 @@ if(count($page['groups']) > 0) { | ||||
| 	   		<?php echo htmlspecialchars(topage($grp['inumofagents'])) ?>
 | ||||
|    		</a> | ||||
| 	</td> | ||||
| 	<td> | ||||
| 		<?php echo $grp['iweight'] ?>
 | ||||
| 	</td> | ||||
| <?php if($page['canmodify']) { ?>
 | ||||
| 	<td> | ||||
| 		<a href="<?php echo $webimroot ?>/operator/groups.php?act=del&gid=<?php echo $grp['groupid'] ?>" id="i<?php echo $grp['groupid'] ?>" class="removelink"> | ||||
| @ -106,7 +111,7 @@ if(count($page['groups']) > 0) { | ||||
| } else { | ||||
| ?>
 | ||||
| 	<tr> | ||||
| 	<td colspan="4"> | ||||
| 	<td colspan="5"> | ||||
| 		<?php echo getlocal("tag.pagination.no_items.elements") ?>
 | ||||
| 	</td> | ||||
| 	</tr> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user