Commit f7021fd9 authored by Sebastian Kummer's avatar Sebastian Kummer

ZO-81 Set PR_ICON_INDEX and PidLidNoteColor from categories sent from

Outlook, translate note color to category when streaming to outlook,
fallback to yellow if no category is sent, fixed typos
parent bacdd6b7
...@@ -465,6 +465,7 @@ class MAPIMapping { ...@@ -465,6 +465,7 @@ class MAPIMapping {
"messageclass" => PR_MESSAGE_CLASS, "messageclass" => PR_MESSAGE_CLASS,
"subject" => PR_SUBJECT, "subject" => PR_SUBJECT,
"Color" => "PT_LONG:PSETID_Note:0x8B00", "Color" => "PT_LONG:PSETID_Note:0x8B00",
"Iconindex" => PR_ICON_INDEX,
); );
} }
......
...@@ -1632,6 +1632,11 @@ class MAPIProvider { ...@@ -1632,6 +1632,11 @@ class MAPIProvider {
// Setting it to an empty array will unset the property in Zarafa as well // Setting it to an empty array will unset the property in Zarafa as well
if (!isset($note->categories)) $note->categories = array(); if (!isset($note->categories)) $note->categories = array();
// update icon index to correspond to the color
if (isset($note->Color) && $note->Color > -1 && $note->Color < 5) {
$note->Iconindex = 768 + $note->Color;
}
$this->setPropsInMAPI($mapimessage, $note, MAPIMapping::GetNoteMapping()); $this->setPropsInMAPI($mapimessage, $note, MAPIMapping::GetNoteMapping());
$noteprops = MAPIMapping::GetNoteProperties(); $noteprops = MAPIMapping::GetNoteProperties();
......
...@@ -97,7 +97,10 @@ class SyncNote extends SyncObject { ...@@ -97,7 +97,10 @@ class SyncNote extends SyncObject {
* @return void * @return void
*/ */
public function SetColorFromCategory() { public function SetColorFromCategory() {
if (is_array($this->categories)) { // default to yellow
$result = array("Yellow Category");
if (!empty($this->categories)) {
$result = array_intersect($this->categories, array_values(self::$colors)); $result = array_intersect($this->categories, array_values(self::$colors));
if (empty($result)) { if (empty($result)) {
$result = array_intersect($this->categories, array_values(self::$unsupportedColors)); $result = array_intersect($this->categories, array_values(self::$unsupportedColors));
...@@ -106,9 +109,9 @@ class SyncNote extends SyncObject { ...@@ -106,9 +109,9 @@ class SyncNote extends SyncObject {
$result = array("White Category"); $result = array("White Category");
} }
} }
if (!empty($result)) {
$this->Color = array_search($result[0], $this->categories);
} }
if (!empty($result)) {
$this->Color = array_search($result[0], self::$colors);
} }
} }
...@@ -121,19 +124,17 @@ class SyncNote extends SyncObject { ...@@ -121,19 +124,17 @@ class SyncNote extends SyncObject {
public function SetCategoryFromColor() { public function SetCategoryFromColor() {
// is a color other than white set // is a color other than white set
if (isset($this->Color) && $this->Color != 3 && $this->Color > -1 && $this->Color < 5) { if (isset($this->Color) && $this->Color != 3 && $this->Color > -1 && $this->Color < 5) {
// check existing categories - do not rewrite category if the category is already a supported or unsupported color // check existing categories - do not rewrite category if the category is already a supported or unsupported color
if (isset($this->categories) && !empty($this->categories) && if (!empty($this->categories) &&
(!empty(array_intersect($this->categories, array_values(self::$unsupportedColors))) || (!empty(array_intersect($this->categories, array_values(self::$unsupportedColors))) ||
!empty(array_intersect($this->categories, array_values(self::$colors))) )) { !empty(array_intersect($this->categories, array_values(self::$colors))) )) {
return false; return false;
} }
if(!isset($this->category)) { if(!isset($this->categories)) {
$this->category = array(); $this->categories = array();
} }
$this->category[] = self::$colors[$this->Color]; $this->categories[] = self::$colors[$this->Color];
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment