From 5921a29ec3623b0630f9875256577bc65e899988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 7 Dec 2016 04:13:49 +0100 Subject: [PATCH] Fixes #5279 Fixed the way icons column width is handled in OrderedArrayAttribute --- html/themes/breezy/lists.css | 2 +- html/themes/legacy/lists.css | 2 +- include/class_SnapshotDialogs.inc | 8 +++---- .../attributes/class_SetAttribute.inc | 24 +++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/html/themes/breezy/lists.css b/html/themes/breezy/lists.css index b9f0569f6..4617e55ef 100644 --- a/html/themes/breezy/lists.css +++ b/html/themes/breezy/lists.css @@ -93,7 +93,7 @@ border-left: 1px solid #C0C2C3; table.listingTable > tbody > tr td > input[type=image], table.listingTable > tbody > tr td > img { -padding: 1px; +padding: 2px; } table.listingTable > tbody > tr td > a:link { diff --git a/html/themes/legacy/lists.css b/html/themes/legacy/lists.css index 2be1dbbb2..680397b2d 100644 --- a/html/themes/legacy/lists.css +++ b/html/themes/legacy/lists.css @@ -93,7 +93,7 @@ border-left: 1px solid #AAA; table.listingTable > tbody > tr td > input[type=image], table.listingTable > tbody > tr td > img { -padding: 1px; +padding: 2px; } diff --git a/include/class_SnapshotDialogs.inc b/include/class_SnapshotDialogs.inc index d21a770a3..7404ebc3f 100644 --- a/include/class_SnapshotDialogs.inc +++ b/include/class_SnapshotDialogs.inc @@ -127,7 +127,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute protected function genRowIcons($key, $value) { $id = $this->getHtmlId(); - list ($img, $width) = parent::genRowIcons($key, $value); + list ($img, $nbicons) = parent::genRowIcons($key, $value); $img = $this->renderInputField( 'image', $id.'_restore_'.$key, array( @@ -136,10 +136,10 @@ class SnapshotsAttribute extends OrderedArrayAttribute 'alt' => _('Restore'), 'class' => 'center' ) - ).' '.$img; - $width += 15; + ).$img; + $nbicons++; - return array ($img, $width); + return array ($img, $nbicons); } protected function handlePostValueActions($id, $postValue) diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index 5478f47ba..13d609f3b 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -434,9 +434,9 @@ class OrderedArrayAttribute extends SetAttribute continue; } - list ($img, $width) = $this->genRowIcons($key, $value); + list ($img, $nbicons) = $this->genRowIcons($key, $value); - $fields[] = array("html" => $img, "attach" => 'style="border:0px;width:'.$width.'px;"'); + $fields[] = array("html" => $img, "attach" => 'style="border:0px;width:'.($nbicons * 20).'px;"'); $div->AddEntry($fields); } $smarty->assign("div_$id", $div->DrawList()); @@ -448,10 +448,10 @@ class OrderedArrayAttribute extends SetAttribute $id = $this->getHtmlId(); $img = ''; - $width = 25; + $nbicons = 1; if ($this->order) { - $width += 20; + $nbicons += 2; if ($key != 0) { $img .= $this->renderInputField( 'image', $id.'_up_'.$key, @@ -461,9 +461,9 @@ class OrderedArrayAttribute extends SetAttribute 'alt' => _('Sort up'), 'class' => 'center' ) - ).' '; + ); } else { - $img .= '<img src="images/empty.png" alt="" style="width:10px;"/>'; + $img .= '<img src="images/empty.png" alt="" style="width:16px;"/>'; } if (($key + 1) < count($this->value)) { $img .= $this->renderInputField( @@ -474,13 +474,13 @@ class OrderedArrayAttribute extends SetAttribute 'alt' => _('Sort down'), 'class' => 'center' ) - ).' '; + ); } else { - $img .= '<img src="images/empty.png" alt="" style="width:10px;"/>'; + $img .= '<img src="images/empty.png" alt="" style="width:16px;"/>'; } } if ($this->edit_enabled) { - $width += 15; + $nbicons++; $img .= $this->renderInputField( 'image', $id.'_edit_'.$key, array( @@ -489,7 +489,7 @@ class OrderedArrayAttribute extends SetAttribute 'alt' => _('Edit'), 'class' => 'center' ) - ).' '; + ); } $img .= $this->renderInputField( 'image', $id.'_del_'.$key, @@ -499,9 +499,9 @@ class OrderedArrayAttribute extends SetAttribute 'alt' => _('Delete'), 'class' => 'center' ) - ).' '; + ); - return array ($img, $width); + return array ($img, $nbicons); } protected function getAttributeArrayValue($key, $value) -- GitLab