mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
first commit for sharing dialog
This commit is contained in:
@@ -7,6 +7,7 @@ return [
|
|||||||
'routes' => [
|
'routes' => [
|
||||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||||
['name' => 'note_api#preflighted_cors', 'url' => '/api/0.1/{path}',
|
['name' => 'note_api#preflighted_cors', 'url' => '/api/0.1/{path}',
|
||||||
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']]
|
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']],
|
||||||
|
['name' => 'note#get_user_groups_and_users', 'url' => '/api/0.1/getusergroups', 'verb' => 'GET']
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@@ -14,6 +14,7 @@ namespace OCA\QuickNotes\Controller;
|
|||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
|
||||||
use OCA\QuickNotes\Db\Note;
|
use OCA\QuickNotes\Db\Note;
|
||||||
@@ -190,4 +191,24 @@ class NoteController extends Controller {
|
|||||||
|
|
||||||
return new DataResponse($note);
|
return new DataResponse($note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*/
|
||||||
|
public function getUserGroupsAndUsers() {
|
||||||
|
$userMgr = \OC::$server->getUserManager();
|
||||||
|
$grpMgr = \OC::$server->getGroupManager();
|
||||||
|
$igroups = $grpMgr->getUserGroups($userMgr->get($this->userId));
|
||||||
|
$users = array();
|
||||||
|
$groups = array();
|
||||||
|
foreach($igroups as $g) {
|
||||||
|
$iusers = $g->getUsers();
|
||||||
|
foreach($iusers as $u) {
|
||||||
|
$users[] = $u->getUID();
|
||||||
|
}
|
||||||
|
$groups[] = $g->getGID();
|
||||||
|
}
|
||||||
|
$params = array('groups' => $groups, 'users' => array_unique($users));
|
||||||
|
return new JSONResponse($params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
top: 6px;
|
top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.save-button #unshare-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
#div-content .save-button {
|
#div-content .save-button {
|
||||||
float: right;
|
float: right;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
|
|||||||
17
js/script.js
17
js/script.js
@@ -162,6 +162,13 @@ View.prototype = {
|
|||||||
var modalnote = $("#modal-note-div .quicknote");
|
var modalnote = $("#modal-note-div .quicknote");
|
||||||
|
|
||||||
var note = $('.notes-grid [data-id=' + id + ']').parent();
|
var note = $('.notes-grid [data-id=' + id + ']').parent();
|
||||||
|
if($('.notes-grid [data-id=' + id + ']').hasClass('shareowner')) {
|
||||||
|
$('.save-button #unshare-button').show();
|
||||||
|
$('.save-button #share-button').hide();
|
||||||
|
} else {
|
||||||
|
$('.save-button #unshare-button').hide();
|
||||||
|
$('.save-button #share-button').show();
|
||||||
|
}
|
||||||
|
|
||||||
var title = note.find("#title-editable").html();
|
var title = note.find("#title-editable").html();
|
||||||
var content = note.find("#content-editable").html();
|
var content = note.find("#content-editable").html();
|
||||||
@@ -336,6 +343,16 @@ View.prototype = {
|
|||||||
modalnote.css("background-color", color);
|
modalnote.css("background-color", color);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// handle share editing notes.
|
||||||
|
$('#modal-note-div #share-button').click(function (event) {
|
||||||
|
$.get(OC.generateUrl('/apps/quicknotes/api/0.1/getusergroups'), function(data) {
|
||||||
|
var groups = data.groups;
|
||||||
|
var users = data.users;
|
||||||
|
alert('groups: ' + groups.toSource());
|
||||||
|
alert('users: ' + users.toSource());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// handle cancel editing notes.
|
// handle cancel editing notes.
|
||||||
$('#modal-note-div #cancel-button').click(function (event) {
|
$('#modal-note-div #cancel-button').click(function (event) {
|
||||||
self.cancelEdit();
|
self.cancelEdit();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<div contenteditable="true" id='content-editable' class='note-content' data-placeholder="No content"></div>
|
<div contenteditable="true" id='content-editable' class='note-content' data-placeholder="No content"></div>
|
||||||
<div class="note-options">
|
<div class="note-options">
|
||||||
<div class="save-button">
|
<div class="save-button">
|
||||||
|
<button id='unshare-button'><?php p($l->t('Unshare'));?></button>
|
||||||
<button id='share-button'><?php p($l->t('Share'));?></button>
|
<button id='share-button'><?php p($l->t('Share'));?></button>
|
||||||
<button id='cancel-button'><?php p($l->t('Cancel')); ?></button>
|
<button id='cancel-button'><?php p($l->t('Cancel')); ?></button>
|
||||||
<button id='save-button'><?php p($l->t('Save')); ?></button>
|
<button id='save-button'><?php p($l->t('Save')); ?></button>
|
||||||
@@ -21,6 +22,9 @@
|
|||||||
<a href="#" class="circle-toolbar" style="background-color: #C1D756"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #C1D756"></a>
|
||||||
<a href="#" class="circle-toolbar" style="background-color: #CECECE"></a>
|
<a href="#" class="circle-toolbar" style="background-color: #CECECE"></a>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="note-share-options">
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user