diff --git a/op/op.Categories.php b/op/op.Categories.php
index 5616028e8..40d355165 100644
--- a/op/op.Categories.php
+++ b/op/op.Categories.php
@@ -108,6 +108,10 @@ else if ($action == "editcategory") {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
+ $color = $_POST["color"];
+ if (!$category->setColor($color)) {
+ UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
+ }
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_category')));
add_log_line(".php&action=editcategory&categoryid=".$categoryid);
}
diff --git a/views/bootstrap/class.Categories.php b/views/bootstrap/class.Categories.php
index 4ebf72eb0..d81e0d348 100644
--- a/views/bootstrap/class.Categories.php
+++ b/views/bootstrap/class.Categories.php
@@ -120,6 +120,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 4a64b7bdb..8ae5b007b 100644
--- a/views/bootstrap4/class.Bootstrap4.php
+++ b/views/bootstrap4/class.Bootstrap4.php
@@ -3659,10 +3659,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
}
if($categories = $document->getCategories()) {
$content .= "
";
- foreach($categories as $category) {
- $color = substr(md5($category->getName()), 0, 6);
- $content .= "".htmlspecialchars($category->getName())." ";
- }
+ foreach($categories as $category)
+ $content .= "getColor() ? ' style="background-color: #'.$category->getColor().' !important;"' : '').">".$category->getName()." ";
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];