Added public static OC_VCategories object to OC_Contacts_App.

Parse cards for new categories in add and edit methods.
This commit is contained in:
Thomas Tanghus 2012-02-19 23:32:09 +01:00
parent 8a1b671fdd
commit c62673d360
2 changed files with 7 additions and 0 deletions

View File

@ -10,8 +10,10 @@
* This class manages our app actions
*/
OC_Contacts_App::$l10n = new OC_L10N('contacts');
OC_Contacts_App::$categories = new OC_VCategories('contacts');
class OC_Contacts_App {
public static $l10n;
public static $categories;
/**
* Render templates/part.details to json output

View File

@ -114,6 +114,8 @@ class OC_Contacts_VCard{
$card = OC_VObject::parse($data);
if(!is_null($card)){
OC_Contacts_App::$categories->loadFromVObject($card);
$fn = $card->getAsString('FN');
if(!$fn){ // Fix missing 'FN' field.
$n = $card->getAsString('N');
@ -187,6 +189,7 @@ class OC_Contacts_VCard{
$email = null;
$card = OC_VObject::parse($data);
if(!is_null($card)){
OC_Contacts_App::$categories->loadFromVObject($card);
foreach($card->children as $property){
if($property->name == 'FN'){
$fn = $property->value;
@ -245,6 +248,7 @@ class OC_Contacts_VCard{
$card = OC_VObject::parse($data);
if(!is_null($card)){
OC_Contacts_App::$categories->loadFromVObject($card);
foreach($card->children as $property){
if($property->name == 'FN'){
$fn = $property->value;
@ -279,6 +283,7 @@ class OC_Contacts_VCard{
$fn = null;
$card = OC_VObject::parse($data);
if(!is_null($card)){
OC_Contacts_App::$categories->loadFromVObject($card);
foreach($card->children as $property){
if($property->name == 'FN'){
$fn = $property->value;