Contacts: First work on cleaner design.

This commit is contained in:
Thomas Tanghus 2012-04-03 03:28:12 +02:00
parent 896bff5748
commit b3f107ddda
7 changed files with 113 additions and 98 deletions

View File

@ -39,7 +39,10 @@ foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.$element); debug('_POST: '.$key.'=>'.$element);
} }
$aid = $_POST['aid']; $aid = isset($_POST['aid'])?$_POST['aid']:null;
if(!$aid) {
$aid = min(OC_Contacts_Addressbook::activeIds()); // first active addressbook.
}
OC_Contacts_App::getAddressbook( $aid ); // is owner access check OC_Contacts_App::getAddressbook( $aid ); // is owner access check
$fn = trim($_POST['fn']); $fn = trim($_POST['fn']);

View File

@ -14,21 +14,21 @@
#contacts_propertymenu li:hover { background-color: #1d2d44; } #contacts_propertymenu li:hover { background-color: #1d2d44; }
#contacts_propertymenu li a:hover { color: #fff } #contacts_propertymenu li a:hover { color: #fff }
#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;} #actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;}
#card { /*max-width: 70em; border: thin solid lightgray; display: block;*/ } #card { width: auto;/*max-width: 70em; border: thin solid lightgray; display: block;*/ }
#firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; } #firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; }
#firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; } #firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 14em; } #card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 14em; float: left; }
.categories { float: left; width: 16em; } .categories { float: left; width: 16em; }
#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #f8f8f8; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; } #card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #fefefe; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
#card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; } #card input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,input[type="email"]:hover,input[type="tel"]:hover,input[type="date"]:hover,input[type="date"],input[type="date"]:hover,input[type="date"]:active,input[type="date"]:active,input[type="date"]:active,input[type="email"]:active,input[type="tel"]:active, select:hover, select:focus, select:active { border: 0 !important; -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; float: left; }
input[type="text"]:invalid,input[type="email"]:invalid,input[type="tel"]:invalid,input[type="date"]:invalid { background-color: #ffc0c0 !important; } input[type="text"]:invalid,input[type="email"]:invalid,input[type="tel"]:invalid,input[type="date"]:invalid { color: #bbb !important; }
dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; } dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
.form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; font-weight: bold; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ } .form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ }
.form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; } .form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; }
.loading { background: url('../../../core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; } .loading { background: url('../../../core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
.float { float: left; }
.listactions { height: 1em; width:60px; float: left; clear: right; } .listactions { height: 1em; width:60px; float: left; clear: right; }
.add,.edit,.delete,.mail, .globe { cursor: pointer; width: 20px; height: 20px; margin: 0; float: left; position:relative; display: none; } .add,.edit,.delete,.mail, .globe { cursor: pointer; width: 20px; height: 20px; margin: 0; float: left; position:relative; display: none; }
.add { background:url('../../../core/img/actions/add.svg') no-repeat center; clear: both; } .add { background:url('../../../core/img/actions/add.svg') no-repeat center; clear: both; }
@ -43,18 +43,18 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
#edit_address_dialog { /*width: 30em;*/ } #edit_address_dialog { /*width: 30em;*/ }
#edit_address_dialog > input { width: 15em; } #edit_address_dialog > input { width: 15em; }
#edit_photo_dialog_img { display: block; width: 150; height: 200; border: thin solid black; } #edit_photo_dialog_img { display: block; width: 150; height: 200; border: thin solid black; }
#fn { float: left; } #fn { float: left !important; width: 18em !important; }
/** #name { /*position: absolute; top: 0px; left: 0px;*/ min-width: 25em; height: 2em; clear: right; display: block; }
* Create classes form, floateven and floatodd which flows left and right respectively. #identityprops { /*position: absolute; top: 2.5em; left: 0px;*/ }
*/ /*#contact_photo { max-width: 250px; }*/
.contactsection { float: left; min-width: 30em; max-width: 40em; margin: 0.5em; border: thin solid lightgray; -webkit-border-radius: 0.5em; -moz-border-radius: 0.5em; border-radius: 0.5em; background-color: #f8f8f8; } #contact_identity { min-width: 30em; }
.contactsection { position: relative; float: left; /*max-width: 40em;*/ padding: 0.5em; height: auto: border: thin solid lightgray;/* -webkit-border-radius: 0.5em; -moz-border-radius: 0.5em; border-radius: 0.5em; background-color: #f8f8f8;*/ }
.contactpart legend { width:auto; padding:.3em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } .contactpart legend { width:auto; padding:.3em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
#cropbox { margin: auto; } #cropbox { margin: auto; }
#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; padding: 0.5em; margin: 0.3em; cursor: pointer; background: url(../../../core/img/loading.gif) no-repeat center center; display: block; /* clear: right;*/ }
#contacts_details_photo { border-radius: 0.5em; border: thin solid #bbb; padding: 0.5em; margin: 1em 1em 1em 7em; cursor: pointer; background: url(../../../core/img/loading.gif) no-repeat center center; clear: right; }
#contacts_details_photo:hover { background: #fff; } #contacts_details_photo:hover { background: #fff; }
#contacts_details_photo_progress { margin: 0.3em 0.3em 0.3em 7em; clear: left; } /*#contacts_details_photo_progress { margin: 0.3em 0.3em 0.3em 7em; clear: left; }*/
/* Address editor */ /* Address editor */
#addressdisplay { padding: 0.5em; } #addressdisplay { padding: 0.5em; }
dl.addresscard { background-color: #fff; float: left; width: 45%; margin: 0 0.3em 0.3em 0.3em; padding: 0; border: thin solid lightgray; } dl.addresscard { background-color: #fff; float: left; width: 45%; margin: 0 0.3em 0.3em 0.3em; padding: 0; border: thin solid lightgray; }
@ -72,8 +72,10 @@ dl.addresscard dd > ul { margin: 0.3em; padding: 0.3em; }
#file_upload_target, #crop_target { display:none; } #file_upload_target, #crop_target { display:none; }
#file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; cursor:pointer; width:0; height:0;} #file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; /*position:absolute; left:0; top:0;*/ cursor:pointer; width:0; height:0;}
input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; } input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
.big { font-weight:bold; font-size:1.2em; }
.huge { font-weight:bold; font-size:1.5em; }
.propertycontainer dd { float: left; width: 25em; } .propertycontainer dd { float: left; width: 25em; }
.propertylist { clear: none; max-width: 28em; } .propertylist { clear: none; max-width: 28em; }
.propertylist li { /*background-color: cyan; */ min-width: 25em; /*max-width: 30em;*/ display: block; clear: right; } .propertylist li { /*background-color: cyan; */ min-width: 25em; /*max-width: 30em;*/ display: block; clear: right; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -65,7 +65,7 @@ Contacts={
propertyTypeFor:function(obj) { propertyTypeFor:function(obj) {
return $(obj).parents('.propertycontainer').first().data('element'); return $(obj).parents('.propertycontainer').first().data('element');
}, },
showHideContactInfo:function() { /*showHideContactInfo:function() {
var show = ($('#emaillist li.propertycontainer').length > 0 || $('#phonelist li.propertycontainer').length > 0 || $('#addressdisplay dl.propertycontainer').length > 0); var show = ($('#emaillist li.propertycontainer').length > 0 || $('#phonelist li.propertycontainer').length > 0 || $('#addressdisplay dl.propertycontainer').length > 0);
console.log('showHideContactInfo: ' + show); console.log('showHideContactInfo: ' + show);
if(show) { if(show) {
@ -73,8 +73,8 @@ Contacts={
} else { } else {
$('#contact_communication').hide(); $('#contact_communication').hide();
} }
}, },*/
checkListFor:function(obj) { /*checkListFor:function(obj) {
var type = $(obj).parents('.propertycontainer').first().data('element'); var type = $(obj).parents('.propertycontainer').first().data('element');
console.log('checkListFor: ' + type); console.log('checkListFor: ' + type);
switch (type) { switch (type) {
@ -101,7 +101,7 @@ Contacts={
case 'BDAY': case 'BDAY':
break; break;
} }
}, },*/
loading:function(obj, state) { loading:function(obj, state) {
if(state) { if(state) {
$(obj).addClass('loading'); $(obj).addClass('loading');
@ -137,18 +137,14 @@ Contacts={
$(this).find('.add').fadeOut(500); $(this).find('.add').fadeOut(500);
} }
);*/ );*/
$('.button,.action').tipsy();
$('#contacts_deletecard').tipsy({gravity: 'ne'});
$('#contacts_downloadcard').tipsy({gravity: 'ne'});
//$('#fn').jec(); //$('#fn').jec();
$('#fn_select').combobox({ $('#fn_select').combobox({
'id': 'fn', 'id': 'fn',
'name': 'value', 'name': 'value',
'classes': ['contacts_property'], 'classes': ['contacts_property', 'huge', 'tip', 'float'],
'attributes': {'placeholder': t('contacts', 'Enter name')},
'title': t('contacts', 'Format custom, Short name, Full name, Reverse or Reverse with comma')}); 'title': t('contacts', 'Format custom, Short name, Full name, Reverse or Reverse with comma')});
//$('.jecEditableOption').attr('title', t('contacts','Custom')); //$('.jecEditableOption').attr('title', t('contacts','Custom'));
$('#fn').tipsy();
$('#contacts_details_photo_wrapper').tipsy();
$('#bday').datepicker({ $('#bday').datepicker({
dateFormat : 'dd-mm-yy' dateFormat : 'dd-mm-yy'
}); });
@ -200,6 +196,9 @@ Contacts={
} }
] ); ] );
$('#categories').multiple_autocomplete({source: categories}); $('#categories').multiple_autocomplete({source: categories});
$('.button,.action,.tip').tipsy();
$('#contacts_deletecard').tipsy({gravity: 'ne'});
$('#contacts_downloadcard').tipsy({gravity: 'ne'});
Contacts.UI.loadListHandlers(); Contacts.UI.loadListHandlers();
}, },
Card:{ Card:{
@ -267,7 +266,7 @@ Contacts={
import:function(){ import:function(){
Contacts.UI.notImplemented(); Contacts.UI.notImplemented();
}, },
add:function(n, fn, aid){ // add a new contact add:function(n, fn, aid, isnew){ // add a new contact
console.log('Add contact: ' + n + ', ' + fn + ' ' + aid); console.log('Add contact: ' + n + ', ' + fn + ' ' + aid);
$.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid }, $.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid },
function(jsondata) { function(jsondata) {
@ -291,7 +290,15 @@ Contacts={
if(!added) { if(!added) {
$('#leftcontent ul').append(item); $('#leftcontent ul').append(item);
} }
if(isnew) {
Contacts.UI.Card.addProperty('EMAIL');
Contacts.UI.Card.addProperty('TEL');
Contacts.UI.Card.addProperty('BDAY');
Contacts.UI.Card.addProperty('NICKNAME');
Contacts.UI.Card.addProperty('ORG');
Contacts.UI.Card.addProperty('CATEGORIES');
$('#fn').focus();
}
} }
else{ else{
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@ -356,7 +363,7 @@ Contacts={
return false; return false;
}, },
loadContact:function(jsondata){ loadContact:function(jsondata){
$('#contact_communication').hide(); //$('#contact_communication').hide();
this.data = jsondata; this.data = jsondata;
this.id = this.data.id; this.id = this.data.id;
$('#rightcontent').data('id',this.id); $('#rightcontent').data('id',this.id);
@ -368,7 +375,6 @@ Contacts={
this.loadPhones(); this.loadPhones();
this.loadAddresses(); this.loadAddresses();
this.loadSingleProperties(); this.loadSingleProperties();
// TODO: load NOTE ;-)
if(this.data.NOTE) { if(this.data.NOTE) {
$('#note').data('checksum', this.data.NOTE[0]['checksum']); $('#note').data('checksum', this.data.NOTE[0]['checksum']);
$('#note').find('textarea').val(this.data.NOTE[0]['value']); $('#note').find('textarea').val(this.data.NOTE[0]['value']);
@ -376,7 +382,7 @@ Contacts={
} else { } else {
$('#note').data('checksum', ''); $('#note').data('checksum', '');
$('#note').find('textarea').val(''); $('#note').find('textarea').val('');
$('#note').hide(); //$('#note').hide();
} }
}, },
loadSingleProperties:function() { loadSingleProperties:function() {
@ -521,17 +527,18 @@ Contacts={
},*/ },*/
editNew:function(){ // add a new contact editNew:function(){ // add a new contact
this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = ''; this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = '';
$.getJSON(OC.filePath('contacts', 'ajax', 'newcontact.php'),{},function(jsondata){ Contacts.UI.Card.add(';;;;', '', '', true);
/*$.getJSON(OC.filePath('contacts', 'ajax', 'newcontact.php'),{},function(jsondata){
if(jsondata.status == 'success'){ if(jsondata.status == 'success'){
id = ''; id = '';
$('#rightcontent').data('id',''); $('#rightcontent').data('id','');
$('#rightcontent').html(jsondata.data.page); $('#rightcontent').html(jsondata.data.page);
Contacts.UI.Card.editName(); //Contacts.UI.Card.editName();
} else { } else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message); //alert(jsondata.data.message);
} }
}); });*/
}, },
savePropertyInternal:function(name, fields, oldchecksum, checksum){ savePropertyInternal:function(name, fields, oldchecksum, checksum){
// TODO: Add functionality for new fields. // TODO: Add functionality for new fields.
@ -627,8 +634,8 @@ Contacts={
},'json'); },'json');
} }
}, },
addProperty:function(obj){ addProperty:function(type){
var type = $(obj).data('type'); //var type = $(obj).data('type');
console.log('addProperty:' + type); console.log('addProperty:' + type);
switch (type) { switch (type) {
case 'PHOTO': case 'PHOTO':
@ -647,21 +654,21 @@ Contacts={
$('#emails').show(); $('#emails').show();
} }
Contacts.UI.Card.addMail(); Contacts.UI.Card.addMail();
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
break; break;
case 'TEL': case 'TEL':
if($('#phonelist>li').length == 1) { if($('#phonelist>li').length == 1) {
$('#phones').show(); $('#phones').show();
} }
Contacts.UI.Card.addPhone(); Contacts.UI.Card.addPhone();
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
break; break;
case 'ADR': case 'ADR':
if($('#addressdisplay>dl').length == 1) { if($('#addressdisplay>dl').length == 1) {
$('#addresses').show(); $('#addresses').show();
} }
Contacts.UI.Card.editAddress('new', true); Contacts.UI.Card.editAddress('new', true);
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
break; break;
case 'NICKNAME': case 'NICKNAME':
case 'ORG': case 'ORG':
@ -682,8 +689,8 @@ Contacts={
if(jsondata.status == 'success'){ if(jsondata.status == 'success'){
if(type == 'list') { if(type == 'list') {
Contacts.UI.propertyContainerFor(obj).remove(); Contacts.UI.propertyContainerFor(obj).remove();
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
Contacts.UI.checkListFor(obj); //Contacts.UI.checkListFor(obj);
} else if(type == 'single') { } else if(type == 'single') {
var proptype = Contacts.UI.propertyTypeFor(obj); var proptype = Contacts.UI.propertyTypeFor(obj);
console.log('deleteProperty, hiding: ' + proptype); console.log('deleteProperty, hiding: ' + proptype);
@ -718,8 +725,8 @@ Contacts={
} else { // Property hasn't been saved so there's nothing to delete. } else { // Property hasn't been saved so there's nothing to delete.
if(type == 'list') { if(type == 'list') {
Contacts.UI.propertyContainerFor(obj).remove(); Contacts.UI.propertyContainerFor(obj).remove();
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
Contacts.UI.checkListFor(obj); //Contacts.UI.checkListFor(obj);
} else if(type == 'single') { } else if(type == 'single') {
var proptype = Contacts.UI.propertyTypeFor(obj); var proptype = Contacts.UI.propertyTypeFor(obj);
console.log('deleteProperty, hiding: ' + proptype); console.log('deleteProperty, hiding: ' + proptype);
@ -891,7 +898,7 @@ Contacts={
if(isnew) { if(isnew) {
container.remove(); container.remove();
} }
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
} }
}, },
close : function(event, ui) { close : function(event, ui) {
@ -900,7 +907,7 @@ Contacts={
if(isnew) { if(isnew) {
container.remove(); container.remove();
} }
Contacts.UI.showHideContactInfo(); //Contacts.UI.showHideContactInfo();
}/*, }/*,
open : function(event, ui) { open : function(event, ui) {
// load 'ADR' property - maybe :-P // load 'ADR' property - maybe :-P
@ -973,7 +980,7 @@ Contacts={
} }
}, },
loadPhoto:function(force){ loadPhoto:function(force){
if(this.data.PHOTO||force==true) { //if(this.data.PHOTO||force==true) {
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){ $.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
if(jsondata.status == 'success'){ if(jsondata.status == 'success'){
//alert(jsondata.data.page); //alert(jsondata.data.page);
@ -986,11 +993,11 @@ Contacts={
}); });
$('#file_upload_form').show(); $('#file_upload_form').show();
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide(); $('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide();
} else { /*} else {
$('#contacts_details_photo_wrapper').empty(); $('#contacts_details_photo_wrapper').empty();
$('#file_upload_form').hide(); $('#file_upload_form').hide();
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().show(); $('#contacts_propertymenu a[data-type="PHOTO"]').parent().show();
} }*/
}, },
editPhoto:function(id, tmp_path){ editPhoto:function(id, tmp_path){
//alert('editPhoto: ' + tmp_path); //alert('editPhoto: ' + tmp_path);
@ -1430,7 +1437,8 @@ $(document).ready(function(){
} }
}); });
$('#contacts_propertymenu a').live('click',function(){ $('#contacts_propertymenu a').live('click',function(){
Contacts.UI.Card.addProperty(this); var type = $(this).data('type');
Contacts.UI.Card.addProperty(type);
$('#contacts_propertymenu').hide(); $('#contacts_propertymenu').hide();
}); });
}); });

View File

@ -72,17 +72,10 @@
.appendTo( ul ); .appendTo( ul );
}; };
this.button = $( "<button type='button'>&nbsp;</button>" ) /*this.button = $( "<button type='button'>&nbsp;</button>" )
.attr( "tabIndex", -1 ) .attr( "tabIndex", -1 )
.attr( "title", "Show All Items" ) .attr( "title", "Show All Items" )
.insertAfter( input ) .insertAfter( input )
/*.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass( "ui-corner-all" )*/
.addClass('svg') .addClass('svg')
.addClass('action') .addClass('action')
.addClass('combo-button') .addClass('combo-button')
@ -99,7 +92,7 @@
// pass empty string as value to search for, displaying all results // pass empty string as value to search for, displaying all results
input.autocomplete( "search", "" ); input.autocomplete( "search", "" );
input.focus(); input.focus();
}); });*/
$.each(this.options, function(key, value) { $.each(this.options, function(key, value) {
self._setOption(key, value); self._setOption(key, value);
}); });
@ -128,6 +121,12 @@
this.options['name'] = value; this.options['name'] = value;
this.input.attr('name', value); this.input.attr('name', value);
break; break;
case "attributes":
var input = this.input;
$.each(this.options['attributes'], function(key, value) {
input.attr(key, value);
});
break;
case "classes": case "classes":
var input = this.input; var input = this.input;
$.each(this.options['classes'], function(key, value) { $.each(this.options['classes'], function(key, value) {

View File

@ -62,7 +62,7 @@
return false; return false;
} }
}); });
this.button = $( "<button type='button'>&nbsp;</button>" ) /*this.button = $( "<button type='button'>&nbsp;</button>" )
.attr( "tabIndex", -1 ) .attr( "tabIndex", -1 )
.attr( "title", "Show All Items" ) .attr( "title", "Show All Items" )
.insertAfter( this.element ) .insertAfter( this.element )
@ -86,7 +86,7 @@
// pass empty string as value to search for, displaying all results // pass empty string as value to search for, displaying all results
self.element.autocomplete( "search", "" ); self.element.autocomplete( "search", "" );
self.element.focus(); self.element.focus();
}); });*/
}, },
}); });
})( jQuery ); })( jQuery );

