Added possibility to edit calendar color

This commit is contained in:
Tim Bolender 2014-04-16 23:11:24 +02:00
parent 6c77c02e21
commit e7ded42c8f
2 changed files with 19 additions and 0 deletions

View file

@ -162,6 +162,17 @@ class Calendar extends \Flake\Core\Model\Db {
)
)));
$oMorpho->add(new \Formal\Element\Text(array(
"prop" => "calendarcolor",
"label" => "Calendar color",
"validation" => "color",
"popover" => array(
"title" => "Calendar color",
"content" => "This is the color that will be displayed in your CalDAV client.</br>".
"Must be supplied in format '#RRGGBBAA' with hexadecimal values. This value is optional.",
)
)));
$oMorpho->add(new \Formal\Element\Text(array(
"prop" => "description",
"label" => "Description"

View file

@ -314,6 +314,14 @@ class Form {
return TRUE;
}
public function validateColor($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) {
if(!empty($sValue) && !preg_match("/^#[a-fA-F0-9]{8}$/", $sValue)) {
return "<strong>" . $oElement->option("label") . "</strong> is not a valid color with format '#RRGGBBAA' in hexadecimal values.";
}
return TRUE;
}
public function postValue($sPropName) {
$aData = \Flake\Util\Tools::POST("data");