1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Cleanup in Contacts.

This commit is contained in:
Thomas Tanghus 2012-03-13 00:55:15 +01:00
parent 13a1583f8b
commit 2eae578367
18 changed files with 1 additions and 1266 deletions

View File

@ -1,103 +0,0 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/addcard.php: '.$msg, OC_Log::DEBUG);
exit();
}
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$aid = $_POST['id'];
OC_Contacts_App::getAddressbook( $aid ); // is owner access check
$fn = trim($_POST['fn']);
$values = $_POST['value'];
$parameters = $_POST['parameters'];
$vcard = new OC_VObject('VCARD');
$vcard->setUID();
$n = isset($values['N'][0])?trim($values['N'][0]).';':';';
$n .= isset($values['N'][1])?trim($values['N'][1]).';':';';
$n .= isset($values['N'][2])?trim($values['N'][2]).';;':';;';
if(!$fn || ($n == ';;;;')) {
bailOut('You have to enter both the extended name and the display name.');
}
$vcard->setString('N',$n);
$vcard->setString('FN',$fn);
// Data to add ...
$add = array('TEL', 'EMAIL', 'ORG');
$address = false;
for($i = 0; $i < 7; $i++){
if( isset($values['ADR'][$i] ) && $values['ADR'][$i]) $address = true;
}
if( $address ) $add[] = 'ADR';
// Add data
foreach( $add as $propname){
if( !( isset( $values[$propname] ) && $values[$propname] )){
continue;
}
$value = $values[$propname];
if( isset( $parameters[$propname] ) && count( $parameters[$propname] )){
$prop_parameters = $parameters[$propname];
} else {
$prop_parameters = array();
}
if(is_array($value)){
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
$value = OC_VObject::escapeSemicolons($value);
}
$vcard->addProperty($propname, strip_tags($value)); //, $prop_parameters);
$line = count($vcard->children) - 1;
foreach ($prop_parameters as $key=>$element) {
if(is_array($element) && strtoupper($key) == 'TYPE') {
// FIXME: Maybe this doesn't only apply for TYPE?
// And it probably shouldn't be done here anyways :-/
foreach($element as $e){
if($e != '' && !is_null($e)){
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$e);
}
}
} else {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$element);
}
}
}
$id = OC_Contacts_VCard::add($aid,$vcard);
if(!$id) {
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR);
exit();
}
// NOTE: Why is this in OC_Contacts_App?
OC_Contacts_App::renderDetails($id, $vcard);

View File

