mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
add bas/collection controller
This commit is contained in:
@@ -6,6 +6,7 @@ rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?ty
|
||||
|
||||
rewrite ^/admin/$ /admin/router.php last;
|
||||
rewrite ^/admin/structure/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/bas/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/statusbit/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/dashboard/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/database/.*$ /admin/router.php last;
|
||||
|
@@ -20,6 +20,7 @@ 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\Bas;
|
||||
use Alchemy\Phrasea\Controller\Admin\Databases;
|
||||
use Alchemy\Phrasea\Controller\Admin\Database;
|
||||
use Alchemy\Phrasea\Controller\Admin\Setup;
|
||||
@@ -32,6 +33,7 @@ return call_user_func(
|
||||
|
||||
$app->mount('/', new Root());
|
||||
$app->mount('/dashboard', new Dashboard());
|
||||
$app->mount('/bas', new Bas());
|
||||
$app->mount('/database', new Database());
|
||||
$app->mount('/databases', new Databases());
|
||||
$app->mount('/setup', new Setup());
|
||||
|
895
lib/Alchemy/Phrasea/Controller/Admin/Bas.php
Normal file
895
lib/Alchemy/Phrasea/Controller/Admin/Bas.php
Normal file
@@ -0,0 +1,895 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Bas implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->before(function() use ($app) {
|
||||
if (null !== $response = $app['phraseanet.core']['Firewall']->requireAdmin($app)) {
|
||||
return $response;
|
||||
}
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_access_to_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Get a collection
|
||||
*
|
||||
* name : admin_database_collection
|
||||
*
|
||||
* description : Get collection
|
||||
*
|
||||
* method : GET
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->get('/{bas_id}/', $this->call('getCollection'))
|
||||
->assert('bas_id', '\d+')
|
||||
->bind('admin_database_collection');
|
||||
|
||||
/**
|
||||
* Delete collection
|
||||
*
|
||||
* name : admin_collection_delete
|
||||
*
|
||||
* description : Delete collection
|
||||
*
|
||||
* method : DELETE
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{bas_id}/', $this->call('delete'))->bind('admin_collection_delete')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Enable collection
|
||||
*
|
||||
* name : admin_collection_enable
|
||||
*
|
||||
* description : Enable collection
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/enable/', $this->call('enable'))->bind('admin_collection_enable')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Disabled collection
|
||||
*
|
||||
* name : admin_collection_disabled
|
||||
*
|
||||
* description : Disabled collection
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/disabled/', $this->call('disabled'))->bind('admin_collection_disabled')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set new order admin
|
||||
*
|
||||
* name : admin_collection_order_admins
|
||||
*
|
||||
* description : Set new order admin
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/order/admins/', $this->call('setOrderAdmins'))->bind('admin_collection_order_admins')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set publication watermark
|
||||
*
|
||||
* name : admin_collection_submit_publication
|
||||
*
|
||||
* description : Set publication watermark
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/publication/display/', $this->call('setPublicationDisplay'))->bind('admin_collection_submit_publication')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Rename a collection
|
||||
*
|
||||
* name : admin_collection_rename
|
||||
*
|
||||
* description : Rename a collection
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/rename/', $this->call('rename'))->bind('admin_collection_rename')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Rename a collection
|
||||
*
|
||||
* name : admin_collection_empty
|
||||
*
|
||||
* description : Rename a collection
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/empty/', $this->call('emptyCollection'))->bind('admin_collection_empty')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Unmount a collection
|
||||
*
|
||||
* name : admin_collection_unmount
|
||||
*
|
||||
* description : Unmount a collection
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/unmount/', $this->call('unmount'))->bind('admin_collection_unmount')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set a new logo
|
||||
*
|
||||
* name : admin_collection_submit_logo
|
||||
*
|
||||
* description : Set a new logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/picture/mini-logo/', $this->call('setLogo'))->bind('admin_collection_submit_logo')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a mini logo
|
||||
*
|
||||
* name : admin_collection_delete_logo
|
||||
*
|
||||
* description : Delete a mini logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{bas_id}/picture/mini-logo/', $this->call('deleteLogo'))->bind('admin_collection_delete_logo')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set a new logo
|
||||
*
|
||||
* name : admin_collection_submit_logo
|
||||
*
|
||||
* description : Set a new logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/picture/watermark/', $this->call('setWatermark'))->bind('admin_collection_submit_logo')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a mini logo
|
||||
*
|
||||
* name : admin_collection_delete_logo
|
||||
*
|
||||
* description : Delete a mini logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{bas_id}/picture/watermark/', $this->call('deleteWatermark'))->bind('admin_collection_delete_logo')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set a new stamp logo
|
||||
*
|
||||
* name :
|
||||
*
|
||||
* description : Set a new stamp
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/picture/stamp-logo/', $this->call('setStamp'))->bind('admin_collection_submit_stamp')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a stamp logo
|
||||
*
|
||||
* name : admin_collection_delete_stamp
|
||||
*
|
||||
* description : Delete a stamp
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{bas_id}/picture/stamp-logo/', $this->call('deleteStamp'))->bind('admin_collection_delete_stamp')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Set a new banner
|
||||
*
|
||||
* name : admin_collection_submit_banner
|
||||
*
|
||||
* description : Set a new logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->post('/{bas_id}/picture/banner/', $this->call('setBanner'))->bind('admin_collection_submit_banner')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a banner
|
||||
*
|
||||
* name : admin_collection_delete_banner
|
||||
*
|
||||
* description : Delete a mini logo
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{bas_id}/picture/banner/', $this->call('deleteBanner'))->bind('admin_collection_delete_banner')->before(function() use ($app) {
|
||||
if ( ! $app['phraseanet.core']->getAUthenticatedUser()->ACL()->has_right_on_base($app['request']->get('bas_id'), 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $databox_id
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function getCollection(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
$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))
|
||||
->who_have_right(array('order_master'))
|
||||
->execute()
|
||||
->get_results();
|
||||
}
|
||||
return new Response($app['twig']->render('admin/collection/collection.html.twig', array(
|
||||
'collection' => $collection,
|
||||
'admins' => $admins,
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function setOrderAdmins(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (count($admins = $request->get('admins', array())) > 0) {
|
||||
$new_admins = array();
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
$new_admins[] = $admin;
|
||||
}
|
||||
|
||||
if (count($new_admins) > 0) {
|
||||
\set_exportorder::set_order_admins(array_filter($admins), $bas_id);
|
||||
}
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/bas/'. $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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'));
|
||||
}
|
||||
|
||||
$message = _('Collection empty successful');
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
} else {
|
||||
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<bas_id>" . $collection->get_bas_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');
|
||||
}
|
||||
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
$message = _('An error occurred');
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'message' => $message));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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);
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, null, \collection::PIC_PRESENTATION);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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);
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, null, \collection::PIC_STAMP);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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);
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, null, \collection::PIC_WM);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function setBanner(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (null === $file = $request->files->get('newBanner')) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
/* @var $file \Symfony\Component\HttpFoundation\File\UploadedFile */
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=too-big');
|
||||
}
|
||||
|
||||
if ($file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, $file, \collection::PIC_PRESENTATION);
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function setStamp(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (null === $file = $request->files->get('newStamp')) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
/* @var $file \Symfony\Component\HttpFoundation\File\UploadedFile */
|
||||
if ($file->getClientSize() > 1024 * 1024) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=too-big');
|
||||
}
|
||||
|
||||
if ($file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, $file, \collection::PIC_STAMP);
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function setWatermark(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (null === $file = $request->files->get('newWm')) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
/* @var $file \Symfony\Component\HttpFoundation\File\UploadedFile */
|
||||
if ($file->getClientSize() > 65535) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=too-big');
|
||||
}
|
||||
|
||||
if ($file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, $file, \collection::PIC_WM);
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function setMiniLogo(Application $app, Request $request, $bas_id)
|
||||
{
|
||||
if (null === $file = $request->files->get('newLogo')) {
|
||||
$app->abort(400);
|
||||
}
|
||||
|
||||
/* @var $file \Symfony\Component\HttpFoundation\File\UploadedFile */
|
||||
if ($file->getClientSize() > 65535) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=too-big');
|
||||
}
|
||||
|
||||
if ($file->isValid()) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
$app['phraseanet.appbox']->write_collection_pic($collection, $file, \collection::PIC_LOGO);
|
||||
|
||||
$app['filesystem']->remove($file->getPathname());
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/?upload-error=unknow-error');
|
||||
}
|
||||
|
||||
return $app->redirect('/admin/bas/' . $bas_id . '/');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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');
|
||||
|
||||
try {
|
||||
$collection = \collection::get_from_base_id($bas_id);
|
||||
|
||||
if ($collection->get_record_amount() > 0) {
|
||||
$msg = _('admin::base:collection: vider la collection avant de la supprimer');
|
||||
} else {
|
||||
$collection->unmount_collection($appbox);
|
||||
$collection->delete();
|
||||
$success = true;
|
||||
$msg = _('forms::operation effectuee OK');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'msg' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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'));
|
||||
}
|
||||
|
||||
if (null === $name = $request->get('name')) {
|
||||
$app->abort(400, _('Missing name format'));
|
||||
}
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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'));
|
||||
}
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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 ( ! $app['phraseanet.core']->getAuthenticatedUser()->ACL()->has_right_on_base($bas_id, 'canadmin')) {
|
||||
$app->abort(403);
|
||||
}
|
||||
|
||||
if (null === $watermark = $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));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $application
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
public function enabled(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));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $application
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $bas_id
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix the method to call with the controller class name
|
||||
*
|
||||
* @param string $method The method to call
|
||||
* @return string
|
||||
*/
|
||||
private function call($method)
|
||||
{
|
||||
return sprintf('%s::%s', __CLASS__, $method);
|
||||
}
|
||||
}
|
@@ -53,7 +53,8 @@ class Database implements ControllerProviderInterface
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->get('/{databox_id}', $this->call('getDatabase'))->bind('admin_databases');
|
||||
$controllers->get('/{databox_id}', $this->call('getDatabase'))
|
||||
->bind('admin_databases');
|
||||
|
||||
/**
|
||||
* Delete a database
|
||||
@@ -68,7 +69,8 @@ class Database implements ControllerProviderInterface
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->delete('/{databox_id}', $this->call('deleteBase'))->bind('admin_delete_databases');
|
||||
$controllers->delete('/{databox_id}', $this->call('deleteBase'))
|
||||
->bind('admin_delete_databases');
|
||||
|
||||
/**
|
||||
* Reset cache
|
||||
@@ -83,7 +85,8 @@ class Database implements ControllerProviderInterface
|
||||
*
|
||||
* return : Redirect Response
|
||||
*/
|
||||
$controllers->post('/', $this->call('createDatabase'))->bind('admin_database_new');
|
||||
$controllers->post('/', $this->call('createDatabase'))
|
||||
->bind('admin_database_new');
|
||||
|
||||
/**
|
||||
* mount a database
|
||||
@@ -98,7 +101,42 @@ class Database implements ControllerProviderInterface
|
||||
*
|
||||
* return : Redirect Response
|
||||
*/
|
||||
$controllers->post('/mount/', $this->call('databaseMount'))->bind('admin_database_mount');
|
||||
$controllers->post('/mount/', $this->call('databaseMount'))
|
||||
->bind('admin_database_mount');
|
||||
|
||||
/**
|
||||
* Unmount a database
|
||||
*
|
||||
* name : admin_database_unmount
|
||||
*
|
||||
* description : unmount one database
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : Redirect Response
|
||||
*/
|
||||
$controllers->post('/{databox_id}/unmount/', $this->call('databaseUnmount'))
|
||||
->assert('databox_id', '\d+')
|
||||
->bind('admin_database_unmount');
|
||||
|
||||
/**
|
||||
* Empty a database
|
||||
*
|
||||
* name : admin_database_empty
|
||||
*
|
||||
* description : empty one database
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : Redirect Response
|
||||
*/
|
||||
$controllers->post('/{databox_id}/empty/', $this->call('emptyDatabase'))
|
||||
->assert('databox_id', '\d+')
|
||||
->bind('admin_database_empty');
|
||||
|
||||
/**
|
||||
* Get database CGU
|
||||
@@ -134,6 +172,23 @@ class Database implements ControllerProviderInterface
|
||||
->assert('databox_id', '\d+')
|
||||
->bind('admin_update_database_cgu');
|
||||
|
||||
/**
|
||||
* Update document information
|
||||
*
|
||||
* name : admin_document_information
|
||||
*
|
||||
* description : Update document information
|
||||
*
|
||||
* method : GET
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : HTML Response
|
||||
*/
|
||||
$controllers->get('/{databox_id}/documents/informations/', $this->call('progressBarInfos'))
|
||||
->assert('databox_id', '\d+')
|
||||
->bind('admin_document_information');
|
||||
|
||||
/**
|
||||
* Mount collection on collection
|
||||
*
|
||||
@@ -369,7 +424,7 @@ class Database implements ControllerProviderInterface
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$app['phraseanet.appbox']->set_databox_indexable($app['phraseanet.appbox']->get_databox($databox_id), ! ! $request->get('INDEXABLE', false));
|
||||
$app['phraseanet.appbox']->set_databox_indexable($app['phraseanet.appbox']->get_databox($databox_id), ! ! $request->get('INDEXABLE', false));
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
}
|
||||
@@ -663,7 +718,7 @@ class Database implements ControllerProviderInterface
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if(null === $viewName = $request->get('viewname')){
|
||||
if (null === $viewName = $request->get('viewname')) {
|
||||
$app->abort(400, _('Missing view name parameter'));
|
||||
}
|
||||
|
||||
@@ -672,6 +727,137 @@ class Database implements ControllerProviderInterface
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param type $databox_id
|
||||
*/
|
||||
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'));
|
||||
}
|
||||
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
$databox->unmount_databox($app['phraseanet.appbox']);
|
||||
|
||||
return $app->json(array('sbas_id' => $databox_id));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param type $databox_id
|
||||
*/
|
||||
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 = _('Base empty successful');
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
} 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');
|
||||
}
|
||||
}
|
||||
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
$message = _('An error occurred');
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'message' => $message));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param integer $databox_id
|
||||
* @param integer $collection_id
|
||||
*/
|
||||
public function emptyCollection(Application $app, Request $request, $databox_id, $collection_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 = _('Collection empty successful');
|
||||
$success = false;
|
||||
|
||||
try {
|
||||
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||
$collection = \collection::get_from_coll_id($databox, $collection_id);
|
||||
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
} else {
|
||||
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<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');
|
||||
}
|
||||
|
||||
$success = true;
|
||||
} catch (\Exception $e) {
|
||||
$message = _('An error occurred');
|
||||
}
|
||||
|
||||
return $app->json(array('success' => $success, 'message' => $message));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Silex\Application $app
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param type $databox_id
|
||||
*/
|
||||
public function progressBarInfos(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'));
|
||||
}
|
||||
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$ret = array(
|
||||
'sbas_id' => null,
|
||||
'indexable' => false,
|
||||
'records' => 0,
|
||||
'xml_indexed' => 0,
|
||||
'thesaurus_indexed' => 0,
|
||||
'viewname' => null,
|
||||
'printLogoURL' => NULL
|
||||
);
|
||||
|
||||
$databox = $appbox->get_databox($databox_id);
|
||||
$datas = $databox->get_indexed_record_amount();
|
||||
|
||||
$ret['indexable'] = $appbox->is_databox_indexable($databox);
|
||||
$ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname());
|
||||
$ret['records'] = $databox->get_record_amount();
|
||||
$ret['sbas_id'] = $databox_id;
|
||||
$ret['xml_indexed'] = $datas['xml_indexed'];
|
||||
$ret['thesaurus_indexed'] = $datas['thesaurus_indexed'];
|
||||
|
||||
if ($app['filesystem']->exists($app['Registry']->get('GV_RootPath') . 'config/minilogos/logopdf_' . $databox_id . '.jpg')) {
|
||||
$ret['printLogoURL'] = '/print/' . $databox_id;
|
||||
}
|
||||
|
||||
return $app->json($ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix the method to call with the controller class name
|
||||
*
|
||||
|
@@ -97,6 +97,49 @@ class Root implements ControllerProviderInterface
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->get('/tree/', function() {
|
||||
if (null === $position = $request->get('position')) {
|
||||
$app->abort(400, _('Missing position parameter'));
|
||||
}
|
||||
|
||||
return new Response($app['twig']->render(\module_admin::getTree($position)));
|
||||
});
|
||||
|
||||
$controllers->get('/test-paths/', function() {
|
||||
|
||||
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
if (0 !== count($tests = $request->get('tests', array()))) {
|
||||
|
||||
$app->abort(400, _('Missing tests parameter'));
|
||||
}
|
||||
|
||||
if (null !== $path = $request->get('path')) {
|
||||
|
||||
$app->abort(400, _('Missing path parameter'));
|
||||
}
|
||||
|
||||
foreach ($tests as $test) {
|
||||
switch ($test) {
|
||||
case 'writeable':
|
||||
if ( ! is_writable($path)) {
|
||||
$result = false;
|
||||
}
|
||||
break;
|
||||
case 'readable':
|
||||
default:
|
||||
if ( ! is_readable($path)) {
|
||||
$result = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $app->json(array('results' => $result));
|
||||
});
|
||||
|
||||
$controllers->get('/structure/{databox_id}/', function(Application $app, Request $request, $databox_id) {
|
||||
if ( ! $app['phraseanet.core']->getAuthenticatedUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
|
||||
$app->abort(403);
|
||||
@@ -206,7 +249,7 @@ class Root implements ControllerProviderInterface
|
||||
$error = true;
|
||||
}
|
||||
|
||||
return $app->json(array('success' => ! $error));
|
||||
return $app->json(array('success' => ! $error));
|
||||
})->assert('databox_id', '\d+')->assert('bit', '\d+');
|
||||
|
||||
$controllers->post('/statusbit/{databox_id}/status/{bit}/', function(Application $app, Request $request, $databox_id, $bit) {
|
||||
|
4
templates/web/Mustache/Prod/Alert-Success.Mustache.html
Normal file
4
templates/web/Mustache/Prod/Alert-Success.Mustache.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="alert alert-success">
|
||||
<button class="close" data-dismiss="alert">×</button>
|
||||
{{ content }}
|
||||
</div>
|
266
templates/web/admin/collection/collection.html.twig
Normal file
266
templates/web/admin/collection/collection.html.twig
Normal file
@@ -0,0 +1,266 @@
|
||||
|
||||
<div class="page-header">
|
||||
<h1>
|
||||
{% trans 'phraseanet:: collection' %} {{ collection.get_name() }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li>{% trans 'phraseanet:: adresse' %} : {{ collection.get_databox().get_serialized_server_info() }}</li>
|
||||
<li>{% trans 'admin::base:collection: numero de collection distante' %} : {{ collection.get_coll_id() }}</li>
|
||||
<li>{% trans 'admin::base:collection: etat de la collection' %} : {{ collection.is_active() ? "admin::base:collection: activer la collection"| trans : "admin::base:collection: descativer la collection"|trans }}</li>
|
||||
<li>{{ collection.get_record_amount() }} records</li>
|
||||
</ul>
|
||||
|
||||
{% if user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<div class="well-small">
|
||||
<h5>{% trans 'admin::collection:: Gestionnaires des commandes' %}</h5>
|
||||
<form id="admin_adder" action="/admin/bas/{{ app.request.get('bas_id') }}/order/admins/" method="post">
|
||||
{% if admins | length > 0 %}
|
||||
<ul>
|
||||
{% for user in admins %}
|
||||
<li>
|
||||
<label for="adm_{{ user.get_id() }}" class="checkbox">
|
||||
<input name="admins[]" type="checkbox" value="{{ user.get_id() }}" id="adm_{{ user.get_id() }}" checked />
|
||||
{{ user.get_display_name() }}
|
||||
</label>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<h6>{% trans 'setup:: ajouter un administrateur des commandes' %}</h6>
|
||||
|
||||
<div>
|
||||
<input class="admin_adder"/>
|
||||
<input type="hidden" name="admins[]"/>
|
||||
<input type="submit" value="{% trans 'boutton::valider' %}" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<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/bas/{{ app.request.get('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' %}
|
||||
</label>
|
||||
<label class="radio" for="pub_wm_wm">
|
||||
<input id="pub_wm_wm" type='radio' name='pub_wm' {{ collection.get_pub_wm() == 'wm' ? 'checked' : ''}} value='wm' />
|
||||
{% trans 'admin::colelction::presentation des elements : watermark' %}
|
||||
</label>
|
||||
<label class="radio" for="pub_wm_stamp">
|
||||
<input id="pub_wm_stamp" type='radio' name='pub_wm' {{ collection.get_pub_wm() == 'stamp' ? 'checked' : ''}} value='stamp' />
|
||||
{% trans 'admin::colelction::presentation des elements : stamp' %}
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="action-block well">
|
||||
<form class="form-inline" method="post" action="/admin/bas/{{ app.request.get('bas_id') }}/rename/">
|
||||
<div class="input-append">
|
||||
<input name="name" class="span2" type="text" size="16">
|
||||
<a class="btn submiter" >
|
||||
<img src="/skins/icons/edit_0.gif" />
|
||||
{% trans 'admin::base:collection: renommer la collection' %}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group well">
|
||||
<form style="display:inline" method="post" action="/admin/bas/{{ 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 }}">
|
||||
<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>
|
||||
</form>
|
||||
|
||||
<form style="display:inline" method="post" action="/admin/bas/{{ 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 ?' %}">
|
||||
<img src='/skins/icons/trash.png' />
|
||||
{% trans 'admin::base:collection: vider la collection' %}
|
||||
</a>
|
||||
</form>
|
||||
|
||||
<form style="display:inline" method="delete" action="/admin/bas/{{ app.request.get('bas_id') }}/">
|
||||
<a class='btn confirm submiter' href="#" data-confirm-msg="{% trans 'admin::collection: Confirmez vous la suppression de cette collection ?' %}">
|
||||
<img src='/skins/icons/delete.gif' />
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<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="delete" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/mini-logo/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/mini-logo/">
|
||||
<input name="newLogo" type="file" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<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="delete" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/watermark/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/watermark/">
|
||||
<input name="newWm" type="file" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<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="delete" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/stamp-logo/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/stamp-logo/">
|
||||
<input name="newStamp" type="file" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<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="delete" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/banner/">
|
||||
<a class="btn btn-danger btn-mini" href="#">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
{% trans 'boutton::supprimer' %}
|
||||
</a>
|
||||
</form>
|
||||
{% endif%}
|
||||
{% elseif user.ACL.has_right_on_base(app.request.get('bas_id'), 'manage') %}
|
||||
<span>{% trans 'admin::base:collection: aucun fichier (minilogo, watermark ...)' %}</span>
|
||||
<form enctype="multipart/form-data" method="post" action="/admin/bas/{{ app.request.get('bas_id') }}/picture/banner/">
|
||||
<input name="newBanner" type="file" />
|
||||
<a class="btn btn-primary">{% trans 'boutton::envoyer' %}</a>
|
||||
<span>(max : 650x200)</span>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(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') }}",
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
var form = $('#admin_adder');
|
||||
$('input[name="admins[]"]:last', form).val(ui.item.id);
|
||||
form.submit();
|
||||
}
|
||||
}).data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||
var email = item.email ? '<br/>'+item.email : '';
|
||||
var login = item.login != item.name ? " ("+ item.login +")" : '';
|
||||
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.name + login + email + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
|
||||
//change display
|
||||
$('#pub_wm_none, #pub_wm_wm, #pub_wm_stamp').bind('click', function(){
|
||||
var $this = $(this);
|
||||
var form = $this.closest('form');
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
type: form.attr('method'),
|
||||
url: form.attr('action'),
|
||||
data: {
|
||||
pub_wm: $this.val()
|
||||
},
|
||||
success: function(datas) {
|
||||
if(datas.success) {
|
||||
p4.Mustache.Render('Alert-Success', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
});
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Error', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("div.right a.submiter").bind("click", function() {
|
||||
var $this = $(this);
|
||||
var form = $this.closest('form');
|
||||
|
||||
if($this.hasClass('confirm')) {
|
||||
if(confirm($this.data('confirm-msg'))) {
|
||||
submitForm($this, form);
|
||||
}
|
||||
} else {
|
||||
submitForm($this, form);
|
||||
}
|
||||
});
|
||||
|
||||
function submitForm(submitLink, form) {
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
type: form.attr('method'),
|
||||
url: form.attr('action'),
|
||||
data: form.serializeArray(),
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
p4.Mustache.Render('Alert-Error', {content:datas.msg}, function(html){
|
||||
$this.closest('.action-block').prepend(html);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
@@ -168,9 +168,10 @@
|
||||
|
||||
<li>
|
||||
<div style="padding:0 0 2px 0;">
|
||||
<a target="right" href="collection.php?act=COLLECTION&p0={{ sbas_id }}&p1={{ collection.get_base_id() }}">
|
||||
<span>{{ collection.get_name() }}</span>
|
||||
</a>
|
||||
{#<a target="right" href="collection.php?act=COLLECTION&p0={{ sbas_id }}&p1={{ collection.get_base_id() }}">#}
|
||||
<a target="right" href="/admin/bas/{{ collection.get_base_id() }}/" class="ajax">
|
||||
<span>{{ collection.get_name() }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<ul>
|
||||
|
||||
|
@@ -25,9 +25,9 @@ $parm = $request->get_parms('action', 'position', 'test', 'renew', 'path', 'test
|
||||
$output = '';
|
||||
|
||||
switch ($parm['action']) {
|
||||
case 'TREE':
|
||||
$output = module_admin::getTree($parm['position']);
|
||||
break;
|
||||
// case 'TREE':
|
||||
// $output = module_admin::getTree($parm['position']);
|
||||
// break;
|
||||
case 'APACHE':
|
||||
if ($parm['test'] == 'success') {
|
||||
$output = '1';
|
||||
@@ -39,73 +39,72 @@ switch ($parm['action']) {
|
||||
$output = $registry->get('GV_ServerName') . 'admin/runscheduler.php?key=' . urlencode(phrasea::scheduler_key( ! ! $parm['renew']));
|
||||
break;
|
||||
|
||||
case 'TESTPATH':
|
||||
$tests = true;
|
||||
foreach ($parm['tests'] as $test) {
|
||||
switch ($test) {
|
||||
case 'writeable':
|
||||
if ( ! is_writable($parm['path'])) {
|
||||
$tests = false;
|
||||
}
|
||||
break;
|
||||
case 'readable':
|
||||
default:
|
||||
if ( ! is_readable($parm['path'])) {
|
||||
$tests = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$output = p4string::jsonencode(array('results' => ($tests ? '1' : '0')));
|
||||
break;
|
||||
// case 'TESTPATH':
|
||||
// $tests = true;
|
||||
// foreach ($parm['tests'] as $test) {
|
||||
// switch ($test) {
|
||||
// case 'writeable':
|
||||
// if ( ! is_writable($parm['path'])) {
|
||||
// $tests = false;
|
||||
// }
|
||||
// break;
|
||||
// case 'readable':
|
||||
// default:
|
||||
// if ( ! is_readable($parm['path'])) {
|
||||
// $tests = true;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// $output = p4string::jsonencode(array('results' => ($tests ? '1' : '0')));
|
||||
// break;
|
||||
|
||||
case 'EMPTYBASE':
|
||||
$parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
$message = _('Base empty successful');
|
||||
try {
|
||||
$sbas_id = (int) $parm['sbas_id'];
|
||||
$databox = $appbox->get_databox($sbas_id);
|
||||
$class_name = 'task_period_emptyColl';
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
} else {
|
||||
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><tasksettings><base_id>" . $collection->get_base_id() . "</base_id></tasksettings>";
|
||||
task_abstract::create($appbox, $class_name, $settings);
|
||||
$message = _('A task has been creted, please run it to complete empty collection');
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$message = _('An error occurred');
|
||||
}
|
||||
$output = p4string::jsonencode(array('message' => $message));
|
||||
break;
|
||||
case 'EMPTYCOLL':
|
||||
$message = _('Collection empty successful');
|
||||
$parm = $request->get_parms(
|
||||
array(
|
||||
"sbas_id" => http_request::SANITIZE_NUMBER_INT
|
||||
, "coll_id" => http_request::SANITIZE_NUMBER_INT
|
||||
)
|
||||
);
|
||||
try {
|
||||
$databox = $appbox->get_databox($parm['sbas_id']);
|
||||
$collection = collection::get_from_coll_id($databox, $parm['coll_id']);
|
||||
|
||||
if ($collection->get_record_amount() <= 500) {
|
||||
$collection->empty_collection(500);
|
||||
} else {
|
||||
$class_name = 'task_period_emptyColl';
|
||||
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<base_id>" . $collection->get_base_id() . "</base_id></tasksettings>";
|
||||
|
||||
task_abstract::create($appbox, $class_name, $settings);
|
||||
$message = _('A task has been creted, please run it to complete empty collection');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$message = _('An error occurred');
|
||||
}
|
||||
$output = p4string::jsonencode(array('message' => $message));
|
||||
break;
|
||||
// case 'EMPTYBASE':
|
||||
// $parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
// $message = _('Base empty successful');
|
||||
// try {
|
||||
// $sbas_id = (int) $parm['sbas_id'];
|
||||
// $databox = $appbox->get_databox($sbas_id);
|
||||
// $class_name = 'task_period_emptyColl';
|
||||
// foreach ($databox->get_collections() as $collection) {
|
||||
// if ($collection->get_record_amount() <= 500) {
|
||||
// $collection->empty_collection(500);
|
||||
// } else {
|
||||
// $settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"
|
||||
// task_abstract::create($appbox, $class_name, $settings);
|
||||
// $message = _('A task has been creted, please run it to complete empty collection');
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception $e) {
|
||||
// $message = _('An error occurred');
|
||||
// }
|
||||
// $output = p4string::jsonencode(array('message' => $message));
|
||||
// break;
|
||||
// case 'EMPTYCOLL':
|
||||
// $message = _('Collection empty successful');
|
||||
// $parm = $request->get_parms(
|
||||
// array(
|
||||
// "sbas_id" => http_request::SANITIZE_NUMBER_INT
|
||||
// , "coll_id" => http_request::SANITIZE_NUMBER_INT
|
||||
// )
|
||||
// );
|
||||
// try {
|
||||
// $databox = $appbox->get_databox($parm['sbas_id']);
|
||||
// $collection = collection::get_from_coll_id($databox, $parm['coll_id']);
|
||||
//
|
||||
// if ($collection->get_record_amount() <= 500) {
|
||||
// $collection->empty_collection(500);
|
||||
// } else {
|
||||
// $class_name = 'task_period_emptyColl';
|
||||
//
|
||||
// task_abstract::create($appbox, $class_name, $settings);
|
||||
// $message = _('A task has been creted, please run it to complete empty collection');
|
||||
// }
|
||||
// } catch (Exception $e) {
|
||||
// $message = _('An error occurred');
|
||||
// }
|
||||
// $output = p4string::jsonencode(array('message' => $message));
|
||||
// break;
|
||||
|
||||
case 'SETTASKSTATUS':
|
||||
$parm = $request->get_parms('task_id', 'status', 'signal');
|
||||
@@ -219,49 +218,49 @@ switch ($parm['action']) {
|
||||
$output = p4string::jsonencode($ret);
|
||||
break;
|
||||
|
||||
case 'UNMOUNTBASE':
|
||||
$parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
$ret = array('sbas_id' => null);
|
||||
// case 'UNMOUNTBASE':
|
||||
// $parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
// $ret = array('sbas_id' => null);
|
||||
//
|
||||
// $databox = $appbox->get_databox((int) $parm['sbas_id']);
|
||||
// $databox->unmount_databox($appbox);
|
||||
//
|
||||
// $ret['sbas_id'] = $parm['sbas_id'];
|
||||
// $output = p4string::jsonencode($ret);
|
||||
// break;
|
||||
|
||||
$databox = $appbox->get_databox((int) $parm['sbas_id']);
|
||||
$databox->unmount_databox($appbox);
|
||||
|
||||
$ret['sbas_id'] = $parm['sbas_id'];
|
||||
$output = p4string::jsonencode($ret);
|
||||
break;
|
||||
|
||||
case 'P_BAR_INFO':
|
||||
$parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
$ret = array(
|
||||
'sbas_id' => null,
|
||||
'indexable' => false,
|
||||
'records' => 0,
|
||||
'xml_indexed' => 0,
|
||||
'thesaurus_indexed' => 0,
|
||||
'viewname' => null,
|
||||
'printLogoURL' => NULL
|
||||
);
|
||||
|
||||
$databox = $appbox->get_databox((int) $parm['sbas_id']);
|
||||
|
||||
$ret['indexable'] = $appbox->is_databox_indexable($databox);
|
||||
$ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname());
|
||||
|
||||
$ret['records'] = $databox->get_record_amount();
|
||||
|
||||
$datas = $databox->get_indexed_record_amount();
|
||||
|
||||
$ret['sbas_id'] = $parm['sbas_id'];
|
||||
$tot = $idxxml = $idxth = 0;
|
||||
|
||||
$ret['xml_indexed'] = $datas['xml_indexed'];
|
||||
$ret['thesaurus_indexed'] = $datas['thesaurus_indexed'];
|
||||
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/minilogos/logopdf_' . $parm['sbas_id'] . '.jpg')) {
|
||||
$ret['printLogoURL'] = '/print/' . $parm['sbas_id'];
|
||||
}
|
||||
$output = p4string::jsonencode($ret);
|
||||
break;
|
||||
// case 'P_BAR_INFO':
|
||||
// $parm = $request->get_parms(array('sbas_id' => http_request::SANITIZE_NUMBER_INT));
|
||||
// $ret = array(
|
||||
// 'sbas_id' => null,
|
||||
// 'indexable' => false,
|
||||
// 'records' => 0,
|
||||
// 'xml_indexed' => 0,
|
||||
// 'thesaurus_indexed' => 0,
|
||||
// 'viewname' => null,
|
||||
// 'printLogoURL' => NULL
|
||||
// );
|
||||
//
|
||||
// $databox = $appbox->get_databox((int) $parm['sbas_id']);
|
||||
//
|
||||
// $ret['indexable'] = $appbox->is_databox_indexable($databox);
|
||||
// $ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname());
|
||||
//
|
||||
// $ret['records'] = $databox->get_record_amount();
|
||||
//
|
||||
// $datas = $databox->get_indexed_record_amount();
|
||||
//
|
||||
// $ret['sbas_id'] = $parm['sbas_id'];
|
||||
// $tot = $idxxml = $idxth = 0;
|
||||
//
|
||||
// $ret['xml_indexed'] = $datas['xml_indexed'];
|
||||
// $ret['thesaurus_indexed'] = $datas['thesaurus_indexed'];
|
||||
//
|
||||
// if (file_exists($registry->get('GV_RootPath') . 'config/minilogos/logopdf_' . $parm['sbas_id'] . '.jpg')) {
|
||||
// $ret['printLogoURL'] = '/print/' . $parm['sbas_id'];
|
||||
// }
|
||||
// $output = p4string::jsonencode($ret);
|
||||
// break;
|
||||
|
||||
// case 'CHGVIEWNAME':
|
||||
//
|
||||
|
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms("u");
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$user = User_Adapter::getInstance($parm['u'], $appbox);
|
||||
|
||||
phrasea::headers();
|
||||
|
||||
|
||||
$info = "";
|
||||
$info2 = "";
|
||||
|
||||
$info .= _('admin::compte-utilisateur identifiant') . " : " . $user->get_login();
|
||||
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur nom') . "/" . _('admin::compte-utilisateur prenom') . " : ";
|
||||
$info2 .= $user->get_display_name();
|
||||
if ($user->get_email()) {
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur email') . " : " . $user->get_email();
|
||||
}
|
||||
if ($user->get_tel()) {
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur telephone') . " : " . $user->get_tel();
|
||||
}
|
||||
if ($user->get_job()) {
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur poste') . " : " . $user->get_job();
|
||||
}
|
||||
if ($user->get_company()) {
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur societe') . " : " . $user->get_company();
|
||||
}
|
||||
if ($user->get_position()) {
|
||||
$info2 .= "<br>" . _('admin::compte-utilisateur activite') . " : " . $user->get_position();
|
||||
}
|
||||
$info2 .= "<br><div style='background-color:#777777'><font color=#FFFFFF>" . _('admin::compte-utilisateur adresse') . "</font>";
|
||||
$info2 .= "<br>" . $user->get_address() . "<br>" . $user->get_zipcode() . " " . $user->get_city();
|
||||
$info2 .= "</div>";
|
||||
if ($info2 != "")
|
||||
$info .= "<font color=#EEEEEE>" . $info2 . "</font>";
|
||||
$info = str_replace("<br><br>", "<br>", $info);
|
||||
$info = str_replace("\n", "", $info);
|
||||
$info = str_replace("\r", "", $info);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
parent.usrDesc[<?php echo $parm["u"] ?>] = "<?php echo p4string::MakeString($info, "js") ?>";
|
||||
parent.redrawUsrDesc(<?php echo $parm["u"] ?>);
|
||||
</script>
|
@@ -38,6 +38,7 @@ $groups = array(
|
||||
, '//include/vendor/jquery-file-upload/js/vendor/jquery.ui.widget.js'
|
||||
, '//include/vendor/jquery-file-upload/js/jquery.iframe-transport.js'
|
||||
, '//include/vendor/jquery-file-upload/js/jquery.fileupload.js'
|
||||
, '//prod/jquery.Phraseanet.js'
|
||||
),
|
||||
'report' => array(
|
||||
'//include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js'
|
||||
|
Reference in New Issue
Block a user