From d12ff1eb1328609c03ab73ad28f0db2d434b9d86 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 May 2021 16:15:06 +0200 Subject: [PATCH] document categorie may have a color --- op/op.Categories.php | 5 +++++ views/bootstrap/class.Categories.php | 9 +++++++++ views/bootstrap4/class.Bootstrap4.php | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/op/op.Categories.php b/op/op.Categories.php index ce54a75e9..5428ed70c 100644 --- a/op/op.Categories.php +++ b/op/op.Categories.php @@ -100,6 +100,11 @@ else if ($action == "editcategory") { if (!$category->setName($name)) { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } + + $color = $_POST["color"]; + if (!$category->setColor($color)) { + UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); + } } else { diff --git a/views/bootstrap/class.Categories.php b/views/bootstrap/class.Categories.php index e3711fb53..4a44899d6 100644 --- a/views/bootstrap/class.Categories.php +++ b/views/bootstrap/class.Categories.php @@ -125,6 +125,15 @@ $(document).ready( function() { 'value'=>($category ? htmlspecialchars($category->getName()) : '') ) ); + $this->formField( + getMLText("color"), + array( + 'element'=>'input', + 'type'=>'text', + 'name'=>'color', + 'value'=>($category ? htmlspecialchars($category->getColor()) : '') + ) + ); $this->contentContainerEnd(); $this->formSubmit(" ".getMLText('save')); ?> diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 621051e70..703bb1eaf 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -3007,7 +3007,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if($categories = $document->getCategories()) { $content .= "
"; foreach($categories as $category) - $content .= "".$category->getName()." "; + $content .= "getColor() ? ' style="background-color: #'.$category->getColor().' !important;"' : '').">".$category->getName()." "; } if(!empty($extracontent['bottom_title'])) $content .= $extracontent['bottom_title'];