[Owncloud] [Contacts] Hack for sorting by last name

Andreas Borutta borumat at gmx.de
Thu Aug 1 11:32:59 UTC 2013


Thomas Tanghus schrieb:

> On Wednesday 31 July 2013 13:02 Andreas Borutta wrote:
>> Hi.
>> 
>> In version 5.0.9 it's not possible to sort by last name.
>> When I got it, that feature should arive in version 6.
>> 
>> Because sorting by last name is important for me:
>> Do you know a working hack of config files to realize that sorting
>> now?
>> 
>> There's an old post with a suggestion for an older version of OC:
>> http://forum.owncloud.org/viewtopic.php?f=4&t=6755
>> 
>> But I'm not a programmer and do not know which code has to be
>> replaced.
>> 
>> If anyone could give me a hint ...?
> 
> You could change getDisplayName() at 
> https://github.com/owncloud/apps/blob/stable5/contacts/js/contacts.js#L29
> to return the values from the N property instead of the FN property.

Thanks for your hint Thomas.

I changed:

***
Contact.prototype.getDisplayName = function() {
		return this.getPreferredValue('FN') || this.getPreferredValue('ORG',
[]).clean('').join(', ') || this.getPreferredValue('EMAIL');
	};
***

to

***
Contact.prototype.getDisplayName = function() {
		return this.getPreferredValue('N') || this.getPreferredValue('ORG',
[]).clean('').join(', ') || this.getPreferredValue('EMAIL');
	};
***

> Both are explained here: https://tools.ietf.org/html/rfc2426#section-3.1
> 
> The N property is an array btw.
> 
> getDisplayName() could return something like:
> 
> this.getPreferredValue('N', [this.getPreferredValue('FN','')])
>   .slice(0, 2).join(', ');

Where please do I have to place that code?


Andreas
-- 
http://borumat.de
http://fahrradzukunft.de




More information about the Owncloud mailing list