mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-08 00:34:42 +03:00
Replace "thread.php" with a controller
This commit is contained in:
parent
5244480d4c
commit
7b6604fba2
@ -0,0 +1,46 @@
|
||||
<?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\Chat;
|
||||
|
||||
use Mibew\RequestProcessor\ThreadProcessor;
|
||||
use Mibew\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Contains actions which are related with thread itself.
|
||||
*/
|
||||
class ThreadController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Update threads state.
|
||||
*
|
||||
* @param Request $request Incoming request.
|
||||
* @return A set of data to update the thread at client side.
|
||||
*/
|
||||
public function updateAction(Request $request)
|
||||
{
|
||||
$processor = ThreadProcessor::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;
|
||||
}
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
# Chat actions
|
||||
chat_thread_update:
|
||||
path: /thread/update
|
||||
defaults:
|
||||
_controller: Mibew\Controller\Chat\ThreadController::updateAction
|
||||
|
||||
## Operator's chat
|
||||
chat_operator:
|
||||
|
@ -77,7 +77,7 @@
|
||||
jQuery(document).ready(function(){
|
||||
Mibew.Application.start({
|
||||
server: {
|
||||
url: '{{mibewRoot}}/thread.php',
|
||||
url: '{{mibewRoot}}/thread/update',
|
||||
requestsFrequency: {{frequency}}
|
||||
},
|
||||
page: {
|
||||
|
@ -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(__FILE__) . '/libs/init.php');
|
||||
|
||||
$processor = \Mibew\RequestProcessor\ThreadProcessor::getInstance();
|
||||
$processor->receiveRequest($_POST['data']);
|
Loading…
Reference in New Issue
Block a user