mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge remote-tracking branch 'upstream/master' into 20150306-elastic-indexer
Conflicts: bin/console bower.json composer.json composer.lock lib/Alchemy/Phrasea/Application.php lib/Alchemy/Phrasea/Border/Manager.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Core/PhraseaEvents.php lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php lib/classes/caption/field.php lib/classes/record/Interface.php templates/web/prod/index.html.twig www/skins/prod/000000/prodcolor.css
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -21,7 +21,6 @@ abstract class AbstractDelivery implements ControllerProviderInterface
|
||||
public function deliverContent(Request $request, \record_adapter $record, $subdef, $watermark, $stamp, Application $app)
|
||||
{
|
||||
$file = $record->get_subdef($subdef);
|
||||
|
||||
$pathOut = $file->get_pathfile();
|
||||
|
||||
if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
|
||||
@@ -30,43 +29,18 @@ abstract class AbstractDelivery implements ControllerProviderInterface
|
||||
$pathOut = \recordutils_image::stamp($app, $file);
|
||||
}
|
||||
|
||||
$log_id = null;
|
||||
try {
|
||||
$logger = $app['phraseanet.logger']($record->get_databox());
|
||||
$log_id = $logger->get_id();
|
||||
|
||||
$referrer = 'NO REFERRER';
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$referrer = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
$record->log_view($log_id, $referrer, $app['conf']->get(['main', 'key']));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$disposition = $request->query->get('download') ? DeliverDataInterface::DISPOSITION_ATTACHMENT : DeliverDataInterface::DISPOSITION_INLINE;
|
||||
|
||||
$response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), $disposition, $file->get_mime());
|
||||
$response->setPrivate();
|
||||
|
||||
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
||||
if ($file->getEtag()) {
|
||||
$response->setEtag($file->getEtag());
|
||||
$response->setLastModified($file->get_modification_date());
|
||||
}
|
||||
|
||||
if (false === $record->is_grouping() && $subdef !== 'document') {
|
||||
if (in_array($subdef, array('document', 'preview'))) {
|
||||
$response->setPrivate();
|
||||
$this->logView($app, $record, $request);
|
||||
} elseif ($subdef !== 'thumbnail') {
|
||||
try {
|
||||
if ($file->getDataboxSubdef()->get_class() == \databox_subdef::CLASS_THUMBNAIL) {
|
||||
// default expiration is 5 days
|
||||
$expiration = 60 * 60 * 24 * 5;
|
||||
$response->setExpires(new \DateTime(sprintf('+%d seconds', $expiration)));
|
||||
|
||||
$response->setMaxAge($expiration);
|
||||
$response->setSharedMaxAge($expiration);
|
||||
$response->setPublic();
|
||||
if ($file->getDataboxSubdef()->get_class() != \databox_subdef::CLASS_THUMBNAIL) {
|
||||
$response->setPrivate();
|
||||
$this->logView($app, $record, $request);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -77,4 +51,15 @@ abstract class AbstractDelivery implements ControllerProviderInterface
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function logView(Application $app, \record_adapter $record, Request $request)
|
||||
{
|
||||
try {
|
||||
$logger = $app['phraseanet.logger']($record->get_databox());
|
||||
$log_id = $logger->get_id();
|
||||
$record->log_view($log_id, $request->headers->get('referer', 'NO REFERRER'), $app['phraseanet.configuration']['main']['key']);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -105,15 +105,6 @@ class Collection implements ControllerProviderInterface
|
||||
$controllers->post('/{bas_id}/picture/stamp-logo/delete/', 'controller.admin.collection:deleteStamp')
|
||||
->assert('bas_id', '\d+')
|
||||
->bind('admin_collection_delete_stamp');
|
||||
|
||||
$controllers->post('/{bas_id}/picture/banner/', 'controller.admin.collection:setBanner')
|
||||
->assert('bas_id', '\d+')
|
||||
->bind('admin_collection_submit_banner');
|
||||
|
||||
$controllers->post('/{bas_id}/picture/banner/delete/', 'controller.admin.collection:deleteBanner')
|
||||
->assert('bas_id', '\d+')
|
||||
->bind('admin_collection_delete_banner');
|
||||
|
||||
$controllers->get('/{bas_id}/informations/details/', 'controller.admin.collection:getDetails')
|
||||
->assert('bas_id', '\d+')
|
||||
->bind('admin_collection_display_document_details');
|
||||
@@ -267,41 +258,6 @@ class Collection implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the collection banner
|
||||
*
|
||||
* @param Application $app The silex application
|
||||
* @param Request $request The current request
|
||||
* @param integer $bas_id The collection base_id
|
||||
* @return JsonResponse|RedirectResponse
|
||||
*/
|
||||
public function deleteBanner(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
$success = false;
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->write_collection_pic($app['media-alchemyst'], $app['filesystem'], $collection, null, \collection::PIC_PRESENTATION);
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
return $app->json([
|
||||
'success' => $success,
|
||||
'msg' => $success ? $app->trans('Successful removal') : $app->trans('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $collection->get_base_id(),
|
||||
'success' => (int) $success,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the collection stamp
|
||||
*
|
||||
@@ -408,56 +364,6 @@ class Collection implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a collection banner
|
||||
*
|
||||
* @param Application $app The silex application
|
||||
* @param Request $request The current request
|
||||
* @param integer $bas_id The collection base_id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function setBanner(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (null === $file = $request->files->get('newBanner')) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-too-big',
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$file->isValid()) {
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-invalid',
|
||||
]);
|
||||
}
|
||||
|
||||
$collection = \collection::get_from_base_id($app, $bas_id);
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->write_collection_pic($app['media-alchemyst'], $app['filesystem'], $collection, $file, \collection::PIC_PRESENTATION);
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 0,
|
||||
'error' => 'file-error',
|
||||
]);
|
||||
}
|
||||
|
||||
return $app->redirectPath('admin_display_collection', [
|
||||
'bas_id' => $bas_id,
|
||||
'success' => 1,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a collection stamp
|
||||
*
|
||||
@@ -631,7 +537,6 @@ class Collection implements ControllerProviderInterface
|
||||
$msg = $app->trans('Successful removal');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -47,7 +47,7 @@ class ConnectedUsers implements ControllerProviderInterface
|
||||
$date = new \DateTime('-2 hours');
|
||||
$params = ['date' => $date->format('Y-m-d h:i:s')];
|
||||
|
||||
$query = $app['EM']->createQuery($dql);
|
||||
$query = $app['orm.em']->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$sessions = $query->getResult();
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -115,6 +115,9 @@ class Databoxes implements ControllerProviderInterface
|
||||
case 'mount-failed' :
|
||||
$errorMsg = $app->trans('Database could not be mounted');
|
||||
break;
|
||||
case 'innodb-support' :
|
||||
$errorMsg = _('Database server does not support InnoDB storage engine');
|
||||
break;
|
||||
}
|
||||
|
||||
return $app['twig']->render('admin/databases.html.twig', [
|
||||
@@ -155,7 +158,7 @@ class Databoxes implements ControllerProviderInterface
|
||||
$dataTemplate = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml');
|
||||
|
||||
try {
|
||||
$connbas = $app['dbal.provider']->get([
|
||||
$connbas = $app['dbal.provider']([
|
||||
'host' => $hostname,
|
||||
'port' => $port,
|
||||
'user' => $user,
|
||||
@@ -172,6 +175,7 @@ class Databoxes implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['authentication']->getUser());
|
||||
$app['acl']->get($app['authentication']->getUser())->delete_data_from_cache();
|
||||
|
||||
$connbas->close();
|
||||
return $app->redirectPath('admin_database', ['databox_id' => $base->get_sbas_id(), 'success' => 1, 'reload-tree' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('admin_databases', ['success' => 0, 'error' => 'base-failed']);
|
||||
@@ -188,7 +192,7 @@ class Databoxes implements ControllerProviderInterface
|
||||
|
||||
try {
|
||||
$data_template = new \SplFileInfo($app['root.path'] . '/lib/conf.d/data_templates/' . $dataTemplate . '.xml');
|
||||
$connbas = $app['dbal.provider']->get([
|
||||
$connbas = $app['db.provider']([
|
||||
'host' => $hostname,
|
||||
'port' => $port,
|
||||
'user' => $userDb,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -67,10 +67,10 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
$publisher->setFeed($feed);
|
||||
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->persist($publisher);
|
||||
$app['orm.em']->persist($feed);
|
||||
$app['orm.em']->persist($publisher);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->redirectPath('admin_feeds_list');
|
||||
})->bind('admin_feeds_create');
|
||||
@@ -101,8 +101,8 @@ class Publications implements ControllerProviderInterface
|
||||
$feed->setSubtitle($request->request->get('subtitle', ''));
|
||||
$feed->setCollection($collection);
|
||||
$feed->setIsPublic('1' === $request->request->get('public'));
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($feed);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->redirectPath('admin_feeds_list');
|
||||
})->before(function (Request $request) use ($app) {
|
||||
@@ -171,8 +171,8 @@ class Publications implements ControllerProviderInterface
|
||||
unset($media);
|
||||
|
||||
$feed->setIconUrl(true);
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($feed);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$app['filesystem']->copy($tmpname, $app['root.path'] . '/config/feed_' . $feed->getId() . '.jpg');
|
||||
$app['filesystem']->copy($tmpname, sprintf('%s/www/custom/feed_%d.jpg', $app['root.path'], $feed->getId()));
|
||||
@@ -202,10 +202,10 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
$feed->addPublisher($publisher);
|
||||
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->persist($publisher);
|
||||
$app['orm.em']->persist($feed);
|
||||
$app['orm.em']->persist($publisher);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
} catch (\Exception $e) {
|
||||
$error = "An error occured";
|
||||
}
|
||||
@@ -230,8 +230,8 @@ class Publications implements ControllerProviderInterface
|
||||
if ($feed->isPublisher($user) && !$feed->isOwner($user)) {
|
||||
$feed->removePublisher($publisher);
|
||||
|
||||
$app['EM']->remove($publisher);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($publisher);
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = "An error occured";
|
||||
@@ -254,8 +254,8 @@ class Publications implements ControllerProviderInterface
|
||||
unlink('custom/feed_' . $feed->getId() . '.jpg');
|
||||
}
|
||||
|
||||
$app['EM']->remove($feed);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($feed);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->redirectPath('admin_feeds_list');
|
||||
})
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -159,32 +159,29 @@ class Root implements ControllerProviderInterface
|
||||
})->bind('admin_display_tree');
|
||||
|
||||
$controllers->get('/test-paths/', function (Application $app, Request $request) {
|
||||
|
||||
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
if (!$request->isXmlHttpRequest()) {
|
||||
$app->abort(400);
|
||||
}
|
||||
if (!array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, $app->trans('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (0 !== count($tests = $request->query->get('tests', []))) {
|
||||
if (0 === count($tests = $request->query->get('tests', []))) {
|
||||
$app->abort(400, $app->trans('Missing tests parameter'));
|
||||
}
|
||||
|
||||
if (null !== $path = $request->query->get('path')) {
|
||||
if (null === $path = $request->query->get('path')) {
|
||||
$app->abort(400, $app->trans('Missing path parameter'));
|
||||
}
|
||||
|
||||
foreach ($tests as $test) {
|
||||
switch ($test) {
|
||||
case 'writeable':
|
||||
if (!is_writable($path)) {
|
||||
$result = false;
|
||||
}
|
||||
$result = is_writable($path);
|
||||
break;
|
||||
case 'readable':
|
||||
default:
|
||||
if (!is_readable($path)) {
|
||||
$result = true;
|
||||
}
|
||||
break;
|
||||
$result = is_readable($path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -30,10 +30,12 @@ class TaskManager implements ControllerProviderInterface
|
||||
|
||||
$app['firewall']->addMandatoryAuthentication($controllers);
|
||||
|
||||
$converter = function ($task) use ($app) {
|
||||
return $app['converter.task']->convert($task);
|
||||
};
|
||||
|
||||
$controllers->before(function (Request $request) use ($app) {
|
||||
$app['firewall']->requireRight('taskmanager');
|
||||
})->convert('task', function ($id) use ($app) {
|
||||
return $app['converter.task']->convert($id);
|
||||
});
|
||||
|
||||
$controllers
|
||||
@@ -70,38 +72,47 @@ class TaskManager implements ControllerProviderInterface
|
||||
|
||||
$controllers
|
||||
->get('/task/{task}/log', 'controller.admin.task:getTaskLog')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_log');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/delete', 'controller.admin.task:postTaskDelete')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_delete');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/start', 'controller.admin.task:postStartTask')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_start');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/stop', 'controller.admin.task:postStopTask')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_stop');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/resetcrashcounter', 'controller.admin.task:postResetCrashes')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_reset');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/save', 'controller.admin.task:postSaveTask')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_save');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/facility', 'controller.admin.task:postTaskFacility')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_facility');
|
||||
|
||||
$controllers
|
||||
->post('/task/{task}/xml-from-form', 'controller.admin.task:postXMLFromForm')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_xml_from_form');
|
||||
|
||||
$controllers
|
||||
->get('/task/{task}', 'controller.admin.task:getTask')
|
||||
->convert('task', $converter)
|
||||
->bind('admin_tasks_task_show');
|
||||
|
||||
$controllers
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -648,7 +648,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$basList = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage']));
|
||||
$models = $app['EM.native-query']->getModelForUser($app['authentication']->getUser(), $basList);
|
||||
$models = $app['orm.em.native-query']->getModelForUser($app['authentication']->getUser(), $basList);
|
||||
|
||||
return $app['twig']->render('/admin/user/import/view.html.twig', [
|
||||
'nb_user_to_add' => $nbUsrToAdd,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -43,6 +43,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Alchemy\Phrasea\Model\Repositories\BasketRepository;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretSession;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;
|
||||
|
||||
class V1 implements ControllerProviderInterface
|
||||
{
|
||||
@@ -116,6 +117,8 @@ class V1 implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/records/add/', 'controller.api.v1:add_record');
|
||||
|
||||
$controllers->post('/embed/substitute/', 'controller.api.v1:substitute');
|
||||
|
||||
$controllers->match('/search/', 'controller.api.v1:search');
|
||||
|
||||
$controllers->match('/records/search/', 'controller.api.v1:search_records');
|
||||
@@ -198,6 +201,7 @@ class V1 implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/me/', 'controller.api.v1:get_current_user');
|
||||
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
@@ -327,7 +331,7 @@ class V1 implements ControllerProviderInterface
|
||||
*/
|
||||
private function get_cache_info(Application $app)
|
||||
{
|
||||
$caches = ['main' => $app['cache'], 'op_code' => $app['opcode-cache'], 'doctrine_metadatas' => $app['EM']->getConfiguration()->getMetadataCacheImpl(), 'doctrine_query' => $app['EM']->getConfiguration()->getQueryCacheImpl(), 'doctrine_result' => $app['EM']->getConfiguration()->getResultCacheImpl(),];
|
||||
$caches = ['main' => $app['cache'], 'op_code' => $app['opcode-cache'], 'doctrine_metadatas' => $app['orm.em']->getConfiguration()->getMetadataCacheImpl(), 'doctrine_query' => $app['orm.em']->getConfiguration()->getQueryCacheImpl(), 'doctrine_result' => $app['orm.em']->getConfiguration()->getResultCacheImpl(),];
|
||||
|
||||
$ret = [];
|
||||
|
||||
@@ -523,8 +527,8 @@ class V1 implements ControllerProviderInterface
|
||||
$session = new LazaretSession();
|
||||
$session->setUser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($session);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($session);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$reasons = $output = null;
|
||||
|
||||
@@ -552,13 +556,15 @@ class V1 implements ControllerProviderInterface
|
||||
return $this->getBadRequest($app, $request, sprintf('Invalid forceBehavior value `%s`', $request->get('forceBehavior')));
|
||||
}
|
||||
|
||||
$app['border-manager']->process($session, $Package, $callback, $behavior);
|
||||
$nosubdef = $request->get('nosubdefs')==='' || \p4field::isyes($request->get('nosubdefs'));
|
||||
$app['border-manager']->process($session, $Package, $callback, $behavior, $nosubdef);
|
||||
|
||||
$ret = ['entity' => null,];
|
||||
|
||||
if ($output instanceof \record_adapter) {
|
||||
$ret['entity'] = '0';
|
||||
$ret['url'] = '/records/' . $output->get_sbas_id() . '/' . $output->get_record_id() . '/';
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_UPLOAD, new RecordEdit($output));
|
||||
}
|
||||
if ($output instanceof LazaretFile) {
|
||||
$ret['entity'] = '1';
|
||||
@@ -567,6 +573,49 @@ class V1 implements ControllerProviderInterface
|
||||
|
||||
return Result::create($request, $ret)->createResponse();
|
||||
}
|
||||
|
||||
public function substitute(Application $app, Request $request)
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
if (count($request->files->get('file')) == 0) {
|
||||
throw new API_V1_exception_badrequest('Missing file parameter');
|
||||
}
|
||||
if (!$request->files->get('file') instanceof Symfony\Component\HttpFoundation\File\UploadedFile) {
|
||||
throw new API_V1_exception_badrequest('You can upload one file at time');
|
||||
}
|
||||
$file = $request->files->get('file');
|
||||
// @var $file Symfony\Component\HttpFoundation\File\UploadedFile
|
||||
if (!$file->isValid()) {
|
||||
throw new API_V1_exception_badrequest('Datas corrupted, please try again');
|
||||
}
|
||||
if (!$request->get('databox_id')) {
|
||||
throw new API_V1_exception_badrequest('Missing databox_id parameter');
|
||||
}
|
||||
if (!$request->get('record_id')) {
|
||||
throw new API_V1_exception_badrequest('Missing record_id parameter');
|
||||
}
|
||||
if (!$request->get('name')) {
|
||||
throw new API_V1_exception_badrequest('Missing name parameter');
|
||||
}
|
||||
$media = $app['mediavorus']->guess($file->getPathname());
|
||||
// @var $record \record_adapter
|
||||
$record = $this->app['phraseanet.appbox']->get_databox($request->get('databox_id'))->get_record($request->get('record_id'));
|
||||
$base_id = $record->get_base_id();
|
||||
$collection = \collection::get_from_base_id($this->app, $base_id);
|
||||
if (!$app['authentication']->getUser()->ACL()->has_right_on_base($base_id, 'canaddrecord')) {
|
||||
throw new API_V1_exception_forbidden(sprintf('You do not have access to collection %s', $collection->get_label($this->app['locale.I18n'])));
|
||||
}
|
||||
$record->substitute_subdef($request->get('name'), $media, $app);
|
||||
foreach ($record->get_embedable_medias() as $name => $media) {
|
||||
if ($name == $request->get('name') &&
|
||||
null !== ($subdef = $this->list_embedable_media($record, $media, $this->app['phraseanet.registry']))) {
|
||||
$ret[] = $subdef;
|
||||
}
|
||||
}
|
||||
|
||||
return Result::create($request, $ret)->createResponse();
|
||||
}
|
||||
|
||||
public function list_quarantine(Application $app, Request $request)
|
||||
{
|
||||
@@ -717,7 +766,7 @@ class V1 implements ControllerProviderInterface
|
||||
$that = $this;
|
||||
$baskets = array_map(function (Basket $basket) use ($that, $app) {
|
||||
return $that->list_basket($app, $basket);
|
||||
}, (array) $app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id)->get_container_baskets($app['EM'], $app['authentication']->getUser()));
|
||||
}, (array) $app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id)->get_container_baskets($app['orm.em'], $app['authentication']->getUser()));
|
||||
|
||||
$record = $app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||
|
||||
@@ -862,6 +911,9 @@ class V1 implements ControllerProviderInterface
|
||||
|
||||
$record->set_binary_status(strrev($datas));
|
||||
|
||||
// @todo Move event dispatch inside record_adapter class (keeps things encapsulated)
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($record));
|
||||
|
||||
$ret = ["status" => $this->list_record_status($record)];
|
||||
|
||||
return Result::create($request, $ret)->createResponse();
|
||||
@@ -984,8 +1036,8 @@ class V1 implements ControllerProviderInterface
|
||||
$Basket->setUser($app['authentication']->getUser());
|
||||
$Basket->setName($name);
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($Basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return Result::create($request, ["basket" => $this->list_basket($app, $Basket)])->createResponse();
|
||||
}
|
||||
@@ -1000,8 +1052,8 @@ class V1 implements ControllerProviderInterface
|
||||
*/
|
||||
public function delete_basket(Application $app, Request $request, Basket $basket)
|
||||
{
|
||||
$app['EM']->remove($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $this->search_baskets($app, $request);
|
||||
}
|
||||
@@ -1091,8 +1143,8 @@ class V1 implements ControllerProviderInterface
|
||||
{
|
||||
$basket->setName($request->get('name'));
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return Result::create($request, ["basket" => $this->list_basket($app, $basket)])->createResponse();
|
||||
}
|
||||
@@ -1109,8 +1161,8 @@ class V1 implements ControllerProviderInterface
|
||||
{
|
||||
$basket->setDescription($request->get('description'));
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return Result::create($request, ["basket" => $this->list_basket($app, $basket)])->createResponse();
|
||||
}
|
||||
@@ -1278,7 +1330,19 @@ class V1 implements ControllerProviderInterface
|
||||
$permalink = null;
|
||||
}
|
||||
|
||||
return ['name' => $media->get_name(), 'permalink' => $permalink, 'height' => $media->get_height(), 'width' => $media->get_width(), 'filesize' => $media->get_size(), 'devices' => $media->getDevices(), 'player_type' => $media->get_type(), 'mime_type' => $media->get_mime(),];
|
||||
return [
|
||||
'name' => $media->get_name(),
|
||||
'permalink' => $permalink,
|
||||
'height' => $media->get_height(),
|
||||
'width' => $media->get_width(),
|
||||
'filesize' => $media->get_size(),
|
||||
'devices' => $media->getDevices(),
|
||||
'player_type' => $media->get_type(),
|
||||
'mime_type' => $media->get_mime(),
|
||||
'substituted' => $media->is_substituted(),
|
||||
'created_on' => $media->get_creation_date()->format(DATE_ATOM),
|
||||
'updated_on' => $media->get_modification_date()->format(DATE_ATOM),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -63,8 +63,8 @@ class Baskets implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['repo.basket-elements'];
|
||||
$basketElement = $repository->findUserElement($request->request->get('p0'), $app['authentication']->getUser());
|
||||
$app['EM']->remove($basketElement);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($basketElement);
|
||||
$app['orm.em']->flush();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
@@ -87,8 +87,8 @@ class Baskets implements ControllerProviderInterface
|
||||
$basket = $app['converter.basket']->convert($request->request->get('courChuId'));
|
||||
$app['acl.basket']->isOwner($basket, $app['authentication']->getUser());
|
||||
|
||||
$app['EM']->remove($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($basket);
|
||||
$app['orm.em']->flush();
|
||||
unset($basket);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -113,8 +113,8 @@ class Baskets implements ControllerProviderInterface
|
||||
$basket->setName($request->request->get('p0'));
|
||||
$basket->setUser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -145,9 +145,9 @@ class Baskets implements ControllerProviderInterface
|
||||
$basketElement->setBasket($basket);
|
||||
$basket->addElement($basketElement);
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['orm.em']->persist($basket);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -30,6 +30,7 @@ class Root implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->before(function (Request $request) use ($app) {
|
||||
|
||||
if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) {
|
||||
return $app->redirectPath('login_authenticate_as_guest', ['redirect' => 'client']);
|
||||
}
|
||||
@@ -233,6 +234,8 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
public function getClient(Application $app, Request $request)
|
||||
{
|
||||
$app['session']->getFlashBag()->add('step_by_step', '');
|
||||
|
||||
try {
|
||||
\Session_Logger::updateClientInfos($app, 2);
|
||||
} catch (SessionNotFound $e) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -211,15 +211,15 @@ class Lightbox implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
if ($basket->getIsRead() === false) {
|
||||
$basket = $app['EM']->merge($basket);
|
||||
$basket = $app['orm.em']->merge($basket);
|
||||
$basket->setIsRead(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
|
||||
$basket = $app['EM']->merge($basket);
|
||||
$basket = $app['orm.em']->merge($basket);
|
||||
$basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$template = 'lightbox/validate.html.twig';
|
||||
@@ -258,15 +258,15 @@ class Lightbox implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
if ($basket->getIsRead() === false) {
|
||||
$basket = $app['EM']->merge($basket);
|
||||
$basket = $app['orm.em']->merge($basket);
|
||||
$basket->setIsRead(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
|
||||
$basket = $app['EM']->merge($basket);
|
||||
$basket = $app['orm.em']->merge($basket);
|
||||
$basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$template = 'lightbox/validate.html.twig';
|
||||
@@ -348,9 +348,9 @@ class Lightbox implements ControllerProviderInterface
|
||||
|
||||
$validationDatas->setNote($note);
|
||||
|
||||
$app['EM']->merge($validationDatas);
|
||||
$app['orm.em']->merge($validationDatas);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($app['browser']->isMobile()) {
|
||||
$datas = $app['twig']->render('lightbox/sc_note.html.twig', ['basket_element' => $basket_element]);
|
||||
@@ -408,9 +408,9 @@ class Lightbox implements ControllerProviderInterface
|
||||
->getValidation()
|
||||
->getParticipant($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->merge($basket_element);
|
||||
$app['orm.em']->merge($basket_element);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$releasable = false;
|
||||
if ($participant->isReleasable() === true) {
|
||||
@@ -468,8 +468,8 @@ class Lightbox implements ControllerProviderInterface
|
||||
|
||||
$participant->setIsConfirmed(true);
|
||||
|
||||
$app['EM']->merge($participant);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->merge($participant);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = ['error' => false, 'datas' => $app->trans('Envoie avec succes')];
|
||||
} catch (ControllerException $e) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -95,13 +95,13 @@ class BasketController implements ControllerProviderInterface
|
||||
{
|
||||
if ($basket->getIsRead() === false) {
|
||||
$basket->setIsRead(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
if ($basket->getValidation()) {
|
||||
if ($basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
|
||||
$basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class BasketController implements ControllerProviderInterface
|
||||
$Basket->setUser($app['authentication']->getUser());
|
||||
$Basket->setDescription($request->request->get('desc'));
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
$app['orm.em']->persist($Basket);
|
||||
|
||||
$n = 0;
|
||||
|
||||
@@ -136,14 +136,14 @@ class BasketController implements ControllerProviderInterface
|
||||
$basket_element->setRecord($record);
|
||||
$basket_element->setBasket($Basket);
|
||||
|
||||
$app['EM']->persist($basket_element);
|
||||
$app['orm.em']->persist($basket_element);
|
||||
|
||||
$Basket->addElement($basket_element);
|
||||
|
||||
$n++;
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($request->getRequestFormat() === 'json') {
|
||||
$data = [
|
||||
@@ -162,8 +162,8 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
public function deleteBasket(Application $app, Request $request, BasketEntity $basket)
|
||||
{
|
||||
$app['EM']->remove($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$data = [
|
||||
'success' => true
|
||||
@@ -179,7 +179,7 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
public function removeBasketElement(Application $app, Request $request, BasketEntity $basket, $basket_element_id)
|
||||
{
|
||||
$basketElement = $app['EM']->getRepository('Phraseanet:BasketElement')->find($basket_element_id);
|
||||
$basketElement = $app['orm.em']->getRepository('Phraseanet:BasketElement')->find($basket_element_id);
|
||||
$ord = $basketElement->getOrd();
|
||||
|
||||
foreach ($basket->getElements() as $basket_element) {
|
||||
@@ -188,12 +188,12 @@ class BasketController implements ControllerProviderInterface
|
||||
}
|
||||
if ($basket_element->getId() === (int) $basket_element_id) {
|
||||
$basket->removeElement($basket_element);
|
||||
$app['EM']->remove($basket_element);
|
||||
$app['orm.em']->remove($basket_element);
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$data = ['success' => true, 'message' => $app->trans('Record removed from basket')];
|
||||
|
||||
@@ -212,8 +212,8 @@ class BasketController implements ControllerProviderInterface
|
||||
$basket->setName($request->request->get('name', ''));
|
||||
$basket->setDescription($request->request->get('description'));
|
||||
|
||||
$app['EM']->merge($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->merge($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$success = true;
|
||||
$msg = $app->trans('Basket has been updated');
|
||||
@@ -259,11 +259,11 @@ class BasketController implements ControllerProviderInterface
|
||||
if (isset($order[$basketElement->getId()])) {
|
||||
$basketElement->setOrd($order[$basketElement->getId()]);
|
||||
|
||||
$app['EM']->merge($basketElement);
|
||||
$app['orm.em']->merge($basketElement);
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
$ret = ['success' => true, 'message' => $app->trans('Basket updated')];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -278,8 +278,8 @@ class BasketController implements ControllerProviderInterface
|
||||
|
||||
$basket->setArchived($archive_status);
|
||||
|
||||
$app['EM']->merge($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->merge($basket);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($archive_status) {
|
||||
$message = $app->trans('Basket has been archived');
|
||||
@@ -314,7 +314,7 @@ class BasketController implements ControllerProviderInterface
|
||||
$basket_element->setRecord($record);
|
||||
$basket_element->setBasket($basket);
|
||||
|
||||
$app['EM']->persist($basket_element);
|
||||
$app['orm.em']->persist($basket_element);
|
||||
|
||||
$basket->addElement($basket_element);
|
||||
|
||||
@@ -327,14 +327,14 @@ class BasketController implements ControllerProviderInterface
|
||||
$validationData->setParticipant($participant);
|
||||
$validationData->setBasketElement($basket_element);
|
||||
|
||||
$app['EM']->persist($validationData);
|
||||
$app['orm.em']->persist($validationData);
|
||||
}
|
||||
}
|
||||
|
||||
$n++;
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$data = [
|
||||
'success' => true
|
||||
@@ -365,7 +365,7 @@ class BasketController implements ControllerProviderInterface
|
||||
$n++;
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$data = ['success' => true, 'message' => $app->trans('%quantity% records moved', ['%quantity%' => $n])];
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -180,12 +180,19 @@ class DoDownload implements ControllerProviderInterface
|
||||
$app['session']->save();
|
||||
ignore_user_abort(true);
|
||||
|
||||
\set_export::build_zip(
|
||||
$app,
|
||||
$token,
|
||||
$list,
|
||||
sprintf($app['tmp.download.path'].'/%s.zip', $token->getValue()) // Dest file
|
||||
);
|
||||
if ($list['count'] > 1) {
|
||||
\set_export::build_zip(
|
||||
$app,
|
||||
$token,
|
||||
$list,
|
||||
sprintf($app['tmp.download.path'].'/%s.zip', $token->getValue()) // Dest file
|
||||
);
|
||||
} else {
|
||||
$list['complete'] = true;
|
||||
$token->setData(serialize($list));
|
||||
$app['orm.em']->persist($token);
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
return $app->json([
|
||||
'success' => true,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Prod;
|
||||
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
|
||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||
use Alchemy\Phrasea\Metadata\Tag\TfEditdate;
|
||||
@@ -292,6 +294,7 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$media = $app['mediavorus']->guess($value->get_pathfile());
|
||||
$app['subdef.substituer']->substitute($reg_record, $name, $media);
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($reg_record));
|
||||
$app['phraseanet.logger']($reg_record->get_databox())->log(
|
||||
$reg_record,
|
||||
\Session_Logger::EVENT_SUBSTITUTE,
|
||||
@@ -311,15 +314,6 @@ class Edit implements ControllerProviderInterface
|
||||
$databoxes = $records->databoxes();
|
||||
$databox = array_pop($databoxes);
|
||||
|
||||
$meta_struct = $databox->get_meta_structure();
|
||||
$write_edit_el = false;
|
||||
$date_obj = new \DateTime();
|
||||
foreach ($meta_struct->get_elements() as $meta_struct_el) {
|
||||
if ($meta_struct_el->get_tag() instanceof TfEditdate) {
|
||||
$write_edit_el = $meta_struct_el;
|
||||
}
|
||||
}
|
||||
|
||||
$elements = $records->toArray();
|
||||
|
||||
foreach ($request->request->get('mds') as $rec) {
|
||||
@@ -346,31 +340,7 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
if (isset($rec['metadatas']) && is_array($rec['metadatas'])) {
|
||||
$record->set_metadatas($rec['metadatas']);
|
||||
}
|
||||
|
||||
/**
|
||||
* todo : this should not work
|
||||
*/
|
||||
if ($write_edit_el instanceof \databox_field) {
|
||||
$fields = $record->get_caption()->get_fields([$write_edit_el->get_name()], true);
|
||||
$field = array_pop($fields);
|
||||
|
||||
$meta_id = null;
|
||||
|
||||
if ($field && !$field->is_multi()) {
|
||||
$values = $field->get_values();
|
||||
$meta_id = array_pop($values)->getId();
|
||||
}
|
||||
|
||||
$metas = [
|
||||
[
|
||||
'meta_struct_id' => $write_edit_el->get_id(),
|
||||
'meta_id' => $meta_id,
|
||||
'value' => $date_obj->format('Y-m-d h:i:s'),
|
||||
]
|
||||
];
|
||||
|
||||
$record->set_metadatas($metas, true);
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($record));
|
||||
}
|
||||
|
||||
$newstat = $record->get_status();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -91,6 +91,8 @@ class Export implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('Error while connecting to FTP');
|
||||
|
||||
try {
|
||||
$ftpClient = $app['phraseanet.ftp.client']($request->request->get('address', ''), 21, 90, !!$request->request->get('ssl'));
|
||||
$ftpClient->login($request->request->get('login', 'anonymous'), $request->request->get('password', 'anonymous'));
|
||||
@@ -98,7 +100,6 @@ class Export implements ControllerProviderInterface
|
||||
$msg = $app->trans('Connection to FTP succeed');
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
$msg = $app->trans('Error while connecting to FTP');
|
||||
}
|
||||
|
||||
return $app->json([
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -78,12 +78,12 @@ class Feed implements ControllerProviderInterface
|
||||
->setRecordId($record->get_record_id())
|
||||
->setSbasId($record->get_sbas_id());
|
||||
$entry->addItem($item);
|
||||
$app['EM']->persist($item);
|
||||
$app['orm.em']->persist($item);
|
||||
}
|
||||
|
||||
$app['EM']->persist($entry);
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($entry);
|
||||
$app['orm.em']->persist($feed);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::FEED_ENTRY_CREATE, new FeedEntryEvent($entry, $request->request->get('notify')));
|
||||
|
||||
@@ -159,11 +159,11 @@ class Feed implements ControllerProviderInterface
|
||||
}
|
||||
$item = $app['repo.feed-items']->find($item_sort_datas[0]);
|
||||
$item->setOrd($item_sort_datas[1]);
|
||||
$app['EM']->persist($item);
|
||||
$app['orm.em']->persist($item);
|
||||
}
|
||||
|
||||
$app['EM']->persist($entry);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($entry);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->json([
|
||||
'error' => false,
|
||||
@@ -190,8 +190,8 @@ class Feed implements ControllerProviderInterface
|
||||
$app->abort(403, $app->trans('Action Forbidden : You are not the publisher'));
|
||||
}
|
||||
|
||||
$app['EM']->remove($entry);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($entry);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->json(['error' => false, 'message' => 'succes']);
|
||||
})
|
||||
@@ -209,7 +209,7 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$datas = $app['twig']->render('prod/results/feeds.html.twig', [
|
||||
'feeds' => $feeds,
|
||||
'feed' => new Aggregate($app['EM'], $feeds),
|
||||
'feed' => new Aggregate($app['orm.em'], $feeds),
|
||||
'page' => $page
|
||||
]);
|
||||
|
||||
@@ -238,7 +238,7 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$feeds = $app['repo.feeds']->getAllForUser($app['acl']->get($app['authentication']->getUser()));
|
||||
|
||||
$link = $app['feed.aggregate-link-generator']->generate(new Aggregate($app['EM'], $feeds),
|
||||
$link = $app['feed.aggregate-link-generator']->generate(new Aggregate($app['orm.em'], $feeds),
|
||||
$app['authentication']->getUser(),
|
||||
AggregateLinkGenerator::FORMAT_RSS,
|
||||
null, $renew
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -242,8 +242,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
//Delete lazaret file
|
||||
$app['EM']->remove($lazaretFile);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($lazaretFile);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$ret['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -295,8 +295,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
$lazaretFileName = $app['tmp.lazaret.path'].'/'.$lazaretFile->getFilename();
|
||||
$lazaretThumbFileName = $app['tmp.lazaret.path'].'/'.$lazaretFile->getThumbFilename();
|
||||
|
||||
$app['EM']->remove($lazaretFile);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($lazaretFile);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
try {
|
||||
$app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]);
|
||||
@@ -317,22 +317,58 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function emptyLazaret(Application $app, Request $request)
|
||||
{
|
||||
$ret = ['success' => false, 'message' => '', 'result' => []];
|
||||
$ret = array(
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
'result' => array(
|
||||
'tobedone' => 0,
|
||||
'done' => 0,
|
||||
'todo' => 0,
|
||||
'max' => '',
|
||||
)
|
||||
);
|
||||
|
||||
$lazaretFiles = $app['repo.lazaret-files']->findAll();
|
||||
$maxTodo = -1; // all
|
||||
if($request->get('max') !== null) {
|
||||
$maxTodo = (int)($request->get('max'));
|
||||
$ret['result']['max'] = $maxTodo;
|
||||
if( $maxTodo <= 0) {
|
||||
$maxTodo = -1; // all
|
||||
}
|
||||
}
|
||||
$ret['result']['max'] = $maxTodo;
|
||||
|
||||
$app['EM']->beginTransaction();
|
||||
$repo = $app['repo.lazaret-files'];
|
||||
|
||||
$ret['result']['tobedone'] = $repo->createQueryBuilder('id')
|
||||
->select('COUNT(id)')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
|
||||
if($maxTodo == -1) {
|
||||
// all
|
||||
$lazaretFiles = $repo->findAll();
|
||||
}
|
||||
else {
|
||||
// limit maxTodo
|
||||
$lazaretFiles = $repo->findBy(array(), null, $maxTodo);
|
||||
}
|
||||
|
||||
|
||||
$app['orm.em']->beginTransaction();
|
||||
|
||||
try {
|
||||
foreach ($lazaretFiles as $lazaretFile) {
|
||||
$this->denyLazaretFile($app, $lazaretFile);
|
||||
$ret['result']['done']++;
|
||||
}
|
||||
$app['EM']->commit();
|
||||
$app['orm.em']->commit();
|
||||
$ret['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
$app['EM']->rollback();
|
||||
$app['orm.em']->rollback();
|
||||
$ret['message'] = $app->trans('An error occured');
|
||||
}
|
||||
$ret['result']['todo'] = $ret['result']['tobedone'] - $ret['result']['done'];
|
||||
|
||||
return $app->json($ret);
|
||||
}
|
||||
@@ -400,8 +436,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
//Delete lazaret file
|
||||
$app['EM']->remove($lazaretFile);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($lazaretFile);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$ret['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -437,6 +473,6 @@ class Lazaret implements ControllerProviderInterface
|
||||
|
||||
$lazaretThumbFileName = $app['tmp.lazaret.path'].'/'.$lazaretFile->getThumbFilename();
|
||||
|
||||
return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), DeliverDataInterface::DISPOSITION_INLINE, 'image/jpeg', 3600);
|
||||
return $app['phraseanet.file-serve']->deliverFile($lazaretThumbFileName, $lazaretFile->getOriginalName(), DeliverDataInterface::DISPOSITION_INLINE, 'image/jpeg');
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -124,7 +124,7 @@ class Order implements ControllerProviderInterface
|
||||
$orderElement->setOrder($order);
|
||||
$orderElement->setBaseId($record->get_base_id());
|
||||
$orderElement->setRecordId($record->get_record_id());
|
||||
$app['EM']->persist($orderElement);
|
||||
$app['orm.em']->persist($orderElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ class Order implements ControllerProviderInterface
|
||||
|
||||
try {
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::ORDER_CREATE, new OrderEvent($order));
|
||||
$app['EM']->persist($order);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($order);
|
||||
$app['orm.em']->flush();
|
||||
$msg = $app->trans('The records have been properly ordered');
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -242,8 +242,8 @@ class Order implements ControllerProviderInterface
|
||||
$basket->setUser($order->getUser());
|
||||
$basket->setPusher($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$n = 0;
|
||||
@@ -275,10 +275,10 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
$success = true;
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->persist($orderElement);
|
||||
$app['EM']->persist($order);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($basket);
|
||||
$app['orm.em']->persist($orderElement);
|
||||
$app['orm.em']->persist($order);
|
||||
$app['orm.em']->flush();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
@@ -320,7 +320,7 @@ class Order implements ControllerProviderInterface
|
||||
$orderElement->setOrderMaster($app['authentication']->getUser());
|
||||
$orderElement->setDeny(true);
|
||||
|
||||
$app['EM']->persist($orderElement);
|
||||
$app['orm.em']->persist($orderElement);
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
@@ -332,8 +332,8 @@ class Order implements ControllerProviderInterface
|
||||
}
|
||||
$success = true;
|
||||
|
||||
$app['EM']->persist($order);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($order);
|
||||
$app['orm.em']->flush();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -187,16 +187,23 @@ class Property implements ControllerProviderInterface
|
||||
{
|
||||
$typeLst = $request->request->get('types', []);
|
||||
$records = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']);
|
||||
$mimeLst = $request->request->get('mimes', []);
|
||||
$forceType = $request->request->get('force_types', '');
|
||||
$updated = [];
|
||||
|
||||
foreach ($records as $record) {
|
||||
try {
|
||||
$recordType = !empty($forceType) ? $forceType : (isset($typeLst[$record->get_serialize_key()]) ? $typeLst[$record->get_serialize_key()] : null);
|
||||
$mimeType = isset($mimeLst[$record->get_serialize_key()]) ? $mimeLst[$record->get_serialize_key()] : null;
|
||||
|
||||
if ($recordType) {
|
||||
$record->set_type($recordType);
|
||||
$updated[$record->get_serialize_key()] = $recordType;
|
||||
$updated[$record->get_serialize_key()]['record_type'] = $recordType;
|
||||
}
|
||||
|
||||
if ($mimeType) {
|
||||
$record->set_mime($mimeType);
|
||||
$updated[$record->get_serialize_key()]['mime_type'] = $mimeType;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -192,14 +192,14 @@ class Push implements ControllerProviderInterface
|
||||
$Basket->setPusher($app['authentication']->getUser());
|
||||
$Basket->setIsRead(false);
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
$app['orm.em']->persist($Basket);
|
||||
|
||||
foreach ($pusher->get_elements() as $element) {
|
||||
$BasketElement = new BasketElement();
|
||||
$BasketElement->setRecord($element);
|
||||
$BasketElement->setBasket($Basket);
|
||||
|
||||
$app['EM']->persist($BasketElement);
|
||||
$app['orm.em']->persist($BasketElement);
|
||||
|
||||
$Basket->addElement($BasketElement);
|
||||
|
||||
@@ -218,7 +218,7 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$arguments = [
|
||||
'basket' => $Basket->getId(),
|
||||
@@ -238,7 +238,7 @@ class Push implements ControllerProviderInterface
|
||||
$app['phraseanet.logger']($BasketElement->getRecord($app)->get_databox())
|
||||
->log($BasketElement->getRecord($app), \Session_Logger::EVENT_VALIDATE, $user_receiver->getId(), '');
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$message = $app->trans('%quantity_records% records have been sent to %quantity_users% users', [
|
||||
'%quantity_records%' => count($pusher->get_elements()),
|
||||
@@ -264,7 +264,7 @@ class Push implements ControllerProviderInterface
|
||||
'message' => $app->trans('Unable to send the documents')
|
||||
];
|
||||
|
||||
$app['EM']->beginTransaction();
|
||||
$app['orm.em']->beginTransaction();
|
||||
|
||||
try {
|
||||
$pusher = new RecordHelper\Push($app, $app['request']);
|
||||
@@ -291,21 +291,21 @@ class Push implements ControllerProviderInterface
|
||||
$Basket->setUser($app['authentication']->getUser());
|
||||
$Basket->setIsRead(false);
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
$app['orm.em']->persist($Basket);
|
||||
|
||||
foreach ($pusher->get_elements() as $element) {
|
||||
$BasketElement = new BasketElement();
|
||||
$BasketElement->setRecord($element);
|
||||
$BasketElement->setBasket($Basket);
|
||||
|
||||
$app['EM']->persist($BasketElement);
|
||||
$app['orm.em']->persist($BasketElement);
|
||||
|
||||
$Basket->addElement($BasketElement);
|
||||
}
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$app['EM']->refresh($Basket);
|
||||
$app['orm.em']->refresh($Basket);
|
||||
|
||||
if (!$Basket->getValidation()) {
|
||||
$Validation = new ValidationSession();
|
||||
@@ -320,7 +320,7 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$Basket->setValidation($Validation);
|
||||
$app['EM']->persist($Validation);
|
||||
$app['orm.em']->persist($Validation);
|
||||
} else {
|
||||
$Validation = $Basket->getValidation();
|
||||
}
|
||||
@@ -368,7 +368,7 @@ class Push implements ControllerProviderInterface
|
||||
$validationParticipant->setCanAgree($participant['agree']);
|
||||
$validationParticipant->setCanSeeOthers($participant['see_others']);
|
||||
|
||||
$app['EM']->persist($validationParticipant);
|
||||
$app['orm.em']->persist($validationParticipant);
|
||||
|
||||
foreach ($Basket->getElements() as $BasketElement) {
|
||||
$ValidationData = new ValidationData();
|
||||
@@ -390,8 +390,8 @@ class Push implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$app['EM']->merge($BasketElement);
|
||||
$app['EM']->persist($ValidationData);
|
||||
$app['orm.em']->merge($BasketElement);
|
||||
$app['orm.em']->persist($ValidationData);
|
||||
|
||||
$app['phraseanet.logger']($BasketElement->getRecord($app)->get_databox())
|
||||
->log($BasketElement->getRecord($app), \Session_Logger::EVENT_PUSH, $participantUser->getId(), '');
|
||||
@@ -399,9 +399,9 @@ class Push implements ControllerProviderInterface
|
||||
$validationParticipant->addData($ValidationData);
|
||||
}
|
||||
|
||||
$validationParticipant = $app['EM']->merge($validationParticipant);
|
||||
$validationParticipant = $app['orm.em']->merge($validationParticipant);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$arguments = [
|
||||
'basket' => $Basket->getId(),
|
||||
@@ -419,9 +419,9 @@ class Push implements ControllerProviderInterface
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::VALIDATION_CREATE, new ValidationEvent($validationParticipant, $Basket, $url, $request->request->get('message'), $receipt, (int) $request->request->get('duration')));
|
||||
}
|
||||
|
||||
$app['EM']->merge($Basket);
|
||||
$app['EM']->merge($Validation);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->merge($Basket);
|
||||
$app['orm.em']->merge($Validation);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$message = $app->trans('%quantity_records% records have been sent for validation to %quantity_users% users', [
|
||||
'%quantity_records%' => count($pusher->get_elements()),
|
||||
@@ -433,10 +433,10 @@ class Push implements ControllerProviderInterface
|
||||
'message' => $message
|
||||
];
|
||||
|
||||
$app['EM']->commit();
|
||||
$app['orm.em']->commit();
|
||||
} catch (ControllerException $e) {
|
||||
$ret['message'] = $e->getMessage();
|
||||
$app['EM']->rollback();
|
||||
$app['orm.em']->rollback();
|
||||
}
|
||||
|
||||
return $app->json($ret);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -152,7 +152,7 @@ class Query implements ControllerProviderInterface
|
||||
$explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes();
|
||||
$explain .= "</div>";
|
||||
|
||||
$infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '"', $explain) . '">' . $app->trans('reponses:: %total% reponses', ['%total%' => $result->getTotal()]) . '</a> | ' . $app->trans('reponses:: %number% documents selectionnes', ['%number%' => '<span id="nbrecsel"></span>']);
|
||||
$infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '"', $explain) . '">' .$app->trans('%total% reponses', ['%total%' => '<span>'.$result->getTotal().'</span>']) . '</a>';
|
||||
|
||||
$json['infos'] = $infoResult;
|
||||
$json['navigation'] = $string;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -122,7 +122,7 @@ class Records implements ControllerProviderInterface
|
||||
]),
|
||||
"others" => $app['twig']->render('prod/preview/appears_in.html.twig', [
|
||||
'parents' => $record->get_grouping_parents(),
|
||||
'baskets' => $record->get_container_baskets($app['EM'], $app['authentication']->getUser())
|
||||
'baskets' => $record->get_container_baskets($app['orm.em'], $app['authentication']->getUser())
|
||||
]),
|
||||
"current" => $train,
|
||||
"history" => $app['twig']->render('prod/preview/short_history.html.twig', [
|
||||
@@ -135,7 +135,9 @@ class Records implements ControllerProviderInterface
|
||||
'record' => $record
|
||||
]),
|
||||
"pos" => $record->get_number(),
|
||||
"title" => str_replace(['[[em]]', '[[/em]]'], ['<em>', '</em>'], $record->get_title($query, $searchEngine))
|
||||
"title" => str_replace(array('[[em]]', '[[/em]]'), array('<em>', '</em>'), $record->get_title($query, $searchEngine)),
|
||||
"collection_name" => $record->get_collection()->get_name(),
|
||||
"collection_logo" => $record->get_collection()->getLogo($record->get_base_id(), $app)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -162,14 +164,14 @@ class Records implements ControllerProviderInterface
|
||||
$basketElements = $basketElementsRepository->findElementsByRecord($record);
|
||||
|
||||
foreach ($basketElements as $element) {
|
||||
$app['EM']->remove($element);
|
||||
$app['orm.em']->remove($element);
|
||||
$deleted[] = $element->getRecord($app)->get_serialize_key();
|
||||
}
|
||||
|
||||
$attachedStories = $StoryWZRepository->findByRecord($app, $record);
|
||||
|
||||
foreach ($attachedStories as $attachedStory) {
|
||||
$app['EM']->remove($attachedStory);
|
||||
$app['orm.em']->remove($attachedStory);
|
||||
}
|
||||
|
||||
$deleted[] = $record->get_serialize_key();
|
||||
@@ -179,7 +181,7 @@ class Records implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $app->json($deleted);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -102,10 +102,13 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$helper = new Helper\Prod($app, $app['request']);
|
||||
|
||||
return $app['twig']->render('prod/index.html.twig', [
|
||||
'module_name' => 'Production',
|
||||
'WorkZone' => new Helper\WorkZone($app, $app['request']),
|
||||
'module_prod' => new Helper\Prod($app, $app['request']),
|
||||
'module_prod' => $helper,
|
||||
'search_datas' => $helper->get_search_datas(),
|
||||
'cssfile' => $cssfile,
|
||||
'module' => 'prod',
|
||||
'events' => $app['events-manager'],
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -14,6 +14,8 @@ namespace Alchemy\Phrasea\Controller\Prod;
|
||||
use Alchemy\Phrasea\Controller\Exception as ControllerException;
|
||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||
use Alchemy\Phrasea\Model\Entities\StoryWZ;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -78,9 +80,9 @@ class Story implements ControllerProviderInterface
|
||||
$StoryWZ->setUser($app['authentication']->getUser());
|
||||
$StoryWZ->setRecord($Story);
|
||||
|
||||
$app['EM']->persist($StoryWZ);
|
||||
$app['orm.em']->persist($StoryWZ);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$data = [
|
||||
@@ -132,6 +134,8 @@ class Story implements ControllerProviderInterface
|
||||
$n++;
|
||||
}
|
||||
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($Story));
|
||||
|
||||
$data = [
|
||||
'success' => true
|
||||
, 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n])
|
||||
@@ -159,6 +163,9 @@ class Story implements ControllerProviderInterface
|
||||
, 'message' => $app->trans('Record removed from story')
|
||||
];
|
||||
|
||||
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($Story));
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
return $app->json($data);
|
||||
} else {
|
||||
@@ -222,6 +229,8 @@ class Story implements ControllerProviderInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = ['success' => true, 'message' => $app->trans('Story updated')];
|
||||
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($story));
|
||||
} catch (ControllerException $e) {
|
||||
$ret = ['success' => false, 'message' => $e->getMessage()];
|
||||
} catch (\Exception $e) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -87,23 +87,30 @@ class Tools implements ControllerProviderInterface
|
||||
$controllers->post('/image/', function (Application $app, Request $request) {
|
||||
$return = ['success' => true];
|
||||
|
||||
$selection = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']);
|
||||
$force = $request->request->get('force_substitution') == '1';
|
||||
|
||||
$selection = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord'));
|
||||
|
||||
foreach ($selection as $record) {
|
||||
|
||||
$substituted = false;
|
||||
foreach ($record->get_subdefs() as $subdef) {
|
||||
if ($subdef->is_substituted()) {
|
||||
$substituted = true;
|
||||
|
||||
if ($force) {
|
||||
// unset flag
|
||||
$subdef->set_substituted(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$substituted || $request->request->get('ForceThumbSubstit') == '1') {
|
||||
if (!$substituted || $force) {
|
||||
$record->rebuild_subdefs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $app->json($return);
|
||||
})->bind('prod_tools_image');
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\Controller\Prod;
|
||||
use Alchemy\Phrasea\Border\File;
|
||||
use Alchemy\Phrasea\Border\Attribute\Status;
|
||||
use Alchemy\Phrasea\Core\Event\LazaretEvent;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use DataURI\Parser;
|
||||
use DataURI\Exception\Exception as DataUriException;
|
||||
use Alchemy\Phrasea\Model\Entities\LazaretSession;
|
||||
@@ -51,6 +51,8 @@ class Upload implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/flash-version/', 'controller.prod.upload:getFlashUploadForm')
|
||||
->bind('upload_flash_form');
|
||||
$controllers->get('/html5-version/', 'controller.prod.upload:getHtml5UploadForm')
|
||||
->bind('upload_html5_form');
|
||||
|
||||
$controllers->post('/', 'controller.prod.upload:upload')
|
||||
->bind('upload');
|
||||
@@ -71,12 +73,25 @@ class Upload implements ControllerProviderInterface
|
||||
$maxFileSize = $this->getUploadMaxFileSize();
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/upload/upload-flash.html.twig', [
|
||||
'sessionId' => session_id(),
|
||||
'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())),
|
||||
'maxFileSize' => $maxFileSize,
|
||||
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
|
||||
]);
|
||||
'prod/upload/upload-flash.html.twig', array(
|
||||
'sessionId' => session_id(),
|
||||
'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())),
|
||||
'maxFileSize' => $maxFileSize,
|
||||
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
|
||||
));
|
||||
}
|
||||
|
||||
public function getHtml5UploadForm(Application $app, Request $request)
|
||||
{
|
||||
$maxFileSize = $this->getUploadMaxFileSize();
|
||||
|
||||
return $app['twig']->render(
|
||||
'prod/upload/upload.html.twig', array(
|
||||
'sessionId' => session_id(),
|
||||
'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())),
|
||||
'maxFileSize' => $maxFileSize,
|
||||
'maxFileSizeReadable' => \p4string::format_octets($maxFileSize)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +177,7 @@ class Upload implements ControllerProviderInterface
|
||||
$lazaretSession = new LazaretSession();
|
||||
$lazaretSession->setUser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($lazaretSession);
|
||||
$app['orm.em']->persist($lazaretSession);
|
||||
|
||||
$packageFile = new File($app, $media, $collection, $file->getClientOriginalName());
|
||||
|
||||
@@ -208,6 +223,8 @@ class Upload implements ControllerProviderInterface
|
||||
$element = 'record';
|
||||
$message = $app->trans('The record was successfully created');
|
||||
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::RECORD_UPLOAD, new RecordEdit($elementCreated));
|
||||
|
||||
// try to create thumbnail from data URI
|
||||
if ('' !== $b64Image = $request->request->get('b64_image', '')) {
|
||||
try {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -170,9 +170,9 @@ class UsrLists implements ControllerProviderInterface
|
||||
$List->setName($list_name);
|
||||
$List->addOwner($Owner);
|
||||
|
||||
$app['EM']->persist($Owner);
|
||||
$app['EM']->persist($List);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($Owner);
|
||||
$app['orm.em']->persist($List);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
@@ -261,7 +261,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$list->setName($list_name);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
@@ -290,8 +290,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
$app['EM']->remove($list);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($list);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
@@ -329,8 +329,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$user_entry = $entry_repository->findEntryByListAndUsrId($list, $usr_id);
|
||||
|
||||
$app['EM']->remove($user_entry);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($user_entry);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
@@ -381,12 +381,12 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$list->addEntrie($entry);
|
||||
|
||||
$app['EM']->persist($entry);
|
||||
$app['orm.em']->persist($entry);
|
||||
|
||||
$inserted_usr_ids[] = $user_entry->getId();
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if (count($inserted_usr_ids) > 1) {
|
||||
$datas = [
|
||||
@@ -476,14 +476,14 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$list->addOwner($owner);
|
||||
|
||||
$app['EM']->persist($owner);
|
||||
$app['orm.em']->persist($owner);
|
||||
}
|
||||
|
||||
$role = $app['request']->request->get('role');
|
||||
|
||||
$owner->setRole($role);
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
@@ -521,8 +521,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$owner = $owners_repository->findByListAndUsrId($list, $usr_id);
|
||||
|
||||
$app['EM']->remove($owner);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($owner);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$datas = [
|
||||
'success' => true
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -150,11 +150,11 @@ class WorkZone implements ControllerProviderInterface
|
||||
$StoryWZ->setUser($app['authentication']->getUser());
|
||||
$StoryWZ->setRecord($Story);
|
||||
|
||||
$app['EM']->persist($StoryWZ);
|
||||
$app['orm.em']->persist($StoryWZ);
|
||||
$done++;
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($alreadyFixed === 0) {
|
||||
if ($done <= 1) {
|
||||
@@ -192,8 +192,8 @@ class WorkZone implements ControllerProviderInterface
|
||||
throw new NotFoundHttpException('Story not found');
|
||||
}
|
||||
|
||||
$app['EM']->remove($StoryWZ);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($StoryWZ);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
return $app->json([
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -133,9 +133,7 @@ class Activity implements ControllerProviderInterface
|
||||
$conf = [
|
||||
'user' => [$app->trans('report:: utilisateur'), 0, 1, 0, 0],
|
||||
'nbdoc' => [$app->trans('report:: nombre de documents'), 0, 0, 0, 0],
|
||||
'poiddoc' => [$app->trans('report:: poids des documents'), 0, 0, 0, 0],
|
||||
'nbprev' => [$app->trans('report:: nombre de preview'), 0, 0, 0, 0],
|
||||
'poidprev' => [$app->trans('report:: poids des previews'), 0, 0, 0, 0]
|
||||
];
|
||||
|
||||
$activity = new \module_report_activity(
|
||||
@@ -347,7 +345,7 @@ class Activity implements ControllerProviderInterface
|
||||
'ddate' => [$app->trans('report:: jour'), 0, 0, 0, 0],
|
||||
'total' => [$app->trans('report:: total des telechargements'), 0, 0, 0, 0],
|
||||
'preview' => [$app->trans('report:: preview'), 0, 0, 0, 0],
|
||||
'document' => [$app->trans('report:: document original'), 0, 0, 0, 0]
|
||||
'document' => [$app->trans('report:: document'), 0, 0, 0, 0]
|
||||
];
|
||||
|
||||
$activity = new \module_report_activity(
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -302,6 +302,10 @@ class Root implements ControllerProviderInterface
|
||||
*/
|
||||
public function doReportDownloads(Application $app, Request $request)
|
||||
{
|
||||
|
||||
// no_// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
|
||||
$download = new \module_report_download(
|
||||
$app,
|
||||
$request->request->get('dmin'),
|
||||
@@ -333,25 +337,36 @@ class Root implements ControllerProviderInterface
|
||||
$download->setHasLimit(false);
|
||||
$download->setPrettyString(false);
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
$this->doReport($app, $request, $download, $conf);
|
||||
|
||||
return $this->getCSVResponse($app, $download, 'download');
|
||||
$r = $this->getCSVResponse($app, $download, 'download');
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($r, true)), FILE_APPEND);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
$report = $this->doReport($app, $request, $download, $conf);
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
if ($report instanceof Response) {
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
return $report;
|
||||
}
|
||||
|
||||
return $app->json([
|
||||
'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [
|
||||
'result' => isset($report['report']) ? $report['report'] : $report,
|
||||
'is_infouser' => false,
|
||||
'is_nav' => false,
|
||||
'is_groupby' => false,
|
||||
'is_plot' => false,
|
||||
'is_doc' => false
|
||||
'result' => isset($report['report']) ? $report['report'] : $report,
|
||||
'is_infouser' => false,
|
||||
'is_nav' => false,
|
||||
'is_groupby' => false,
|
||||
'is_plot' => false,
|
||||
'is_doc' => false
|
||||
]),
|
||||
'display_nav' => $report['display_nav'], // do we display the prev and next button ?
|
||||
'next' => $report['next_page'], //Number of the next page
|
||||
@@ -383,7 +398,7 @@ class Root implements ControllerProviderInterface
|
||||
$conf_pref = [];
|
||||
|
||||
foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) {
|
||||
$conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0];
|
||||
$conf_pref[$field] = array($field, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
$conf = array_merge([
|
||||
@@ -401,7 +416,11 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
$this->doReport($app, $request, $document, $conf, 'record_id');
|
||||
|
||||
return $this->getCSVResponse($app, $document, 'documents');
|
||||
$r = $this->getCSVResponse($app, $document, 'documents');
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($r, true)), FILE_APPEND);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
$report = $this->doReport($app, $request, $document, $conf, 'record_id');
|
||||
@@ -509,6 +528,7 @@ class Root implements ControllerProviderInterface
|
||||
$response = new CSVFileResponse($filename, function () use ($app, $result) {
|
||||
$app['csv.exporter']->export('php://output', $result);
|
||||
});
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -548,6 +568,7 @@ class Root implements ControllerProviderInterface
|
||||
unset($conf['ip']);
|
||||
}
|
||||
}
|
||||
|
||||
//save initial conf
|
||||
$base_conf = $conf;
|
||||
//format conf according user preferences
|
||||
@@ -612,13 +633,20 @@ class Root implements ControllerProviderInterface
|
||||
$filter->addFilter('record_id', '=', $request->request->get('word', ''));
|
||||
}
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
//set filters to current report
|
||||
$report->setFilter($filter->getTabFilter());
|
||||
$report->setActiveColumn($filter->getActiveColumn());
|
||||
$report->setPostingFilter($filter->getPostingFilter());
|
||||
|
||||
// display a new arraywhere results are group
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
if ('' !== $groupby = $request->request->get('groupby', '')) {
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
$report->setConfig(false);
|
||||
$groupby = current(explode(' ', $groupby));
|
||||
|
||||
@@ -644,6 +672,8 @@ class Root implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
//set Limit
|
||||
if ($report->getEnableLimit()
|
||||
&& ('' !== $page = $request->request->get('page', ''))
|
||||
@@ -653,6 +683,8 @@ class Root implements ControllerProviderInterface
|
||||
$report->setLimit(false, false);
|
||||
}
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
//time to build our report
|
||||
if (false === $what) {
|
||||
$reportArray = $report->buildReport($conf);
|
||||
@@ -660,6 +692,8 @@ class Root implements ControllerProviderInterface
|
||||
$reportArray = $report->buildReport($conf, $what, $request->request->get('tbl', false));
|
||||
}
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
|
||||
return $reportArray;
|
||||
}
|
||||
|
||||
@@ -681,19 +715,33 @@ class Root implements ControllerProviderInterface
|
||||
foreach (array_keys($report->getDisplay()) as $k) {
|
||||
$headers[$k] = $k;
|
||||
}
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s \n\n", __FILE__, __LINE__, var_export($headers, true)), FILE_APPEND);
|
||||
|
||||
// set headers as first row
|
||||
$result = $report->getResult();
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s \n\n", __FILE__, __LINE__, var_export($result[0], true)), FILE_APPEND);
|
||||
|
||||
array_unshift($result, $headers);
|
||||
|
||||
$collection = new CallbackCollection($result, function ($row) use ($report) {
|
||||
$collection = new CallbackCollection($result, function ($row) use ($headers) {
|
||||
// restrict fields to the displayed ones
|
||||
return array_map('strip_tags', array_intersect_key($row, $report->getDisplay()));
|
||||
// return array_map("strip_tags", array_intersect_key($row, $report->getDisplay()));
|
||||
$ret = array();
|
||||
foreach($headers as $f) {
|
||||
$ret[$f] = array_key_exists($f, $row) ? strip_tags($row[$f]) : '';
|
||||
}
|
||||
return $ret;
|
||||
});
|
||||
|
||||
$filename = sprintf('report_export_%s_%s.csv', $type, date('Ymd'));
|
||||
$response = new CSVFileResponse($filename, function () use ($app, $collection) {
|
||||
|
||||
$cb = function () use ($app, $collection) {
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($collection, true)), FILE_APPEND);
|
||||
$app['csv.exporter']->export('php://output', $collection);
|
||||
});
|
||||
};
|
||||
|
||||
$response = new CSVFileResponse($filename, $cb);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -267,7 +267,7 @@ class Account implements ControllerProviderInterface
|
||||
WHERE s.user = :usr_id
|
||||
ORDER BY s.created DESC';
|
||||
|
||||
$query = $app['EM']->createQuery($dql);
|
||||
$query = $app['orm.em']->createQuery($dql);
|
||||
$query->setMaxResults(100);
|
||||
$query->setParameters(['usr_id' => $app['session']->get('usr_id')]);
|
||||
$sessions = $query->getResult();
|
||||
@@ -364,7 +364,7 @@ class Account implements ControllerProviderInterface
|
||||
|
||||
if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) {
|
||||
$app['authentication']->getUser()
|
||||
->setGender($request->request->get("form_gender"))
|
||||
->setGender((int) $request->request->get("form_gender"))
|
||||
->setFirstName($request->request->get("form_firstname"))
|
||||
->setLastName($request->request->get("form_lastname"))
|
||||
->setAddress($request->request->get("form_address"))
|
||||
@@ -393,10 +393,10 @@ class Account implements ControllerProviderInterface
|
||||
$ftpCredential->setReceptionFolder($request->request->get("form_destFTP"));
|
||||
$ftpCredential->setRepositoryPrefixName($request->request->get("form_prefixFTPfolder"));
|
||||
|
||||
$app['EM']->persist($ftpCredential);
|
||||
$app['EM']->persist($app['authentication']->getUser());
|
||||
$app['orm.em']->persist($ftpCredential);
|
||||
$app['orm.em']->persist($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
$app->addFlash('success', $app->trans('login::notification: Changements enregistres'));
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -367,12 +367,12 @@ class Login implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->persist($user);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($user);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if (null !== $provider) {
|
||||
$this->attachProviderToUser($app['EM'], $provider, $user);
|
||||
$app['EM']->flush();
|
||||
$this->attachProviderToUser($app['orm.em'], $provider, $user);
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$registrationsOK = [];
|
||||
@@ -620,9 +620,11 @@ class Login implements ControllerProviderInterface
|
||||
|
||||
$url = $app->url('login_renew_password', ['token' => $token->getValue()], true);
|
||||
|
||||
$expirationDate = new \DateTime('+1 day');
|
||||
$mail = MailRequestPasswordUpdate::create($app, $receiver);
|
||||
$mail->setLogin($user->getLogin());
|
||||
$mail->setButtonUrl($url);
|
||||
$mail->setExpiration($expirationDate);
|
||||
|
||||
$app['notification.deliverer']->deliver($mail);
|
||||
$app->addFlash('info', $app->trans('phraseanet:: Un email vient de vous etre envoye'));
|
||||
@@ -807,10 +809,10 @@ class Login implements ControllerProviderInterface
|
||||
$app['dispatcher']->dispatch(PhraseaEvents::VALIDATION_REMINDER, new ValidationEvent($participant, $basket, $url));
|
||||
|
||||
$participant->setReminded(new \DateTime('now'));
|
||||
$app['EM']->persist($participant);
|
||||
$app['orm.em']->persist($participant);
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$session = $app['authentication']->openAccount($user);
|
||||
|
||||
@@ -820,16 +822,18 @@ class Login implements ControllerProviderInterface
|
||||
|
||||
$width = $height = null;
|
||||
if ($app['request']->cookies->has('screen')) {
|
||||
$data = explode('x', $app['request']->cookies->get('screen'));
|
||||
$width = $data[0];
|
||||
$height = $data[1];
|
||||
$data = array_filter((explode('x', $app['request']->cookies->get('screen', ''))));
|
||||
if (count($data) === 2) {
|
||||
$width = $data[0];
|
||||
$height = $data[1];
|
||||
}
|
||||
}
|
||||
$session->setIpAddress($app['request']->getClientIp())
|
||||
->setScreenHeight($height)
|
||||
->setScreenWidth($width);
|
||||
|
||||
$app['EM']->persist($session);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($session);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
return $session;
|
||||
}
|
||||
@@ -879,8 +883,8 @@ class Login implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if (null !== $user) {
|
||||
$this->attachProviderToUser($app['EM'], $provider, $user);
|
||||
$app['EM']->flush();
|
||||
$this->attachProviderToUser($app['orm.em'], $provider, $user);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$this->postAuthProcess($app, $user);
|
||||
|
||||
@@ -896,8 +900,8 @@ class Login implements ControllerProviderInterface
|
||||
if ($app['authentication.providers.account-creator']->isEnabled()) {
|
||||
$user = $app['authentication.providers.account-creator']->create($app, $token->getId(), $token->getIdentity()->getEmail(), $token->getTemplates());
|
||||
|
||||
$this->attachProviderToUser($app['EM'], $provider, $user);
|
||||
$app['EM']->flush();
|
||||
$this->attachProviderToUser($app['orm.em'], $provider, $user);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$this->postAuthProcess($app, $user);
|
||||
|
||||
@@ -992,8 +996,8 @@ class Login implements ControllerProviderInterface
|
||||
|
||||
$response->headers->setCookie(new Cookie('persistent', $token, time() + $app['phraseanet.configuration']['session']['lifetime']));
|
||||
|
||||
$app['EM']->persist($session);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($session);
|
||||
$app['orm.em']->flush();
|
||||
}
|
||||
|
||||
$event = new PostAuthenticate($request, $response, $user, $context);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -68,7 +68,7 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
|
||||
$feeds = $app['repo.feeds']->getAllForUser($app['acl']->get($user));
|
||||
|
||||
$aggregate = new Aggregate($app['EM'], $feeds, $token);
|
||||
$aggregate = new Aggregate($app['orm.em'], $feeds, $token);
|
||||
|
||||
$request = $app['request'];
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -90,7 +90,7 @@ class Session implements ControllerProviderInterface
|
||||
'notifications' => $app['events-manager']->get_notifications()
|
||||
]);
|
||||
|
||||
$baskets = $app['EM']->getRepository('Phraseanet:Basket')->findUnreadActiveByUser($app['authentication']->getUser());
|
||||
$baskets = $app['orm.em']->getRepository('Phraseanet:Basket')->findUnreadActiveByUser($app['authentication']->getUser());
|
||||
|
||||
foreach ($baskets as $basket) {
|
||||
$ret['changed'][] = $basket->getId();
|
||||
@@ -161,13 +161,13 @@ class Session implements ControllerProviderInterface
|
||||
$module = new SessionModule();
|
||||
$module->setModuleId($moduleId);
|
||||
$module->setSession($session);
|
||||
$app['EM']->persist($module);
|
||||
$app['orm.em']->persist($module);
|
||||
} else {
|
||||
$app['EM']->persist($session->getModuleById($moduleId)->setUpdated(new \DateTime()));
|
||||
$app['orm.em']->persist($session->getModuleById($moduleId)->setUpdated(new \DateTime()));
|
||||
}
|
||||
|
||||
$app['EM']->persist($session);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->persist($session);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
$ret['status'] = 'ok';
|
||||
|
||||
@@ -219,8 +219,8 @@ class Session implements ControllerProviderInterface
|
||||
$app->abort(403, 'Unauthorized');
|
||||
}
|
||||
|
||||
$app['EM']->remove($session);
|
||||
$app['EM']->flush();
|
||||
$app['orm.em']->remove($session);
|
||||
$app['orm.em']->flush();
|
||||
|
||||
if ($app['request']->isXmlHttpRequest()) {
|
||||
return $app->json([
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -148,13 +148,15 @@ class Setup implements ControllerProviderInterface
|
||||
$databox_name = $request->request->get('db_name');
|
||||
|
||||
try {
|
||||
$abConn = $app['dbal.provider']->get([
|
||||
$abInfo = [
|
||||
'host' => $database_host,
|
||||
'port' => $database_port,
|
||||
'user' => $database_user,
|
||||
'password' => $database_password,
|
||||
'dbname' => $appbox_name,
|
||||
]);
|
||||
];
|
||||
|
||||
$abConn = $app['dbal.provider']($abInfo);
|
||||
$abConn->connect();
|
||||
} catch (\Exception $e) {
|
||||
return $app->redirectPath('install_step2', [
|
||||
@@ -164,13 +166,15 @@ class Setup implements ControllerProviderInterface
|
||||
|
||||
try {
|
||||
if ($databox_name) {
|
||||
$dbConn = $app['dbal.provider']->get([
|
||||
$dbInfo = [
|
||||
'host' => $database_host,
|
||||
'port' => $database_port,
|
||||
'user' => $database_user,
|
||||
'password' => $database_password,
|
||||
'dbname' => $databox_name,
|
||||
]);
|
||||
];
|
||||
|
||||
$dbConn = $app['dbal.provider']($dbInfo);
|
||||
$dbConn->connect();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -179,6 +183,17 @@ class Setup implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
$app['dbs.options'] = array_merge(
|
||||
$app['db.options.from_info']($dbInfo),
|
||||
$app['db.options.from_info']($abInfo),
|
||||
$app['dbs.options']
|
||||
);
|
||||
$app['orm.ems.options'] = array_merge(
|
||||
$app['orm.em.options.from_info']($dbInfo),
|
||||
$app['orm.em.options.from_info']($abInfo),
|
||||
$app['orm.ems.options']
|
||||
);
|
||||
|
||||
$email = $request->request->get('email');
|
||||
$password = $request->request->get('password');
|
||||
$template = $request->request->get('db_template');
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -43,10 +43,8 @@ class Thesaurus implements ControllerProviderInterface
|
||||
$controllers->match('linkfield2.php', 'controller.thesaurus:linkFieldStep2');
|
||||
$controllers->match('linkfield3.php', 'controller.thesaurus:linkFieldStep3');
|
||||
$controllers->match('loadth.php', 'controller.thesaurus:loadThesaurus')->bind('thesaurus_loadth');
|
||||
$controllers->match('newsy_dlg.php', 'controller.thesaurus:newSynonymDialog');
|
||||
$controllers->match('newterm.php', 'controller.thesaurus:newTerm');
|
||||
$controllers->match('properties.php', 'controller.thesaurus:properties');
|
||||
$controllers->match('search.php', 'controller.thesaurus:search');
|
||||
$controllers->match('thesaurus.php', 'controller.thesaurus:thesaurus')->bind('thesaurus_thesaurus');
|
||||
|
||||
$controllers->match('xmlhttp/accept.x.php', 'controller.thesaurus:acceptXml');
|
||||
@@ -1117,23 +1115,6 @@ class Thesaurus implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function newSynonymDialog(Application $app, Request $request)
|
||||
{
|
||||
$languages = [];
|
||||
|
||||
foreach ($app['locales.available'] as $lng_code => $lng) {
|
||||
$lng_code = explode('_', $lng_code);
|
||||
$languages[$lng_code[0]] = $lng;
|
||||
}
|
||||
|
||||
return $app['twig']->render('thesaurus/new-synonym-dialog.html.twig', [
|
||||
'piv' => $request->get('piv'),
|
||||
'typ' => $request->get('typ'),
|
||||
'languages' => $languages,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function newTerm(Application $app, Request $request)
|
||||
{
|
||||
list($term, $context) = $this->splitTermAndContext($request->get("t"));
|
||||
@@ -1216,11 +1197,6 @@ class Thesaurus implements ControllerProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function search(Application $app, Request $request)
|
||||
{
|
||||
return $app['twig']->render('thesaurus/search.html.twig');
|
||||
}
|
||||
|
||||
public function thesaurus(Application $app, Request $request)
|
||||
{
|
||||
$flags = $jsFlags = [];
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
* (c) 2005-2015 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
|
Reference in New Issue
Block a user