diff --git a/.gitmodules b/.gitmodules index 4337ee5ac0..3d9c349027 100644 --- a/.gitmodules +++ b/.gitmodules @@ -63,3 +63,6 @@ url = https://github.com/wavded/humane-js.git +[submodule "www/include/vendor/qunit"] + path = www/include/vendor/qunit + url = git://github.com/jquery/qunit.git diff --git a/bin/console b/bin/console index 8a5fce126e..48c99a699c 100755 --- a/bin/console +++ b/bin/console @@ -27,7 +27,9 @@ require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; try { - bootstrap::register_autoloads(); + \bootstrap::register_autoloads(); + + $Core = \bootstrap::getCore(); $app = new Application(" _____ _ _ _____ _____ ______ _ _ ______ _______ @@ -45,7 +47,8 @@ try This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; type `about:license' for details.\n\n" - . ' KONSOLE KOMMANDER', GV_version . ' ' . GV_version_name); + . ' KONSOLE KOMMANDER', $Core->getVersion()->getName() + . ' ' . $Core->getVersion()->getNumber()); $app->add(new module_console_aboutAuthors('about:authors')); $app->add(new module_console_aboutLicense('about:license')); diff --git a/hudson/build.properties b/hudson/build.properties index 071a10ec8a..12294dcf26 100644 --- a/hudson/build.properties +++ b/hudson/build.properties @@ -2,4 +2,4 @@ dir.src=/tmp/jenkinsWorking-dev # test.ci -dir.dest=/home/sites_web/test-dev.ci.alchemyasp.com +dir.dest=/home/sites_web/test-dev.ci.alchemyasp.com/pv3 diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php index 304a450bc7..bfd00f9ddf 100644 --- a/lib/Alchemy/Phrasea/Application/Api.php +++ b/lib/Alchemy/Phrasea/Application/Api.php @@ -32,6 +32,8 @@ return call_user_func(function() $app = new Silex\Application(); + $app["Core"] = bootstrap::getCore(); + $app["appbox"] = appbox::get_instance(); /** @@ -68,7 +70,7 @@ return call_user_func(function() */ $app['api'] = function () use ($app) { - return new API_V1_adapter(false, $app["appbox"]); + return new API_V1_adapter(false, $app["appbox"], $app["Core"]); }; diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php index 23f5c1d2aa..e17e5639f2 100644 --- a/lib/Alchemy/Phrasea/Application/Lightbox.php +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -20,7 +20,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ - return call_user_func( function() { @@ -30,17 +29,29 @@ return call_user_func( $app = new Silex\Application(); - $app->get('/', function () use ($session, $appbox) + $app['Core'] = bootstrap::getCore(); + + $app->get('/', function (Silex\Application $app) use ($session, $appbox) { User_Adapter::updateClientInfos((6)); - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); + + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $basket_collection = $repository->findActiveByUser( + $app['Core']->getAuthenticatedUser() + ); + $twig = new supertwig(); $twig->addFilter(array('nl2br' => 'nl2br')); $browser = Browser::getInstance(); $template = 'lightbox/index.twig'; if (!$browser->isNewGeneration() && !$browser->isMobile()) + { $template = 'lightbox/IE6/index.twig'; + } $output = $twig->render($template, array( 'baskets_collection' => $basket_collection, @@ -55,7 +66,7 @@ return call_user_func( } ); - $app->get('/ajax/NOTE_FORM/{sselcont_id}/', function($sselcont_id) use ($session, $appbox) + $app->get('/ajax/NOTE_FORM/{sselcont_id}/', function(Silex\Application $app, $sselcont_id) use ($session, $appbox) { $browser = Browser::getInstance(); if (!$browser->isMobile()) @@ -71,7 +82,7 @@ return call_user_func( } )->assert('sselcont_id', '\d+'); - $app->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function($sselcont_id) + $app->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function(Silex\Application $app, $sselcont_id) { $twig = new supertwig(); $twig->addFilter(array('nl2br' => 'nl2br', 'formatoctet' => 'p4string::format_octets')); @@ -107,19 +118,30 @@ return call_user_func( $appbox = appbox::get_instance(); $usr_id = $appbox->get_session()->get_usr_id(); - $basket_element = basket_element_adapter::getInstance($sselcont_id); - $basket = basket_adapter::getInstance($appbox, $basket_element->get_ssel_id(), $usr_id); + + $em = $app['Core']->getEntityManager(); + + $repository = $em->getRepository('\Entities\BasketElement'); + /* @var $repository \Repositories\BasketElementRepository */ + + $BasketElement = $repository->findUserElement( + $sselcont_id + , $app['Core']->getAuthenticatedUser() + ); + + + $Basket = $BasketElement->getBasket(); $ret = array(); - $ret['number'] = $basket_element->get_record()->get_number(); - $ret['title'] = $basket_element->get_record()->get_title(); + $ret['number'] = $BasketElement->getRecord()->get_number(); + $ret['title'] = $BasketElement->getRecord()->get_title(); - $ret['preview'] = $twig->render($template_preview, array('record' => $basket_element->get_record(), 'not_wrapped' => true)); - $ret['options_html'] = $twig->render($template_options, array('basket_element' => $basket_element)); - $ret['agreement_html'] = $twig->render($template_agreement, array('basket' => $basket, 'basket_element' => $basket_element)); - $ret['selector_html'] = $twig->render($template_selector, array('basket_element' => $basket_element)); - $ret['note_html'] = $twig->render($template_note, array('basket_element' => $basket_element)); - $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $basket_element->get_record())); + $ret['preview'] = $twig->render($template_preview, array('record' => $BasketElement->getRecord(), 'not_wrapped' => true)); + $ret['options_html'] = $twig->render($template_options, array('basket_element' => $BasketElement)); + $ret['agreement_html'] = $twig->render($template_agreement, array('basket' => $Basket, 'basket_element' => $BasketElement)); + $ret['selector_html'] = $twig->render($template_selector, array('basket_element' => $BasketElement)); + $ret['note_html'] = $twig->render($template_note, array('basket_element' => $BasketElement)); + $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $BasketElement->getRecord())); $output = p4string::jsonencode($ret); return new Response($output, 200, array('Content-Type' => 'application/json')); @@ -130,7 +152,7 @@ return call_user_func( - $app->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function($entry_id, $item_id) + $app->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(Silex\Application $app, $entry_id, $item_id) { $twig = new supertwig(); $twig->addFilter(array('nl2br' => 'nl2br', 'formatoctet' => 'p4string::format_octets')); @@ -182,15 +204,25 @@ return call_user_func( } )->assert('entry_id', '\d+')->assert('item_id', '\d+'); - $app->get('/validate/{ssel_id}/', function ($ssel_id) use ($session, $appbox) + $app->get('/validate/{ssel_id}/', function (Silex\Application $app, $ssel_id) use ($session, $appbox) { User_Adapter::updateClientInfos((6)); $browser = Browser::getInstance(); - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); - $basket = basket_adapter::getInstance($appbox, $ssel_id, $session->get_usr_id()); + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $basket_collection = $repository->findActiveByUser( + $app['Core']->getAuthenticatedUser() + ); + + $basket = $repository->findUserBasket( + $ssel_id + , $app['Core']->getAuthenticatedUser() + ); if ($basket->is_valid()) { @@ -220,20 +252,25 @@ return call_user_func( } )->assert('ssel_id', '\d+'); - $app->get('/compare/{ssel_id}/', function ($ssel_id) use ($session, $appbox) + $app->get('/compare/{ssel_id}/', function (Silex\Application $app, $ssel_id) use ($session, $appbox) { User_Adapter::updateClientInfos((6)); $browser = Browser::getInstance(); - $basket_collection = new basketCollection($appbox, $session->get_usr_id()); - $basket = basket_adapter::getInstance($appbox, $ssel_id, $session->get_usr_id()); + $em = $app['Core']->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); - if ($basket->is_valid()) - { - $basket->get_first_element()->load_users_infos(); - } + /* @var $repository \Repositories\BasketRepository */ + $basket_collection = $repository->findActiveByUser( + $app['Core']->getAuthenticatedUser() + ); + + $basket = $repository->findUserBasket( + $ssel_id + , $app['Core']->getAuthenticatedUser() + ); $twig = new supertwig(); @@ -260,7 +297,7 @@ return call_user_func( - $app->get('/feeds/entry/{entry_id}/', function ($entry_id) use ($session, $appbox) + $app->get('/feeds/entry/{entry_id}/', function (Silex\Application $app, $entry_id) use ($session, $appbox) { User_Adapter::updateClientInfos((6)); @@ -293,7 +330,7 @@ return call_user_func( } )->assert('entry_id', '\d+'); - $app->get('/ajax/LOAD_REPORT/{ssel_id}/', function($ssel_id) use ($appbox, $app) + $app->get('/ajax/LOAD_REPORT/{ssel_id}/', function(Silex\Application $app, $ssel_id) use ($appbox, $app) { $twig = new supertwig(); $twig->addFilter(array('nl2br' => 'nl2br')); @@ -311,7 +348,7 @@ return call_user_func( } )->assert('ssel_id', '\d+'); - $app->post('/ajax/SET_NOTE/{sselcont_id}/', function ($sselcont_id) use ($app) + $app->post('/ajax/SET_NOTE/{sselcont_id}/', function (Silex\Application $app, $sselcont_id) { $output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')); try @@ -352,7 +389,7 @@ return call_user_func( } )->assert('sselcont_id', '\d+'); - $app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function($sselcont_id) use ($app) + $app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(Silex\Application $app, $sselcont_id) { $request = $app['request']; $agreement = (int) $request->get('agreement'); @@ -362,7 +399,7 @@ return call_user_func( 'releasable' => false, 'datas' => _('Erreur lors de la mise a jour des donnes ') ); - + try { $appbox = appbox::get_instance(); @@ -388,7 +425,7 @@ return call_user_func( )->assert('sselcont_id', '\d+'); - $app->post('/ajax/SET_RELEASE/{ssel_id}/', function($ssel_id) use ($session, $appbox) + $app->post('/ajax/SET_RELEASE/{ssel_id}/', function(Silex\Application $app, $ssel_id) use ($session, $appbox) { $basket = basket_adapter::getInstance($appbox, $ssel_id, $appbox->get_session()->get_usr_id()); diff --git a/lib/Alchemy/Phrasea/Application/OAuth2.php b/lib/Alchemy/Phrasea/Application/OAuth2.php index 9aeab670d7..92a5c4174c 100644 --- a/lib/Alchemy/Phrasea/Application/OAuth2.php +++ b/lib/Alchemy/Phrasea/Application/OAuth2.php @@ -33,6 +33,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; return call_user_func(function() { $app = new Silex\Application(); + + $app['Core'] = bootstrap::getCore(); $app->register(new Silex\Provider\ValidatorServiceProvider(), array( 'validator.class_path' => __DIR__ . '/../../../../lib/vendor/symfony/src', diff --git a/lib/Alchemy/Phrasea/Application/Overview.php b/lib/Alchemy/Phrasea/Application/Overview.php index bca38e533d..33b3202bf9 100644 --- a/lib/Alchemy/Phrasea/Application/Overview.php +++ b/lib/Alchemy/Phrasea/Application/Overview.php @@ -29,6 +29,8 @@ return call_user_func( $session = $appbox->get_session(); $app = new Silex\Application(); + + $app['Core'] = bootstrap::getCore(); $deliver_content = function(Session_Handler $session, record_adapter $record, $subdef, $watermark, $stamp, $app) diff --git a/lib/Alchemy/Phrasea/Application/Setup.php b/lib/Alchemy/Phrasea/Application/Setup.php index 20470a1b9b..e620cd2db0 100644 --- a/lib/Alchemy/Phrasea/Application/Setup.php +++ b/lib/Alchemy/Phrasea/Application/Setup.php @@ -15,6 +15,7 @@ use Silex\Application; use Alchemy\Phrasea\Controller\Setup as Controller; use Alchemy\Phrasea\Controller\Utils as ControllerUtils; +require_once dirname(__FILE__) . '/../../../bootstrap.php'; /** * * @package @@ -25,6 +26,8 @@ use Alchemy\Phrasea\Controller\Utils as ControllerUtils; return call_user_func(function() { $app = new Silex\Application(); + + $app['Core'] = bootstrap::getCore(); $app['install'] = false; $app['upgrade'] = false; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index 9ee68a3777..0340f38242 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -39,8 +39,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $template = 'admin/editusers.twig'; $twig = new \supertwig(); @@ -55,8 +54,7 @@ class Users implements ControllerProviderInterface $controllers->get('/rights/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $template = 'admin/editusers.twig'; $twig = new \supertwig(); @@ -71,11 +69,7 @@ class Users implements ControllerProviderInterface $controllers->post('/delete/', function() use ($app) { - $request = $app['request']; - - - - $module = new UserHelper\Edit($request); + $module = new UserHelper\Edit($app['Core']); $module->delete_users(); return $app->redirect('/admin/users/search/'); @@ -88,8 +82,7 @@ class Users implements ControllerProviderInterface try { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $rights->apply_rights(); $rights->apply_infos(); @@ -110,8 +103,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/quotas/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $template = 'admin/editusers_quotas.twig'; $twig = new \supertwig(); @@ -125,8 +117,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/quotas/apply/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $rights->apply_quotas(); return; @@ -135,8 +126,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/time/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $template = 'admin/editusers_timelimit.twig'; $twig = new \supertwig(); @@ -150,8 +140,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/time/apply/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $rights->apply_time(); return; @@ -160,8 +149,7 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/masks/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $template = 'admin/editusers_masks.twig'; $twig = new \supertwig(); @@ -175,46 +163,40 @@ class Users implements ControllerProviderInterface $controllers->post('/rights/masks/apply/', function() use ($app) { - $request = $app['request']; - $rights = new UserHelper\Edit($request); + $rights = new UserHelper\Edit($app['Core']); $rights->apply_masks(); return; } ); - $controllers->post('/search/', function() use ($app) + $controllers->match('/search/', function() use ($app) { - $request = $app['request']; - $users = new UserHelper\Manage($request); + $users = new UserHelper\Manage($app['Core']); $template = 'admin/users.html'; $twig = new \supertwig(); $twig->addFilter(array('floor' => 'floor')); $twig->addFilter(array('getDate' => 'phraseadate::getDate')); - return $twig->render($template, $users->search($request)); + return $twig->render($template, $users->search()); } ); - $controllers->get('/search/', function() use ($app) + $controllers->post('/apply_template/', function() use ($app) { - $request = $app['request']; - $users = new UserHelper\Manage($request); - $template = 'admin/users.html'; + $users = UserHelper\Manage($app['Core']); + + $users->apply_template(); - $twig = new \supertwig(); - $twig->addFilter(array('floor' => 'floor')); - $twig->addFilter(array('getDate' => 'phraseadate::getDate')); - - return $twig->render($template, $users->search($request)); + return new Symfony\Component\HttpFoundation\RedirectResponse('/admin/users/search/'); } ); $controllers->get('/typeahead/search/', function() use ($app, $appbox) { $request = $app['request']; - $user_query = new User_Query($appbox); + $user_query = new \User_Query($appbox); $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $like_value = $request->get('term'); @@ -258,7 +240,7 @@ class Users implements ControllerProviderInterface try { $request = $app['request']; - $module = new UserHelper\Manage($request); + $module = new UserHelper\Manage($app['Core']); if ($request->get('template') == '1') { $user = $module->create_template(); @@ -285,7 +267,7 @@ class Users implements ControllerProviderInterface $controllers->post('/export/csv/', function() use ($appbox, $app) { $request = $app['request']; - $user_query = new \User_Query($appbox); + $user_query = new \User_Query($appbox, $app['Core']); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $like_value = $request->get('like_value'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Basket.php b/lib/Alchemy/Phrasea/Controller/Prod/Basket.php index a0e5716807..a27a292604 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Basket.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Basket.php @@ -136,7 +136,7 @@ class Basket implements ControllerProviderInterface }); $controllers->post( - '/{basket_id}/{basket_element_id}/delete/' + '/{basket_id}/delete/{basket_element_id}/' , function(Application $app, Request $request, $basket_id, $basket_element_id) { /* @var $em \Doctrine\ORM\EntityManager */ @@ -342,6 +342,61 @@ class Basket implements ControllerProviderInterface return new RedirectResponse('/'); } }); + + + + $controllers->post( + '/{basket_id}/stealElements/' + , function(Application $app, Request $request, $basket_id) + { + $em = $app['Core']->getEntityManager(); + + /* @var $em \Doctrine\ORM\EntityManager */ + $basket = $em->getRepository('\Entities\Basket') + ->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser()); + + $user = $app['Core']->getAuthenticatedUser(); + /* @var $user \User_Adapter */ + + $n = 0; + + foreach ($request->get('elements') as $bask_element_id) + { + $basket_element = $em->getRepository('\Entities\BasketElement') + ->findUserElement($bask_element_id, $user); + + if(!$basket_element) + { + continue; + } + + $basket_element->setBasket($basket); + + $em->merge($basket_element); + + $n++; + } + + $em->merge($basket); + $em->flush(); + + $data = array( + 'success' => true + , 'message' => sprintf(_('%d records moved'), $n) + ); + + if ($request->getRequestFormat() == 'json') + { + + $datas = $app['Core']['Serializer']->serialize($data, 'json'); + + return new Response($datas, 200, array('Content-type' => 'application/json')); + } + else + { + return new RedirectResponse('/'); + } + }); $controllers->get('/create/', function(Application $app) { @@ -364,7 +419,7 @@ class Basket implements ControllerProviderInterface $twig = new \supertwig(); - $html = $twig->render('prod/basket.twig', array('basket' => $basket)); + $html = $twig->render('prod/WorkZone/Basket.html.twig', array('basket' => $basket)); return new Response($html); })->assert('basket_id', '\d+'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index ae536a6735..bf91de5734 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -45,9 +45,9 @@ class Bridge implements ControllerProviderInterface }; if (!$account->get_api()->get_connector()->is_configured()) - throw new \Bridge_Exception_ApiConnectorNotConfigured(); + throw new \Bridge_Exception_ApiConnectorNotConfigured("Bridge API Connector is not configured"); if (!$account->get_api()->get_connector()->is_connected()) - throw new \Bridge_Exception_ApiConnectorNotConnected (); + throw new \Bridge_Exception_ApiConnectorNotConnected ("Bridge API Connector is not connected"); return; }); @@ -55,7 +55,7 @@ class Bridge implements ControllerProviderInterface $controllers->post('/manager/' , function() use ($app, $twig) { - $route = new RecordHelper\Bridge($app['request']); + $route = new RecordHelper\Bridge($app['Core']); $appbox = \appbox::get_instance(); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); @@ -420,7 +420,7 @@ class Bridge implements ControllerProviderInterface $account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $app['require_connection']($account); - $route = new RecordHelper\Bridge($request); + $route = new RecordHelper\Bridge($app['Core']); $route->grep_records($account->get_api()->acceptable_records()); $params = array( @@ -447,7 +447,7 @@ class Bridge implements ControllerProviderInterface $account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $app['require_connection']($account); - $route = new RecordHelper\Bridge($request); + $route = new RecordHelper\Bridge($app['Core']); $route->grep_records($account->get_api()->acceptable_records()); $connector = $account->get_api()->get_connector(); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php index f6f6539d00..8d91dec23b 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php @@ -30,9 +30,7 @@ class Edit implements ControllerProviderInterface $controllers->post('/', function() use ($app) { - $request = $app['request']; - - $handler = new RecordHelper\Edit($request); + $handler = new RecordHelper\Edit($app['Core']); $handler->propose_editing(); @@ -48,7 +46,7 @@ class Edit implements ControllerProviderInterface $controllers->post('/apply/', function() use ($app) { $request = $app['request']; - $editing = new RecordHelper\Edit($request); + $editing = new RecordHelper\Edit($app['Core']); $editing->execute($request); $template = 'prod/actions/edit_default.twig'; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php index abbcb87436..ff3456643d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php @@ -43,7 +43,7 @@ class Feed implements ControllerProviderInterface $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $feeds = \Feed_Collection::load_all($appbox, $user); $request = $app['request']; - $publishing = new RecordHelper\Feed($request); + $publishing = new RecordHelper\Feed($app['Core']); $datas = $twig->render('prod/actions/publish/publish.html', array('publishing' => $publishing, 'feeds' => $feeds)); @@ -71,7 +71,7 @@ class Feed implements ControllerProviderInterface $entry = \Feed_Entry_Adapter::create($appbox, $feed, $publisher, $title, $subtitle, $author_name, $author_mail); - $publishing = new RecordHelper\Feed($request); + $publishing = new RecordHelper\Feed($app['Core']); foreach ($publishing->get_elements() as $record) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 406756f730..d30eea7d57 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -34,7 +34,7 @@ class MoveCollection implements ControllerProviderInterface $controllers->post('/', function() use ($app) { $request = $app['request']; - $move = new RecordHelper\MoveCollection($request); + $move = new RecordHelper\MoveCollection($app['Core']); $move->propose(); $template = 'prod/actions/collection_default.twig'; @@ -49,7 +49,7 @@ class MoveCollection implements ControllerProviderInterface $controllers->post('/apply/', function() use ($app) { $request = $app['request']; - $move = new RecordHelper\MoveCollection($request); + $move = new RecordHelper\MoveCollection($app['Core']); $move->execute($request); $template = 'prod/actions/collection_submit.twig'; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php index fdfbe5fecd..0dc38afd19 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php @@ -46,9 +46,8 @@ class WorkZone implements ControllerProviderInterface , 'srt' => $app['request']->get('sort') ); - $twig->addFilter(array('get_collection_logo' => 'collection::getLogo')); - return new Response($twig->render('prod/baskets.html', $params)); + return new Response($twig->render('prod/WorkZone/WorkZone.html.twig', $params)); }); return $controllers; diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php index 49c5f1675a..1e1e5fdd06 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php @@ -20,15 +20,6 @@ use Silex\ControllerProviderInterface; use Silex\ControllerCollection; date_default_timezone_set('Europe/Berlin'); -require_once dirname(__FILE__) . '/../../../../version.inc'; -require_once dirname(__FILE__) . '/../../../../classes/phrasea.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/bootstrap.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/cache/cacheableInterface.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/cache/interface.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/cache/nocache.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/cache/adapter.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/User/Interface.class.php'; -require_once dirname(__FILE__) . '/../../../../classes/User/Adapter.class.php'; /** * @@ -43,8 +34,6 @@ class Installer implements ControllerProviderInterface { $controllers = new ControllerCollection(); - $app['available_languages'] = \User_Adapter::detectLanguage(new \Setup_Registry()); - $controllers->get('/', function() use ($app) { $request = $app['request']; @@ -89,17 +78,17 @@ class Installer implements ControllerProviderInterface } - $ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); - $loader = new Twig_Loader_Filesystem($ld_path); - $twig = new Twig_Environment($loader); + $ld_path = array(__DIR__ . '/../../../../../templates/web'); + $loader = new \Twig_Loader_Filesystem($ld_path); + $twig = new \Twig_Environment($loader); $html = $twig->render( '/setup/index.twig' , array_merge($constraints_coll, array( 'locale' => Session_Handler::get_locale() - , 'available_locales' => $app['available_languages'] - , 'version_number' => GV_version - , 'version_name' => GV_version_name + , 'available_locales' => $app['Core']::getAvailableLanguages() + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() , 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/' )) ); @@ -111,12 +100,12 @@ class Installer implements ControllerProviderInterface { \phrasea::use_i18n(\Session_Handler::get_locale()); - $ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); + $ld_path = array(__DIR__ . '/../../../../../templates/web'); - $loader = new Twig_Loader_Filesystem($ld_path); - $twig = new Twig_Environment($loader); + $loader = new \Twig_Loader_Filesystem($ld_path); + $twig = new \Twig_Environment($loader); - $twig->addExtension(new Twig_Extensions_Extension_I18n()); + $twig->addExtension(new \Twig_Extensions_Extension_I18n()); $request = $app['request']; @@ -125,14 +114,15 @@ class Installer implements ControllerProviderInterface { $warnings[] = _('It is not recommended to install Phraseanet without HTTPS support'); } + $html = $twig->render( '/setup/step2.twig' , array( 'locale' => \Session_Handler::get_locale() - , 'available_locales' => $app['available_languages'] + , 'available_locales' => $app['Core']::getAvailableLanguages() , 'available_templates' => \appbox::list_databox_templates() - , 'version_number' => GV_version - , 'version_name' => GV_version_name + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() , 'warnings' => $warnings , 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/' , 'discovered_binaries' => \setup::discover_binaries() diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php index d68079202d..1dc98f8eea 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php @@ -25,7 +25,6 @@ use Silex\ControllerCollection; * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ - class Upgrader implements ControllerProviderInterface { @@ -34,7 +33,6 @@ class Upgrader implements ControllerProviderInterface $controllers = new ControllerCollection(); $app['registry'] = new \Setup_Registry(); - $app['available_languages'] = \User_Adapter::detectLanguage($app['registry']); $app['twig'] = function() { return new \supertwig(); @@ -51,10 +49,11 @@ class Upgrader implements ControllerProviderInterface , array( 'locale' => \Session_Handler::get_locale() , 'upgrade_status' => $upgrade_status - , 'available_locales' => $app['available_languages'] + , 'available_locales' => $app['Core']::getAvailableLanguages() , 'bad_users' => \User_Adapter::get_wrong_email_users(\appbox::get_instance()) - , 'version_number' => GV_version - , 'version_name' => GV_version_name) + , 'version_number' => $app['Core']['Version']->getNumber() + , 'version_name' => $app['Core']['Version']->getName() + ) ); ini_set('display_errors', 'on'); diff --git a/lib/Alchemy/Phrasea/Core.php b/lib/Alchemy/Phrasea/Core.php index 5d4b3dcf86..e5782f2f8c 100644 --- a/lib/Alchemy/Phrasea/Core.php +++ b/lib/Alchemy/Phrasea/Core.php @@ -24,7 +24,16 @@ require_once __DIR__ . '/../../vendor/Silex/vendor/pimple/lib/Pimple.php'; class Core extends \Pimple { - /** + + protected static $availableLanguages = array( + 'ar_SA' => 'العربية' + , 'de_DE' => 'Deutsch' + , 'en_GB' => 'English' + , 'es_ES' => 'Español' + , 'fr_FR' => 'Français' + ); + + /** * * @var Core\Configuration */ @@ -54,10 +63,23 @@ class Core extends \Pimple }); - $this['Registry'] = $this->share(function() - { - return \registry::get_instance(); - }); + if (\setup::is_installed()) + { + $this['Registry'] = $this->share(function() + { + return \registry::get_instance(); + }); + \phrasea::start(); + $this->enableEvents(); + } + else + { + + $this['Registry'] = $this->share(function() + { + return new \Setup_Registry(); + }); + } /** * Initialize Request @@ -82,22 +104,21 @@ class Core extends \Pimple $this->verifyTimeZone(); - \phrasea::start(); - $this->detectLanguage(); $this->enableLocales(); - $this->enableEvents(); define('JETON_MAKE_SUBDEF', 0x01); define('JETON_WRITE_META_DOC', 0x02); define('JETON_WRITE_META_SUBDEF', 0x04); define('JETON_WRITE_META', 0x06); - $gatekeeper = \gatekeeper::getInstance(); - $gatekeeper->check_directory(); - + if (\setup::is_installed()) + { + $gatekeeper = \gatekeeper::getInstance(); + $gatekeeper->check_directory(); + } return; } @@ -203,6 +224,7 @@ class Core extends \Pimple protected function enableEvents() { + \phrasea::load_events(); return; @@ -216,8 +238,8 @@ class Core extends \Pimple if ($this->getRegistry()->get('GV_debug')) { - ini_set('display_errors', 'on'); - ini_set('display_startup_errors', 'on'); + ini_set('display_errors', 'on'); + ini_set('display_startup_errors', 'on'); } else { @@ -237,23 +259,24 @@ class Core extends \Pimple return $this; } + /** + * + * @return Array + */ + public static function getAvailableLanguages() + { + return static::$availableLanguages; + } + protected function detectLanguage() { - $availables = array( - 'ar_SA' => 'العربية' - , 'de_DE' => 'Deutsch' - , 'en_GB' => 'English' - , 'es_ES' => 'Español' - , 'fr_FR' => 'Français' - ); - $this->getRequest()->setDefaultLocale( $this->getRegistry()->get('GV_default_lng', 'en_GB') ); $cookies = $this->getRequest()->cookies; - if (isset($availables[$cookies->get('locale')])) + if (isset(static::$availableLanguages[$cookies->get('locale')])) { $this->getRequest()->setLocale($cookies->get('locale')); } diff --git a/lib/Alchemy/Phrasea/Helper/Helper.php b/lib/Alchemy/Phrasea/Helper/Helper.php index 09f38fb519..2953aa0afc 100644 --- a/lib/Alchemy/Phrasea/Helper/Helper.php +++ b/lib/Alchemy/Phrasea/Helper/Helper.php @@ -22,7 +22,11 @@ use Alchemy\Phrasea\Core; class Helper { - private $core; + /** + * + * @var Alchemy\Phrasea\Core\Kernel + */ + protected $core; /** * diff --git a/lib/Alchemy/Phrasea/Helper/Record/Bridge.php b/lib/Alchemy/Phrasea/Helper/Record/Bridge.php index a921d009aa..e69619bf75 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Bridge.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Bridge.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Helper\Record; -use Alchemy\Phrasea\Helper\RecordsAbstract as RecordHelper; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; /** * diff --git a/lib/Alchemy/Phrasea/Helper/Record/Edit.php b/lib/Alchemy/Phrasea/Helper/Record/Edit.php index 7327fa029a..2ae4a0ab11 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Edit.php @@ -8,13 +8,17 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Alchemy\Phrasea\Helper\Record; - -use Alchemy\Phrasea\Helper\RecordsAbstract as RecordHelper; -use Symfony\Component\HttpFoundation\Request; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper, + Symfony\Component\HttpFoundation\Request; /** + * Edit Record Helper + * This object handles /edit/ request and filters records that user can edit + * + * It prepares metadatas, databases structures. * * @package * @license http://opensource.org/licenses/gpl-3.0 GPLv3 @@ -64,16 +68,21 @@ class Edit extends RecordHelper * @var boolean */ protected $works_on_unique_sbas = true; + + /** + * + * @var type + */ protected $has_thesaurus = false; - - - public function __construct(Request $request) + /** + * + * @param \Alchemy\Phrasea\Core $core + * @return Edit + */ + public function __construct(\Alchemy\Phrasea\Core $core) { - $appbox = \appbox::get_instance(); - - parent::__construct($request); - + parent::__construct($core); if ($this->is_single_grouping()) { @@ -186,9 +195,7 @@ class Edit extends RecordHelper protected function generate_javascript_elements() { $_lst = array(); - $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); $twig = new \supertwig(); foreach ($this->selection as $record) @@ -251,7 +258,7 @@ class Edit extends RecordHelper } catch (Exception $e) { - + } $_lst[$indice]['type'] = $record->get_type(); } @@ -282,7 +289,7 @@ class Edit extends RecordHelper $T_sgval['b' . $base_id] = array(); $collection = \collection::get_from_base_id($base_id); - + if ($sxe = simplexml_load_string($collection->get_prefs())) { $z = $sxe->xpath('/baseprefs/sugestedValues'); @@ -292,7 +299,7 @@ class Edit extends RecordHelper foreach ($z[0] as $ki => $vi) // les champs { - + $field = $databox->get_meta_structure()->get_element_by_name($ki); if (!$field) continue; // champ inconnu dans la structure ? @@ -323,9 +330,7 @@ class Edit extends RecordHelper protected function generate_javascript_status() { $_tstatbits = array(); - $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); if ($user->ACL()->has_right('changestatus')) { @@ -457,12 +462,11 @@ class Edit extends RecordHelper } catch (Exception $e) { - + } } if (!is_array($request->get('mds'))) - return $this; $sbas_id = (int) $request->get('sbid'); diff --git a/lib/Alchemy/Phrasea/Helper/Record/Feed.php b/lib/Alchemy/Phrasea/Helper/Record/Feed.php index 5f6702d749..ae56596e6f 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Feed.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Feed.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Helper\Record; -use Alchemy\Phrasea\Helper\RecordsAbstract as RecordHelper; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; use Symfony\Component\HttpFoundation\Request; /** @@ -43,15 +43,13 @@ class Feed extends RecordHelper /** * - * @param Request $request - * @return RecordsFeed + * @param \Alchemy\Phrasea\Core $core + * @return Feed */ - public function __construct(Request $request) + public function __construct(\Alchemy\Phrasea\Core $core) { - $appbox = \appbox::get_instance(); - - parent::__construct($request); - + parent::__construct($core); + if ($this->is_single_grouping()) { $record = array_pop($this->selection->get_elements()); diff --git a/lib/Alchemy/Phrasea/Helper/RecordsAbstract.php b/lib/Alchemy/Phrasea/Helper/Record/Helper.php similarity index 82% rename from lib/Alchemy/Phrasea/Helper/RecordsAbstract.php rename to lib/Alchemy/Phrasea/Helper/Record/Helper.php index 6d8d9a9976..3616f8592b 100644 --- a/lib/Alchemy/Phrasea/Helper/RecordsAbstract.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Helper.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Helper; +namespace Alchemy\Phrasea\Helper\Record; use Symfony\Component\HttpFoundation\Request; @@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\Request; * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class RecordsAbstract +class Helper extends \Alchemy\Phrasea\Helper\Helper { /** @@ -92,45 +92,35 @@ class RecordsAbstract /** * - * @var basket_adapter + * @var \Entities\Basket */ protected $original_basket; - /** * - * @return action_move + * @param \Alchemy\Phrasea\Core $core + * @return Helper */ - public function __construct(Request $request) + public function __construct(\Alchemy\Phrasea\Core $core) { - $this->request = $request; + parent::__construct($core); + $this->selection = new \set_selection(); $appbox = \appbox::get_instance(); $usr_id = $appbox->get_session()->get_usr_id(); - + if (trim($request->get('ssel')) !== '') { - $basket = \basket_adapter::getInstance($appbox, $request->get('ssel'), $usr_id); - - if ($basket->is_grouping() && $this->flatten_groupings === true) - { - foreach ($basket->get_elements() as $basket_element) - { - /* @var $basket_element basket_element_adapter */ - $this->selection->add_element($basket_element->get_record()); - } - } - elseif($basket->is_grouping()) - { - $grouping = new record_adapter($basket->get_sbas_id(), $basket->get_record_id()); - $this->selection->add_element($grouping); - } - else - { - $this->selection->load_basket($basket); - $this->is_basket = true; - } - $this->original_basket = $basket; + $em = $this->getCore()->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $$repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($request->get('ssel'), $this->getCore()->getAuthenticatedUser()); + + $this->selection->load_basket($Basket); + + $this->is_basket = true; + $this->original_basket = $Basket; } else { @@ -159,7 +149,7 @@ class RecordsAbstract /** * If the original selection was a basket, returns the basket object * - * @return basket_adapter + * @return \Entities\Basket */ public function get_original_basket() { @@ -304,16 +294,6 @@ class RecordsAbstract return $this->selection->serialize_list(); } - public function get_request() - { - return $this->request; - } - - public function set_request($request) - { - $this->request = $request; - } - public function grep_records(Closure $closure) { foreach ($this->selection->get_elements() as $record) diff --git a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php index 5d85ad5329..bb58038a27 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php @@ -11,8 +11,7 @@ namespace Alchemy\Phrasea\Helper\Record; - -use Alchemy\Phrasea\Helper\RecordsAbstract as RecordHelper; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; use Symfony\Component\HttpFoundation\Request; /** @@ -23,33 +22,37 @@ use Symfony\Component\HttpFoundation\Request; */ class MoveCollection extends RecordHelper { + /** * * @var Array */ protected $required_rights = array('candeleterecord'); + /** * * @var Array */ protected $available_destinations; + /** * */ protected $works_on_unique_sbas = true; /** - * Constructor * - * @return action_move + * @param \Alchemy\Phrasea\Core $core + * @return MoveCollection */ - public function __construct(Request $request) + public function __construct(\Alchemy\Phrasea\Core $core) { - parent::__construct($request); + parent::__construct($core); $this->evaluate_destinations(); return $this; } + /** * Check which collections can receive the documents * @@ -60,14 +63,13 @@ class MoveCollection extends RecordHelper $this->available_destinations = array(); if (!$this->is_possible) - return $this; - $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); - - $this->available_destinations = array_keys($user->ACL()->get_granted_base(array('canaddrecord'), array($this->sbas_id))); + $this->available_destinations = array_keys( + $this->getCore()->getAuthenticatedUser()->ACL()->get_granted_base( + array('canaddrecord'), array($this->sbas_id) + ) + ); return $this; } @@ -95,8 +97,7 @@ class MoveCollection extends RecordHelper public function execute(Request $request) { $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); $base_dest = $user->ACL()->has_right_on_base($request->get('base_id'), 'canaddrecord') ? @@ -130,4 +131,5 @@ class MoveCollection extends RecordHelper return $this; } + } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Tooltip.php b/lib/Alchemy/Phrasea/Helper/Record/Tooltip.php index 7f586c0aeb..d43a749638 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Tooltip.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Tooltip.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Helper\Record; -use Alchemy\Phrasea\Helper\RecordsAbstract as RecordHelper; +use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; /** * diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index 657b7d1f0e..ba8d3b997b 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -19,11 +19,9 @@ use Symfony\Component\HttpFoundation\Request; * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class Edit +class Edit extends \Alchemy\Phrasea\Helper\Helper { - protected $request; - /** * * @var array @@ -42,19 +40,11 @@ class Edit */ protected $base_id; - /** - * - * @param Symfony\Component\HttpFoundation\Request $request - * @return module_admin_route_users_edit - */ - public function __construct(Request $request) + public function __construct(\Alchemy\Phrasea\Core $core) { + parent::__construct($core); $this->users = explode(';', $request->get('users')); - $this->request = $request; - $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $users = array(); foreach ($this->users as $usr_id) { @@ -83,23 +73,26 @@ class Edit protected function delete_user(\User_Adapter $user) { - $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); + $master = $this->getCore()->getAuthenticatedUser(); - $list = array_keys(\User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL()->get_granted_base(array('canadmin'))); + $list = array_keys($master->ACL()->get_granted_base(array('canadmin'))); $user->ACL()->revoke_access_from_bases($list); + if ($user->ACL()->is_phantom()) + { $user->delete(); - + } + return $this; } public function get_users_rights() { + $user = $this->getCore()->getAuthenticatedUser(); $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); - $list = array_keys(\User_Adapter::getInstance($session->get_usr_id(), $appbox)->ACL()->get_granted_base(array('canadmin'))); + + $list = array_keys($user->ACL()->get_granted_base(array('canadmin'))); $sql = "SELECT b.sbas_id, @@ -203,7 +196,7 @@ class Edit public function get_quotas() { - $this->base_id = (int) $this->request->get('base_id'); + $this->base_id = (int) $this->getCore()->getRequest()->get('base_id'); // $this->base_id = (int) $parm['base_id']; @@ -230,7 +223,7 @@ class Edit public function get_masks() { - $this->base_id = (int) $this->request->get('base_id'); + $this->base_id = (int) $this->getCore()->getRequest()->get('base_id'); $sql = "SELECT BIN(mask_and) AS mask_and, BIN(mask_xor) AS mask_xor FROM basusr @@ -334,7 +327,7 @@ class Edit public function get_time() { - $this->base_id = (int) $this->request->get('base_id'); + $this->base_id = (int) $this->getCore()->getRequest()->get('base_id'); $sql = "SELECT u.usr_id, time_limited, limited_from, limited_to FROM (usr u INNER JOIN basusr bu ON u.usr_id = bu.usr_id) @@ -540,7 +533,14 @@ class Edit return $this; } - $appbox = \appbox::get_instance(); + $user = User_adapter::getInstance(array_pop($this->users), appbox::get_instance()); + + if ($user->is_template()) + { + return $this; + } + + $appbox = appbox::get_instance(); $session = $appbox->get_session(); $request = \http_request::getInstance(); @@ -584,15 +584,45 @@ class Edit return $this; } + public function apply_template() + { + $appbox = appbox::get_instance(); + $session = $appbox->get_session(); + + $template = \User_adapter::getInstance($this->request->get('template'), $appbox); + + if ($template->get_template_owner()->get_id() != $session->get_usr_id()) + { + throw new \Exception_Forbidden('You are not the owner of the template'); + } + + $current_user = \User_adapter::getInstance($session->get_usr_id(), $appbox); + $base_ids = array_keys($current_user->ACL()->get_granted_base(array('canadmin'))); + + foreach ($this->users as $usr_id) + { + $user = \User_adapter::getInstance($usr_id, $appbox); + + if($user->is_template()) + { + continue; + } + + $user->ACL()->apply_model($template, $base_ids); + } + + return $this; + } + public function apply_quotas() { - $this->base_id = (int) $this->request->get('base_id'); + $this->base_id = (int) $this->getCore()->getRequest()->get('base_id'); foreach ($this->users as $usr_id) { $user = \User_Adapter::getInstance($usr_id, \appbox::get_instance()); - if ($this->request->get('quota')) - $user->ACL()->set_quotas_on_base($this->base_id, $this->request->get('droits'), $this->request->get('restes')); + if ($this->getCore()->getRequest()->get('quota')) + $user->ACL()->set_quotas_on_base($this->base_id, $this->getCore()->getRequest()->get('droits'), $this->getCore()->getRequest()->get('restes')); else $user->ACL()->remove_quotas_on_base($this->base_id); } @@ -602,12 +632,13 @@ class Edit public function apply_masks() { - $this->base_id = (int) $this->request->get('base_id'); + $request = $this->getCore()->getRequest(); + $this->base_id = (int) $request->get('base_id'); - $vand_and = $this->request->get('vand_and'); - $vand_or = $this->request->get('vand_or'); - $vxor_and = $this->request->get('vxor_and'); - $vxor_or = $this->request->get('vxor_or'); + $vand_and = $request->get('vand_and'); + $vand_or = $request->get('vand_or'); + $vxor_and = $request->get('vxor_and'); + $vxor_or = $request->get('vxor_or'); if ($vand_and && $vand_or && $vxor_and && $vxor_or) { @@ -624,13 +655,14 @@ class Edit public function apply_time() { + $request = $this->getCore()->getRequest(); + + $this->base_id = (int) $request->get('base_id'); - $this->base_id = (int) $this->request->get('base_id'); + $dmin = $request->get('dmin') ? new \DateTime($request->get('dmin')) : null; + $dmax = $request->get('dmax') ? new \DateTime($request->get('dmax')) : null; - $dmin = $this->request->get('dmin') ? new \DateTime($this->request->get('dmin')) : null; - $dmax = $this->request->get('dmax') ? new \DateTime($this->request->get('dmax')) : null; - - $activate = $this->request->get('limit'); + $activate = $request->get('limit'); foreach ($this->users as $usr_id) { diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index 961727fbbb..aceeddd4b5 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -19,10 +19,9 @@ use Symfony\Component\HttpFoundation\Request; * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -class Manage +class Manage extends \Alchemy\Phrasea\Helper\Helper { - protected $request; /** * * @var array @@ -39,18 +38,11 @@ class Manage */ protected $usr_id; - public function __construct(Request $request) - { - $this->request = $request; - - - return $this; - } - - public function search(Request $request) + public function search() { + $request = $this->getCore()->getRequest(); + $appbox = \appbox::get_instance(); - $session = $appbox->get_session(); $offset_start = (int) $request->get('offset_start'); $offset_start = $offset_start < 0 ? 0 : $offset_start; @@ -69,7 +61,7 @@ class Manage , 'offset_start' => $offset_start ); - $user = \User_Adapter::getInstance($session->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); $query = new \User_Query($appbox); if (is_array($request->get('base_id'))) @@ -110,18 +102,25 @@ class Manage if (is_null($v)) $this->query_parms[$k] = false; } + + + $query = new User_Query($appbox); + $templates = $query + ->only_templates(true) + ->execute()->get_results(); return array( 'users' => $this->results, 'parm' => $this->query_parms, 'invite_user' => $invite, - 'autoregister_user' => $autoregister + 'autoregister_user' => $autoregister, + 'templates' => $templates ); } public function create_newuser() { - $email = $this->request->get('value'); + $email = $this->getCore()->getRequest()->get('value'); if(!\mail::validateEmail($email)) { @@ -153,7 +152,7 @@ class Manage public function create_template() { - $name = $this->request->get('value'); + $name = $this->getCore()->getRequest()->get('value'); if(trim($name) === '') { @@ -161,7 +160,7 @@ class Manage } $appbox = \appbox::get_instance(); - $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); + $user = $this->getCore()->getAuthenticatedUser(); $created_user = \User_Adapter::create($appbox, $name, \random::generatePassword(16), null, false, false); $created_user->set_template($user); diff --git a/lib/Doctrine/Entities/BasketElement.php b/lib/Doctrine/Entities/BasketElement.php index ed0db18c92..059b7e7adf 100644 --- a/lib/Doctrine/Entities/BasketElement.php +++ b/lib/Doctrine/Entities/BasketElement.php @@ -22,214 +22,235 @@ require_once __DIR__ . '/../../classes/record/adapter.class.php'; */ class BasketElement { - /** - * @var integer $id - */ - private $id; - /** - * @var integer $record_id - */ - private $record_id; + /** + * @var integer $id + */ + private $id; - /** - * @var integer $sbas_id - */ - private $sbas_id; + /** + * @var integer $record_id + */ + private $record_id; - /** - * @var integer $ord - */ - private $ord; + /** + * @var integer $sbas_id + */ + private $sbas_id; - /** - * @var datetime $created - */ - private $created; + /** + * @var integer $ord + */ + private $ord; - /** - * @var datetime $updated - */ - private $updated; + /** + * @var datetime $created + */ + private $created; - /** - * @var Entities\Basket - */ - private $basket; + /** + * @var datetime $updated + */ + private $updated; + /** + * @var Entities\Basket + */ + private $basket; - /** - * Get id - * - * @return integer - */ - public function getId() + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set record_id + * + * @param integer $recordId + */ + public function setRecordId($recordId) + { + $this->record_id = $recordId; + } + + /** + * Get record_id + * + * @return integer + */ + public function getRecordId() + { + return $this->record_id; + } + + /** + * Set sbas_id + * + * @param integer $sbasId + */ + public function setSbasId($sbasId) + { + $this->sbas_id = $sbasId; + } + + /** + * Get sbas_id + * + * @return integer + */ + public function getSbasId() + { + return $this->sbas_id; + } + + /** + * Set ord + * + * @param integer $ord + */ + public function setOrd($ord) + { + $this->ord = $ord; + } + + /** + * Get ord + * + * @return integer + */ + public function getOrd() + { + return $this->ord; + } + + /** + * Set created + * + * @param datetime $created + */ + public function setCreated($created) + { + $this->created = $created; + } + + /** + * Get created + * + * @return datetime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set updated + * + * @param datetime $updated + */ + public function setUpdated($updated) + { + $this->updated = $updated; + } + + /** + * Get updated + * + * @return datetime + */ + public function getUpdated() + { + return $this->updated; + } + + /** + * Set basket + * + * @param Entities\Basket $basket + */ + public function setBasket(\Entities\Basket $basket) + { + $this->basket = $basket; + } + + /** + * Get basket + * + * @return Entities\Basket + */ + public function getBasket() + { + return $this->basket; + } + + public function getRecord() + { + return new \record_adapter($this->getSbasId(), $this->getRecordId(), $this->getOrd()); + } + + public function setRecord(\record_adapter $record) + { + $this->setRecordId($record->get_record_id()); + $this->setSbasId($record->get_sbas_id()); + } + + public function setLastInBasket() + { + $this->setOrd($this->getBasket()->getElements()->count() + 1); + } + + /** + * @var Entities\ValidationData + */ + private $validation_datas; + + public function __construct() + { + $this->validation_datas = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add validation_datas + * + * @param Entities\ValidationData $validationDatas + */ + public function addValidationData(\Entities\ValidationData $validationDatas) + { + $this->validation_datas[] = $validationDatas; + } + + /** + * Get validation_datas + * + * @return Doctrine\Common\Collections\Collection + */ + public function getValidationDatas() + { + return $this->validation_datas; + } + + /** + * + * @param \User_Adapter $user + * @return \Entities\ValidationData + */ + public function getUserValidationDatas(\User_Adapter $user) + { + foreach ($this->validation_datas as $validationData) { - return $this->id; + /* @var $validationData \Entities\ValidationData */ + if ($validationData->getParticipant()->getUser()->get_id() == $user->get_id()) + { + return $validationData; + } } - /** - * Set record_id - * - * @param integer $recordId - */ - public function setRecordId($recordId) - { - $this->record_id = $recordId; - } + throw new \Exception('There is no such participant'); + } - /** - * Get record_id - * - * @return integer - */ - public function getRecordId() - { - return $this->record_id; - } - - /** - * Set sbas_id - * - * @param integer $sbasId - */ - public function setSbasId($sbasId) - { - $this->sbas_id = $sbasId; - } - - /** - * Get sbas_id - * - * @return integer - */ - public function getSbasId() - { - return $this->sbas_id; - } - - /** - * Set ord - * - * @param integer $ord - */ - public function setOrd($ord) - { - $this->ord = $ord; - } - - /** - * Get ord - * - * @return integer - */ - public function getOrd() - { - return $this->ord; - } - - /** - * Set created - * - * @param datetime $created - */ - public function setCreated($created) - { - $this->created = $created; - } - - /** - * Get created - * - * @return datetime - */ - public function getCreated() - { - return $this->created; - } - - /** - * Set updated - * - * @param datetime $updated - */ - public function setUpdated($updated) - { - $this->updated = $updated; - } - - /** - * Get updated - * - * @return datetime - */ - public function getUpdated() - { - return $this->updated; - } - - /** - * Set basket - * - * @param Entities\Basket $basket - */ - public function setBasket(\Entities\Basket $basket) - { - $this->basket = $basket; - } - - /** - * Get basket - * - * @return Entities\Basket - */ - public function getBasket() - { - return $this->basket; - } - - public function getRecord() - { - return new \record_adapter($this->getSbasId(), $this->getRecordId(), $this->getOrd()); - } - - public function setRecord(\record_adapter $record) - { - $this->setRecordId($record->get_record_id()); - $this->setSbasId($record->get_sbas_id()); - } - - public function setLastInBasket() - { - $this->setOrd($this->getBasket()->getElements()->count() + 1); - } - /** - * @var Entities\ValidationData - */ - private $validation_datas; - - public function __construct() - { - $this->validation_datas = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Add validation_datas - * - * @param Entities\ValidationData $validationDatas - */ - public function addValidationData(\Entities\ValidationData $validationDatas) - { - $this->validation_datas[] = $validationDatas; - } - - /** - * Get validation_datas - * - * @return Doctrine\Common\Collections\Collection - */ - public function getValidationDatas() - { - return $this->validation_datas; - } } \ No newline at end of file diff --git a/lib/Doctrine/Entities/ValidationParticipant.php b/lib/Doctrine/Entities/ValidationParticipant.php index c588a8892a..654cac9a99 100644 --- a/lib/Doctrine/Entities/ValidationParticipant.php +++ b/lib/Doctrine/Entities/ValidationParticipant.php @@ -8,7 +8,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Entities; + /** * * @package @@ -28,19 +30,44 @@ class ValidationParticipant */ private $usr_id; - /** - * @var Entities\ValidationData - */ - private $datases; - /** * @var Entities\ValidationSession */ private $session; + /** + * @var datetime $reminded + */ + private $reminded = false; + + /** + * @var Entities\ValidationData + */ + private $datas; + + /** + * @var boolean $is_confirmed + */ + private $is_confirmed = false; + + /** + * @var boolean $can_agree + */ + private $can_agree = false; + + /** + * @var boolean $can_see_others + */ + private $can_see_others = false; + + /** + * @var boolean $is_aware + */ + private $is_aware = false; + public function __construct() { - $this->datases = new \Doctrine\Common\Collections\ArrayCollection(); + $this->datas = new \Doctrine\Common\Collections\ArrayCollection(); } /** @@ -76,21 +103,11 @@ class ValidationParticipant /** * Add datases * - * @param Entities\ValidationData $datases + * @param Entities\ValidationData $datas */ - public function addValidationData(\Entities\ValidationData $datases) + public function addValidationData(\Entities\ValidationData $datas) { - $this->datases[] = $datases; - } - - /** - * Get datases - * - * @return Doctrine\Common\Collections\Collection - */ - public function getDatases() - { - return $this->datases; + $this->datas[] = $datas; } /** @@ -113,12 +130,6 @@ class ValidationParticipant return $this->session; } - /** - * @var boolean $is_aware - */ - private $is_aware = false; - - /** * Set is_aware * @@ -144,10 +155,125 @@ class ValidationParticipant * @param \User_Adapter $user * @return ValidationParticipant */ - public function setParticipant(\User_Adapter $user) + public function setUser(\User_Adapter $user) { $this->usr_id = $user->get_id(); return $this; } + public function getUser() + { + return \User_Adapter::getInstance($this->getUsrId(), appbox::get_instance()); + } + + /** + * Set reminded + * + * @param datetime $reminded + */ + public function setReminded($reminded) + { + $this->reminded = $reminded; + } + + /** + * Get reminded + * + * @return datetime + */ + public function getReminded() + { + return $this->reminded; + } + + /** + * Get datas + * + * @return Doctrine\Common\Collections\Collection + */ + public function getDatas() + { + return $this->datas; + } + + /** + * Set is_confirmed + * + * @param boolean $isConfirmed + */ + public function setIsConfirmed($isConfirmed) + { + $this->is_confirmed = $isConfirmed; + } + + /** + * Get is_confirmed + * + * @return boolean + */ + public function getIsConfirmed() + { + return $this->is_confirmed; + } + + /** + * Set can_agree + * + * @param boolean $canAgree + */ + public function setCanAgree($canAgree) + { + $this->can_agree = $canAgree; + } + + /** + * Get can_agree + * + * @return boolean + */ + public function getCanAgree() + { + return $this->can_agree; + } + + /** + * Set can_see_others + * + * @param boolean $canSeeOthers + */ + public function setCanSeeOthers($canSeeOthers) + { + $this->can_see_others = $canSeeOthers; + } + + /** + * Get can_see_others + * + * @return boolean + */ + public function getCanSeeOthers() + { + return $this->can_see_others; + } + + public function isReleasable() + { + + if ($this->getIsConfirmed()) + { + return false; + } + + foreach ($this->getDatas() as $validation_data) + { + /* @var $validation_data \Entities\ValidationData */ + if ($validation_data->getAgreement() === null) + { + return false; + } + } + + return true; + } + } \ No newline at end of file diff --git a/lib/Doctrine/Entities/ValidationSession.php b/lib/Doctrine/Entities/ValidationSession.php index 53ecd9e063..42d05e2767 100644 --- a/lib/Doctrine/Entities/ValidationSession.php +++ b/lib/Doctrine/Entities/ValidationSession.php @@ -265,6 +265,24 @@ class ValidationSession return $this->participants; } + /** + * Get a participant + * + * @return Entities\ValidationParticipant + */ + public function getParticipant(\User_Adapter $user) + { + foreach ($this->getParticipants() as $participant) + { + if ($participant->getUser()->get_id() == $user->get_id()) + { + return $participant; + } + } + + throw new \Exception_NotFound('Particpant not found'); + } + /** * @var integer $initiator */ @@ -295,6 +313,11 @@ class ValidationSession return $this->initiator_id; } + public function isInitiator(\User_Adapter $user) + { + return $this->getInitiatorId() == $user->get_id(); + } + public function setInitiator(\User_Adapter $user) { $this->initiator_id = $user->get_id(); @@ -309,4 +332,55 @@ class ValidationSession } } + public function isFinished() + { + if (is_null($this->getExpires())) + { + return null; + } + + $date_obj = new DateTime(); + + return $date_obj > $this->getExpires(); + } + + public function getValidationString(\User_Adapter $user) + { + + if ($this->isInitiator($user)) + { + if ($this->isFinished()) + { + return sprintf( + _('Vous aviez envoye cette demande a %d utilisateurs') + , (count($this->getParticipants()) - 1) + ); + } + else + { + return sprintf( + _('Vous avez envoye cette demande a %d utilisateurs') + , (count($this->getParticipants()) - 1) + ); + } + } + else + { + if ($this->getParticipant($user)->getCanSeeOthers()) + { + return sprintf( + _('Processus de validation recu de %s et concernant %d utilisateurs') + , $this->getInitiator()->get_display_name() + , (count($this->getParticipants()) - 1)); + } + else + { + return sprintf( + _('Processus de validation recu de %s') + , $this->getInitiator()->get_display_name() + ); + } + } + } + } \ No newline at end of file diff --git a/lib/Doctrine/Repositories/BasketElementRepository.php b/lib/Doctrine/Repositories/BasketElementRepository.php new file mode 100644 index 0000000000..fb3c33d40c --- /dev/null +++ b/lib/Doctrine/Repositories/BasketElementRepository.php @@ -0,0 +1,73 @@ + $user->get_id(), + 'element_id' => $element_id + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getOneOrNullResult(); + } + + public function findElementsByRecord(\record_adapter $record) + { + $dql = 'SELECT e FROM Entities\BasketElement e + WHERE e.record_id = :record_id AND e.sbas_id = :sbas_id'; + + $params = array( + 'sbas_id' => $record->get_sbas_id(), + 'record_id' => $record_id->get_record_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + + /** + * + * @param type $element_id + * @param \User_Adapter $user + * @return \Entities\BasketELement + */ + public function findUserElement($element_id, \User_Adapter $user) + { + $element = $this->find($element_id); + + /* @var $element \Entities\BasketElement */ + if (null === $element) + { + throw new \Exception_NotFound(_('Element is not found')); + } + + if ($element->getBasket()->getowner()->get_id() != $user->get_id()) + { + throw new \Exception_Forbidden(_('You have not access to this basket element')); + } + + return $element; + } + +} \ No newline at end of file diff --git a/lib/Doctrine/Repositories/BasketRepository.php b/lib/Doctrine/Repositories/BasketRepository.php index 5ec96c8c0d..0bc3abb163 100644 --- a/lib/Doctrine/Repositories/BasketRepository.php +++ b/lib/Doctrine/Repositories/BasketRepository.php @@ -32,14 +32,13 @@ class BasketRepository extends EntityRepository { $dql = 'SELECT b FROM Entities\Basket b WHERE b.usr_id = :usr_id AND b.archived = false'; - + $query = $this->_em->createQuery($dql); $query->setParameters(array('usr_id' => $user->get_id())); return $query->getResult(); } - - + /** * Returns all baskets that are in validation session not expired and * where a specified user is participant (not owner) @@ -54,18 +53,27 @@ class BasketRepository extends EntityRepository JOIN s.participants p WHERE b.usr_id != ?1 AND p.usr_id = ?2 AND s.expires > CURRENT_TIMESTAMP()'; - + $query = $this->_em->createQuery($dql); $query->setParameters(array(1 => $user->get_id(), 2 => $user->get_id())); return $query->getResult(); } - + + /** + * Find a basket specified by his basket_id and his owner + * + * @throws \Exception_NotFound + * @throws \Exception_Forbidden + * @param type $basket_id + * @param \User_Adapter $user + * @return \Entities\Basket + */ public function findUserBasket($basket_id, \User_Adapter $user) { $basket = $this->find($basket_id); - /* @var $basket Entities\Basket */ + /* @var $basket \Entities\Basket */ if (null === $basket) { throw new \Exception_NotFound(_('Basket is not found')); @@ -79,4 +87,22 @@ class BasketRepository extends EntityRepository return $basket; } + public function findContainingRecord(\record_adapter $record) + { + + $dql = 'SELECT b FROM Entities\Basket b + JOIN b.elements e + WHERE e.record_id = :record_id AND e.sbas_id = e.sbas_id'; + + $params = array( + 'record_id' => $record->get_record_id(), + 'sbas_id' => $record->get_sbas_id() + ); + + $query = $this->_em->createQuery($dql); + $query->setParameters($params); + + return $query->getResult(); + } + } diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 08b4717058..36ad600b21 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -11,9 +11,10 @@ /** * - * @package + * @return \Alchemy\Phrasea\Core * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ require_once dirname(__FILE__) . '/classes/bootstrap.class.php'; -bootstrap::execute(); + +return bootstrap::execute(); diff --git a/lib/classes/ACL.class.php b/lib/classes/ACL.class.php index 3f8ffd0ff0..26949a568f 100644 --- a/lib/classes/ACL.class.php +++ b/lib/classes/ACL.class.php @@ -47,6 +47,7 @@ class ACL implements cache_cacheableInterface * @var Array */ protected $_rights_records_preview; + /** * * @var Array @@ -242,47 +243,88 @@ class ACL implements cache_cacheableInterface if (count($base_ids) == 0) return $this; - $params = array( - ':usr_id' => $this->user->get_id() - , ':template_id' => $template_user->get_id() + $sbas_ids = array(); + + foreach ($base_ids as $base_id) + { + $sbas_ids[] = phrasea::sbasFromBas($base_id); + } + + $sbas_ids = array_unique($sbas_ids); + + $sbas_rights = array('bas_manage', 'bas_modify_struct', 'bas_modif_th', 'bas_chupub'); + + $sbas_to_acces = array(); + $rights_to_give = array(); + + foreach ($template_user->ACL()->get_granted_sbas() as $databox) + { + $sbas_id = $databox->get_sbas_id(); + + if (!in_array($sbas_id, $sbas_ids)) + continue; + + + if (!$this->has_access_to_sbas($sbas_id)) + { + $sbas_to_acces[] = $sbas_id; + } + + foreach ($sbas_rights as $right) + { + if ($template_user->ACL()->has_right_on_sbas($sbas_id, $right)) + { + $rights_to_give[$sbas_id][$right] = '1'; + } + } + } + + $this->give_access_to_sbas($sbas_to_acces); + + foreach ($rights_to_give as $sbas_id => $rights) + { + $this->update_rights_to_sbas($sbas_id, $rights); + } + + $bas_rights = array('canputinalbum', 'candwnldhd' + , 'candwnldpreview', 'cancmd' + , 'canadmin', 'actif', 'canreport', 'canpush' + , 'canaddrecord', 'canmodifrecord', 'candeleterecord' + , 'chgstatus', 'imgtools' + , 'manage', 'modify_struct' + , 'nowatermark', 'order_master' ); - $sql = 'INSERT INTO sbasusr - (SELECT distinct null as sbasusr_id, sb.sbas_id, :usr_id as usr_id, bas_manage - , bas_modify_struct,bas_modif_th,bas_chupub - FROM sbasusr sb, bas b - WHERE b.base_id IN (' . implode(', ', $base_ids) . ') - AND b.sbas_id = sb.sbas_id - AND usr_id = :template_id)'; + $bas_to_acces = array(); + $rights_to_give = array(); - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); + foreach ($template_user->ACL()->get_granted_base() as $collection) + { + $base_id = $collection->get_base_id(); - $this->delete_data_from_cache(self::CACHE_RIGHTS_SBAS); + if (!in_array($base_id, $base_ids)) + continue; - $sql = "INSERT INTO basusr - (SELECT null as id, base_id, :usr_id as usr_id, canputinalbum - , candwnldhd, candwnldsubdef, candwnldpreview, cancmd - , canadmin, actif, canreport, canpush, now() as creationdate - , basusr_infousr, mask_and, mask_xor, restrict_dwnld - , month_dwnld_max, remain_dwnld, time_limited, limited_from - , limited_to, canaddrecord, canmodifrecord, candeleterecord - , chgstatus, '0000-00-00 00:00:00' as lastconn, imgtools - , manage, modify_struct, bas_manage, bas_modify_struct - , nowatermark, order_master - FROM basusr - WHERE usr_id = - (SELECT usr_id - FROM usr WHERE usr_id = :template_id) - AND base_id IN (" . implode(', ', $base_ids) . "))"; + if (!$this->has_access_to_base($base_id)) + { + $bas_to_acces[] = $base_id; + } - $stmt = $this->appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); + foreach ($bas_rights as $right) + { + if ($template_user->ACL()->has_right_on_base($base_id, $right)) + { + $rights_to_give[$base_id][$right] = '1'; + } + } + } - $this->inject_rights(); - $this->delete_data_from_cache(self::CACHE_RIGHTS_BAS); + $this->give_access_to_base($bas_to_acces); + + foreach ($rights_to_give as $sbas_id => $rights) + { + $this->update_rights_to_base($base_id, $rights); + } $this->user->set_last_template($template_user); @@ -315,7 +357,7 @@ class ACL implements cache_cacheableInterface { return false; } - + if (!isset($this->_rights_bas[$base_id][$right])) throw new Exception('right ' . $right . ' does not exists'); @@ -750,7 +792,7 @@ class ACL implements cache_cacheableInterface { if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited)) return $this; - + try { $this->_rights_bas = $this->get_data_from_cache(self::CACHE_RIGHTS_BAS); @@ -1399,12 +1441,12 @@ class ACL implements cache_cacheableInterface $this->load_rights_bas(); $datetime = new DateTime(); - + if (!isset($this->_limited[$base_id])) { return false; } - + $ret = ($this->_limited[$base_id]['dmin'] > $datetime || $this->_limited[$base_id]['dmax'] < $datetime); diff --git a/lib/classes/API/OAuth2/Adapter.class.php b/lib/classes/API/OAuth2/Adapter.class.php index ec5dcaddbd..c70cf6f381 100644 --- a/lib/classes/API/OAuth2/Adapter.class.php +++ b/lib/classes/API/OAuth2/Adapter.class.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__) . '/../../../vendor/oauth2/lib/OAuth2.inc'; +require_once __DIR__ . '/../../../vendor/oauth2/lib/OAuth2.inc'; /** * diff --git a/lib/classes/API/OAuth2/Autoloader.class.php b/lib/classes/API/OAuth2/Autoloader.class.php index 6fd696ef08..1099c5eac6 100644 --- a/lib/classes/API/OAuth2/Autoloader.class.php +++ b/lib/classes/API/OAuth2/Autoloader.class.php @@ -41,7 +41,7 @@ class API_OAuth2_Autoloader */ static public function autoload($class) { - if (file_exists($file = dirname(__FILE__) . '/../../../vendor/oauth2/lib/' . str_replace(array('_', "\0"), array('/', ''), $class) . '.inc')) + if (file_exists($file = __DIR__ . '/../../../vendor/oauth2/lib/' . str_replace(array('_', "\0"), array('/', ''), $class) . '.inc')) { require $file; } diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index 75b9fe69ec..fe09fe2e3e 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -34,6 +34,13 @@ class API_V1_adapter extends API_V1_Abstract */ protected $appbox; + /** + * Phraseanet Core + * + * @var \Alchemy\Phrasea\Core + */ + protected $core; + /** * API constructor * @@ -41,9 +48,10 @@ class API_V1_adapter extends API_V1_Abstract * @param appbox $appbox Appbox object * @return API_V1_adapter */ - public function __construct($auth_token, appbox &$appbox) + public function __construct($auth_token, appbox &$appbox, Alchemy\Phrasea\Core $core) { $this->appbox = $appbox; + $this->core = $core; return $this; } @@ -332,7 +340,7 @@ class API_V1_adapter extends API_V1_Abstract $ret = array(); foreach ($containers as $basket) { - $ret[$basket->get_ssel_id()] = $this->list_basket($basket); + $ret[$basket->getId()] = $this->list_basket($basket); } $result->set_datas(array("baskets" => $ret)); @@ -549,7 +557,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function add_record_tobasket(Request $request, $databox_id, $record_id) { - + } /** @@ -607,10 +615,18 @@ class API_V1_adapter extends API_V1_Abstract if (trim(strip_tags($name)) === '') throw new API_V1_exception_badrequest (); - $user = User_Adapter::getInstance($this->appbox->get_session()->get_usr_id(), $this->appbox); - $basket = basket_adapter::create($this->appbox, $name, $user); + $user = $this->core->getAuthenticatedUser(); + + $Basket = new \Entities\Basket(); + $Basket->setOwner($user); + $Basket->setName($name); + + $em = $this->core->getEntityManager(); + $em->persist($Basket); + $em->flush(); + $ret = array(); - $ret[$basket->get_ssel_id()] = $this->list_basket($basket); + $ret[$Basket->getId()] = $this->list_basket($Basket); $result->set_datas(array("basket" => $ret)); return $result; @@ -627,12 +643,15 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($request, $this); - $basket = basket_adapter::getInstance( - $this->appbox - , $basket_id - , $this->appbox->get_session()->get_usr_id() - ); - $basket->delete(); + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser()); + $em->remove($Basket); + $em->flush(); return $this->search_baskets($request); } @@ -647,21 +666,21 @@ class API_V1_adapter extends API_V1_Abstract public function get_basket(Request $request, $basket_id) { $result = new API_V1_result($request, $this); - try - { - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $result->set_datas( - array("basket_elements" => - array( - $basket->get_ssel_id() => $this->list_basket_content($basket) - ) - ) - ); - } - catch (Exception $e) - { - } + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser()); + + $result->set_datas( + array("basket_elements" => + array( + $Basket->getId() => $this->list_basket_content($Basket) + ) + ) + ); return $result; } @@ -669,16 +688,18 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve elements of one basket * - * @param basket_adapter $basket + * @param \Entities\Basket $Basket * @return type */ - protected function list_basket_content(basket_adapter $basket) + protected function list_basket_content(\Entities\Basket $Basket) { - $ret = $this->list_basket($basket); + $ret = $this->list_basket($Basket); + $ret['basket_elements'] = array(); - foreach ($basket->get_elements() as $basket_element) + + foreach ($Basket->getElements() as $basket_element) { - $ret['basket_elements'][$basket_element->get_sselcont_id()] = $this->list_basket_element($basket_element); + $ret['basket_elements'][$basket_element->getId()] = $this->list_basket_element($basket_element); } return $ret; @@ -687,23 +708,46 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve detailled informations about a basket element * - * @param basket_element_adapter $basket_element + * @param \Entities\BasketElement $basket_element * @return type */ - protected function list_basket_element(basket_element_adapter $basket_element) + protected function list_basket_element(\Entities\BasketElement $basket_element) { $ret = array( - 'basket_element_id' => $basket_element->get_sselcont_id() - , 'order' => $basket_element->get_order() - , 'record' => $this->list_record($basket_element->get_record()) - , 'validation_item' => $basket_element->is_validation_item() + 'basket_element_id' => $basket_element->getId() + , 'order' => $basket_element->getOrd() + , 'record' => $this->list_record($basket_element->getRecord()) + , 'validation_item' => !!$basket_element->getValidationDatas() ); - if ($basket_element->is_validation_item()) + if ($basket_element->getValidationDatas()) { - $ret['choices'] = $basket_element->get_choices(); - $ret['agreement'] = $basket_element->get_my_agreement(); - $ret['note'] = $basket_element->get_my_note(); + $choices = array(); + $agreement = $note = null; + + foreach ($basket_element->getValidationDatas() as $validation_datas) + { + $user = $validation_datas->getParticipant()->getUser(); + /* @var $validation_datas Entities\ValidationData */ + $choices[$user->get_id()] = array( + 'usr_id' => $user->get_id(), + 'usr_name' => $user->get_display_name(), + 'is_mine' => $user->get_id() == $this->core->getAuthenticatedUser()->get_id(), + 'agreement' => $validation_datas->getAgreement(), + 'updated_on' => $validation_datas->getUpdated()->format(DATE_ATOM), + 'note' => $validation_datas->getNote() + ); + + if($user->get_id() == $this->core->getAuthenticatedUser()->get_id()) + { + $agreement = $validation_datas->getAgreement(); + $note = $validation_datas->getNote(); + } + } + + $ret['choices'] = $choices(); + $ret['agreement'] = $agreement(); + $ret['note'] = $note(); } return $ret; @@ -721,12 +765,23 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $name = $request->get('name'); - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $basket->set_name($name); + + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser()); + $Basket->setName($name); + + $em->merge($Basket); + $em->flush(); + $result->set_datas( array( "basket" => - array($basket->get_ssel_id() => $this->list_basket_content($basket) + array($Basket->getId() => $this->list_basket_content($Basket) ) ) ); @@ -746,12 +801,23 @@ class API_V1_adapter extends API_V1_Abstract $result = new API_V1_result($request, $this); $desc = $request->get('description'); - $basket = basket_adapter::getInstance($this->appbox, $basket_id, $this->appbox->get_session()->get_usr_id()); - $basket->set_description($desc); + + $em = $this->core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($basket_id, $this->core->getAuthenticatedUser()); + $Basket->setDescription($desc); + + $em->merge($Basket); + $em->flush(); + $result->set_datas( array( "basket" => - array($basket->get_ssel_id() => $this->list_basket_content($basket) + array($Basket->getId() => $this->list_basket_content($Basket) ) ) ); @@ -791,7 +857,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function remove_publications(Request $request, $publication_id) { - + } /** @@ -919,7 +985,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function search_users(Request $request) { - + } /** @@ -929,7 +995,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function get_user_acces(Request $request, $usr_id) { - + } /** @@ -938,7 +1004,7 @@ class API_V1_adapter extends API_V1_Abstract */ public function add_user(Request $request) { - + } /** @@ -1032,7 +1098,6 @@ class API_V1_adapter extends API_V1_Abstract * @todo ajouter une option pour avoir les values serialisées * dans un cas multi */ - return array( 'meta_id' => $field->get_meta_id() , 'meta_structure_id' => $field->get_meta_struct_id() @@ -1044,30 +1109,53 @@ class API_V1_adapter extends API_V1_Abstract /** * Retirve information about one basket * - * @param basket_adapter $basket + * @param \Entities\Basket $basket * @return array */ - protected function list_basket(basket_adapter $basket) + protected function list_basket(\Entities\Basket $basket) { $ret = array( - 'created_on' => $basket->get_create_date()->format(DATE_ATOM) - , 'description' => $basket->get_description() - , 'name' => $basket->get_name() - , 'pusher_usr_id' => $basket->get_pusher() ? $basket->get_pusher()->get_id() : null - , 'ssel_id' => $basket->get_ssel_id() - , 'updated_on' => $basket->get_update_date()->format(DATE_ATOM) - , 'unread' => $basket->is_unread() + 'created_on' => $basket->getCreated()->format(DATE_ATOM) + , 'description' => $basket->getDescription() + , 'name' => $basket->getName() + , 'pusher_usr_id' => $basket->getPusherId() + , 'ssel_id' => $basket->getId() + , 'updated_on' => $basket->getUpdated()->format(DATE_ATOM) + , 'unread' => !$basket->getIsRead() ); - if ($basket->is_valid()) + if ($basket->getValidation()) { + $users = array(); + + foreach ($basket->getValidation()->getParticipants() as $participant) + { + /* @var $participant \Entities\ValidationParticipant */ + $user = $participant->getUser(); + + $users[$user->get_id()] = array( + 'usr_id' => $user->get_id(), + 'usr_name' => $user->get_display_name(), + 'confirmed' => $participant->getIsConfirmed(), + 'can_agree' => $participant->getCanAgree(), + 'can_see_others' => $participant->getCanSeeOthers() + ); + } + + $expires_on_atom = $basket->getValidation()->getExpires(); + + if ($expires_on_atom instanceof DateTime) + $expires_on_atom = $expires_on_atom->format(DATE_ATOM); + + $user = \User_Adapter::getInstance($this->appbox->get_session()->get_usr_id(), $this->appbox); + $ret = array_merge( array( - 'validation_users' => $basket->get_validating_users() - , 'validation_end_date' => ($basket->get_validation_end_date() instanceof DateTime ? $basket->get_validation_end_date()->format(DATE_ATOM) : null) - , 'validation_infos' => $basket->get_validation_infos() - , 'validation_confirmed' => $basket->is_confirmed() - , 'mine' => $basket->is_mine() + 'validation_users' => $users + , 'validation_end_date' => $expires_on_atom + , 'validation_infos' => $basket->getValidation()->getValidationString($user) + , 'validation_confirmed' => $basket->getValidation()->getParticipant($user)->getIsConfirmed() + , 'mine' => $basket->getValidation()->isInitiator($user) ) , $ret ); diff --git a/lib/classes/API/V1/result.class.php b/lib/classes/API/V1/result.class.php index cf8f410e83..4469c26413 100644 --- a/lib/classes/API/V1/result.class.php +++ b/lib/classes/API/V1/result.class.php @@ -1,6 +1,6 @@ is_template; } + public function get_template_owner() + { + return $this->template_owner; + } + public static function get_usr_id_from_email($email) { if(is_null($email)) @@ -1371,7 +1376,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $lngs = array(); - $path = dirname(__FILE__) . "/../../../locale"; + $path = __DIR__ . "/../../../locale"; if ($hdir = opendir($path)) { while (false !== ($file = readdir($hdir))) @@ -1393,95 +1398,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return $lngs; } - public static function detectLanguage(registryInterface $registry, $setLng = null) - { - $avLanguages = self::avLanguages(); - $sel = $askLng = $askLocale = ''; - - if ($setLng !== null) - { - $askLng = substr($setLng, 0, 2); - $askLocale = $setLng; - } - elseif (Session_Handler::isset_cookie('locale')) - { - $askLng = substr(Session_Handler::get_cookie('locale'), 0, 2); - $askLocale = Session_Handler::get_cookie('locale'); - } - elseif (strlen($registry->get('GV_default_lng')) > 2) - { - $askLng = substr($registry->get('GV_default_lng'), 0, 2); - $askLocale = $registry->get('GV_default_lng'); - } - - - if ($askLng != '' && isset($avLanguages[$askLng]) && isset($avLanguages[$askLng][$askLocale])) - { - $avLanguages[$askLng][$askLocale]['selected'] = true; - $sel = $askLocale; - } - - if ($sel === '' && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) - { - $languages = explode(';', $_SERVER['HTTP_ACCEPT_LANGUAGE']); - $found = false; - - foreach ($languages as $language) - { - $language = explode(',', strtolower($language)); - if (count($language) != 2) - continue; - - foreach ($language as $lang) - { - if (strpos($lang, '-') == 2 && strlen($lang) == 5) - { - $l = explode('-', $lang); - $l[0] = strtolower($l[0]); - $l[1] = strtoupper($l[1]); - - if ($sel != '') - { - $found = true; - break; - } - $lang = implode('_', $l); - if (isset($avLanguages[$l[0]])) - { - if (!isset($avLanguages[$l[0]][$lang])) - { - $lang = end(array_keys($avLanguages[$l[0]])); - } - $avLanguages[$l[0]][$lang]['selected'] = true; - $sel = $lang; - $found = true; - break; - } - } - } - if ($found) - break; - } - if (!$found && array_key_exists(substr($registry->get('GV_default_lng'), 0, 2), $avLanguages)) - { - $avLanguages[substr($registry->get('GV_default_lng'), 0, 2)][$registry->get('GV_default_lng')]['selected'] = true; - $sel = $registry->get('GV_default_lng'); - } - } - if ($sel == '') - { - $key = end(array_keys($avLanguages)); - $lang = end(array_keys($avLanguages[$key])); - $avLanguages[$key][$lang]['selected'] = true; - $sel = $lang; - } - Session_Handler::set_locale($sel); - - $sel = explode('_', $sel); - - return $avLanguages; - } - public static function get_wrong_email_users(appbox $appbox) { diff --git a/lib/classes/User/Query.class.php b/lib/classes/User/Query.class.php index 16a73a413a..4794c485c2 100644 --- a/lib/classes/User/Query.class.php +++ b/lib/classes/User/Query.class.php @@ -88,6 +88,11 @@ class User_Query implements User_QueryInterface * @var boolean */ protected $include_templates = false; + /** + * + * @var boolean + */ + protected $only_templates = false; /** * * @var Array @@ -123,10 +128,10 @@ class User_Query implements User_QueryInterface const SORT_FIRSTNAME= 'usr_prenom'; const SORT_LASTNAME= 'usr_nom'; const SORT_COMPANY = 'societe'; - const SORT_LOGIN = 'login'; + const SORT_LOGIN = 'usr_login'; const SORT_EMAIL = 'usr_mail'; const SORT_ID = 'usr_id'; - const SORT_CREATIONDATE = 'creationdate'; + const SORT_CREATIONDATE = 'usr_creationdate'; const SORT_COUNTRY = 'pays'; const SORT_LASTMODEL = 'lastModel'; @@ -191,18 +196,22 @@ class User_Query implements User_QueryInterface $sql .= ' AND usr_login NOT LIKE "(#deleted_%" '; - if ($this->include_invite) + if (!$this->include_invite) { $sql .= ' AND usr.invite=0 '; } - if ($this->include_templates === false) + if ($this->only_templates === true) + { + $sql .= ' AND model_of = ' . $session->get_usr_id(); + } + elseif ($this->include_templates === false) { $sql .= ' AND model_of=0'; } else { - $sql .= ' AND (model_of=0 OR model_of= ' . $session->get_usr_id() . ' ) '; + $sql .= ' AND (model_of=0 OR model_of = ' . $session->get_usr_id() . ' ) '; } $baslist = array(); @@ -355,6 +364,17 @@ class User_Query implements User_QueryInterface return $this; } + /** + * + * @param boolean $boolean + * @return User_Query + */ + public function only_templates($boolean) + { + $this->only_templates = !!$boolean; + + return $this; + } /** * @@ -390,6 +410,8 @@ class User_Query implements User_QueryInterface case self::SORT_COMPANY: case self::SORT_LOGIN: case self::SORT_EMAIL: + $sorter[$k] = ' usr.`' . $sort . '` COLLATE utf8_unicode_ci '; + break; case self::SORT_ID: case self::SORT_CREATIONDATE: case self::SORT_COUNTRY: @@ -410,7 +432,7 @@ class User_Query implements User_QueryInterface $sorter[$k] .= ' ASC '; break; case self::ORD_DESC: - $sorter[$k] .= ' ASC '; + $sorter[$k] .= ' DESC '; break; } } diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index fe42b0516b..101571e9a0 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -74,7 +74,7 @@ class appbox extends base $this->registry = $registry; $this->session = Session_Handler::getInstance($this); - require dirname(__FILE__) . '/../../config/connexion.inc'; + require __DIR__ . '/../../config/connexion.inc'; $this->host = $hostname; $this->port = $port; @@ -371,15 +371,17 @@ class appbox extends base protected function post_upgrade(Setup_Upgrade &$upgrader) { + $Core = bootstrap::getCore(); + $upgrader->add_steps(1 + count($this->get_databoxes())); - $this->apply_patches($this->get_version(), GV_version, true, $upgrader); - $this->setVersion(GV_version); + $this->apply_patches($this->get_version(), $Core->getVersion()->getNumber(), true, $upgrader); + $this->setVersion($Core->getVersion()->getNumber()); $upgrader->add_steps_complete(1); foreach ($this->get_databoxes() as $databox) { - $databox->apply_patches($databox->get_version(), GV_version, true, $upgrader); - $databox->setVersion(GV_version); + $databox->apply_patches($databox->get_version(), $Core->getVersion()->getNumber(), true, $upgrader); + $databox->setVersion($Core->getVersion()->getNumber()); $upgrader->add_steps_complete(1); } @@ -407,7 +409,7 @@ class appbox extends base { $credentials['dbname'] = $dbname; } - $connexion = dirname(__FILE__) . "/../../config/connexion.inc"; + $connexion = __DIR__ . "/../../config/connexion.inc"; if (is_file($connexion)) unlink($connexion); @@ -420,7 +422,7 @@ class appbox extends base } if (!file_put_contents($connexion, $connexionINI, FILE_APPEND) !== false) - throw new Exception(sprintf(_('Impossible d\'ecrire dans le dossier %s'), dirname(dirname(__FILE__)) . "/config/")); + throw new Exception(sprintf(_('Impossible d\'ecrire dans le dossier %s'), dirname(__DIR__) . "/config/")); if (function_exists('chmod')) chmod($connexion, 0700); @@ -543,7 +545,7 @@ class appbox extends base public static function list_databox_templates() { $files = array(); - $dir = new DirectoryIterator(dirname(__FILE__) . '/../conf.d/data_templates/'); + $dir = new DirectoryIterator(__DIR__ . '/../conf.d/data_templates/'); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index 2aaab24e52..c6ad4c2fca 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -257,9 +257,10 @@ abstract class base implements cache_cacheableInterface public function upgradeavailable() { + $Core = bootstrap::getCore(); if ($this->get_version()) - return version_compare(GV_version, $this->get_version(), '>'); + return version_compare($Core->getVersion()->getNumber(), $this->get_version(), '>'); else return true; @@ -267,7 +268,7 @@ abstract class base implements cache_cacheableInterface protected function upgradeDb($apply_patches, Setup_Upgrade &$upgrader) { - require_once dirname(__FILE__) . '/../version.inc'; + require_once __DIR__ . '/../version.inc'; $recommends = array(); @@ -338,10 +339,12 @@ abstract class base implements cache_cacheableInterface } $current_version = $this->get_version(); + $Core = bootstrap::getCore(); + $upgrader->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); if ($apply_patches) { - $this->apply_patches($current_version, GV_version, false, $upgrader); + $this->apply_patches($current_version, $Core->getVersion()->getNumber(), false, $upgrader); } $upgrader->add_steps_complete(1); @@ -390,7 +393,7 @@ abstract class base implements cache_cacheableInterface return $this; - $structure = simplexml_load_file(dirname(__FILE__) . "/../../lib/conf.d/bases_structure.xml"); + $structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml"); if (!$structure) throw new Exception('Unable to load schema'); @@ -418,8 +421,8 @@ abstract class base implements cache_cacheableInterface $this->createTable($table); } - if (defined('GV_version')) - $this->setVersion(GV_version); + $Core = bootstrap::getCore(); + $this->setVersion($Core->getVersion()->getNumber()); return $this; } diff --git a/lib/classes/basket/element/adapter.class.php b/lib/classes/basket/element/adapter.class.php index 67ab3a32ca..7ae6a0797f 100644 --- a/lib/classes/basket/element/adapter.class.php +++ b/lib/classes/basket/element/adapter.class.php @@ -127,7 +127,7 @@ class basket_element_adapter implements cache_cacheableInterface } catch (Exception $e) { - + } $sql = 'SELECT s.usr_id as owner, v.id as validate_id, v.can_see_others, @@ -149,7 +149,7 @@ class basket_element_adapter implements cache_cacheableInterface } catch (Exception $e) { - + } $first = true; @@ -493,7 +493,7 @@ class basket_element_adapter implements cache_cacheableInterface } catch (Exception $e) { - + } } } @@ -518,7 +518,6 @@ class basket_element_adapter implements cache_cacheableInterface $note = strip_tags($note); if (!$this->validate_id) - return false; $appbox = appbox::get_instance(); @@ -554,7 +553,7 @@ class basket_element_adapter implements cache_cacheableInterface } catch (Exception $e) { - + } return $this; @@ -596,7 +595,9 @@ class basket_element_adapter implements cache_cacheableInterface foreach ($this->choices as $key => $value) { if (trim($value['note']) != '') + { $n++; + } } return $n; diff --git a/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php b/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php index 3fbf455407..5eac57d440 100644 --- a/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php +++ b/lib/classes/binaryAdapter/video/progressive/moovRelocator.class.php @@ -1,5 +1,5 @@ closeCursor(); if ($row) - return self::get_instance((int) $row['sbas_id']); try @@ -463,7 +462,7 @@ class databox extends base } catch (Exception $e) { - + } $sql = 'USE `' . $dbname . '`'; @@ -575,7 +574,6 @@ class databox extends base public function get_meta_structure() { if ($this->meta_struct) - return $this->meta_struct; try @@ -698,7 +696,6 @@ class databox extends base } } if ($n > $limit) - return true; return false; @@ -725,7 +722,7 @@ class databox extends base public static function get_available_metadatas() { $available_fields = array(); - $dir = dirname(__FILE__) . '/metadata/description/'; + $dir = __DIR__ . '/metadata/description/'; $registry = registry::get_instance(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { @@ -960,7 +957,14 @@ class databox extends base $this->saveStructure($dom_struct); $type = isset($field['type']) ? $field['type'] : 'string'; - $type = in_array($type, array(databox_field::TYPE_DATE, databox_field::TYPE_NUMBER, databox_field::TYPE_TEXT)) ? $type : databox_field::TYPE_TEXT; + $type = in_array($type + , array( + databox_field::TYPE_DATE + , databox_field::TYPE_NUMBER + , databox_field::TYPE_STRING + , databox_field::TYPE_TEXT + ) + ) ? $type : databox_field::TYPE_STRING; $meta_struct_field = databox_field::create($this, $fname); $meta_struct_field @@ -968,7 +972,7 @@ class databox extends base ->set_indexable(isset($field['index']) ? $field['index'] : '1') ->set_type($type) ->set_tbranch(isset($field['tbranch']) ? $field['tbranch'] : '') - ->set_thumbtitle(isset($field['thumbtitle']) ? $field['thumbtitle'] : '0') + ->set_thumbtitle(isset($field['thumbtitle']) ? $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0')) ->set_multi(isset($field['multi']) ? $field['multi'] : 0) ->set_report(isset($field['report']) ? $field['report'] : '1') ->save(); @@ -979,7 +983,7 @@ class databox extends base } catch (Exception $e) { - + } if (isset($field['regname'])) @@ -1213,7 +1217,6 @@ class databox extends base public function get_structure() { if ($this->structure) - return $this->structure; $this->structure = $this->retrieve_structure(); @@ -1228,7 +1231,7 @@ class databox extends base } catch (Exception $e) { - + } $structure = null; @@ -1254,7 +1257,6 @@ class databox extends base public function get_cterms() { if ($this->cterms) - return $this->cterms; $sql = "SELECT value FROM pref WHERE prop='cterms'"; @@ -1421,7 +1423,6 @@ class databox extends base public function get_cgus() { if ($this->cgus) - return $this->cgus; $this->load_cgus(); @@ -1439,7 +1440,7 @@ class databox extends base } catch (Exception $e) { - + } $sql = 'SELECT value, locale, updated_on FROM pref WHERE prop ="ToU"'; diff --git a/lib/classes/databox/field.class.php b/lib/classes/databox/field.class.php index cb83c8b037..f08f639d2b 100644 --- a/lib/classes/databox/field.class.php +++ b/lib/classes/databox/field.class.php @@ -124,6 +124,7 @@ class databox_field implements cache_cacheableInterface const TYPE_TEXT = "text"; const TYPE_DATE = "date"; + const TYPE_STRING = "string"; const TYPE_NUMBER = "number"; /** @@ -176,7 +177,7 @@ class databox_field implements cache_cacheableInterface $this->required = !!$row['required']; $this->multi = !!$row['multi']; $this->report = !!$row['report']; - $this->type = $row['type']; + $this->type = $row['type'] ?: self::TYPE_STRING; $this->tbranch = $row['tbranch']; if ($row['dces_element']) { diff --git a/lib/classes/eventsmanager/broker.class.php b/lib/classes/eventsmanager/broker.class.php index 2b15317d02..4f3ea9fbf6 100644 --- a/lib/classes/eventsmanager/broker.class.php +++ b/lib/classes/eventsmanager/broker.class.php @@ -67,17 +67,17 @@ class eventsmanager_broker { $iterators_pool = array(); - $root = dirname(__FILE__) . '/../../'; + $root = __DIR__ . '/../../'; if ($type == 'event') { - $iterators_pool['event'][] = new DirectoryIterator(dirname(__FILE__) . '/event/'); - if (file_exists(dirname(__FILE__) . '/event/')) - $iterators_pool['event'][] = new DirectoryIterator(dirname(__FILE__) . '/event/'); + $iterators_pool['event'][] = new DirectoryIterator(__DIR__ . '/event/'); + if (file_exists(__DIR__ . '/event/')) + $iterators_pool['event'][] = new DirectoryIterator(__DIR__ . '/event/'); } if ($type == 'notify') { - $iterators_pool['notify'][] = new DirectoryIterator(dirname(__FILE__) . '/notify/'); + $iterators_pool['notify'][] = new DirectoryIterator(__DIR__ . '/notify/'); } $ret = array(); diff --git a/lib/classes/module/console/aboutAuthors.class.php b/lib/classes/module/console/aboutAuthors.class.php index 50e9698a6d..5ed63eac7f 100644 --- a/lib/classes/module/console/aboutAuthors.class.php +++ b/lib/classes/module/console/aboutAuthors.class.php @@ -37,7 +37,7 @@ class module_console_aboutAuthors extends Command public function execute(InputInterface $input, OutputInterface $output) { - $output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../AUTHORS')); + $output->writeln(file_get_contents(__DIR__ . '/../../../../AUTHORS')); return; } diff --git a/lib/classes/module/console/aboutLicense.class.php b/lib/classes/module/console/aboutLicense.class.php index 246140dbbc..04c6ccf958 100644 --- a/lib/classes/module/console/aboutLicense.class.php +++ b/lib/classes/module/console/aboutLicense.class.php @@ -37,7 +37,7 @@ class module_console_aboutLicense extends Command public function execute(InputInterface $input, OutputInterface $output) { - $output->writeln(file_get_contents(dirname(__FILE__) . '/../../../../LICENSE')); + $output->writeln(file_get_contents(__DIR__ . '/../../../../LICENSE')); return; } diff --git a/lib/classes/module/console/schedulerStart.class.php b/lib/classes/module/console/schedulerStart.class.php index 52afd000be..d0b2591f55 100644 --- a/lib/classes/module/console/schedulerStart.class.php +++ b/lib/classes/module/console/schedulerStart.class.php @@ -45,7 +45,7 @@ class module_console_schedulerStart extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $scheduler = new task_Scheduler(); $scheduler->run($output, true); diff --git a/lib/classes/module/console/schedulerState.class.php b/lib/classes/module/console/schedulerState.class.php index 4861e02224..cedf9fc9f1 100644 --- a/lib/classes/module/console/schedulerState.class.php +++ b/lib/classes/module/console/schedulerState.class.php @@ -40,7 +40,7 @@ class module_console_schedulerState extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $appbox = appbox::get_instance(); $task_manager = new task_manager($appbox); diff --git a/lib/classes/module/console/schedulerStop.class.php b/lib/classes/module/console/schedulerStop.class.php index b806770dd1..ab487f4157 100644 --- a/lib/classes/module/console/schedulerStop.class.php +++ b/lib/classes/module/console/schedulerStop.class.php @@ -40,7 +40,7 @@ class module_console_schedulerStop extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $appbox = appbox::get_instance(); $task_manager = new task_manager($appbox); diff --git a/lib/classes/module/console/systemBackupDB.class.php b/lib/classes/module/console/systemBackupDB.class.php index f477da44c3..6384e76bfc 100644 --- a/lib/classes/module/console/systemBackupDB.class.php +++ b/lib/classes/module/console/systemBackupDB.class.php @@ -31,7 +31,7 @@ class module_console_systemBackupDB extends Command $dir = sprintf( '%s/config/' - , dirname(dirname(dirname(dirname(dirname(__FILE__))))) + , dirname(dirname(dirname(dirname(__DIR__)))) ); $this->setDescription('Backup Phraseanet Databases'); @@ -48,7 +48,7 @@ class module_console_systemBackupDB extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $output->write('Phraseanet is going to be backup...', true); diff --git a/lib/classes/module/console/systemClearCache.class.php b/lib/classes/module/console/systemClearCache.class.php index 262f20fb83..bb597514da 100644 --- a/lib/classes/module/console/systemClearCache.class.php +++ b/lib/classes/module/console/systemClearCache.class.php @@ -44,8 +44,8 @@ class module_console_systemClearCache extends Command ->exclude('.git') ->exclude('.svn') ->in(array( - dirname(__FILE__) . '/../../../../tmp/cache_minify/' - , dirname(__FILE__) . '/../../../../tmp/cache_twig/' + __DIR__ . '/../../../../tmp/cache_minify/' + , __DIR__ . '/../../../../tmp/cache_twig/' )) ; $count = 1; @@ -59,8 +59,8 @@ class module_console_systemClearCache extends Command $finder ->directories() ->in(array( - dirname(__FILE__) . '/../../../../tmp/cache_minify' - , dirname(__FILE__) . '/../../../../tmp/cache_twig' + __DIR__ . '/../../../../tmp/cache_minify' + , __DIR__ . '/../../../../tmp/cache_twig' )) ->exclude('.git') ->exclude('.svn') diff --git a/lib/classes/module/console/systemTemplateGenerator.class.php b/lib/classes/module/console/systemTemplateGenerator.class.php index 5ca41ac1ba..9410329704 100644 --- a/lib/classes/module/console/systemTemplateGenerator.class.php +++ b/lib/classes/module/console/systemTemplateGenerator.class.php @@ -36,16 +36,16 @@ class module_console_systemTemplateGenerator extends Command public function execute(InputInterface $input, OutputInterface $output) { - require_once dirname(__FILE__) . '/../../../../lib/vendor/Twig/lib/Twig/Autoloader.php'; - require_once dirname(__FILE__) . '/../../../../lib/vendor/Twig-extensions/lib/Twig/Extensions/Autoloader.php'; + require_once __DIR__ . '/../../../../lib/vendor/Twig/lib/Twig/Autoloader.php'; + require_once __DIR__ . '/../../../../lib/vendor/Twig-extensions/lib/Twig/Extensions/Autoloader.php'; Twig_Autoloader::register(); Twig_Extensions_Autoloader::register(); - $tplDir = dirname(__FILE__) . '/../../../../templates/'; - $tmpDir = dirname(__FILE__) . '/../../../../tmp/cache_twig/'; + $tplDir = __DIR__ . '/../../../../templates/'; + $tmpDir = __DIR__ . '/../../../../tmp/cache_twig/'; $loader = new Twig_Loader_Filesystem($tplDir); $twig = new Twig_Environment($loader, array( diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php index 22d62f2a66..b8de9d1b5e 100644 --- a/lib/classes/module/console/systemUpgrade.class.php +++ b/lib/classes/module/console/systemUpgrade.class.php @@ -39,9 +39,9 @@ class module_console_systemUpgrade extends Command if (!setup::is_installed()) { - if (file_exists(dirname(__FILE__) . "/../../../../config/connexion.inc") - && !file_exists(dirname(__FILE__) . "/../../../../config/config.inc") - && file_exists(dirname(__FILE__) . "/../../../../config/_GV.php")) + if (file_exists(__DIR__ . "/../../../../config/connexion.inc") + && !file_exists(__DIR__ . "/../../../../config/config.inc") + && file_exists(__DIR__ . "/../../../../config/_GV.php")) { $output->writeln('This version of Phraseanet requires a config/config.inc'); @@ -76,7 +76,7 @@ class module_console_systemUpgrade extends Command } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $output->write('Phraseanet is going to be upgraded', true); $dialog = $this->getHelperSet()->get('dialog'); diff --git a/lib/classes/module/console/tasklist.class.php b/lib/classes/module/console/tasklist.class.php index 58fd108ed0..91da2498d5 100644 --- a/lib/classes/module/console/tasklist.class.php +++ b/lib/classes/module/console/tasklist.class.php @@ -42,7 +42,7 @@ class module_console_tasklist extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $appbox = appbox::get_instance(); $task_manager = new task_manager($appbox); diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index 6e22d6fd24..da62654ed0 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -50,7 +50,7 @@ class module_console_taskrun extends Command throw new RuntimeException('Phraseanet is not set up'); } - require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; + require_once __DIR__ . '/../../../../lib/bootstrap.php'; $task_id = (int) $input->getArgument('task_id'); diff --git a/lib/classes/patch/320aa.class.php b/lib/classes/patch/320aa.class.php index a3b28f1fe6..5468abc4d5 100644 --- a/lib/classes/patch/320aa.class.php +++ b/lib/classes/patch/320aa.class.php @@ -54,9 +54,9 @@ class patch_320aa implements patchInterface function apply(base &$appbox) { - if(is_file(dirname(__FILE__) . '/../../../config/_GV.php')) - require dirname(__FILE__) . '/../../../config/_GV.php'; - require dirname(__FILE__) . '/../../../lib/conf.d/_GV_template.inc'; + if(is_file(__DIR__ . '/../../../config/_GV.php')) + require __DIR__ . '/../../../config/_GV.php'; + require __DIR__ . '/../../../lib/conf.d/_GV_template.inc'; define('GV_STATIC_URL', ''); define('GV_sphinx', false); diff --git a/lib/classes/phrasea.class.php b/lib/classes/phrasea.class.php index 70b22feae2..07d05537ce 100644 --- a/lib/classes/phrasea.class.php +++ b/lib/classes/phrasea.class.php @@ -105,7 +105,7 @@ class phrasea public static function start() { - require (dirname(__FILE__) . '/../../config/connexion.inc'); + require (__DIR__ . '/../../config/connexion.inc'); if (!extension_loaded('phrasea2')) printf("Missing Extension php-phrasea"); @@ -283,7 +283,7 @@ class phrasea putenv('LANGUAGE=' . $locale . '.' . $codeset); bind_textdomain_codeset($textdomain, 'UTF-8'); - bindtextdomain($textdomain, dirname(__FILE__) . '/../../locale/'); + bindtextdomain($textdomain, __DIR__ . '/../../locale/'); setlocale(LC_ALL , $locale . '.UTF-8' , $locale . '.UTF8' @@ -497,7 +497,7 @@ class phrasea else { $request->set_code($code); - include(dirname(__FILE__) . '/../../www/include/error.php'); + include(__DIR__ . '/../../www/include/error.php'); } die(); break; diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index 22bf8b7514..f5eeb1604b 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -479,23 +479,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function move_to_collection(collection &$collection, appbox &$appbox) { - $sql = 'UPDATE sselcont - SET base_id = :base_id - WHERE record_id = :record_id - AND base_id IN (SELECT base_id FROM bas WHERE sbas_id = :sbas_id)'; - - $params = array( - ':base_id' => $collection->get_base_id(), - ':record_id' => $this->get_record_id(), - ':sbas_id' => $this->get_sbas_id() - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $stmt->closeCursor(); - - basket_adapter::revoke_baskets_record($this, $appbox); - $sql = "UPDATE record SET coll_id = :coll_id WHERE record_id =:record_id"; $params = array( @@ -1047,7 +1030,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface $base_url = ''; $original_file = $subdef_def = false; - $subdefs = $this->get_databox()->get_subdef_structure(); foreach ($subdefs as $type => $datas) @@ -1068,7 +1050,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface try { $value = $this->get_subdef($name); - $original_file = p4string::addEndSlash($value['path']) . $value['file']; + $original_file = p4string::addEndSlash($value->get_path()) . $value->get_file(); unlink($original_file); } catch (Exception $e) @@ -1083,7 +1065,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface if (trim($subdef_def->get_baseurl()) !== '') { $base_url = str_replace( - array((string) $subdef_def->get_path(), $newfilename), array((string) $subdef_def->get_baseurl(), ''), $path_file_dest + array((string) $subdef_def->get_path(), $newfilename) + , array((string) $subdef_def->get_baseurl(), '') + , $path_file_dest ); } @@ -1093,7 +1077,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface $sql = 'DELETE FROM subdef WHERE record_id= :record_id AND name=:name'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $this->record_id, ':name' => $name)); + $stmt->execute( + array( + ':record_id' => $this->record_id + , ':name' => $name + ) + ); $registry = registry::get_instance(); @@ -1128,7 +1117,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $sql = 'UPDATE record SET moddate=NOW() WHERE record_id=:record_id'; $stmt = $connbas->prepare($sql); - $stmt->bindParam(':record_id', $this->get_record_id()); + $stmt->execute(array(':record_id' => $this->get_record_id())); $stmt->execute(); $this->delete_data_from_cache(self::CACHE_SUBDEFS); @@ -1714,21 +1703,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface $stmt->execute(array(':record_id' => $this->get_record_id())); $stmt->closeCursor(); - $sql = 'SELECT s.ssel_id, c.sselcont_id, s.usr_id - FROM sselcont c, ssel s - WHERE c.base_id = :base_id AND c.record_id = :record_id - AND s.ssel_id = c.ssel_id'; - $stmt = $conn->prepare($sql); - $stmt->execute(array(':record_id' => $this->get_record_id(), ':base_id' => $this->get_base_id())); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - - foreach ($rs as $row) + $em = bootstrap::getCore()->getEntityManager(); + + $repository = $em->getRepository('\Entities\BasketElement'); + + /* @var $repository \Repositories\BasketElementRepository */ + foreach($repository->findElementsByRecord($this) as $basket_element) { - $basket = basket_adapter::getInstance($appbox, $row['ssel_id'], $row['usr_id']); - $basket->remove_from_ssel($row['sselcont_id']); + $em->remove($basket_element); } - - $stmt->closeCursor(); + + $em->flush(); foreach ($ftodel as $f) @unlink($f); @@ -1935,37 +1920,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_container_baskets() { - if ($this->container_basket) - return $this->container_basket; - - $appbox = appbox::get_instance(); - $session = $appbox->get_session(); - - $baskets = array(); - $sql = 'SELECT s.ssel_id FROM ssel s, sselcont c - WHERE s.ssel_id = c.ssel_id - AND c.base_id = :base_id AND record_id = :record_id - AND usr_id = :usr_id AND temporaryType="0"'; - - $params = array( - ':base_id' => $this->get_base_id() - , ':record_id' => $this->get_record_id() - , ':usr_id' => $session->get_usr_id() - ); - - $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute($params); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) - { - $baskets[$row['ssel_id']] = basket_adapter::getInstance($appbox, $row['ssel_id'], $session->get_usr_id()); - } - - $this->container_basket = $baskets; - - return $this->container_basket; + $Core = bootstrap::getCore(); + $em = $Core->getEntityManager(); + + $repo = $em->getRepository('\Entities\Baskets'); + + /* @var $$repo \Repositories\BasketRepository */ + return $repo->findContainingRecord($this); } /** diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index 5f5cf88dc2..72303206f7 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -89,6 +89,7 @@ class record_preview extends record_adapter public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine =null, $query='') { $appbox = appbox::get_instance(); + $Core = bootstrap::getCore(); $number = null; $this->env = $env; @@ -139,37 +140,42 @@ class record_preview extends record_adapter break; case "BASK": - $basket = basket_adapter::getInstance($appbox, $contId, $appbox->get_session()->get_usr_id()); + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($contId, $Core->getAuthenticatedUser()); - $this->container = $basket; - $this->total = count($basket->get_elements()); + /* @var $Basket \Entities\Basket */ + $this->container = $Basket; + $this->total = $Basket->getElements()->count(); $i = 0; $first = true; - foreach ($basket->get_elements() as $element) + foreach ($Basket->getElements() as $element) { + /* @var $element \Entities\BasketElement */ $i++; if ($first) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); - $this->name = $basket->get_name(); - $number = $element->get_order(); + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); + $this->name = $Basket->getName(); + $number = $element->getOrd(); } $first = false; - if ($element->get_order() == $pos) + if ($element->getOrd() == $pos) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); - $this->name = $basket->get_name(); - $number = $element->get_order(); + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); + $this->name = $Basket->getName(); + $number = $element->getOrd(); } } break; case "FEED": $entry = Feed_Entry_Adapter::load_from_id($appbox, $contId); -// $basket = basket_adapter::getInstance($appbox, $contId, $appbox->get_session()->get_usr_id()); $this->container = $entry; $this->total = count($entry->get_content()); diff --git a/lib/classes/registry.class.php b/lib/classes/registry.class.php index e8c13dfd3b..ada342d04d 100644 --- a/lib/classes/registry.class.php +++ b/lib/classes/registry.class.php @@ -41,7 +41,7 @@ class registry implements registryInterface */ public static function get_instance() { - $prefix = crc32(dirname(__FILE__)); + $prefix = crc32(__DIR__); if (!self::$_instance instanceof self) self::$_instance = new self(new cache_opcode_adapter($prefix)); @@ -57,8 +57,8 @@ class registry implements registryInterface { $this->cache = $cache; - require dirname(__FILE__) . '/../../config/config.inc'; - $this->cache->set('GV_RootPath', dirname(dirname(dirname(__FILE__))) . '/'); + require __DIR__ . '/../../config/config.inc'; + $this->cache->set('GV_RootPath', dirname(dirname(__DIR__)) . '/'); $this->cache->set('GV_ServerName', p4string::addEndSlash($servername)); $this->cache->set('GV_debug', !!$debug); $this->cache->set('GV_maintenance', !!$maintenance); diff --git a/lib/classes/searchEngine/adapter/sphinx/engine.class.php b/lib/classes/searchEngine/adapter/sphinx/engine.class.php index 29b2c72346..124bb85f12 100644 --- a/lib/classes/searchEngine/adapter/sphinx/engine.class.php +++ b/lib/classes/searchEngine/adapter/sphinx/engine.class.php @@ -1,6 +1,6 @@ get_session(); $registry = $appbox->get_registry(); - - $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - + $user = $Core->getAuthenticatedUser(); + $download_list = array(); $remain_hd = array(); if ($sstid != "") { - $basket = basket_adapter::getInstance($appbox, $sstid, $user->get_id()); + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($sstid, $user); - foreach ($basket->get_elements() as $basket_element) + foreach ($Basket->getElements() as $basket_element) { - $base_id = $basket_element->get_record()->get_base_id(); - $record_id = $basket_element->get_record()->get_record_id(); + /* @var $basket_element \Entities\BasketElement */ + $base_id = $basket_element->getRecord()->get_base_id(); + $record_id = $basket_element->getRecord()->get_record_id(); if (!isset($remain_hd[$base_id])) { @@ -70,7 +76,7 @@ class set_export extends set_abstract $current_element = $download_list[] = new record_exportElement( - $basket_element->get_record()->get_sbas_id(), + $basket_element->getRecord()->get_sbas_id(), $record_id, $basket->get_name() . '/', $remain_hd[$base_id] @@ -950,7 +956,7 @@ class set_export extends set_abstract public static function stream_file( $file, $exportname, $mime, $disposition='attachment') { - require_once dirname(__FILE__) . "/../../../lib/vendor/Silex/autoload.php"; + require_once __DIR__ . "/../../../lib/vendor/Silex/autoload.php"; $registry = registry::get_instance(); $disposition = in_array($disposition, array('inline', 'attachment')) ? diff --git a/lib/classes/set/order.class.php b/lib/classes/set/order.class.php index 1c7f93104d..6d55dd9bbb 100644 --- a/lib/classes/set/order.class.php +++ b/lib/classes/set/order.class.php @@ -219,19 +219,29 @@ class set_order extends set_abstract } } - try + $core = \bootstrap::getCore(); + + $em = $core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + $Basket = $repository->findUserBasket($this->ssel_id, $core->getAuthenticatedUser()); + + if(!$Basket) { - $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $session->get_usr_id()); - } - catch (Exception $e) - { - $basket = basket_adapter::create($appbox, sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d')), $this->user, '', $pusher); - - $this->ssel_id = $basket->get_ssel_id(); - + $Basket = new Basket(); + $Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d'))); + $Basket->setOwner($this->user); + $Basket->setPusher($core->getAuthenticatedUser()); + + $em->persist($Basket); + $em->flush(); + + $this->ssel_id = $Basket->getId(); + $sql = 'UPDATE `order` SET ssel_id = :ssel_id WHERE id = :order_id'; $stmt = $conn->prepare($sql); - $stmt->execute(array(':ssel_id' => $basket->get_ssel_id(), ':order_id' => $this->id)); + $stmt->execute(array(':ssel_id' => $Basket->getId(), ':order_id' => $this->id)); $stmt->closeCursor(); } diff --git a/lib/classes/set/selection.class.php b/lib/classes/set/selection.class.php index ce5a6ae235..f257649f47 100644 --- a/lib/classes/set/selection.class.php +++ b/lib/classes/set/selection.class.php @@ -31,21 +31,14 @@ class set_selection extends set_abstract /** * - * @param basket_adapter $basket - * @param boolean $flatten_if_grouping + * @param \Entities\Basket $basket * @return set_selection */ - public function load_basket(basket_adapter $basket, $flatten_if_grouping = true) + public function load_basket(\Entities\Basket $Basket) { - if ($basket->is_grouping() && !$flatten_if_grouping) + foreach ($Basket->getElements() as $basket_element) { - $record = new record_adapter($basket->get_sbas_id(), $basket->get_record_id(), count($this->elements)); - $this->add_element($record); - } - else - { - foreach ($basket->get_elements() as $basket_element) - $this->add_element($basket_element->get_record()); + $this->add_element($basket_element->getRecord()); } return $this; diff --git a/lib/classes/setup.class.php b/lib/classes/setup.class.php index f906ed0f67..1337281771 100644 --- a/lib/classes/setup.class.php +++ b/lib/classes/setup.class.php @@ -68,13 +68,13 @@ class setup public static function is_installed() { - return file_exists(dirname(__FILE__) . "/../../config/connexion.inc") - && file_exists(dirname(__FILE__) . "/../../config/config.inc"); + return file_exists(__DIR__ . "/../../config/connexion.inc") + && file_exists(__DIR__ . "/../../config/config.inc"); } function create_global_values(registryInterface &$registry, $datas=array()) { - require(dirname(__FILE__) . "/../../lib/conf.d/_GV_template.inc"); + require(__DIR__ . "/../../lib/conf.d/_GV_template.inc"); if ($registry->is_set('GV_timezone')) @@ -257,12 +257,12 @@ class setup { if (system_server::get_platform() == 'WINDOWS') { - $exiftool = dirname(dirname(__FILE__)) . '/vendor/exiftool/exiftool.exe'; - $indexer = dirname(dirname(dirname(__FILE__))) . '/bin/phraseanet_indexer.exe'; + $exiftool = dirname(__DIR__) . '/vendor/exiftool/exiftool.exe'; + $indexer = dirname(dirname(__DIR__)) . '/bin/phraseanet_indexer.exe'; } else { - $exiftool = dirname(dirname(__FILE__)) . '/vendor/exiftool/exiftool'; + $exiftool = dirname(__DIR__) . '/vendor/exiftool/exiftool'; $indexer = null; } @@ -453,7 +453,7 @@ class setup public static function check_writability(registryInterface $registry) { - $root = p4string::addEndSlash(realpath(dirname(__FILE__) . '/../../')); + $root = p4string::addEndSlash(realpath(__DIR__ . '/../../')); $pathes = array( $root . 'config', @@ -765,17 +765,17 @@ class setup public static function get_config_filepath() { - return dirname(__FILE__) . '/../../config/config.inc'; + return __DIR__ . '/../../config/config.inc'; } public static function get_connexion_filepath() { - return dirname(__FILE__) . '/../../config/connexion.inc'; + return __DIR__ . '/../../config/connexion.inc'; } public static function rollback(connection_pdo $conn, connection_pdo $connbas =null) { - $structure = simplexml_load_file(dirname(__FILE__) . "/../../lib/conf.d/bases_structure.xml"); + $structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml"); if (!$structure) throw new Exception('Unable to load schema'); @@ -814,7 +814,7 @@ class setup } } } - $connexion = dirname(__FILE__) . "/../../config/connexion.inc"; + $connexion = __DIR__ . "/../../config/connexion.inc"; if (file_exists($connexion)) unlink($connexion); diff --git a/lib/classes/sphinx/configuration.class.php b/lib/classes/sphinx/configuration.class.php index b2d1278466..92d9d43607 100644 --- a/lib/classes/sphinx/configuration.class.php +++ b/lib/classes/sphinx/configuration.class.php @@ -37,7 +37,7 @@ class sphinx_configuration public function get_available_charsets() { $available_charsets = array(); - $dir = dirname(__FILE__) . '/charsetTable/'; + $dir = __DIR__ . '/charsetTable/'; echo $dir; $registry = registry::get_instance(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) diff --git a/lib/classes/supertwig.class.php b/lib/classes/supertwig.class.php index 8c3ddc9c5c..9f69c4f461 100644 --- a/lib/classes/supertwig.class.php +++ b/lib/classes/supertwig.class.php @@ -111,6 +111,7 @@ class supertwig $this->addFilter(array('round' => 'round')); $this->addFilter(array('nl2br' => 'nl2br')); $this->addFilter(array('prettyString' => 'phraseadate::getPrettyString')); + $this->addFilter(array('get_collection_logo' => 'collection::getLogo')); } catch (Exception $e) { diff --git a/lib/classes/task/Scheduler.class.php b/lib/classes/task/Scheduler.class.php index 782879a89b..14480851f8 100644 --- a/lib/classes/task/Scheduler.class.php +++ b/lib/classes/task/Scheduler.class.php @@ -45,14 +45,14 @@ class task_Scheduler protected static function get_connection() { - require dirname(__FILE__) . '/../../../config/connexion.inc'; + require __DIR__ . '/../../../config/connexion.inc'; return new connection_pdo('appbox', $hostname, $port, $user, $password, $dbname); } public function run(OutputInterface $output = null, $log_tasks = true) { - require_once dirname(__FILE__) . '/../../bootstrap.php'; + require_once __DIR__ . '/../../bootstrap.php'; $this->output = $output; $appbox = appbox::get_instance(); $registry = $appbox->get_registry(); diff --git a/lib/classes/task/period/upgradetov32.class.php b/lib/classes/task/period/upgradetov32.class.php index f61cd25c65..7d365b2a74 100644 --- a/lib/classes/task/period/upgradetov32.class.php +++ b/lib/classes/task/period/upgradetov32.class.php @@ -67,8 +67,8 @@ class task_period_upgradetov32 extends task_abstract if (!$this->sbas_id) { printf("sbas_id '" . $this->sbas_id . "' invalide\n"); - - return 'stopped'; + $this->return_value = self::RETURNSTATUS_STOPPED; + return; } try @@ -78,6 +78,8 @@ class task_period_upgradetov32 extends task_abstract } catch (Exception $e) { + $this->return_value = self::RETURNSTATUS_STOPPED; + return; } @@ -94,6 +96,7 @@ class task_period_upgradetov32 extends task_abstract catch (Exception $e) { printf("Please verify all your databox meta fields before migrating, It seems somes are wrong\n"); + $this->return_value = self::RETURNSTATUS_STOPPED; return 'stopped'; } @@ -194,7 +197,7 @@ class task_period_upgradetov32 extends task_abstract $sql = 'select record_id, coll_id, xml, BIN(status) as status FROM record - WHERE record_id NOT IN (select distinct record_id from technical_datas) + WHERE migrated="0" AND record_id NOT IN (select distinct record_id from technical_datas) LIMIT 0, 500'; $stmt = $connbas->prepare($sql); @@ -238,7 +241,7 @@ class task_period_upgradetov32 extends task_abstract } catch (Exception $e) { - + } } @@ -280,9 +283,6 @@ class task_period_upgradetov32 extends task_abstract { $record = new record_adapter($this->sbas_id, $row['record_id']); - -// $sbas_id = $this->sbas_id; - $metas = $databox->get_meta_structure(); $metadatas = array(); @@ -367,12 +367,16 @@ class task_period_upgradetov32 extends task_abstract $memory = memory_get_usage() >> 20; if ($n_done >= 5000) - - return task_abstract::RETURNSTATUS_TORESTART; + { + $this->return_value = task_abstract::RETURNSTATUS_TORESTART; + return; + } if ($memory > 100) - - return task_abstract::RETURNSTATUS_TORESTART; - } + { + $this->return_value = task_abstract::RETURNSTATUS_TORESTART; + return; + } + } catch (Exception $e) { @@ -393,8 +397,6 @@ class task_period_upgradetov32 extends task_abstract $conn = connection::getPDOConnection(); - $ret = 'stopped'; - printf("taskid %s ending." . PHP_EOL, $this->get_task_id()); sleep(1); printf("good bye world I was task upgrade to version 3.2" . PHP_EOL); @@ -406,11 +408,12 @@ class task_period_upgradetov32 extends task_abstract $stmt->closeCursor(); $this->setProgress(0, 0); - $ret = 'todelete'; - + + $this->return_value = self::RETURNSTATUS_TODELETE; + flush(); - return $ret; + return; } } diff --git a/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml b/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml index 8c07f0c891..1ec3141289 100644 --- a/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.BasketElement.dcm.yml @@ -1,5 +1,6 @@ Entities\BasketElement: type: entity + repositoryClass: Repositories\BasketElementRepository table: BasketElements uniqueConstraints: unique_recordcle: diff --git a/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml index 019a2688ca..1752c81520 100644 --- a/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.ValidationData.dcm.yml @@ -19,7 +19,7 @@ Entities\ValidationData: manyToOne: participant: targetEntity: ValidationParticipant - inversedBy: datases + inversedBy: datas joinColumn: name: participant_id referencedColumnName: id diff --git a/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml index f5a499051d..cc0038ecf4 100644 --- a/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.ValidationParticipant.dcm.yml @@ -12,8 +12,17 @@ Entities\ValidationParticipant: type: integer is_aware: type: boolean + is_confirmed: + type: boolean + can_agree: + type: boolean + can_see_others: + type: boolean + reminded: + type: datetime + nullable: true; oneToMany: - datases: + datas: targetEntity: ValidationData mappedBy: participant cascade: ["ALL"] diff --git a/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml index 38c677fe58..e61be84eb8 100644 --- a/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml @@ -21,9 +21,6 @@ Entities\ValidationSession: on: update expires: type: datetime - reminded: - type: datetime - nullable: true; oneToOne: basket: targetEntity: Basket diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index 702ceef86e..56efc01fbc 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -1349,16 +1349,6 @@ - - bas_manage - int(1) unsigned - - - - - 0 - - bas_modify_struct int(1) unsigned diff --git a/lib/unitTest/Bridge/ApplicationTest.php b/lib/unitTest/Bridge/ApplicationTest.php index a71ccbb2e9..3dbd945714 100644 --- a/lib/unitTest/Bridge/ApplicationTest.php +++ b/lib/unitTest/Bridge/ApplicationTest.php @@ -172,11 +172,18 @@ class Bridge_Application extends PhraseanetWebTestCaseAuthenticatedAbstract public function testLogoutDeconnected() { + try + { $url = sprintf('/bridge/adapter/%d/logout/', self::$account->get_id()); $crawler = $this->client->request('GET', $url); $pageContent = $this->client->getResponse()->getContent(); $this->assertContains("/adapter/" . self::$account->get_id() . "/logout/", $pageContent); $this->deconnected($crawler, $pageContent); + } + catch(Exception $e) + { + exit($e); + } } public function testLogout() diff --git a/lib/unitTest/PhraseanetPHPUnitAbstract.class.inc b/lib/unitTest/PhraseanetPHPUnitAbstract.class.inc index 7087b3b66f..c77dfeac4a 100644 --- a/lib/unitTest/PhraseanetPHPUnitAbstract.class.inc +++ b/lib/unitTest/PhraseanetPHPUnitAbstract.class.inc @@ -337,6 +337,11 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase protected static $collection; protected static $time_start; protected static $generated_subdefs = array(); + + /** + * + * @var \Alchemy\Phrasea\Core + */ protected static $core; public static function setUpBeforeClass() @@ -959,4 +964,4 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase $browser->setUserAgent($user_agent); } -} \ No newline at end of file +} diff --git a/lib/unitTest/api/v1/api_v1_adapterTest.php b/lib/unitTest/api/v1/api_v1_adapterTest.php index 400c84d55f..f457efa3c2 100644 --- a/lib/unitTest/api/v1/api_v1_adapterTest.php +++ b/lib/unitTest/api/v1/api_v1_adapterTest.php @@ -22,7 +22,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract { parent::setUp(); $appbox = appbox::get_instance(); - $this->object = new API_V1_adapter(FALSE, $appbox); + $this->object = new API_V1_adapter(FALSE, $appbox, self::$core); } public function testGet_error_code() @@ -370,10 +370,16 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract $appbox = appbox::get_instance(); $session = $appbox->get_session(); $usr_id = $session->get_usr_id(); + + $em = self::$core->getEntityManager(); + $repo = $em->getRepository('\Entities\Basket'); + + /* @var $repo \Repositories\BasketRepository */ + $repo->findUserBasket($ssel_id, self::$core->getAuthenticatedUser()); - $basket = basket_adapter::getInstance(appbox::get_instance(), $ssel_id, $usr_id); - $this->assertTrue($basket instanceof basket_adapter); - $basket->delete(); + $this->assertTrue($basket instanceof \Entities\Basket); + $em->remove($Basket); + $em->flush(); } public function testDelete_basket() @@ -381,8 +387,17 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract $appbox = appbox::get_instance(); $usr_id = $appbox->get_session()->get_usr_id(); $user = User_Adapter::getInstance($usr_id, $appbox); - $basket = basket_adapter::create($appbox, 'test suppression', $user); - $ssel_id = $basket->get_ssel_id(); + + $em = self::$core->getEntityManager(); + + $Basket = new Entities\Basket(); + $Basket->setName('Delete test'); + $Basket->setOwner($user); + + $em->persist($Basket); + $em->flush(); + + $ssel_id = $basket->getId(); $request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json')); $result = $this->object->delete_basket($request, $ssel_id); @@ -390,12 +405,14 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract $this->assertEquals('application/json', $result->get_content_type()); $this->assertTrue(is_object(json_decode($result->format()))); + $repo = $em->getRepository('\Entities\Basket'); + try { - basket_adapter::getInstance($appbox, $ssel_id, $usr_id); + $repo->findUserBasket($ssel_id, $user); $this->fail('An exception should have been raised'); } - catch (Exception_Basket_NotFound $e) + catch (Exception_NotFound $e) { } diff --git a/lib/unitTest/api/v1/aplicationTest.php b/lib/unitTest/api/v1/aplicationTest.php index 130a358e33..5ba8cc9511 100644 --- a/lib/unitTest/api/v1/aplicationTest.php +++ b/lib/unitTest/api/v1/aplicationTest.php @@ -246,7 +246,7 @@ class API_V1_test_adapter extends PhraseanetWebTestCaseAbstract $this->assertTrue((strlen($metadatas->separator) > 0)); $this->assertTrue(is_string($metadatas->thesaurus_branch)); - $this->assertTrue(in_array($metadatas->type, array(databox_field::TYPE_DATE, databox_field::TYPE_NUMBER, databox_field::TYPE_TEXT))); + $this->assertTrue(in_array($metadatas->type, array(databox_field::TYPE_DATE,databox_field::TYPE_STRING, databox_field::TYPE_NUMBER, databox_field::TYPE_TEXT))); $this->assertTrue(is_bool($metadatas->indexable)); $this->assertTrue(is_bool($metadatas->multivalue)); $this->assertTrue(is_bool($metadatas->readonly)); diff --git a/lib/unitTest/api/v1/aplicationYamlTest.php b/lib/unitTest/api/v1/aplicationYamlTest.php index ea3d70333e..7ca063191b 100644 --- a/lib/unitTest/api/v1/aplicationYamlTest.php +++ b/lib/unitTest/api/v1/aplicationYamlTest.php @@ -254,7 +254,7 @@ class API_V1_test_adapterYaml extends PhraseanetWebTestCaseAbstract $this->assertTrue((strlen($metadatas["separator"]) > 0)); $this->assertTrue(is_string($metadatas["thesaurus_branch"])); - $this->assertTrue(in_array($metadatas["type"], array(databox_field::TYPE_DATE, databox_field::TYPE_NUMBER, databox_field::TYPE_TEXT))); + $this->assertTrue(in_array($metadatas["type"], array(databox_field::TYPE_DATE,databox_field::TYPE_STRING, databox_field::TYPE_NUMBER, databox_field::TYPE_TEXT))); $this->assertTrue(is_bool($metadatas["indexable"])); $this->assertTrue(is_bool($metadatas["multivalue"])); $this->assertTrue(is_bool($metadatas["readonly"])); diff --git a/lib/unitTest/record/adapterTest.php b/lib/unitTest/record/adapterTest.php index 3c7460e469..7be9f8593c 100644 --- a/lib/unitTest/record/adapterTest.php +++ b/lib/unitTest/record/adapterTest.php @@ -478,10 +478,9 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract $baskets = $baskets['baskets']; $basket = array_shift($baskets); - $this->assertInstanceOf('basket_adapter', $basket); + $this->assertInstanceOf('\Entities\Basket', $basket); $basket->push_element(self::$record_1, false, false); - self::$record_1->get_container_baskets(); $found = $sselcont_id = false; @@ -490,13 +489,13 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract foreach (self::$record_1->get_container_baskets() as $c_basket) { - if ($c_basket->get_ssel_id() == $basket->get_ssel_id()) + if ($c_basket->getId() == $basket->get_ssel_id()) { $found = true; - foreach ($c_basket->get_elements() as $b_el) + foreach ($c_basket->getElements() as $b_el) { - if ($b_el->get_record()->get_record_id() == $record_id && $b_el->get_record()->get_sbas_id() == $sbas_id) - $sselcont_id = $b_el->get_sselcont_id(); + if ($b_el->getRecord()->get_record_id() == $record_id && $b_el->getRecord()->get_sbas_id() == $sbas_id) + $sselcont_id = $b_el->getId(); } } } diff --git a/lib/unitTest/userTest.php b/lib/unitTest/userTest.php index 82e4fc5a3d..4bcc3d3912 100644 --- a/lib/unitTest/userTest.php +++ b/lib/unitTest/userTest.php @@ -37,12 +37,22 @@ class userTest extends PhraseanetPHPUnitAbstract $this->assertFalse(User_Adapter::get_usr_id_from_email(null)); self::$user->set_email(''); $this->assertFalse(User_Adapter::get_usr_id_from_email(null)); - self::$user->set_email('noonealt1@example.com'); - $this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noonealt1@example.com')); + self::$user->set_email('noone@example.com'); + $this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com')); } catch(Exception $e) { $this->fail($e->getMessage()); + } + try + { + + self::$user->set_email('noonealt1@example.com'); + $this->fail('A user already got this address'); + } + catch(Exception $e) + { + } $this->assertFalse(User_Adapter::get_usr_id_from_email(null)); } diff --git a/templates/mobile/lightbox/basket_element.twig b/templates/mobile/lightbox/basket_element.twig index 9a870f8b6e..a982e7b254 100644 --- a/templates/mobile/lightbox/basket_element.twig +++ b/templates/mobile/lightbox/basket_element.twig @@ -11,28 +11,30 @@ {% endblock %} {% block content %} - {% set record = basket_element.get_record() %} + {% set record = basket_element.getRecord() %}
- Back -

