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

Fix missing semicolons, trailing commas, leading/trailing whitespaces, mixed tabs/spaces.

This commit is contained in:
Mario Ferraro 2012-12-17 14:19:22 +00:00
parent 6dd4a143a8
commit a00596cb70
4 changed files with 223 additions and 223 deletions

204
js/app.js
View File

@ -22,11 +22,11 @@ utils.isArray = function(obj) {
utils.isInt = function(s) {
return typeof s === 'number' && (s.toString().search(/^-?[0-9]+$/) === 0);
}
};
utils.isUInt = function(s) {
return typeof s === 'number' && (s.toString().search(/^[0-9]+$/) === 0);
}
};
/**
* utils.type
@ -50,7 +50,7 @@ utils.moveCursorToEnd = function(el) {
range.collapse(false);
range.select();
}
}
};
if (typeof Object.create !== 'function') {
Object.create = function (o) {
@ -78,7 +78,7 @@ Array.prototype.clean = function(deleteValue) {
// Keep it DRY ;)
var wrongKey = function(event) {
return (event.type === 'keydown' && (event.keyCode !== 32 && event.keyCode !== 13));
}
};
/**
* Simply notifier
@ -140,7 +140,7 @@ OC.notify = function(params) {
self.notifier.removeData(dataid);
});
}
}
};
var GroupList = function(groupList, listItemTmpl) {
this.$groupList = groupList;
@ -158,7 +158,7 @@ var GroupList = function(groupList, listItemTmpl) {
if(response.status !== 'success') {
OC.notify({message:response.data.message});
}
})
});
} else {
self.selectGroup({element:$(this)});
}
@ -166,19 +166,19 @@ var GroupList = function(groupList, listItemTmpl) {
this.$groupListItemTemplate = listItemTmpl;
this.categories = [];
}
};
GroupList.prototype.nameById = function(id) {
return this.findById(id).contents().filter(function(){ return(this.nodeType == 3); }).text().trim()
}
return this.findById(id).contents().filter(function(){ return(this.nodeType == 3); }).text().trim();
};
GroupList.prototype.findById = function(id) {
return this.$groupList.find('h3[data-id="' + id + '"]');
}
};
GroupList.prototype.isFavorite = function(contactid) {
return this.inGroup(contactid, 'fav');
}
};
GroupList.prototype.selectGroup = function(params) {
var id, $elem;
@ -203,15 +203,15 @@ GroupList.prototype.selectGroup = function(params) {
$(document).trigger('status.group.selected', {
id: this.lastgroup,
type: $elem.data('type'),
contacts: $elem.data('contacts'),
contacts: $elem.data('contacts')
});
}
};
GroupList.prototype.inGroup = function(contactid, groupid) {
var $groupelem = this.findById(groupid);
var contacts = $groupelem.data('contacts');
return (contacts.indexOf(contactid) !== -1);
}
};
GroupList.prototype.setAsFavorite = function(contactid, state, cb) {
contactid = parseInt(contactid);
@ -251,7 +251,7 @@ GroupList.prototype.setAsFavorite = function(contactid, state, cb) {
}
});
}
}
};
/**
* Add one or more contact ids to a group
@ -315,7 +315,7 @@ GroupList.prototype.addTo = function(contactid, groupid, cb) {
$(document).trigger('status.group.contactadded', {
contactid: contactid,
groupid: groupid,
groupname: self.nameById(groupid),
groupname: self.nameById(groupid)
});
}
} else {
@ -325,14 +325,14 @@ GroupList.prototype.addTo = function(contactid, groupid, cb) {
}
});
}
}
};
GroupList.prototype.removeFrom = function(contactid, groupid, cb) {
console.log('GroupList.removeFrom', contactid, groupid);
var $groupelem = this.findById(groupid);
var contacts = $groupelem.data('contacts');
var ids = [];
// If it's the 'all' group simply decrement the number
if(groupid === 'all') {
var $numelem = $groupelem.find('.numcontacts');
@ -405,7 +405,7 @@ GroupList.prototype.removeFrom = function(contactid, groupid, cb) {
}
});
}
}
};
GroupList.prototype.removeFromAll = function(contactid, alsospecial) {
var self = this;
@ -413,11 +413,11 @@ GroupList.prototype.removeFromAll = function(contactid, alsospecial) {
$.each(this.$groupList.find(selector), function(i, group) {
self.removeFrom(contactid, $(this).data('id'));
});
}
};
GroupList.prototype.categoriesChanged = function(newcategories) {
console.log('GroupList.categoriesChanged, I should do something');
}
};
GroupList.prototype.contactDropped = function(event, ui) {
var dragitem = ui.draggable, droptarget = $(this);
@ -430,7 +430,7 @@ GroupList.prototype.contactDropped = function(event, ui) {
$(this).data('obj').addTo(dragitem.data('id'), $(this).data('id'));
}
}
}
};
GroupList.prototype.deleteGroup = function(groupid, cb) {
var $elem = this.findById(groupid);
@ -445,7 +445,7 @@ GroupList.prototype.deleteGroup = function(groupid, cb) {
groupid: groupid,
newgroupid: parseInt($newelem.data('id')),
groupname: self.nameById(groupid),
contacts: contacts,
contacts: contacts
});
$elem.remove();
self.selectGroup({element:$newelem});
@ -456,7 +456,7 @@ GroupList.prototype.deleteGroup = function(groupid, cb) {
cb(jsondata);
}
});
}
};
GroupList.prototype.editGroup = function(id) {
var self = this;
@ -476,16 +476,16 @@ GroupList.prototype.editGroup = function(id) {
self.addGroup({name:name, element:$elem}, function(response) {
if(response.status === 'success') {
$elem.prepend(name).removeClass('editing').attr('data-id', response.id);
$input.next('.checked').remove()
$input.remove()
$input.next('.checked').remove();
$input.remove();
self.$editelem = null;
} else {
$input.prop('disabled', false);
OC.notify({message:response.message});
}
});
}
};
if(typeof id === 'undefined') {
// Add new group
var tmpl = this.$groupListItemTemplate;
@ -493,7 +493,7 @@ GroupList.prototype.editGroup = function(id) {
id: 'new',
type: 'category',
num: 0,
name: '',
name: ''
});
var $input = $('<input type="text" class="active" /><a class="action checked disabled" />');
self.$editelem.prepend($input).addClass('editing');
@ -533,11 +533,11 @@ GroupList.prototype.editGroup = function(id) {
var $input = $('<input type="text" class="active" value="' + name + '" /><a class="action checked disabled />');
$elem.prepend($input).addClass('editing');
$input.focus();
} else {
throw { name: 'WrongParameterType', message: 'GroupList.editGroup only accept integers.'}
throw { name: 'WrongParameterType', message: 'GroupList.editGroup only accept integers.'};
}
}
};
GroupList.prototype.addGroup = function(params, cb) {
console.log('GroupList.addGroup', params.name);
@ -565,8 +565,8 @@ GroupList.prototype.addGroup = function(params, cb) {
id: jsondata.data.id,
type: 'category',
num: contacts.length,
name: name,
})
name: name
});
self.categories.push({id: jsondata.data.id, name: name});
$elem.data('obj', self);
$elem.data('contacts', contacts);
@ -595,7 +595,7 @@ GroupList.prototype.addGroup = function(params, cb) {
}
}
});
}
};
GroupList.prototype.loadGroups = function(numcontacts, cb) {
var self = this;
@ -608,11 +608,11 @@ GroupList.prototype.loadGroups = function(numcontacts, cb) {
if (jsondata && jsondata.status == 'success') {
self.lastgroup = jsondata.data.lastgroup;
self.sortorder = jsondata.data.sortorder.length > 0
? $.map(jsondata.data.sortorder.split(','), function(c) {return parseInt(c)})
? $.map(jsondata.data.sortorder.split(','), function(c) {return parseInt(c);})
: [];
console.log('sortorder', self.sortorder);
// Favorites
var contacts = $.map(jsondata.data.favorites, function(c) {return parseInt(c)});
var contacts = $.map(jsondata.data.favorites, function(c) {return parseInt(c);});
var $elem = tmpl.octemplate({
id: 'fav',
type: 'fav',
@ -633,12 +633,12 @@ GroupList.prototype.loadGroups = function(numcontacts, cb) {
console.log('favorites', $elem.data('contacts'));
// Normal groups
$.each(jsondata.data.categories, function(c, category) {
var contacts = $.map(category.contacts, function(c) {return parseInt(c)});
var contacts = $.map(category.contacts, function(c) {return parseInt(c);});
var $elem = (tmpl).octemplate({
id: category.id,
type: 'category',
num: contacts.length,
name: category.name,
name: category.name
});
self.categories.push({id: category.id, name: category.name});
$elem.data('obj', self);
@ -666,12 +666,12 @@ GroupList.prototype.loadGroups = function(numcontacts, cb) {
// Shared addressbook
$.each(jsondata.data.shared, function(c, shared) {
var sharedindicator = '<img class="shared svg" src="' + OC.imagePath('core', 'actions/shared') + '"'
+ 'title="' + t('contacts', 'Shared by {owner}', {owner:shared.userid}) + '" />'
+ 'title="' + t('contacts', 'Shared by {owner}', {owner:shared.userid}) + '" />';
var $elem = (tmpl).octemplate({
id: shared.id,
type: 'shared',
num: '', //jsondata.data.shared.length,
name: shared.displayname,
name: shared.displayname
});
$elem.find('.numcontacts').after(sharedindicator);
$elem.data('obj', self);
@ -685,27 +685,27 @@ GroupList.prototype.loadGroups = function(numcontacts, cb) {
console.log('stop sorting', $(this));
var ids = [];
$.each($(this).children('h3[data-type="category"]'), function(i, elem) {
ids.push($(elem).data('id'))
})
ids.push($(elem).data('id'));
});
self.sortorder = ids;
$(document).trigger('status.groups.sorted', {
sortorder: self.sortorder.join(','),
sortorder: self.sortorder.join(',')
});
},
}
});
var $elem = self.findById(self.lastgroup);
$elem.addClass('active');
$(document).trigger('status.group.selected', {
id: self.lastgroup,
type: $elem.data('type'),
contacts: $elem.data('contacts'),
contacts: $elem.data('contacts')
});
} // TODO: else
if(typeof cb === 'function') {
cb();
}
});
}
};
OC.Contacts = OC.Contacts || {
init:function(id) {
@ -713,7 +713,7 @@ OC.Contacts = OC.Contacts || {
$(document).ajaxError(function(e, xhr, settings, exception) {
// Don't try to get translation because it's likely a network error.
OC.notify({
message: 'error in: ' + settings.url + ', '+'error: ' + xhr.responseText,
message: 'error in: ' + settings.url + ', '+'error: ' + xhr.responseText
});
});
}
@ -853,7 +853,7 @@ OC.Contacts = OC.Contacts || {
var id = parseInt(data.id);
console.log('contact', data.id, 'deleted');
// update counts on group lists
self.groups.removeFromAll(data.id, true)
self.groups.removeFromAll(data.id, true);
});
$(document).bind('status.contact.added', function(e, data) {
@ -867,7 +867,7 @@ OC.Contacts = OC.Contacts || {
});
$(document).bind('status.contact.enabled', function(e, enabled) {
console.log('status.contact.enabled', enabled)
console.log('status.contact.enabled', enabled);
/*if(enabled) {
self.showActions(['back', 'download', 'delete', 'groups']);
} else {
@ -906,7 +906,7 @@ OC.Contacts = OC.Contacts || {
self.dontScroll = false;
}, 100);
}
self.currentlistid = result.id
self.currentlistid = result.id;
});
$(document).bind('status.nomorecontacts', function(e, result) {
@ -931,7 +931,7 @@ OC.Contacts = OC.Contacts || {
console.log('waiting for contacts to load');
setTimeout(function() {
$(document).trigger('request.loadcontact', {
id: result.id,
id: result.id
});
}, 1000);
}
@ -1008,7 +1008,7 @@ OC.Contacts = OC.Contacts || {
$.each(result.contacts, function(idx, contactid) {
var contact = self.contacts.findById(contactid);
console.log('contactid', contactid, contact);
self.contacts.findById(contactid).removeFromGroup(result.groupname);
});
});
@ -1083,7 +1083,7 @@ OC.Contacts = OC.Contacts || {
if(self.$settings.find($(e.target)).length == 0) {
self.$settings.switchClass('open', '');
}
}
};
if(self.$settings.hasClass('open')) {
self.$settings.switchClass('open', '');
$('body').unbind('click', bodyListener);
@ -1145,8 +1145,8 @@ OC.Contacts = OC.Contacts || {
// If a contact is open the action is only applied to that,
// otherwise on all selected items.
if(self.currentid) {
ids = [self.currentid,];
buildnow = true
ids = [self.currentid];
buildnow = true;
} else {
ids = self.contacts.getSelectedContacts();
}
@ -1156,7 +1156,7 @@ OC.Contacts = OC.Contacts || {
if(!self.currentid) {
self.showActions(['add']);
}
if($opt.val() === 'add') { // Add new group
action = 'add';
console.log('add group...');
@ -1179,7 +1179,7 @@ OC.Contacts = OC.Contacts || {
$(document).trigger('status.contact.addedtogroup', {
contactid: id,
groupid: groupId,
groupname: groupName,
groupname: groupName
});
}, 1000);
});
@ -1194,7 +1194,7 @@ OC.Contacts = OC.Contacts || {
});
return;
}
groupName = $opt.text(), groupId = $opt.val();
console.log('trut', groupName, groupId);
@ -1215,7 +1215,7 @@ OC.Contacts = OC.Contacts || {
$(document).trigger('status.contact.addedtogroup', {
contactid: id,
groupid: groupId,
groupname: groupName,
groupname: groupName
});
}, 1000);
});
@ -1241,7 +1241,7 @@ OC.Contacts = OC.Contacts || {
$(document).trigger('status.contact.removedfromgroup', {
contactid: id,
groupid: groupId,
groupname: groupName,
groupname: groupName
});
});
} else {
@ -1281,7 +1281,7 @@ OC.Contacts = OC.Contacts || {
}
self.openContact($(this).data('id'));
});
this.$settings.find('h3').on('click keydown', function(event) {
if(wrongKey(event)) {
return;
@ -1294,7 +1294,7 @@ OC.Contacts = OC.Contacts || {
var $list = $(this).next('ul');
if($(this).data('id') === 'addressbooks') {
console.log('addressbooks');
if(!self.$addressbookTmpl) {
self.$addressbookTmpl = $('#addressbookTemplate');
}
@ -1302,9 +1302,9 @@ OC.Contacts = OC.Contacts || {
$list.empty();
$.each(self.contacts.addressbooks, function(id, book) {
var $li = self.$addressbookTmpl.octemplate({
id: id,
id: id,
permissions: book.permissions,
displayname: book.displayname,
displayname: book.displayname
});
$list.append($li);
@ -1317,7 +1317,7 @@ OC.Contacts = OC.Contacts || {
var $li = $(this).parents('li').first();
$.ajax({
type:'POST',
url:OC.filePath('contacts', 'ajax', 'addressbook/delete.php'),
url:OC.filePath('contacts', 'ajax', 'addressbook/delete.php'),
data:{ id: id },
success:function(jsondata) {
console.log(jsondata);
@ -1343,7 +1343,7 @@ OC.Contacts = OC.Contacts || {
error:function(jqXHR, textStatus, errorThrown) {
OC.notify({message:textStatus + ': ' + errorThrown});
id = false;
},
}
});
});
$list.find('a.action.globe').on('click keypress', function() {
@ -1376,13 +1376,13 @@ OC.Contacts = OC.Contacts || {
$.ajax({
type:'POST',
async:false,
url:OC.filePath('contacts', 'ajax', 'addressbook/add.php'),
url:OC.filePath('contacts', 'ajax', 'addressbook/add.php'),
data:{ name: name },
success:function(jsondata) {
console.log(jsondata);
if(jsondata.status == 'success') {
self.contacts.setAddressbook(jsondata.data.addressbook);
id = jsondata.data.addressbook.id
id = jsondata.data.addressbook.id;
} else {
OC.notify({message:jsondata.data.message});
}
@ -1390,10 +1390,10 @@ OC.Contacts = OC.Contacts || {
error:function(jqXHR, textStatus, errorThrown) {
OC.notify({message:textStatus + ': ' + errorThrown});
id = false;
},
}
});
return id;
}
};
self.$importIntoSelect.empty();
$.each(self.contacts.addressbooks, function(id, book) {
@ -1403,7 +1403,7 @@ OC.Contacts = OC.Contacts || {
createCallback:addAddressbookCallback,
singleSelect: true,
createText:String(t('contacts', 'Add address book')),
minWidth: 120,
minWidth: 120
});
}
@ -1420,11 +1420,11 @@ OC.Contacts = OC.Contacts || {
$(this).hide();
self.currentid = 'new';
// Properties that the contact doesn't know
console.log('addContact, groupid', self.currentgroup)
console.log('addContact, groupid', self.currentgroup);
var groupprops = {
favorite: false,
groups: self.groups.categories,
currentgroup: {id:self.currentgroup, name:self.groups.nameById(self.currentgroup)},
currentgroup: {id:self.currentgroup, name:self.groups.nameById(self.currentgroup)}
};
self.tmpcontact = self.contacts.addContact(groupprops);
self.$rightContent.prepend(self.tmpcontact);
@ -1450,7 +1450,7 @@ OC.Contacts = OC.Contacts || {
return;
}
console.log('download');
document.location.href = OC.linkTo('contacts', 'export.php')
document.location.href = OC.linkTo('contacts', 'export.php')
+ '?selectedids=' + self.contacts.getSelectedContacts().join(',');
});
@ -1558,14 +1558,14 @@ OC.Contacts = OC.Contacts || {
$status.text(t('contacts', 'Importing from {filename}...', {filename:fileName})).fadeIn();
doImport(fileName, aid, function(response) {
if(response.status === 'success') {
$status.text(t('contacts', '{success} imported, {failed} failed.',
$status.text(t('contacts', '{success} imported, {failed} failed.',
{success:response.data.imported, failed:response.data.failed})).fadeIn();
}
delete uploadingFiles[fileName];
numfiles -= 1; uploadedfiles -= 1;
$progressbar.progressbar('value',50+(50/(todo-uploadedfiles)));
});
})
});
//$status.text(t('contacts', 'Importing...')).fadeIn();
waitForImport();
};
@ -1605,7 +1605,7 @@ OC.Contacts = OC.Contacts || {
$.each(files, function(i, file) {
var fileName = file.name;
console.log('file.name', file.name);
var jqXHR = $('#import_fileupload').fileupload('send',
var jqXHR = $('#import_fileupload').fileupload('send',
{
files: file,
formData: function(form) {
@ -1624,7 +1624,7 @@ OC.Contacts = OC.Contacts || {
})
.error(function(jqXHR, textStatus, errorThrown) {
console.log(textStatus);
OC.notify({message:errorThrown + ': ' + textStatus,});
OC.notify({message:errorThrown + ': ' + textStatus});
});
uploadingFiles[fileName] = jqXHR;
});
@ -1673,9 +1673,9 @@ OC.Contacts = OC.Contacts || {
$('#upload input.stop').hide();
}
}
})
});
});
$(document).on('keypress', function(event) {
if(!$(event.target).is('body')) {
return;
@ -1731,7 +1731,7 @@ OC.Contacts = OC.Contacts || {
break;
case 34: // PageDown
case 78: // n
console.log('page down')
console.log('page down');
break;
case 79: // o
console.log('open contact?');
@ -1757,7 +1757,7 @@ OC.Contacts = OC.Contacts || {
});
// find all with a title attribute and tipsy them
// find all with a title attribute and tipsy them
$('.tooltipped.downwards:not(.onfocus)').tipsy({gravity: 'n'});
$('.tooltipped.upwards:not(.onfocus)').tipsy({gravity: 's'});
$('.tooltipped.rightwards:not(.onfocus)').tipsy({gravity: 'w'});
@ -1792,8 +1792,8 @@ OC.Contacts = OC.Contacts || {
});
$(this).dialog('close');
},
'Cancel':function() {
$(this).dialog('close');
'Cancel':function() {
$(this).dialog('close');
return false;
}
},
@ -1803,7 +1803,7 @@ OC.Contacts = OC.Contacts || {
},
open: function(event, ui) {
$dlg.find('input').focus();
},
}
});
},
setAllChecked: function(checked) {
@ -1847,7 +1847,7 @@ OC.Contacts = OC.Contacts || {
var groupprops = {
favorite: this.groups.isFavorite(this.currentid),
groups: this.groups.categories,
currentgroup: {id:this.currentgroup, name:this.groups.nameById(this.currentgroup)},
currentgroup: {id:this.currentgroup, name:this.groups.nameById(this.currentgroup)}
};
var $contactelem = this.contacts.showContact(this.currentid, groupprops);
var self = this;
@ -1879,7 +1879,7 @@ OC.Contacts = OC.Contacts || {
OC.notify({
message:t(
'contacts',
'The file you are trying to upload exceed the maximum size for file uploads on this server.'),
'The file you are trying to upload exceed the maximum size for file uploads on this server.')
});
return;
} else {
@ -1898,12 +1898,12 @@ OC.Contacts = OC.Contacts || {
},
cloudPhotoSelected:function(id, path) {
var self = this;
console.log('cloudPhotoSelected, id', id)
console.log('cloudPhotoSelected, id', id);
$.getJSON(OC.filePath('contacts', 'ajax', 'oc_photo.php'),
{path: path, id: id},function(jsondata) {
if(jsondata.status == 'success') {
//alert(jsondata.data.page);
self.editPhoto(jsondata.data.id, jsondata.data.tmp)
self.editPhoto(jsondata.data.id, jsondata.data.tmp);
$('#edit_photo_dialog_img').html(jsondata.data.page);
}
else{
@ -1917,7 +1917,7 @@ OC.Contacts = OC.Contacts || {
{id: id}, function(jsondata) {
if(jsondata.status == 'success') {
//alert(jsondata.data.page);
self.editPhoto(jsondata.data.id, jsondata.data.tmp)
self.editPhoto(jsondata.data.id, jsondata.data.tmp);
$('#edit_photo_dialog_img').html(jsondata.data.page);
}
else{
@ -1926,7 +1926,7 @@ OC.Contacts = OC.Contacts || {
});
},
editPhoto:function(id, tmpkey) {
console.log('editPhoto', id, tmpkey)
console.log('editPhoto', id, tmpkey);
$('.tipsy').remove();
// Simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
@ -1961,7 +1961,7 @@ OC.Contacts = OC.Contacts || {
maxSize: [399, 399],
bgColor: 'black',
bgOpacity: .4,
boxWidth: 400,
boxWidth: 400,
boxHeight: 400,
setSelect: [ 100, 130, 50, 50 ]//,
//aspectRatio: 0.8
@ -2000,7 +2000,7 @@ OC.Contacts = OC.Contacts || {
if(jsondata && jsondata.status === 'success') {
// load cropped photo.
$(document).trigger('status.contact.photoupdated', {
id: jsondata.data.id,
id: jsondata.data.id
});
} else {
if(!jsondata) {
@ -2016,14 +2016,14 @@ OC.Contacts = OC.Contacts || {
$.ajax({
type:'POST',
async:false,
url:OC.filePath('contacts', 'ajax', 'addressbook/add.php'),
url:OC.filePath('contacts', 'ajax', 'addressbook/add.php'),
data:{ name: data.name, description: data.description },
success:function(jsondata) {
if(jsondata.status == 'success') {
if(typeof cb === 'function') {
cb({
status:'success',
addressbook: jsondata.data.addressbook,
addressbook: jsondata.data.addressbook
});
}
} else {
@ -2040,7 +2040,7 @@ OC.Contacts = OC.Contacts || {
$('body').append('<div id="addressbook_dialog"></div>');
var $dlg = $('#addressbook_dialog').html(data).octemplate({
nameplaceholder: t('contacts', 'Enter name'),
descplaceholder: t('contacts', 'Enter description'),
descplaceholder: t('contacts', 'Enter description')
}).dialog({
modal: true, height: 'auto', width: 'auto',
title: t('contacts', 'Select addressbook'),
@ -2062,7 +2062,7 @@ OC.Contacts = OC.Contacts || {
if(data.status === 'success') {
cb({
status:'success',
addressbook:data.addressbook,
addressbook:data.addressbook
});
} else {
cb({status:'error'});
@ -2075,7 +2075,7 @@ OC.Contacts = OC.Contacts || {
if(typeof cb === 'function') {
cb({
status:'success',
addressbook:self.contacts.addressbooks[parseInt(aid)],
addressbook:self.contacts.addressbooks[parseInt(aid)]
});
}
$(this).dialog('close');
@ -2100,7 +2100,7 @@ OC.Contacts = OC.Contacts || {
|| book.permissions & OC.PERMISSION_DELETE)) {
var row = '<tr><td><input id="book_{id}" name="book" type="radio" value="{id}"</td>'
+ '<td><label for="book_{id}">{displayname}</label></td>'
+ '<td>{description}</td></tr>'
+ '<td>{description}</td></tr>';
var $row = $(row).octemplate({
id:book.id,
displayname:book.displayname,
@ -2113,12 +2113,12 @@ OC.Contacts = OC.Contacts || {
$lastrow.find('input.name,input.desc').on('focus', function(e) {
$lastrow.find('input[type="radio"]').prop('checked', true);
});
},
}
});
}).error(function() {
OC.notify({message: t('contacts', 'Network or server error. Please inform administrator.')});
});
},
}
};
(function( $ ) {

View File

@ -24,14 +24,14 @@ OC.Contacts = OC.Contacts || {};
this.detailTemplates = detailtemplates;
this.multi_properties = ['EMAIL', 'TEL', 'IMPP', 'ADR', 'URL'];
}
};
Contact.prototype.showActions = function(act) {
this.$footer.children().hide();
if(act && act.length > 0) {
this.$footer.children('.'+act.join(',.')).show();
}
}
};
Contact.prototype.setAsSaving = function(obj, state) {
if(!obj) {
@ -44,10 +44,10 @@ OC.Contacts = OC.Contacts || {};
} else {
$(obj).removeClass('loading');
}*/
}
};
Contact.prototype.addProperty = function($option, name) {
console.log('Contact.addProperty', name)
console.log('Contact.addProperty', name);
switch(name) {
case 'NICKNAME':
case 'TITLE':
@ -85,9 +85,9 @@ OC.Contacts = OC.Contacts || {};
$elem.find('select.type[name="parameters[TYPE][]"]')
.combobox({
singleclick: true,
classes: ['propertytype', 'float', 'label'],
classes: ['propertytype', 'float', 'label']
});
}
};
Contact.prototype.deleteProperty = function(params) {
var obj = params.obj;
@ -114,7 +114,7 @@ OC.Contacts = OC.Contacts || {};
if(!jsondata) {
$(document).trigger('status.contact.error', {
status: 'error',
message: t('contacts', 'Network or server error. Please inform administrator.'),
message: t('contacts', 'Network or server error. Please inform administrator.')
});
self.setAsSaving(obj, false);
return false;
@ -144,13 +144,13 @@ OC.Contacts = OC.Contacts || {};
} else {
$(document).trigger('status.contact.error', {
status: 'error',
message: jsondata.data.message,
message: jsondata.data.message
});
self.setAsSaving(obj, false);
return false;
}
},'json');
}
};
/**
* @brief Act on change of a property.
@ -197,7 +197,7 @@ OC.Contacts = OC.Contacts || {};
if(!jsondata) {
$(document).trigger('status.contact.error', {
status: 'error',
message: t('contacts', 'Network or server error. Please inform administrator.'),
message: t('contacts', 'Network or server error. Please inform administrator.')
});
$(obj).addClass('error');
self.setAsSaving(obj, false);
@ -217,8 +217,8 @@ OC.Contacts = OC.Contacts || {};
name: element,
value: self.valueFor(obj),
parameters: self.parametersFor(obj),
checksum: jsondata.data.checksum,
}
checksum: jsondata.data.checksum
};
break;
}
}
@ -228,7 +228,7 @@ OC.Contacts = OC.Contacts || {};
name: element,
value: self.valueFor(obj),
parameters: self.parametersFor(obj),
checksum: jsondata.data.checksum,
checksum: jsondata.data.checksum
});
}
self.propertyContainerFor(obj).data('checksum', jsondata.data.checksum);
@ -241,7 +241,7 @@ OC.Contacts = OC.Contacts || {};
break;
case 'FN':
if(!self.data.FN || !self.data.FN.length) {
self.data.FN = [{name:'FN', value:'', parameters:[]}]
self.data.FN = [{name:'FN', value:'', parameters:[]}];
}
self.data.FN[0]['value'] = value;
// Update the list element
@ -279,7 +279,7 @@ OC.Contacts = OC.Contacts || {};
}
$(document).trigger('status.contact.renamed', {
id: self.id,
contact: self,
contact: self
});
break;
case 'N':
@ -300,7 +300,7 @@ OC.Contacts = OC.Contacts || {};
name: element,
value: value,
parameters: self.parametersFor(obj),
checksum: jsondata.data.checksum,
checksum: jsondata.data.checksum
};
break;
default:
@ -312,21 +312,21 @@ OC.Contacts = OC.Contacts || {};
} else {
$(document).trigger('status.contact.error', {
status: 'error',
message: jsondata.data.message,
message: jsondata.data.message
});
self.setAsSaving(obj, false);
return false;
}
},'json');
}
};
/**
* Hide contact list element.
*/
Contact.prototype.hide = function() {
this.getListItemElement().hide();
}
};
/**
* Remove any open contact from the DOM.
*/
@ -338,7 +338,7 @@ OC.Contacts = OC.Contacts || {};
} else {
return false;
}
}
};
/**
* Remove any open contact from the DOM and detach it's list
@ -353,7 +353,7 @@ OC.Contacts = OC.Contacts || {};
this.$listelem.detach();
return this;
}
}
};
/**
* Set a contacts list element as (un)checked
@ -364,7 +364,7 @@ OC.Contacts = OC.Contacts || {};
this.$listelem.find('input:checkbox').prop('checked', checked);
return this;
}
}
};
/**
* Set a contact to en/disabled depending on its permissions.
@ -381,13 +381,13 @@ OC.Contacts = OC.Contacts || {};
$(this).prop('disabled', !enabled);
});
$(document).trigger('status.contact.enabled', enabled);
}
};
/**
* Add a contact from data store and remove it from the DOM
* @params params. An object which can contain the optional properties:
* aid: The id of the addressbook to add the contact to. Per default it will be added to the first.
* fn: The formatted name of the contact.
* aid: The id of the addressbook to add the contact to. Per default it will be added to the first.
* fn: The formatted name of the contact.
* @param cb Optional callback function which
* @returns The callback gets an object as argument with a variable 'status' of either 'success'
* or 'error'. On success the 'data' property of that object contains the contact id as 'id', the
@ -400,7 +400,7 @@ OC.Contacts = OC.Contacts || {};
if(!jsondata) {
$(document).trigger('status.contact.error', {
status: 'error',
message: t('contacts', 'Network or server error. Please inform administrator.'),
message: t('contacts', 'Network or server error. Please inform administrator.')
});
return false;
}
@ -409,7 +409,7 @@ OC.Contacts = OC.Contacts || {};
self.access.id = parseInt(jsondata.data.aid);
self.data = jsondata.data.details;
// Add contact to current group
if(self.groupprops && self.groupprops.currentgroup.name !== 'all'
if(self.groupprops && self.groupprops.currentgroup.name !== 'all'
&& self.groupprops.currentgroup.name !== 'fav') {
if(!self.data.CATEGORIES) {
self.data.CATEGORIES = [{value:[self.groupprops.currentgroup.name], parameters:[]}];
@ -418,25 +418,25 @@ OC.Contacts = OC.Contacts || {};
// Tell OC.Contacts to save in backend
$(document).trigger('request.contact.addtogroup', {
id: self.id,
groupid: self.groupprops.currentgroup.id,
groupid: self.groupprops.currentgroup.id
});
}
}
$(document).trigger('status.contact.added', {
id: self.id,
contact: self,
contact: self
});
}
if(typeof cb == 'function') {
cb(jsondata);
}
});
}
};
/**
* Delete contact from data store and remove it from the DOM
* @param cb Optional callback function which
* @returns An object with a variable 'status' of either success
* or 'error'
* or 'error'
*/
Contact.prototype.destroy = function(cb) {
var self = this;
@ -465,7 +465,7 @@ OC.Contacts = OC.Contacts || {};
cb(retval);
}
});
}
};
Contact.prototype.queryStringFor = function(obj) {
var q = 'id=' + this.id;
@ -488,23 +488,23 @@ OC.Contacts = OC.Contacts || {};
}
}
return q;
}
};
Contact.prototype.propertyContainerFor = function(obj) {
return $(obj).hasClass('propertycontainer')
? $(obj)
: $(obj).parents('.propertycontainer').first();
}
};
Contact.prototype.checksumFor = function(obj) {
return this.propertyContainerFor(obj).data('checksum');
}
};
Contact.prototype.valueFor = function(obj) {
var $container = this.propertyContainerFor(obj);
console.assert($container.length > 0, 'Couldn\'t find container for ' + $(obj))
return $container.is('input')
? $container.val()
console.assert($container.length > 0, 'Couldn\'t find container for ' + $(obj));
return $container.is('input')
? $container.val()
: (function() {
var $elem = $container.find('textarea.value,input.value:not(:checkbox)');
console.assert($elem.length > 0, 'Couldn\'t find value for ' + $container.data('element'));
@ -518,7 +518,7 @@ OC.Contacts = OC.Contacts || {};
return retval;
}
})();
}
};
Contact.prototype.parametersFor = function(obj, asText) {
var parameters = [];
@ -541,12 +541,12 @@ OC.Contacts = OC.Contacts || {};
parameters[paramname].push(val);
});
return parameters;
}
};
Contact.prototype.propertyTypeFor = function(obj) {
var ptype = this.propertyContainerFor(obj).data('element');
return ptype ? ptype.toUpperCase() : null;
}
};
/**
* Render the list item
@ -560,7 +560,7 @@ OC.Contacts = OC.Contacts || {};
tel: this.getPreferredValue('TEL', ''),
adr: this.getPreferredValue('ADR', []).clean('').join(', '),
categories: this.getPreferredValue('CATEGORIES', [])
.clean('').join(' / '),
.clean('').join(' / ')
});
if(this.access.owner !== OC.currentUser
&& !(this.access.permissions & OC.PERMISSION_UPDATE
@ -568,7 +568,7 @@ OC.Contacts = OC.Contacts || {};
this.$listelem.find('input:checkbox').prop('disabled', true).css('opacity', '0');
}
return this.$listelem;
}
};
/**
* Render the full contact
@ -593,13 +593,13 @@ OC.Contacts = OC.Contacts || {};
$.datepicker.parseDate('yy-mm-dd',
this.getPreferredValue('BDAY', '').substring(0, 10)))
: '',
note: this.getPreferredValue('NOTE', ''),
note: this.getPreferredValue('NOTE', '')
}
: {id:'', favorite:'', name:'', nickname:'', title:'', org:'', bday:'', note:'', n0:'', n1:'', n2:'', n3:'', n4:''};
this.$fullelem = this.$fullTemplate.octemplate(values).data('contactobject', this);
this.$footer = this.$fullelem.find('footer');
this.$fullelem.find('.tooltipped.rightwards.onfocus').tipsy({trigger: 'focus', gravity: 'w'});
this.$fullelem.on('submit', function() {
return false;
@ -630,12 +630,12 @@ OC.Contacts = OC.Contacts || {};
$editor.toggle('blind');
$('body').unbind('click', bodyListener);
}
}
};
$editor.toggle('blind', function() {
$('body').bind('click', bodyListener);
});
});
this.$fullelem.on('click keydown', '.delete', function(event) {
$('.tipsy').remove();
if(wrongKey(event)) {
@ -651,15 +651,15 @@ OC.Contacts = OC.Contacts || {};
}
if($(this).is('.close') || $(this).is('.cancel')) {
$(document).trigger('request.contact.close', {
id: self.id,
id: self.id
});
} else if($(this).is('.export')) {
$(document).trigger('request.contact.export', {
id: self.id,
id: self.id
});
} else if($(this).is('.delete')) {
$(document).trigger('request.contact.delete', {
id: self.id,
id: self.id
});
}
return false;
@ -672,11 +672,11 @@ OC.Contacts = OC.Contacts || {};
return false;
} else if(event.keyCode === 27) {
$(document).trigger('request.contact.close', {
id: self.id,
id: self.id
});
}
});
this.$fullelem.on('change', '.value,.parameter', function(event) {
if(this.value === this.defaultValue) {
return;
@ -700,7 +700,7 @@ OC.Contacts = OC.Contacts || {};
}
$(document).trigger('request.contact.setasfavorite', {
id: self.id,
state: !state,
state: !state
});
});
this.loadPhoto();
@ -766,7 +766,7 @@ OC.Contacts = OC.Contacts || {};
//console.log('param', param);
if(param.toUpperCase() == 'PREF') {
var $cb = $property.find('input[type="checkbox"]');
$cb.attr('checked', 'checked')
$cb.attr('checked', 'checked');
meta.push($cb.attr('title'));
}
else if(param.toUpperCase() == 'TYPE') {
@ -807,7 +807,7 @@ OC.Contacts = OC.Contacts || {};
$property.find('select.type[name="parameters[TYPE][]"]')
.combobox({
singleclick: true,
classes: ['propertytype', 'float', 'label'],
classes: ['propertytype', 'float', 'label']
});
}
$list.append($property);
@ -825,13 +825,13 @@ OC.Contacts = OC.Contacts || {};
this.showActions(['close', 'add', 'export', 'delete']);
}
return this.$fullelem;
}
};
Contact.prototype.isEditable = function() {
return ((this.access.owner === OC.currentUser)
|| (this.access.permissions & OC.PERMISSION_UPDATE
|| this.access.permissions & OC.PERMISSION_DELETE));
}
};
/**
* Render a simple property. Used for EMAIL and TEL.
@ -846,7 +846,7 @@ OC.Contacts = OC.Contacts || {};
? { value: property.value, checksum: property.checksum }
: { value: '', checksum: 'new' };
return this.detailTemplates[name].octemplate(values);
}
};
/**
* Render an ADR (address) property.
@ -874,7 +874,7 @@ OC.Contacts = OC.Contacts || {};
adr4: property.value[4] || '',
adr5: property.value[5] || '',
adr6: property.value[6] || '',
idx: idx,
idx: idx
}
: {value:'', checksum:'new', adr0:'', adr1:'', adr2:'', adr3:'', adr4:'', adr5:'', adr6:'', idx: idx};
var $elem = this.detailTemplates['adr'].octemplate(values);
@ -898,7 +898,7 @@ OC.Contacts = OC.Contacts || {};
$('body').unbind('click', bodyListener);
});
}
}
};
$viewer.slideUp();
$editor.toggle('blind', function() {
$('body').bind('click', bodyListener);
@ -923,7 +923,7 @@ OC.Contacts = OC.Contacts || {};
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name,
country: item.countryName
}
};
}));
}
});
@ -933,7 +933,7 @@ OC.Contacts = OC.Contacts || {};
if(ui.item && $elem.find('.value.country').val().trim().length == 0) {
$elem.find('.value.country').val(ui.item.country);
}
},
}
});
$elem.find('.value.country')
.autocomplete({
@ -955,15 +955,15 @@ OC.Contacts = OC.Contacts || {};
return {
label: item.name,
value: item.name
}
};
}));
}
});
},
minLength: 2,
minLength: 2
});
return $elem;
}
};
/**
* Render an IMPP (Instant Messaging) property.
@ -976,10 +976,10 @@ OC.Contacts = OC.Contacts || {};
}
var values = property ? {
value: property.value,
checksum: property.checksum,
checksum: property.checksum
} : {value: '', checksum: 'new'};
return this.detailTemplates['impp'].octemplate(values);
}
};
/**
* Render the PHOTO property.
@ -992,7 +992,7 @@ OC.Contacts = OC.Contacts || {};
this.$photowrapper.addClass('loading').addClass('wait');
var $phototools = this.$fullelem.find('#phototools');
delete this.photo;
$('img.contactphoto').remove()
$('img.contactphoto').remove();
this.photo = new Image();
$(this.photo).load(function () {
$(this).addClass('contactphoto');
@ -1021,17 +1021,17 @@ OC.Contacts = OC.Contacts || {};
$phototools.find('.edit').on('click', function() {
$(document).trigger('request.edit.contactphoto', {
id: self.id,
id: self.id
});
});
$phototools.find('.cloud').on('click', function() {
$(document).trigger('request.select.contactphoto.fromcloud', {
id: self.id,
id: self.id
});
});
$phototools.find('.upload').on('click', function() {
$(document).trigger('request.select.contactphoto.fromlocal', {
id: self.id,
id: self.id
});
});
if(this.data && this.data.PHOTO) {
@ -1048,7 +1048,7 @@ OC.Contacts = OC.Contacts || {};
.css('background', 'url(' + OC.filePath('', '', 'remote.php')+'/contactthumbnail?id='+self.id+refreshstr + ')');
});
}
}
};
/**
* Get the jquery element associated with this object
@ -1058,7 +1058,7 @@ OC.Contacts = OC.Contacts || {};
this.renderListItem();
}
return this.$listelem;
}
};
/**
* Get the preferred value for a property.
@ -1088,7 +1088,7 @@ OC.Contacts = OC.Contacts || {};
});
}
return pref;
}
};
/**
* Returns true/false depending on the contact being in the
@ -1106,9 +1106,9 @@ OC.Contacts = OC.Contacts || {};
if(typeof categories[i] === 'string' && (name.toLowerCase() === categories[i].toLowerCase())) {
return true;
}
};
}
return false;
}
};
/**
* Add this contact to a group
@ -1117,7 +1117,7 @@ OC.Contacts = OC.Contacts || {};
Contact.prototype.addToGroup = function(name) {
console.log('addToGroup', name);
if(!this.data.CATEGORIES) {
this.data.CATEGORIES = [{value:[name]},];
this.data.CATEGORIES = [{value:[name]}];
} else {
if(this.inGroup(name)) {
return;
@ -1129,7 +1129,7 @@ OC.Contacts = OC.Contacts || {};
}
}
this.saveProperty({name:'CATEGORIES', value:this.data.CATEGORIES[0].value.join(',') });
}
};
/**
* Remove this contact to a group
@ -1160,7 +1160,7 @@ OC.Contacts = OC.Contacts || {};
}
}
this.saveProperty({name:'CATEGORIES', value:this.data.CATEGORIES[0].value.join(',') });
}
};
Contact.prototype.setCurrent = function(on) {
if(on) {
@ -1171,9 +1171,9 @@ OC.Contacts = OC.Contacts || {};
$(document).trigger('status.contact.currentlistitem', {
id: this.id,
pos: Math.round(this.$listelem.position().top),
height: Math.round(this.$listelem.height()),
height: Math.round(this.$listelem.height())
});
}
};
Contact.prototype.next = function() {
var $next = this.$listelem.next('tr');
@ -1183,10 +1183,10 @@ OC.Contacts = OC.Contacts || {};
$(document).trigger('status.contact.currentlistitem', {
id: parseInt($next.data('id')),
pos: Math.round($next.position().top),
height: Math.round($next.height()),
height: Math.round($next.height())
});
}
}
};
Contact.prototype.prev = function() {
var $prev = this.$listelem.prev('tr');
@ -1196,10 +1196,10 @@ OC.Contacts = OC.Contacts || {};
$(document).trigger('status.contact.currentlistitem', {
id: parseInt($prev.data('id')),
pos: Math.round($prev.position().top),
height: Math.round($prev.height()),
height: Math.round($prev.height())
});
}
}
};
var ContactList = function(contactlist, contactlistitemtemplate, contactfulltemplate, contactdetailtemplates) {
//console.log('ContactList', contactlist, contactlistitemtemplate, contactfulltemplate, contactdetailtemplates);
@ -1221,7 +1221,7 @@ OC.Contacts = OC.Contacts || {};
$(document).bind('status.contact.renamed', function(e, data) {
self.insertContact(data.contact.getListItemElement().detach());
});
}
};
/**
* Show/hide contacts belonging to an addressbook.
@ -1239,7 +1239,7 @@ OC.Contacts = OC.Contacts || {};
this.contacts[contact].getListItemElement().hide();
}
}
}
};
/**
* Show/hide contacts belonging to shared addressbooks.
@ -1256,7 +1256,7 @@ OC.Contacts = OC.Contacts || {};
}
}
}
}
};
/**
* Show contacts in list
@ -1281,7 +1281,7 @@ OC.Contacts = OC.Contacts || {};
this.contacts[contact].getListItemElement().show();
}
}
}
};
ContactList.prototype.contactPos = function(id) {
if(!id) {
@ -1291,15 +1291,15 @@ OC.Contacts = OC.Contacts || {};
var $elem = this.contacts[parseInt(id)].getListItemElement();
var pos = $elem.offset().top - this.$contactList.offset().top + this.$contactList.scrollTop();
return pos;
}
};
ContactList.prototype.hideContact = function(id) {
this.contacts[parseInt(id)].hide();
}
};
ContactList.prototype.closeContact = function(id) {
this.contacts[parseInt(id)].close();
}
};
/**
* Returns a Contact object by searching for its id
@ -1321,7 +1321,7 @@ OC.Contacts = OC.Contacts || {};
} else if(utils.isArray(id)) {
$.extend(this.deletionQueue, id);
} else {
throw { name: 'WrongParameterType', message: 'ContactList.delayedDelete only accept integers or arrays.'}
throw { name: 'WrongParameterType', message: 'ContactList.delayedDelete only accept integers or arrays.'};
}
$.each(this.deletionQueue, function(idx, id) {
self.contacts[id].detach().setChecked(false);
@ -1335,7 +1335,7 @@ OC.Contacts = OC.Contacts || {};
e.returnValue = String(warn);
}
return warn;
}
};
}
if(this.$contactList.find('tr:visible').length === 0) {
$(document).trigger('status.visiblecontacts');
@ -1359,7 +1359,7 @@ OC.Contacts = OC.Contacts || {};
window.onbeforeunload = null;
}
});
}
};
/**
* Delete a contact with this id
@ -1388,7 +1388,7 @@ OC.Contacts = OC.Contacts || {};
if(response.status === 'success') {
delete self.contacts[id];
$(document).trigger('status.contact.deleted', {
id: id,
id: id
});
self.length -= 1;
if(self.length === 0) {
@ -1398,7 +1398,7 @@ OC.Contacts = OC.Contacts || {};
OC.notify({message:response.message});
}
});
}
};
/**
* Opens the contact with this id in edit mode
@ -1408,7 +1408,7 @@ OC.Contacts = OC.Contacts || {};
ContactList.prototype.showContact = function(id, props) {
console.assert(typeof id === 'number', 'ContactList.showContact called with a non-number');
this.currentContact = id;
console.log('Contacts.showContact', id, this.contacts[this.currentContact], this.contacts)
console.log('Contacts.showContact', id, this.contacts[this.currentContact], this.contacts);
return this.contacts[this.currentContact].renderContact(props);
};
@ -1422,10 +1422,10 @@ OC.Contacts = OC.Contacts || {};
revert: 'invalid',
//containment: '#content',
opacity: 0.8, helper: 'clone',
zIndex: 1000,
zIndex: 1000
});
var name = $contact.find('.nametext').text().toLowerCase();
var added = false
var added = false;
this.$contactList.find('tr').each(function() {
if ($(this).find('.nametext').text().toLowerCase().localeCompare(name) > 0) {
$(this).before($contact);
@ -1438,7 +1438,7 @@ OC.Contacts = OC.Contacts || {};
}
$contact.show();
return $contact;
}
};
/**
* Add contact
@ -1459,7 +1459,7 @@ OC.Contacts = OC.Contacts || {};
this.contacts[this.currentContact].close();
}
return contact.renderContact(props);
}
};
/**
* Get contacts selected in list
@ -1473,7 +1473,7 @@ OC.Contacts = OC.Contacts || {};
contacts.push(parseInt($(b).parents('tr').first().data('id')));
});
return contacts;
}
};
ContactList.prototype.setCurrent = function(id, deselect_other) {
self = this;
@ -1483,7 +1483,7 @@ OC.Contacts = OC.Contacts || {};
});
}
this.contacts[parseInt(id)].setCurrent(true);
}
};
// Should only be neccesary with progressive loading, but it's damn fast, so... ;)
ContactList.prototype.doSort = function() {
@ -1497,7 +1497,7 @@ OC.Contacts = OC.Contacts || {};
$.each(rows, function(index, row) {
self.$contactList.append(row);
});
}
};
/**
* Save addressbook data
@ -1505,8 +1505,8 @@ OC.Contacts = OC.Contacts || {};
*/
ContactList.prototype.unsetAddressbook = function(id) {
delete this.addressbooks[id];
}
};
/**
* Save addressbook data
* @param object book
@ -1519,9 +1519,9 @@ OC.Contacts = OC.Contacts || {};
id: parseInt(book.id),
displayname: book.displayname,
description: book.description,
active: Boolean(parseInt(book.active)),
active: Boolean(parseInt(book.active))
};
}
};
/**
* Load contacts
* @param int offset

View File

@ -75,7 +75,7 @@ Contacts_Import={
}
});
}
}
};
var openContact = function(id) {
if(typeof OC.Contacts !== 'undefined') {
@ -83,7 +83,7 @@ var openContact = function(id) {
} else {
window.location.href = OC.linkTo('contacts', 'index.php') + '?id=' + id;
}
}
};
$(document).ready(function(){
if(typeof FileActions !== 'undefined'){
@ -91,5 +91,5 @@ $(document).ready(function(){
FileActions.setDefault('text/vcard','importaddressbook');
FileActions.register('text/x-vcard','importaddressbook', OC.PERMISSION_READ, '', Contacts_Import.importdialog);
FileActions.setDefault('text/x-vcard','importaddressbook');
};
}
});

View File

@ -1,14 +1,14 @@
/**
* @param 'createCallback' A function to be called when a new entry is created. Two arguments are supplied to this function:
* The select element used and the value of the option. If the function returns false addition will be cancelled. If it returns
* anything else it will be used as the value of the newly added option.
* anything else it will be used as the value of the newly added option.
* @param 'createText' The placeholder text for the create action.
* @param 'title' The title to show if no options are selected.
* @param 'checked' An array containing values for options that should be checked. Any options which are already selected will be added to this array.
* @param 'labels' The corresponding labels to show for the checked items.
* @param 'oncheck' Callback function which will be called when a checkbox/radiobutton is selected. If the function returns false the input will be unchecked.
* @param 'onuncheck' @see 'oncheck'.
* @param 'singleSelect' If true radiobuttons will be used instead of checkboxes.
* @param 'singleSelect' If true radiobuttons will be used instead of checkboxes.
*/
(function( $ ){
var multiSelectId=-1;
@ -23,7 +23,7 @@
'labels':[],
'oncheck':false,
'onuncheck':false,
'minWidth': 'default;',
'minWidth': 'default;'
};
$(this).attr('data-msid', multiSelectId);
$.extend(settings,options);
@ -62,7 +62,7 @@
var self = this;
self.menuDirection = 'down';
button.click(function(event){
var button=$(this);
if(button.parent().children('ul').length>0) {
if(self.menuDirection === 'down') {
@ -146,7 +146,7 @@
settings.labels.splice(index,1);
}
var oldWidth=button.width();
button.children('span').first().text(settings.labels.length > 0
button.children('span').first().text(settings.labels.length > 0
? settings.labels.join(', ')
: settings.title);
var newOuterWidth=Math.max((button.outerWidth()-2),settings.minOuterWidth)+'px';
@ -193,7 +193,7 @@
return false;
}
var li=$(this).parent();
var val = $(this).val()
var val = $(this).val();
var select=button.parent().next();
if(typeof settings.createCallback === 'function') {
var response = settings.createCallback(select, val);
@ -217,7 +217,7 @@
select.append(option);
li.prev().children('input').prop('checked', true).trigger('change');
button.parent().data('preventHide',false);
button.children('span').first().text(settings.labels.length > 0
button.children('span').first().text(settings.labels.length > 0
? settings.labels.join(', ')
: settings.title);
if(self.menuDirection === 'up') {
@ -276,7 +276,7 @@
}
}
});
return span;
};
})( jQuery );