@ -1,28 +0,0 @@
<?php
/**
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
function bailOut($msg) {
OC_JSON::error(array('data' => array('message' => $msg)));
OC_Log::write('contacts','ajax/categories/edit.php: '.$msg, OC_Log::DEBUG);
exit();
}
function debug($msg) {
OC_Log::write('contacts','ajax/categories/edit.php: '.$msg, OC_Log::DEBUG);
}
$tmpl = new OC_TEMPLATE("contacts", "part.edit_categories_dialog");
$categories = OC_Contacts_App::$categories->categories();
debug(print_r($categories, true));
$tmpl->assign('categories',$categories);
$tmpl->printpage();
?>

View File

@ -1,15 +0,0 @@
<?php
/**
* Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$output = new OC_TEMPLATE("contacts", "part.messagebox");
$output -> printpage();
?>

View File

@ -1,106 +0,0 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$id = $_POST['id'];
$checksum = $_POST['checksum'];
$vcard = OC_Contacts_App::getContactVCard( $id );
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
// Set the value
$value = $_POST['value'];
if(is_array($value)){
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
foreach(array_keys($value) as $key) {
OC_Log::write('contacts','ajax/setproperty.php: setting: '.$key.': '.$value[$key], OC_Log::DEBUG);
}
$value = OC_VObject::escapeSemicolons($value);
}
OC_Log::write('contacts','ajax/setproperty.php: setting: '.$vcard->children[$line]->name.': '.$value, OC_Log::DEBUG);
$vcard->children[$line]->setValue(strip_tags($value));
// Add parameters
$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array();
if ($vcard->children[$line]->name == 'TEL' && !array_key_exists('TYPE', $postparameters)){
$postparameters['TYPE']='';
}
for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
$name = $vcard->children[$line]->parameters[$i]->name;
if(array_key_exists($name,$postparameters)){
if($postparameters[$name] == '' || is_null($postparameters[$name])){
unset($vcard->children[$line]->parameters[$i]);
}
else{
unset($vcard->children[$line][$name]);
$values = $postparameters[$name];
if (!is_array($values)){
$values = array($values);
}
foreach($values as $value){
$vcard->children[$line]->add($name, $value);
}
}
unset($postparameters[$name]);
}
}
$missingparameters = array_keys($postparameters);
foreach($missingparameters as $i){
if(!$postparameters[$i] == '' && !is_null($postparameters[$i])){
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($i,$postparameters[$i]);
}
}
// Do checksum and be happy
// NOTE: This checksum is not used..?
$checksum = md5($vcard->children[$line]->serialize());
if(!OC_Contacts_VCard::edit($id,$vcard)) {
OC_JSON::error(array('data' => array('message' => $l->t('Error updating contact property.'))));
OC_Log::write('contacts','ajax/setproperty.php: Error updating contact property: '.$value, OC_Log::ERROR);
exit();
}
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
if ($vcard->children[$line]->name == 'FN'){
$tmpl = new OC_Template('contacts','part.property.FN');
}
elseif ($vcard->children[$line]->name == 'N'){
$tmpl = new OC_Template('contacts','part.property.N');
}
else{
$tmpl = new OC_Template('contacts','part.property');
}
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line));
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page, 'line' => $line, 'checksum' => $checksum, 'oldchecksum' => $_POST['checksum'] )));

View File

@ -1,40 +0,0 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
$addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser());
$tmpl = new OC_Template('contacts','part.addcardform');
$tmpl->assign('addressbooks',$addressbooks);
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View File

@ -1,37 +0,0 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$id = $_GET['id'];
$card = OC_Contacts_App::getContactObject( $id );
$tmpl = new OC_Template('contacts','part.addpropertyform');
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View File

@ -1,52 +0,0 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$id = $_GET['id'];
$checksum = $_GET['checksum'];
$vcard = OC_Contacts_App::getContactVCard( $id );
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
if(is_null($line)){
OC_JSON::error(array('data' => array( 'message' => OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.'))));
exit();
}
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
$tmpl = new OC_Template('contacts','part.setpropertyform');
$tmpl->assign('id',$id);
$tmpl->assign('checksum',$checksum);
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line]));
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View File

@ -1,37 +0,0 @@
#contacts { padding-left:2px; padding-top: 5px; background: #fff; }
#leftcontent a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; }
#chooseaddressbook {margin-right: 170px; float: right;}
#contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;}
#contacts_details_name_n { font-size:0.8em;margin-left:25%;color:#666;}
#contacts_details_photo { margin:.5em 0em .5em 25%; }
#contacts_deletecard {position:absolute;top:15px;right:25px;}
#contacts_downloadcard {position:absolute;top:15px;right:50px;}
#contacts_details_list { list-style:none; }
#contacts_details_list li { overflow:visible; }
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; clear: right; }
#contacts_setproperty_button { margin-left:25%; }
#contacts_addcardform legend,label { font-weight: bold; width: 10em; overflow: ellipsis; }
#contacts_addcardform legend { padding-left: 3em; font-size:1.1em; }
#contacts_addcardform input[type="text"] { width: 25em; }
#contacts_addcardform input[type="email"] { width: 15em; }
#contacts_addcardform input[type="tel"] { width: 15em; }
dl.form { width: 100%; float: left; clear: right; margin: 1em; padding: 0; }
.form dt { display: table-cell; clear: left; float: left; min-width: 10em; margin: 0; padding-top: 0.5em; padding-right: 1em;font-weight: bold; text-align:right; vertical-align: text-bottom; bottom: 0px; }
.form dd { display: table-cell; clear: right; float: left; min-width: 20em; margin: 0; padding: 0; white-space: nowrap; top: 0px; }
.form input { position: relative; width: 20em; }
.contacts_property_data ul, ol.contacts_property_data { list-style:none; }
.contacts_property_data li { overflow: hidden; }
.contacts_property_data li label { width:20%; float:left; text-align:right;padding-right:0.3em; }
.contacts_property_data input { float:left; }
.contacts_property_data li input { width:70%;overflow:hidden; }
.chzn-container { margin:3px 0 0; }
.chzn-container .chzn-choices { border-radius: 0.5em; }
.chzn-container.chzn-container-active .chzn-choices { border-bottom-left-radius: 0;border-bottom-right-radius: 0; }
.chzn-container .chzn-drop { border-bottom-left-radius: 0.5em;border-bottom-right-radius: 0.5em; }

View File

@ -1,409 +0,0 @@
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
* @copyright 2011-2012 Thomas Tanghus <thomas@tanghus.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
Contacts={
UI:{
showCardDAVUrl:function(username, bookname){
$('#carddav_url').val(totalurl + '/' + username + '/' + bookname);
$('#carddav_url').show();
$('#carddav_url_close').show();
},
messageBox:function(title, msg) {
if($('#messagebox').dialog('isOpen') == true){
// NOTE: Do we ever get here?
$('#messagebox').dialog('moveToTop');
}else{
$('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'messagebox.php'), function(){
$('#messagebox').dialog(
{
autoOpen: true,
title: title,
buttons: [{
text: "Ok",
click: function() { $(this).dialog("close"); }
}],
close: function(event, ui) {
$(this).dialog('destroy').remove();
},
open: function(event, ui) {
$('#messagebox_msg').html(msg);
}
});
});
}
},
Addressbooks:{
overview:function(){
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
$('#chooseaddressbook_dialog').dialog('moveToTop');
}else{
$('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(){
$('#chooseaddressbook_dialog').dialog({
width : 600,
close : function(event, ui) {
$(this).dialog('destroy').remove();
}
});
});
}
},
activation:function(checkbox, bookid)
{
$.post(OC.filePath('contacts', 'ajax', 'activation.php'), { bookid: bookid, active: checkbox.checked?1:0 },
function(data) {
/*
* Arguments:
* data.status
* data.bookid
* data.active
*/
if (data.status == 'success'){
checkbox.checked = data.active == 1;
Contacts.UI.Contacts.update();
}
});
},
newAddressbook:function(object){
var tr = $(document.createElement('tr'))
.load(OC.filePath('contacts', 'ajax', 'addbook.php'));
$(object).closest('tr').after(tr).hide();
/* TODO: Shouldn't there be some kinda error checking here? */
},
editAddressbook:function(object, bookid){
var tr = $(document.createElement('tr'))
.load(OC.filePath('contacts', 'ajax', 'editaddressbook.php') + "?bookid="+bookid);
$(object).closest('tr').after(tr).hide();
},
deleteAddressbook:function(bookid){
var check = confirm("Do you really want to delete this address book?");
if(check == false){
return false;
}else{
$.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid},
function(data) {
if (data.status == 'success'){
$('#chooseaddressbook_dialog').dialog('destroy').remove();
Contacts.UI.Contacts.update();
Contacts.UI.Addressbooks.overview();
} else {
Contacts.UI.messageBox(t('contacts', 'Error'), data.message);
//alert('Error: ' + data.message);
}
});
}
},
submit:function(button, bookid){
var displayname = $("#displayname_"+bookid).val();
var active = $("#edit_active_"+bookid+":checked").length;
var description = $("#description_"+bookid).val();
var url;
if (bookid == 'new'){
url = OC.filePath('contacts', 'ajax', 'createaddressbook.php');
}else{
url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php');
}
$.post(url, { id: bookid, name: displayname, active: active, description: description },
function(jsondata){
if(jsondata.status == 'success'){
$(button).closest('tr').prev().html(data.page).show().next().remove();
Contacts.UI.Contacts.update();
} else {
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
}
});
},
cancel:function(button, bookid){
$(button).closest('tr').prev().show().next().remove();
}
},
Contacts:{
/**
* Reload the contacts list.
*/
update:function(){
$.getJSON('ajax/contacts.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts').html(jsondata.data.page);
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'),jsondata.data.message);
//alert(jsondata.data.message);
}
});
setTimeout(Contacts.UI.Contacts.lazyupdate, 500);
},
/**
* Add thumbnails to the contact list as they become visible in the viewport.
*/
lazyupdate:function(){
$('#contacts li').live('inview', function(){
if (!$(this).find('a').attr('style')) {
$(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
}
});
}
}
}
}
$(document).ready(function(){
/*-------------------------------------------------------------------------
* Event handlers
*-----------------------------------------------------------------------*/
/**
* Load the details view for a contact.
*/
$('#leftcontent li').live('click',function(){
var id = $(this).data('id');
var oldid = $('#rightcontent').data('id');
if(oldid != 0){
$('#leftcontent li[data-id="'+oldid+'"]').removeClass('active');
}
$.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').data('id',jsondata.data.id);
$('#rightcontent').html(jsondata.data.page);
$('#leftcontent li[data-id="'+jsondata.data.id+'"]').addClass('active');
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
});
return false;
});
/**
* Delete currently selected contact (and clear form?)
*/
$('#contacts_deletecard').live('click',function(){
$('#contacts_deletecard').tipsy('hide');
var id = $('#rightcontent').data('id');
$.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#leftcontent [data-id="'+jsondata.data.id+'"]').remove();
$('#rightcontent').data('id','');
$('#rightcontent').empty();
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
});
return false;
});
/**
* Add a property to the contact.
* NOTE: Where does 'contacts_addproperty' exist?
*/
$('#contacts_addproperty').live('click',function(){
var id = $('#rightcontent').data('id');
$.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details_list').append(jsondata.data.page);
$('#contacts_addproperty').hide();
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
alert('From handler: '+jsondata.data.message);
}
});
return false;
});
/**
* Change the inputs based on which type of property is selected for addition.
*/
$('#contacts_addpropertyform [name="name"]').live('change',function(){
$('#contacts_addpropertyform #contacts_addresspart').remove();
$('#contacts_addpropertyform #contacts_phonepart').remove();
$('#contacts_addpropertyform #contacts_fieldpart').remove();
$('#contacts_addpropertyform #contacts_generic').remove();
if($(this).val() == 'ADR'){
$('#contacts_addresspart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
else if($(this).val() == 'TEL'){
$('#contacts_phonepart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
else{
$('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
$('#contacts_addpropertyform .contacts_property_data select').chosen();
});
$('#contacts_addpropertyform input[type="submit"]').live('click',function(){
$.post('ajax/addproperty.php',$('#contacts_addpropertyform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_addpropertyform').before(jsondata.data.page);
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
}
}, 'json');
return false;
});
/**
* Show the Addressbook chooser
*/
$('#chooseaddressbook').click(function(){
Contacts.UI.Addressbooks.overview();
return false;
});
/**
* Open blank form to add new contact.
*/
$('#contacts_newcontact').click(function(){
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').data('id','');
$('#rightcontent').html(jsondata.data.page)
.find('select').chosen();
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
});
return false;
});
/**
* Add and insert a new contact into the list.
*/
$('#contacts_addcardform input[type="submit"]').live('click',function(){
$.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').data('id',jsondata.data.id);
$('#rightcontent').html(jsondata.data.page);
$('#leftcontent .active').removeClass('active');
var item = '<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url(thumbnail.php?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+jsondata.data.name+'</a></li>';
var added = false;
$('#leftcontent ul li').each(function(){
if ($(this).text().toLowerCase() > jsondata.data.name.toLowerCase()) {
$(this).before(item).fadeIn('fast');
added = true;
return false;
}
});
if(!added) {
$('#leftcontent ul').append(item);
}
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
}, 'json');
return false;
});
/**
* Show inputs for editing a property.
*/
$('.contacts_property [data-use="edit"]').live('click',function(){
var id = $('#rightcontent').data('id');
var checksum = $(this).parents('.contacts_property').first().data('checksum');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page)
.find('select').chosen();
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
});
return false;
});
/**
* Save the edited property
*/
$('#contacts_setpropertyform input[type="submit"]').live('click',function(){
$.post('ajax/setproperty.php',$(this).parents('form').first().serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
},'json');
return false;
});
$('.contacts_property [data-use="delete"]').live('click',function(){
var id = $('#rightcontent').data('id');
var checksum = $(this).parents('li').first().data('checksum');
$.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[data-checksum="'+checksum+'"]').remove();
}
else{
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
//alert(jsondata.data.message);
}
});
return false;
});
$('.contacts_property').live('mouseenter',function(){
$(this).find('span[data-use]').show();
});
$('.contacts_property').live('mouseleave',function(){
$(this).find('span[data-use]').hide();
});
$('#contacts_addcardform select').chosen();
$('#contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
if (isInView) { //NOTE: I've kept all conditions for future reference ;-)
// element is now visible in the viewport
if (visiblePartY == 'top') {
// top part of element is visible
} else if (visiblePartY == 'bottom') {
// bottom part of element is visible
} else {
// whole part of element is visible
if (!$(this).find('a').attr('style')) {
//alert($(this).data('id') + ' has background: ' + $(this).attr('style'));
$(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
}/* else {
alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url'));
}*/
}
} else {
// element has gone out of viewport
}
});
$('.button').tipsy();
//Contacts.UI.messageBox('Hello','Sailor');
});

