1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

admin manage repo share

This commit is contained in:
lian
2016-08-03 18:17:24 +08:00
committed by lian
parent c4ffca620e
commit 92df1ef8d2
12 changed files with 1523 additions and 3 deletions

View File

@@ -141,6 +141,7 @@ define([
// Group
case 'groups': return siteRoot + 'api/v2.1/groups/';
case 'search_group': return siteRoot + 'api/v2.1/search-group/';
case 'group': return siteRoot + 'api/v2.1/groups/' + options.group_id + '/';
case 'group_members': return siteRoot + 'api/v2.1/groups/' + options.group_id + '/members/';
case 'group_member': return siteRoot + 'api/v2.1/groups/' + options.group_id + '/members/' + options.email + '/';
@@ -180,6 +181,10 @@ define([
case 'admin-system-library': return siteRoot + 'api/v2.1/admin/system-library/';
case 'admin-trash-libraries': return siteRoot + 'api/v2.1/admin/trash-libraries/';
case 'admin-trash-library': return siteRoot + 'api/v2.1/admin/trash-libraries/' + options.repo_id + '/';
case 'admin_library_user_shares': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/user-shares/';
case 'admin_library_user_share': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/user-share/';
case 'admin_library_group_shares': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/group-shares/';
case 'admin_library_group_share': return siteRoot + 'api/v2.1/admin/libraries/' + options.repo_id + '/group-share/';
}
},
@@ -634,6 +639,73 @@ define([
}
},
groupInputOptionsForSelect2: function() {
var _this = this;
return {
placeholder: gettext("Search groups"),
// with 'tags', the user can directly enter, not just select
// tags need `<input type="hidden" />`, not `<select>`
tags: [],
minimumInputLength: 1, // input at least 1 character
formatInputTooShort: gettext("Please enter 1 or more character"),
formatNoMatches: gettext("No matches"),
formatSearching: gettext("Searching..."),
formatAjaxError: gettext("Loading failed"),
ajax: {
url: _this.getUrl({name: 'search_group'}),
dataType: 'json',
delay: 250,
cache: true,
data: function(params) {
return {
q: params
};
},
results: function(data) {
var group_list = [], groups = data;
for (var i = 0, len = groups.length; i < len; i++) {
group_list.push({ // 'id' & 'text' are required by the plugin
"id": groups[i].id,
"text": groups[i].name,
"name": groups[i].name
});
}
return {
results: group_list
};
}
},
// format items shown in the drop-down menu
formatResult: function(item) {
if (item.name) {
return '<span class="text ellipsis">' + _this.HTMLescape(item.name) + '</span>';
} else {
return; // if no match, show nothing
}
},
// format selected item shown in the input
formatSelection: function(item) {
return _this.HTMLescape(item.name || item.id); // if no name, show the email, i.e., when directly input, show the email
},
createSearchChoice: function(term) {
return {
'id': $.trim(term)
};
},
escapeMarkup: function(m) { return m; }
}
},
// check if a file is an image
imageCheck: function (filename) {
// no file ext