Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-04-13 21:28:28 +0300
committerJulius Härtl <jus@bitgrid.net>2019-04-13 21:28:28 +0300
commit1bdb0ff3eaa0f8a874bbf306ca5fe8a45f8e6ff4 (patch)
tree69363d95e38dc7b02a55c4e2cf3a9149f75cbb46 /appinfo
parent66adbbbe655ef62f1545a39c2bf31630455af8da (diff)
Add first working version of collaborative editing
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/app.php12
-rw-r--r--appinfo/database.xml148
-rw-r--r--appinfo/info.xml4
-rw-r--r--appinfo/routes.php13
4 files changed, 172 insertions, 5 deletions
diff --git a/appinfo/app.php b/appinfo/app.php
index e29799f72..7c15d6096 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -4,3 +4,15 @@ declare(strict_types=1);
namespace OCA\Text\AppInfo;
+$eventDispatcher = \OC::$server->getEventDispatcher();
+
+// only load text editor if the user is logged in
+if (\OC::$server->getUserSession()->isLoggedIn()) {
+ $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function () {
+ \OCP\Util::addScript('text', 'files');
+ });
+}
+
+$eventDispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () {
+ // load public stuff
+});
diff --git a/appinfo/database.xml b/appinfo/database.xml
new file mode 100644
index 000000000..cbb2019c7
--- /dev/null
+++ b/appinfo/database.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<database>
+ <name>*dbname*</name>
+ <create>true</create>
+ <overwrite>false</overwrite>
+ <charset>utf8</charset>
+ <table>
+ <name>*dbprefix*text_documents</name>
+ <declaration>
+ <field>
+ <name>id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <autoincrement>1</autoincrement>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>current_version</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ <default>0</default>
+ </field>
+ <field>
+ <name>last_saved_version</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ <default>0</default>
+ </field>
+ </declaration>
+ </table>
+
+ <table>
+ <name>*dbprefix*text_sessions</name>
+ <declaration>
+ <field>
+ <name>id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <autoincrement>1</autoincrement>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>user_id</name>
+ <type>text</type>
+ <length>64</length>
+ </field>
+ <field>
+ <name>guest_name</name>
+ <type>text</type>
+ <length>64</length>
+ </field>
+ <field>
+ <name>color</name>
+ <type>text</type>
+ <length>64</length>
+ </field>
+ <field>
+ <name>token</name>
+ <type>text</type>
+ <length>64</length>
+ </field>
+ <field>
+ <name>document_id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <length>4</length>
+ </field>
+ <field>
+ <name>last_contact</name>
+ <type>integer</type>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+
+ <index>
+ <name>rd_session_token_idx</name>
+ <unique>false</unique>
+ <field>
+ <name>token</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>
+ </declaration>
+ </table>
+
+ <table>
+ <name>*dbprefix*text_steps</name>
+ <declaration>
+ <field>
+ <name>id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <autoincrement>1</autoincrement>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>document_id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>session_id</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>data</name>
+ <type>clob</type>
+ </field>
+ <field>
+ <name>version</name>
+ <type>integer</type>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ <default>0</default>
+ </field>
+
+ <index>
+ <name>rd_steps_did_idx</name>
+ <unique>false</unique>
+ <field>
+ <name>document_id</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>
+ <index>
+ <name>rd_steps_version_idx</name>
+ <unique>false</unique>
+ <field>
+ <name>version</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>
+ </declaration>
+ </table>
+</database>
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 68674d1f0..c7d6db71f 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,11 +5,11 @@
<name>Text</name>
<summary>Type together</summary>
<description>Collaborative text editor</description>
- <version>0.1.0-dev1</version>
+ <version>0.1.0-dev12</version>
<licence>agpl</licence>
<author mail="jus@bitgrid.net">Julius Härtl</author>
<namespace>Text</namespace>
- <category>type</category>
+ <category>office</category>
<website>https://github.com/nextcloud/text</website>
<bugs>https://github.com/nextcloud/text/issues</bugs>
<repository type="git">https://github.com/nextcloud/text.git</repository>
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 468b47616..ff8413314 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -7,11 +7,18 @@ return [
'routes' => [
['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'],
+ // Setup a new session
['name' => 'Session#create', 'url' => '/session/create', 'verb' => 'GET'],
- ['name' => 'Sync#sync', 'url' => '/session/sync', 'verb' => 'GET'],
- ['name' => 'Session#push', 'url' => '/session/push', 'verb' => 'GET'],
- ['name' => 'Session#get', 'url' => '/session/get', 'verb' => 'GET'],
+ // Load initial document
+ ['name' => 'Session#fetch', 'url' => '/session/fetch', 'verb' => 'GET'],
+ // Load steps
+ ['name' => 'Session#sync', 'url' => '/session/sync', 'verb' => 'GET'],
+ // Push own steps
+ ['name' => 'Session#push', 'url' => '/session/push', 'verb' => 'POST'],
+ // Close session
['name' => 'Session#close', 'url' => '/session/close', 'verb' => 'GET'],
+ //['name' => 'Session#get', 'url' => '/session/get', 'verb' => 'GET'],
+
]
];