Merge branch '4.0'

Also updated dependencies
This commit is contained in:
Benoît Burnichon
2016-02-28 23:31:16 +01:00
22 changed files with 2537 additions and 2279 deletions

View File

@@ -27,7 +27,7 @@
"bootstrap-sass": "v2.3.2.2",
"jquery.lazyload": "~1.9.7",
"jquery-treeview": "~1.4.2",
"alchemy-embed-medias": "~0.3.1"
"alchemy-embed-medias": "~0.3.2"
},
"devDependencies": {
"mocha": "latest",

View File

@@ -30,7 +30,7 @@
"require": {
"php": ">=5.5",
"alchemy-fr/tcpdf-clone": "~6.0",
"alchemy/embed-bundle": "^0.2.0",
"alchemy/embed-bundle": "^0.3.2",
"alchemy/geonames-api-consumer": "~0.1.0",
"alchemy/google-plus-api-client": "~0.6.2",
"alchemy/mediavorus": "^0.4.4",

168
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "d39892bd2597bbeda0205d0254b90dcd",
"content-hash": "db752ae42fca6cbf8f9d67dfe5dc6639",
"hash": "0b264e88dc633332244aa459e5bbe1f3",
"content-hash": "7f563052a82cf882eda37b48fde1d642",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -15,6 +15,12 @@
"url": "https://github.com/alchemy-fr/tcpdf-clone.git",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/tcpdf-clone/zipball/2ba0248a7187f1626df6c128750650416267f0e7",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
@@ -61,6 +67,10 @@
"qrcode",
"tcpdf"
],
"support": {
"source": "https://github.com/alchemy-fr/tcpdf-clone/tree/6.0.039",
"issues": "https://github.com/alchemy-fr/tcpdf-clone/issues"
},
"time": "2013-10-13 16:11:17"
},
{
@@ -103,14 +113,14 @@
"email": "imprec@gmail.com",
"homepage": "http://www.lickmychip.com/"
},
{
"name": "Nicolas Le Goff",
"email": "legoff.n@gmail.com"
},
{
"name": "Phraseanet Team",
"email": "info@alchemy.fr",
"homepage": "http://www.phraseanet.com/"
},
{
"name": "Nicolas Le Goff",
"email": "legoff.n@gmail.com"
}
],
"description": "A set of tools to build binary drivers",
@@ -122,16 +132,16 @@
},
{
"name": "alchemy/embed-bundle",
"version": "v0.2.0",
"version": "v0.3.2",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/embed-bundle.git",
"reference": "37cc6ab627e4a770a60aad4ae4c60934e5de5cf5"
"reference": "3db85da5eb56aa1ebeac4b0a3e224f127dfa7c1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/37cc6ab627e4a770a60aad4ae4c60934e5de5cf5",
"reference": "37cc6ab627e4a770a60aad4ae4c60934e5de5cf5",
"url": "https://api.github.com/repos/alchemy-fr/embed-bundle/zipball/3db85da5eb56aa1ebeac4b0a3e224f127dfa7c1c",
"reference": "3db85da5eb56aa1ebeac4b0a3e224f127dfa7c1c",
"shasum": ""
},
"require-dev": {
@@ -169,10 +179,10 @@
],
"description": "Embed resources bundle",
"support": {
"source": "https://github.com/alchemy-fr/embed-bundle/tree/v0.2.0",
"source": "https://github.com/alchemy-fr/embed-bundle/tree/v0.3.2",
"issues": "https://github.com/alchemy-fr/embed-bundle/issues"
},
"time": "2016-01-15 12:49:06"
"time": "2016-02-25 17:06:03"
},
{
"name": "alchemy/geonames-api-consumer",
@@ -536,6 +546,12 @@
"url": "https://github.com/alchemy-fr/symfony-cors.git",
"reference": "dbf7fcff1ce9fc1265db12955476ff169eab7375"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/symfony-cors/zipball/dbf7fcff1ce9fc1265db12955476ff169eab7375",
"reference": "dbf7fcff1ce9fc1265db12955476ff169eab7375",
"shasum": ""
},
"require": {
"symfony/http-kernel": "^2.3.0|^3.0.0"
},
@@ -556,11 +572,7 @@
"Alchemy\\CorsBundle\\": "src/Bundle/"
}
},
"autoload-dev": {
"psr-4": {
"Alchemy\\Cors\\Tests\\": "tests/unit/Component/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1519,21 +1531,21 @@
},
{
"name": "doctrine/migrations",
"version": "v1.3.0",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/migrations.git",
"reference": "2ce8d87d4247e4b87cc5905ea5f8446b12bd9b5b"
"reference": "abc571dadd45df42f19baac7a0a1a371216dd93d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/2ce8d87d4247e4b87cc5905ea5f8446b12bd9b5b",
"reference": "2ce8d87d4247e4b87cc5905ea5f8446b12bd9b5b",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/abc571dadd45df42f19baac7a0a1a371216dd93d",
"reference": "abc571dadd45df42f19baac7a0a1a371216dd93d",
"shasum": ""
},
"require": {
"doctrine/dbal": "~2.2",
"ocramius/proxy-manager": "^1.0",
"ocramius/proxy-manager": "^1.0|^2.0",
"php": "^5.5|^7.0",
"symfony/console": "~2.3|~3.0",
"symfony/yaml": "~2.3|~3.0"
@@ -1541,18 +1553,22 @@
"require-dev": {
"doctrine/coding-standard": "dev-master",
"doctrine/orm": "2.*",
"jdorn/sql-formatter": "~1.1",
"johnkary/phpunit-speedtrap": "~1.0@dev",
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "~4.7",
"satooshi/php-coveralls": "0.6.*"
},
"suggest": {
"jdorn/sql-formatter": "Allows to generate formatted SQL with the diff command."
},
"bin": [
"bin/doctrine-migrations"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "v1.4.x-dev"
"dev-master": "v1.5.x-dev"
}
},
"autoload": {
@@ -1584,7 +1600,7 @@
"database",
"migrations"
],
"time": "2016-01-23 09:49:17"
"time": "2016-02-23 15:28:39"
},
{
"name": "doctrine/orm",
@@ -1725,12 +1741,12 @@
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "v1.0.0"
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"reference": "v1.0.0",
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"shasum": ""
},
"require": {
@@ -1757,7 +1773,7 @@
"keywords": [
"event-dispatcher"
],
"time": "2012-05-30 08:01:08"
"time": "2012-05-30 15:01:08"
},
{
"name": "facebook/php-sdk",
@@ -1803,6 +1819,7 @@
"facebook",
"sdk"
],
"abandoned": "facebook/php-sdk-v4",
"time": "2013-11-19 23:11:14"
},
{
@@ -2644,12 +2661,12 @@
"source": {
"type": "git",
"url": "https://github.com/hoaproject/Stream.git",
"reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3"
"reference": "3bc446bc00849bf51166adc415d77aa375d48d8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hoaproject/Stream/zipball/3bc446bc00849bf51166adc415d77aa375d48d8c",
"reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3",
"reference": "3bc446bc00849bf51166adc415d77aa375d48d8c",
"shasum": ""
},
"require": {
@@ -2694,7 +2711,7 @@
"stream",
"wrapper"
],
"time": "2015-10-22 06:30:43"
"time": "2015-10-26 12:21:43"
},
{
"name": "hoa/ustring",
@@ -3724,7 +3741,7 @@
],
"authors": [
{
"name": "Stephen Clay",
"name": "Steve Clay",
"email": "steve@mrclay.org",
"homepage": "http://www.mrclay.org/",
"role": "Developer"
@@ -3910,21 +3927,21 @@
"source": {
"type": "git",
"url": "https://github.com/romainneutron/Imagine-Silex-Service-Provider.git",
"reference": "0.1.2"
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/a8a7862ae90419f2b23746cd8436c2310e4eb084",
"reference": "0.1.2",
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084",
"shasum": ""
},
"require": {
"imagine/imagine": "*",
"php": ">=5.3.3",
"silex/silex": ">=1.0,<2.0"
"silex/silex": "~1.0"
},
"require-dev": {
"symfony/browser-kit": ">=2.0,<3.0"
"symfony/browser-kit": "~2.0"
},
"type": "library",
"autoload": {
@@ -5335,7 +5352,7 @@
},
{
"name": "Phraseanet Team",
"email": "support@alchemy.fr",
"email": "info@alchemy.fr",
"homepage": "http://www.phraseanet.com/"
}
],
@@ -5399,6 +5416,62 @@
],
"time": "2014-12-05 14:17:14"
},
{
"name": "symfony/polyfill-apcu",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-apcu.git",
"reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c",
"reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting apcu_* functions to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"apcu",
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
},
{
"name": "symfony/polyfill-intl-icu",
"version": "v1.1.0",
@@ -5857,22 +5930,23 @@
},
{
"name": "symfony/symfony",
"version": "v2.8.2",
"version": "v2.8.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/symfony.git",
"reference": "f3e6a82bcbea4db3b56df08e491e20a1faae82b5"
"reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/symfony/zipball/f3e6a82bcbea4db3b56df08e491e20a1faae82b5",
"reference": "f3e6a82bcbea4db3b56df08e491e20a1faae82b5",
"url": "https://api.github.com/repos/symfony/symfony/zipball/7a9a5fce7ce6e448e527f635463dda00761e12c2",
"reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2",
"shasum": ""
},
"require": {
"doctrine/common": "~2.4",
"php": ">=5.3.9",
"psr/log": "~1.0",
"symfony/polyfill-apcu": "~1.1",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php54": "~1.0",
@@ -5941,7 +6015,7 @@
"doctrine/orm": "~2.4,>=2.4.5",
"egulias/email-validator": "~1.2",
"monolog/monolog": "~1.11",
"ocramius/proxy-manager": "~0.4|~1.0",
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
"phpdocumentor/reflection": "^1.0.7"
},
"type": "library",
@@ -5986,7 +6060,7 @@
"keywords": [
"framework"
],
"time": "2016-01-14 12:01:11"
"time": "2016-02-28 21:06:29"
},
{
"name": "themattharris/tmhoauth",
@@ -7176,16 +7250,16 @@
},
{
"name": "sebastian/environment",
"version": "1.3.3",
"version": "1.3.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6e7133793a8e5a5714a551a8324337374be209df"
"reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df",
"reference": "6e7133793a8e5a5714a551a8324337374be209df",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
"reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf",
"shasum": ""
},
"require": {
@@ -7222,7 +7296,7 @@
"environment",
"hhvm"
],
"time": "2015-12-02 08:37:27"
"time": "2016-02-26 18:40:46"
},
{
"name": "sebastian/exporter",

View File

@@ -86,7 +86,7 @@ class SessionController extends Controller
}
if ($this->getConf()->get(['registry', 'maintenance', 'enabled'], false)) {
$ret['message'] .= strip_tags($this->getConf()->get(['registry', 'maintenance', 'enabled']));
$ret['message'] .= strip_tags($this->getConf()->get(['registry', 'maintenance', 'message']));
}
}

