mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 18:38:31 +03:00
Create controller for awaiting-users actions
This commit is contained in:
parent
4dac50301d
commit
1106a510da
97
src/mibew/libs/classes/Mibew/Controller/UsersController.php
Normal file
97
src/mibew/libs/classes/Mibew/Controller/UsersController.php
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2014 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Mibew\Controller;
|
||||||
|
|
||||||
|
use Mibew\Settings;
|
||||||
|
use Mibew\Style\ChatStyle;
|
||||||
|
use Mibew\RequestProcessor\UsersProcessor;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains actions for all awaiting users-related functionality.
|
||||||
|
*/
|
||||||
|
class UsersController extends AbstractController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Generate content for "users" route.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return string Rendered page content
|
||||||
|
*/
|
||||||
|
public function indexAction(Request $request)
|
||||||
|
{
|
||||||
|
$operator = $request->attributes->get('_operator');
|
||||||
|
$status = $request->query->has('away') ? 1 : 0;
|
||||||
|
|
||||||
|
notify_operator_alive($operator['operatorid'], $status);
|
||||||
|
|
||||||
|
$_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']);
|
||||||
|
|
||||||
|
$page = array();
|
||||||
|
$page['havemenu'] = !$request->query->has('nomenu');
|
||||||
|
$page['showpopup'] = (Settings::get('enablepopupnotification') == '1') ? "1" : "0";
|
||||||
|
$page['frequency'] = Settings::get('updatefrequency_operator');
|
||||||
|
$page['istatus'] = $status;
|
||||||
|
$page['showonline'] = (Settings::get('showonlineoperators') == '1') ? "1" : "0";
|
||||||
|
$page['showvisitors'] = (Settings::get('enabletracking') == '1') ? "1" : "0";
|
||||||
|
$page['agentId'] = $operator['operatorid'];
|
||||||
|
$page['geoLink'] = Settings::get('geolink');
|
||||||
|
$page['geoWindowParams'] = Settings::get('geolinkparams');
|
||||||
|
|
||||||
|
// Load dialogs style options
|
||||||
|
$chat_style = new ChatStyle(ChatStyle::getCurrentStyle());
|
||||||
|
$style_config = $chat_style->getConfigurations();
|
||||||
|
$page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
|
||||||
|
$page['coreStyles.inviteWindowParams'] = $style_config['chat']['window_params'];
|
||||||
|
|
||||||
|
// Load page style options
|
||||||
|
$style_config = $this->getStyle()->getConfigurations();
|
||||||
|
$page['coreStyles.threadTag'] = $style_config['users']['thread_tag'];
|
||||||
|
$page['coreStyles.visitorTag'] = $style_config['users']['visitor_tag'];
|
||||||
|
$page['coreStyles.trackedUserWindowParams'] = $style_config['tracked']['user_window_params'];
|
||||||
|
$page['coreStyles.trackedVisitorWindowParams'] = $style_config['tracked']['visitor_window_params'];
|
||||||
|
$page['coreStyles.banWindowParams'] = $style_config['ban']['window_params'];
|
||||||
|
|
||||||
|
$page['title'] = getlocal("clients.title");
|
||||||
|
$page['menuid'] = "users";
|
||||||
|
|
||||||
|
// Get additional plugins data
|
||||||
|
$page = array_merge($page, get_plugins_data('users'));
|
||||||
|
$page = array_merge($page, prepare_menu($operator));
|
||||||
|
|
||||||
|
return $this->render('users', $page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate content for "users_update" route.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return string Rendered page content
|
||||||
|
*/
|
||||||
|
public function updateAction(Request $request)
|
||||||
|
{
|
||||||
|
$processor = UsersProcessor::getInstance();
|
||||||
|
// TODO: Remove bufferization after *Processor classes will be rewritten
|
||||||
|
// to play nice with symfony request/response objects
|
||||||
|
ob_start();
|
||||||
|
$processor->receiveRequest($request->request->get('data'));
|
||||||
|
$content = ob_get_clean();
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
@ -774,7 +774,7 @@ function prepare_menu($operator, $has_right = true)
|
|||||||
$result['operator'] = to_page(get_operator_name($operator));
|
$result['operator'] = to_page(get_operator_name($operator));
|
||||||
$result['goOnlineLink'] = getlocal2(
|
$result['goOnlineLink'] = getlocal2(
|
||||||
"menu.goonline",
|
"menu.goonline",
|
||||||
array(MIBEW_WEB_ROOT . "/operator/users.php?nomenu")
|
array(MIBEW_WEB_ROOT . "/operator/users?nomenu")
|
||||||
);
|
);
|
||||||
if ($has_right) {
|
if ($has_right) {
|
||||||
$result['showban'] = Settings::get('enableban') == "1";
|
$result['showban'] = Settings::get('enableban') == "1";
|
||||||
|
@ -17,3 +17,15 @@ updates:
|
|||||||
defaults:
|
defaults:
|
||||||
_controller: Mibew\Controller\UpdatesController::indexAction
|
_controller: Mibew\Controller\UpdatesController::indexAction
|
||||||
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
|
|
||||||
|
users:
|
||||||
|
path: /operator/users
|
||||||
|
defaults:
|
||||||
|
_controller: Mibew\Controller\UsersController::indexAction
|
||||||
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
|
|
||||||
|
users_update:
|
||||||
|
path: /operator/users/update
|
||||||
|
defaults:
|
||||||
|
_controller: Mibew\Controller\UsersController::updateAction
|
||||||
|
_access_check: Mibew\AccessControl\Check\LoggedInCheck
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* Copyright 2005-2014 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)) . '/libs/init.php');
|
|
||||||
|
|
||||||
$processor = \Mibew\RequestProcessor\UsersProcessor::getInstance();
|
|
||||||
$processor->receiveRequest($_POST['data']);
|
|
@ -1,69 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* Copyright 2005-2014 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Import namespaces and classes of the core
|
|
||||||
use Mibew\Settings;
|
|
||||||
use Mibew\Style\ChatStyle;
|
|
||||||
use Mibew\Style\PageStyle;
|
|
||||||
|
|
||||||
// Initialize libraries
|
|
||||||
require_once(dirname(dirname(__FILE__)) . '/libs/init.php');
|
|
||||||
|
|
||||||
$operator = check_login();
|
|
||||||
force_password($operator);
|
|
||||||
|
|
||||||
$status = isset($_GET['away']) ? 1 : 0;
|
|
||||||
|
|
||||||
notify_operator_alive($operator['operatorid'], $status);
|
|
||||||
|
|
||||||
$_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']);
|
|
||||||
|
|
||||||
$page = array();
|
|
||||||
$page['havemenu'] = !isset($_GET['nomenu']);
|
|
||||||
$page['showpopup'] = (Settings::get('enablepopupnotification') == '1') ? "1" : "0";
|
|
||||||
$page['frequency'] = Settings::get('updatefrequency_operator');
|
|
||||||
$page['istatus'] = $status;
|
|
||||||
$page['showonline'] = (Settings::get('showonlineoperators') == '1') ? "1" : "0";
|
|
||||||
$page['showvisitors'] = (Settings::get('enabletracking') == '1') ? "1" : "0";
|
|
||||||
$page['agentId'] = $operator['operatorid'];
|
|
||||||
$page['geoLink'] = Settings::get('geolink');
|
|
||||||
$page['geoWindowParams'] = Settings::get('geolinkparams');
|
|
||||||
|
|
||||||
// Load dialogs style options
|
|
||||||
$chat_style = new ChatStyle(ChatStyle::getCurrentStyle());
|
|
||||||
$style_config = $chat_style->getConfigurations();
|
|
||||||
$page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
|
|
||||||
$page['coreStyles.inviteWindowParams'] = $style_config['chat']['window_params'];
|
|
||||||
|
|
||||||
// Load page style options
|
|
||||||
$page_style = new PageStyle(PageStyle::getCurrentStyle());
|
|
||||||
$style_config = $page_style->getConfigurations();
|
|
||||||
$page['coreStyles.threadTag'] = $style_config['users']['thread_tag'];
|
|
||||||
$page['coreStyles.visitorTag'] = $style_config['users']['visitor_tag'];
|
|
||||||
$page['coreStyles.trackedUserWindowParams'] = $style_config['tracked']['user_window_params'];
|
|
||||||
$page['coreStyles.trackedVisitorWindowParams'] = $style_config['tracked']['visitor_window_params'];
|
|
||||||
$page['coreStyles.banWindowParams'] = $style_config['ban']['window_params'];
|
|
||||||
|
|
||||||
$page['title'] = getlocal("clients.title");
|
|
||||||
$page['menuid'] = "users";
|
|
||||||
|
|
||||||
// Get additional plugins data
|
|
||||||
$page = array_merge($page, get_plugins_data('users'));
|
|
||||||
|
|
||||||
$page = array_merge($page, prepare_menu($operator));
|
|
||||||
|
|
||||||
$page_style->render('users', $page);
|
|
@ -13,7 +13,7 @@
|
|||||||
<h2>{{l10n "right.main"}}</h2>
|
<h2>{{l10n "right.main"}}</h2>
|
||||||
<ul class="submenu">
|
<ul class="submenu">
|
||||||
<li{{#ifEqual menuid "main"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/index.php">{{l10n "topMenu.main"}}</a></li>
|
<li{{#ifEqual menuid "main"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/index.php">{{l10n "topMenu.main"}}</a></li>
|
||||||
<li{{#ifEqual menuid "users"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/users.php">{{l10n "topMenu.users"}}</a> <span class="small">(<a class="inner" href="{{mibewRoot}}/operator/users.php?nomenu">{{l10n "topMenu.users.nomenu"}}</a>)</span></li>
|
<li{{#ifEqual menuid "users"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/users">{{l10n "topMenu.users"}}</a> <span class="small">(<a class="inner" href="{{mibewRoot}}/operator/users?nomenu">{{l10n "topMenu.users.nomenu"}}</a>)</span></li>
|
||||||
<li{{#ifEqual menuid "history"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/history.php">{{l10n "page_analysis.search.title"}}</a></li>
|
<li{{#ifEqual menuid "history"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/history.php">{{l10n "page_analysis.search.title"}}</a></li>
|
||||||
{{#if showstat}}
|
{{#if showstat}}
|
||||||
<li{{#ifEqual menuid "statistics"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/statistics.php">{{l10n "statistics.title"}}</a></li>
|
<li{{#ifEqual menuid "statistics"}} class="active"{{/ifEqual}}><a href="{{mibewRoot}}/operator/statistics.php">{{l10n "statistics.title"}}</a></li>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<div class="dashitem">
|
<div class="dashitem">
|
||||||
<div class="dashitem-content">
|
<div class="dashitem-content">
|
||||||
<img src="{{stylePath}}/images/dash/visitors.gif" alt=""/>
|
<img src="{{stylePath}}/images/dash/visitors.gif" alt=""/>
|
||||||
<a href="{{mibewRoot}}/operator/users.php">
|
<a href="{{mibewRoot}}/operator/users">
|
||||||
{{l10n "topMenu.users"}}
|
{{l10n "topMenu.users"}}
|
||||||
</a>
|
</a>
|
||||||
{{l10n "page_client.pending_users"}}
|
{{l10n "page_client.pending_users"}}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
Mibew.Application.start({
|
Mibew.Application.start({
|
||||||
server: {
|
server: {
|
||||||
url: "{{mibewRoot}}/operator/update.php",
|
url: "{{mibewRoot}}/operator/users/update",
|
||||||
requestsFrequency: {{frequency}}
|
requestsFrequency: {{frequency}}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user