Fix editing default user settings

This commit is contained in:
Romain Neutron
2013-11-14 13:29:49 +01:00
parent 7ce719a00b
commit 84c444c186
5 changed files with 89 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/
class Version
{
protected static $number = '3.8.1-alpha.3';
protected static $number = '3.8.1-alpha.4';
protected static $name = 'Diplodocus';
public static function getNumber()

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',

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

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

@@ -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();
}