mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
V 3.5 RC 1
This commit is contained in:
71
lib/classes/Controller/Admin/Fields.class.php
Normal file
71
lib/classes/Controller/Admin/Fields.class.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\ControllerCollection;
|
||||
|
||||
class Controller_Admin_Fields implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$session = $appbox->get_session();
|
||||
// $session->close_storage();
|
||||
|
||||
$controllers = new ControllerCollection();
|
||||
|
||||
|
||||
$controllers->get('/checkmulti/', function() use ($app, $appbox)
|
||||
{
|
||||
$request = $app['request'];
|
||||
$multi = ($request->get('multi') === 'true');
|
||||
|
||||
$metadata = databox_field::load_class_from_xpath($request->get('source'));
|
||||
|
||||
$datas = array(
|
||||
'result' => ($multi === $metadata->is_multi())
|
||||
, 'is_multi' => $metadata->is_multi()
|
||||
);
|
||||
|
||||
return new Response(p4string::jsonencode($datas));
|
||||
});
|
||||
|
||||
$controllers->get('/checkreadonly/', function() use ($app, $appbox)
|
||||
{
|
||||
$request = $app['request'];
|
||||
$readonly = ($request->get('readonly') === 'true');
|
||||
|
||||
$metadata = databox_field::load_class_from_xpath($request->get('source'));
|
||||
|
||||
$datas = array(
|
||||
'result' => ($readonly === $metadata->is_readonly())
|
||||
, 'is_readonly' => $metadata->is_readonly()
|
||||
);
|
||||
|
||||
return new Response(p4string::jsonencode($datas));
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user