Merge branch '3.8'

Conflicts:
	lib/Alchemy/Phrasea/Core/Version.php
This commit is contained in:
Romain Neutron
2013-11-14 17:52:52 +01:00
17 changed files with 32922 additions and 23527 deletions

View File

@@ -72,7 +72,7 @@ class Login implements ControllerProviderInterface
'meta_keywords' => $app['phraseanet.registry']->get('GV_metakeywords'),
'browser_name' => $app['browser']->getBrowser(),
'browser_version' => $app['browser']->getVersion(),
'available_language' => $app->getAvailableLanguages(),
'available_language' => $app['locales.available'],
'locale' => $app['locale'],
'current_url' => $app['request']->getUri(),
'flash_types' => $app->getAvailableFlashTypes(),

View File

@@ -23,19 +23,19 @@ class LocaleServiceProvider implements ServiceProviderInterface
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']);
return $data[0];
};
});
$app['locale.l10n'] = function (Application $app) {
$app['locale.l10n'] = $app->share(function (Application $app) {
$data = explode('_', $app['locale']);
return $data[1];
};
});
$app['locales.available'] = function (Application $app) {
$app['locales.available'] = $app->share(function (Application $app) {
$availableLanguages = PhraseaApplication::getAvailableLanguages();
if ($app['phraseanet.configuration']->isSetup()
@@ -65,9 +65,9 @@ class LocaleServiceProvider implements ServiceProviderInterface
} else {
return $availableLanguages;
}
};
});
$app['locales.mapping'] = function (Application $app) {
$app['locales.mapping'] = $app->share(function (Application $app) {
$codes = array();
foreach ($app['locales.available'] as $code => $language) {
$data = explode('_', $code);
@@ -75,7 +75,7 @@ class LocaleServiceProvider implements ServiceProviderInterface
}
return $codes;
};
});
$app['locales.I18n.available'] = $app->share(function (Application $app) {
$locales = array();

View File

@@ -74,9 +74,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
'images_per_page' => 20,
'images_size' => 120,
'editing_images_size' => 134,
'editing_top_box' => '180px',
'editing_right_box' => '400px',
'editing_left_box' => '710px',
'editing_top_box' => 30,
'editing_right_box' => 48,
'editing_left_box' => 33,
'basket_sort_field' => 'name',
'basket_sort_order' => 'ASC',
'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;
return $this;
}
public function purgePreferences()
{
$this->notifications_preferences_loaded = $this->preferences_loaded = false;
}
protected function load_notifications_preferences(Application $app)
{
$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)

View 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;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -127,7 +127,7 @@
<input style="font-size:2px; width:5px;" type="text" id="editFakefocus" />
</form>
</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_ZOOMSLIDER" >
</div>
@@ -150,7 +150,7 @@
<div id='EDIT_MID'>
<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">
{{_self.HTML_fieldlist(recordsRequest, fields)}}
</div>
@@ -230,7 +230,7 @@
<div id="idExplain" class="PNB"></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'>
<ul>
{% if thesaurus %}

View File

@@ -220,6 +220,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
return new Client($DI['app'], array());
});
self::$DI['user']->purgePreferences();
}
public function tearDown()

View File

@@ -58,6 +58,30 @@ class userTest extends PhraseanetPHPUnitAbstract
$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()
{
$user = $this->get_user();

View File

@@ -1740,7 +1740,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
},
stop: function () {
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();
}
});
@@ -1753,7 +1753,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
setPreviewEdit();
},
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();
setSizeLimits();
}
@@ -1769,7 +1769,7 @@ function startThisEditing(sbas_id, what, regbasprid, ssel) {
setPreviewEdit();
},
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();
setSizeLimits();
}