mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
fix some bugs
This commit is contained in:
@@ -4,7 +4,7 @@ rewrite ^/(download)/([a-zA-Z0-9]*)\/get$ /include/download_prepare.php?type
|
||||
rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/?$ /include/download_anonymous.php?type=$1&token=$2 last;
|
||||
rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?type=$1&token=$2&get=1 last;
|
||||
|
||||
rewrite ^/admin/$ /admin/router.php last;
|
||||
rewrite ^/admin/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/databox/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/sphinx/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/structure/.*$ /admin/router.php last;
|
||||
|
@@ -5,9 +5,9 @@ namespace Alchemy\Phrasea;
|
||||
use Alchemy\Phrasea\PhraseanetServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider;
|
||||
use Silex\Application as SilexApplication;
|
||||
use Silex\Provider\TwigServiceProvider;
|
||||
use Silex\Provider\UrlGeneratorServiceProvider;
|
||||
use Silex\Provider\ValidatorServiceProvider;
|
||||
use Silex\Provider\TwigServiceProvider;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
@@ -74,7 +74,6 @@ class Application extends SilexApplication
|
||||
}
|
||||
|
||||
$twig->addGlobal('session', $app['phraseanet.appbox']->get_session());
|
||||
$twig->addGlobal('appbox', $app['phraseanet.appbox']);
|
||||
$twig->addGlobal('version_number', $app['phraseanet.core']->getVersion()->getNumber());
|
||||
$twig->addGlobal('version_name', $app['phraseanet.core']->getVersion()->getName());
|
||||
$twig->addGlobal('core', $app['phraseanet.core']);
|
||||
@@ -138,6 +137,10 @@ class Application extends SilexApplication
|
||||
$app = $this;
|
||||
|
||||
$this->error(function($e) use ($app) {
|
||||
|
||||
var_dump($e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
||||
exit;
|
||||
|
||||
if ($app['debug']) {
|
||||
return new Response($e->getMessage(), 500);
|
||||
} else {
|
||||
|
@@ -12,19 +12,19 @@
|
||||
namespace Alchemy\Phrasea\Application;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Alchemy\Phrasea\Controller\Admin\Collection;
|
||||
use Alchemy\Phrasea\Controller\Admin\ConnectedUsers;
|
||||
use Alchemy\Phrasea\Controller\Admin\Dashboard;
|
||||
use Alchemy\Phrasea\Controller\Admin\Databox;
|
||||
use Alchemy\Phrasea\Controller\Admin\Databoxes;
|
||||
use Alchemy\Phrasea\Controller\Admin\Description;
|
||||
use Alchemy\Phrasea\Controller\Admin\Fields;
|
||||
use Alchemy\Phrasea\Controller\Admin\Publications;
|
||||
use Alchemy\Phrasea\Controller\Admin\Root;
|
||||
use Alchemy\Phrasea\Controller\Admin\Subdefs;
|
||||
use Alchemy\Phrasea\Controller\Admin\Users;
|
||||
use Alchemy\Phrasea\Controller\Admin\Dashboard;
|
||||
use Alchemy\Phrasea\Controller\Admin\Collection;
|
||||
use Alchemy\Phrasea\Controller\Admin\Databoxes;
|
||||
use Alchemy\Phrasea\Controller\Admin\Databox;
|
||||
use Alchemy\Phrasea\Controller\Admin\Setup;
|
||||
use Alchemy\Phrasea\Controller\Admin\Sphinx;
|
||||
use Alchemy\Phrasea\Controller\Admin\Subdefs;
|
||||
use Alchemy\Phrasea\Controller\Admin\Users;
|
||||
use Alchemy\Phrasea\Controller\Utils\ConnectionTest;
|
||||
use Alchemy\Phrasea\Controller\Utils\PathFileTest;
|
||||
|
||||
|
@@ -11,21 +11,18 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Collection implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
@@ -38,7 +35,7 @@ class Collection implements ControllerProviderInterface
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->attributes->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
@@ -399,6 +396,7 @@ class Collection implements ControllerProviderInterface
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
$admins = array();
|
||||
|
||||
if ($app['phraseanet.core']->getAuthenticatedUser()->ACL()->has_right_on_base($bas_id, 'manage')) {
|
||||
$query = new \User_Query($app['phraseanet.appbox']);
|
||||
$admins = $query->on_base_ids(array($bas_id))
|
||||
@@ -407,9 +405,26 @@ class Collection implements ControllerProviderInterface
|
||||
->get_results();
|
||||
}
|
||||
|
||||
switch ($errorMsg = $request->query->get('error')) {
|
||||
case 'file-error':
|
||||
$errorMsg = _('forms::erreur lors de l\'envoi du fichier');
|
||||
break;
|
||||
case 'file-invalid':
|
||||
$errorMsg = _('Invalid file format');
|
||||
break;
|
||||
case 'file-file-too-big':
|
||||
$errorMsg = _('The file is too big');
|
||||
break;
|
||||
case 'collection-not-empty':
|
||||
$errorMsg = _('admin::base:collection: vider la collection avant de la supprimer');
|
||||
break;
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('admin/collection/collection.html.twig', array(
|
||||
'collection' => $collection,
|
||||
'admins' => $admins,
|
||||
'errorMsg' => $errorMsg,
|
||||
'reloadTree' => $request->query->get('reload-tree') === '1'
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -423,7 +438,7 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function setOrderAdmins(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (count($admins = $request->get('admins', array())) > 0) {
|
||||
if (count($admins = $request->request->get('admins', array())) > 0) {
|
||||
$new_admins = array();
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
@@ -435,7 +450,7 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?operation=ok');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -448,23 +463,19 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function emptyCollection(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$message = _('An error occurred');
|
||||
$msg = _('An error occurred');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
$message = _('Collection empty successful');
|
||||
$msg = _('Collection empty successful');
|
||||
} else {
|
||||
$settings = '<?xml version="1.0" encoding="UTF-8"?><tasksettings><bas_id>' . $collection->get_base_id() . '</bas_id></tasksettings>';
|
||||
\task_abstract::create($app['phraseanet.appbox'], 'task_period_emptyColl', $settings);
|
||||
$message = _('A task has been creted, please run it to complete empty collection');
|
||||
$msg = _('A task has been creted, please run it to complete empty collection');
|
||||
}
|
||||
|
||||
$success = true;
|
||||
@@ -472,7 +483,16 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $message));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -485,12 +505,7 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteBanner(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
@@ -500,7 +515,16 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -513,12 +537,7 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteStamp(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
@@ -528,7 +547,16 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,12 +569,7 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteWatermark(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
@@ -556,7 +579,16 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,23 +601,27 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteLogo(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->update_logo(null);
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, null, \collection::PIC_WM);
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, null, \collection::PIC_LOGO);
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,12 +640,12 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=too-big');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-too-big');
|
||||
}
|
||||
|
||||
if ( ! $file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-invalid');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -620,10 +656,10 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.core']['file-system']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?operation=ok');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -642,12 +678,12 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=too-big');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-too-big');
|
||||
}
|
||||
|
||||
if ( ! $file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-invalid');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -658,10 +694,10 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.core']['file-system']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?operation=ok');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,12 +716,12 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
if ($file->getClientSize() > 65535) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=too-big');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-too-big');
|
||||
}
|
||||
|
||||
if ( ! $file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-invalid');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -696,10 +732,10 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.core']['file-system']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?operation=ok');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -718,12 +754,12 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
if ($file->getClientSize() > 65535) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=too-big');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-too-big');
|
||||
}
|
||||
|
||||
if ( ! $file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-invalid');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -734,10 +770,10 @@ class Collection implements ControllerProviderInterface
|
||||
$app['phraseanet.core']['file-system']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?upload-error=unknow-error');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=0&error=file-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?operation=ok');
|
||||
return $app->redirect('/admin/collection/' . $bas_id . '/?success=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -750,10 +786,6 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function delete(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
@@ -762,6 +794,7 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
if ($collection->get_record_amount() > 0) {
|
||||
$msg = _('admin::base:collection: vider la collection avant de la supprimer');
|
||||
|
||||
} else {
|
||||
$collection->unmount_collection($app['phraseanet.appbox']);
|
||||
$collection->delete();
|
||||
@@ -772,7 +805,25 @@ class Collection implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $msg
|
||||
));
|
||||
}
|
||||
|
||||
if($collection->get_record_amount() > 0) {
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=0&error=collection-not-empty');
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $collection->get_sbas_id() . '/?success=1&reload-tree=1');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=0');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -785,23 +836,25 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function unmount(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->unmount_collection($app['phraseanet.appbox']);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured')
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -814,27 +867,29 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function rename(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (null === $name = $request->get('name')) {
|
||||
$app->abort(400, _('Missing name format'));
|
||||
if (trim($name = $request->request->get('name')) === '') {
|
||||
$app->abort(400, _('Missing name parameter'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->set_name($name);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured')
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success . '&reload-tree=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -847,27 +902,29 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function setPublicationDisplay(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (null === $watermark = $request->get('pub_wm')) {
|
||||
if (null === $watermark = $request->request->get('pub_wm')) {
|
||||
$app->abort(400, _('Missing pub_wm format'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->set_public_presentation($watermark);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured')
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -880,23 +937,25 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function enable(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->enable($app['phraseanet.appbox']);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured')
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -909,23 +968,25 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function disabled(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
$collection->disable($app['phraseanet.appbox']);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured')
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -978,21 +1039,12 @@ class Collection implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($updateMsg = $request->get('update')) {
|
||||
switch ($updateMsg) {
|
||||
case 'ok';
|
||||
$updateMsg = _('forms::operation effectuee OK');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('admin/collection/suggested_value.html.twig', array(
|
||||
'collection' => $collection,
|
||||
'databox' => $databox,
|
||||
'suggestedValues' => $suggestedValues,
|
||||
'structFields' => $structFields,
|
||||
'basePrefs' => $basePrefs,
|
||||
'updateMsg' => $updateMsg,
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -1006,29 +1058,29 @@ class Collection implements ControllerProviderInterface
|
||||
*/
|
||||
public function submitSuggestedValues(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
if ($mdesc = \DOMDocument::loadXML($request->get('str'))) {
|
||||
if ($mdesc = \DOMDocument::loadXML($request->request->get('str'))) {
|
||||
$collection->set_prefs($mdesc);
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
$success = true;
|
||||
} else {
|
||||
$msg = _('Coult not load XML');
|
||||
$success = false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'bas_id' => $collection->get_base_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/suggested-values/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -11,15 +11,10 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -11,15 +11,10 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -129,11 +124,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
*/
|
||||
public function slash(Application $app, Request $request)
|
||||
{
|
||||
if ((false !== $cacheFlushed = $request->get('flush_cache', false)) && $cacheFlushed === 'ok') {
|
||||
$cacheFlushed = true;
|
||||
}
|
||||
|
||||
switch ($emailStatus = $request->get('email')) {
|
||||
switch ($emailStatus = $request->query->get('email')) {
|
||||
case 'sent';
|
||||
$emailStatus = _('Mail sent');
|
||||
break;
|
||||
@@ -150,7 +141,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'cache_flushed' => $cacheFlushed,
|
||||
'cache_flushed' => $request->query->get('flush_cache') === 'ok',
|
||||
'admins' => \User_Adapter::get_sys_admins(),
|
||||
'email_status' => $emailStatus,
|
||||
'search_engine_status' => $searchEngineStatus,
|
||||
@@ -193,7 +184,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
*/
|
||||
public function sendMail(Application $app, Request $request)
|
||||
{
|
||||
if (null === $mail = $request->get('email')) {
|
||||
if (null === $mail = $request->request->get('email')) {
|
||||
$app->abort(400, 'Bad request missing email parameter');
|
||||
};
|
||||
|
||||
@@ -230,7 +221,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
{
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
if (count($admins = $request->get('admins', array())) > 0) {
|
||||
if (count($admins = $request->request->get('admins', array())) > 0) {
|
||||
|
||||
if ( ! in_array($user->get_id(), $admins)) {
|
||||
$admins[] = $user->get_id();
|
||||
|
@@ -11,17 +11,12 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Core;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -409,25 +404,23 @@ class Databox implements ControllerProviderInterface
|
||||
{
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
switch ($uploadErrorLogoMsg = $request->get('upload-logo')) {
|
||||
case 'error':
|
||||
$uploadErrorLogoMsg = _('forms::erreur lors de l\'envoi du fichier');
|
||||
switch ($errorMsg = $request->query->get('error')) {
|
||||
case 'file-error':
|
||||
$errorMsg = _('forms::erreur lors de l\'envoi du fichier');
|
||||
break;
|
||||
case 'error-send':
|
||||
$uploadErrorLogoMsg = _('forms::erreur lors de l\'envoi du fichier');
|
||||
case 'file-invalid':
|
||||
$errorMsg = _('Invalid file format');
|
||||
break;
|
||||
case 'error-invalid':
|
||||
$uploadErrorLogoMsg = _('Invalid file format');
|
||||
break;
|
||||
case 'too-big':
|
||||
$uploadErrorLogoMsg = _('The file is too big');
|
||||
case 'file-too-big':
|
||||
$errorMsg = _('The file is too big');
|
||||
break;
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('admin/databox/databox.html.twig', array(
|
||||
'databox' => $databox,
|
||||
'showDetail' => (int) $request->get("sta") < 1,
|
||||
'uploadErrorLogoMsg' => $uploadErrorLogoMsg
|
||||
'showDetail' => (int) $request->query->get("sta") < 1,
|
||||
'errorMsg' => $errorMsg,
|
||||
'reloadTree' => $request->query->get('reload-tree') === '1'
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -463,29 +456,34 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteBase(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$ret = array('sbas_id' => null, 'success' => false, 'msg' => null);
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
if ($databox->get_record_amount() == 0) {
|
||||
|
||||
if ($databox->get_record_amount() > 0) {
|
||||
$msg = _('admin::base: vider la base avant de la supprimer');
|
||||
} else {
|
||||
$databox->unmount_databox($app['phraseanet.appbox']);
|
||||
$app['phraseanet.appbox']->write_databox_pic($databox, null, \databox::PIC_PDF);
|
||||
$databox->delete();
|
||||
$ret['sbas_id'] = $databox_id;
|
||||
$ret['success'] = true;
|
||||
$ret['msg'] = _('forms::operation effectuee OK');
|
||||
} else {
|
||||
$ret['msg'] = _('admin::base: vider la base avant de la supprimer');
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$ret['msg'] = _('An error occured');
|
||||
|
||||
}
|
||||
|
||||
return $app->json($ret);
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'sbas_id' => $databox->get_sbas_id()
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox->get_sbas_id() . '/?success=' . (int) $success . ($databox->get_record_amount() > 0 ? '&error=databox-not-empty' : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,13 +496,25 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function reindex(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->get_databox($databox_id)->reindex();
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$app['phraseanet.appbox']->get_databox($databox_id)->reindex();
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -517,13 +527,25 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function setIndexable(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->set_databox_indexable($app['phraseanet.appbox']->get_databox($databox_id), ! ! $request->request->get('indexable', false));
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$app['phraseanet.appbox']->set_databox_indexable($app['phraseanet.appbox']->get_databox($databox_id), ! ! $request->get('indexable', false));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,11 +564,16 @@ class Databox implements ControllerProviderInterface
|
||||
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
foreach ($request->get('TOU', array()) as $loc => $terms) {
|
||||
$databox->update_cgus($loc, $terms, ! ! $request->get('valid', false));
|
||||
try {
|
||||
foreach ($request->request->get('TOU', array()) as $loc => $terms) {
|
||||
$databox->update_cgus($loc, $terms, ! ! $request->request->get('valid', false));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/cgus/?success=0');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/cgus/');
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/cgus/?success=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,19 +586,19 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function createDatabase(Application $app, Request $request)
|
||||
{
|
||||
if ('' === $dbName = $request->get('new_dbname', '')) {
|
||||
if ('' === $dbName = $request->request->get('new_dbname', '')) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=no-empty');
|
||||
return $app->redirect('/admin/databoxes/?error=no-empty');
|
||||
}
|
||||
|
||||
if (\p4string::hasAccent($dbName)) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=special-chars');
|
||||
return $app->redirect('/admin/databoxes/?error=special-chars');
|
||||
}
|
||||
|
||||
$registry = $app['phraseanet.core']['Registry'];
|
||||
|
||||
if ((null === $request->get('new_settings')) && (null !== $dataTemplate = $request->get('new_data_template'))) {
|
||||
if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) {
|
||||
|
||||
$configuration = Configuration::build();
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
@@ -588,27 +615,28 @@ class Databox implements ControllerProviderInterface
|
||||
$connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, array(), $registry);
|
||||
} catch (\PDOException $e) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=database-failed');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=database-failed');
|
||||
}
|
||||
|
||||
try {
|
||||
$base = \databox::create($app['phraseanet.appbox'], $connbas, $dataTemplate, $registry);
|
||||
$base->registerAdmin($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$app['phraseanet.core']->getAuthenticatedUser()->ACL()->delete_data_from_cache();
|
||||
|
||||
return $app->redirect('/admin/databases/?success=base-ok&sbas-id=' . $base->get_sbas_id());
|
||||
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=base-failed');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=base-failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
null !== $request->get('new_settings')
|
||||
&& (null !== $hostname = $request->get('new_hostname'))
|
||||
&& (null !== $port = $request->get('new_port'))
|
||||
&& (null !== $userDb = $request->get('new_user'))
|
||||
&& (null !== $passwordDb = $request->get('new_password'))
|
||||
&& (null !== $dataTemplate = $request->get('new_data_template'))) {
|
||||
null !== $request->request->get('new_settings')
|
||||
&& (null !== $hostname = $request->request->get('new_hostname'))
|
||||
&& (null !== $port = $request->request->get('new_port'))
|
||||
&& (null !== $userDb = $request->request->get('new_user'))
|
||||
&& (null !== $passwordDb = $request->request->get('new_password'))
|
||||
&& (null !== $dataTemplate = $request->request->get('new_data_template'))) {
|
||||
|
||||
try {
|
||||
$data_template = new \SplFileInfo($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml');
|
||||
@@ -617,14 +645,14 @@ class Databox implements ControllerProviderInterface
|
||||
$base = \databox::create($app['phraseanet.appbox'], $connbas, $data_template, $registry);
|
||||
$base->registerAdmin($app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
return $app->redirect('/admin/databases/?success=base-ok&sbas-id=' . $base->get_sbas_id());
|
||||
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=base-failed');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=base-failed');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=database-failed');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=database-failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,20 +666,20 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function databaseMount(Application $app, Request $request)
|
||||
{
|
||||
if ('' === $dbName = trim($request->get('new_dbname', ''))) {
|
||||
if ('' === $dbName = trim($request->request->get('new_dbname', ''))) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=no-empty');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=no-empty');
|
||||
}
|
||||
|
||||
if (\p4string::hasAccent($dbName)) {
|
||||
|
||||
return $app->redirect('/admin/databases/?error=special-chars');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=special-chars');
|
||||
}
|
||||
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$registry = $app['phraseanet.core']['Registry'];
|
||||
|
||||
if ((null === $request->get('new_settings'))) {
|
||||
if ((null === $request->request->get('new_settings'))) {
|
||||
try {
|
||||
$configuration = Configuration::build();
|
||||
$connexion = $configuration->getConnexion();
|
||||
@@ -666,20 +694,21 @@ class Databox implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$appbox->get_connection()->commit();
|
||||
|
||||
return $app->redirect('/admin/databases/?success=mount-ok&sbas-id=' . $base->get_sbas_id());
|
||||
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
|
||||
} catch (\Exception $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
|
||||
return $app->redirect('/admin/databases/?error=mount-failed');
|
||||
var_dump($e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
|
||||
exit;
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=mount-failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
null !== $request->get('new_settings')
|
||||
&& (null !== $hostname = $request->get('new_hostname'))
|
||||
&& (null !== $port = $request->get('new_port'))
|
||||
&& (null !== $userDb = $request->get('new_user'))
|
||||
&& (null !== $passwordDb = $request->get('new_password'))) {
|
||||
null !== $request->request->get('new_settings')
|
||||
&& (null !== $hostname = $request->request->get('new_hostname'))
|
||||
&& (null !== $port = $request->request->get('new_port'))
|
||||
&& (null !== $userDb = $request->request->get('new_user'))
|
||||
&& (null !== $passwordDb = $request->request->get('new_password'))) {
|
||||
|
||||
try {
|
||||
$appbox->get_connection()->beginTransaction();
|
||||
@@ -687,11 +716,11 @@ class Databox implements ControllerProviderInterface
|
||||
$base->registerAdmin($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$appbox->get_connection()->commit();
|
||||
|
||||
return $app->redirect('/admin/databases/?success=mount-ok&sbas-id=' . $base->get_sbas_id());
|
||||
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
|
||||
} catch (\Exception $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
|
||||
return $app->redirect('/admin/databases/?error=mount-failed');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=mount-failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -717,7 +746,7 @@ class Databox implements ControllerProviderInterface
|
||||
try {
|
||||
$baseId = \collection::mount_collection($databox_id, $collection_id, $user);
|
||||
|
||||
if (null == $othCollSel = $request->get("othcollsel")) {
|
||||
if (null == $othCollSel = $request->request->get("othcollsel")) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
@@ -762,21 +791,18 @@ class Databox implements ControllerProviderInterface
|
||||
$app['phraseanet.appbox']->write_databox_pic($databox, $file, \databox::PIC_PDF);
|
||||
unlink($file->getPathname());
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/');
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=1');
|
||||
} else {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?upload-logo=too-big');
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=0&error=file-too-big');
|
||||
}
|
||||
} else {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?upload-logo=error-send');
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=0&error=file-invalid');
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?upload-logo=error-invalid');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?upload-logo=error');
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/??success=0&error=file-error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,22 +816,25 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function deleteLogoPdf(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = ('An error occured');
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->write_databox_pic($app['phraseanet.appbox']->get_databox($databox_id), null, \databox::PIC_PDF);
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg, 'sbas_id' => $databox_id));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -818,13 +847,25 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function clearLogs(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$app['phraseanet.appbox']->get_databox($databox_id)->clear_logs();
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$app['phraseanet.appbox']->get_databox($databox_id)->clear_logs();
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -837,17 +878,29 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function changeViewName(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (null === $viewName = $request->get('viewname')) {
|
||||
if (null === $viewName = $request->request->get('viewname')) {
|
||||
$app->abort(400, _('Missing view name parameter'));
|
||||
}
|
||||
|
||||
$app['phraseanet.appbox']->set_databox_viewname($app['phraseanet.appbox']->get_databox($databox_id), $viewName);
|
||||
$success = false;
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
try {
|
||||
$app['phraseanet.appbox']->set_databox_viewname($app['phraseanet.appbox']->get_databox($databox_id), $viewName);
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -860,24 +913,27 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function unmountDatabase(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$success = false;
|
||||
$msg = _('An error occured');
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
$databox->unmount_databox($app['phraseanet.appbox']);
|
||||
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg, 'sbas_id' => $databox_id));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success . '&reload-tree=1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -890,11 +946,7 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function emptyDatabase(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$message = _('An error occurred');
|
||||
$msg = _('An error occurred');
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
@@ -903,11 +955,11 @@ class Databox implements ControllerProviderInterface
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
$message = _('Base empty successful');
|
||||
$msg = _('Base empty successful');
|
||||
} else {
|
||||
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><tasksettings><base_id>" . $collection->get_base_id() . "</base_id></tasksettings>";
|
||||
\task_abstract::create($app['phraseanet.appbox'], 'task_period_emptyColl', $settings);
|
||||
$message = _('A task has been creted, please run it to complete empty collection');
|
||||
$msg = _('A task has been creted, please run it to complete empty collection');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -916,7 +968,16 @@ class Databox implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $message));
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $msg,
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -929,7 +990,7 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function progressBarInfos(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
if ( ! $app['request']->isXmlHttpRequest() || 'json' !== $app['request']->getRequestFormat()) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
@@ -959,7 +1020,7 @@ class Databox implements ControllerProviderInterface
|
||||
$ret['thesaurus_indexed'] = $datas['thesaurus_indexed'];
|
||||
|
||||
if ($app['phraseanet.core']['file-system']->exists($app['phraseanet.core']['Registry']->get('GV_RootPath') . 'config/minilogos/logopdf_' . $databox_id . '.jpg')) {
|
||||
$ret['printLogoURL'] = '/print/' . $databox_id;
|
||||
$ret['printLogoURL'] = '/custom/minilogos/logopdf_' . $databox_id . '.jpg';
|
||||
}
|
||||
|
||||
$ret['success'] = true;
|
||||
@@ -996,17 +1057,30 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function setReorder(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
$success = false;
|
||||
|
||||
foreach ($request->get('order', array()) as $order => $baseId) {
|
||||
try {
|
||||
foreach ($request->request->get('order', array()) as $order => $baseId) {
|
||||
$collection = \collection::get_from_base_id($baseId);
|
||||
$app['phraseanet.appbox']->set_collection_order($collection, $order);
|
||||
unset($collection);
|
||||
}
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
if ('json' === $app['request']->getRequestFormat()) {
|
||||
|
||||
return $app->json(array(
|
||||
'success' => $success,
|
||||
'msg' => $success ? _('forms::operation effectuee OK') : _('An error occured'),
|
||||
'sbas_id' => $databox_id
|
||||
));
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/collections/order?success=' . (int) $success);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1032,7 +1106,7 @@ class Databox implements ControllerProviderInterface
|
||||
*/
|
||||
public function createCollection(Application $app, Request $request, $databox_id)
|
||||
{
|
||||
if ($name = trim($request->request->get('cnm', '')) === '') {
|
||||
if (($name = trim($request->request->get('name', ''))) === '') {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/collection/error=name');
|
||||
}
|
||||
@@ -1055,7 +1129,7 @@ class Databox implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/');
|
||||
return $app->redirect('/admin/collection/' . $collection->get_base_id() . '/?success=1&reload-tree=1');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databox/' . $databox_id . '/collection/error=error');
|
||||
@@ -1076,7 +1150,7 @@ class Databox implements ControllerProviderInterface
|
||||
|
||||
$out = array('total' => array('totobj' => 0, 'totsiz' => 0, 'mega' => '0', 'giga' => '0'), 'result' => array());
|
||||
|
||||
foreach ($databox->get_record_details($request->get('sort')) as $vgrp) {
|
||||
foreach ($databox->get_record_details($request->query->get('sort')) as $vgrp) {
|
||||
|
||||
$last_k1 = $last_k2 = null;
|
||||
$outRow = array('midobj' => 0, 'midsiz' => 0);
|
||||
|
@@ -11,16 +11,11 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -122,7 +117,7 @@ class Databoxes implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
switch ($errorMsg = $request->get('error')) {
|
||||
switch ($errorMsg = $request->query->get('error')) {
|
||||
case 'scheduler-started' :
|
||||
$errorMsg = _('Veuillez arreter le planificateur avant la mise a jour');
|
||||
break;
|
||||
@@ -147,18 +142,8 @@ class Databoxes implements ControllerProviderInterface
|
||||
case 'no-empty' :
|
||||
$errorMsg = _('Database can not be empty');
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($msgSuccess = $request->get('success')) {
|
||||
case 'restart' :
|
||||
$msgSuccess = _('N\'oubliez pas de redemarrer le planificateur de taches');
|
||||
break;
|
||||
case 'mount-ok' :
|
||||
$mountBase = true;
|
||||
case 'database-ok' :
|
||||
$createBase = false === $mountBase ? : false;
|
||||
$msgSuccess = _('The operation completed successfully');
|
||||
$user->ACL()->delete_data_from_cache();
|
||||
case 'mount-failed' :
|
||||
$errorMsg = _('Database could not be mounted');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -169,11 +154,8 @@ class Databoxes implements ControllerProviderInterface
|
||||
'sbas' => $sbas,
|
||||
'upgrade_available' => $upgradeAvailable,
|
||||
'error_msg' => $errorMsg,
|
||||
'success_msg' => $msgSuccess,
|
||||
'recommendations' => $upgrader->getRecommendations(),
|
||||
'advices' => $request->get('advices', array()),
|
||||
'mountBase' => $mountBase,
|
||||
'createBase' => $createBase,
|
||||
'advices' => $request->query->get('advices', array()),
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -188,23 +170,23 @@ class Databoxes implements ControllerProviderInterface
|
||||
{
|
||||
if (\phrasea::is_scheduler_started()) {
|
||||
|
||||
return $app->redirect('/admin/databoxes/?error=scheduler-started');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=scheduler-started');
|
||||
}
|
||||
|
||||
try {
|
||||
$upgrader = new \Setup_Upgrade($app['phraseanet.appbox']);
|
||||
$advices = $app['phraseanet.appbox']->forceUpgrade($upgrader);
|
||||
|
||||
return $app->redirect('/admin/databoxes/?success=restart&' . http_build_query(array('advices' => $advices)));
|
||||
return $app->redirect('/admin/databoxes/?success=1¬ice=restart&' . http_build_query(array('advices' => $advices)));
|
||||
} catch (\Exception_Setup_UpgradeAlreadyStarted $e) {
|
||||
|
||||
return $app->redirect('/admin/databoxes/?error=already-started');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=already-started');
|
||||
} catch (\Exception_Setup_FixBadEmailAddresses $e) {
|
||||
|
||||
return $app->redirect('/admin/databoxes/?error=bad-email');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=bad-email');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/databoxes/?error=unknow');
|
||||
return $app->redirect('/admin/databoxes/?success=0&error=unknow');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,11 +13,11 @@ namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
|
||||
use PHPExiftool\Driver\TagProvider;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -12,9 +12,9 @@
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -12,9 +12,9 @@
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -11,15 +11,10 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -106,7 +101,7 @@ class Root implements ControllerProviderInterface
|
||||
})
|
||||
->bind('admin');
|
||||
|
||||
$controllers->get('/tree/', function() {
|
||||
$controllers->get('/tree/', function(Application $app, Request $request) {
|
||||
$Core = $app['phraseanet.core'];
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$user = $Core->getAuthenticatedUser();
|
||||
@@ -167,7 +162,7 @@ class Root implements ControllerProviderInterface
|
||||
})
|
||||
->bind('admin_display_tree');
|
||||
|
||||
$controllers->get('/test-paths/', function() {
|
||||
$controllers->get('/test-paths/', function(Application $app, Request $request) {
|
||||
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
@@ -220,6 +215,7 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render('admin/structure.html.twig', array(
|
||||
'databox' => $databox,
|
||||
'errors' => $errors,
|
||||
'structure' => $structure,
|
||||
'errorsStructure' => $errorsStructure,
|
||||
@@ -262,10 +258,8 @@ class Root implements ControllerProviderInterface
|
||||
$app->abort(403);
|
||||
}
|
||||
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
return new Response($app['twig']->render('admin/statusbit.html.twig', array(
|
||||
'status' => $databox->get_statusbits(),
|
||||
'databox'=> $app['phraseanet.appbox']->get_databox($databox_id),
|
||||
)));
|
||||
})
|
||||
->assert('databox_id', '\d+')
|
||||
@@ -370,9 +364,9 @@ class Root implements ControllerProviderInterface
|
||||
\databox_status::deleteIcon($databox_id, $bit, 'on');
|
||||
}
|
||||
|
||||
if (isset($_FILES['image_on']) && $_FILES['image_on']['name']) {
|
||||
if (null !== $file = $request->files->get('image_on')) {
|
||||
try {
|
||||
\databox_status::updateIcon($databox_id, $bit, 'on', $_FILES['image_on']);
|
||||
\databox_status::updateIcon($databox_id, $bit, 'on', $file);
|
||||
} catch (\Exception_Forbidden $e) {
|
||||
|
||||
return $app->redirect('/admin/statusbit/' . $databox_id . '/status/' . $bit . '/?error=rights');
|
||||
|
@@ -16,11 +16,11 @@ namespace Alchemy\Phrasea\Controller\Admin;
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -11,16 +11,11 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -105,11 +100,11 @@ class Sphinx implements ControllerProviderInterface
|
||||
public function submitConfiguration(Application $app, Request $request)
|
||||
{
|
||||
$app['phraseanet.core']['Registry']->set(
|
||||
'sphinx_charset_tables', $request->get('charset_tables', array()), \registry::TYPE_ARRAY
|
||||
'sphinx_charset_tables', $request->request->get('charset_tables', array()), \registry::TYPE_ARRAY
|
||||
);
|
||||
|
||||
$app['phraseanet.core']['Registry']->set(
|
||||
'sphinx_user_stemmer', $request->get('libstemmer', array()), \registry::TYPE_ARRAY
|
||||
'sphinx_user_stemmer', $request->request->get('libstemmer', array()), \registry::TYPE_ARRAY
|
||||
);
|
||||
|
||||
return $app->redirect('/admin/sphinx/configuration/?update=ok');
|
||||
|
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Alchemy\Phrasea\Helper\User as UserHelper;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Alchemy\Phrasea\Helper\User as UserHelper;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -415,7 +415,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$templates = $deny = $accept = $options = array();
|
||||
|
||||
foreach ($request->get('template', array()) as $tmp) {
|
||||
foreach ($request->request->get('template', array()) as $tmp) {
|
||||
if (trim($tmp) != '') {
|
||||
$tmp = explode('_', $tmp);
|
||||
|
||||
@@ -425,14 +425,14 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->get('deny', array()) as $den) {
|
||||
foreach ($request->request->get('deny', array()) as $den) {
|
||||
$den = explode('_', $den);
|
||||
if (count($den) == 2 && ! isset($templates[$den[0]])) {
|
||||
$deny[$den[0]][$den[1]] = $den[1];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->get('accept', array()) as $acc) {
|
||||
foreach ($request->request->get('accept', array()) as $acc) {
|
||||
$acc = explode('_', $acc);
|
||||
if (count($acc) == 2 && ! isset($templates[$acc[0]])) {
|
||||
$accept[$acc[0]][$acc[1]] = $acc[1];
|
||||
@@ -440,14 +440,14 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->get('accept_hd', array()) as $accHD) {
|
||||
foreach ($request->request->get('accept_hd', array()) as $accHD) {
|
||||
$accHD = explode('_', $accHD);
|
||||
if (count($accHD) == 2 && isset($accept[$accHD[0]]) && isset($options[$accHD[0]][$accHD[1]])) {
|
||||
$options[$accHD[0]][$accHD[1]]['HD'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($request->get('watermark', array()) as $wm) {
|
||||
foreach ($request->request->get('watermark', array()) as $wm) {
|
||||
$wm = explode('_', $wm);
|
||||
if (count($wm) == 2 && isset($accept[$wm[0]]) && isset($options[$wm[0]][$wm[1]])) {
|
||||
$options[$wm[0]][$wm[1]]['WM'] = true;
|
||||
@@ -574,7 +574,7 @@ class Users implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/users/demands/?demands=ok');
|
||||
return $app->redirect('/admin/users/demands/?success=1');
|
||||
})
|
||||
->bind('users_submit_demands');
|
||||
|
||||
@@ -587,14 +587,14 @@ class Users implements ControllerProviderInterface
|
||||
$controllers->post('/import/file/', function(Application $app, Request $request) {
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
if ((null === $file = $request->files->get('file')) || ! $file->isValid()) {
|
||||
if ((null === $file = $request->files->get('files')) || ! $file->isValid()) {
|
||||
|
||||
return $app->rediretc('/admin/import/file/?error=file');
|
||||
return $app->redirect('/admin/users/import/file/?error=file-invalid');
|
||||
}
|
||||
|
||||
$array = \format::csv_to_arr($file->getPathname());
|
||||
|
||||
$equivalenceToMysqlField = $this->getEquivalenceToMysqlField();
|
||||
$equivalenceToMysqlField = Users::getEquivalenceToMysqlField();
|
||||
$loginDefined = $pwdDefined = false;
|
||||
$loginNew = array();
|
||||
$out = array('ignored_row' => array(), 'errors' => array());
|
||||
@@ -724,11 +724,11 @@ class Users implements ControllerProviderInterface
|
||||
$nbCreation = 0;
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
if ((null === $serializedArray = $request->get('sr')) || ('' === $serializedArray)) {
|
||||
if ((null === $serializedArray = $request->request->get('sr')) || ('' === $serializedArray)) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
if (null === $model = $request->get("modelToAplly")) {
|
||||
if (null === $model = $request->request->get("modelToAplly")) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ class Users implements ControllerProviderInterface
|
||||
$nbLines = sizeof($array);
|
||||
$nbCols = sizeof($array[0]);
|
||||
|
||||
$equivalenceToMysqlField = $this->getEquivalenceToMysqlField();
|
||||
$equivalenceToMysqlField = Users::getEquivalenceToMysqlField();
|
||||
|
||||
for ($i = 1; $i < $nbLines; $i ++ ) {
|
||||
$curUser = null;
|
||||
@@ -843,7 +843,7 @@ class Users implements ControllerProviderInterface
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
private function getEquivalenceToMysqlField()
|
||||
public static function getEquivalenceToMysqlField()
|
||||
{
|
||||
$equivalenceToMysqlField = array();
|
||||
|
||||
|
@@ -220,7 +220,7 @@ class Installer implements ControllerProviderInterface
|
||||
$registry->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING);
|
||||
$registry->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING);
|
||||
|
||||
$user = \User_Adapter::create($appbox, $request->request->get('email'), $request->request->get('password'), $request->query->get('email'), true);
|
||||
$user = \User_Adapter::create($appbox, $request->request->get('email'), $request->request->get('password'), $request->request->get('email'), true);
|
||||
|
||||
\phrasea::start($app['phraseanet.core']);
|
||||
|
||||
@@ -229,7 +229,7 @@ class Installer implements ControllerProviderInterface
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
|
||||
if ($databox_name && ! \p4string::hasAccent($databox_name)) {
|
||||
$template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->query->get('db_template') . '.xml');
|
||||
$template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->request->get('db_template') . '.xml');
|
||||
$databox = \databox::create($appbox, $connbas, $template, $registry);
|
||||
$user->ACL()
|
||||
->give_access_to_sbas(array($databox->get_sbas_id()))
|
||||
|
@@ -103,8 +103,10 @@ class appbox extends base
|
||||
if ( ! in_array(mb_strtolower($pathfile->getMimeType()), array('image/gif', 'image/png', 'image/jpeg', 'image/jpg', 'image/pjpeg'))) {
|
||||
throw new \InvalidArgumentException('Invalid file format');
|
||||
}
|
||||
|
||||
$filename = $pathfile->getPathname();
|
||||
|
||||
if ($pic_type === collection::PIC_LOGO) {
|
||||
//resize collection logo
|
||||
$imageSpec = new ImageSpecification();
|
||||
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
||||
@@ -121,6 +123,24 @@ class appbox extends base
|
||||
} catch (\MediaAlchemyst\Exception $e) {
|
||||
|
||||
}
|
||||
} else if ($pic_type === collection::PIC_PRESENTATION) {
|
||||
//resize collection logo
|
||||
$imageSpec = new ImageSpecification();
|
||||
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
||||
$imageSpec->setDimensions(650, 200);
|
||||
|
||||
$tmp = tempnam(sys_get_temp_dir(), 'tmpdatabox') . '.jpg';
|
||||
|
||||
try {
|
||||
$core['media-alchemyst']
|
||||
->open($pathfile->getPathname())
|
||||
->turninto($tmp, $imageSpec)
|
||||
->close();
|
||||
$filename = $tmp;
|
||||
} catch (\MediaAlchemyst\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($pic_type) {
|
||||
@@ -148,7 +168,9 @@ class appbox extends base
|
||||
$custom_path = $registry->get('GV_RootPath') . 'www/custom/' . $pic_type . '/' . $collection->get_base_id();
|
||||
|
||||
foreach (array($file, $custom_path) as $target) {
|
||||
|
||||
if (is_file($target)) {
|
||||
|
||||
$core['file-system']->remove($target);
|
||||
}
|
||||
|
||||
|
@@ -435,7 +435,7 @@ class databox_status
|
||||
throw new Exception_Upload_FileTooBig();
|
||||
}
|
||||
|
||||
if ($file->isValid()) {
|
||||
if ( ! $file->isValid()) {
|
||||
throw new Exception_Upload_Error();
|
||||
}
|
||||
|
||||
@@ -444,11 +444,12 @@ class databox_status
|
||||
$name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif";
|
||||
|
||||
try {
|
||||
$file->move($path, $name);
|
||||
$file = $file->move($registry->get('GV_RootPath') . "config/status/", $path.$name);
|
||||
} catch (FileException $e) {
|
||||
throw new Exception_Upload_CannotWriteFile();
|
||||
}
|
||||
|
||||
|
||||
$custom_path = $registry->get('GV_RootPath') . 'www/custom/status/';
|
||||
|
||||
$core['file-system']->mkdir($custom_path, 0750);
|
||||
|
@@ -1,3 +1,10 @@
|
||||
{% if reloadTree %}
|
||||
<script type="text/javascript">
|
||||
parent.reloadTree('base:{{ collection.get_sbas_id() }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% set bas_id = collection.get_base_id() %}
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
@@ -5,11 +12,19 @@
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{% if app.request.get('operation') == 'ok' %}
|
||||
{% if app.request.query.get('success') == '1' %}
|
||||
<div class="alert alert-success">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'forms::operation effectuee OK' %}
|
||||
</div>
|
||||
{% elseif app.request.query.get('success') == '0' %}
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<strong>{% trans 'An error occured' %}</strong>
|
||||
{% if errorMsg is not none %}
|
||||
{{ errorMsg }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<ul>
|
||||
@@ -19,10 +34,10 @@
|
||||
<li>{{ collection.get_record_amount() }} records <a target='_self' href='/admin/collection/{{ collection.get_base_id() }}/informations/details/'>{% trans 'phraseanet:: details' %}</a></li>
|
||||
</ul>
|
||||
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
{% if user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<div class="well-small">
|
||||
<h5>{% trans 'admin::collection:: Gestionnaires des commandes' %}</h5>
|
||||
<form id="admin_adder" action="/admin/collection/{{ app.request.get('bas_id') }}/order/admins/" method="post">
|
||||
<form id="admin_adder" action="/admin/collection/{{ bas_id }}/order/admins/" method="post">
|
||||
{% if admins | length > 0 %}
|
||||
<ul>
|
||||
{% for user in admins %}
|
||||
@@ -48,7 +63,7 @@
|
||||
|
||||
<div class="well-small action-block">
|
||||
<h5>{% trans 'admin::collection:: presentation des elements lors de la diffusion aux utilisateurs externes (publications)' %}</h5>
|
||||
<form method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/publication/display/">
|
||||
<form method="post" action="/admin/collection/{{ bas_id }}/publication/display/">
|
||||
<label class="radio" for="pub_wm_none">
|
||||
<input id="pub_wm_none" type='radio' name='pub_wm' {{ collection.get_pub_wm() == 'none' ? 'checked' : ''}} value='none' />
|
||||
{% trans 'admin::colelction::presentation des elements : rien' %}
|
||||
@@ -65,122 +80,121 @@
|
||||
</div>
|
||||
|
||||
<div class="action-block well">
|
||||
<form class="form-inline" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/rename/">
|
||||
<form class="form-inline" method="post" action="/admin/collection/{{ bas_id }}/rename/">
|
||||
<div class="input-append">
|
||||
<input name="name" class="span2" type="text" size="16">
|
||||
<a class="btn submiter" >
|
||||
<button class="btn reload-tree" type="submit">
|
||||
<img src="/skins/icons/edit_0.gif" />
|
||||
{% trans 'admin::base:collection: renommer la collection' %}
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group well">
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/{{ collection.is_active() ? 'disabled' : 'enabled' }}/">
|
||||
<a class='btn confirm submiter' href='#' data-confirm-msg="{{ collection.is_active() ? 'admin::base:collection: etes vous sur darreter la publication de cette collection'|trans : 'admin::base:collection: etes vous sur de publier cette collection ?'|trans }}">
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ bas_id }}/{{ collection.is_active() ? 'disabled' : 'enable' }}/">
|
||||
<button class='btn confirm' data-confirm-msg="{{ collection.is_active() ? 'admin::base:collection: etes vous sur darreter la publication de cette collection'|trans : 'admin::base:collection: etes vous sur de publier cette collection ?'|trans }}">
|
||||
<img src='/skins/icons/db-remove.png'/>
|
||||
{{ collection.is_active() ? 'admin::base:collection: descativer la collection' | trans : 'admin::base:collection: activer la collection'| trans }}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/empty/">
|
||||
<a class='btn confirm submiter' href="#" data-confirm-msg="{% trans 'admin::base:collection: etes vous sur de vider la collection ?' %}">
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ bas_id }}/empty/">
|
||||
<button class='btn confirm' data-confirm-msg="{% trans 'admin::base:collection: etes vous sur de vider la collection ?' %}">
|
||||
<img src='/skins/icons/trash.png' />
|
||||
{% trans 'admin::base:collection: vider la collection' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/delete/">
|
||||
<a class='btn confirm submiter' href="#" data-confirm-msg="{% trans 'admin::collection: Confirmez vous la suppression de cette collection ?' %}">
|
||||
<form style="display:inline" method="post" action="/admin/collection/{{ bas_id }}/delete/">
|
||||
<button class='btn confirm' data-confirm-msg="{% trans 'admin::collection: Confirmez vous la suppression de cette collection ?' %}">
|
||||
<img src='/skins/icons/delete.gif' />
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# mini logo #}
|
||||
<div class="well-small action-block">
|
||||
<h5>{% trans 'admin::base:collection: minilogo actuel' %}</h5>
|
||||
{% if collection.getLogo(app.request.get('bas_id')) is not empty %}
|
||||
<div class="thumbnail" style="width:20px;height:20px;margin-top:5px;margin-bottom:5px">{{ collection.getLogo(app.request.get('bas_id')) | raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/mini-logo/delete/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
{% if collection.getLogo(bas_id) is not empty %}
|
||||
<div class="thumbnail" style="width:120px;height:24px;margin-top:5px;margin-bottom:5px">{{ collection.getLogo(bas_id) | raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ bas_id }}/picture/mini-logo/delete/">
|
||||
<button class="btn btn-danger btn-mini" >
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
{% elseif user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/mini-logo/">
|
||||
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="/admin/collection/{{ bas_id }}/picture/mini-logo/">
|
||||
<input name="newLogo" type="file" accept="image/*" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# watermark #}
|
||||
<div class="well-small action-block">
|
||||
<h5>Watermark</h5>
|
||||
{% if collection.getWatermark(app.request.get('bas_id')) is not empty %}
|
||||
<div class="thumbnail" style="width:20px;height:20px">{{ collection.getWatermark(app.request.get('bas_id'))| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/watermark/delete/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<h5>{% trans "Watermark" %}</h5>
|
||||
{% if collection.getWatermark(bas_id) is not empty %}
|
||||
<div class="thumbnail">{{ collection.getWatermark(bas_id)| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ bas_id }}/picture/watermark/delete/">
|
||||
<button class="btn btn-danger btn-mini">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
{% elseif user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/watermark/">
|
||||
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="/admin/collection/{{ bas_id }}/picture/watermark/">
|
||||
<input name="newWm" type="file" accept="image/*" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# stamp logo #}
|
||||
<div class="well-small action-block">
|
||||
<h5>StampLogo</h5>
|
||||
{% if collection.getStamp(app.request.get('bas_id')) is not empty %}
|
||||
<div class="thumbnail" style="width:20px;height:20px">{{ collection.getStamp(app.request.get('bas_id'))| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/stamp-logo/delete/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<h5>{% trans "Stamp logo" %}</h5>
|
||||
{% if collection.getStamp(bas_id) is not empty %}
|
||||
<div class="thumbnail" style="max-height:120px;max-width:260px">{{ collection.getStamp(bas_id)| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ bas_id }}/picture/stamp-logo/delete/">
|
||||
<button class="btn btn-danger btn-mini">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
{% elseif user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/stamp-logo/">
|
||||
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="/admin/collection/{{ bas_id }}/picture/stamp-logo/">
|
||||
<input name="newStamp" type="file" accept="image/*" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# Bandeau de présentation #}
|
||||
<div class="well-small action-block">
|
||||
<h5>{% trans 'admin::base:collection: image de presentation : ' %}</h5>
|
||||
{% if collection.getPresentation(app.request.get('bas_id')) is not empty %}
|
||||
<div class="thumbnail" style="width:20px;height:20px">{{ collection.getPresentation(app.request.get('bas_id'))| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/banner/delete/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
{% if collection.getPresentation(bas_id) is not empty %}
|
||||
<div class="thumbnail" style="width:650px;height:200px">{{ collection.getPresentation(bas_id)| raw }}</div>
|
||||
{% if user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<form method="post" action="/admin/collection/{{ bas_id }}/picture/banner/delete/">
|
||||
<button class="btn btn-danger btn-mini">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
{% elseif user.ACL.has_right_on_base(bas_id, 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/collection/{{ app.request.get('bas_id') }}/picture/banner/">
|
||||
<form class="fileupload no-ajax" enctype="multipart/form-data" method="post" action="/admin/collection/{{ bas_id }}/picture/banner/">
|
||||
<input name="newBanner" type="file" accept="image/*" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
<span>(max : 650x200)</span>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -189,7 +203,7 @@
|
||||
$(document).ready(function(){
|
||||
//add admins
|
||||
$( ".admin_adder" ).autocomplete({
|
||||
source: "/admin/users/typeahead/search/?have_not_right[]=order_master&on_base[]={{ app.request.get('bas_id') }}",
|
||||
source: "/admin/users/typeahead/search/?have_not_right[]=order_master&on_base[]={{ bas_id }}",
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
var form = $('#admin_adder');
|
||||
@@ -232,7 +246,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
$("div.right a.submiter").bind("click", function() {
|
||||
$("div.right .submiter").bind("click", function() {
|
||||
var $this = $(this);
|
||||
var form = $this.closest('form');
|
||||
|
||||
@@ -246,28 +260,60 @@
|
||||
});
|
||||
|
||||
function submitForm(submitLink, form) {
|
||||
|
||||
form.bind('submit', function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
type: form.attr('method'),
|
||||
url: form.attr('action'),
|
||||
data: form.serializeArray(),
|
||||
beforeSend : function() {
|
||||
submitLink.attr('disabled', true).addClass('disabled');
|
||||
},
|
||||
success: function(datas) {
|
||||
if(datas.success) {
|
||||
if(submitLink.hasClass('reload')) {
|
||||
parent.reloadTree('base:{{ app.request.get('bas_id') }}');
|
||||
parent.reloadTree('base:{{ collection.get_sbas_id() }}');
|
||||
}
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Success', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
alert(datas.msg);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
submitLink.attr('disabled', false).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Error', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
$('.fileupload').each(function () {
|
||||
$(this).fileupload({
|
||||
dataType: 'html',
|
||||
add: function(e, data) {
|
||||
if( ! /(\.|\/)(png|jpeg|jpg|pjpg|gif)$/i.test(data.files[0].type)) {
|
||||
{% set supported_file_types = ['jpg', 'jpeg', 'pjpg', 'gif', 'png']|join(' | ') %}
|
||||
alert("{% trans %} Invalid file type, only ({{ supported_file_types }}) file formats are supported {% endtrans %}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
data.submit();
|
||||
},
|
||||
submit: function(e, data) {
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
},
|
||||
done: function (e, data) {
|
||||
$('#right-ajax').removeClass('loading').html(data.result);
|
||||
enableForms($('#right-ajax form:not(.no-ajax)'));
|
||||
|
||||
$.each($('#right-ajax a'),function(i, el){
|
||||
enableLink($(el));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
@@ -62,7 +62,7 @@
|
||||
dataType:'json',
|
||||
type:'POST',
|
||||
data: {order: order},
|
||||
url: '{{ path('admin_database_submit_collections_order', {'databox_id': app.request.get('databox_id')}) }}',
|
||||
url: '{{ path('admin_database_submit_collections_order', {'databox_id': app.request.attributes.get('databox_id')}) }}',
|
||||
beforeSend : function() {
|
||||
$this.attr('disabled', true);
|
||||
},
|
||||
|
@@ -13,6 +13,19 @@
|
||||
<h1>{% trans 'Suggested values' %}</h1>
|
||||
</div>
|
||||
|
||||
|
||||
{% if app.request.query.get('success') == '1' %}
|
||||
<div class="alert alert-success">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'forms::operation effectuee OK' %}
|
||||
</div>
|
||||
{% elseif app.request.query.get('success') == '0' %}
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<strong>{% trans 'An error occured' %}</strong>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="iddivloading" style="background-image:url('./trans.gif');background-position: top bottom; background-repeat: repeat; border:#ff0000 3px solid;position:absolute; width:94%;height:80%; top:95px; left:10px;z-index:99;text-align:center">
|
||||
<table style='width:100%;height:100%; text-align:center;vertical-align: middle; color:#FF0000; font-size:16px'>
|
||||
<tr>
|
||||
@@ -39,7 +52,7 @@
|
||||
</td>
|
||||
|
||||
<td style="text-align:center;height:30px;font-size:12px; border:0px;background-position: 0px 0px;background-repeat: repeat-x" nowrap>
|
||||
{% trans 'admin::sugval: Valeurs suggerees/Preferences de la collection' %} {{ app.request.get('bas_id')|bas_names }}
|
||||
{% trans 'admin::sugval: Valeurs suggerees/Preferences de la collection' %} {{ app.request.attributes.get('bas_id')|bas_names }}
|
||||
</td>
|
||||
|
||||
<td style="height:30px;width:20px;font-size:12px;border:0px; text-align:right">
|
||||
@@ -86,8 +99,7 @@
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<span id="valsug">
|
||||
<select size="12" name=valsug2 id="valsug2" onFocus="activ4VS();" onClick="desactiver();activ4VS();" onChange="desactiv4VS();" style="width:100%;font-size:11px;height:380px;">
|
||||
</select>
|
||||
<select size="12" name=valsug2 id="valsug2" onFocus="activ4VS();" onClick="desactiver();activ4VS();" onChange="desactiv4VS();" style="width:100%;font-size:11px;height:380px;"></select>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@@ -123,7 +135,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form method="post" name="chgStructure" action="/admin/collection/{{ app.request.get('bas_id') }}/suggested-values/" onsubmit="return(false);" target="right" style="visibility:hidden;">
|
||||
<form method="post" name="chgStructure" action="/admin/collection/{{ app.request.attributes.get('bas_id') }}/suggested-values/" onsubmit="return(false);" target="right" style="visibility:hidden;">
|
||||
<textarea nowrap style="visibility:hidden;white-space:pre" name="str" id="idstr">{{ collection.get_prefs() }}</textarea>
|
||||
</form>
|
||||
|
||||
|
@@ -1,23 +1,22 @@
|
||||
<script type="text/javascript">
|
||||
{% if createBase or mountBase %}
|
||||
parent.reloadTree('bases:bases');
|
||||
{% if app.request.query.get('success') == '1' %}
|
||||
<div class="alert alert-success">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'forms::operation effectuee OK' %}
|
||||
</div>
|
||||
{% elseif app.request.query.get('success') == '0' %}
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<strong>{% trans 'An error occured' %}</strong>
|
||||
{% if error_msg is not none %}
|
||||
{{ error_msg }}
|
||||
{% endif %}
|
||||
|
||||
{% if createBase %}
|
||||
document.location.replace('{{ path('admin_database', {'databox_id': app.request.get('databox_id')}) }}');
|
||||
{% endif %}
|
||||
</script>
|
||||
|
||||
|
||||
{% if success_msg is not none %}
|
||||
<div class='alert'>
|
||||
{{ success_msg }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if error_msg is not none %}
|
||||
<div class='alert'>
|
||||
{{ error_msg }}
|
||||
{% if app.request.query.get('notice') == 'restart' %}
|
||||
<div class="alert">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'N\'oubliez pas de redemarrer le planificateur de taches' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<h1>{% trans'Terms Of Use' %}</h1>
|
||||
|
||||
<form target="_self" method="post" action="{{ path('admin_database_submit_cgus', {'databox_id': app.request.get('databox_id')}) }}">
|
||||
<form target="_self" method="post" action="{{ path('admin_database_submit_cgus', {'databox_id': app.request.attributes.get('databox_id')}) }}">
|
||||
<div class='well'>
|
||||
<input type="submit" value="{% trans'Mettre a jour' %}" id="valid"/>
|
||||
<input class='btn btn-primary' type="submit" value="{% trans'Mettre a jour' %}" id="valid"/>
|
||||
<label for="valid" class='checkbox'>
|
||||
{% trans'admin::CGU Les utilisateurs doivent imperativement revalider ces conditions' %}
|
||||
<input type="checkbox" value="1" name="valid"/>
|
||||
@@ -22,10 +22,7 @@
|
||||
{% if code in cgus| keys %}
|
||||
<div id="terms-{{ code }}">
|
||||
{% spaceless %}
|
||||
<textarea name="TOU[{{ code }}]" style="width:100%;height:600px;margin:0 auto;">
|
||||
{% set cgu = attribute(cgus, code) %}
|
||||
{{ cgu['value']|trim }}
|
||||
</textarea>
|
||||
<textarea name="TOU[{{ code }}]" style="width:100%;height:600px;margin:0 auto;">{% set cgu = attribute(cgus, code) %}{{ cgu['value']|trim }}</textarea>
|
||||
{% endspaceless %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -1,6 +1,28 @@
|
||||
{% if reloadTree %}
|
||||
<script type="text/javascript">
|
||||
parent.reloadTree('bases:bases');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<div class="header">
|
||||
<h1>{{ databox.get_serialized_server_info() }}</h1>
|
||||
</div>
|
||||
|
||||
{% if app.request.query.get('success') == '1' %}
|
||||
<div class="alert alert-success">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'forms::operation effectuee OK' %}
|
||||
</div>
|
||||
{% elseif app.request.query.get('success') == '0' %}
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<strong>{% trans 'An error occured' %}</strong>
|
||||
{% if errorMsg is not none %}
|
||||
{{ errorMsg }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
ID : {{ databox.get_sbas_id() }}
|
||||
@@ -14,7 +36,7 @@
|
||||
<form method='post' action='{{ path('admin_database_rename', {'databox_id': databox.get_sbas_id()}) }}'>
|
||||
<div class="input-append">
|
||||
<input id="db-view-name" name='viewname' class="span2" type="text" size="16">
|
||||
<a class="btn submiter" type="button">{% trans 'Rename' %}</a>
|
||||
<button class="btn" type="submit">{% trans 'Rename' %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -69,7 +91,7 @@
|
||||
<div class=" well-small">
|
||||
<form method="post" action="{{ path('admin_database_set_indexable', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<label class="checkbox" for="is_indexable">
|
||||
<input type="checkbox" id="is_indexable" name='indexable' {{ appbox.is_databox_indexable(databox) ? 'checked' : ''}} />
|
||||
<input type="checkbox" id="is_indexable" name='indexable' {{ app['phraseanet.appbox'].is_databox_indexable(databox) ? 'checked' : ''}} />
|
||||
{% trans "admin::base: Cette base est indexable" %}
|
||||
</label>
|
||||
</form>
|
||||
@@ -78,9 +100,9 @@
|
||||
<div class="btn-group well-small">
|
||||
|
||||
<form method="post" action="{{ path('admin_database_reindex', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<a class='btn submiter confirm' href='#' data-confirm-msg="{% trans 'Confirmez-vous la re-indexation de la base ?' %}">
|
||||
<button type='button' class='btn submiter confirm' data-confirm-msg="{% trans 'Confirmez-vous la re-indexation de la base ?' %}">
|
||||
{% trans "base:: re-indexer" %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<a style='display:inline-block' target="right" class="ajax btn" href="{{ path('admin_database_display_new_collection_form', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
@@ -89,31 +111,32 @@
|
||||
</a>
|
||||
|
||||
<form style='display:inline' method="post" action="{{ path('admin_database_clear_logs', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<a href="#" class='btn submiter confirm'data-confirm-msg="{% trans 'admin::base: Confirmer la suppression de tous les logs' %}">
|
||||
<button type="button" class='btn submiter confirm'
|
||||
data-confirm-msg="{% trans 'admin::base: Confirmer la suppression de tous les logs' %}">
|
||||
<img src="/skins/icons/clearLogs.png" />
|
||||
{% trans "admin::base: supprimer tous les logs" %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form style='display:inline' method="post" action="{{ path('admin_database_unmount', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<a href="#" class='btn submiter confirm' data-confirm-msg="{% trans 'admin::base: Confirmer vous l\'arret de la publication de la base' %}">
|
||||
<button class='btn confirm' data-confirm-msg="{% trans 'admin::base: Confirmer vous l\'arret de la publication de la base' %}">
|
||||
<img src="/skins/icons/db-remove.png" />
|
||||
{% trans "admin::base: arreter la publication de la base" %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form style='display:inline' method="post" action="{{ path('admin_database_empty', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<a href="#" class='btn submiter confirm' data-confirm-msg="{% trans 'admin::base: Confirmer le vidage complet de la base' %}">
|
||||
<button type='button' class='btn submiter confirm' data-confirm-msg="{% trans 'admin::base: Confirmer le vidage complet de la base' %}">
|
||||
<img src="/skins/icons/trash.png" />
|
||||
{% trans "admin::base: vider la base" %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form style='display:inline' method="post" action="{{ path('admin_database_delete', {'databox_id': databox.get_sbas_id()}) }}">
|
||||
<a href="#" class='btn submiter confirm' data-confirm-msg="{% trans 'admin::base: Confirmer la suppression de la base' %}">
|
||||
<button type='button' class='btn submiter confirm' data-confirm-msg="{% trans 'admin::base: Confirmer la suppression de la base' %}">
|
||||
<img src="/skins/icons/delete.gif" />
|
||||
{% trans "admin::base: supprimer la base" %}
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -176,31 +199,20 @@
|
||||
<div class="logo_box">
|
||||
<hr>
|
||||
<h4>{% trans "admin::base: logo impression PDF" %}</h4>
|
||||
{% if uploadErrorLogoMsg is not none %}
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{{ uploadErrorLogoMsg }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="printLogoDIV_OK">
|
||||
<img id="printLogo" src="/print/{{ databox.get_sbas_id() }} " />
|
||||
<img class='thumbnail' id="printLogo" src="/custom/minilogos/logopdf_{{ databox.get_sbas_id() }}.jpg" />
|
||||
{% if user.ACL().has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
|
||||
<form method="post" action="{{ path('admin_database_delete_logo', {'databox_id': databox.get_sbas_id()}) }}"/>
|
||||
<a href="#" class='btn submiter'>
|
||||
{% trans "admin::base:collection: supprimer le logo" %}
|
||||
</a>
|
||||
<form method="post" target="right" action="{{ path('admin_database_delete_logo', {'databox_id': databox.get_sbas_id()}) }}" >
|
||||
<button class="btn btn-mini btn-danger">{% trans "admin::base:collection: supprimer le logo" %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div id="printLogoDIV_NONE">
|
||||
{% trans "admin::base:collection: aucun fichier (minilogo, watermark ...)" %}
|
||||
<form method="post" name="flpdf" action="{{ path('admin_database_submit_logo', {'databox_id': databox.get_sbas_id()}) }}" target="right" enctype="multipart/form-data">
|
||||
{% if user.ACL().has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
|
||||
<input name="newLogoPdf" type="file" accept="image/jpeg" />
|
||||
<input class="btn submiter" value="{% trans "boutton::envoyer" %}" />
|
||||
<input id="fileupload" class="no-ajax" type="file" name="newLogoPdf" data-url="{{ path('admin_database_submit_logo', {'databox_id': databox.get_sbas_id()}) }}" accept="image/jpg, image/jpeg">
|
||||
<i>{% trans "admin::base: envoyer un logo (jpeg 35px de hauteur max)" %}</i>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -262,7 +274,13 @@
|
||||
url: form.attr('action'),
|
||||
data: form.serializeArray(),
|
||||
success: function(datas) {
|
||||
|
||||
if(datas.success) {
|
||||
if(submitLink.hasClass('reload')) {
|
||||
parent.reloadTree('base:{{ databox.get_sbas_id() }}');
|
||||
}
|
||||
} else {
|
||||
alert(datas.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -279,7 +297,9 @@
|
||||
$("#mount-coll").toggle();
|
||||
});
|
||||
|
||||
$("div.right a.submiter").bind("click", function() {
|
||||
console.log($("div.right .submiter"));
|
||||
|
||||
$("div.right .submiter").bind("click", function() {
|
||||
var $this = $(this);
|
||||
var form = $this.closest('form');
|
||||
|
||||
@@ -293,30 +313,62 @@
|
||||
});
|
||||
|
||||
function submitForm(submitLink, form) {
|
||||
|
||||
form.bind('submit', function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
type: form.attr('method'),
|
||||
url: form.attr('action'),
|
||||
data: form.serializeArray(),
|
||||
before : function() {
|
||||
submitLink.attr('disabled', true).addClass('disabled');
|
||||
},
|
||||
success: function(datas) {
|
||||
if(datas.success) {
|
||||
if(submitLink.hasClass('reload')) {
|
||||
parent.reloadTree('base:{{ app.request.get('bas_id') }}');
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Success', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
});
|
||||
parent.reloadTree('base:{{ databox.get_sbas_id() }}');
|
||||
}
|
||||
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Error', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
});
|
||||
alert(datas.msg);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
submitLink.attr('disabled', false).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout("refreshDatabaseInformations();", 6000);
|
||||
|
||||
|
||||
|
||||
$('#fileupload').fileupload({
|
||||
dataType: 'html',
|
||||
add: function(e, data) {
|
||||
if( ! /(\.|\/)(jpe?g)$/i.test(data.files[0].type)) {
|
||||
{% set supported_file_types = ['jpg']|join(' | ') %}
|
||||
alert("{% trans %} Invalid file type, only ({{ supported_file_types }}) file formats are supported {% endtrans %}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
data.submit();
|
||||
},
|
||||
submit: function(e, data) {
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
},
|
||||
done: function (e, data) {
|
||||
$('#right-ajax').removeClass('loading').html(data.result);
|
||||
enableForms($('#right-ajax form:not(.no-ajax)'));
|
||||
|
||||
$.each($('#right-ajax a'),function(i, el){
|
||||
enableLink($(el));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
@@ -6,14 +6,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='col'>
|
||||
{% if app.request.get('sort') == 'col' %}
|
||||
{% if app.request.query.get('sort') == 'col' %}
|
||||
<img src="/skins/icons/tsort_desc.gif">
|
||||
{% endif %}
|
||||
{% trans 'phraseanet:: collection' %}
|
||||
</th>
|
||||
|
||||
<th class="obj">
|
||||
{% if app.request.get('sort') == 'obj' %}
|
||||
{% if app.request.query.get('sort') == 'obj' %}
|
||||
<img src="/skins/icons/tsort_desc.gif">
|
||||
{% endif %}
|
||||
{% trans 'admin::base: objet' %}
|
||||
|
@@ -80,14 +80,6 @@
|
||||
})
|
||||
};
|
||||
|
||||
function activeTree(click)
|
||||
{
|
||||
$('#FNDR').treeview({
|
||||
collapsed: true,
|
||||
animated: "medium"
|
||||
});
|
||||
|
||||
|
||||
function enableForms(forms) {
|
||||
forms.bind('submit', function(){
|
||||
|
||||
@@ -142,6 +134,13 @@
|
||||
});
|
||||
}
|
||||
|
||||
function activeTree(click)
|
||||
{
|
||||
$('#FNDR').treeview({
|
||||
collapsed: true,
|
||||
animated: "medium"
|
||||
});
|
||||
|
||||
$.each($('#tree a[target=right]'),function(){
|
||||
var dest = $(this).attr('href');
|
||||
|
||||
@@ -181,6 +180,7 @@
|
||||
$('.zone_online_users').trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(
|
||||
function(){
|
||||
resize();
|
||||
@@ -189,10 +189,6 @@
|
||||
}
|
||||
);
|
||||
|
||||
function refreshBaskets()
|
||||
{
|
||||
return;
|
||||
}
|
||||
function resize()
|
||||
{
|
||||
$('#right').height($(this).height()-$('#mainMenu').height()-20);
|
||||
|
@@ -1,3 +1,6 @@
|
||||
{% set status = databox.get_statusbits() %}
|
||||
{% set databox_id = databox.get_sbas_id() %}
|
||||
|
||||
<h1>
|
||||
{% trans 'phraseanet::status bit' %}
|
||||
</h1>
|
||||
@@ -20,18 +23,18 @@
|
||||
</td>
|
||||
{% if attribute(status, bit) is defined %}
|
||||
<td>
|
||||
<a target="right" href="/admin/statusbit/{{ app.request.get('databox_id') }}/status/{{ bit }}/" class="ajax">
|
||||
<a target="right" href="/admin/statusbit/{{ databox_id }}/status/{{ bit }}/" class="ajax">
|
||||
<img class="editer" src="/skins/icons/edit_0.gif" />
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="/admin/statusbit/{{ app.request.get('databox_id') }}/status/{{ bit }}/delete/">
|
||||
<form method="post" action="/admin/statusbit/{{ databox_id }}/status/{{ bit }}/delete/">
|
||||
<img class="deleter submiter" src="/skins/icons/delete_0.gif" />
|
||||
</form>
|
||||
</td>
|
||||
{% else %}
|
||||
<td colspan="2">
|
||||
<a target="right" href="/admin/statusbit/{{ app.request.get('databox_id') }}/status/{{ bit }}/" class="ajax">
|
||||
<a target="right" href="/admin/statusbit/{{ databox_id }}/status/{{ bit }}/" class="ajax">
|
||||
<img class="adder" src="/skins/icons/light_new.gif" />
|
||||
</a>
|
||||
</td>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
<h1 style='padding-left:30px;'>{% trans 'status:: numero de bit' %} {{ app.request.get('bit') }}</h1>
|
||||
|
||||
<form class="form-horizontal" enctype="multipart/form-data" method="post" action="/admin/statusbit/{{ app.request.get('databox_id') }}/status/{{ app.request.get('bit') }}/">
|
||||
<form id="fileupload" class="form-horizontal" enctype="multipart/form-data" method="post" action="/admin/statusbit/{{ app.request.get('databox_id') }}/status/{{ app.request.get('bit') }}/">
|
||||
<fieldset>
|
||||
<div class="span5 well-small">
|
||||
<label for="name">
|
||||
@@ -28,14 +28,14 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="image_off">
|
||||
{% trans'admin::status: symboliser par'%}
|
||||
{% if status['img_off'] is defined and status['img_off'] %}
|
||||
<img src="{{ status['img_off'] }}" />
|
||||
{% else %}
|
||||
{% trans 'admin::status: aucun symlboler' %}
|
||||
{% endif %}
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input type="file" name="image_off" accept="image/*"/>
|
||||
<div class='thumbnail' style='height:20px;width:20px'>
|
||||
{% if status['img_off'] is defined and status['img_off'] %}
|
||||
<img src="{{ status['img_off'] }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
@@ -62,14 +62,14 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="image_on">
|
||||
{% trans'admin::status: symboliser par'%}
|
||||
{% if status['img_on'] is defined and status['img_on'] %}
|
||||
<img src="{{ status['img_on'] }}" />
|
||||
{% else %}
|
||||
{% trans 'admin::status: aucun symlboler' %}
|
||||
{% endif %}
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input type="file" name="image_on" accept="image/*"/>
|
||||
<div class='thumbnail' style='height:20px;width:20px'>
|
||||
{% if status['img_on'] is defined and status['img_on'] %}
|
||||
<img src="{{ status['img_on'] }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
<div class=" span10">
|
||||
<div class="form-actions">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<button id="form_submitter" class="btn btn-primary" type="button">
|
||||
{% trans 'boutton::valider' %}
|
||||
</button>
|
||||
<a style='text-decoration:none;' class="btn" href="/admin/statusbit/{{ app.request.get('databox_id') }}/">{% trans 'boutton::retour' %}
|
||||
@@ -105,3 +105,60 @@
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
var selected_files = [];
|
||||
|
||||
$("#fileupload").fileupload({
|
||||
singleFileUploads: false,
|
||||
limitMultiFileUploads: 2,
|
||||
dataType: 'html',
|
||||
add: function(e, data) {
|
||||
$.each(data.files, function(i, file) {
|
||||
{% set supported_file_types = ['png', 'jpg', 'gif']|join(' | ') %}
|
||||
if( ! /(\image|\/)(png|jpeg|jpg|pjpg|gif)$/i.test(file.type)) {
|
||||
alert("{% trans %} Invalid file type, only ({{ supported_file_types }}) file formats are supported {% endtrans %}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
loadImage(file,function(img){
|
||||
$('input[name='+data.paramName[0]+']').closest('.controls').find('.thumbnail').empty().append(img);
|
||||
}, {
|
||||
fileType: /^image\/(gif|jpeg|png|jpg)$/,
|
||||
maxSize : 5242880, // 5MB
|
||||
maxWidth: 16,
|
||||
maxHeight: 16,
|
||||
minWidth: 16,
|
||||
minHeight: 16,
|
||||
});
|
||||
});
|
||||
|
||||
selected_files.push(data);
|
||||
|
||||
return false;
|
||||
},
|
||||
submit: function(e, data) {
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
},
|
||||
done: function (e, data) {
|
||||
$('#right-ajax').removeClass('loading').html(data.result);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$("#form_submitter").bind('click', function(){
|
||||
|
||||
if( selected_files.length > 0 ) {
|
||||
$.each( selected_files, function(i, data) {
|
||||
data.submit();
|
||||
});
|
||||
} else {
|
||||
$("#fileupload").submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
@@ -27,7 +27,7 @@
|
||||
<h2>{% trans 'admin::base: structure' %}</h2>
|
||||
|
||||
|
||||
<form method="POST" action="/admin/structure/{{ app.request.get('databox_id') }}/">
|
||||
<form method="POST" action="/admin/structure/{{ databox.get_sbas_id() }}/">
|
||||
<TEXTAREA nowrap style="width:99%; height:450px; white-space:pre" name="structure">{{ structure }}</TEXTAREA>
|
||||
<div class="form-actions">
|
||||
<button class="btn btn-primary" type="submit">{% trans 'boutton::valider' %}</button>
|
||||
|
@@ -105,7 +105,7 @@
|
||||
<h1>{% trans 'admin:: demandes en cours' %}</h1>
|
||||
</div>
|
||||
|
||||
{% if app.request.get('demands') == 'ok' %}
|
||||
{% if app.request.query.get('success') == '1' %}
|
||||
<div class="alert alert-success">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
{% trans 'Requests for the application registrations were recorded successfully' %}
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<h1>{% trans 'Upload a "csv" file for users creation' %}</h1>
|
||||
</div>
|
||||
|
||||
{% if app.request.get('error') is not none %}
|
||||
{% set error = app.request.get('error') %}
|
||||
{% if app.request.query.get('error') is not none %}
|
||||
{% set error = app.request.query.get('error') %}
|
||||
<div class="alert alert-error">
|
||||
<button class="close" data-dismiss="alert" type="button">×</button>
|
||||
{% if error == 'file' %}
|
||||
{% if error == 'file-invalid' %}
|
||||
{% trans 'An error occured while upload the file. Please retry' %}
|
||||
{% elseif error == 'row-login' %}
|
||||
{% trans 'Row "login" is missing, script has stopped' %}
|
||||
@@ -37,11 +37,39 @@
|
||||
<a href="/admin/users/import/example/rtf/"> <i class="icon-share"></i> {% trans 'You can download the documentation here' %}</a>
|
||||
</div>
|
||||
|
||||
<form class ='well' method="post" target="_self" action="/admin/users/import/file/" ENCTYPE="multipart/form-data" >
|
||||
{% trans "User's file " %} : <input name="file" type="file" />
|
||||
<div class="form-actions">
|
||||
<button class='btn btn-primary'>{% trans 'Send this file' %}</button>
|
||||
<a href="" target='/admin/users/search/' class='btn'>{% trans 'boutton::retour' %}</a>
|
||||
</div>
|
||||
</form>
|
||||
<span class="label" style="display:inline-block" >
|
||||
<i class="icon-plus icon-white"></i>
|
||||
<span>{% trans 'Select a file' %}</span>
|
||||
<input id="fileupload" type="file" name="files" data-url="/admin/users/import/file/" accept="text/csv, text/rtf">
|
||||
</span>
|
||||
<a href="/admin/users/search/" class='btn ajax'>{% trans 'boutton::retour' %}</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#fileupload').fileupload({
|
||||
dataType: 'html',
|
||||
add: function(e, data) {
|
||||
if( ! /(\.|\/)(csv|rtf)$/i.test(data.files[0].type)) {
|
||||
{% set supported_file_types = ['csv', 'rtf']|join(' | ') %}
|
||||
alert("{% trans %} Invalid file type, only ({{ supported_file_types }}) file formats are supported {% endtrans %}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
data.submit();
|
||||
},
|
||||
submit: function(e, data) {
|
||||
$('#right-ajax').empty().addClass('loading');
|
||||
},
|
||||
done: function (e, data) {
|
||||
$('#right-ajax').removeClass('loading').html(data.result);
|
||||
enableForms($('#right-ajax form:not(.no-ajax)'));
|
||||
|
||||
$.each($('#right-ajax a'),function(i, el){
|
||||
enableLink($(el));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
@@ -3,7 +3,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if app.request.get('user-updated') is not none%}
|
||||
{% if app.request.query.get('user-updated') is not none%}
|
||||
<div class="alert alert-success">
|
||||
<button class="close" data-dismiss="alert" type="button">×</button>
|
||||
{% set user_count = app.request.get('user-updated') %}
|
||||
|
@@ -150,13 +150,14 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
/**
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::submitSuggestedValues
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
*/
|
||||
public function testPostSuggestedValuesBadRequest()
|
||||
public function testPostSuggestedValuesNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/suggested-values/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,13 +211,14 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
/**
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::enable
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
*/
|
||||
public function testPostEnableBadRequest()
|
||||
public function testPostEnableNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/enable/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,14 +250,15 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::disabled
|
||||
*/
|
||||
public function testPostDisabledBadRequest()
|
||||
public function testPostDisabledNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/disabled/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,20 +310,23 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'admins' => array(self::$user_alt1->get_id())
|
||||
));
|
||||
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?operation=ok');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/');
|
||||
|
||||
$this->assertTrue(self::$user_alt1->ACL()->has_right_on_base(self::$collection->get_base_id(), 'order_master'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::setPublicationDisplay
|
||||
*/
|
||||
public function testPostPublicationDisplayBadRequest()
|
||||
public function testPostPublicationDisplayNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/publication/display/');
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/publication/display/', array(
|
||||
'pub_wm' => 'wm',
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,14 +370,19 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::rename
|
||||
*/
|
||||
public function testPostNameBadRequest()
|
||||
public function testPostNameNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/rename/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/rename/', array(
|
||||
'name' => 'test_rename_coll'
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,14 +428,17 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::emptyCollection
|
||||
*/
|
||||
public function testPostEmptyCollectionBadRequestFormat()
|
||||
public function testPostEmptyCollectionNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/empty/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/empty/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,19 +595,22 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'newLogo' => new \Symfony\Component\HttpFoundation\File\UploadedFile($target, 'logo.jpg')
|
||||
);
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/mini-logo/', array(), $files);
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?operation=ok');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||
$this->assertEquals(1, count(\collection::getLogo(self::$collection->get_base_id())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::deleteLogo
|
||||
*/
|
||||
public function testDeleteMiniLogoBadRequestFormat()
|
||||
public function testDeleteMiniLogoNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/mini-logo/delete/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/picture/mini-logo/delete/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -627,19 +644,22 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'newWm' => new \Symfony\Component\HttpFoundation\File\UploadedFile($target, 'logo.jpg')
|
||||
);
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/watermark/', array(), $files);
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?operation=ok');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||
$this->assertEquals(1, count(\collection::getWatermark(self::$collection->get_base_id())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::deleteWatermark
|
||||
*/
|
||||
public function testDeleteWmBadRequestFormat()
|
||||
public function testDeleteWmBadNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/watermark/delete/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/picture/watermark/delete/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -673,19 +693,22 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'newStamp' => new \Symfony\Component\HttpFoundation\File\UploadedFile($target, 'logo.jpg')
|
||||
);
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/stamp-logo/', array(), $files);
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?operation=ok');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||
$this->assertEquals(1, count(\collection::getStamp(self::$collection->get_base_id())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::deleteStamp
|
||||
*/
|
||||
public function testDeleteStampBadRequestFormat()
|
||||
public function testDeleteStampBadNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/stamp-logo/delete/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' .$collection->get_base_id() . '/picture/stamp-logo/delete/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -720,19 +743,22 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'newBanner' => new \Symfony\Component\HttpFoundation\File\UploadedFile($target, 'logo.jpg')
|
||||
);
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/banner/', array(), $files);
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?operation=ok');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||
$this->assertEquals(1, count(\collection::getPresentation(self::$collection->get_base_id())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::deleteBanner
|
||||
*/
|
||||
public function testDeleteBannerBadRequestFormat()
|
||||
public function testDeleteBannerNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/picture/banner/delete/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/picture/banner/delete/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -788,14 +814,17 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::delete
|
||||
*/
|
||||
public function testDeleteCollectionBadRequestFormat()
|
||||
public function testDeleteCollectionNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/delete/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/delete/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -854,14 +883,17 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::unmount
|
||||
*/
|
||||
public function testPostUnmountCollectionBadRequestFormat()
|
||||
public function testPostUnmountCollectionNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/collection/' . self::$collection->get_base_id() . '/unmount/');
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/collection/' . $collection->get_base_id() . '/unmount/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -276,11 +276,18 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
/**
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::updateDatabaseCGU
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
*/
|
||||
public function testUpdateDatabaseCGUBadRequestFormat()
|
||||
public function testUpdateDatabaseCGNotJson()
|
||||
{
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/cgus/');
|
||||
$this->setAdmin(true);
|
||||
|
||||
$collection = $this->createOneCollection();
|
||||
|
||||
$this->client->request('POST', '/databox/' . $collection->get_sbas_id() . '/cgus/', array(
|
||||
'TOU' => array('fr_FR' => 'Test update CGUS')
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +308,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'TOU' => array('fr_FR' => $cgusUpdate)
|
||||
));
|
||||
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/databox/' . self::$collection->get_sbas_id() . '/cgus/');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/databox/' . self::$collection->get_sbas_id() . '/cgus/?success=1');
|
||||
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox(self::$collection->get_sbas_id());
|
||||
$cgus = $databox->get_cgus();
|
||||
@@ -318,7 +325,6 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('GET', '/databox/' . self::$collection->get_sbas_id() . '/informations/documents/');
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,14 +437,17 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::reindex
|
||||
*/
|
||||
public function testPostReindexBadRequestFormat()
|
||||
public function testPostReindexNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/reindex/');
|
||||
$collection = $this->createOnecollection();
|
||||
|
||||
$this->client->request('POST', '/databox/' . $collection->get_sbas_id() . '/reindex/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,14 +467,17 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::setIndexable
|
||||
*/
|
||||
public function testPostIndexableBadRequestFormat()
|
||||
public function testPostIndexableNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/reindex/');
|
||||
$collection = $this->createOnecollection();
|
||||
|
||||
$this->client->request('POST', '/databox/' . $collection->get_sbas_id() . '/indexable/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,14 +502,17 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::clearLogs
|
||||
*/
|
||||
public function testPostClearLogBadRequestFormat()
|
||||
public function testPostClearLogNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/clear-logs/');
|
||||
$collection = $this->createOnecollection();
|
||||
|
||||
$this->client->request('POST', '/databox/' . $collection->get_sbas_id() . '/clear-logs/');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,14 +533,19 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::changeViewName
|
||||
*/
|
||||
public function testChangeViewBadRequestFormat()
|
||||
public function testChangeViewNotJson()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/view-name/');
|
||||
$collection = $this->createOnecollection();
|
||||
|
||||
$this->client->request('POST', '/databox/' . $collection->get_sbas_id() . '/view-name/', array(
|
||||
'viewname' => 'hello'
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -574,7 +594,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('/admin/databases/?error=no-empty', $response->headers->get('location'));
|
||||
$this->assertEquals('/admin/databoxes/?error=no-empty', $response->headers->get('location'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -590,7 +610,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('/admin/databases/?error=special-chars', $response->headers->get('location'));
|
||||
$this->assertEquals('/admin/databoxes/?error=special-chars', $response->headers->get('location'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -622,8 +642,9 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$uriRedirect = $response->headers->get('location');
|
||||
$this->assertTrue( ! ! strrpos($uriRedirect, 'success=base-ok'));
|
||||
$databoxId = array_pop(explode('=', array_pop(explode('&', $uriRedirect))));
|
||||
$this->assertTrue( ! ! strrpos($uriRedirect, 'success=1'));
|
||||
$explode = explode('/', $uriRedirect);
|
||||
$databoxId = $explode[3];
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($databoxId);
|
||||
$databox->unmount_databox($this->app['phraseanet.appbox']);
|
||||
$databox->delete();
|
||||
@@ -673,8 +694,10 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$uriRedirect = $response->headers->get('location');
|
||||
|
||||
$this->assertTrue( ! ! strrpos($uriRedirect, 'success=mount-ok'));
|
||||
$databoxId = array_pop(explode('=', array_pop(explode('&', $uriRedirect))));
|
||||
|
||||
$this->assertTrue( ! ! strrpos($uriRedirect, 'success=1'));
|
||||
$explode = explode('/', $uriRedirect);
|
||||
$databoxId = $explode[3];
|
||||
|
||||
try {
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($databoxId);
|
||||
@@ -718,7 +741,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'newLogoPdf' => new \Symfony\Component\HttpFoundation\File\UploadedFile($target, 'logo.jpg')
|
||||
);
|
||||
$this->client->request('POST', '/databox/' . self::$collection->get_sbas_id() . '/logo/', array(), $files);
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/databox/' . self::$collection->get_sbas_id() . '/');
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/databox/' . self::$collection->get_sbas_id() . '/?success=1');
|
||||
$this->assertNotEmpty(\databox::getPrintLogo(self::$collection->get_sbas_id()));
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
RewriteRule ^(mail-export)/([a-zA-Z0-9]*)\/?$ /include/download_anonymous.php?type=$1&token=$2 [L]
|
||||
RewriteRule ^(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?type=$1&token=$2&get=1 [L]
|
||||
|
||||
RewriteRule ^admin/$ /admin/router.php [L]
|
||||
RewriteRule ^admin/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/databox/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/sphinx/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/structure/.*$ /admin/router.php [L]
|
||||
|
Reference in New Issue
Block a user