pull/1/head
Victor Dubiniuk 11 years ago
parent 78ba2cabe1
commit 8aee613fca

@ -14,33 +14,6 @@ namespace OCA\Documents;
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
*/

@ -83,8 +83,3 @@ $this->create('documents_user_invite', 'ajax/user/invite')
->post()
->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;
}
#odf-toolbar #dropdown{
right:auto;
}
#document-title{
position: absolute;
top: 9px;

@ -15,20 +15,13 @@ var documentsMain = {
' <button id="odf-close">' +
t('documents', 'Close') +
' </button>' +
'<div id="document-title"><div>' +
' <div id="document-title"><div>' +
'%title%' +
'</div></div>' +
' <button id="odf-invite">' +
t('documents', 'Share') +
' </div></div>' +
' <button id="odf-invite" class="drop">' +
t('documents', 'Share') +
' </button>' +
' <div id="invite-block" style="display:none">' +
' <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>' +
' <span id="toolbar" class="claro"></span>' +
'</div>',
/* Editor wrapper HTML */
@ -68,6 +61,8 @@ var documentsMain = {
$(document.body).prepend(documentsMain.UI.toolbar.replace(/%title%/g, title));
if (!canShare){
$('#odf-invite,#invite-block').remove();
} else {
//TODO: fill in with users
}
$(document.body).addClass("claro");
$(document.body).prepend(documentsMain.UI.container);
@ -189,38 +184,11 @@ var documentsMain = {
onInvite: function(event) {
event.preventDefault();
$('#invite-block').toggle();
$('#inivite-input').autocomplete({
minLength: 1,
source: function(search, response) {
$.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);
}
});
if (OC.Share.droppedDown) {
OC.Share.hideDropDown();
} else {
OC.Share.showDropDown('file', 118, $("#odf-toolbar"), true, OC.PERMISSION_READ | OC.PERMISSION_SHARE | OC.PERMISSION_UPDATE);
}
},
sendInvite: function() {
@ -344,11 +312,7 @@ $(document).ready(function() {
$(document.body).on('click', '#odf-close', documentsMain.onClose);
$(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);
var file_upload_start = $('#file_upload_start');

Loading…
Cancel
Save