Removed obsolete commented code and made minor speed improvements.
Added stub function for loading categories.
This commit is contained in:
parent
71aa36c3f1
commit
96612c506e
2 changed files with 17 additions and 99 deletions
|
@ -117,7 +117,7 @@ Contacts={
|
|||
$('#carddav_url_close').show();
|
||||
},
|
||||
messageBox:function(title, msg) {
|
||||
if(msg.toLowerCase().indexOf('auth') > 0) {
|
||||
if(msg.toLowerCase().indexOf('auth') != -1) {
|
||||
// fugly hack, I know
|
||||
alert(msg);
|
||||
}
|
||||
|
@ -335,17 +335,6 @@ Contacts={
|
|||
// Load first in list.
|
||||
if($('#contacts li').length > 0) {
|
||||
Contacts.UI.Card.update();
|
||||
/*
|
||||
var firstid = $('#contacts li:first-child').data('id');
|
||||
console.log('trying to load: ' + firstid);
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':firstid},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
Contacts.UI.Card.loadContact(jsondata.data);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
}
|
||||
});*/
|
||||
} else {
|
||||
// load intro page
|
||||
$.getJSON('ajax/loadintro.php',{},function(jsondata){
|
||||
|
@ -374,6 +363,7 @@ Contacts={
|
|||
$('#rightcontent').data('id',this.id);
|
||||
//console.log('loaded: ' + this.data.FN[0]['value']);
|
||||
this.populateNameFields();
|
||||
this.loadCategories();
|
||||
this.loadPhoto();
|
||||
this.loadMails();
|
||||
this.loadPhones();
|
||||
|
@ -455,9 +445,6 @@ Contacts={
|
|||
this.fullname += ', ' + this.honsuf;
|
||||
}
|
||||
$('#n').html(this.fullname);
|
||||
//$('.jecEditableOption').attr('title', 'Custom');
|
||||
//$('.jecEditableOption').text(this.fn);
|
||||
//$('.jecEditableOption').attr('value', 0);
|
||||
$('#fn_select option').remove();
|
||||
$('#fn_select').combobox('value', this.fn);
|
||||
var names = [this.fullname, this.givname + ' ' + this.famname, this.famname + ' ' + this.givname, this.famname + ', ' + this.givname];
|
||||
|
@ -466,17 +453,16 @@ Contacts={
|
|||
.append($('<option></option>')
|
||||
.text(value));
|
||||
});
|
||||
/*$('#full').text(this.fullname);
|
||||
$('#short').text(this.givname + ' ' + this.famname);
|
||||
$('#reverse').text(this.famname + ' ' + this.givname);
|
||||
$('#reverse_comma').text(this.famname + ', ' + this.givname);*/
|
||||
$('#contact_identity').find('*[data-element="N"]').data('checksum', this.data.N[0]['checksum']);
|
||||
$('#contact_identity').find('*[data-element="FN"]').data('checksum', this.data.FN[0]['checksum']);
|
||||
$('#contact_identity').show();
|
||||
},
|
||||
loadCategories:function(){
|
||||
if(this.data.CATEGORIES) {
|
||||
//
|
||||
}
|
||||
},
|
||||
editNew:function(){ // add a new contact
|
||||
//Contacts.UI.notImplemented();
|
||||
//return false;
|
||||
this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = '';
|
||||
$.getJSON('ajax/newcontact.php',{},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
@ -713,12 +699,6 @@ Contacts={
|
|||
.text(value));
|
||||
});
|
||||
|
||||
/*$('#short').text(n[1] + ' ' + n[0]);
|
||||
$('#full').text(this.fullname);
|
||||
$('#reverse').text(n[0] + ' ' + n[1]);
|
||||
$('#reverse_comma').text(n[0] + ', ' + n[1]);*/
|
||||
//$('#n').html(full);
|
||||
//$('#fn').val(0);
|
||||
if(this.id == '') {
|
||||
var aid = $(dlg).find('#aid').val();
|
||||
Contacts.UI.Card.add(n.join(';'), $('#short').text(), aid);
|
||||
|
@ -889,21 +869,22 @@ Contacts={
|
|||
},
|
||||
loadPhoto:function(){
|
||||
if(this.data.PHOTO) {
|
||||
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
//alert(jsondata.data.page);
|
||||
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
$('#file_upload_form').show();
|
||||
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide();
|
||||
} else {
|
||||
$('#contacts_details_photo_wrapper').empty();
|
||||
$('#file_upload_form').hide();
|
||||
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().show();
|
||||
}
|
||||
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
//alert(jsondata.data.page);
|
||||
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
editPhoto:function(id, tmp_path){
|
||||
//alert('editPhoto: ' + tmp_path);
|
||||
|
@ -1143,13 +1124,6 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Open blank form to add new contact.
|
||||
* FIXME: Load the same page but only show name data and popup the name edit dialog.
|
||||
* On save load the page again with an id and show all fields.
|
||||
* NOTE: Or: Load the full page and popup name dialog modal. On success set the newly aquired ID, on
|
||||
* Cancel or failure give appropriate message and show ... something else :-P
|
||||
*/
|
||||
$('#contacts_newcontact').click(function(){
|
||||
Contacts.UI.Card.editNew();
|
||||
});
|
||||
|
@ -1175,9 +1149,6 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete currently selected contact TODO: and clear page
|
||||
*/
|
||||
$('#contacts_deletecard').live('click',function(){
|
||||
Contacts.UI.Card.delete();
|
||||
});
|
||||
|
|
|
@ -70,14 +70,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
<?php
|
||||
if(0) { /*foreach($card['EMAIL'] as $email) {*/
|
||||
?>
|
||||
<li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $email['checksum'] ?>" data-element="EMAIL">
|
||||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($email['parameters']['PREF'])?'checked="checked"':''); ?> />
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="<?php echo $email['value'] ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
<?php } ?>
|
||||
</ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
|
||||
</div> <!-- email addresses-->
|
||||
|
||||
|
@ -93,17 +85,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<?php echo html_select_options($_['phone_types'], array()) ?>
|
||||
</select>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
<?php
|
||||
if(0) { /*foreach($card['TEL'] as $phone) {*/
|
||||
?>
|
||||
<li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $phone['checksum'] ?>" data-element="TEL">
|
||||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($phone['parameters']['PREF'])?'checked="checked"':''); ?> />
|
||||
<input type="text" required="required" class="nonempty contacts_property" style="width:8em; border: 0px;" name="value" value="<?php echo $phone['value'] ?>" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
|
||||
<select class="contacts_property" multiple="multiple" name="parameters[TYPE][]">
|
||||
<?php echo html_select_options($_['phone_types'], isset($phone['parameters']['TYPE'])?$phone['parameters']['TYPE']:array()) ?>
|
||||
</select>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
<?php } ?>
|
||||
</ul><!-- a id="add_phone" class="add" title="<?php echo $l->t('Add phone number'); ?>"></a -->
|
||||
</div> <!-- Phone numbers -->
|
||||
|
||||
|
@ -118,40 +99,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<span class="adr_type_label"></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
</dt><dd><ul class="addresslist"></ul></dd></dl>
|
||||
|
||||
<?php if(0) { /*foreach($card['ADR'] as $address) {*/ ?>
|
||||
<dl class="addresscard propertycontainer" data-checksum="<?php echo $address['checksum']; ?>" data-element="ADR">
|
||||
<dt>
|
||||
<input class="adr contacts_property" name="value" type="hidden" value="<?php echo implode(';',$address['value']); ?>" />
|
||||
<input type="hidden" class="adr_type contacts_property" name="parameters[TYPE][]" value="<?php echo strtoupper(implode(',',$address['parameters'])); ?>" />
|
||||
<span class="adr_type_label">
|
||||
<?php
|
||||
if(count($address['parameters']) > 0) {
|
||||
//array_walk($address['parameters'], ) Nah, this wont work...
|
||||
$translated = array();
|
||||
foreach($address['parameters'] as $type) {
|
||||
$translated[] = $l->t(ucwords(strtolower($type)));
|
||||
}
|
||||
echo implode('/', $translated);
|
||||
}
|
||||
?></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
</dt>
|
||||
<dd>
|
||||
<ul class="addresslist">
|
||||
<?php
|
||||
$adr = $address['value'];
|
||||
$tmp = ($adr[0]?'<li>'.$adr[0].'</li>':'');
|
||||
$tmp .= ($adr[1]?'<li>'.$adr[1].'</li>':'');
|
||||
$tmp .= ($adr[2]?'<li>'.$adr[2].'</li>':'');
|
||||
$tmp .= ($adr[3]||$adr[5]?'<li>'.$adr[5].' '.$adr[3].'</li>':'');
|
||||
$tmp .= ($adr[4]?'<li>'.$adr[4].'</li>':'');
|
||||
$tmp .= ($adr[6]?'<li>'.$adr[6].'</li>':'');
|
||||
echo $tmp;
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div> <!-- Addresses -->
|
||||
|
|
Loading…
Reference in a new issue