mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Split Record provider into controller/provider
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
namespace Alchemy\Phrasea;
|
||||
|
||||
use Alchemy\Geonames\GeonamesServiceProvider;
|
||||
use Alchemy\Phrasea\ControllerProvider\Prod\Records;
|
||||
use Alchemy\Phrasea\ControllerProvider\Prod\Root as Prod;
|
||||
use Alchemy\Phrasea\ControllerProvider\Prod\Share;
|
||||
use Alchemy\Phrasea\ControllerProvider\Prod\Story;
|
||||
@@ -315,6 +314,7 @@ class Application extends SilexApplication
|
||||
'Alchemy\Phrasea\ControllerProvider\Prod\Property' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\Prod\Push' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\Prod\Query' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\Prod\Record' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\Datafiles' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\Lightbox' => [],
|
||||
'Alchemy\Phrasea\ControllerProvider\MediaAccessor' => [],
|
||||
@@ -628,7 +628,6 @@ class Application extends SilexApplication
|
||||
$this->mount('/prod/story', new Story());
|
||||
$this->mount('/prod/WorkZone', new WorkZone());
|
||||
$this->mount('/prod/lists', new UsrLists());
|
||||
$this->mount('/prod/records/', new Records());
|
||||
$this->mount('/prod/share/', new Share());
|
||||
$this->mount('/prod/TOU/', new TOU());
|
||||
$this->mount('/prod/tooltip', new Tooltip());
|
||||
@@ -679,6 +678,7 @@ class Application extends SilexApplication
|
||||
'/prod/printer/' => 'Alchemy\Phrasea\ControllerProvider\Prod\Printer',
|
||||
'/prod/push/' => 'Alchemy\Phrasea\ControllerProvider\Prod\Push',
|
||||
'/prod/query/' => 'Alchemy\Phrasea\ControllerProvider\Prod\Query',
|
||||
'/prod/records/' => 'Alchemy\Phrasea\ControllerProvider\Prod\Record',
|
||||
'/prod/records/edit' => 'Alchemy\Phrasea\ControllerProvider\Prod\Edit',
|
||||
'/prod/records/movecollection' => 'Alchemy\Phrasea\ControllerProvider\Prod\MoveCollection',
|
||||
'/prod/records/property' => 'Alchemy\Phrasea\ControllerProvider\Prod\Property',
|
||||
|
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
@@ -8,53 +7,24 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace Alchemy\Phrasea\Controller\Prod;
|
||||
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Controller\Controller;
|
||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Records implements ControllerProviderInterface
|
||||
class RecordController extends Controller
|
||||
{
|
||||
use ControllerProviderTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$app['controller.prod.records'] = $this;
|
||||
|
||||
$controllers = $this->createAuthenticatedCollection($app);
|
||||
|
||||
$controllers->match('/', 'controller.prod.records:getRecord')
|
||||
->bind('record_details')
|
||||
->method('GET|POST');
|
||||
|
||||
$controllers->post('/delete/', 'controller.prod.records:doDeleteRecords')
|
||||
->bind('record_delete');
|
||||
|
||||
$controllers->post('/delete/what/', 'controller.prod.records:whatCanIDelete')
|
||||
->bind('record_what_can_i_delete');
|
||||
|
||||
$controllers->post('/renew-url/', 'controller.prod.records:renewUrl')
|
||||
->bind('record_renew_url');
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get record detailed view
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @return Response
|
||||
*/
|
||||
public function getRecord(Application $app, Request $request)
|
||||
{
|
||||
@@ -147,7 +117,7 @@ class Records implements ControllerProviderInterface
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @return Response
|
||||
*/
|
||||
public function doDeleteRecords(Application $app, Request $request)
|
||||
{
|
||||
@@ -192,7 +162,7 @@ class Records implements ControllerProviderInterface
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @return Response
|
||||
*/
|
||||
public function whatCanIDelete(Application $app, Request $request)
|
||||
{
|
||||
@@ -211,7 +181,7 @@ class Records implements ControllerProviderInterface
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @return Response
|
||||
*/
|
||||
public function renewUrl(Application $app, Request $request)
|
||||
{
|
59
lib/Alchemy/Phrasea/ControllerProvider/Prod/Record.php
Normal file
59
lib/Alchemy/Phrasea/ControllerProvider/Prod/Record.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\ControllerProvider\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\Prod\RecordController;
|
||||
use Alchemy\Phrasea\ControllerProvider\ControllerProviderTrait;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\ServiceProviderInterface;
|
||||
|
||||
class Record implements ControllerProviderInterface, ServiceProviderInterface
|
||||
{
|
||||
use ControllerProviderTrait;
|
||||
|
||||
public function register(Application $app)
|
||||
{
|
||||
$app['controller.prod.records'] = $app->share(function (PhraseaApplication $app) {
|
||||
return (new RecordController($app));
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(Application $app)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $this->createAuthenticatedCollection($app);
|
||||
|
||||
$controllers->match('/', 'controller.prod.records:getRecord')
|
||||
->bind('record_details')
|
||||
->method('GET|POST');
|
||||
|
||||
$controllers->post('/delete/', 'controller.prod.records:doDeleteRecords')
|
||||
->bind('record_delete');
|
||||
|
||||
$controllers->post('/delete/what/', 'controller.prod.records:whatCanIDelete')
|
||||
->bind('record_what_can_i_delete');
|
||||
|
||||
$controllers->post('/renew-url/', 'controller.prod.records:renewUrl')
|
||||
->bind('record_renew_url');
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user