View File

@@ -34,7 +34,7 @@ class UserPreferenceController extends Controller
$success = false;
$msg = $this->app->trans('Error while saving preference');
if ($prop && $value) {
if (!is_null($prop) && !is_null($value)) {
$this->getSession()->set('phraseanet.' . $prop, $value);
$success = true;
$msg = $this->app->trans('Preference saved !');

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\Basket;
use Alchemy\Phrasea\Model\Entities\User;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Translation\TranslatorInterface;
@@ -53,7 +54,7 @@ class BasketRepository extends EntityRepository
/**
* Returns all basket for a given user that are not marked as archived
*
* @param User $user
* @param User $user
* @return Basket[]
*/
public function findActiveByUser(User $user, $sort = null)
@@ -145,8 +146,8 @@ class BasketRepository extends EntityRepository
*
* @throws NotFoundHttpException
* @throws AccessDeniedHttpException
* @param type $basket_id
* @param User $user
* @param int $basket_id
* @param User $user
* @return Basket
*/
public function findUserBasket($basket_id, User $user, $requireOwner)
@@ -207,8 +208,6 @@ class BasketRepository extends EntityRepository
public function findWorkzoneBasket(User $user, $query, $year, $type, $offset, $perPage)
{
$params = [];
switch ($type) {
case self::RECEIVED:
$dql = 'SELECT b
@@ -241,18 +240,6 @@ class BasketRepository extends EntityRepository
'usr_id' => $user->getId()
];
break;
default:
$dql = 'SELECT b
FROM Phraseanet:Basket b
LEFT JOIN b.elements e
LEFT JOIN b.validation s
LEFT JOIN s.participants p
WHERE (b.user = :usr_id OR p.user = :validating_usr_id)';
$params = [
'usr_id' => $user->getId(),
'validating_usr_id' => $user->getId()
];
break;
case self::MYBASKETS:
$dql = 'SELECT b
FROM Phraseanet:Basket b
@@ -264,6 +251,17 @@ class BasketRepository extends EntityRepository
'usr_id' => $user->getId()
];
break;
default:
$dql = 'SELECT b
FROM Phraseanet:Basket b
LEFT JOIN b.elements e
LEFT JOIN b.validation s
LEFT JOIN s.participants p
WHERE (b.user = :usr_id OR p.user = :validating_usr_id)';
$params = [
'usr_id' => $user->getId(),
'validating_usr_id' => $user->getId()
];
}
if (ctype_digit($year) && strlen($year) == 4) {
@@ -287,9 +285,7 @@ class BasketRepository extends EntityRepository
->setFirstResult($offset)
->setMaxResults($perPage);
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query, true);
return $paginator;
return new Paginator($query, true);
}
/**

View File

@@ -565,14 +565,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
{
$name = strtolower($name);
if (!in_array($name, $this->get_available_subdefs())) {
throw new Exception_Media_SubdefNotFound(sprintf("subdef `%s` not found", $name));
}
if (isset($this->subdefs[$name])) {
return $this->subdefs[$name];
}
if (!in_array($name, $this->get_available_subdefs())) {
throw new Exception_Media_SubdefNotFound(sprintf("subdef `%s` not found", $name));
}
if (!$this->subdefs) {
$this->subdefs = [];
}
@@ -1583,7 +1583,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
}
/**
* @return set_selection
* @return set_selection|record_adapter[]
* @throws Exception
* @throws \Doctrine\DBAL\DBALException
* @deprecated use {@link self::getChildren} instead.
@@ -1593,6 +1593,11 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
return $this->getChildren();
}
/**
* @return set_selection|record_adapter[]
* @throws Exception
* @throws \Doctrine\DBAL\DBALException
*/
public function getChildren()
{
if (!$this->isStory()) {

View File

@@ -12,36 +12,22 @@
abstract class set_abstract implements IteratorAggregate
{
/**
*
* @var Array
* @var \record_adapter[]
*/
protected $elements = [];
/**
*
* @return ArrayIterator
*/
public function getIterator()
{
$this->load_elements();
return new ArrayIterator($this->elements);
}
/**
*
* @return set
*/
protected function load_elements()
{
return $this;
}
/**
*
* @param string $offset
* @param string $value
* @return Void
* @param record_adapter $value
* @return void
*/
public function offsetSet($offset, $value)
{
@@ -53,9 +39,8 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @param string $offset
* @return boolean
* @return bool
*/
public function offsetExists($offset)
{
@@ -63,9 +48,8 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @param string $offset
* @return Void
* @return void
*/
public function offsetUnset($offset)
{
@@ -73,9 +57,8 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @param string $offset
* @return record_adapter
* @return record_adapter|null
*/
public function offsetGet($offset)
{
@@ -83,8 +66,7 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @return int
* @return bool
*/
public function is_empty()
{
@@ -104,7 +86,7 @@ abstract class set_abstract implements IteratorAggregate
/**
* Get the number of element in the set
*
* @return Int
* @return int
*/
public function get_count()
{
@@ -112,7 +94,6 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @return int
*/
public function get_count_groupings()
@@ -127,20 +108,16 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @return Array
* @return record_adapter[]
*/
public function get_elements()
{
$this->load_elements();
return $this->elements;
}
/**
*
* @param record_adapter $record
* @return set
* @return $this
*/
public function add_element(\record_adapter $record)
{
@@ -150,9 +127,8 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @param record_adapter $record
* @return set
* @return $this
*/
public function remove_element(\record_adapter $record)
{
@@ -164,7 +140,6 @@ abstract class set_abstract implements IteratorAggregate
}
/**
*
* @return string
*/
public function serialize_list()

View File

@@ -12,10 +12,28 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Serializer\CaptionSerializer;
use Alchemy\Phrasea\Model\Entities\Token;
use Alchemy\Phrasea\Model\Entities\User;
use Assert\Assertion;
use Doctrine\DBAL\Connection;
use Symfony\Component\Filesystem\Filesystem;
class set_export extends set_abstract
{
private static $maxFilenameLength = 256;
/**
* @param int $newLength
*/
public static function setMaxFilenameLength($newLength)
{
Assertion::integer($newLength);
Assertion::greaterThan($newLength, 0);
self::$maxFilenameLength = $newLength;
}
/**
* @var Application
*/
protected $app;
protected $storage = [];
protected $total_download;
@@ -30,19 +48,15 @@ class set_export extends set_abstract
protected $exportName;
/**
*
* @param Application $app
* @param string $lst
* @param integer $sstid
* @param integer $storyWZid
* @return set_export
* @param string $lst
* @param int $sstid
* @param int $storyWZid
*/
public function __construct(Application $app, $lst, $sstid, $storyWZid = null)
{
$this->app = $app;
$download_list = [];
$remain_hd = [];
if ($storyWZid) {
@@ -60,8 +74,8 @@ class set_export extends set_abstract
$this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d");
foreach ($Basket->getElements() as $basket_element) {
$base_id = $basket_element->getRecord($this->app)->get_base_id();
$record_id = $basket_element->getRecord($this->app)->get_record_id();
$base_id = $basket_element->getRecord($this->app)->getBaseId();
$record_id = $basket_element->getRecord($this->app)->getRecordId();
if (!isset($remain_hd[$base_id])) {
if ($app->getAclForUser($app->getAuthenticatedUser())->is_restricted_download($base_id)) {
@@ -71,14 +85,14 @@ class set_export extends set_abstract
}
}
$current_element = $download_list[] =
new record_exportElement(
$app,
$basket_element->getRecord($this->app)->get_sbas_id(),
$record_id,
$Basket->getName(),
$remain_hd[$base_id]
$current_element = new record_exportElement(
$app,
$basket_element->getRecord($this->app)->getDataboxId(),
$record_id,
$Basket->getName(),
$remain_hd[$base_id]
);
$this->add_element($current_element);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
@@ -99,9 +113,9 @@ class set_export extends set_abstract
}
if ($record->isStory()) {
foreach ($record->get_children() as $child_basrec) {
$base_id = $child_basrec->get_base_id();
$record_id = $child_basrec->get_record_id();
foreach ($record->getChildren() as $child_basrec) {
$base_id = $child_basrec->getBaseId();
$record_id = $child_basrec->getRecordId();
if (!isset($remain_hd[$base_id])) {
if ($app->getAclForUser($app->getAuthenticatedUser())->is_restricted_download($base_id)) {
@@ -111,20 +125,20 @@ class set_export extends set_abstract
}
}
$current_element = $download_list[] =
new record_exportElement(
$app,
$child_basrec->get_sbas_id(),
$record_id,
$record->get_title(null, null, true) . '_' . $n,
$remain_hd[$base_id]
$current_element = new record_exportElement(
$app,
$child_basrec->getDataboxId(),
$record_id,
$record->get_title(null, null, true) . '_' . $n,
$remain_hd[$base_id]
);
$this->add_element($current_element);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
} else {
$base_id = $record->get_base_id();
$record_id = $record->get_record_id();
$base_id = $record->getBaseId();
$record_id = $record->getRecordId();
if (!isset($remain_hd[$base_id])) {
if ($app->getAclForUser($app->getAuthenticatedUser())->is_restricted_download($base_id)) {
@@ -134,15 +148,14 @@ class set_export extends set_abstract
}
}
$current_element =
$download_list[$basrec[0] . '_' . $basrec[1]] =
new record_exportElement(
$app,
$record->get_sbas_id(),
$record_id,
'',
$remain_hd[$base_id]
$current_element = new record_exportElement(
$app,
$record->getDataboxId(),
$record_id,
'',
$remain_hd[$base_id]
);
$this->add_element($current_element);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
@@ -150,8 +163,6 @@ class set_export extends set_abstract
}
}
$this->elements = $download_list;
$display_download = [];
$display_orderable = [];
@@ -161,18 +172,19 @@ class set_export extends set_abstract
$this->businessFieldsAccess = false;
foreach ($this->elements as $download_element) {
if ($app->getAclForUser($app->getAuthenticatedUser())->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
/** @var record_exportElement $download_element */
foreach ($this->get_elements() as $download_element) {
if ($app->getAclForUser($app->getAuthenticatedUser())->has_right_on_base($download_element->getBaseId(), 'canmodifrecord')) {
$this->businessFieldsAccess = true;
}
foreach ($download_element->get_downloadable() as $name => $properties) {
if (!isset($display_download[$name])) {
$display_download[$name] = [
'size' => 0,
'total' => 0,
'size' => 0,
'total' => 0,
'available' => 0,
'refused' => []
'refused' => [],
];
}
@@ -191,9 +203,9 @@ class set_export extends set_abstract
foreach ($download_element->get_orderable() as $name => $properties) {
if (!isset($display_orderable[$name])) {
$display_orderable[$name] = [
'total' => 0,
'total' => 0,
'available' => 0,
'refused' => []
'refused' => [],
];
}
@@ -209,7 +221,7 @@ class set_export extends set_abstract
}
foreach ($display_download as $name => $values) {
$display_download[$name]['size'] = (int) $values['size'];
$display_download[$name]['size'] = (int)$values['size'];
}
$display_ftp = [];
@@ -222,79 +234,73 @@ class set_export extends set_abstract
$this->ftp_datas = [];
if ($this->app['conf']->get(['registry', 'ftp', 'ftp-enabled']) && ($hasadminright || $this->app['conf']->get(['registry', 'ftp', 'ftp-user-access']))) {
if ($this->app['conf']->get([
'registry',
'ftp',
'ftp-enabled',
]) && ($hasadminright || $this->app['conf']->get(['registry', 'ftp', 'ftp-user-access']))
) {
$display_ftp = $display_download;
$this->total_ftp = $this->total_download;
$lst_base_id = array_keys($app->getAclForUser($app->getAuthenticatedUser())->get_granted_base());
if ($hasadminright) {
$sql = "SELECT Users.id AS usr_id ,Users.login AS usr_login ,Users.email AS usr_mail, FtpCredential.*
FROM (
FtpCredential INNER JOIN Users ON (
FtpCredential.active = 1 AND FtpCredential.user_id = Users.id
) INNER JOIN basusr ON (
Users.id=basusr.usr_id
AND (basusr.base_id=
'" . implode("' OR basusr.base_id='", $lst_base_id) . "'
)
)
)
GROUP BY Users.id ";
$params = [];
} elseif ($this->app['conf']->get(['registry', 'ftp', 'ftp-user-access'])) {
$sql = "SELECT Users.id AS usr_id ,Users.login AS usr_login ,Users.email AS usr_mail, FtpCredential.*
FROM (
FtpCredential INNER JOIN Users ON (
FtpCredential.active = 1 AND FtpCredential.id = Users.id
) INNER JOIN basusr ON (
Users.id=basusr.usr_id
AND Users.id = :usr_id
AND (basusr.base_id=
'" . implode("' OR basusr.base_id='", $lst_base_id) . "'
)
)
)
GROUP BY Users.id ";
$params = [':usr_id' => $app->getAuthenticatedUser()->getId()];
$userFilterSQL = '';
$params = [];
$types = [];
if (!$hasadminright) {
$userFilterSQL = ' AND Users.id = :usr_id';
$params['usr_id'] = $app->getAuthenticatedUser()->getId();
$types['usr_id'] = PDO::PARAM_INT;
}
$sql = <<<SQL
SELECT Users.id AS usr_id ,Users.login AS usr_login ,Users.email AS usr_mail, FtpCredential.*
FROM (
FtpCredential INNER JOIN Users ON (FtpCredential.active = 1 AND FtpCredential.user_id = Users.id)
INNER JOIN basusr ON (
Users.id=basusr.usr_id
${userFilterSQL}
AND (basusr.base_id IN (:baseIds))
)
)
GROUP BY Users.id
SQL;
$params['baseIds'] = $lst_base_id;
$types['baseIds'] = Connection::PARAM_INT_ARRAY;
$datas[] = [
'name' => $app->trans('export::ftp: reglages manuels'),
'usr_id' => '0',
'address' => '',
'login' => '',
'password' => '',
'ssl' => false,
'dest_folder' => '',
'prefix_folder' => 'Export_' . date("Y-m-d_H.i.s"),
'passive' => false,
'max_retry' => 5,
'sendermail' => $app->getAuthenticatedUser()->getEmail()
'name' => $app->trans('export::ftp: reglages manuels'),
'usr_id' => '0',
'address' => '',
'login' => '',
'password' => '',
'ssl' => false,
'dest_folder' => '',
'prefix_folder' => 'Export_' . date("Y-m-d_H.i.s"),
'passive' => false,
'max_retry' => 5,
'sendermail' => $app->getAuthenticatedUser()->getEmail(),
];
$stmt = $app->getApplicationBox()->get_connection()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
foreach ($app->getApplicationBox()->get_connection()->fetchAll($sql, $params, $types) as $row) {
$datas[] = [
'name' => $row["usr_login"],
'usr_id' => $row['usr_id'],
'address' => $row['address'],
'login' => $row['login'],
'password' => $row['password'],
'ssl' => !! $row['tls'],
'dest_folder' => $row['reception_folder'],
'prefix_folder' =>
(strlen(trim($row['repository_prefix_name'])) > 0 ?
trim($row['repository_prefix_name']) :
'Export_' . date("Y-m-d_H.i.s")),
'passive' => !! $row['passive'],
'max_retry' => $row['max_retry'],
'usr_mail' => $row['usr_mail'],
'sender_mail' => $app->getAuthenticatedUser()->getEmail()
'name' => $row["usr_login"],
'usr_id' => $row['usr_id'],
'address' => $row['address'],
'login' => $row['login'],
'password' => $row['password'],
'ssl' => !!$row['tls'],
'dest_folder' => $row['reception_folder'],
'prefix_folder' =>
(strlen(trim($row['repository_prefix_name'])) > 0 ?
trim($row['repository_prefix_name']) :
'Export_' . date("Y-m-d_H.i.s")),
'passive' => !!$row['passive'],
'max_retry' => $row['max_retry'],
'usr_mail' => $row['usr_mail'],
'sender_mail' => $app->getAuthenticatedUser()->getEmail(),
];
}
@@ -304,8 +310,6 @@ class set_export extends set_abstract
$this->display_orderable = $display_orderable;
$this->display_download = $display_download;
$this->display_ftp = $display_ftp;
return $this;
}
/**
@@ -319,8 +323,7 @@ class set_export extends set_abstract
}
/**
*
* @return Array
* @return array
*/
public function get_ftp_datas()
{
@@ -333,8 +336,7 @@ class set_export extends set_abstract
}
/**
*
* @return Array
* @return array
*/
public function get_display_orderable()
{
@@ -342,8 +344,7 @@ class set_export extends set_abstract
}
/**
*
* @return Array
* @return array
*/
public function get_display_download()
{
@@ -351,8 +352,7 @@ class set_export extends set_abstract
}
/**
*
* @return Array
* @return array
*/
public function get_display_ftp()
{
@@ -360,8 +360,7 @@ class set_export extends set_abstract
}
/**
*
* @return Int
* @return int
*/
public function get_total_download()
{
@@ -369,8 +368,7 @@ class set_export extends set_abstract
}
/**
*
* @return Int
* @return int
*/
public function get_total_order()
{
@@ -378,8 +376,7 @@ class set_export extends set_abstract
}
/**
*
* @return Int
* @return int
*/
public function get_total_ftp()
{
@@ -387,16 +384,15 @@ class set_export extends set_abstract
}
/**
*
* @param User $user
* @param User $user
* @param Filesystem $filesystem
* @param Array $subdefs
* @param boolean $rename_title
* @param boolean $includeBusinessFields
*
* @return Array
* @param array $subdefs
* @param bool $rename_title
* @param bool $includeBusinessFields
* @return array
* @throws Exception
*/
public function prepare_export(User $user, Filesystem $filesystem, Array $subdefs, $rename_title, $includeBusinessFields)
public function prepare_export(User $user, Filesystem $filesystem, array $subdefs, $rename_title, $includeBusinessFields)
{
if (!is_array($subdefs)) {
throw new Exception('No subdefs given');
@@ -414,32 +410,33 @@ class set_export extends set_abstract
$unicode = new \unicode();
foreach ($this->elements as $download_element) {
/** @var record_exportElement $download_element */
foreach ($this->get_elements() as $download_element) {
$id = count($files);
$files[$id] = [
'base_id' => $download_element->get_base_id(),
'record_id' => $download_element->get_record_id(),
'base_id' => $download_element->getBaseId(),
'record_id' => $download_element->getRecordId(),
'original_name' => '',
'export_name' => '',
'subdefs' => []
'export_name' => '',
'subdefs' => [],
];
$BF = false;
if ($includeBusinessFields && $this->app->getAclForUser($user)->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
if ($includeBusinessFields && $this->app->getAclForUser($user)->has_right_on_base($download_element->getBaseId(), 'canmodifrecord')) {
$BF = true;
}
$desc = $this->app['serializer.caption']->serialize($download_element->get_caption(), CaptionSerializer::SERIALIZE_XML, $BF);
$files[$id]['original_name'] =
$files[$id]['export_name'] =
$files[$id]['export_name'] =
$download_element->get_original_name(true);
$files[$id]['original_name'] =
trim($files[$id]['original_name']) != '' ?
$files[$id]['original_name'] : $id;
$files[$id]['original_name'] : $id;
$infos = pathinfo($files[$id]['original_name']);
@@ -456,13 +453,14 @@ class set_export extends set_abstract
$sizeMaxAjout = 0;
$sizeMaxExt = 0;
$sd = $download_element->get_subdefs();
foreach ($download_element->get_downloadable() as $name => $properties) {
if ($properties === false || !in_array($name, $subdefs)) {
continue;
}
if (!in_array($name, ['caption', 'caption-yaml']) && !isset($sd[$name])) {
$subdef = $download_element->get_subdef($name);
if (!in_array($name, ['caption', 'caption-yaml']) && !isset($subdef)) {
continue;
}
@@ -481,23 +479,23 @@ class set_export extends set_abstract
break;
case 'thumbnail':
$tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
'path' => $subdef->get_path(),
'file' => $subdef->get_file(),
];
$subdef_export = true;
$subdef_alive = true;
break;
case 'document':
$subdef_export = true;
$path = \recordutils_image::stamp($this->app , $sd[$name]);
$path = \recordutils_image::stamp($this->app, $subdef);
$tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
'path' => $subdef->get_path(),
'file' => $subdef->get_file(),
];
if (file_exists($path)) {
$tmp_pathfile = [
'path' => dirname($path)
, 'file' => basename($path)
'path' => dirname($path),
'file' => basename($path),
];
$subdef_alive = true;
}
@@ -507,17 +505,18 @@ class set_export extends set_abstract
$subdef_export = true;
$tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
'path' => $subdef->get_path(),
'file' => $subdef->get_file(),
];
if (!$this->app->getAclForUser($user)->has_right_on_base($download_element->get_base_id(), "nowatermark")
if (!$this->app->getAclForUser($user)->has_right_on_base($download_element->getBaseId(), "nowatermark")
&& !$this->app->getAclForUser($user)->has_preview_grant($download_element)
&& $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) {
$path = recordutils_image::watermark($this->app, $sd[$name]);
&& $subdef->get_type() == media_subdef::TYPE_IMAGE
) {
$path = recordutils_image::watermark($this->app, $subdef);
if (file_exists($path)) {
$tmp_pathfile = [
'path' => dirname($path)
, 'file' => basename($path)
'path' => dirname($path),
'file' => basename($path),
];
$subdef_alive = true;
}
@@ -560,14 +559,12 @@ class set_export extends set_abstract
$files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"];
$files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"];
$files[$id]["subdefs"][$name]["label"] = $properties['label'];
$files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size();
$files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime();
$files[$id]["subdefs"][$name]["folder"] =
$download_element->get_directory();
$files[$id]["subdefs"][$name]["exportExt"] =
isset($infos['extension']) ? $infos['extension'] : '';
$files[$id]["subdefs"][$name]["size"] = $subdef->get_size();
$files[$id]["subdefs"][$name]["mime"] = $subdef->get_mime();
$files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory();
$files[$id]["subdefs"][$name]["exportExt"] = isset($infos['extension']) ? $infos['extension'] : '';
$size += $sd[$name]->get_size();
$size += $subdef->get_size();
break;
}
@@ -582,7 +579,7 @@ class set_export extends set_abstract
}
}
$max_length = 31 - $sizeMaxExt - $sizeMaxAjout;
$max_length = self::$maxFilenameLength - 1 - $sizeMaxExt - $sizeMaxAjout;
$name = $files[$id]["export_name"];
@@ -595,7 +592,7 @@ class set_export extends set_abstract
while (in_array(mb_strtolower($name), $file_names)) {
$n++;
$suffix = "-" . $n; // pour diese si besoin
$max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix);
$max_length = self::$maxFilenameLength - 1 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix);
$name = mb_strtolower($files[$id]["export_name"]);
if ($start_length > $max_length)
$name = mb_substr($name, 0, $max_length) . $suffix;
@@ -611,10 +608,12 @@ class set_export extends set_abstract
$i = 0;
$name = utf8_decode($files[$id]["export_name"]);
$tmp_name = "";
$good_keys = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
$good_keys = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '-', '_', '.', '#'];
'4', '5', '6', '7', '8', '9', '-', '_', '.', '#',
];
while (isset($name[$i])) {
if (!in_array(mb_strtolower($name[$i]), $good_keys))
@@ -629,7 +628,7 @@ class set_export extends set_abstract
$files[$id]["export_name"] = $tmp_name;
if (in_array('caption', $subdefs)) {
$caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app->getAuthenticatedUser()->getId().'/';
$caption_dir = $this->app['tmp.caption.path'] . '/' . time() . $this->app->getAuthenticatedUser()->getId() . '/';
$filesystem->mkdir($caption_dir, 0750);
@@ -650,7 +649,7 @@ class set_export extends set_abstract
}
if (in_array('caption-yaml', $subdefs)) {
$caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app->getAuthenticatedUser()->getId().'/';
$caption_dir = $this->app['tmp.caption.path'] . '/' . time() . $this->app->getAuthenticatedUser()->getId() . '/';
$filesystem->mkdir($caption_dir, 0750);
@@ -674,23 +673,22 @@ class set_export extends set_abstract
$this->list = [
'files' => $files,
'names' => $file_names,
'size' => $size,
'count' => $n_files
'size' => $size,
'count' => $n_files,
];
return $this->list;
}
/**
*
* @param Application $app
* @param String $token
* @param Array $list
* @param string $zipFile
* @param Token $token
* @param array $list
* @param string $zipFile
*
* @return string
*/
public static function build_zip(Application $app, Token $token, Array $list, $zipFile)
public static function build_zip(Application $app, Token $token, array $list, $zipFile)
{
if (isset($list['complete']) && $list['complete'] === true) {
return;
@@ -745,19 +743,22 @@ class set_export extends set_abstract
* @todo a revoir le cas anonymous
*
* @param Application $app
* @param Array $list
* @param String $type
* @param boolean $anonymous
* @param string $comment
* @param array $list
* @param String $type
* @param boolean $anonymous
* @param string $comment
*
* @return Void
* @return void
*/
public static function log_download(Application $app, Array $list, $type, $anonymous = false, $comment = '')
public static function log_download(Application $app, array $list, $type, $anonymous = false, $comment = '')
{
$tmplog = [];
$files = $list['files'];
$event_name = in_array($type, [Session_Logger::EVENT_EXPORTMAIL,Session_Logger::EVENT_EXPORTDOWNLOAD]) ? $type : Session_Logger::EVENT_EXPORTDOWNLOAD;
$event_name = in_array($type, [
Session_Logger::EVENT_EXPORTMAIL,
Session_Logger::EVENT_EXPORTDOWNLOAD,
]) ? $type : Session_Logger::EVENT_EXPORTDOWNLOAD;
foreach ($files as $record) {
foreach ($record["subdefs"] as $o => $obj) {
@@ -765,16 +766,16 @@ class set_export extends set_abstract
$record_object = new record_adapter($app, $sbas_id, $record['record_id']);
$app['phraseanet.logger']($record_object->get_databox())->log($record_object, $event_name, $o, $comment);
$app['phraseanet.logger']($record_object->getDatabox())->log($record_object, $event_name, $o, $comment);
if ($o != "caption") {
$log["rid"] = $record_object->get_record_id();
$log["rid"] = $record_object->getRecordId();
$log["subdef"] = $o;
$log["poids"] = $obj["size"];
$log["shortXml"] = $app['serializer.caption']->serialize($record_object->get_caption(), CaptionSerializer::SERIALIZE_XML);
$tmplog[$record_object->get_base_id()][] = $log;
$tmplog[$record_object->getBaseId()][] = $log;
if (!$anonymous && $o == 'document' && null !== $app->getAuthenticatedUser()) {
$app->getAclForUser($app->getAuthenticatedUser())->remove_remaining($record_object->get_base_id());
$app->getAclForUser($app->getAuthenticatedUser())->remove_remaining($record_object->getBaseId());
}
}
@@ -794,9 +795,9 @@ class set_export extends set_abstract
foreach ($list_base as $base_id) {
if ($app->getAclForUser($app->getAuthenticatedUser())->is_restricted_download($base_id)) {
$params = [
':remain_dl' => $app->getAclForUser($app->getAuthenticatedUser())->remaining_download($base_id)
, ':base_id' => $base_id
, ':usr_id' => $app->getAclForUser($app->getAuthenticatedUser())->getId()
':remain_dl' => $app->getAclForUser($app->getAuthenticatedUser())->remaining_download($base_id),
':base_id' => $base_id,
':usr_id' => $app->getAuthenticatedUser()->getId(),
];
$stmt->execute($params);
@@ -805,7 +806,5 @@ class set_export extends set_abstract
$stmt->closeCursor();
}
return;
}
}

View File

@@ -14,21 +14,17 @@ use Alchemy\Phrasea\Model\Entities\Basket;
class set_selection extends set_abstract
{
protected $app;
/**
*
* @return set_selection
* @var Application
*/
protected $app;
public function __construct(Application $app)
{
$this->app = $app;
$this->elements = [];
return $this;
}
/**
*
* @param Basket $Basket
* @return set_selection
*/
@@ -42,20 +38,19 @@ class set_selection extends set_abstract
}
/**
*
* @param array $rights
* @param array $sbas_rights
*
* @return set_selection
*/
public function grep_authorized(Array $rights = [], Array $sbas_rights = [])
public function grep_authorized(array $rights = [], array $sbas_rights = [])
{
$to_remove = [];
foreach ($this->elements as $id => $record) {
$base_id = $record->get_base_id();
$sbas_id = $record->get_sbas_id();
$record_id = $record->get_record_id();
foreach ($this->get_elements() as $id => $record) {
$base_id = $record->getBaseId();
$sbas_id = $record->getDataboxId();
$record_id = $record->getRecordId();
if (! $rights) {
if ($this->app->getAclForUser($this->app->getAuthenticatedUser())->has_hd_grant($record)) {
continue;
@@ -84,7 +79,7 @@ class set_selection extends set_abstract
}
try {
$connsbas = $record->get_databox()->get_connection();
$connsbas = $record->getDatabox()->get_connection();
$sql = 'SELECT record_id
FROM record
@@ -105,31 +100,30 @@ class set_selection extends set_abstract
}
}
foreach ($to_remove as $id) {
unset($this->elements[$id]);
$this->offsetUnset($id);
}
return $this;
}
/**
*
* @param array $lst
* @param Boolean $flatten_groupings
*
* @return set_selection
*/
public function load_list(Array $lst, $flatten_groupings = false)
public function load_list(array $lst, $flatten_groupings = false)
{
foreach ($lst as $basrec) {
$basrec = explode('_', $basrec);
if (count($basrec) == 2) {
try {
$record = new record_adapter($this->app, (int) $basrec[0], (int) $basrec[1], count($this->elements));
$record = new record_adapter($this->app, (int) $basrec[0], (int) $basrec[1], $this->get_count());
} catch (\Exception $e) {
continue;
}
if ($record->isStory() && $flatten_groupings === true) {
foreach ($record->get_children() as $rec) {
foreach ($record->getChildren() as $rec) {
$this->add_element($rec);
}
} else {
@@ -142,14 +136,13 @@ class set_selection extends set_abstract
}
/**
*
* @return array
* @return array<int>
*/
public function get_distinct_sbas_ids()
{
$ret = [];
foreach ($this->elements as $record) {
$sbas_id = phrasea::sbasFromBas($this->app, $record->get_base_id());
foreach ($this->get_elements() as $record) {
$sbas_id = $record->getDataboxId();
$ret[$sbas_id] = $sbas_id;
}

View File

@@ -384,7 +384,7 @@ function manageSession(data, showMessages) {
$('body').append('<div id="#MESSAGE"></div>');
$('#MESSAGE')
.empty()
.append(data.message + '<div style="margin:20px;"><input type="checkbox" class="dialog_remove" />' + language.hideMessage + '</div>')
.append('<div style="margin:30px 10px;"><h4><b>' + data.message + '</b></h4></div><div style="margin:20px 0px 10px;"><label class="checkbox"><input type="checkbox" class="dialog_remove" />' + language.hideMessage + '</label></div>')
.attr('title', 'Global Message')
.dialog({
autoOpen: false,
@@ -393,8 +393,20 @@ function manageSession(data, showMessages) {
draggable: false,
modal: true,
close: function () {
if ($('.dialog_remove:checked', $(this)).length > 0)
setTemporaryPref('message', 0);
if ($('.dialog_remove:checked', $(this)).length > 0) {
// setTemporaryPref
$.ajax({
type: "POST",
url: "/user/preferences/temporary/",
data: {
prop: 'message',
value: 0
},
success: function (data) {
return;
}
});
}
}
})
.dialog('open');

View File

@@ -413,13 +413,13 @@
this.list = null;
this.container = $container;
$('.back_link', this.container).bind('click', function () {
$container.on('click', '.back_link', function() {
$('#PushBox').show();
$('#ListManager').hide();
return false;
});
$('a.list_sharer', this.container).off('click').on('click', function () {
$container.on('click', 'a.list_sharer', function() {
var $this = $(this),
options = {
@@ -434,8 +434,7 @@
return false;
});
$('a.user_adder', this.container).bind('click', function () {
$container.on('click', 'a.user_adder', function() {
var $this = $(this);

View File

@@ -751,18 +751,19 @@ function linearize() {
$('#answers .list').width(w);
}
else {
var minMargin = 5;
var margin = 0;
var el = $('#answers .diapo:first');
var brdrWidth = el.css('border-width');
var stdWidth = el.outerWidth() + 10;
var diapoWidth = el.outerWidth() + (minMargin * 2);
var fllWidth = $('#answers').innerWidth();
fllWidth -= 16;
fllWidth -= 26;
var n = Math.floor(fllWidth / (stdWidth));
var n = Math.floor(fllWidth / (diapoWidth));
margin = Math.floor((fllWidth % stdWidth) / (2 * n));
$('#answers .diapo').css('margin', '5px ' + (5 + margin) + 'px');
margin = Math.floor((fllWidth % diapoWidth) / (2 * n));
margin = margin + minMargin;
$('#answers .diapo').css('margin', '5px ' + (margin) + 'px');
}
}

View File

@@ -87,6 +87,14 @@ function openPreview(env, pos, contId, reload) {
// update real absolute position with pagination:
var absolutePos = parseInt(navigation.perPage,10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos,10);
// if comes from story, work with relative positionning
if (env == 'REG') {
// @TODO - if event comes from workzone (basket|story),
// we can use the relative position in order to display the doubleclicked records
// except we can't know the original event in this implementation
absolutePos = 0;
}
prevAjax = $.ajax({
type: "POST",
url: "../prod/records/",

View File

@@ -673,6 +673,11 @@ function edit_clk_editimg(evt, i) {
updateEditSelectedRecords(evt);
}
function toggleGroupSelection() {
var groupIndex = 0;
edit_clk_editimg(false, groupIndex);
}
// ---------------------------------------------------------------------------
// on a clique sur une checkbox de status
// ---------------------------------------------------------------------------
@@ -1651,7 +1656,12 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
if ($('#editcontextwrap').length == 0)
$('body').append('<div id="editcontextwrap"></div>');
self.setTimeout("edit_select_all();", 100);
// if is a group, only select the group
if (p4.edit.what === 'GRP') {
toggleGroupSelection();
} else {
self.setTimeout("edit_select_all();", 100);
}
$('.previewTips, .DCESTips, .fieldTips', p4.edit.editBox).tooltip({
fixable: true,

View File

@@ -88,10 +88,6 @@ a:hover {
TEXT-DECORATION: none
}
#desktop {
min-width: 1100px;
}
EM {
FONT-STYLE: normal;
BACKGROUND-COLOR: #D82400;
@@ -535,6 +531,7 @@ h4 {
@import 'ui-components/thumb-extractor';
@import 'ui-components/pagination';
@import 'ui-components/upload';
@import 'ui-components/modal-basket-pref';
@import 'ui-components/modal-publish';
@import 'ui-components/modal-edit';
@import 'ui-components/modal-export';

View File

@@ -38,6 +38,7 @@ $answersInfoLabelColor: #949494 !default;
#answers {
box-sizing: border-box;
.status {
img {
max-width: 16px;
@@ -54,14 +55,19 @@ $answersInfoLabelColor: #949494 !default;
cursor: pointer;
}
.list {
box-sizing: border-box;
position: relative;
float: left;
margin: 10px;
margin: 8px;
width: 600px;
overflow: hidden;
border: 3px solid $darkerBorderColor;
.diapo {
margin: 5px;
}
.desc {
.dl-horizontal {
margin-bottom: 0;
dt {
width: 70px; //100
}
@@ -78,7 +84,7 @@ $answersInfoLabelColor: #949494 !default;
background-color: $darkerBackgroundColor;
top: 55px;
bottom: 0;
margin-right: 8px;
margin-right: 0;
//overflow-y: hidden;
padding-left: 10px;
overflow-y: auto;

View File

@@ -0,0 +1,146 @@
#BasketBrowser {
h1 {
font-size: 14px;
line-height: 20px;
margin: 0;
padding: 0;
}
.Browser {
background-color: $mediumBackgroundColor;
}
.Basket {
background-color: $mediumBackgroundColor;
display: none;
.thumb_wrapper {
margin: 5px;
}
}
.result {
position: relative;
height: 100px;
.PNB10 {
overflow: hidden;
}
table {
height: 80px;
}
&.odd {
background-color: $darkBackgroundColor;
}
td.thumbnail {
display: table-cell;
width: 105px;
height: 80px;
padding: 0;
border: none;
border-radius: 0;
box-shadow: none;
line-height: 18px;
text-align: center;
vertical-align: top;
&.content {
width: 390px;
vertical-align: top;
}
.counter {
bottom: 18px;
font-size: 14px;
position: relative;
right: 5px;
text-align: right;
}
}
}
.results {
.datas {
top: 50px;
bottom: 50px;
overflow-y: auto;
overflow-x: hidden;
}
.header, .footer {
height: 50px;
}
.header {
bottom: auto;
}
.footer {
top: auto;
}
.result h1.title {
font-size: 14px;
}
}
form {
h1 {
margin: 10px 0;
}
ul li {
padding: 0;
border-top: 1px solid #9A9A9A;
&.first {
border-top: none;
}
label {
padding: 3px 0 2px 20px;
}
}
}
h1.title .loader {
display: none;
margin: 4px;
}
img {
vertical-align: middle;
}
table {
width: 100%;
border: none;
vertical-align: top;
td.paginator {
text-align: right;
}
}
input {
display: none;
&.Query {
padding: 3px;
display: block;
border-radius: 4px;
width: 155px;
padding-left: 25px;
}
}
label {
cursor: pointer;
color: #9a9a9a;
}
input:checked + label,
label.selected {
background-color: $highlightDarkerColor;
color: $highlightTextColor;
}
}

View File

@@ -31,7 +31,7 @@
{% set class_status = '' %}
{% endif %}
<div pos="{{ i }}" id="idEditDiapo_{{ i }}" class="diapo selected {{ class_status }}" style="width:{{ cont_width }}px; height:{{ cont_height }}px;">
<div pos="{{ i }}" id="idEditDiapo_{{ i }}" class="diapo {{ class_status }}" style="width:{{ cont_width }}px; height:{{ cont_height }}px;">
<div class='titre'>
{{ record.get_original_name() }}
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
<?php
namespace Alchemy\Tests\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Model\Entities\User;
/**
* @group functional
@@ -130,22 +131,28 @@ class ExportTest extends \PhraseanetAuthenticatedWebTestCase
*/
public function testExportFtp()
{
if (!self::$DI['app']['conf']->get(['registry', 'ftp', 'ftp-enabled'])) {
self::$DI['app']['conf']->set(['registry', 'ftp', 'ftp-enabled'], true);
$app = $this->getApplication();
if (!$app['conf']->get(['registry', 'ftp', 'ftp-enabled'])) {
$app['conf']->set(['registry', 'ftp', 'ftp-enabled'], true);
self::$GV_activeFTP = true;
}
/** @var User $user */
$user = self::$DI['user'];
//inserted rows from this function are deleted in tearDownAfterClass
self::$DI['client']->request('POST', '/prod/export/ftp/', [
'lst' => self::$DI['record_1']->get_serialize_key(),
'user_dest' => self::$DI['user']->getId(),
$this->getClient()->request('POST', '/prod/export/ftp/', [
'lst' => $this->getRecord1()->get_serialize_key(),
'user_dest' => $user->getId(),
'address' => 'local.phrasea.test',
'login' => self::$DI['user']->getEmail(),
'login' => $user->getEmail(),
'dest_folder' => '/home/test/',
'prefix_folder' => 'test2/',
'obj' => ['preview']
]);
$response = self::$DI['client']->getResponse();
$response = $this->getClient()->getResponse();
$this->assertTrue($response->isOk());
$datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas);
@@ -161,13 +168,13 @@ class ExportTest extends \PhraseanetAuthenticatedWebTestCase
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRecordsExport');
self::$DI['client']->request('POST', '/prod/export/mail/', [
'lst' => self::$DI['record_1']->get_serialize_key(),
$this->getClient()->request('POST', '/prod/export/mail/', [
'lst' => $this->getRecord1()->get_serialize_key(),
'destmail' => 'user@example.com',
'obj' => ['preview'],
]);
$response = self::$DI['client']->getResponse();
$response = $this->getClient()->getResponse();
$this->assertTrue($response->isOk());
}
@@ -177,8 +184,8 @@ class ExportTest extends \PhraseanetAuthenticatedWebTestCase
*/
public function testRequireAuthentication()
{
$this->logout(self::$DI['app']);
self::$DI['client']->request('POST', '/prod/export/multi-export/');
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
$this->logout($this->getApplication());
$this->getClient()->request('POST', '/prod/export/multi-export/');
$this->assertTrue($this->getClient()->getResponse()->isRedirect());
}
}