mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge branch '3.8'
Conflicts: lib/Alchemy/Phrasea/Core/Version.php
This commit is contained in:
@@ -72,7 +72,7 @@ class Login implements ControllerProviderInterface
|
|||||||
'meta_keywords' => $app['phraseanet.registry']->get('GV_metakeywords'),
|
'meta_keywords' => $app['phraseanet.registry']->get('GV_metakeywords'),
|
||||||
'browser_name' => $app['browser']->getBrowser(),
|
'browser_name' => $app['browser']->getBrowser(),
|
||||||
'browser_version' => $app['browser']->getVersion(),
|
'browser_version' => $app['browser']->getVersion(),
|
||||||
'available_language' => $app->getAvailableLanguages(),
|
'available_language' => $app['locales.available'],
|
||||||
'locale' => $app['locale'],
|
'locale' => $app['locale'],
|
||||||
'current_url' => $app['request']->getUri(),
|
'current_url' => $app['request']->getUri(),
|
||||||
'flash_types' => $app->getAvailableFlashTypes(),
|
'flash_types' => $app->getAvailableFlashTypes(),
|
||||||
|
@@ -23,19 +23,19 @@ class LocaleServiceProvider implements ServiceProviderInterface
|
|||||||
return $app['phraseanet.registry']->get('GV_default_lng', 'en_GB');
|
return $app['phraseanet.registry']->get('GV_default_lng', 'en_GB');
|
||||||
});
|
});
|
||||||
|
|
||||||
$app['locale.I18n'] = function (Application $app) {
|
$app['locale.I18n'] = $app->share(function (Application $app) {
|
||||||
$data = explode('_', $app['locale']);
|
$data = explode('_', $app['locale']);
|
||||||
|
|
||||||
return $data[0];
|
return $data[0];
|
||||||
};
|
});
|
||||||
|
|
||||||
$app['locale.l10n'] = function (Application $app) {
|
$app['locale.l10n'] = $app->share(function (Application $app) {
|
||||||
$data = explode('_', $app['locale']);
|
$data = explode('_', $app['locale']);
|
||||||
|
|
||||||
return $data[1];
|
return $data[1];
|
||||||
};
|
});
|
||||||
|
|
||||||
$app['locales.available'] = function (Application $app) {
|
$app['locales.available'] = $app->share(function (Application $app) {
|
||||||
$availableLanguages = PhraseaApplication::getAvailableLanguages();
|
$availableLanguages = PhraseaApplication::getAvailableLanguages();
|
||||||
|
|
||||||
if ($app['phraseanet.configuration']->isSetup()
|
if ($app['phraseanet.configuration']->isSetup()
|
||||||
@@ -65,9 +65,9 @@ class LocaleServiceProvider implements ServiceProviderInterface
|
|||||||
} else {
|
} else {
|
||||||
return $availableLanguages;
|
return $availableLanguages;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
$app['locales.mapping'] = function (Application $app) {
|
$app['locales.mapping'] = $app->share(function (Application $app) {
|
||||||
$codes = array();
|
$codes = array();
|
||||||
foreach ($app['locales.available'] as $code => $language) {
|
foreach ($app['locales.available'] as $code => $language) {
|
||||||
$data = explode('_', $code);
|
$data = explode('_', $code);
|
||||||
@@ -75,7 +75,7 @@ class LocaleServiceProvider implements ServiceProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $codes;
|
return $codes;
|
||||||
};
|
});
|
||||||
|
|
||||||
$app['locales.I18n.available'] = $app->share(function (Application $app) {
|
$app['locales.I18n.available'] = $app->share(function (Application $app) {
|
||||||
$locales = array();
|
$locales = array();
|
||||||
|
@@ -74,9 +74,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
'images_per_page' => 20,
|
'images_per_page' => 20,
|
||||||
'images_size' => 120,
|
'images_size' => 120,
|
||||||
'editing_images_size' => 134,
|
'editing_images_size' => 134,
|
||||||
'editing_top_box' => '180px',
|
'editing_top_box' => 30,
|
||||||
'editing_right_box' => '400px',
|
'editing_right_box' => 48,
|
||||||
'editing_left_box' => '710px',
|
'editing_left_box' => 33,
|
||||||
'basket_sort_field' => 'name',
|
'basket_sort_field' => 'name',
|
||||||
'basket_sort_order' => 'ASC',
|
'basket_sort_order' => 'ASC',
|
||||||
'warning_on_delete_story' => 'true',
|
'warning_on_delete_story' => 'true',
|
||||||
@@ -1057,11 +1057,27 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->app['phraseanet.configuration']['user-settings'])) {
|
||||||
|
$this->_prefs = array_replace(
|
||||||
|
$this->_prefs,
|
||||||
|
// remove keys that are not defined in default values
|
||||||
|
array_intersect_key(
|
||||||
|
$this->app['phraseanet.configuration']['user-settings'],
|
||||||
|
self::$def_values
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->preferences_loaded = true;
|
$this->preferences_loaded = true;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function purgePreferences()
|
||||||
|
{
|
||||||
|
$this->notifications_preferences_loaded = $this->preferences_loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
protected function load_notifications_preferences(Application $app)
|
protected function load_notifications_preferences(Application $app)
|
||||||
{
|
{
|
||||||
$this->load_preferences();
|
$this->load_preferences();
|
||||||
@@ -1075,7 +1091,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->notification_preferences_loaded = true;
|
$this->notifications_preferences_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_notifications_preference(Application $app, $notification_id)
|
public function get_notifications_preference(Application $app, $notification_id)
|
||||||
|
79
lib/classes/patch/381alpha4a.php
Normal file
79
lib/classes/patch/381alpha4a.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
|
||||||
|
class patch_381alpha4a implements patchInterface
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $release = '3.8.1-alpha.4';
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $concern = array(base::APPLICATION_BOX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function get_release()
|
||||||
|
{
|
||||||
|
return $this->release;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function require_all_upgrades()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function concern()
|
||||||
|
{
|
||||||
|
return $this->concern;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function apply(base $appbox, Application $app)
|
||||||
|
{
|
||||||
|
$sql = "SELECT usr_id, prop, value FROM usr_settings
|
||||||
|
WHERE prop = 'editing_top_box'
|
||||||
|
OR prop = 'editing_right_box' OR prop = 'editing_left_box'";
|
||||||
|
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$sql = 'UPDATE usr_settings SET value = :value WHERE usr_id = :usr_id AND prop = :prop';
|
||||||
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$value = $row['value'];
|
||||||
|
|
||||||
|
if ('px' === substr($value, -2)) {
|
||||||
|
$value = substr($value, 0, -2);
|
||||||
|
} elseif ('%' === substr($value, -1)) {
|
||||||
|
$value = substr($value, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->execute(array(':value' => $value, ':usr_id' => $row['usr_id'], ':prop' => $row['prop']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
12981
locale/phraseanet.pot
12981
locale/phraseanet.pot
File diff suppressed because it is too large
Load Diff
@@ -127,7 +127,7 @@
|
|||||||
<input style="font-size:2px; width:5px;" type="text" id="editFakefocus" />
|
<input style="font-size:2px; width:5px;" type="text" id="editFakefocus" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="EDIT_TOP" style="height:{{app['authentication'].getUser().getPrefs('editing_top_box')}};">
|
<div id="EDIT_TOP" style="height:{{app['authentication'].getUser().getPrefs('editing_top_box')}}%;">
|
||||||
<div id="EDIT_MENU">
|
<div id="EDIT_MENU">
|
||||||
<div id="EDIT_ZOOMSLIDER" >
|
<div id="EDIT_ZOOMSLIDER" >
|
||||||
</div>
|
</div>
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
|
|
||||||
<div id='EDIT_MID'>
|
<div id='EDIT_MID'>
|
||||||
<div id='EDIT_MID_L' class='ui-corner-all'>
|
<div id='EDIT_MID_L' class='ui-corner-all'>
|
||||||
<div id="divS_wrapper" style="width:{{app['authentication'].getUser().getPrefs('editing_right_box')}}">
|
<div id="divS_wrapper" style="width:{{app['authentication'].getUser().getPrefs('editing_right_box')}}%">
|
||||||
<div id="divS">
|
<div id="divS">
|
||||||
{{_self.HTML_fieldlist(recordsRequest, fields)}}
|
{{_self.HTML_fieldlist(recordsRequest, fields)}}
|
||||||
</div>
|
</div>
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
<div id="idExplain" class="PNB"></div>
|
<div id="idExplain" class="PNB"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="EDIT_MID_R" style="width:{{app['authentication'].getUser().getPrefs('editing_left_box')}}">
|
<div id="EDIT_MID_R" style="width:{{app['authentication'].getUser().getPrefs('editing_left_box')}}%;">
|
||||||
<div style='position:absolute; top:0; left:0; right:0; bottom:0;' class='tabs'>
|
<div style='position:absolute; top:0; left:0; right:0; bottom:0;' class='tabs'>
|
||||||
<ul>
|
<ul>
|
||||||
{% if thesaurus %}
|
{% if thesaurus %}
|
||||||
|
@@ -220,6 +220,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
return new Client($DI['app'], array());
|
return new Client($DI['app'], array());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self::$DI['user']->purgePreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
@@ -58,6 +58,30 @@ class userTest extends PhraseanetPHPUnitAbstract
|
|||||||
$this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box'));
|
$this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetPrefWithACustomizedConf()
|
||||||
|
{
|
||||||
|
$data = isset(self::$DI['app']['phraseanet.configuration']['user-settings']) ? self::$DI['app']['phraseanet.configuration']['user-settings'] : null;
|
||||||
|
|
||||||
|
self::$DI['app']['phraseanet.configuration']['user-settings'] = array(
|
||||||
|
'images_per_page' => 42,
|
||||||
|
'images_size' => 666,
|
||||||
|
'lalala' => 'didou',
|
||||||
|
);
|
||||||
|
|
||||||
|
$user = $this->get_user();
|
||||||
|
|
||||||
|
$this->assertNull($user->getPrefs('lalala'));
|
||||||
|
$this->assertSame(666, $user->getPrefs('images_size'));
|
||||||
|
$this->assertSame(42, $user->getPrefs('images_per_page'));
|
||||||
|
$this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box'));
|
||||||
|
|
||||||
|
if (null === $data) {
|
||||||
|
unset(self::$DI['app']['phraseanet.configuration']['user-settings']);
|
||||||
|
} else {
|
||||||
|
self::$DI['app']['phraseanet.configuration']['user-settings'] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetPref()
|
public function testSetPref()
|
||||||
{
|
{
|
||||||
$user = $this->get_user();
|
$user = $this->get_user();
|
||||||
|
@@ -1740,7 +1740,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
|
|||||||
},
|
},
|
||||||
stop: function () {
|
stop: function () {
|
||||||
hsplit1();
|
hsplit1();
|
||||||
setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height()) + '%');
|
setPref('editing_top_box', Math.floor($('#EDIT_TOP').height() * 100 / $('#EDIT_ALL').height()));
|
||||||
setSizeLimits();
|
setSizeLimits();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1753,7 +1753,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
|
|||||||
setPreviewEdit();
|
setPreviewEdit();
|
||||||
},
|
},
|
||||||
stop: function () {
|
stop: function () {
|
||||||
setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width()) + '%');
|
setPref('editing_right_box', Math.floor($('#divS').width() * 100 / $('#EDIT_MID_L').width()));
|
||||||
vsplit1();
|
vsplit1();
|
||||||
setSizeLimits();
|
setSizeLimits();
|
||||||
}
|
}
|
||||||
@@ -1769,7 +1769,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
|
|||||||
setPreviewEdit();
|
setPreviewEdit();
|
||||||
},
|
},
|
||||||
stop: function () {
|
stop: function () {
|
||||||
setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width()) + '%');
|
setPref('editing_left_box', Math.floor($('#EDIT_MID_R').width() * 100 / $('#EDIT_MID').width()));
|
||||||
vsplit2();
|
vsplit2();
|
||||||
setSizeLimits();
|
setSizeLimits();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user