{{basket_element.get_order()}} - {{record.get_title()}}

+ Back +

{{basket_element.getOrd()}} - {{record.get_title()}}

Home
{{ thumbnail.format100percent(record.get_preview(),'',session, record.get_thumbnail()) }} - {% if basket_element.is_validation_item() %} + {% if basket_element.getBasket().getValidation() %}
- - + + - - + +
- {% trans 'validation:: editer ma note' %} + + {% trans 'validation:: editer ma note' %} +
-
    +
      {% include 'lightbox/sc_note.twig' %}
diff --git a/templates/web/admin/editusers.twig b/templates/web/admin/editusers.twig index 8e7a18f87e..dd36b33274 100644 --- a/templates/web/admin/editusers.twig +++ b/templates/web/admin/editusers.twig @@ -111,7 +111,7 @@
  • Droits
  • - {% if main_user is not empty %} + {% if main_user is not empty and main_user.is_template is empty %}
  • Fiche
  • @@ -142,7 +142,7 @@ - + @@ -402,7 +402,7 @@
    - {% if main_user is not empty %} + {% if main_user is not empty and main_user.is_template is empty %}
    diff --git a/templates/web/admin/users.html b/templates/web/admin/users.html index e396f3c187..47c1ea5099 100644 --- a/templates/web/admin/users.html +++ b/templates/web/admin/users.html @@ -52,33 +52,91 @@

    + +

    + {% trans 'Apply a template' %} + + +

    +
    - - - - - - - - @@ -120,8 +178,8 @@ {{users.get_total}} resultats - {% set pages = users.get_total() / 20 %} - {% set modulo = users.get_total() % 20 %} + {% set pages = users.get_total() / parm['per_page'] %} + {% set modulo = users.get_total() % parm['per_page'] %} {% if modulo > 0 %}{% set pages = pages + 1 %}{% endif %} {{pages|floor}} pages @@ -188,6 +246,9 @@ el.addClass('selected'); } }); + $('#users_page_form select[name="per_page"]').bind('change', function(){ + $(this).closest('form').submit(); + }); }); diff --git a/templates/web/lightbox/IE6/agreement_box.twig b/templates/web/lightbox/IE6/agreement_box.twig index 9c2db96dfd..69f33af335 100644 --- a/templates/web/lightbox/IE6/agreement_box.twig +++ b/templates/web/lightbox/IE6/agreement_box.twig @@ -1,41 +1,49 @@ -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() %}
    + {% trans 'admin::compte-utilisateur id utilisateur' %} + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur identifiant' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur nom/prenom' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur societe' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur email' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur pays' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur dernier modele applique' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + + + + {% trans 'admin::compte-utilisateur date de creation' %} + + + {{ parm.ord == 'asc' ? '▼' : '▲' }} + +
    - +
    {% trans 'VALIDATION' %}{% trans 'lightbox::recaptitulatif' %} + + {% trans 'lightbox::recaptitulatif' %} + +
    - {% if basket.is_valid() %} -
    {{basket.get_validation_infos}}
    + {% if basket.getValidation() %} +
    + {{ basket.getValidation().getValidationString(user) }} +
      - {% for choice in basket_element.get_choices() %} - {% if choice.agreement == 1 %} + {% for validation_data in basket_element.getValidationData() %} + {% if validation_data.getAgreement() == true %} {% set classuser = 'agree' %} - {% elseif choice.agreement == -1 %} - {% set classuser = 'disagree' %} - {% else %} + {% elseif validation_data.getAgreement() == false %} {% set classuser = '' %} + {% else %} + {% set classuser = 'disagree' %} {% endif %} -
    • {{choice.usr_name}}
    • +
    • + {{ validation_data.getParticipant().getUser().get_display_name }} +
    • {% endfor %}
    {% endif %} - {% if basket_element and basket_element.is_validation_item() %} + {% if basket_element and basket_element.getBasket().getValidation() %}
    diff --git a/templates/web/lightbox/IE6/basket_options.twig b/templates/web/lightbox/IE6/basket_options.twig index ef3212b290..543147f8da 100644 --- a/templates/web/lightbox/IE6/basket_options.twig +++ b/templates/web/lightbox/IE6/basket_options.twig @@ -1,4 +1,4 @@ -{% if basket.is_valid() %} +{% if basket.getValidation() %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' %} - {% for item in baskets %} - {% if item.is_valid() %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection.get_baskets() %} + {% if basket.getValidation() %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() is null %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %}
    -
    +
    {% trans 'validation:: OUI' %}
    -
    +
    {% trans 'validation:: NON' %}
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()}} -

    - {% if item.is_validation_finished %} - {% trans '(validation) session terminee' %} - {% elseif item.is_confirmed %} - {% trans '(validation) envoyee' %} - {% else %} - {% trans '(validation) a envoyer' %} - {% endif %} -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    {{item.get_validation_infos}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getELements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()}} +

    + {% if basket.getValidation().isFinished() %} + {% trans '(validation) session terminee' %} + {% elseif basket.getValidation().getParticipant(user).getIsConfirmed() %} + {% trans '(validation) envoyee' %} + {% else %} + {% trans '(validation) a envoyer' %} + {% endif %} +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    {{ basket.getValidation.getValidationString(user) }}
    +
    +
    +
    + +
    +
    @@ -100,59 +95,54 @@ {% trans 'Voici vos paniers' %}
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()}} -

    -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().getRecord().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()}} +

    +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{basket.getDescription()}}
    +
    +
    +
    + +
    +
    diff --git a/templates/web/lightbox/IE6/sc_container.twig b/templates/web/lightbox/IE6/sc_container.twig index 05e791c83e..fba6725f15 100644 --- a/templates/web/lightbox/IE6/sc_container.twig +++ b/templates/web/lightbox/IE6/sc_container.twig @@ -1,24 +1,24 @@ {% block basket %}
    - {% for element in basket.get_elements() %} + {% for element in basket.getElements() %}
    - - diff --git a/templates/web/lightbox/IE6/sc_options_box.twig b/templates/web/lightbox/IE6/sc_options_box.twig index 50023759d5..ff4197a9de 100644 --- a/templates/web/lightbox/IE6/sc_options_box.twig +++ b/templates/web/lightbox/IE6/sc_options_box.twig @@ -22,13 +22,19 @@
    - +
    | - {% if basket_element.is_validation_item() %} + {% if basket_element.getBasket().getValidation() %} {% endif %} {% endif %} diff --git a/templates/web/lightbox/IE6/validate.twig b/templates/web/lightbox/IE6/validate.twig index c929ca9dd7..f12637827b 100644 --- a/templates/web/lightbox/IE6/validate.twig +++ b/templates/web/lightbox/IE6/validate.twig @@ -16,7 +16,7 @@ {% endblock %} {% block content %} - {% set basket_element = basket.get_first_element%} + {% set basket_element = basket.getElements().first() %}
    @@ -27,11 +27,11 @@ -
    {% if basket_element %}{{basket_element.get_order()}}{% endif %}
    +
    {% if basket_element %}{{basket_element.getOrd()}}{% endif %}
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -44,7 +44,7 @@
    {% if basket_element %} - {% set bask_prev = basket_element.get_record().get_preview() %} + {% set bask_prev = basket_element.getRecord().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} {% include 'lightbox/selector_box.twig' %} @@ -60,8 +60,8 @@
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -82,7 +82,7 @@ {% trans 'notice'%} - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% trans 'Validation'%} @@ -92,16 +92,16 @@
    -
    +
    {% if basket_element %} - {{caption.format_caption(basket_element.get_record())}} + {{caption.format_caption(basket_element.getRecord())}} {% endif %}
    - {% if basket.is_valid() %} + {% if basket.getValidation() %}
    {% include 'lightbox/IE6/agreement_box.twig' %}
    @@ -127,27 +127,19 @@ diff --git a/templates/web/lightbox/agreement_box.twig b/templates/web/lightbox/agreement_box.twig index cb0cdd6a05..b5f7c72ab6 100644 --- a/templates/web/lightbox/agreement_box.twig +++ b/templates/web/lightbox/agreement_box.twig @@ -8,32 +8,33 @@ - {% if basket.is_valid() %} -
    {{basket.get_validation_infos}}
    + {% if basket.getValidation() %} +
    {{ basket.getValidation().getValidationString(user) }}
      - {% for choice in basket_element.get_choices() %} - {% if choice.agreement == 1 %} + {% for choice in basket_element.getValidationDatas() %} + {% if choice.getAgreement() == true %} {% set classuser = 'agree' %} - {% elseif choice.agreement == -1 %} - {% set classuser = 'disagree' %} - {% else %} + {% elseif choice.getAgreement() == null %} {% set classuser = '' %} + {% else %} + {% set classuser = 'disagree' %} {% endif %} -
    • {{choice.usr_name}}
    • + {% set participant = choice.getParticipant().getUser() %} +
    • {{participant.get_display_name()}}
    • {% endfor %}
    {% endif %}
    -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() %}
    -
    +
    {% trans 'validation:: OUI' %}
    -
    +
    {% trans 'validation:: NON' %}
    diff --git a/templates/web/lightbox/basket_content_report.twig b/templates/web/lightbox/basket_content_report.twig index 59f9d28079..9acbfb4af1 100644 --- a/templates/web/lightbox/basket_content_report.twig +++ b/templates/web/lightbox/basket_content_report.twig @@ -2,17 +2,17 @@ {% import 'common/thumbnail.html' as thumbnail %}
    - {% for basket_element in basket.get_elements() %} - {% set record = basket_element.get_record() %} - + {% for basket_element in basket.getElements() %} + {% set record = basket_element.getRecord() %} +
    - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' %} - {% for item in baskets %} - {% if item.is_valid() %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation() %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %} - {% for key,baskets in baskets_collection.get_baskets() %} - {% if key == 'baskets' or key == 'recept' %} - {% for item in baskets %} - {% if item.is_valid() == false %} - {% set basket_length = item.get_elements()|length%} - - - - {% endif %} - {% endfor %} - {% endif %} + {% for basket in baskets_collection %} + {% if basket.getValidation is null %} + {% set basket_length = basket.getElements().count() %} + + + + {% endif %} {% endfor %}
    -
    - {{basket_element.get_order()}} + {{basket_element.getOrd()}}
    {{thumbnail.format(record.get_thumbnail(),165, 125, '', session, true)}}
    @@ -20,22 +20,22 @@
    - {% for choice in basket_element.get_choices()%} + {% for validationDatas in basket_element.getValidationDatas()%}
    - {% if choice.agreement == 1 %} + {% if validationDatas.getAgreement() == true %} {% set imguser = '' %} {% set styleuser = '' %} - {% elseif choice.agreement == -1 %} + {% elseif validationDatas.getAgreement() == false %} {% set imguser = '' %} {% set styleuser = '' %} {% else %} {% set imguser = '' %} {% set styleuser = 'margin-left:18px;' %} {% endif %} - {{imguser|raw}} {{choice.usr_name}} - {% if choice.note != '' %} - : {{choice.note|nl2br}} + {{imguser|raw}} {{validationDatas.getParticipant().getUser().get_display_name()}} + {% if validationDatas.getNote() != '' %} + : {{validationDatas.getNote()|nl2br}} {% endif %}
    diff --git a/templates/web/lightbox/basket_options.twig b/templates/web/lightbox/basket_options.twig index 34b8492981..2409f03bf0 100644 --- a/templates/web/lightbox/basket_options.twig +++ b/templates/web/lightbox/basket_options.twig @@ -1,4 +1,4 @@ -{% if basket.is_valid() %} +{% if basket.getValidation() %}
    -
    {% if first_item %}{{first_item.get_ord()}}{% endif %}
    +
    {% if first_item %}{{first_item.getOrd()}}{% endif %}
    -
    - {% if first_item %}{{first_item.get_record().get_title|raw}}{% endif %} +
    + {% if first_item %}{{first_item.getRecord().get_title|raw}}{% endif %}
    @@ -45,7 +45,7 @@
    {% if first_item %} - {% set bask_prev = first_item.get_record().get_preview() %} + {% set bask_prev = first_item.getRecord().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} {% include 'lightbox/selector_box.twig' %} @@ -61,8 +61,8 @@
    -
    - {% if first_item %}{{first_item.get_record().get_title}}{% endif %} +
    + {% if first_item %}{{first_item.getRecord().get_title}}{% endif %}
    @@ -83,7 +83,7 @@
    {% if first_item %} - {{caption.format_caption(first_item.get_record())}} + {{caption.format_caption(first_item.getRecord())}} {% endif %}
    diff --git a/templates/web/lightbox/index.twig b/templates/web/lightbox/index.twig index 03b28347c4..4262491a3c 100644 --- a/templates/web/lightbox/index.twig +++ b/templates/web/lightbox/index.twig @@ -31,67 +31,62 @@
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()|raw}} -

    - {% if item.is_validation_finished %} - {% trans '(validation) session terminee' %} - {% elseif item.is_confirmed %} - {% trans '(validation) envoyee' %} - {% else %} - {% trans '(validation) a envoyer' %} - {% endif %} -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    {{item.get_validation_infos}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().get_record().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{basket.getName()|raw}} +

    + {% if basket.getValidation().isFinished() %} + {% trans '(validation) session terminee' %} + {% elseif basket.getValidation().getParticipant(user).getIsConfirmed() %} + {% trans '(validation) envoyee' %} + {% else %} + {% trans '(validation) a envoyer' %} + {% endif %} +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    {{ basket.getValidation().getValidationString(user) }}
    +
    +
    +
    + +
    +
    @@ -101,59 +96,54 @@ {% trans 'Voici vos paniers' %}
    -
    - - - - - - - - -
    - {% if basket_length > 0%} - {{thumbnail.format(item.get_first_element.get_record().get_thumbnail, 170, 170, '', session, true)}} - {% endif %} - - -
    - - - - - - - - - - - -
    -

    - {{item.get_name()|raw}} -

    -
    - {% set basket_length = item.get_elements()|length%} - ({% trans %}{{basket_length}} documents{% endtrans %}) -
    -
    {{item.get_description()}}
    -
    -
    -
    - -
    -
    +
    + + + + + + + + +
    + {% if basket_length > 0%} + {{thumbnail.format(basket.getElements().first().get_record().get_thumbnail, 170, 170, '', session, true)}} + {% endif %} + + +
    + + + + + + + + + + + +
    +

    + {{ basket.getName()|raw}} +

    +
    + ({% trans %}{{basket_length}} documents{% endtrans %}) +
    +
    {{ basket.getDescription() }}
    +
    +
    +
    + +
    +
    diff --git a/templates/web/lightbox/sc_note.twig b/templates/web/lightbox/sc_note.twig index 6d0a83bbf5..5422735c84 100644 --- a/templates/web/lightbox/sc_note.twig +++ b/templates/web/lightbox/sc_note.twig @@ -1,25 +1,33 @@ -{% if basket_element and basket_element.is_validation_item() %} -
    -
    -
    -
    -

    {% trans 'validation:: votre note' %}

    -
    - {% for user, datas in basket_element.get_choices() %} - {% if datas.note != '' %} -
    - {{datas.usr_name}} : {{datas.note|nl2br}} -
    - {% endif %} - {% endfor %} - -
    - -
    - - -
    -
    -
    +{% if basket_element and basket_element?getBasket().getValidation() %} +
    +
    +
    +
    +

    {% trans 'validation:: votre note' %}

    +
    +
    + {% for validationDatas in basket_element.getValidationDatas() %} + {% if validationDatas.getNote() != '' %} +
    + + {{validationDatas.getParticipant().getUser().get_display_name()}} + : {{ validationDatas.getNote()|nl2br }} +
    + {% endif %} + {% endfor %} + +
    + +
    + + +
    +
    +
    +
    {% endif %} diff --git a/templates/web/lightbox/sc_options_box.twig b/templates/web/lightbox/sc_options_box.twig index d38f60c567..b5a31dbe45 100644 --- a/templates/web/lightbox/sc_options_box.twig +++ b/templates/web/lightbox/sc_options_box.twig @@ -22,13 +22,19 @@
    - +
    | - {% if basket_element.is_validation_item() %} + {% if basket_element.getBasket().getValidation() %} {% endif %} {% endif %} diff --git a/templates/web/lightbox/selector_box.twig b/templates/web/lightbox/selector_box.twig index 98237fd343..4b73b747ee 100644 --- a/templates/web/lightbox/selector_box.twig +++ b/templates/web/lightbox/selector_box.twig @@ -1,8 +1,8 @@ -{% if basket_element and basket_element.is_validation_item() %} +{% if basket_element and basket_element.getBasket().getValidation() %} {% endif %} diff --git a/templates/web/lightbox/validate.twig b/templates/web/lightbox/validate.twig index 897585b2c1..e1afc796d9 100644 --- a/templates/web/lightbox/validate.twig +++ b/templates/web/lightbox/validate.twig @@ -18,7 +18,7 @@ {% block content %} - {% set basket_element = basket.get_first_element%} + {% set basket_element = basket.getElements().first() %}
    @@ -29,11 +29,17 @@ -
    {% if basket_element %}{{basket_element.get_order()}}{% endif %}
    +
    + {% if basket_element %} + {{basket_element.getOrd()}} + {% endif %} +
    -
    - {% if basket_element %}{{basket_element.get_record().get_title|raw}}{% endif %} +
    + {% if basket_element %} + {{basket_element.getRecord().get_title}} + {% endif %}
    @@ -46,7 +52,7 @@
    {% if basket_element %} - {% set bask_prev = basket_element.get_record().get_preview() %} + {% set bask_prev = basket_element.getRecord().get_preview() %} {{thumbnail.format(bask_prev,bask_prev.get_width(),bask_prev.get_height(),'',session, false)}} {% endif %} {% include 'lightbox/selector_box.twig' %} @@ -62,8 +68,8 @@
    -
    - {% if basket_element %}{{basket_element.get_record().get_title}}{% endif %} +
    + {% if basket_element %}{{basket_element.getRecord().get_title}}{% endif %}
    @@ -84,16 +90,16 @@ {% endif %} {% trans 'notice'%}
    -
    +
    {% if basket_element %} - {{caption.format_caption(basket_element.get_record())}} + {{caption.format_caption(basket_element.getRecord())}} {% endif %}
    - {% if basket.is_valid() %} + {% if basket.getValidation() %}
    {% include 'lightbox/agreement_box.twig' %} @@ -121,27 +127,19 @@ {% endif %} @@ -168,13 +166,13 @@
    - {% if basket.is_valid() %} + {% if basket.getValidation() %} {% endif %} {% endblock %} diff --git a/templates/web/prod/Baskets/Create.html.twig b/templates/web/prod/Baskets/Create.html.twig index 0a72f908a4..938d687997 100644 --- a/templates/web/prod/Baskets/Create.html.twig +++ b/templates/web/prod/Baskets/Create.html.twig @@ -13,7 +13,7 @@ - + + + + + + +

    QUnit example

    +

    +
    +

    +
      +
      test markup, will be hidden
      + + diff --git a/www/include/minify/builder/index.php b/www/include/minify/builder/index.php index bb5e000ad3..b2d28cc784 100644 --- a/www/include/minify/builder/index.php +++ b/www/include/minify/builder/index.php @@ -8,7 +8,7 @@ if (phpversion() < 5) { $encodeOutput = (function_exists('gzdeflate') && !ini_get('zlib.output_compression')); -require dirname(__FILE__) . '/../config.php'; +require __DIR__ . '/../config.php'; if (! $min_enableBuilder) { header('Location: /'); @@ -162,14 +162,14 @@ $serveOpts = array( ,'lastModifiedTime' => max( // regenerate cache if either of these change filemtime(__FILE__) - ,filemtime(dirname(__FILE__) . '/../config.php') + ,filemtime(__DIR__ . '/../config.php') ) ,'minifyAll' => true ,'encodeOutput' => $encodeOutput ); ob_end_clean(); -set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . get_include_path()); +set_include_path(__DIR__ . '/../lib' . PATH_SEPARATOR . get_include_path()); require 'Minify.php'; diff --git a/www/include/minify/builder/ocCheck.php b/www/include/minify/builder/ocCheck.php index 001c012ce4..e78c13a123 100644 --- a/www/include/minify/builder/ocCheck.php +++ b/www/include/minify/builder/ocCheck.php @@ -8,7 +8,7 @@ $_oc = ini_get('zlib.output_compression'); // allow access only if builder is enabled -require dirname(__FILE__) . '/../config.php'; +require __DIR__ . '/../config.php'; if (! $min_enableBuilder) { header('Location: /'); exit(); diff --git a/www/include/minify/config.php b/www/include/minify/config.php index 32ba786f6a..b40ee41f4c 100644 --- a/www/include/minify/config.php +++ b/www/include/minify/config.php @@ -150,7 +150,7 @@ $min_uploaderHoursBehind = 0; * Path to Minify's lib folder. If you happen to move it, change * this accordingly. */ -$min_libPath = dirname(__FILE__) . '/lib'; +$min_libPath = __DIR__ . '/lib'; $min_cachePath = dirname( __FILE__ ) . '/../../../tmp/cache_minify'; diff --git a/www/include/minify/groupsConfig.php b/www/include/minify/groupsConfig.php index 90fcc35247..a241d13375 100644 --- a/www/include/minify/groupsConfig.php +++ b/www/include/minify/groupsConfig.php @@ -79,7 +79,12 @@ $groups = array( , '//login/geonames.js' , '//include/jslibs/jquery.form.2.49.js' , '//include/jslibs/jquery.vertical.buttonset.js' + , '//include/js/jquery.Selection.js' + , '//prod/jquery.Prod.js' + , '//prod/jquery.Results.js' , '//prod/page0.js' + , '//prod/jquery.WorkZone.js' + , '//prod/jquery.Alerts.js' , '//prod/publicator.js' , '//prod/jquery.order.js' , '//include/jslibs/jquery.sprintf.1.0.3.js' diff --git a/www/include/minify/index.php b/www/include/minify/index.php index acc09b970d..8135ca21bd 100644 --- a/www/include/minify/index.php +++ b/www/include/minify/index.php @@ -7,7 +7,7 @@ * @package Minify */ -define('MINIFY_MIN_DIR', dirname(__FILE__)); +define('MINIFY_MIN_DIR', __DIR__); // load config require MINIFY_MIN_DIR . '/config.php'; diff --git a/www/include/minify/utils.php b/www/include/minify/utils.php index ca4abbaf53..c07dd54841 100644 --- a/www/include/minify/utils.php +++ b/www/include/minify/utils.php @@ -34,7 +34,7 @@ function Minify_groupUri($group, $forceAmpersand = false) : "/?g={$group}"; return _Minify_getBuild($group)->uri( - '/' . basename(dirname(__FILE__)) . $path + '/' . basename(__DIR__) . $path ,$forceAmpersand ); } @@ -83,7 +83,7 @@ function _Minify_getBuild($group) static $builds = array(); static $gc = false; if (false === $gc) { - $gc = (require dirname(__FILE__) . '/groupsConfig.php'); + $gc = (require __DIR__ . '/groupsConfig.php'); } if (! isset($builds[$group])) { $builds[$group] = new Minify_Build($gc[$group]); diff --git a/www/include/multiexports.php b/www/include/multiexports.php index 976f0378f8..f8752a2c9e 100644 --- a/www/include/multiexports.php +++ b/www/include/multiexports.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/include/printpage.php b/www/include/printpage.php index bf5bf09e0f..aa2c7093e3 100644 --- a/www/include/printpage.php +++ b/www/include/printpage.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/include/printpage_pdf.php b/www/include/printpage_pdf.php index 7f3172e932..b2805576ba 100644 --- a/www/include/printpage_pdf.php +++ b/www/include/printpage_pdf.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/include/sendmailpage.php b/www/include/sendmailpage.php index 5fd1c8840c..819742c169 100644 --- a/www/include/sendmailpage.php +++ b/www/include/sendmailpage.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . '/../../lib/bootstrap.php'; +require_once __DIR__ . '/../../lib/bootstrap.php'; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/include/updses.php b/www/include/updses.php index 78462fea10..cae2db95b1 100644 --- a/www/include/updses.php +++ b/www/include/updses.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/include/vendor/qunit b/www/include/vendor/qunit new file mode 160000 index 0000000000..0712230bb2 --- /dev/null +++ b/www/include/vendor/qunit @@ -0,0 +1 @@ +Subproject commit 0712230bb203c262211649b32bd712ec7df5f857 diff --git a/www/login/account.php b/www/login/account.php index 5c3e60e9f8..f4ff4226cd 100644 --- a/www/login/account.php +++ b/www/login/account.php @@ -14,9 +14,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; -require_once dirname(__FILE__) . "/../../lib/classes/API/OAuth2/Autoloader.class.php"; +require_once __DIR__ . "/../../lib/classes/API/OAuth2/Autoloader.class.php"; API_OAuth2_Autoloader::register(); diff --git a/www/login/authenticate.php b/www/login/authenticate.php index f05b9a4191..69e543ac31 100644 --- a/www/login/authenticate.php +++ b/www/login/authenticate.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/login/forgotpwd.php b/www/login/forgotpwd.php index 215119acc7..30073345bd 100644 --- a/www/login/forgotpwd.php +++ b/www/login/forgotpwd.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/login/index.php b/www/login/index.php index e79c6d7902..d3546df22a 100644 --- a/www/login/index.php +++ b/www/login/index.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -125,7 +125,7 @@ if (!$registry->get('GV_maintenance')
      ' . _('login::captcha: recopier les mots ci dessous') . ' : -
      ' . recaptcha_get_html(GV_captcha_public_key) . '
      '; +
      ' . recaptcha_get_html($registry->get('GV_captcha_public_key')) . '
      '; } $public_feeds = Feed_Collection::load_public_feeds($appbox); diff --git a/www/login/logout.php b/www/login/logout.php index b336f4dacc..da46015a5b 100644 --- a/www/login/logout.php +++ b/www/login/logout.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); diff --git a/www/login/register-confirm.php b/www/login/register-confirm.php index 5bc5b93475..30070add09 100644 --- a/www/login/register-confirm.php +++ b/www/login/register-confirm.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $request = http_request::getInstance(); diff --git a/www/login/register.php b/www/login/register.php index cf354cefe7..c25f542ba4 100644 --- a/www/login/register.php +++ b/www/login/register.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/login/reset-email.php b/www/login/reset-email.php index f57157b38a..1f462a83a9 100644 --- a/www/login/reset-email.php +++ b/www/login/reset-email.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -133,7 +133,7 @@ if (isset($parm['form_password']) && isset($parm['form_email']) && isset($parm[' if (str_replace(array("\r\n", "\r", "\n", "\t"), '_', trim($parm['form_email'])) == $parm['form_email_confirm']) { - require_once(dirname(__FILE__) . '/../../lib/vendor/PHPMailer_v5.1/class.phpmailer.php'); + require_once(__DIR__ . '/../../lib/vendor/PHPMailer_v5.1/class.phpmailer.php'); if (PHPMailer::ValidateAddress($parm['form_email'])) { if (mail::reset_email($parm['form_email'], $session->get_usr_id()) === true) diff --git a/www/login/reset-password.php b/www/login/reset-password.php index fd58df4adc..30f6aeb40e 100644 --- a/www/login/reset-password.php +++ b/www/login/reset-password.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/login/sendmail-confirm.php b/www/login/sendmail-confirm.php index 363b5fba9d..b2ecbe96d3 100644 --- a/www/login/sendmail-confirm.php +++ b/www/login/sendmail-confirm.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_post_datas('usr_id'); diff --git a/www/prod/answer.php b/www/prod/answer.php index 41ba1d37f9..43f44978ac 100644 --- a/www/prod/answer.php +++ b/www/prod/answer.php @@ -18,7 +18,7 @@ * @see http://developer.phraseanet.com * */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/prod/chghddocument.php b/www/prod/chghddocument.php index 81872143cf..4748020fe3 100644 --- a/www/prod/chghddocument.php +++ b/www/prod/chghddocument.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/prod/chgstatus.php b/www/prod/chgstatus.php index 22427b8c97..7bacc3fd7b 100644 --- a/www/prod/chgstatus.php +++ b/www/prod/chgstatus.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/prod/chgthumb.php b/www/prod/chgthumb.php index 1cd0b33892..94ce850028 100644 --- a/www/prod/chgthumb.php +++ b/www/prod/chgthumb.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/prod/chgtype.php b/www/prod/chgtype.php index 5ad7fbc29b..2509af63d3 100644 --- a/www/prod/chgtype.php +++ b/www/prod/chgtype.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); phrasea::headers(); diff --git a/www/prod/docfunction.php b/www/prod/docfunction.php index fa0004a327..aa1042992c 100644 --- a/www/prod/docfunction.php +++ b/www/prod/docfunction.php @@ -14,7 +14,10 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; +$Core = bootstrap::getCore(); +$em = $Core->getEntityManager(); + $appbox = appbox::get_instance(); $session = $appbox->get_session(); phrasea::headers(); @@ -235,13 +238,17 @@ $user = User_Adapter::getInstance($usr_id, $appbox); if ($parm['SSTTID'] != '' && ($parm['lst'] == null || $parm['lst'] == '')) { $parm['lst'] = array(); - - $basket = basket_adapter::getInstance($appbox, $parm['SSTTID'], $usr_id); - - foreach ($basket->get_elements() as $basket_element) + + $repository = $em->getRepository('\Entities\Basket'); + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket($Core->getRequest()->get('SSTTID'), $Core->getAuthenticatedUser()); + + foreach ($Basket->get_elements() as $basket_element) { - $record = $basket_element->get_record(); - $parm['lst'][] = $record->get_sbas_id() . '_' . $record->get_record_id(); + /* @var $basket_element \Entities\BasketElement */ + $record = $basket_element->getRecord(); + $parm['lst'][] = $record->get_serialize_key(); } $parm['lst'] = implode(';', $parm['lst']); } diff --git a/www/prod/imgfunction.php b/www/prod/imgfunction.php index f7435f6718..2a0f906272 100644 --- a/www/prod/imgfunction.php +++ b/www/prod/imgfunction.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +$Core = require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -46,11 +46,20 @@ if ($parm['ACT'] === null) if ($parm['SSTTID'] != '' && ($parm['lst'] == null || $parm['lst'] == '')) { - $basket = basket_adapter::getInstance($appbox, $parm['SSTTID'], $usr_id); - foreach ($basket->get_elements() as $basket_element) + $em = $Core->getEntityManager(); + $repository = $em->getRepository('\Entities\Basket'); + + /* @var $repository \Repositories\BasketRepository */ + + $Basket = $repository->findUserBasket( + $Core->getRequest()->get('SSTTID') + , $Core->getAuthenticatedUser() + ); + + foreach ($Basket->getElements() as $basket_element) { - $parm['lst'] .= $basket_element->get_record()->get_serialize_key() . ';'; + $parm['lst'] .= $basket_element->getRecord()->get_serialize_key() . ';'; } } diff --git a/www/prod/jquery.Alerts.js b/www/prod/jquery.Alerts.js new file mode 100644 index 0000000000..3b25facb9c --- /dev/null +++ b/www/prod/jquery.Alerts.js @@ -0,0 +1,50 @@ +var p4 = p4 || {}; + +(function(p4){ + + function create_dialog() + { + if($('#p4_alerts').length === 0) + { + $('body').append('
      '); + } + + return $('#p4_alerts'); + } + + function alert(title, message) + { + var dialog = create_dialog(); + + var button = new Object(); + + button[language.annuler] = function(){ + dialog.dialog('close'); + }; + + dialog.attr('title',title) + .empty() + .append(message) + .dialog({ + + autoOpen:false, + closeOnEscape:true, + resizable:false, + draggable:false, + modal:true, + buttons : button, + draggable:false, + overlay: { + backgroundColor: '#000', + opacity: 0.7 + } + }).dialog('open'); + + return; + } + + p4.Alerts = alert; + + + return; +}(p4)) diff --git a/www/prod/jquery.Phraseanet.js b/www/prod/jquery.Phraseanet.js new file mode 100644 index 0000000000..188d3dd8bb --- /dev/null +++ b/www/prod/jquery.Phraseanet.js @@ -0,0 +1,7 @@ +var p4 = p4 || {}; + +(function(p4){ + + + +}(p4)); \ No newline at end of file diff --git a/www/prod/jquery.Prod.js b/www/prod/jquery.Prod.js new file mode 100644 index 0000000000..0447771527 --- /dev/null +++ b/www/prod/jquery.Prod.js @@ -0,0 +1,33 @@ +(function(){ + + $(document).ready(function(){ + + $('a.dialog').live('click', function(event){ + + var $this = $(this); + + $.ajax({ + type: "GET", + url: $this.attr('href'), + dataType: 'html', + beforeSend:function(){ + + }, + success: function(data){ + $('#DIALOG').attr('title', $this.attr('title')) + .empty() + .append(data) + .dialog() + .dialog('open'); + return; + } + }); + + return false; + }); + + + + }); + +}()) \ No newline at end of file diff --git a/www/prod/jquery.Results.js b/www/prod/jquery.Results.js new file mode 100644 index 0000000000..7510b09d8b --- /dev/null +++ b/www/prod/jquery.Results.js @@ -0,0 +1,22 @@ +var p4 = p4 || {}; + +(function(p4, window){ + + p4.Results = { + 'Selection':new Selectable({ + selector : '.IMGT', + container:$('#answers'), + selectStart:function(event, selection){ + $('#answercontextwrap table:visible').hide(); + }, + selectStop:function(event, selection){ + viewNbSelect(); + }, + callbackSelection:function(element){ + return $(element).attr('id').split('_').slice(1,3).join('_'); + } + }) + }; + + return; +}(p4, window)) diff --git a/www/prod/jquery.Search.js b/www/prod/jquery.Search.js new file mode 100644 index 0000000000..3089378655 --- /dev/null +++ b/www/prod/jquery.Search.js @@ -0,0 +1,6 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + diff --git a/www/prod/jquery.WorkZone.js b/www/prod/jquery.WorkZone.js new file mode 100644 index 0000000000..78e1dd9f1e --- /dev/null +++ b/www/prod/jquery.WorkZone.js @@ -0,0 +1,591 @@ +var p4 = p4 || {}; + +(function(p4){ + + + + + + function refreshBaskets(baskId, sort, scrolltobottom) + { + var active = $('#baskets .SSTT.ui-state-active'); + if(baskId == 'current' && active.length>0) + baskId = active.attr('id').split('_').slice(1,2).pop(); + sort = ($.inArray(sort, ['date', 'name'])>=0) ? sort : ''; + + scrolltobottom = typeof scrolltobottom == 'undefined' ? false : scrolltobottom; + + $.ajax({ + type: "GET", + url: "/prod/WorkZone/", + data: { + type:'basket', + id:baskId, + sort:sort + }, + beforeSend:function(){ + $('#basketcontextwrap').remove(); + }, + success: function(data){ + + var cache = $("#idFrameC #baskets"); + $(".SSTT",cache).droppable('destroy'); + + $('.bloc',cache).droppable('destroy'); + cache.accordion('destroy') + + .empty() + .append(data); + + activeBaskets(); + $('.basketTips').tooltip({ + delay: 200 + }); + cache.disableSelection(); + + if(!scrolltobottom) + return; + + p4.next_bask_scroll = true; + return; + } + }); + } + + + + function setTemporaryPref(name,value) + { + + $.ajax({ + type: "POST", + url: "/prod/prodFeedBack.php", + data: { + action: "SAVETEMPPREF", + prop:name, + value:value + }, + success: function(data){ + return; + } + }); + } + + $("#baskets div.content select[name=valid_ord]").live('change',function(){ + + var active = $('#baskets .SSTT.ui-state-active'); + if(active.length==0) + return; + + getContent(active); + }); + + + + function WorkZoneElementRemover(el, confirm) + { + + if(confirm !== true && $(el).hasClass('groupings') && p4.reg_delete == true) + { + var buttons = {}; + + + buttons[language.valider] = function() { + $("#DIALOG-baskets").dialog('close').remove(); + WorkZoneElementRemover(el,true); + }; + + buttons[language.annuler] = function(){ + $("#DIALOG-baskets").dialog('close').remove(); + }; + + var texte = '

      '+language.confirmRemoveReg+'

      '+language.hideMessage+'
      '; + $('body').append('
      '); + $("#DIALOG-baskets").attr('title',language.removeTitle) + .empty() + .append(texte) + .dialog({ + + autoOpen:false, + closeOnEscape:true, + resizable:false, + draggable:false, + modal:true, + buttons:buttons, + draggable:false, + overlay: { + backgroundColor: '#000', + opacity: 0.7 + } + }).dialog('open'); + return; + } + + var id = $(el).attr('id').split('_').slice(2,4).join('_'); + + $.ajax({ + type: "POST", + url: $(el).attr('href'), + dataType:'json', + beforeSend : function(){ + $('.wrapCHIM_'+id).find('.CHIM').fadeOut(); + }, + success: function(data){ + + if(data.success) + { + humane.info(data.message); + p4.WorkZone.Selection.remove(id); + + $('.wrapCHIM_'+id).find('.CHIM').draggable('destroy'); + $('.wrapCHIM_'+id).remove(); + } + else + { + humane.error(data.message); + $('.wrapCHIM_'+id).find('.CHIM').fadeIn(); + } + return; + } + }); + return false; + } + + + function activeBaskets() + { + var cache = $("#idFrameC #baskets"); + + cache.accordion({ + active:'active', + autoHeight: false, + collapsible:true, + header:'div.header', + change:function(event,ui){ + + if(p4.next_bask_scroll) + { + p4.next_bask_scroll = false; + + var b_active = $('#baskets .SSTT.active'); + + if(!b_active.next().is(':visible')) + return; + + var t = $('#baskets .SSTT.active').position().top + b_active.next().height() -200; + + t = t < 0 ? 0 : t; + + $('#baskets .bloc').stop().animate({ + scrollTop:t + }); + } + + var uiactive = $(this).find('.ui-state-active'); + + if(uiactive.length === 0) + { + return; /* everything is closed */ + } + + var clicked = uiactive.attr('id').split('_').pop(); + var href = $('a', uiactive).attr('href'); + + uiactive.addClass('ui-state-focus active'); + + p4.WorkZone.Selection.empty(); + + getContent(uiactive); + + }, + changestart:function(event,ui){ + $('#basketcontextwrap .basketcontextmenu').hide(); + } + }); + $('.bloc',cache).droppable({ + accept:function(elem){ + if($(elem).hasClass('grouping') && !$(elem).hasClass('SSTT')) + return true; + return false; + }, + scope:'objects', + hoverClass:'groupDrop', + tolerance:'pointer', + drop:function(){ + fix(); + } + }); + + if($('.SSTT.active',cache).length>0) + { + var el = $('.SSTT.active',cache)[0]; + $(el).trigger('click'); + } + + + $(".SSTT, .content",cache) + .droppable({ + scope:'objects', + hoverClass:'baskDrop', + tolerance:'pointer', + accept:function(elem){ + if($(elem).hasClass('CHIM')) + { + if($(elem).closest('.content').prev()[0] == $(this)[0]) + { + return false; + } + } + if($(elem).hasClass('grouping') || $(elem).parent()[0]==$(this)[0]) + return false; + return true; + }, + drop:function(event,ui){ + dropOnBask(event,ui.draggable,$(this)); + } + }); + + if($('#basketcontextwrap').length == 0) + $('body').append('
      '); + + $('.context-menu-item',cache).hover(function(){ + $(this).addClass('context-menu-item-hover'); + },function(){ + $(this).removeClass('context-menu-item-hover'); + }); + $.each($(".SSTT",cache),function(){ + var el = $(this); + $(this).find('.contextMenuTrigger').contextMenu('#'+$(this).attr('id')+' .contextMenu',{ + 'appendTo':'#basketcontextwrap', + openEvt:'click', + theme:'vista', + dropDown:true, + showTransition:'slideDown', + hideTransition:'hide', + shadow:false + }); + }); + + } + + + + function getContent(header) + { + if(window.console) + { + console.log('Reload content for ', header); + } + + $.ajax({ + type: "GET", + url: $('a', header).attr('href'), + dataType:'html', + beforeSend:function(){ + $('#tooltip').hide(); + header.next().addClass('loading'); + }, + success: function(data){ + header.removeClass('unread'); + + var dest = header.next(); + + dest.droppable('destroy').empty().removeClass('loading'); + + dest.append(data) + + $('a.WorkZoneElementRemover', dest) + .bind('mousedown', function(event){return false;}) + .bind('click', function(event){ + + return WorkZoneElementRemover($(this), false); + + }); + + dest.droppable({ + accept:function(elem){ + if($(elem).hasClass('CHIM')) + { + if($(elem).closest('.content')[0] == $(this)[0]) + { + return false; + } + } + if($(elem).hasClass('grouping') || $(elem).parent()[0]==$(this)[0]) + return false; + return true; + }, + hoverClass:'baskDrop', + scope:'objects', + drop:function(event, ui){ + dropOnBask(event,ui.draggable,$(this).prev()); + }, + tolerance:'pointer' + }); + + $('.noteTips, .captionRolloverTips', dest).tooltip(); + + dest.find('.CHIM').draggable({ + helper : function(){ + $('body').append('
      '+ + '
      '+ + p4.WorkZone.Selection.length() + '
      '); + return $('#dragDropCursor'); + }, + scope:"objects", + distance : 20, + scroll : false, + refreshPositions:true, + cursorAt: { + top:10, + left:-20 + }, + start:function(event, ui){ + var baskets = $('#baskets'); + baskets.append('
      '+ + '
      '); + $('.bottom-scroller',baskets).bind('mousemove',function(){ + $('#baskets .bloc').scrollTop($('#baskets .bloc').scrollTop()+30); + }); + $('.top-scroller',baskets).bind('mousemove',function(){ + $('#baskets .bloc').scrollTop($('#baskets .bloc').scrollTop()-30); + }); + }, + stop:function(){ + $('#baskets').find('.top-scroller, .bottom-scroller') + .unbind() + .remove(); + }, + drag:function(event,ui){ + if(is_ctrl_key(event) || $(this).closest('.content').hasClass('grouping')) + $('#dragDropCursor div').empty().append('+ '+p4.WorkZone.Selection.length()); + else + $('#dragDropCursor div').empty().append(p4.WorkZone.Selection.length()); + + } + }); + answerSizer(); + return; + } + }); + } + + + + + + + + function dropOnBask(event,from,destKey) + { + var action = "", + from = $(from), dest_uri = '', lstbr = [], + sselcont = [], act = "ADD"; + + if(from.hasClass("CHIM")) + { + /* Element(s) come from an open object in the workzone */ + action = $(' #baskets .ui-state-active').hasClass('grouping') ? 'REG2' : 'CHU2'; + } + else + { + /* Element(s) come from result */ + action = 'IMGT2'; + } + + action += destKey.hasClass('grouping') ? 'REG' : 'CHU'; + + if(destKey.hasClass('content')) + { + /* I dropped on content */ + dest_uri = $('a', destKey.prev()).attr('href'); + } + else + { + /* I dropped on Title */ + dest_uri = $('a', destKey).attr('href'); + } + + if(window.console) + { + window.console.log('Requested action is ', action, ' and act on ', dest_uri); + } + + if(action=="IMGT2CHU" || action=="IMGT2REG") + { + if($(from).hasClass('.baskAdder')) + { + lstbr = [$(from).attr('id').split('_').slice(2,4).join('_')]; + } + else + { + lstbr = p4.Results.Selection.get(); + } + } + else + { + sselcont = $.map(p4.WorkZone.Selection.get(), function(n,i){ + return $('.CHIM_'+n, $('#baskets .content:visible')).attr('id').split('_').slice(1,2).pop(); + }); + lstbr = p4.WorkZone.Selection.get(); + } + + switch(action) + { + case "CHU2CHU" : + if(!is_ctrl_key(event)) + act = "MOV"; + break; + + case "IMGT2REG": + case "CHU2REG" : + case "REG2REG": + var sameSbas = true, + sbas_reg = destKey.attr('sbas'); + + for (var i=0; i0) + refreshBaskets(data.pop()); + } + }); + } + + $(document).ready(function(){ + activeBaskets(); + + p4.WorkZone = { + 'Selection':new Selectable({selector : '.CHIM', container:$('#baskets')}), + 'refresh':refreshBaskets, + 'reloadCurrent':function(){ + var sstt = $('#baskets .content:visible'); + if(sstt.length === 0) + return; + getContent(sstt.prev()); + } + }; + }); + + return; +}(p4)) diff --git a/www/prod/jquery.dialogs.js b/www/prod/jquery.dialogs.js deleted file mode 100644 index 71447007c9..0000000000 --- a/www/prod/jquery.dialogs.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - - -$(document).ready(function(){ - - $('a.dialog').live('click', function(event){ - - var $this = $(this); - - $.ajax({ - type: "GET", - url: $this.attr('href'), - dataType: 'html', - beforeSend:function(){ - - }, - success: function(data){ - - $('#DIALOG').attr('title', $this.attr('title')) - .empty() - .append(data) - .dialog() - .dialog('open'); - - - - return; - } - }); - - return false; - }); - -}); \ No newline at end of file diff --git a/www/prod/jquery.edit.js b/www/prod/jquery.edit.js index a00be8d94a..06a2dc285a 100644 --- a/www/prod/jquery.edit.js +++ b/www/prod/jquery.edit.js @@ -1365,7 +1365,7 @@ function edit_applyMultiDesc(evt) , success : function(data){ if(p4.edit.what == 'GRP' || p4.edit.what == 'SSEL') - refreshBaskets('current'); + return p4.WorkZone.refresh('current'); $("#Edit_copyPreset_dlg").remove(); $('#EDITWINDOW').hide(); hideOverlay(2); diff --git a/www/prod/newimg.php b/www/prod/newimg.php index 18dee3fe2c..a8e0087a86 100644 --- a/www/prod/newimg.php +++ b/www/prod/newimg.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); phrasea::headers(); diff --git a/www/prod/newtemporary.php b/www/prod/newtemporary.php deleted file mode 100644 index de019ca238..0000000000 --- a/www/prod/newtemporary.php +++ /dev/null @@ -1,262 +0,0 @@ -get_session(); -phrasea::headers(); - -$usr_id = $session->get_usr_id(); -$user = User_Adapter::getInstance($usr_id, $appbox); -$request = http_request::getInstance(); - -if ($request->has_post_datas()) -{ - $parm = $request->get_parms('name', 'type', 'desc', 'lst', 'coll'); - - if (trim($parm['name']) != '') - { - if (is_null($parm['type']) || $parm['type'] == "CHU") - { - try - { - $basket = basket_adapter::create($appbox, $parm['name'], $user, $parm['desc']); - - if (trim($parm['lst']) != '') - { - $basket->push_list($parm['lst'], false); - } - echo ""; - exit(); - } - catch (Exception $e) - { - - } - } - elseif ($parm['type'] == "REG") - { - try - { - $basket = basket_adapter::create($appbox, $parm['name'], $user, $parm['desc'], null, $parm['coll']); - if ($parm['lst'] != '') - $basket->push_list($parm['lst'], false); - echo ""; - exit(); - } - catch (Exception $e) - { -?> - - - -ACL(); -$html = array(); - -$list = $ACL->get_granted_base(array('canaddrecord')); -$current_sbas_id = false; -foreach ($list as $base_id=>$collection) -{ - $sbas_id = $collection->get_databox()->get_sbas_id(); - if (!isset($html[$sbas_id])) - $html[$sbas_id] = ''; - $html[$sbas_id] .= ''; -} - -$menu = ''; -foreach ($html as $sbas_id => $sbas) - $menu .= '' . $sbas . ''; - -$parm = $request->get_parms('type'); -?> - - - <?php echo _('action:: nouveau panier') ?> - - - - - - - - - -
      -
      -
        -
      • -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - : -
      -
      - value="CHU"> -
      - - value="REG"> - -
      - - - -
      - - - - - - - - - - - - -
       :
       :
      -
      -
      - - -
      -
      -
      -
      - - - diff --git a/www/prod/page0.js b/www/prod/page0.js index f104f15ed6..a575caf211 100644 --- a/www/prod/page0.js +++ b/www/prod/page0.js @@ -1,6 +1,6 @@ document.getElementById('loader_bar').style.width = '30%'; -var p4 = {}; +var p4 = p4 || {}; var baskAjax,baskAjaxrunning; baskAjaxrunning = false; @@ -125,20 +125,6 @@ function getLanguage(){ } }); } -//function loadBask(sselid,el){ -// -// $("#baskets .SSTT").removeClass('ui-state-focus ui-state-hover active'); -// $(el).addClass('ui-state-focus active'); -// -// -// if($(el).next().is(':visible')) -// { -// return true; -// } -// -// getBask(sselid,el); -// p4.baskSel = []; -//} function is_ctrl_key(event) { @@ -166,312 +152,6 @@ function is_shift_key(event) } -function getBask(sselid,el,ord) -{ - if(typeof ord == 'undefined') - ord = ''; - - $.ajax({ - type: "GET", - url: "/prod/baskets/" + sselid+ "/", - dataType:'html', - data: { - ord:ord - }, - beforeSend:function(){ - $('#tooltip').hide(); - $(el).next().addClass('loading'); - - }, - success: function(data){ - $(el).removeClass('unread'); - $(el).next().droppable('destroy').empty().removeClass('loading'); - $(el).next().append(data).droppable({ - accept:function(elem){ - if($(elem).hasClass('CHIM')) - { - if($(elem).closest('.content')[0] == $(this)[0]) - { - return false; - } - } - if($(elem).hasClass('grouping') || $(elem).parent()[0]==$(this)[0]) - return false; - return true; - }, - hoverClass:'baskDrop', - scope:'objects', - drop:function(event, ui){ - dropOnBask(event,ui.draggable,$(this).prev()); - }, - tolerance:'pointer' - }); - $('.noteTips, .captionRolloverTips',$(el).next()).tooltip(); - $(el).next().find('.CHIM').draggable({ - helper : function(){ - $('body').append('
      '+ - '
      '+ - p4.baskSel.length+'
      '); - return $('#dragDropCursor'); - }, - scope:"objects", - distance : 20, - scroll : false, - refreshPositions:true, - cursorAt: { - top:10, - left:-20 - }, - start:function(event, ui){ - var baskets = $('#baskets'); - baskets.append('
      '+ - '
      '); - $('.bottom-scroller',baskets).bind('mousemove',function(){ - $('#baskets .bloc').scrollTop($('#baskets .bloc').scrollTop()+30); - }); - $('.top-scroller',baskets).bind('mousemove',function(){ - $('#baskets .bloc').scrollTop($('#baskets .bloc').scrollTop()-30); - }); - }, - stop:function(){ - $('#baskets').find('.top-scroller, .bottom-scroller') - .unbind() - .remove(); - }, - drag:function(event,ui){ - if(is_ctrl_key(event) || $(this).closest('.content').hasClass('grouping')) - $('#dragDropCursor div').empty().append('+ '+p4.baskSel.length); - else - $('#dragDropCursor div').empty().append(p4.baskSel.length); - - } - }); - answerSizer(); - return; - } - }); -} - -function dropOnBask(event,from,destKey) -{ - var action = "", - from = $(from), - current_opened_sstt = $(' #baskets .ui-state-active'); - - - if(from.hasClass("CHIM")) - action = (current_opened_sstt.hasClass('grouping')?'REG':'CHU') + "2"; - else - action = 'IMGT2'; - - action += destKey.hasClass('grouping')?'REG':'CHU'; - - - dest_sbas = destKey.attr('sbas') ; - cur_sbas = $(from).attr('sbas') ; - - var ssttid_dest = destKey.attr('id').split('_').slice(1,2).pop(); - - if(destKey.hasClass('content')) - { - var ssttid_dest_uri = $('a', destKey.prev()).attr('href'); - } - else - { - var ssttid_dest_uri = $('a', destKey).attr('href'); - } - - var lstbr; - var sselcont = []; - if(action=="IMGT2CHU" || action=="IMGT2REG") - { - sselcont = []; - lstbr = p4.sel.join(';'); - if($(from).hasClass('.baskAdder')) - lstbr = $(from).attr('id').split('_').slice(2,4).join('_'); - } - else - { - var content = $('#baskets .content:visible'); - sselcont = $.map(p4.baskSel, function(n,i){ - return $('.CHIM_'+n,content).attr('id').split('_').slice(1,2).pop(); - }); - lstbr = p4.baskSel.join(';'); - } - - var act = "ADD"; - - switch(action) - { - case "IMGT2CHU": // image de recherche vers une selection - case "CHU2CHU" : // image de selection vers une selection - - if(event && !is_ctrl_key(event) && action=="CHU2CHU") - act = "MOV"; - - break; - - case "IMGT2REG": // image de recherche vers un regroupement - case "CHU2REG" : // image de selection vers un regroupement - - if(action=="IMGT2REG") - { - var sbasDepart = destKey.attr('sbas'); - - lstbr = new Array; - sameSbas = true; - - for (var i=0; i0) - { - if(elem.attr('sbas')!=sbasDepart) - sameSbas = false; - else - lstbr.push(p4.sel[i]); - } - else - lstbr.push(p4.sel[i]); - - } - lstbr = lstbr.join(';'); - - } - - if(cur_sbas!=dest_sbas || (action=="IMGT2REG" && sameSbas==false )) - { - - var texte = language.reg_wrong_sbas; - - var button = new Object; - button[language.annuler] = function(){ - $('#DIALOG').dialog('close'); - }; - - $("#DIALOG").attr('title','') - .empty() - .append(texte) - .dialog({ - - autoOpen:false, - closeOnEscape:true, - resizable:false, - draggable:false, - modal:true, - buttons : button, - draggable:false, - overlay: { - backgroundColor: '#000', - opacity: 0.7 - } - }).dialog('open'); - // if(lstbr == '') - return; - } - if(action=="CHU2REG" && !is_ctrl_key(event)) - act = "MOV"; - - break; - - case "REG2REG": // image d'un regroupement vers un regroupement - if(cur_sbas!=dest_sbas) - { - alert(language.wrongsbas); - return; - } - // if(!is_ctrl_key(event)) - // act = "MOV"; - - break; - - case "REG2CHU": - - // if(!is_ctrl_key(event)) - // act = "MOV"; - - break; - } - - var from_id = false; - - if(action == 'CHU2CHU' || action == 'REG2REG' || action == 'CHU2REG' || action == 'REG2CHU') - { - from_id = $(from).closest('.content').attr('id').split('_').pop(); - } - - if(action == 'IMGT2CHU') - { - if(act == 'ADD') - { - var url = ssttid_dest_uri + "addElements/"; - var data = { - lst:lstbr - }; - } - } - else - { - if(action == 'IMGT2REG') - { - if(act == 'ADD') - { - var url = ssttid_dest_uri + "addElements/"; - var data = { - lst:lstbr - }; - } - } - } - - $.ajax({ - type: "POST", - url: url, - data: data, - dataType:'json', - // data: { - // action: act+action, - // sselcont:sselcont.join(';'), - // lst:lstbr, - // dest:ssttid_dest, - // from:from_id - // }, - beforeSend:function(){ - - }, - success: function(data){ - if(!data.success) - { - humane.error(data.message); - if(!data.result) - return; - } - else - { - humane.info(data.message); - } - // var main = action.substr(0,4); - // if(main == 'CHU2' || main=='REG2') - // { - // if(act == 'MOV') - // { - // $('.wrapCHIM_'+data.datas.join(', .wrapCHIM_')).remove(); - // p4.baskSel = []; - // } - // } - // - var current_id = current_opened_sstt.length > 0 ? current_opened_sstt.attr('id').split('_').pop() : null; - if((act == 'MOV') || (current_id == ssttid_dest)) - { - refreshBaskets('current','',true); - } - return; - } - }); -} - function checkBases(bool) @@ -670,7 +350,7 @@ function newSearch() bases.append(''); }); - p4.sel = []; + p4.Results.Selection.empty(); var val = $('#EDIT_query').val(); $('#searchForm input[name="qry"]').val(val); @@ -742,15 +422,8 @@ function newAdvSearch() $('#EDIT_query').val(val); newSearch(); -// $('#adv_search').dialog('close'); } -//function stopEvent(e) -//{ -// -// e.stopPropagation();e.preventDefault();e.cancelBubble;return false; -//} - function beforeSearch() { @@ -808,7 +481,7 @@ function afterSearch() viewNbSelect(); $('#idFrameA div.IMGT').draggable({ helper : function(){ - $('body').append('
      '+p4.sel.length+'
      '); + $('body').append('
      '+p4.Results.Selection.length()+'
      '); return $('#dragDropCursor'); }, scope:"objects", @@ -900,79 +573,6 @@ function answerSizer() } -function setTemporaryPref(name,value) -{ - - $.ajax({ - type: "POST", - url: "/prod/prodFeedBack.php", - data: { - action: "SAVETEMPPREF", - prop:name, - value:value - }, - success: function(data){ - return; - } - }); -} - -function unFix(el) -{ - var id = $(el).attr('id').split('_').slice(1,2).pop(); - $.ajax({ - type: "POST", - url: "/prod/prodFeedBack.php", - data: { - action: "UNFIX", - lst:id - }, - success: function(data){ - $('#SSTT_'+id).next().droppable('destroy').remove(); - $('#SSTT_'+id).droppable('destroy').remove(); - } - }); -} -function fix() -{ - $.ajax({ - type: "POST", - url: "/prod/prodFeedBack.php", - dataType: "json", - data: { - action: "FIX", - lst:p4.sel.join(';') - }, - success: function(data){ - if(data.length>0) - refreshBaskets(data.pop()); - } - }); -} - -function newTemp() -{ - $('#MODALDL').attr('src','about:blank'); - $('#MODALDL').attr('src',"newtemporary.php"); - - - var t = (bodySize.y - 400) / 2; - var l = (bodySize.x - 400) / 2; - - $('#MODALDL').css({ - 'display': 'block', - 'opacity': 0, - 'width': '400px', - 'position': 'absolute', - 'top': t, - 'left': l, - 'height': '440px' - }).fadeTo(500, 1); - - showOverlay(2); - -} - function linearize() { var list = $('#answers .list'); @@ -1008,254 +608,6 @@ function linearize() } -function refreshBaskets(baskId, sort, scrolltobottom) -{ - var active = $('#idFrameC #baskets .SSTT.ui-state-active'); - if(baskId == 'current' && active.length>0) - baskId = active.attr('id').split('_').slice(1,2).pop(); - sort = ($.inArray(sort, ['date', 'name'])>=0) ? sort : ''; - - scrolltobottom = typeof scrolltobottom == 'undefined' ? false : scrolltobottom; - - $.ajax({ - type: "GET", - url: "/prod/WorkZone/", - data: { - type:'basket', - id:baskId, - sort:sort - }, - beforeSend:function(){ - $('#basketcontextwrap').remove(); - }, - success: function(data){ - - var cache = $("#idFrameC #baskets"); - $(".SSTT",cache).droppable('destroy'); - - $('.bloc',cache).droppable('destroy'); - cache.accordion('destroy') - - .empty() - .append(data); - - activeBaskets(); - $('.basketTips').tooltip({ - delay: 200 - }); - cache.disableSelection(); - - if(!scrolltobottom) - return; - - p4.next_bask_scroll = true; - return; - } - }); -} - -function activeBaskets() -{ - var cache = $("#idFrameC #baskets"); - cache.accordion({ - active:'active', - autoHeight: false, - collapsible:true, - header:'div.header', - change:function(event,ui){ - - if(p4.next_bask_scroll) - { - p4.next_bask_scroll = false; - - var b_active = $('#baskets .SSTT.active'); - - if(!b_active.next().is(':visible')) - return; - - var t = $('#baskets .SSTT.active').position().top + b_active.next().height() -200; - - t = t < 0 ? 0 : t; - - $('#baskets .bloc').stop().animate({ - scrollTop:t - }); - } - - var uiactive = $(this).find('.ui-state-active'); - - if(uiactive.length === 0) - { - return; /* everything is closed */ - } - - var clicked = uiactive.attr('id').split('_').pop(); - var href = $('a', uiactive).attr('href'); - - uiactive.addClass('ui-state-focus active'); - - p4.baskSel = []; - - $('#SSTT_content_'+clicked) - .empty() - .addClass('loading') - .load(href, function(){ - $(this).removeClass('loading'); - - $('a.WorkZoneElementRemover', $(this)) - .bind('mousedown', function(event){return false;}) - .bind('click', function(event){ - - return WorkZoneElementRemover($(this), false); - - function WorkZoneElementRemover(el, confirm) - { - - if(confirm !== true && $(el).hasClass('groupings') && p4.reg_delete == true) - { - var buttons = {}; - - - buttons[language.valider] = function() { - $("#DIALOG-baskets").dialog('close').remove(); - WorkZoneElementRemover(el,true); - }; - - buttons[language.annuler] = function(){ - $("#DIALOG-baskets").dialog('close').remove(); - }; - - var texte = '

      '+language.confirmRemoveReg+'

      '+language.hideMessage+'
      '; - $('body').append('
      '); - $("#DIALOG-baskets").attr('title',language.removeTitle) - .empty() - .append(texte) - .dialog({ - - autoOpen:false, - closeOnEscape:true, - resizable:false, - draggable:false, - modal:true, - buttons:buttons, - draggable:false, - overlay: { - backgroundColor: '#000', - opacity: 0.7 - } - }).dialog('open'); - return; - } - - var full_id = $(el).attr('id').split('_'); - var id = full_id.pop(); - var ssel_id = full_id.pop(); - $.ajax({ - type: "POST", - url: $(el).attr('href'), - dataType:'json', - beforeSend : function(){ - $('.wrapCHIM_'+id).find('.CHIM').fadeOut(); - }, - success: function(data){ - - if(data.success) - { - humane.info(data.message); - var k = $(el).parent().attr('id').split('_').slice(2,4).join('_'); - if($.inArray(k,p4.baskSel)>=0) - { - p4.baskSel = $.grep(p4.baskSel,function(n){ - return(n!=k); - }); - } - $('.wrapCHIM_'+id).find('.CHIM').draggable('destroy'); - $('.wrapCHIM_'+id).remove(); - } - else - { - humane.error(data.message); - $('.wrapCHIM_'+id).find('.CHIM').fadeIn(); - } - return; - } - }); - return false; - } - }); - }); - - }, - changestart:function(event,ui){ - $('#basketcontextwrap .basketcontextmenu').hide(); - } - }); - $('.bloc',cache).droppable({ - accept:function(elem){ - if($(elem).hasClass('grouping') && !$(elem).hasClass('SSTT')) - return true; - return false; - }, - scope:'objects', - hoverClass:'groupDrop', - tolerance:'pointer', - drop:function(){ - fix(); - } - }); - - if($('.SSTT.active',cache).length>0) - { - var el = $('.SSTT.active',cache)[0]; - $(el).trigger('click'); - } - - - $(".SSTT, .content",cache) - .droppable({ - scope:'objects', - hoverClass:'baskDrop', - tolerance:'pointer', - accept:function(elem){ - if($(elem).hasClass('CHIM')) - { - if($(elem).closest('.content').prev()[0] == $(this)[0]) - { - return false; - } - } - if($(elem).hasClass('grouping') || $(elem).parent()[0]==$(this)[0]) - return false; - return true; - }, - drop:function(event,ui){ - dropOnBask(event,ui.draggable,$(this)); - } - }); - - if($('#basketcontextwrap').length == 0) - $('body').append('
      '); - - $('.context-menu-item',cache).hover(function(){ - $(this).addClass('context-menu-item-hover'); - },function(){ - $(this).removeClass('context-menu-item-hover'); - }); - $.each($(".SSTT",cache),function(){ - var el = $(this); - $(this).find('.contextMenuTrigger').contextMenu('#'+$(this).attr('id')+' .contextMenu',{ - 'appendTo':'#basketcontextwrap', - openEvt:'click', - theme:'vista', - dropDown:true, - showTransition:'slideDown', - hideTransition:'hide', - shadow:false - }); - }); - -} - function initLook() { @@ -1516,31 +868,28 @@ $(document).ready(function(){ }); $('.basket_refresher').live('click', function(){ - refreshBaskets('current'); + return p4.WorkZone.refresh('current'); return false; }); $('#loader_bar').stop().animate({ width:'70%' },450); - p4 = { - preview :{ + + p4.preview ={ open:false, current:false - }, - currentViewMode:'classic', - nbNoview:0, - reg_delete:true, - lng:'', - sel:[], - baskSel:[], - edit:{}, - thesau:{ + }; + p4.currentViewMode='classic'; + p4.nbNoview=0; + p4.reg_delete=true; + p4.lng=''; + p4.edit={}; + p4.thesau={ tabs:null - }, - active_zone:false, - next_bask_scroll: false - }; + }; + p4.active_zone=false; + p4.next_bask_scroll= false; $('#backcolorpickerHolder').ColorPicker({ @@ -1726,17 +1075,7 @@ $(document).ready(function(){ startThesaurus(); activeFilters(); checkFilters(); - activeBaskets(); - $("#baskets div.content select[name=valid_ord]").live('change',function(){ - - var active = $('#idFrameC #baskets .SSTT.ui-state-active'); - if(active.length==0) - return; - var baskId = active.attr('id').split('_').slice(1,2).pop(); - - getBask(baskId,$('#SSTT_'+baskId),$(this).val()); - }); activeZoning(); @@ -1831,48 +1170,6 @@ $(document).ready(function(){ } }); - $('#idFrameA div.IMGT').live('mousedown',function(event){ - evt_mdwn_obj(this, event); - return; - }); - - $('#idFrameA div.IMGT').live('click',function(event){ - if(is_shift_key(event) || is_ctrl_key(event)) - return true; - p4.sel = new Array(); - $('#answers .IMGT.selected').removeClass('selected last_selected'); - var k = $(this).attr('id').split('_').slice(1,3).join('_'); - select_this($(this),k) - $(this).addClass('last_selected'); - return; - }); - - - - - $('#idFrameC div.CHIM').live('mousedown',function(event){ - baskSelection(this, event); - return; - }); - - $('#idFrameC div.CHIM').live('click',function(event){ - if(is_shift_key(event) || is_ctrl_key(event)) - return true; - p4.baskSel = new Array(); - var cont = $('#idFrameC .SSTT.content:visible'); - $('.CHIM.selected, .CHIM.last_selected', cont).removeClass('selected last_selected'); - - var k = $(this).attr('id').split('_').slice(2,4).join('_'); - p4.baskSel.push(k); - $(this).addClass('selected last_selected'); - return; - }); - - - - $('#idFrameC .SSTT').live('mousedown',function(event){ - return; - }); $('button.answer_selector').bind('click',function(){ selector($(this)); }).bind('mouseover',function(event){ @@ -2092,19 +1389,19 @@ $(document).ready(function(){ case 80://P if(is_ctrl_key(event)) { - printThis("lst="+p4.sel.join(';')); + printThis("lst="+p4.Results.Selection.serialize()); cancelKey = shortCut = true; } break; case 69://e if(is_ctrl_key(event)) { - editThis('IMGT',p4.sel.join(';')); + editThis('IMGT',p4.Results.Selection.serialize()); cancelKey = shortCut = true; } break; // case 46://del - // deleteThis(p4.sel.join(';')); + // deleteThis(p4.Results.Selection.serialize()); // cancelKey = true; // break; case 40: // down arrow @@ -2140,33 +1437,26 @@ $(document).ready(function(){ case 65: // a if(is_ctrl_key(event)) { - $.each($("#baskets div.content:visible .CHIM.diapo"),function(i,n){ - var k = $(n).attr('id').split('_').slice(2,4).join('_'); - if($.inArray(k,p4.baskSel) <0) - { - p4.baskSel.push(k); - $(n).addClass('selected'); - } - }); + p4.WorkZone.Selection.selectAll(); cancelKey = shortCut = true; } break; case 80://P if(is_ctrl_key(event)) { - printThis("lst="+p4.baskSel.join(';')); + printThis("lst="+p4.WorkZone.Selection.serialize()); cancelKey = shortCut = true; } break; case 69://e if(is_ctrl_key(event)) { - editThis('IMGT',p4.baskSel.join(';')); + editThis('IMGT',p4.WorkZone.Selection.serialize()); cancelKey = shortCut = true; } break; // case 46://del - // deleteThis(p4.sel.join(';')); + // deleteThis(p4.Results.Selection.serialize()); // cancelKey = true; // break; case 40: // down arrow @@ -2389,64 +1679,6 @@ function editThis(type,value) return; } -function renameThis(ssel) -{ - $.ajax({ - type: "POST", - url: "/prod/prodFeedBack.php", - data: { - action: "BASKETRENAME", - ssel_id:ssel, - name:$('#basket-dialog input[name=name]').val(), - description:$('#basket-desc').val() - }, - success: function(data){ - refreshBaskets('current'); - } - }); -} - -function renameBasket(that,ssel) -{ - var buttons = {}; - - buttons[language.valider] = function() { - renameThis(ssel); - $('#basket-dialog').dialog('close'); - - }; - - buttons[language.annuler] = function(){ - $('#basket-dialog').dialog('close'); - }; - - $.ajax({ - type: "GET", - url: "/prod/baskets/"+ssel+'/update/', - dataType : 'html', - success: function(data){ - - $("#basket-dialog") - .dialog({ - title:language.bask_rename, - autoOpen:false, - closeOnEscape:true, - resizable:false, - draggable:false, - modal:true, - overlay: { - backgroundColor: '#000', - opacity: 0.7 - } - }).dialog('option','buttons',buttons) - .dialog('open'); - $('#basket-dialog input[name=name]').val(data.name); - $('#basket-dialog textarea').val(data.description); - } - }); -} - - (function($) { $.fn.extend({ highlight: function(color) { @@ -2685,15 +1917,15 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - value = "lst=" + p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + value = "lst=" + p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - value = "lst=" + p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + value = "lst=" + p4.WorkZone.Selection.serialize(); else value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -2722,15 +1954,15 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - datas.lst = p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + datas.lst = p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - datas.lst = p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + datas.lst = p4.WorkZone.Selection.serialize(); else datas.ssel = $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -2761,14 +1993,14 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) + if(p4.Results.Selection.length() > 0) type = 'IMGT'; } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) + if(p4.WorkZone.Selection.length() > 0) type = 'CHIM'; } } @@ -2789,20 +2021,20 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) + if(p4.Results.Selection.length() > 0) { type = 'IMGT'; - value = p4.sel.join(';'); + value = p4.Results.Selection.serialize(); } } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) + if(p4.WorkZone.Selection.length() > 0) { type = 'IMGT'; - value = p4.baskSel.join(';'); + value = p4.WorkZone.Selection.serialize(); } else { @@ -2836,20 +2068,20 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) + if(p4.Results.Selection.length() > 0) { type = 'IMGT'; - value = p4.sel.join(';'); + value = p4.Results.Selection.serialize(); } } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) + if(p4.WorkZone.Selection.length() > 0) { type = 'IMGT'; - value = p4.baskSel.join(';'); + value = p4.WorkZone.Selection.serialize(); } else { @@ -2912,15 +2144,15 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - value.lst = p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + value.lst = p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - value.lst = p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + value.lst = p4.WorkZone.Selection.serialize(); else value.ssel = $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -2952,15 +2184,15 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - value = "lst=" + p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + value = "lst=" + p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - value = "lst=" + p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + value = "lst=" + p4.WorkZone.Selection.serialize(); else value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -2987,15 +2219,15 @@ function activeIcons() var value=""; if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - value = "lst=" + p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + value = "lst=" + p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - value = "lst=" + p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + value = "lst=" + p4.WorkZone.Selection.serialize(); else value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -3023,15 +2255,15 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) - value = "lst=" + p4.sel.join(';'); + if(p4.Results.Selection.length() > 0) + value = "lst=" + p4.Results.Selection.serialize(); } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) - value = "lst=" + p4.baskSel.join(';'); + if(p4.WorkZone.Selection.length() > 0) + value = "lst=" + p4.WorkZone.Selection.serialize(); else value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); } @@ -3060,18 +2292,18 @@ function activeIcons() if($(this).hasClass('results_window')) { - if(p4.sel.length > 0) + if(p4.Results.Selection.length() > 0) { - datas.lst = p4.sel.join(';'); + datas.lst = p4.Results.Selection.serialize(); } } else { if($(this).hasClass('basket_window')) { - if(p4.baskSel.length > 0) + if(p4.WorkZone.Selection.length() > 0) { - datas.lst = p4.baskSel.join(';'); + datas.lst = p4.WorkZone.Selection.serialize(); } else { @@ -3119,9 +2351,9 @@ function checkDeleteThis(type, el) var lst = ''; if(type == 'IMGT') - lst = p4.sel.join(';'); + lst = p4.Results.Selection.serialize(); if(type == 'CHIM') - lst = p4.baskSel.join(';'); + lst = p4.WorkZone.Selection.serialize(); deleteThis(lst); @@ -3260,7 +2492,7 @@ function downloadThis(datas) function viewNbSelect() { - $("#nbrecsel").empty().append(p4.sel.length); + $("#nbrecsel").empty().append(p4.Results.Selection.length()); } function selector(el) @@ -3373,12 +2605,12 @@ function selector(el) function select_this(n,k) { - if(p4.sel.length >= 800) + if(p4.Results.Selection.length() >= 800) { alert(language.max_record_selected); return false; } - p4.sel.push(k); + p4.Results.Selection.push(k); $(n).addClass('selected'); return true; } @@ -3400,210 +2632,6 @@ function evt_add_in_chutier(a,b,event,el) } -function evt_mdwn_obj(obj, evt) //, i, idx) -{ - if(typeof($(obj).attr('id')) == undefined) - return; - var objId = $(obj).attr('id').split('_'); - - $('#answercontextwrap table:visible').hide(); - - switch(objId[0]) - { - case "IMGT": - var cont = $('#idFrameA'); - // on a clique sur une imagette - k = objId.slice(1,3).join('_'); - - if(is_shift_key(evt) && $('.IMGT.last_selected', cont).length!=0) - { - // la touche shift est pressee - var lst = $('.IMGT', cont); - var index1 = $.inArray($('.IMGT.last_selected', cont)[0],lst); - var index2 = $.inArray($(obj)[0],lst); - - if(index2=0) - { - p4.sel = $.grep(p4.sel,function(n){ - return(n!=k); - }); - $(obj).removeClass('selected'); - } - else - { - // if(p4.sel >= 400) - // { - // alert(language.max_record_selected); - // return; - // } - - if(!select_this(obj,k)) - return false; - // p4.sel.push(k); - // $(obj).addClass('selected'); - } - } - } - - $('.last_selected', cont).removeClass('last_selected'); - $(obj).addClass('last_selected'); - - viewNbSelect(); - - break; - case "SSTT": // l'onglet d'un chutier - case "SSEL": // le contenant d'un chutier - case "CHIM": // une imagette dans un chutier - case "PREV": // une preview - // dragObj.dragSrc = obj; - break; - default: - break; - } - return false; -} - -function baskSelection(obj,evt) -{ - var cont = $('#idFrameC .content:visible'); - // on a clique sur une imagette - var objId = $(obj).attr('id'); - var k = $(obj).attr('id').split('_').slice(2,4).join('_'); - - if(is_shift_key(evt) && $('.CHIM.last_selected', cont).length!=0) - { - // la touche shift est pressee - var lst = $('.CHIM', cont); - var index1 = $.inArray($('.CHIM.last_selected', cont)[0],lst); - var index2 = $.inArray($(obj)[0],lst); - - if(index2=0) - { - p4.baskSel = $.grep(p4.baskSel,function(n){ - return(n!=k); - }); - $(obj).removeClass('selected'); - } - else - { - p4.baskSel.push(k); - $(obj).addClass('selected'); - } - } - } - - $('.last_selected', cont).removeClass('last_selected'); - $(obj).addClass('last_selected'); - return false; -} - -// ----------------------------------------------------------------------------------------------- - - function doSpecialSearch(qry, allbase){ if (allbase) { checkBases(true); @@ -3664,7 +2692,6 @@ function doDelete(lst) $.each(data,function(i,n){ var imgt = $('#IMGT_'+n); - var chim = $('.CHIM_'+n); $('.doc_infos', imgt).remove(); imgt.unbind("click").removeAttr("ondblclick").removeClass("selected").draggable("destroy").removeClass("IMGT").find("img").unbind(); imgt.find(".thumb img").attr("src","/skins/icons/deleted.png").css({ @@ -3674,15 +2701,10 @@ function doDelete(lst) chim.parent().slideUp().remove(); imgt.find(".status,.title,.bottom").empty(); - if($.inArray(n,p4.sel)>=0) - { - p4.sel = $.grep(p4.sel,function(m){ - return(m!=n); - }); - } + p4.Results.Selection.remove(n); + p4.WorkZone.Selection.remove(n); }); viewNbSelect(); - refreshBaskets('current'); } }); } @@ -3705,7 +2727,7 @@ function deleteBasket(item) $('#SSTT_'+k).slideUp().droppable('destroy').remove(); if($('#baskets .SSTT').length == 0) - refreshBaskets(false); + return p4.WorkZone.refresh(false); } else { @@ -3784,26 +2806,9 @@ function advSearch(event) { event.cancelBubble = true; alternateSearch(false); - // var adv_buttons = {}; - // adv_buttons[language.rechercher] = function(){ - // newAdvSearch(); - // }; - // adv_buttons[language.fermer] = function(){ - // $('#adv_search').dialog('close'); - // }; - $('#idFrameC .tabs a.adv_search').trigger('click'); -// $("#adv_search") -// .dialog('option','title',language.advsearch_title) -// .dialog('option','buttons',adv_buttons) -// .dialog('option','height',(bodySize.y-100)).dialog('open'); -// var h = $("#adv_search").innerHeight()-$("#adv_search .ui-tabs-nav").outerHeight(); -// $('#adv_search .ui-tabs-panel').height(h-30); -// $('#adv_search .ui-tabs-panel .innerBox').height(h-50); -// $('#adv_filters .adv_search_bind input').each(function(i,n){ -// $(this).val(''); -// }); -// $('#adv_search input[name=query_all]').val($('#EDIT_query').val()).select(); +$('#idFrameC .tabs a.adv_search').trigger('click'); + } function start_page_selector() @@ -3991,7 +2996,7 @@ function saveWindows() function gotopage(pag) { - document.forms['search'].sel.value = p4.sel.join(';'); + document.forms['search'].sel.value = p4.Results.Selection.serialize(); $('#formAnswerPage').val(pag); $('#searchForm').submit(); } @@ -4180,7 +3185,7 @@ function save_order() $.post("prodFeedBack.php" , options , function(data){ - refreshBaskets('current'); + return p4.WorkZone.refresh('current'); return; }); diff --git a/www/prod/prodFeedBack.php b/www/prod/prodFeedBack.php index b7dc344b19..cc76544a0f 100644 --- a/www/prod/prodFeedBack.php +++ b/www/prod/prodFeedBack.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -108,59 +108,6 @@ switch ($action) $output = 1; break; -// case 'BASKETS': -// require ($registry->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php'); -// $parm = $request->get_parms('id', 'sort'); -// $baskets = new basketCollection($appbox, $usr_id); -// -// $twig = new supertwig(); -// $twig->addFilter(array('get_collection_logo' => 'collection::getLogo')); -// -// $output = $twig->render('prod/baskets.html', array( -// 'basket_collection' => $baskets, -// 'selected_ssel' => $parm['id'], -// 'srt' => $parm['sort'] -// ) -// ); -// break; -// case 'BASKETNAME': -// require ($registry->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php'); -// $parm = $request->get_parms('ssel_id'); -// $basket = basket_adapter::getInstance($appbox, $parm['ssel_id'], $usr_id); -// $output = p4string::jsonencode(array('name' => $basket->get_name(), 'description' => $basket->get_description())); -// break; - case 'BASKETRENAME': - require ($registry->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php'); - $parm = $request->get_parms('ssel_id', 'name', 'description'); - $basket = basket_adapter::getInstance($appbox, $parm['ssel_id'], $usr_id); - $basket->set_name($parm['name']); - $basket->set_description($parm['description']); -// $output = $basket->save(); - break; - - case 'GETBASKET': - require ($registry->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php'); - - $twig = new supertwig(); - $twig->addFilter(array('nl2br' => 'nl2br')); - - $parm = $request->get_parms('id', 'ord'); - - $basket = basket_adapter::getInstance($appbox, $parm['id'], $usr_id); - $basket->set_read(); - - $order = $parm['ord']; - - if (trim($order) == '' || !in_array($order, array('asc', 'desc', 'nat'))) - $order = $user->getPrefs('bask_val_order'); - else - $user->setPrefs('bask_val_order', $order); - - $basket->sort($order); - - $output = p4string::jsonencode(array('content' => $twig->render('prod/basket.twig', array('basket' => $basket, 'ordre' => $order)))); - break; - case 'DELETE': require ($registry->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php'); $parm = $request->get_parms('lst'); @@ -178,11 +125,6 @@ switch ($action) break; - case 'REORDER_DATAS': - $parm = $request->get_parms('ssel_id'); - $basket = basket_adapter::getInstance($appbox, $parm['ssel_id'], $usr_id); - $output = $basket->getOrderDatas(); - break; case 'SAVE_ORDER_DATAS': $parm = $request->get_parms('ssel_id', 'value'); $basket = basket_adapter::getInstance($appbox, $parm['ssel_id'], $usr_id); @@ -281,17 +223,6 @@ switch ($action) $basket = basket_adapter::getInstance($appbox, $parm['dest'], $usr_id); $output = p4string::jsonencode($basket->push_list($parm['lst'], false)); break; - case 'DELFROMBASK': - $parm = $request->get_parms('ssel_id', 'sselcont_id'); - $basket = basket_adapter::getInstance($appbox, $parm['ssel_id'], $usr_id); - $output = p4string::jsonencode($basket->remove_from_ssel($parm['sselcont_id'])); - break; - case 'DELBASK': - $parm = $request->get_parms('ssel'); - $basket = basket_adapter::getInstance($appbox, $parm['ssel'], $usr_id); - $output = $basket->delete(); - unset($basket); - break; case 'MOVCHU2CHU': $parm = $request->get_parms('from', 'dest', 'sselcont'); diff --git a/www/prod/publish.php b/www/prod/publish.php index 43ceb8076b..55da404848 100644 --- a/www/prod/publish.php +++ b/www/prod/publish.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $message = ''; try diff --git a/www/prod/push.feedback.php b/www/prod/push.feedback.php index a77fe208d3..cd1135acec 100644 --- a/www/prod/push.feedback.php +++ b/www/prod/push.feedback.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/prod/pushdoc.php b/www/prod/pushdoc.php index f22ad0ef66..42a5c546e7 100644 --- a/www/prod/pushdoc.php +++ b/www/prod/pushdoc.php @@ -15,7 +15,7 @@ * @link www.phraseanet.com */ define('ZFONT', 'freesans'); -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); @@ -687,7 +687,7 @@ if ($act == "SEND") } ?> get_session(); diff --git a/www/prod/share.php b/www/prod/share.php index 01e7f6245b..54731e8709 100644 --- a/www/prod/share.php +++ b/www/prod/share.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(); $appbox = appbox::get_instance(); $registry = $appbox->get_registry(); diff --git a/www/report/ajax_chart.php b/www/report/ajax_chart.php index fb172be261..074c3c42dc 100644 --- a/www/report/ajax_chart.php +++ b/www/report/ajax_chart.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $request = http_request::getInstance(); diff --git a/www/report/ajax_info_dashboard.php b/www/report/ajax_info_dashboard.php index f1d7b108b7..bab9720ece 100644 --- a/www/report/ajax_info_dashboard.php +++ b/www/report/ajax_info_dashboard.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $request = http_request::getInstance(); diff --git a/www/report/ajax_liste_base.php b/www/report/ajax_liste_base.php index 3d1eed98e3..65fffcbd0f 100644 --- a/www/report/ajax_liste_base.php +++ b/www/report/ajax_liste_base.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms( diff --git a/www/report/ajax_table_content.php b/www/report/ajax_table_content.php index d1e197e3b5..9c831bfaba 100644 --- a/www/report/ajax_table_content.php +++ b/www/report/ajax_table_content.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; /* get all the post parameters from report.php's form */ diff --git a/www/report/charts/drawLinePlotWithLegend.php b/www/report/charts/drawLinePlotWithLegend.php index a764f4f636..54ae2c8356 100644 --- a/www/report/charts/drawLinePlotWithLegend.php +++ b/www/report/charts/drawLinePlotWithLegend.php @@ -1,8 +1,8 @@ get_parms("value", 'legend', 'absc'); diff --git a/www/report/charts/draw_pie.php b/www/report/charts/draw_pie.php index dcc6d8e570..5ac850c623 100644 --- a/www/report/charts/draw_pie.php +++ b/www/report/charts/draw_pie.php @@ -1,8 +1,8 @@ get_parms("value", 'legend', 'title'); diff --git a/www/report/export_csv.php b/www/report/export_csv.php index 65c3f67351..7ad3a4d7bf 100644 --- a/www/report/export_csv.php +++ b/www/report/export_csv.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms('name', 'csv'); diff --git a/www/report/index.php b/www/report/index.php index 1db463852e..47394970ea 100644 --- a/www/report/index.php +++ b/www/report/index.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/report/report.php b/www/report/report.php index 1369a3aef9..7d5bbfb979 100644 --- a/www/report/report.php +++ b/www/report/report.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $registry = registry::get_instance(); diff --git a/www/report/tab.php b/www/report/tab.php index 7da2bbb74b..b6352c6d34 100644 --- a/www/report/tab.php +++ b/www/report/tab.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; /* get all the post parameters from report.php's form */ diff --git a/www/setup/installer.php b/www/setup/installer.php index 309847ec72..45a8007272 100644 --- a/www/setup/installer.php +++ b/www/setup/installer.php @@ -17,7 +17,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . '/../../lib/classes/bootstrap.class.php'; +require_once __DIR__ . '/../../lib/classes/bootstrap.class.php'; bootstrap::register_autoloads(); bootstrap::set_php_configuration(); diff --git a/www/skins/admin/admincolor.css b/www/skins/admin/admincolor.css index f45e65ee20..01ced53018 100644 --- a/www/skins/admin/admincolor.css +++ b/www/skins/admin/admincolor.css @@ -141,4 +141,20 @@ table.admintable tbody .dropdown{ .users_col.options{ cursor:pointer; color:#AFAFAF; +} +#users th.sortable span{ + margin:0 5px; +} +#users th.sortable{ + cursor:pointer; +} +#users th.sortable.hover, +#users th.sortable.sorted{ + background-color:#F0AD30; +} +#users th.sortable span.ord_notifier{ + display:none; +} +#users th.sortable.sorted span.ord_notifier{ + display:inline; } \ No newline at end of file diff --git a/www/skins/admin/fleche verte.png b/www/skins/admin/fleche verte.png deleted file mode 100644 index 914623748c..0000000000 Binary files a/www/skins/admin/fleche verte.png and /dev/null differ diff --git a/www/skins/lng/inclin-ar.gif b/www/skins/lng/inclin-ar.gif deleted file mode 100644 index 8ad6e70d9a..0000000000 Binary files a/www/skins/lng/inclin-ar.gif and /dev/null differ diff --git a/www/skins/lng/inclin-ar.png b/www/skins/lng/inclin-ar.png new file mode 100644 index 0000000000..3a95504d21 Binary files /dev/null and b/www/skins/lng/inclin-ar.png differ diff --git a/www/skins/lng/inclin-de.gif b/www/skins/lng/inclin-de.gif deleted file mode 100644 index 229f594a87..0000000000 Binary files a/www/skins/lng/inclin-de.gif and /dev/null differ diff --git a/www/skins/lng/inclin-de.png b/www/skins/lng/inclin-de.png new file mode 100644 index 0000000000..cb0a8c17f8 Binary files /dev/null and b/www/skins/lng/inclin-de.png differ diff --git a/www/skins/lng/inclin-en.gif b/www/skins/lng/inclin-en.gif deleted file mode 100644 index 5b7ce96b90..0000000000 Binary files a/www/skins/lng/inclin-en.gif and /dev/null differ diff --git a/www/skins/lng/inclin-en.png b/www/skins/lng/inclin-en.png new file mode 100644 index 0000000000..3a95504d21 Binary files /dev/null and b/www/skins/lng/inclin-en.png differ diff --git a/www/skins/lng/inclin-fr.gif b/www/skins/lng/inclin-fr.gif deleted file mode 100644 index 166e4aa9fb..0000000000 Binary files a/www/skins/lng/inclin-fr.gif and /dev/null differ diff --git a/www/skins/lng/inclin-fr.png b/www/skins/lng/inclin-fr.png new file mode 100644 index 0000000000..499c680c0a Binary files /dev/null and b/www/skins/lng/inclin-fr.png differ diff --git a/www/skins/prod/000000/prodcolor.css b/www/skins/prod/000000/prodcolor.css index 144abe0db9..110ee7d87f 100644 --- a/www/skins/prod/000000/prodcolor.css +++ b/www/skins/prod/000000/prodcolor.css @@ -263,6 +263,18 @@ span.ww_winTitle{ padding:0; min-height:120px; } +.ui-accordion-icons .ui-accordion-header a +{ + padding:2px 25px; +} +.ui-state-active .ui-icon +{ + background-image: url("/include/jslibs/jquery-ui-1.8.12/css/dark-hive/images/ui-icons_cccccc_256x240.png"); +} +#baskets .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { + color:#FFFFFF; + font-size:1em; +} .ui-accordion .ui-accordion-content.loading { background-image:url(/skins/icons/loader000.gif); diff --git a/www/skins/prod/959595/prodcolor.css b/www/skins/prod/959595/prodcolor.css index e6a3ca527a..116a2d8816 100644 --- a/www/skins/prod/959595/prodcolor.css +++ b/www/skins/prod/959595/prodcolor.css @@ -266,6 +266,18 @@ span.ww_winTitle{ padding:0; min-height:120px; } +.ui-accordion-icons .ui-accordion-header a +{ + padding:2px 25px; +} +.ui-state-active .ui-icon +{ + background-image: url("/include/jslibs/jquery-ui-1.8.12/css/ui-lightness/images/ui-icons_ffffff_256x240.png"); +} +#baskets .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { + color:#FFFFFF; + font-size:1em; +} .ui-accordion .ui-accordion-content.loading { background-image:url(/skins/icons/loaderd9d9d9.gif); diff --git a/www/thesaurus2/accept.php b/www/thesaurus2/accept.php index 1a05eae6b1..f8b3a849e5 100644 --- a/www/thesaurus2/accept.php +++ b/www/thesaurus2/accept.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); diff --git a/www/thesaurus2/export_text.php b/www/thesaurus2/export_text.php index b74a58cef8..281caab130 100644 --- a/www/thesaurus2/export_text.php +++ b/www/thesaurus2/export_text.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/export_text_dlg.php b/www/thesaurus2/export_text_dlg.php index 932008f1a3..df0df49320 100644 --- a/www/thesaurus2/export_text_dlg.php +++ b/www/thesaurus2/export_text_dlg.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/export_topics.php b/www/thesaurus2/export_topics.php index 808aff4d70..e3d396440b 100644 --- a/www/thesaurus2/export_topics.php +++ b/www/thesaurus2/export_topics.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); diff --git a/www/thesaurus2/export_topics_dlg.php b/www/thesaurus2/export_topics_dlg.php index 0ea89aed32..b599457e79 100644 --- a/www/thesaurus2/export_topics_dlg.php +++ b/www/thesaurus2/export_topics_dlg.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/import.php b/www/thesaurus2/import.php index d48a1e094d..f2de0b25a7 100644 --- a/www/thesaurus2/import.php +++ b/www/thesaurus2/import.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/import_dlg.php b/www/thesaurus2/import_dlg.php index 80beeefb95..166d8ad6ed 100644 --- a/www/thesaurus2/import_dlg.php +++ b/www/thesaurus2/import_dlg.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); phrasea::headers(200, true); diff --git a/www/thesaurus2/index.php b/www/thesaurus2/index.php index db79401005..7b00fe45f7 100644 --- a/www/thesaurus2/index.php +++ b/www/thesaurus2/index.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry(); diff --git a/www/thesaurus2/linkfield.php b/www/thesaurus2/linkfield.php index 3467a9a91a..f8518718b9 100644 --- a/www/thesaurus2/linkfield.php +++ b/www/thesaurus2/linkfield.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); diff --git a/www/thesaurus2/linkfield2.php b/www/thesaurus2/linkfield2.php index 0dc349a0f6..f84c76ecbe 100644 --- a/www/thesaurus2/linkfield2.php +++ b/www/thesaurus2/linkfield2.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/linkfield3.php b/www/thesaurus2/linkfield3.php index 0dcd1abd5f..ab32570ba3 100644 --- a/www/thesaurus2/linkfield3.php +++ b/www/thesaurus2/linkfield3.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/loadth.php b/www/thesaurus2/loadth.php index 4817286cec..3ce20dedbb 100644 --- a/www/thesaurus2/loadth.php +++ b/www/thesaurus2/loadth.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . '/../../lib/bootstrap.php'; +require_once __DIR__ . '/../../lib/bootstrap.php'; $registry = registry::get_instance(); phrasea::headers(); $debug = false; diff --git a/www/thesaurus2/newsy_dlg.php b/www/thesaurus2/newsy_dlg.php index e8c0f2a1c2..20de190d9a 100644 --- a/www/thesaurus2/newsy_dlg.php +++ b/www/thesaurus2/newsy_dlg.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/newterm.php b/www/thesaurus2/newterm.php index 417286df87..5ac3ae4217 100644 --- a/www/thesaurus2/newterm.php +++ b/www/thesaurus2/newterm.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); diff --git a/www/thesaurus2/properties.php b/www/thesaurus2/properties.php index ffb6dc825b..6821d2cf07 100644 --- a/www/thesaurus2/properties.php +++ b/www/thesaurus2/properties.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/replace.php b/www/thesaurus2/replace.php index 58b3965949..11383977e3 100644 --- a/www/thesaurus2/replace.php +++ b/www/thesaurus2/replace.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/replace2.php b/www/thesaurus2/replace2.php index ff7b124550..f99b2c99b0 100644 --- a/www/thesaurus2/replace2.php +++ b/www/thesaurus2/replace2.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/replace3.php b/www/thesaurus2/replace3.php index 52de9a4ecc..c74cdd514e 100644 --- a/www/thesaurus2/replace3.php +++ b/www/thesaurus2/replace3.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/rescan.php b/www/thesaurus2/rescan.php index b6248a4ee4..7142412813 100644 --- a/www/thesaurus2/rescan.php +++ b/www/thesaurus2/rescan.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/rescan_dlg.php b/www/thesaurus2/rescan_dlg.php index aee025d95c..a07a3a4c7d 100644 --- a/www/thesaurus2/rescan_dlg.php +++ b/www/thesaurus2/rescan_dlg.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/search.php b/www/thesaurus2/search.php index 041e7feb55..1ecebcdc07 100644 --- a/www/thesaurus2/search.php +++ b/www/thesaurus2/search.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(200, true); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/thesaurus.php b/www/thesaurus2/thesaurus.php index 9ec547e088..bfc84b797d 100644 --- a/www/thesaurus2/thesaurus.php +++ b/www/thesaurus2/thesaurus.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; phrasea::headers(); $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/thesaurus2/xmlhttp/accept.x.php b/www/thesaurus2/xmlhttp/accept.x.php index 194e17bd8b..b84889a37c 100644 --- a/www/thesaurus2/xmlhttp/accept.x.php +++ b/www/thesaurus2/xmlhttp/accept.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/acceptcandidates.x.php b/www/thesaurus2/xmlhttp/acceptcandidates.x.php index 536456ac14..2b4f6d6c58 100644 --- a/www/thesaurus2/xmlhttp/acceptcandidates.x.php +++ b/www/thesaurus2/xmlhttp/acceptcandidates.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/changesylng.x.php b/www/thesaurus2/xmlhttp/changesylng.x.php index 47450fbe7d..c8b64ddecf 100644 --- a/www/thesaurus2/xmlhttp/changesylng.x.php +++ b/www/thesaurus2/xmlhttp/changesylng.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/changesypos.x.php b/www/thesaurus2/xmlhttp/changesypos.x.php index 8c7ba2c0d3..793d5fcdde 100644 --- a/www/thesaurus2/xmlhttp/changesypos.x.php +++ b/www/thesaurus2/xmlhttp/changesypos.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/deletenohits.x.php b/www/thesaurus2/xmlhttp/deletenohits.x.php index 3895ab8b8c..b48a8bb6be 100644 --- a/www/thesaurus2/xmlhttp/deletenohits.x.php +++ b/www/thesaurus2/xmlhttp/deletenohits.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/thesaurus2/xmlhttp/delsy.x.php b/www/thesaurus2/xmlhttp/delsy.x.php index 70e46cf55c..5501328d80 100644 --- a/www/thesaurus2/xmlhttp/delsy.x.php +++ b/www/thesaurus2/xmlhttp/delsy.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); require("../xmlhttp.php"); diff --git a/www/thesaurus2/xmlhttp/delts.x.php b/www/thesaurus2/xmlhttp/delts.x.php index 33d17c7ea6..628210e29d 100644 --- a/www/thesaurus2/xmlhttp/delts.x.php +++ b/www/thesaurus2/xmlhttp/delts.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/thesaurus2/xmlhttp/gethtmlbranch.x.php b/www/thesaurus2/xmlhttp/gethtmlbranch.x.php index c8b304d3b8..aaf1cdbeb3 100644 --- a/www/thesaurus2/xmlhttp/gethtmlbranch.x.php +++ b/www/thesaurus2/xmlhttp/gethtmlbranch.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/getsy.x.php b/www/thesaurus2/xmlhttp/getsy.x.php index 314d00447b..207c6177f4 100644 --- a/www/thesaurus2/xmlhttp/getsy.x.php +++ b/www/thesaurus2/xmlhttp/getsy.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/getterm.x.php b/www/thesaurus2/xmlhttp/getterm.x.php index 8baf058e6a..2a49f36cb5 100644 --- a/www/thesaurus2/xmlhttp/getterm.x.php +++ b/www/thesaurus2/xmlhttp/getterm.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/killterm.x.php b/www/thesaurus2/xmlhttp/killterm.x.php index 681b21ce23..e8112ec89b 100644 --- a/www/thesaurus2/xmlhttp/killterm.x.php +++ b/www/thesaurus2/xmlhttp/killterm.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); require("../xmlhttp.php"); diff --git a/www/thesaurus2/xmlhttp/newsy.x.php b/www/thesaurus2/xmlhttp/newsy.x.php index 7295bf8c98..62c84d63ee 100644 --- a/www/thesaurus2/xmlhttp/newsy.x.php +++ b/www/thesaurus2/xmlhttp/newsy.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/newts.x.php b/www/thesaurus2/xmlhttp/newts.x.php index 1cd95ddabf..39fc05b91a 100644 --- a/www/thesaurus2/xmlhttp/newts.x.php +++ b/www/thesaurus2/xmlhttp/newts.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/openbranches.x.php b/www/thesaurus2/xmlhttp/openbranches.x.php index a91e24716f..b0d024dc14 100644 --- a/www/thesaurus2/xmlhttp/openbranches.x.php +++ b/www/thesaurus2/xmlhttp/openbranches.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/reject.x.php b/www/thesaurus2/xmlhttp/reject.x.php index 57b341ebd7..fbdbe9f899 100644 --- a/www/thesaurus2/xmlhttp/reject.x.php +++ b/www/thesaurus2/xmlhttp/reject.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); require("../xmlhttp.php"); diff --git a/www/thesaurus2/xmlhttp/searchcandidate.x.php b/www/thesaurus2/xmlhttp/searchcandidate.x.php index 6b51c10e7a..cdb90ec346 100644 --- a/www/thesaurus2/xmlhttp/searchcandidate.x.php +++ b/www/thesaurus2/xmlhttp/searchcandidate.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../../lib/bootstrap.php"; +require_once __DIR__ . "/../../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/thesaurus2/xmlhttp/searchnohits.x.php b/www/thesaurus2/xmlhttp/searchnohits.x.php index 0f27c9ed0b..49754f3a55 100644 --- a/www/thesaurus2/xmlhttp/searchnohits.x.php +++ b/www/thesaurus2/xmlhttp/searchnohits.x.php @@ -1,6 +1,6 @@ get_session(); $registry = $appbox->get_registry(); diff --git a/www/upload/lazaret_image.php b/www/upload/lazaret_image.php index 8df9c736f1..7325858a02 100644 --- a/www/upload/lazaret_image.php +++ b/www/upload/lazaret_image.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms('id'); diff --git a/www/upload/upload.php b/www/upload/upload.php index 627de1f1db..383e65e618 100644 --- a/www/upload/upload.php +++ b/www/upload/upload.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . '/../../lib/classes/http/request.class.php'; +require_once __DIR__ . '/../../lib/classes/http/request.class.php'; $request = http_request::getInstance(); $parm = $request->get_parms('session', 'coll', 'status'); @@ -25,7 +25,7 @@ if ($parm["session"]) session_id($parm["session"]); } -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/upload/uploadFeedback.php b/www/upload/uploadFeedback.php index 734b64ad8b..1e09c4e7c1 100644 --- a/www/upload/uploadFeedback.php +++ b/www/upload/uploadFeedback.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms('action', 'from_id', 'to_id', 'actions', 'id'); diff --git a/www/xmlhttp/acceptcandidates.j.php b/www/xmlhttp/acceptcandidates.j.php index 6353c71a27..5ddb543fd4 100644 --- a/www/xmlhttp/acceptcandidates.j.php +++ b/www/xmlhttp/acceptcandidates.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/checkcandidatetarget.j.php b/www/xmlhttp/checkcandidatetarget.j.php index 7b2406792c..8bb9d1c9c3 100644 --- a/www/xmlhttp/checkcandidatetarget.j.php +++ b/www/xmlhttp/checkcandidatetarget.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/deletecandidates.j.php b/www/xmlhttp/deletecandidates.j.php index aec0cd1a3b..42065c4e4e 100644 --- a/www/xmlhttp/deletecandidates.j.php +++ b/www/xmlhttp/deletecandidates.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/editing_presets.j.php b/www/xmlhttp/editing_presets.j.php index d8be3d741c..fa302fb6c1 100644 --- a/www/xmlhttp/editing_presets.j.php +++ b/www/xmlhttp/editing_presets.j.php @@ -14,7 +14,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/xmlhttp/getsy_prod.x.php b/www/xmlhttp/getsy_prod.x.php index a7f9418435..a5150ceab6 100644 --- a/www/xmlhttp/getsy_prod.x.php +++ b/www/xmlhttp/getsy_prod.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/getterm_prod.h.php b/www/xmlhttp/getterm_prod.h.php index 8ed668a4c7..3de36ff492 100644 --- a/www/xmlhttp/getterm_prod.h.php +++ b/www/xmlhttp/getterm_prod.h.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/getterm_prod.x.php b/www/xmlhttp/getterm_prod.x.php index 77ce661f71..a92f4764dd 100644 --- a/www/xmlhttp/getterm_prod.x.php +++ b/www/xmlhttp/getterm_prod.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $request = http_request::getInstance(); $parm = $request->get_parms( "bid" diff --git a/www/xmlhttp/openbranch_prod.j.php b/www/xmlhttp/openbranch_prod.j.php index a7ccf7c12e..587b06d066 100644 --- a/www/xmlhttp/openbranch_prod.j.php +++ b/www/xmlhttp/openbranch_prod.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/www/xmlhttp/openbranches_prod.h.php b/www/xmlhttp/openbranches_prod.h.php index 5c91109a18..642224d104 100644 --- a/www/xmlhttp/openbranches_prod.h.php +++ b/www/xmlhttp/openbranches_prod.h.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/openbranches_prod.x.php b/www/xmlhttp/openbranches_prod.x.php index ee6130178f..9664ddb6fe 100644 --- a/www/xmlhttp/openbranches_prod.x.php +++ b/www/xmlhttp/openbranches_prod.x.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); diff --git a/www/xmlhttp/replacecandidate.j.php b/www/xmlhttp/replacecandidate.j.php index 95bd8fdb68..52952e2162 100644 --- a/www/xmlhttp/replacecandidate.j.php +++ b/www/xmlhttp/replacecandidate.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $registry = registry::get_instance(); $request = http_request::getInstance(); diff --git a/www/xmlhttp/search_th_term_prod.j.php b/www/xmlhttp/search_th_term_prod.j.php index 4524ef9aea..870d7a2287 100644 --- a/www/xmlhttp/search_th_term_prod.j.php +++ b/www/xmlhttp/search_th_term_prod.j.php @@ -15,7 +15,7 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link www.phraseanet.com */ -require_once dirname(__FILE__) . "/../../lib/bootstrap.php"; +require_once __DIR__ . "/../../lib/bootstrap.php"; $appbox = appbox::get_instance(); $session = $appbox->get_session(); $registry = $appbox->get_registry();