mirror of
				https://github.com/Mibew/design.git
				synced 2025-11-04 04:15:14 +03:00 
			
		
		
		
	permissions
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@221 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									ef2a286d3d
								
							
						
					
					
						commit
						2443b4e0a5
					
				@ -99,7 +99,11 @@ var HtmlGenerationUtils = {
 | 
			
		||||
  		var cellsCount = 2;
 | 
			
		||||
  		var link = servlet+"?thread="+id;
 | 
			
		||||
 		var gen = '<td class="table" style="padding-left:0px; padding-right:0px;">';
 | 
			
		||||
		gen += HtmlGenerationUtils.popupLink( (cantakenow||!canview) ? link : link+"&viewonly=true", localized[canopen ? 0 : 1], "ImCenter"+id, username, 640, 480, ban);
 | 
			
		||||
 		if(canopen || canview ) {
 | 
			
		||||
			gen += HtmlGenerationUtils.popupLink( (cantakenow||!canview) ? link : link+"&viewonly=true", localized[canopen ? 0 : 1], "ImCenter"+id, username, 640, 480, ban);
 | 
			
		||||
		} else {
 | 
			
		||||
			gen += '<a href="#">' + username + '</a>';
 | 
			
		||||
		}
 | 
			
		||||
		gen += '</td><td><img src="'+webimRoot+'/images/free.gif" width="5" height="1" border="0" alt=""></td>';
 | 
			
		||||
		if( canopen ) {
 | 
			
		||||
			gen += '<td width="30" align="center">';
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 372 B  | 
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -46,9 +46,9 @@ function expand_var($matches) {
 | 
			
		||||
			return "$webimroot/styles/$current_style";
 | 
			
		||||
		} else if($var == 'pagination') {
 | 
			
		||||
			return generate_pagination($page['pagination']);
 | 
			
		||||
		} else if($var == 'errors') {
 | 
			
		||||
		} else if($var == 'errors' || $var == 'harderrors') {
 | 
			
		||||
			if( isset($errors) && count($errors) > 0 ) {
 | 
			
		||||
				$result = getlocal("errors.header");
 | 
			
		||||
				$result = getlocal("$var.header");
 | 
			
		||||
				foreach( $errors as $e ) {
 | 
			
		||||
					$result .= getlocal("errors.prefix").$e.getlocal("errors.suffix");
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
@ -124,6 +124,7 @@ page.gen_button.sample=Example
 | 
			
		||||
page.gen_button.code.description=<strong>Caution!</strong> Please don't change<br/> the code manually because<br/> we don't guarantee that<br/> it will work!
 | 
			
		||||
mail.user.history.subject=Web Messenger: dialog history
 | 
			
		||||
mail.user.history.body=Hello, {0}!\n\nYour chat history: \n\n{1}\n--- \nKind Regards,\nWeb Messenger
 | 
			
		||||
harderrors.header=<font color="#c13030"><b>Cannot execute:</b><br/><ul>
 | 
			
		||||
errors.header=<font color="#c13030"><b>Correct the mistakes:</b><br/><ul>
 | 
			
		||||
errors.prefix=<li class="error">
 | 
			
		||||
errors.suffix=</li>
 | 
			
		||||
@ -265,7 +266,7 @@ page_avatar.intro=You can upload your photo only in JPG, GIF, PNG or TIF image f
 | 
			
		||||
page_avatar.title=Upload photo
 | 
			
		||||
page_search.intro=Search for chat history of a specified user or a specified phrase in a message.
 | 
			
		||||
page_settings.intro=Specify options affecting chat window and common system behavior
 | 
			
		||||
permission.admin=System administration: settings, operators management
 | 
			
		||||
permission.admin=System administration: settings, operators management, button generation
 | 
			
		||||
permission.takeover=Take over chat thread
 | 
			
		||||
permission.viewthreads=View another operator's chat thread
 | 
			
		||||
permissions.intro=Here you can control operator's permissions 
 | 
			
		||||
 | 
			
		||||
@ -124,6 +124,7 @@ page.gen_button.sample=
 | 
			
		||||
page.gen_button.code.description=<strong>Внимание!</strong> При внесении<br/> каких-либо изменений<br/> в этот код работоспособность<br/> кнопки не гарантируется!
 | 
			
		||||
mail.user.history.subject=Веб Мессенджер: история диалога
 | 
			
		||||
mail.user.history.body=Здраствуйте, {0}!\n\nПо Вашему запросу, высылаем историю: \n\n{1}\n--- \nС уважением,\nВеб Мессенджер
 | 
			
		||||
harderrors.header=<font color="#c13030"><b>Невозможно выполнить:</b><br/><ul>
 | 
			
		||||
errors.header=<font color="#c13030"><b>Исправьте ошибки:</b><br/><ul>
 | 
			
		||||
errors.prefix=<li class="error">
 | 
			
		||||
errors.suffix=</li>
 | 
			
		||||
@ -265,7 +266,7 @@ page_avatar.intro=
 | 
			
		||||
page_avatar.title=Загрузка фотографии
 | 
			
		||||
page_search.intro=На данной странице можно осуществить поиск диалогов по имени пользователя или фразе, встречающейся в сообщении.
 | 
			
		||||
page_settings.intro=Здесь вы можете задать опции влияющие на отображение чат окна и общее поведение системы 
 | 
			
		||||
permission.admin=Администрирование системы: настройка, управление операторами
 | 
			
		||||
permission.admin=Администрирование системы: настройка, управление операторами, генерация кнопки
 | 
			
		||||
permission.takeover=Перехватывать диалоги у других операторов
 | 
			
		||||
permission.viewthreads=Просматривать диалоги других операторов в режиме реального времени
 | 
			
		||||
permissions.intro=Здесь вы можете ограничить возможности оператора
 | 
			
		||||
 | 
			
		||||
@ -37,17 +37,33 @@ if( !isset($_GET['token']) ) {
 | 
			
		||||
	$viewonly = verifyparam( "viewonly", "/^true$/", false);
 | 
			
		||||
 | 
			
		||||
	$forcetake = verifyparam("force", "/^true$/", false);
 | 
			
		||||
	if( !$viewonly && $thread['istate'] == $state_chatting && $operator['operatorid'] != $thread['agentId'] && $forcetake == false ) {
 | 
			
		||||
		$page = array(
 | 
			
		||||
			'user' => topage($thread['userName']), 'agent' => topage($thread['agentName']), 'link' => $_SERVER['PHP_SELF']."?thread=$threadid&force=true"
 | 
			
		||||
		);
 | 
			
		||||
		start_html_output();
 | 
			
		||||
		require('../view/confirm.php');
 | 
			
		||||
		exit;
 | 
			
		||||
	if( !$viewonly && $thread['istate'] == $state_chatting && $operator['operatorid'] != $thread['agentId'] ) {
 | 
			
		||||
 | 
			
		||||
		if(!is_capable($can_takeover, $operator)) {
 | 
			
		||||
			$errors = array("Cannot take over");
 | 
			
		||||
			start_html_output();
 | 
			
		||||
			expand("../styles", getchatstyle(), "error.tpl");
 | 
			
		||||
			exit;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if( $forcetake == false ) {
 | 
			
		||||
			$page = array(
 | 
			
		||||
				'user' => topage($thread['userName']), 'agent' => topage($thread['agentName']), 'link' => $_SERVER['PHP_SELF']."?thread=$threadid&force=true"
 | 
			
		||||
			);
 | 
			
		||||
			start_html_output();
 | 
			
		||||
			require('../view/confirm.php');
 | 
			
		||||
			exit;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!$viewonly)
 | 
			
		||||
	if (!$viewonly) {
 | 
			
		||||
		take_thread($thread,$operator);
 | 
			
		||||
	} else if(!is_capable($can_viewthreads, $operator)) {
 | 
			
		||||
		$errors = array("Cannot view threads");
 | 
			
		||||
		start_html_output();
 | 
			
		||||
		expand("../styles", getchatstyle(), "error.tpl");
 | 
			
		||||
		exit;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$token = $thread['ltoken'];
 | 
			
		||||
	header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
 | 
			
		||||
@ -61,6 +77,13 @@ if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) {
 | 
			
		||||
	die("wrong thread");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if($thread['agentId'] != $operator['operatorid'] && !is_capable($can_viewthreads, $operator)) {
 | 
			
		||||
	$errors = array("Cannot view threads");
 | 
			
		||||
	start_html_output();
 | 
			
		||||
	expand("../styles", getchatstyle(), "error.tpl");
 | 
			
		||||
	exit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
setup_chatview_for_operator($thread, $operator);
 | 
			
		||||
 | 
			
		||||
start_html_output();
 | 
			
		||||
 | 
			
		||||
@ -85,6 +85,7 @@ $page['tabs'] = array(
 | 
			
		||||
	getlocal("page_agent.tab.avatar") => "",
 | 
			
		||||
	getlocal("page_agent.tab.permissions") => "$webimroot/operator/permissions.php?op=$opId"
 | 
			
		||||
);
 | 
			
		||||
$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
 | 
			
		||||
 | 
			
		||||
start_html_output();
 | 
			
		||||
require('../view/avatar.php');
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,8 @@ $page = array(
 | 
			
		||||
	'operator' => topage(get_operator_name($operator)),
 | 
			
		||||
	'version' => $version,
 | 
			
		||||
	'localeLinks' => get_locale_links("$webimroot/operator/index.php"),
 | 
			
		||||
	'showban' => $settings['enableban'] == "1"
 | 
			
		||||
	'showban' => $settings['enableban'] == "1",
 | 
			
		||||
	'showadmin' => is_capable($can_administrate, $operator),
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
start_html_output();
 | 
			
		||||
 | 
			
		||||
@ -54,12 +54,14 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
 | 
			
		||||
 | 
			
		||||
	if( count($errors) == 0 ) {
 | 
			
		||||
		if (!$opId) {
 | 
			
		||||
			create_operator($login,$password,$localname,$commonname,"");
 | 
			
		||||
			$newop = create_operator($login,$password,$localname,$commonname,"");
 | 
			
		||||
			header("Location: $webimroot/operator/avatar.php?op=".$newop['operatorid']);
 | 
			
		||||
			exit;
 | 
			
		||||
		} else {
 | 
			
		||||
			update_operator($opId,$login,$password,$localname,$commonname);
 | 
			
		||||
			header("Location: $webimroot/operator/operators.php");
 | 
			
		||||
			exit;
 | 
			
		||||
		}
 | 
			
		||||
		header("Location: $webimroot/operator/operators.php");
 | 
			
		||||
		exit;
 | 
			
		||||
	} else {
 | 
			
		||||
		$page['formlogin'] = topage($login);
 | 
			
		||||
		$page['formname'] = topage($localname);
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,9 @@ if( !$op ) {
 | 
			
		||||
	if(count($errors) == 0) {
 | 
			
		||||
		update_operator_permissions($op['operatorid'],$new_permissions);
 | 
			
		||||
 | 
			
		||||
		if ($opId && $_SESSION['operator'] && $operator['operatorid'] == $opId) {
 | 
			
		||||
			$_SESSION['operator']['iperm'] = $new_permissions;
 | 
			
		||||
		}
 | 
			
		||||
		header("Location: $webimroot/operator/operator.php?op=$opId");
 | 
			
		||||
		exit;
 | 
			
		||||
	}
 | 
			
		||||
@ -64,6 +67,7 @@ $page['tabs'] = array(
 | 
			
		||||
 | 
			
		||||
$page['permissionsList'] = get_permission_list();
 | 
			
		||||
$page['formpermissions'] = array("");
 | 
			
		||||
$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
 | 
			
		||||
 | 
			
		||||
foreach($permission_ids as $perm => $id) {
 | 
			
		||||
	if(is_capable($perm,$op)) {
 | 
			
		||||
 | 
			
		||||
@ -69,7 +69,9 @@ function get_useragent_version($userAgent) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function thread_to_xml($thread,$link) {
 | 
			
		||||
	global $threadstate_to_string, $threadstate_key, $webim_encoding, $operator, $settings;
 | 
			
		||||
	global $state_chatting, $threadstate_to_string, $threadstate_key,
 | 
			
		||||
			$webim_encoding, $operator, $settings,
 | 
			
		||||
			$can_viewthreads, $can_takeover;
 | 
			
		||||
	$state = $threadstate_to_string[$thread['istate']];
 | 
			
		||||
	$result = "<thread id=\"".$thread['threadid']."\" stateid=\"$state\"";
 | 
			
		||||
	if( $state == "closed" )
 | 
			
		||||
@ -80,8 +82,11 @@ function thread_to_xml($thread,$link) {
 | 
			
		||||
	$threadoperator = $nextagent ? get_operator_name($nextagent)
 | 
			
		||||
						: ($thread['agentName'] ? $thread['agentName'] : "-");
 | 
			
		||||
 | 
			
		||||
	$result .= " canopen=\"true\"";
 | 
			
		||||
	if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid']) {
 | 
			
		||||
	if(!($thread['istate'] == $state_chatting && $thread['agentId'] != $operator['operatorid'] && !is_capable($can_takeover,$operator))) {
 | 
			
		||||
		$result .= " canopen=\"true\"";
 | 
			
		||||
	}
 | 
			
		||||
	if ($thread['agentId'] != $operator['operatorid'] && $thread['nextagent'] != $operator['operatorid']
 | 
			
		||||
			&& is_capable($can_viewthreads, $operator)) {
 | 
			
		||||
		$result .= " canview=\"true\"";
 | 
			
		||||
	}
 | 
			
		||||
	if ($settings['enableban'] == "1") {
 | 
			
		||||
 | 
			
		||||
@ -60,7 +60,7 @@
 | 
			
		||||
		</tr>
 | 
			
		||||
		</table>
 | 
			
		||||
		<p>
 | 
			
		||||
			${errors}
 | 
			
		||||
			${harderrors}
 | 
			
		||||
		</p>
 | 
			
		||||
	</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@
 | 
			
		||||
	</tr><tr><td height="100%" bgcolor="#FED840"><img src='${webimroot}/images/free.gif' width="1" height="1" border="0" alt="" /></td>
 | 
			
		||||
	<td background="${webimroot}/images/winbg.gif" class="bgcy">
 | 
			
		||||
 | 
			
		||||
		${errors}
 | 
			
		||||
		${harderrors}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	</td><td bgcolor="#E8A400"><img src='${webimroot}/images/free.gif' width="1" height="1" border="0" alt="" /></td>
 | 
			
		||||
 | 
			
		||||
@ -71,6 +71,12 @@
 | 
			
		||||
<tr><td align="right" style="padding-right:16px;"><table cellspacing="0" cellpadding="0" border="0"><tr><?php foreach($page['tabs'] as $k => $v) { if($v) { ?><td class="textform" style="padding: 2px 9px 3px 9px;"><a href="<?php echo $v ?>"><?php echo $k ?></a></td><?php } else { ?><td class="textform" background="<?php echo $webimroot ?>/images/loginbg.gif" style="border-left:1px solid #bbbbbb;border-top:1px solid #bbbbbb;border-right:1px solid #bbbbbb;padding: 2px 9px 3px 9px;"><?php echo $k ?></td><?php }} ?></tr></table></td></tr>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
<tr><td background='<?php echo $webimroot ?>/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td class="formauth" colspan="3">
 | 
			
		||||
				<b><?php echo $page['currentop'] ?></b>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tr><td colspan="3" height="15"></td></tr>
 | 
			
		||||
 | 
			
		||||
        <?php if( $page['avatar'] ) { ?>
 | 
			
		||||
        	<tr><td class='formauth'><?php echo getlocal('form.field.avatar.current') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
 | 
			
		||||
 | 
			
		||||
@ -46,17 +46,22 @@
 | 
			
		||||
 | 
			
		||||
<table cellspacing="0" cellpadding="0" border="0">
 | 
			
		||||
 | 
			
		||||
<?php if( $page['showadmin'] ) { ?>
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/operators.php'><?php echo getlocal('leftMenu.client_agents') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('admin.content.client_agents') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
 | 
			
		||||
<?php } ?>
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/users.php'><?php echo getlocal('topMenu.users') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('page_client.pending_users') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
 | 
			
		||||
<?php if( $page['showadmin'] ) { ?>
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/getcode.php'><?php echo getlocal('leftMenu.client_gen_button') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('admin.content.client_gen_button') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/history.php'><?php echo getlocal('page_analysis.search.title') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.history') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
<?php if( $page['showban'] ) { ?>
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/blocked.php'><?php echo getlocal('menu.blocked') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.blocked') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
<?php if( $page['showadmin'] ) { ?>
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/settings.php'><?php echo getlocal('leftMenu.client_settings') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('admin.content.client_settings') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
	<tr><td width='20' valign='top'><img src='<?php echo $webimroot ?>/images/lidiv.gif' width='5' height='45' border='0' alt=''></td><td valign='top' class='text'><a href='<?php echo $webimroot ?>/operator/logout.php'><?php echo getlocal('topMenu.logoff') ?></a><br><img src='<?php echo $webimroot ?>/images/free.gif' width='1' height='10' border='0' alt=''><br><?php echo getlocal('content.logoff') ?><br></td></tr><tr><td colspan='2' height='20'></td></tr>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -71,6 +71,12 @@
 | 
			
		||||
<tr><td align="right" style="padding-right:16px;"><table cellspacing="0" cellpadding="0" border="0"><tr><?php foreach($page['tabs'] as $k => $v) { if($v) { ?><td class="textform" style="padding: 2px 9px 3px 9px;"><a href="<?php echo $v ?>"><?php echo $k ?></a></td><?php } else { ?><td class="textform" background="<?php echo $webimroot ?>/images/loginbg.gif" style="border-left:1px solid #bbbbbb;border-top:1px solid #bbbbbb;border-right:1px solid #bbbbbb;padding: 2px 9px 3px 9px;"><?php echo $k ?></td><?php }} ?></tr></table></td></tr>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
<tr><td background='<?php echo $webimroot ?>/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='<?php echo $webimroot ?>/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='<?php echo $webimroot ?>/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td class="formauth" colspan="3">
 | 
			
		||||
				<b><?php echo $page['currentop'] ?></b>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tr><td colspan="3" height="15"></td></tr>
 | 
			
		||||
 | 
			
		||||
<?php foreach( $page['permissionsList'] as $pm ) { ?>
 | 
			
		||||
		<tr class="formauth" colspan="3">
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user