View File

@ -1,20 +1,17 @@
../appinfo/app.php
../ajax/activation.php
../ajax/addbook.php
../ajax/addcard.php
../ajax/addproperty.php
../ajax/createaddressbook.php
../ajax/deletebook.php
../ajax/deleteproperty.php
../ajax/getdetails.php
../ajax/setproperty.php
../ajax/saveproperty.php
../ajax/updateaddressbook.php
../lib/app.php
../templates/index.php
../templates/part.addcardform.php
../templates/part.chooseaddressbook.php
../templates/part.chooseaddressbook.rowfields.php
../templates/part.details.php
../templates/part.editaddressbook.php
../templates/part.property.php
../templates/part.setpropertyform.php

View File

@ -1,138 +0,0 @@
<form id="contacts_addcardform">
<?php if(count($_['addressbooks'])==1): ?>
<input type="hidden" name="id" value="<?php echo $_['addressbooks'][0]['id']; ?>">
<?php else: ?>
<fieldset class="inputs">
<dl class="form">
<dt>
<label for="id"><?php echo $l->t('Addressbook'); ?></label>
</dt>
<dd>
<select name="id" size="1">
<?php echo html_select_options($_['addressbooks'], null, array('value'=>'id', 'label'=>'displayname')); ?>
</select>
</dd>
</dl>
</fieldset>
<?php endif; ?>
<fieldset class="inputs">
<dl class="form">
<dt>
<label for="n1"><?php echo $l->t('Given name'); ?></label>
</dd>
<dd>
<input id="n1" type="text" name="value[N][1]" value="">
</dd>
<dt>
<label for="n0"><?php echo $l->t('Family name'); ?></label>
</dd>
<dd>
<input id="n0" type="text" name="value[N][0]" value="">
</dd>
<dt>
<label for="n2"><?php echo $l->t('Additional names'); ?></label>
</dd>
<dd>
<input id="n2" type="text" name="value[N][2]" value="">
<input type="hidden" name="value[N][4]" value="">
<input type="hidden" name="value[N][5]" value="">
</dd>
</dl>
</fieldset>
<fieldset class="inputs">
<dl class="form">
<dt>
<label for="fn"><?php echo $l->t('Display name'); ?></label>
</dd>
<dd>
<input id="fn" type="text" name="fn" placeholder="<?php echo $l->t('How you want the name displayed in the list'); ?>" value="">
</dd>
<dt>
<label for="org"><?php echo $l->t('Organization'); ?></label>
</dt>
<dd>
<input id="org" type="text" name="value[ORG]" value="">
</dd>
</dl>
</fieldset>
<fieldset class="inputs">
<dl class="form">
<dt>
<label for="email"><?php echo $l->t('Email'); ?></label>
</dt>
<dd>
<input id="email" type="email" name="value[EMAIL]" value="">
</dd>
<dt>
<label for="tel"><?php echo $l->t('Telephone'); ?></label>
</dt>
<dd>
<input type="tel" id="tel" name="value[TEL]" value="">
<select id="TEL" name="parameters[TEL][TYPE][]" multiple="multiple">
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</dd>
</dl>
</fieldset>
<fieldset class="inputs">
<legend><?php echo $l->t('Address'); ?></legend>
<dl class="form">
<dt>
<label for="adr_type"><?php echo $l->t('Type'); ?></label>
</dt>
<dd>
<select id="adr_type" name="parameters[ADR][TYPE]" size="1">
<?php echo html_select_options($_['adr_types'], 'HOME') ?>
</select>
</dd>
<dt>
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
</dt>
<dd>
<input type="text" id="adr_pobox" name="value[ADR][0]" placeholder="<?php echo $l->t('Post Office box'); ?>" value="">
</dd>
<dd>
<!-- dt>
<label class="label" for="adr_extended"><?php echo $l->t('Extended'); ?></label>
</dt>
<dd>
<input type="text" id="adr_extended" name="value[ADR][1]" value="">
</dd -->
<dt>
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
</dt>
<dd>
<input style="width: 12em;" type="text" id="adr_street" name="value[ADR][2]" placeholder="<?php echo $l->t('Street name and no.'); ?>" value="">
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
<input style="width: 7em;" type="text" id="adr_extended" name="value[ADR][1]" placeholder="<?php echo $l->t('Apart. no., floor'); ?>" value="">
</dd>
<dt>
<label for="adr_city"><?php echo $l->t('City'); ?></label>
</dt>
<dd>
<input style="width: 12em;" type="text" id="adr_city" name="value[ADR][3]" value="">
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
<input style="width: 5em;" type="text" id="adr_zipcode" name="value[ADR][5]" value="">
</dd>
<dt>
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
</dt>
<dd>
<input type="text" id="adr_region" name="value[ADR][4]" placeholder="<?php echo $l->t('E.g. state or province'); ?>" value="">
</dd>
<!-- dt>
<label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
</dt>
<dd>
<input type="text" id="adr_zipcode" name="value[ADR][5]" value="">
</dd -->
<dt>
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
</dt>
<dd>
<input type="text" id="adr_country" name="value[ADR][6]" value="">
</dd>
</dl>
</fieldset>
<input class="create" type="submit" name="submit" value="<?php echo $l->t('Create Contact'); ?>">
</form>

