1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

add cloud address book function

This commit is contained in:
lian
2015-06-10 18:42:10 +08:00
parent 8dfa6550db
commit 747b477a1f
4 changed files with 125 additions and 19 deletions

View File

@@ -112,6 +112,7 @@ define([
case 'set_group_folder_perm': return siteRoot + 'ajax/repo/' + options.repo_id + '/set-group-folder-perm/';
case 'starred_files': return siteRoot + 'api2/starredfiles/';
case 'shared_repos': return siteRoot + 'api2/shared-repos/' + options.repo_id + '/';
case 'search_user': return siteRoot + 'api2/search-user/';
}
},
@@ -509,23 +510,39 @@ define([
// with 'tags', the user can directly enter, not just select
// tags need `<input type="hidden" />`, not `<select>`
tags: function () {
var contacts = app.pageOptions.contacts || [];
var contact_list = [];
for (var i = 0, len = contacts.length; i < len; i++) {
contact_list.push({ // 'id' & 'text' are required by the plugin
"id": contacts[i].email,
// for search. both name & email can be searched.
// use ' '(space) to separate name & email
"text": contacts[i].name + ' ' + contacts[i].email,
"avatar": contacts[i].avatar,
"name": contacts[i].name
});
}
return contact_list;
},
tags: true,
tokenSeparators: [',', ' '],
tokenSeparators: [",", " "],
ajax: {
url: _this.getUrl({name: 'search_user'}),
dataType: 'json',
delay: 250,
cache: true,
data: function (params) {
return {
q: params
};
},
results: function (data) {
var user_list = [], users = data['users'];
for (var i = 0, len = users.length; i < len; i++) {
user_list.push({ // 'id' & 'text' are required by the plugin
"id": users[i].email,
// for search. both name & email can be searched.
// use ' '(space) to separate name & email
"text": users[i].name + ' ' + users[i].email,
"avatar": users[i].avatar,
"name": users[i].name
});
}
return {
results: user_list
};
}
},
// format items shown in the drop-down menu
formatResult: function(item) {