diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-26 21:46:18 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-03-26 21:47:37 +0200 |
commit | ee31bc7995eaef0741dc1579d8b6b7e58f359ce4 (patch) | |
tree | ebcaa0f2bfc0fae99c7ad7ebc0f0015b5112c01e /apps/contacts | |
parent | 31e20d22834fd492f97ae38e6919f798ab6be932 (diff) | |
download | nextcloud-server-ee31bc7995eaef0741dc1579d8b6b7e58f359ce4.tar.gz nextcloud-server-ee31bc7995eaef0741dc1579d8b6b7e58f359ce4.zip |
Contacts: Fix saveproperty for categories
Diffstat (limited to 'apps/contacts')
-rw-r--r-- | apps/contacts/ajax/saveproperty.php | 19 | ||||
-rw-r--r-- | apps/contacts/templates/part.contact.php | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 95a7ac20193..272a3f9b325 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -83,16 +83,34 @@ if($element != $name) { bailOut(OC_Contacts_App::$l10n->t('Something went FUBAR. ').$name.' != '.$element); } +/* preprocessing value */ switch($element) { case 'BDAY': $date = New DateTime($value); //$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE); $value = $date->format(DateTime::ATOM); + break; case 'FN': if(!$value) { // create a method thats returns an alternative for FN. //$value = getOtherValue(); } + break; + case 'CATEGORIES': + /* multi autocomplete triggers an save with empty value */ + if (!$value) { + $value = $vcard->getAsString('CATEGORIES'); + } + break; + case 'EMAIL': + $value = strtolower($value); + break; +} + +/* setting value */ +switch($element) { + case 'BDAY': + case 'FN': case 'N': case 'ORG': case 'NOTE': @@ -102,7 +120,6 @@ switch($element) { $vcard->setString($name, $value); break; case 'EMAIL': - $value = strtolower($value); case 'TEL': case 'ADR': // should I delete the property if empty or throw an error? debug('Setting element: (EMAIL/TEL/ADR)'.$element); diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php index cb1e080a40a..a1acb20b9cb 100644 --- a/apps/contacts/templates/part.contact.php +++ b/apps/contacts/templates/part.contact.php @@ -64,7 +64,7 @@ $id = isset($_['id']) ? $_['id'] : ''; <a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a> </dd --> <dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></label></dt> - <dd style="display:none;" class="propertycontainer" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a></dd> + <dd style="display:none;" class="propertycontainer" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a></dd> </dl> </fieldset> <fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE"> |