View File

@ -1,96 +0,0 @@
<?php if(array_key_exists('FN',$_['details'])): ?>
<?php echo $this->inc('part.property.FN', array('property' => $_['details']['FN'][0])); ?>
<?php echo $this->inc('part.property.N', array('property' => $_['details']['N'][0])); ?>
<a href="export.php?contactid=<?php echo $_['id']; ?>"><img class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" /></a>
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
<?php if(isset($_['details']['PHOTO'])): // Emails first ?>
<img id="contacts_details_photo" src="photo.php?id=<?php echo $_['id']; ?>">
<?php endif; ?>
<ul id="contacts_details_list">
<?php if(isset($_['details']['BDAY'])): // Emails first ?>
<?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?>
<?php endif; ?>
<?php if(isset($_['details']['ORG'])): // Emails first ?>
<?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?>
<?php endif; ?>
<?php foreach(array('EMAIL','TEL','ADR') as $type): ?>
<?php if(isset($_['details'][$type])): // Emails first ?>
<?php foreach($_['details'][$type] as $property): ?>
<?php echo $this->inc('part.property',array('property' => $property )); ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
<li class="contacts_property_add">
<form id="contacts_addpropertyform">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<p class="contacts_property_name">
<select name="name" size="1">
<?php echo html_select_options($_['property_types'], 'EMAIL') ?>
</select>
<br>
<input id="contacts_addproperty_button" type="submit" value="<?php echo $l->t('Add'); ?>">
</p>
<p class="contacts_property_data" id="contacts_generic">
<input type="text" name="value" value="">
</p>
</form>
<div id="contacts_addcontactsparts" style="display:none;">
<ul class="contacts_property_data" id="contacts_addresspart">
<li>
<label for="adr_type"><?php echo $l->t('Type'); ?></label>
<select id="adr_type" name="parameters[TYPE]" size="1">
<?php echo html_select_options($_['adr_types'], 'HOME') ?>
</select>
</li>
<li>
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
<input id="adr_pobox" type="text" name="value[0]" value="">
</li>
<li>
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
<input id="adr_extended" type="text" name="value[1]" value="">
</li>
<li>
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
<input id="adr_street" type="text" name="value[2]" value="">
</li>
<li>
<label for="adr_city"><?php echo $l->t('City'); ?></label>
<input id="adr_city" type="text" name="value[3]" value="">
</li>
<li>
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
<input id="adr_region" type="text" name="value[4]" value="">
</li>
<li>
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
<input id="adr_zipcode" type="text" name="value[5]" value="">
</li>
<li>
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
<input id="adr_country" type="text" name="value[6]" value="">
</li>
</ul>
<p class="contacts_property_data" id="contacts_phonepart">
<input type="text" name="value" value="">
<select name="parameters[TYPE][]" multiple="multiple" data-placeholder="<?php echo $l->t('Type') ?>">
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</p>
<p class="contacts_property_data" id="contacts_generic">
<input type="text" name="value" value="">
</p>
</div>
</li>
</ul>
<?php endif; ?>
<script language="Javascript">
/* Re-tipsify ;-)*/
$('#contacts_deletecard').tipsy({gravity: 'ne'});
$('#contacts_downloadcard').tipsy({gravity: 'ne'});
$('.button').tipsy();
</script>