View File

@ -21,12 +21,12 @@ $id = isset($_['id']) ? $_['id'] : '';
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" /> <img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
</div> </div>
<div class="contactsection"> <div id="contact_photo" class="contactsection">
<form style="display:none;" id="file_upload_form" action="ajax/uploadphoto.php" method="post" enctype="multipart/form-data" target="file_upload_target" class="propertycontainer" data-element="PHOTO"> <form class="float" id="file_upload_form" action="ajax/uploadphoto.php" method="post" enctype="multipart/form-data" target="file_upload_target" class="propertycontainer" data-element="PHOTO">
<fieldset id="photo" class="formfloat"> <fieldset id="photo">
<a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a> <a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a>
<div id="contacts_details_photo_wrapper" title="<?php echo $l->t('Click or drop to upload picture'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)"> <div class="tip" id="contacts_details_photo_wrapper" title="<?php echo $l->t('Click or drop to upload picture'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<!-- img style="padding: 1em;" id="contacts_details_photo" alt="Profile picture" src="photo.php?id=<?php echo $_['id']; ?>" / --> <!-- img style="padding: 1em;" id="contacts_details_photo" alt="Profile picture" src="photo.php?id=<?php echo $_['id']; ?>" / -->
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress> <progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
</div> </div>
@ -37,43 +37,40 @@ $id = isset($_['id']) ? $_['id'] : '';
<iframe name="file_upload_target" id='file_upload_target' src=""></iframe> <iframe name="file_upload_target" id='file_upload_target' src=""></iframe>
</fieldset> </fieldset>
</form> </form>
<form id="contact_identity" method="post" <?php echo ($_['id']==''||!isset($_['id'])?'style="display:none;"':''); ?>> </div>
<div id="contact_identity" class="contactsection">
<form method="post">
<input type="hidden" name="id" value="<?php echo $_['id'] ?>"> <input type="hidden" name="id" value="<?php echo $_['id'] ?>">
<fieldset class="propertycontainer" data-element="N"><input type="hidden" id="n" class="contacts_property" name="value" value="" /></fieldset> <fieldset id="ident" class="contactpart">
<fieldset id="ident" class="formfloat">
<!-- legend>Name</legend --> <!-- legend>Name</legend -->
<dl class="form"> <span class="propertycontainer" data-element="N"><input type="hidden" id="n" class="contacts_property" name="value" value="" /></span>
<!-- dt><label for="n"><?php echo $l->t('Name'); ?></label></dt> <span id="name" class="propertycontainer" data-element="FN">
<dd style="padding-top: 0.8em;vertical-align: text-bottom;"><span id="n" type="text"></span></dd --> <select class="float" id="fn_select" title="<?php echo $l->t('Format custom, Short name, Full name, Reverse or Reverse with comma'); ?>" style="width:16em;">
<dt><label for="fn"><?php echo $l->t('Display name'); ?></label></dt>
<dd class="propertycontainer" data-element="FN">
<select id="fn_select" title="<?php echo $l->t('Format custom, Short name, Full name, Reverse or Reverse with comma'); ?>" style="width:16em;">
</select><a id="edit_name" class="action edit" title="<?php echo $l->t('Edit name details'); ?>"></a> </select><a id="edit_name" class="action edit" title="<?php echo $l->t('Edit name details'); ?>"></a>
</dd> </span>
<dl id="identityprops" class="form">
<dt style="display:none;" id="org_label" data-element="ORG"><label for="org"><?php echo $l->t('Organization'); ?></label></dt> <dt style="display:none;" id="org_label" data-element="ORG"><label for="org"><?php echo $l->t('Organization'); ?></label></dt>
<dd style="display:none;" class="propertycontainer" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd> <dd style="display:none;" class="propertycontainer" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
<dt style="display:none;" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt> <dt style="display:none;" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
<dd style="display:none;" class="propertycontainer" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd> <dd style="display:none;" class="propertycontainer" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
<dt style="display:none;" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt> <dt style="display:none;" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
<dd style="display:none;" class="propertycontainer" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd> <dd style="display:none;" class="propertycontainer" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
<dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></label></dt> <dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Groups'); ?></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 bold" name="value" value="" placeholder="
<?php echo $l->t('Separate groups with commas'); ?>" /><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> </dl>
</fieldset> </fieldset>
<fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE">
<legend><?php echo $l->t('Note'); ?><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></legend>
<textarea class="contacts_property note" name="value" cols="60" rows="10"></textarea>
</fieldset>
</form> </form>
</div> </div>
<!-- div class="delimiter"></div --> <!-- div class="delimiter"></div -->
<form id="contact_communication" method="post" style="display: none;"> <div id="contact_communication" class="contactsection">
<div class="contactsection"> <form method="post">
<!-- email addresses --> <!-- email addresses -->
<div id="emails" style="display:none;"> <div id="emails">
<fieldset class="contactpart"> <fieldset class="contactpart">
<legend><?php echo $l->t('Email'); ?></legend> <!-- legend><?php echo $l->t('Email'); ?></legend -->
<ul id="emaillist" class="propertylist"> <ul id="emaillist" class="propertylist">
<li class="template" style="white-space: nowrap; display: none;" data-element="EMAIL"> <li class="template" style="white-space: nowrap; display: none;" data-element="EMAIL">
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" /> <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
@ -83,9 +80,9 @@ $id = isset($_['id']) ? $_['id'] : '';
</div> <!-- email addresses--> </div> <!-- email addresses-->
<!-- Phone numbers --> <!-- Phone numbers -->
<div id="phones" style="display:none;"> <div id="phones">
<fieldset class="contactpart"> <fieldset class="contactpart">
<legend><?php echo $l->t('Phone'); ?></legend> <!-- legend><?php echo $l->t('Phone'); ?></legend -->
<ul id="phonelist" class="propertylist"> <ul id="phonelist" class="propertylist">
<li class="template" style="white-space: nowrap; display: none;" data-element="TEL"> <li class="template" style="white-space: nowrap; display: none;" data-element="TEL">
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" /> <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
@ -100,7 +97,7 @@ $id = isset($_['id']) ? $_['id'] : '';
<!-- Addresses --> <!-- Addresses -->
<div id="addresses" style="display:none;"> <div id="addresses" style="display:none;">
<fieldset class="contactpart"> <fieldset class="contactpart">
<legend><?php echo $l->t('Address'); ?></legend> <!-- legend><?php echo $l->t('Address'); ?></legend -->
<div id="addressdisplay"> <div id="addressdisplay">
<dl class="addresscard template" style="display: none;" data-element="ADR"><dt> <dl class="addresscard template" style="display: none;" data-element="ADR"><dt>
<input class="adr contacts_property" name="value" type="hidden" value="" /> <input class="adr contacts_property" name="value" type="hidden" value="" />
@ -111,11 +108,17 @@ $id = isset($_['id']) ? $_['id'] : '';
</fieldset> </fieldset>
</div> </div>
</div> <!-- Addresses --> </div> <!-- Addresses -->
</div>
<!-- a id="add_address" onclick="Contacts.UI.Card.editAddress('new', true)" class="add" title="<?php echo $l->t('Add address'); ?>"></a -->
</div>
</form> </form>
</div> </div>
<div id="contact_note" class="contactsection">
<form class="float" method="post">
<fieldset id="note" class="formfloat propertycontainer contactpart" data-element="NOTE">
<!-- legend><?php echo $l->t('Note'); ?> --><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><!-- /legend -->
<textarea class="contacts_property note" name="value" cols="40" rows="10" placeholder="<?php echo $l->t('Notes'); ?>"></textarea>
</fieldset>
</form>
</div> <!-- contact_note -->
</div> <!-- card -->
<div id="edit_photo_dialog" title="Edit photo"> <div id="edit_photo_dialog" title="Edit photo">
<div id="edit_photo_dialog_img"></div> <div id="edit_photo_dialog_img"></div>
</div> </div>