From 32ce4c9021ffe359a29b9ee2b39458f877ab3669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Sun, 2 Feb 2014 11:53:50 +0100 Subject: [PATCH] Merged fhemberger-patch-132 --- Core/Frameworks/Baikal/Model/Calendar.php | 39 +++++++++++++++++++++++ Core/Resources/Db/MySQL/db.sql | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Core/Frameworks/Baikal/Model/Calendar.php b/Core/Frameworks/Baikal/Model/Calendar.php index f174a10..dfd0b02 100755 --- a/Core/Frameworks/Baikal/Model/Calendar.php +++ b/Core/Frameworks/Baikal/Model/Calendar.php @@ -78,6 +78,17 @@ class Calendar extends \Flake\Core\Model\Db { return in_array("VTODO", $aComponents); } + if($sPropName === "notes") { + # TRUE if components contains VJOURNAL, FALSE otherwise + if(($sComponents = $this->get("components")) !== "") { + $aComponents = explode(",", $sComponents); + } else { + $aComponents = array(); + } + + return in_array("VJOURNAL", $aComponents); + } + return parent::get($sPropName); } @@ -104,6 +115,27 @@ class Calendar extends \Flake\Core\Model\Db { return parent::set("components", implode(",", $aComponents)); } + if($sPropName === "notes") { + + if(($sComponents = $this->get("components")) !== "") { + $aComponents = explode(",", $sComponents); + } else { + $aComponents = array(); + } + + if($sValue === TRUE) { + if(!in_array("VJOURNAL", $aComponents)) { + $aComponents[] = "VJOURNAL"; + } + } else { + if(in_array("VJOURNAL", $aComponents)) { + unset($aComponents[array_search("VJOURNAL", $aComponents)]); + } + } + + return parent::set("components", implode(",", $aComponents)); + } + return parent::set($sPropName, $sValue); } @@ -141,6 +173,13 @@ class Calendar extends \Flake\Core\Model\Db { "help" => "If checked, todos will be enabled on this calendar.", ))); + $oMorpho->add(new \Formal\Element\Checkbox(array( + "prop" => "notes", + "label" => "Notes", + "help" => "If checked, notes will be enabled on this calendar.", + ))); + + if($this->floating()) { $oMorpho->element("uri")->setOption( "help", diff --git a/Core/Resources/Db/MySQL/db.sql b/Core/Resources/Db/MySQL/db.sql index 95ee53d..a79b899 100644 --- a/Core/Resources/Db/MySQL/db.sql +++ b/Core/Resources/Db/MySQL/db.sql @@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS calendars ( calendarorder INTEGER UNSIGNED NOT NULL DEFAULT '0', calendarcolor VARCHAR(10), timezone TEXT, - components VARCHAR(20), + components VARCHAR(21), transparent TINYINT(1) NOT NULL DEFAULT '0', UNIQUE(principaluri, uri) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;