View File

@ -1,3 +0,0 @@
<div id="messagebox">
<div id="messagebox_msg"></div>
</di>

View File

@ -1,8 +0,0 @@
<div id="firstrun">
You have no contacts in your list.
<div id="selections">
<input type="button" value="Import contacts" onclick="Contacts.UI.Addressbooks.import()" />
<input type="button" value="Add contact" onclick="Contacts.UI.Card.editNew()" />
<input type="button" value="Edit addressbooks" onclick="Contacts.UI.Addressbooks.overview()" />
</div>
</div>

View File

@ -1,9 +0,0 @@
<p id="contacts_details_name" class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
<?php echo htmlspecialchars($_['property']['value']); ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
</p>
<?php if (!isset($_['details'])): ?>
<script>
$('#leftcontent li.active a').text('<?php echo htmlspecialchars($_['property']['value']); ?>');
</script>
<?php endif ?>

View File

@ -1,4 +0,0 @@
<p id="contacts_details_name_n" class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
(<?php echo $_['property']['value'][0].', '.$_['property']['value'][1].' '.$_['property']['value'][2]; ?>)
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
</p>

View File

@ -1,86 +0,0 @@
<li class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
<?php if($_['property']['name'] == 'BDAY'): ?>
<p class="contacts_property_name"><?php echo $l->t('Birthday'); ?></p>
<p class="contacts_property_data">
<?php echo $l->l('date',new DateTime($_['property']['value'])); ?>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
</p>
<?php elseif($_['property']['name'] == 'ORG'): ?>
<p class="contacts_property_name"><?php echo $l->t('Organization'); ?></p>
<p class="contacts_property_data">
<?php echo htmlspecialchars($_['property']['value']); ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
</p>
<?php elseif($_['property']['name'] == 'EMAIL'): ?>
<p class="contacts_property_name"><?php echo $l->t('Email'); ?></p>
<p class="contacts_property_data">
<?php echo htmlspecialchars($_['property']['value']); ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
</p>
<?php elseif($_['property']['name'] == 'TEL'): ?>
<p class="contacts_property_name"><?php echo (isset($_['property']['parameters']['PREF']) && $_['property']['parameters']['PREF']) ? $l->t('Preferred').' ' : '' ?><?php echo $l->t('Phone'); ?></p>
<p class="contacts_property_data">
<?php echo htmlspecialchars($_['property']['value']); ?>
<?php if(isset($_['property']['parameters']['TYPE']) && !empty($_['property']['parameters']['TYPE'])): ?>
<?php
foreach($_['property']['parameters']['TYPE'] as $type) {
if (isset($_['phone_types'][strtoupper($type)])){
$types[]=$_['phone_types'][strtoupper($type)];
}
else{
$types[]=$l->t(ucwords(strtolower($type)));
}
}
$label = join(' ', $types);
?>
(<?php echo $label; ?>)
<?php endif; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
</p>
<?php elseif($_['property']['name'] == 'ADR'): ?>
<p class="contacts_property_name">
<?php echo $l->t('Address'); ?>
<?php if(isset($_['property']['parameters']['TYPE'])): ?>
<br>
<?php
$type = $_['property']['parameters']['TYPE'];
if (isset($_['adr_types'][strtoupper($type)])){
$label=$_['adr_types'][strtoupper($type)];
}
else{
$label=$l->t(ucwords(strtolower($type)));
}
?>
(<?php echo $label; ?>)
<?php endif; ?>
</p>
<p class="contacts_property_data">
<?php if(!empty($_['property']['value'][0])): ?>
<?php echo htmlspecialchars($_['property']['value'][0]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][1])): ?>
<?php echo htmlspecialchars($_['property']['value'][1]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][2])): ?>
<?php echo htmlspecialchars($_['property']['value'][2]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][3])): ?>
<?php echo htmlspecialchars($_['property']['value'][3]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][4])): ?>
<?php echo htmlspecialchars($_['property']['value'][4]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][5])): ?>
<?php echo htmlspecialchars($_['property']['value'][5]); ?><br>
<?php endif; ?>
<?php if(!empty($_['property']['value'][6])): ?>
<?php echo htmlspecialchars($_['property']['value'][6]); ?>
<?php endif; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
</p>
<?php endif; ?>
</li>

