Sharing
This commit is contained in:
parent
78ba2cabe1
commit
8aee613fca
@ -14,33 +14,6 @@ namespace OCA\Documents;
|
|||||||
|
|
||||||
class UserController extends Controller{
|
class UserController extends Controller{
|
||||||
|
|
||||||
/**
|
|
||||||
* Search users according to the pattern
|
|
||||||
*/
|
|
||||||
public static function search(){
|
|
||||||
$uid = self::preDispatch();
|
|
||||||
if (@$_GET['search']){
|
|
||||||
$found = array();
|
|
||||||
$users = array();
|
|
||||||
$count = 0;
|
|
||||||
$limit = 0;
|
|
||||||
$offset = 0;
|
|
||||||
while ($count < 15 && count($users) == $limit) {
|
|
||||||
$limit = 15 - $count;
|
|
||||||
$users = \OC_User::getDisplayNames($_GET['search'], $limit, $offset);
|
|
||||||
$offset += $limit;
|
|
||||||
foreach ($users as $userid => $displayName) {
|
|
||||||
$found[] = array(
|
|
||||||
'label' => $displayName,
|
|
||||||
'value' => $userid
|
|
||||||
);
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
\OCP\JSON::success(array('data'=>$found));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invite users to the editing session
|
* Invite users to the editing session
|
||||||
*/
|
*/
|
||||||
|
@ -83,8 +83,3 @@ $this->create('documents_user_invite', 'ajax/user/invite')
|
|||||||
->post()
|
->post()
|
||||||
->action('\OCA\Documents\UserController', 'invite')
|
->action('\OCA\Documents\UserController', 'invite')
|
||||||
;
|
;
|
||||||
|
|
||||||
$this->create('documents_user_search', 'ajax/user/search')
|
|
||||||
->get()
|
|
||||||
->action('\OCA\Documents\UserController', 'search')
|
|
||||||
;
|
|
||||||
|
@ -92,6 +92,10 @@
|
|||||||
z-index: 500;
|
z-index: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#odf-toolbar #dropdown{
|
||||||
|
right:auto;
|
||||||
|
}
|
||||||
|
|
||||||
#document-title{
|
#document-title{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 9px;
|
top: 9px;
|
||||||
|
@ -15,20 +15,13 @@ var documentsMain = {
|
|||||||
' <button id="odf-close">' +
|
' <button id="odf-close">' +
|
||||||
t('documents', 'Close') +
|
t('documents', 'Close') +
|
||||||
' </button>' +
|
' </button>' +
|
||||||
'<div id="document-title"><div>' +
|
' <div id="document-title"><div>' +
|
||||||
'%title%' +
|
'%title%' +
|
||||||
'</div></div>' +
|
' </div></div>' +
|
||||||
' <button id="odf-invite">' +
|
' <button id="odf-invite" class="drop">' +
|
||||||
t('documents', 'Share') +
|
t('documents', 'Share') +
|
||||||
' </button>' +
|
' </button>' +
|
||||||
' <div id="invite-block" style="display:none">' +
|
' <span id="toolbar" class="claro"></span>' +
|
||||||
' <input id="inivite-input" type="text" />' +
|
|
||||||
' <ul id="invitee-list"></ul>' +
|
|
||||||
' <button id="invite-send">' +
|
|
||||||
t('documents', 'Send Invitation') +
|
|
||||||
' </button>' +
|
|
||||||
' </div>' +
|
|
||||||
' <span id="toolbar" class="claro"></span>' +
|
|
||||||
'</div>',
|
'</div>',
|
||||||
|
|
||||||
/* Editor wrapper HTML */
|
/* Editor wrapper HTML */
|
||||||
@ -68,6 +61,8 @@ var documentsMain = {
|
|||||||
$(document.body).prepend(documentsMain.UI.toolbar.replace(/%title%/g, title));
|
$(document.body).prepend(documentsMain.UI.toolbar.replace(/%title%/g, title));
|
||||||
if (!canShare){
|
if (!canShare){
|
||||||
$('#odf-invite,#invite-block').remove();
|
$('#odf-invite,#invite-block').remove();
|
||||||
|
} else {
|
||||||
|
//TODO: fill in with users
|
||||||
}
|
}
|
||||||
$(document.body).addClass("claro");
|
$(document.body).addClass("claro");
|
||||||
$(document.body).prepend(documentsMain.UI.container);
|
$(document.body).prepend(documentsMain.UI.container);
|
||||||
@ -189,38 +184,11 @@ var documentsMain = {
|
|||||||
|
|
||||||
onInvite: function(event) {
|
onInvite: function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$('#invite-block').toggle();
|
if (OC.Share.droppedDown) {
|
||||||
$('#inivite-input').autocomplete({
|
OC.Share.hideDropDown();
|
||||||
minLength: 1,
|
} else {
|
||||||
source: function(search, response) {
|
OC.Share.showDropDown('file', 118, $("#odf-toolbar"), true, OC.PERMISSION_READ | OC.PERMISSION_SHARE | OC.PERMISSION_UPDATE);
|
||||||
$.get(
|
}
|
||||||
OC.Router.generate('documents_user_search'),
|
|
||||||
{search: $('#inivite-input').val()},
|
|
||||||
function(result) {
|
|
||||||
if (result.status === 'success' && result.data.length > 0) {
|
|
||||||
response(result.data);
|
|
||||||
} else {
|
|
||||||
response([t('core', 'No people found')]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
select: function(event, el) {
|
|
||||||
event.preventDefault();
|
|
||||||
var item = $(
|
|
||||||
'<li title="'
|
|
||||||
+ t('documents', 'Remove from the list')
|
|
||||||
+ '" >'
|
|
||||||
+ el.item.label
|
|
||||||
+ '<input type="hidden" name="invitee[]" value="'
|
|
||||||
+ el.item.value
|
|
||||||
+ '" />'
|
|
||||||
+ '</li>'
|
|
||||||
);
|
|
||||||
$('#inivite-input').val('');
|
|
||||||
$('#invitee-list').prepend(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sendInvite: function() {
|
sendInvite: function() {
|
||||||
@ -344,11 +312,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$(document.body).on('click', '#odf-close', documentsMain.onClose);
|
$(document.body).on('click', '#odf-close', documentsMain.onClose);
|
||||||
$(document.body).on('click', '#odf-invite', documentsMain.onInvite);
|
$(document.body).on('click', '#odf-invite', documentsMain.onInvite);
|
||||||
$(document.body).on('click', '#invite-send', documentsMain.sendInvite);
|
|
||||||
$(document.body).on('click', '#invitee-list li', function(){
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.add-document').on('click', '.add', documentsMain.onCreate);
|
$('.add-document').on('click', '.add', documentsMain.onCreate);
|
||||||
|
|
||||||
var file_upload_start = $('#file_upload_start');
|
var file_upload_start = $('#file_upload_start');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user