mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
set sharing layout
This commit is contained in:
@@ -108,4 +108,38 @@
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
</database>
|
||||
<table>
|
||||
<name>*dbprefix*quicknotes_shares</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<unsigned>true</unsigned>
|
||||
<primary>true</primary>
|
||||
<length>8</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>note_id</name>
|
||||
<type>integer</type>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<unsigned>true</unsigned>
|
||||
<length>8</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>shared_user</name>
|
||||
<type>text</type>
|
||||
<length>200</length>
|
||||
<default></default>
|
||||
</field>
|
||||
<field>
|
||||
<name>shared_group</name>
|
||||
<type>text</type>
|
||||
<length>200</length>
|
||||
<default></default>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
</database>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<description>Quick notes with text, check lists and pictures</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Matias De lellis</author>
|
||||
<version>0.1.0</version>
|
||||
<version>0.1.1</version>
|
||||
<namespace>QuickNotes</namespace>
|
||||
<category>tool</category>
|
||||
<website>https://github.com/matiasdelellis</website>
|
||||
@@ -15,4 +15,4 @@
|
||||
<dependencies>
|
||||
<owncloud min-version="8.0" max-version="9.1"/>
|
||||
</dependencies>
|
||||
</info>
|
||||
</info>
|
||||
|
||||
22
db/share.php
Normal file
22
db/share.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace OCA\QuickNotes\Db;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
|
||||
class Share extends Entity implements JsonSerializable {
|
||||
|
||||
protected $noteId;
|
||||
protected $sharedUser;
|
||||
protected $sharedGroup;
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'note' => $this->noteId,
|
||||
'user' => $this->sharedUser,
|
||||
'group' => $this->sharedGroup
|
||||
];
|
||||
}
|
||||
}
|
||||
28
db/sharemapper.php
Normal file
28
db/sharemapper.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace OCA\QuickNotes\Db;
|
||||
|
||||
use OCP\IDb;
|
||||
use OCP\AppFramework\Db\Mapper;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
class ShareMapper extends Mapper {
|
||||
|
||||
public function __construct(IDb $db) {
|
||||
parent::__construct($db, 'quicknotes_notes', '\OCA\QuickNotes\Db\Share');
|
||||
}
|
||||
|
||||
/*public function find($id, $userId) {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE id = ? AND user_id = ?';
|
||||
return $this->findEntity($sql, [$id, $userId]);
|
||||
}*/
|
||||
|
||||
public function findForUser($userId) {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_user = ?';
|
||||
return $this->findEntities($sql, [$userId]);
|
||||
}
|
||||
|
||||
public function findForGroup($groupId) {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_group = ?';
|
||||
return $this->findEntities($sql, [$groupId]);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<div contenteditable="true" id='content-editable' class='note-content' data-placeholder="No content"></div>
|
||||
<div class="note-options">
|
||||
<div class="save-button">
|
||||
<button id='share-button' class='icon-share'><?php p($l->t('Share'));?></button>
|
||||
<button id='cancel-button'><?php p($l->t('Cancel')); ?></button>
|
||||
<button id='save-button'><?php p($l->t('Save')); ?></button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user