View File

@ -1,91 +0,0 @@
<form id="contacts_setpropertyform">
<input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<?php if($_['property']['name']=='N'): ?>
<p class="contacts_property_name">
<dl class="contacts_property_data form">
<dt><label for="n1"><?php echo $l->t('Given name'); ?></label></dt>
<dd><input id="n1" type="text" name="value[1]" value="<?php echo htmlspecialchars($_['property']['value'][1]); ?>"></dd>
<dt><label for="n0"><?php echo $l->t('Family name'); ?></dt>
<dd><input id="n0" type="text" name="value[0]" value="<?php echo htmlspecialchars($_['property']['value'][0]); ?>"></dd>
<dt><label for="n2"><?php echo $l->t('Additional names'); ?></dt>
<dd><input id="n2" type="text" name="value[2]" value="<?php echo htmlspecialchars($_['property']['value'][2]); ?>">
<input id="n3" type="hidden" name="value[3]" value="<?php echo htmlspecialchars($_['property']['value'][3]); ?>">
<input id="n4" type="hidden" name="value[4]" value="<?php echo htmlspecialchars($_['property']['value'][4]); ?>">
</dd>
</dl>
</p>
<?php elseif($_['property']['name']=='FN'): ?>
<p class="contacts_property_data"><input id="fn" type="text" name="value" value="<?php echo htmlspecialchars($_['property']['value']); ?>"></p>
<?php elseif($_['property']['name']=='ADR'): ?>
<p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
<dl class="contacts_property_data form" id="contacts_addresspart">
<dt>
<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
</dt>
<dd>
<select id="adr_type" name="parameters[TYPE]" size="1">
<?php echo html_select_options($_['adr_types'], strtoupper($_['property']['parameters']['TYPE'])) ?>
</select>
</dd>
<dt>
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
</dt>
<dd>
<input id="adr_pobox" type="text" name="value[0]" value="<?php echo htmlspecialchars($_['property']['value'][0]) ?>">
</dd>
<!-- dt>
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
</dt>
<dd>
<input style="width: 7em;" id="adr_extended" type="text" name="value[1]" value="<?php echo htmlspecialchars($_['property']['value'][1]) ?>">
</dd -->
<dt>
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
</dt>
<dd>
<input style="width: 12em;" id="adr_street" type="text" name="value[2]" value="<?php echo htmlspecialchars($_['property']['value'][2]) ?>">
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label><input style="width: 7em;" id="adr_extended" type="text" name="value[1]" value="<?php echo htmlspecialchars($_['property']['value'][1]) ?>">
</dd>
<dt>
<label for="adr_city"><?php echo $l->t('City'); ?></label>
</dt>
<dd>
<input style="width: 12em;" id="adr_city" type="text" name="value[3]" value="<?php echo htmlspecialchars($_['property']['value'][3]) ?>">
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
<input style="width: 5em;" id="adr_zipcode" type="text" name="value[5]" value="<?php echo htmlspecialchars($_['property']['value'][5]) ?>">
</dd>
<dt>
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
</dt>
<dd>
<input id="adr_region" type="text" name="value[4]" value="<?php echo htmlspecialchars($_['property']['value'][4]) ?>">
</dd>
<!-- dt>
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
</dt>
<dd>
<input style="width: 7em;" id="adr_zipcode" type="text" name="value[5]" value="<?php echo htmlspecialchars($_['property']['value'][5]) ?>">
</dd -->
<dt>
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
</dt>
<dd>
<input style="width: 25em;" id="adr_country" type="text" name="value[6]" value="<?php echo htmlspecialchars($_['property']['value'][6]) ?>">
</dd>
</dl>
<?php elseif($_['property']['name']=='TEL'): ?>
<p class="contacts_property_name"><label for="tel"><?php echo $l->t('Phone'); ?></label></p>
<p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo htmlspecialchars($_['property']['value']) ?>">
<select id="tel_type<?php echo $_['property']['checksum'] ?>" name="parameters[TYPE][]" multiple="multiple" data-placeholder="<?php echo $l->t('Type') ?>">
<?php echo html_select_options($_['phone_types'], isset($_['property']['parameters']['TYPE'])?$_['property']['parameters']['TYPE']:array()) ?>
</select></p>
<?php elseif($_['property']['name']=='EMAIL'): ?>
<p class="contacts_property_name"><label for="email"><?php echo $l->t('Email'); ?></label></p>
<p class="contacts_property_data"><input id="email" type="text" name="value" value="<?php echo htmlspecialchars($_['property']['value']); ?>"></p>
<?php elseif($_['property']['name']=='ORG'): ?>
<p class="contacts_property_name"><label for="org"><?php echo $l->t('Organization'); ?></label></p>
<p class="contacts_property_data"><input id="org" type="text" name="value" value="<?php echo htmlspecialchars($_['property']['value']); ?>"></p>
<?php endif; ?>
<input id="contacts_setproperty_button" type="submit" value="<?php echo $l->t('Update'); ?>">
</form>