Merged fhemberger-patch-132

Former-commit-id: 32ce4c9021
This commit is contained in:
Jérôme Schneider 2014-02-02 11:53:50 +01:00
parent f0e075fab6
commit d9ee53610d
2 changed files with 40 additions and 1 deletions

View file

@ -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",

View file

@ -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;