diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-10-04 21:13:44 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-10-04 21:16:57 +0200 |
commit | fada3517b0e461e2e6a112d6e4f6eb71d856816b (patch) | |
tree | da5eb39d03aad3abac661761aed3290c1cd7c7b3 /apps | |
parent | 4bcb6f5346271e0a92b4b0450f709474910d571b (diff) | |
download | nextcloud-server-fada3517b0e461e2e6a112d6e4f6eb71d856816b.tar.gz nextcloud-server-fada3517b0e461e2e6a112d6e4f6eb71d856816b.zip |
All the basic field for add contact added
Diffstat (limited to 'apps')
-rw-r--r-- | apps/contacts/ajax/addcard.php | 3 | ||||
-rw-r--r-- | apps/contacts/ajax/addproperty.php | 11 | ||||
-rw-r--r-- | apps/contacts/lib/vcard.php | 20 | ||||
-rw-r--r-- | apps/contacts/templates/part.addcardform.php | 36 |
4 files changed, 59 insertions, 11 deletions
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index ee95513732d..70e0f0a89d0 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -44,9 +44,10 @@ $vcard->add(new Sabre_VObject_Property('UID',OC_Contacts_VCard::createUID())); $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); $details = OC_Contacts_VCard::structureContact($vcard); +$name = $details['FN'][0]['value']; $tmpl = new OC_Template('contacts','part.details'); $tmpl->assign('details',$details); $tmpl->assign('id',$id); $page = $tmpl->fetchPage(); -OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page ))); +OC_JSON::success(array('data' => array( 'id' => $id, 'name' => $name, 'page' => $page ))); diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 0b218c6298f..68c4f65fa5c 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -53,16 +53,7 @@ $name = $_POST['name']; $value = $_POST['value']; $parameters = isset($_POST['parameteres'])?$_POST['parameters']:array(); -if(is_array($value)){ - $value = OC_Contacts_VCard::escapeSemicolons($value); -} -$property = new Sabre_VObject_Property( $name, $value ); -$parameternames = array_keys($parameters); -foreach($parameternames as $i){ - $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]); -} - -$vcard->add($property); +OC_Contacts_VCard::addVCardProperty($vcard, $name, $value, $parameters); $line = count($vcard->children) - 1; $checksum = md5($property->serialize()); diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 1c9a8049f73..78327ab15e1 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -273,6 +273,26 @@ class OC_Contacts_VCard{ } /** + * @brief Add property to vcard object + * @param object $vcard + * @param object $name of property + * @param object $value of property + * @param object $paramerters of property + */ + public static function addVCardProperty($vcard, $name, $value, $parameters=array()){ + if(is_array($value)){ + $value = OC_Contacts_VCard::escapeSemicolons($value); + } + $property = new Sabre_VObject_Property( $name, $value ); + $parameternames = array_keys($parameters); + foreach($parameternames as $i){ + $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]); + } + + $vcard->add($property); + } + + /** * @brief Data structure of vCard * @param object $property * @return associative array diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index e87c64507dc..c7d668fae58 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -11,5 +11,41 @@ <?php endif; ?> <label for="fn"><?php echo $l->t('Name'); ?></label> <input type="text" name="fn" value=""><br> + <label for="ADR"><?php echo $l->t('Address'); ?></label> + <div id="contacts_addresspart"> + <select id="ADR" name="parameters[ADR][TYPE]" size="1"> + <option value="adr_work"><?php echo $l->t('Work'); ?></option> + <option value="adr_home" selected="selected"><?php echo $l->t('Home'); ?></option> + </select> + <p><label><?php echo $l->t('PO Box'); ?></label> <input type="text" name="value[ADR][0]" value=""></p> + <p><label><?php echo $l->t('Extended'); ?></label> <input type="text" name="value[ADR][1]" value=""></p> + <p><label><?php echo $l->t('Street'); ?></label> <input type="text" name="value[ADR][2]" value=""></p> + <p><label><?php echo $l->t('City'); ?></label> <input type="text" name="value[ADR][3]" value=""></p> + <p><label><?php echo $l->t('Region'); ?></label> <input type="text" name="value[ADR][4]" value=""></p> + <p><label><?php echo $l->t('Zipcode'); ?></label> <input type="text" name="value[ADR][5]" value=""></p> + <p><label><?php echo $l->t('Country'); ?></label> <input type="text" name="value[ADR][6]" value=""></p> + </div> + <label for="TEL"><?php echo $l->t('Telephone'); ?></label> + <div id="contacts_phonepart"> + <select id="TEL" name="parameters[TEL][TYPE]" size="1"> + <option value="home"><?php echo $l->t('Home'); ?></option> + <option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option> + <option value="work"><?php echo $l->t('Work'); ?></option> + <option value="text"><?php echo $l->t('Text'); ?></option> + <option value="voice"><?php echo $l->t('Voice'); ?></option> + <option value="fax"><?php echo $l->t('Fax'); ?></option> + <option value="video"><?php echo $l->t('Video'); ?></option> + <option value="pager"><?php echo $l->t('Pager'); ?></option> + </select> + <input type="text" name="value[TEL]" value=""> + </div> + <label for="EMAIL"><?php echo $l->t('Email'); ?></label> + <div id="contacts_email"> + <input id="EMAIL" type="text" name="value[EMAIL]" value=""> + </div> + <label for="ORG"><?php echo $l->t('Organization'); ?></label> + <div id="contacts_organisation"> + <input id="ORG" type="text" name="value[ORG]" value=""> + </div> <input type="submit" name="submit" value="<?php echo $l->t('Create Contact'); ?>"> </form> |