rename office -> documents
This commit is contained in:
parent
3e59604485
commit
7bc25ec0ce
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,7 +10,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Controller {
|
||||
|
||||
@ -23,8 +23,8 @@ class Controller {
|
||||
|
||||
$session = Session::getSession(@$args['es_id']);
|
||||
$filename = isset($session['genesis_url']) ? $session['genesis_url'] : '';
|
||||
$officeView = View::initOfficeView($session['owner']);
|
||||
$download = new Download($officeView, $filename);
|
||||
$documentsView = View::initDocumentsView($session['owner']);
|
||||
$download = new Download($documentsView, $filename);
|
||||
$download->sendResponse();
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class Controller {
|
||||
//If there is no existing session we need to start a new one
|
||||
if (!$session || empty($session)){
|
||||
|
||||
$officeView = View::initOfficeView($uid);
|
||||
$documentsView = View::initDocumentsView($uid);
|
||||
$genesisPath = View::storeDocument($uid, $path);
|
||||
|
||||
if (!$genesisPath){
|
||||
@ -173,7 +173,7 @@ class Controller {
|
||||
$invites = array();
|
||||
}
|
||||
|
||||
$tmpl = new \OCP\Template('office', 'part.sessions', '');
|
||||
$tmpl = new \OCP\Template('documents', 'part.sessions', '');
|
||||
$tmpl->assign('invites', $invites);
|
||||
$tmpl->assign('sessions', $sessions);
|
||||
echo $tmpl->fetchPage();
|
||||
|
@ -3,8 +3,8 @@
|
||||
// Init owncloud
|
||||
|
||||
\OCP\User::checkLoggedIn();
|
||||
\OCP\JSON::checkAppEnabled('office');
|
||||
\OCP\JSON::checkAppEnabled('documents');
|
||||
|
||||
$documents=\OCA\Office\Storage::getDocuments();
|
||||
$documents=\OCA\Documents\Storage::getDocuments();
|
||||
|
||||
OCP\JSON::success(array('documents' => $documents));
|
||||
|
@ -36,31 +36,31 @@
|
||||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('office');
|
||||
OCP\JSON::checkAppEnabled('documents');
|
||||
// session_write_close();
|
||||
|
||||
$response = array();
|
||||
try{
|
||||
$request = new OCA\Office\Request();
|
||||
$request = new OCA\Documents\Request();
|
||||
$command = $request->getParam('command');
|
||||
switch ($command){
|
||||
case 'query_memberdata_list':
|
||||
$esId = $request->getParam('args/es_id');
|
||||
$inactiveMembers = \OCA\Office\Member::cleanSession($esId);
|
||||
$inactiveMembers = \OCA\Documents\Member::cleanSession($esId);
|
||||
if (is_array($inactiveMembers)){
|
||||
foreach ($inactiveMembers as $member){
|
||||
\OCA\Office\Op::removeCursor($esId, $member['member_id']);
|
||||
\OCA\Documents\Op::removeCursor($esId, $member['member_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$ids = $request->getParam('args/member_ids');
|
||||
$members = OCA\Office\Member::getMembersAsArray($ids);
|
||||
$members = OCA\Documents\Member::getMembersAsArray($ids);
|
||||
$response["memberdata_list"] = array_map(
|
||||
function($x){
|
||||
$x['display_name'] = \OCP\User::getDisplayName($x['uid']);
|
||||
|
||||
// Stub
|
||||
$x['avatar_url'] = \OCP\Util::linkToRoute('office_user_avatar');
|
||||
$x['avatar_url'] = \OCP\Util::linkToRoute('documents_user_avatar');
|
||||
return $x;
|
||||
},
|
||||
$members
|
||||
@ -75,9 +75,9 @@ try{
|
||||
$ops = $request->getParam('args/client_ops');
|
||||
$hasOps = is_array($ops) && count($ops)>0;
|
||||
|
||||
$currentHead = OCA\Office\Op::getHeadSeq($esId);
|
||||
$currentHead = OCA\Documents\Op::getHeadSeq($esId);
|
||||
try {
|
||||
OCA\Office\Member::updateMemberActivity($memberId);
|
||||
OCA\Documents\Member::updateMemberActivity($memberId);
|
||||
} catch (\Exception $e){
|
||||
|
||||
}
|
||||
@ -88,7 +88,7 @@ try{
|
||||
if ($hasOps) {
|
||||
// incoming ops without conflict
|
||||
// Add incoming ops, respond with a new head
|
||||
$newHead = OCA\Office\Op::addOpsArray($esId, $memberId, $ops);
|
||||
$newHead = OCA\Documents\Op::addOpsArray($esId, $memberId, $ops);
|
||||
$response["result"] = 'added';
|
||||
$response["head_seq"] = $newHead ? $newHead : $currentHead;
|
||||
} else {
|
||||
@ -98,7 +98,7 @@ try{
|
||||
$response["head_seq"] = $currentHead;
|
||||
}
|
||||
} else { // HEADs do not match
|
||||
$response["ops"] = OCA\Office\Op::getOpsAfterJson($esId, $seqHead);
|
||||
$response["ops"] = OCA\Documents\Op::getOpsAfterJson($esId, $seqHead);
|
||||
$response["head_seq"] = $currentHead;
|
||||
$response["result"] = $hasOps ? 'conflict' : 'new_ops';
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
// Init owncloud
|
||||
|
||||
\OCP\User::checkLoggedIn();
|
||||
\OCP\JSON::checkAppEnabled('office');
|
||||
\OCP\JSON::checkAppEnabled('documents');
|
||||
|
||||
$sessions = Session::getAll();
|
||||
if (!is_array($sessions)){
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,21 +10,21 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
\OCP\JSON::callCheck();
|
||||
|
||||
$unstable = isset($_POST['unstable']) ? $_POST['unstable'] : null;
|
||||
if (!is_null($unstable)){
|
||||
\OCP\JSON::checkAdminUser();
|
||||
\OCP\Config::setAppValue('office', 'unstable', $unstable);
|
||||
\OCP\Config::setAppValue('documents', 'unstable', $unstable);
|
||||
\OCP\JSON::success();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['unstable'])){
|
||||
\OCP\JSON::success(array(
|
||||
'value' => \OCP\Config::getAppValue('office', 'unstable', 'false')
|
||||
'value' => \OCP\Config::getAppValue('documents', 'unstable', 'false')
|
||||
));
|
||||
}
|
||||
exit();
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,7 +10,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class UserController {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
|
||||
@ -21,20 +21,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
//OCP\Util::addStyle( 'office', 'style');
|
||||
//OCP\Util::addStyle( 'documents', 'style');
|
||||
|
||||
OCP\App::register(array('order' => 70, 'id' => 'office', 'name' => 'Office'));
|
||||
OCP\App::registerAdmin('office', 'settings');
|
||||
OCP\App::register(array('order' => 70, 'id' => 'documents', 'name' => 'Documents'));
|
||||
OCP\App::registerAdmin('documents', 'settings');
|
||||
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'office_index',
|
||||
'id' => 'documents_index',
|
||||
'order' => 80,
|
||||
'href' => OCP\Util::linkTo('office', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('office', 'office.png'),
|
||||
'name' => 'Office')
|
||||
'href' => OCP\Util::linkTo('documents', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('documents', 'documents.png'),
|
||||
'name' => 'Documents')
|
||||
);
|
||||
|
||||
OC::$CLASSPATH['OCA\Office\Controller'] = 'office/ajax/controller.php';
|
||||
OC::$CLASSPATH['OCA\Office\UserController'] = 'office/ajax/userController.php';
|
||||
OC::$CLASSPATH['OCA\Office\Download\Simple'] = 'office/lib/download/simple.php';
|
||||
OC::$CLASSPATH['OCA\Office\Download\Range'] = 'office/lib/download/range.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Controller'] = 'documents/ajax/controller.php';
|
||||
OC::$CLASSPATH['OCA\Documents\UserController'] = 'documents/ajax/userController.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Download\Simple'] = 'documents/lib/download/simple.php';
|
||||
OC::$CLASSPATH['OCA\Documents\Download\Range'] = 'documents/lib/download/range.php';
|
||||
|
@ -5,7 +5,7 @@
|
||||
<overwrite>false</overwrite>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*office_session</name>
|
||||
<name>*dbprefix*documents_session</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>es_id</name>
|
||||
@ -20,7 +20,7 @@
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>512</length>
|
||||
<comments>Relative to owner office storage /welcome.odt</comments>
|
||||
<comments>Relative to owner documents storage /welcome.odt</comments>
|
||||
</field>
|
||||
<field>
|
||||
<name>genesis_hash</name>
|
||||
@ -45,7 +45,7 @@
|
||||
</field>
|
||||
|
||||
<index>
|
||||
<name>office_session_ei_index</name>
|
||||
<name>documents_session_ei_idx</name>
|
||||
<primary>true</primary>
|
||||
<unique>true</unique>
|
||||
<field>
|
||||
@ -57,7 +57,7 @@
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<name>*dbprefix*office_member</name>
|
||||
<name>*dbprefix*documents_member</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>member_id</name>
|
||||
@ -109,7 +109,7 @@
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<name>*dbprefix*office_op</name>
|
||||
<name>*dbprefix*documents_op</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>seq</name>
|
||||
@ -151,7 +151,7 @@
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>office_op_eis_index</name>
|
||||
<name>documents_op_eis_idx</name>
|
||||
<unique>true</unique>
|
||||
<field>
|
||||
<name>es_id</name>
|
||||
@ -165,7 +165,7 @@
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*office_invite</name>
|
||||
<name>*dbprefix*documents_invite</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>es_id</name>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>office</id>
|
||||
<name>Office</name>
|
||||
<id>documents</id>
|
||||
<name>Documents</name>
|
||||
<description>An ownCloud app to work with office documents</description>
|
||||
<licence>AGPL</licence>
|
||||
<author>Frank Karlitschek</author>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,73 +9,73 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
$this->create('office_genesis', 'ajax/genesis/{es_id}')
|
||||
$this->create('documents_genesis', 'ajax/genesis/{es_id}')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'serve')
|
||||
->action('\OCA\Documents\Controller', 'serve')
|
||||
;
|
||||
$this->create('office_genesis', 'ajax/genesis/{es_id}')
|
||||
$this->create('documents_genesis', 'ajax/genesis/{es_id}')
|
||||
->get()
|
||||
->action('\OCA\Office\Controller', 'serve')
|
||||
->action('\OCA\Documents\Controller', 'serve')
|
||||
;
|
||||
|
||||
$this->create('office_session_start', 'ajax/session/start')
|
||||
$this->create('documents_session_start', 'ajax/session/start')
|
||||
->get()
|
||||
->action('\OCA\Office\Controller', 'startSession')
|
||||
->action('\OCA\Documents\Controller', 'startSession')
|
||||
;
|
||||
$this->create('office_session_start', 'ajax/session/start')
|
||||
$this->create('documents_session_start', 'ajax/session/start')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'startSession')
|
||||
->action('\OCA\Documents\Controller', 'startSession')
|
||||
;
|
||||
|
||||
$this->create('office_session_list', 'ajax/session/list')
|
||||
$this->create('documents_session_list', 'ajax/session/list')
|
||||
->get()
|
||||
->action('\OCA\Office\Controller', 'listSessions')
|
||||
->action('\OCA\Documents\Controller', 'listSessions')
|
||||
;
|
||||
$this->create('office_session_list', 'ajax/session/list')
|
||||
$this->create('documents_session_list', 'ajax/session/list')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'listSessions')
|
||||
->action('\OCA\Documents\Controller', 'listSessions')
|
||||
;
|
||||
|
||||
$this->create('office_session_info', 'ajax/session/info')
|
||||
$this->create('documents_session_info', 'ajax/session/info')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'sessionInfo')
|
||||
->action('\OCA\Documents\Controller', 'sessionInfo')
|
||||
;
|
||||
|
||||
$this->create('office_session_listhtml', 'ajax/session/listHtml')
|
||||
$this->create('documents_session_listhtml', 'ajax/session/listHtml')
|
||||
->get()
|
||||
->action('\OCA\Office\Controller', 'listSessionsHtml')
|
||||
->action('\OCA\Documents\Controller', 'listSessionsHtml')
|
||||
;
|
||||
$this->create('office_session_listhtml', 'ajax/session/listHtml')
|
||||
$this->create('documents_session_listhtml', 'ajax/session/listHtml')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'listSessionsHtml')
|
||||
->action('\OCA\Documents\Controller', 'listSessionsHtml')
|
||||
;
|
||||
|
||||
$this->create('office_session_join', 'ajax/session/join/{es_id}')
|
||||
$this->create('documents_session_join', 'ajax/session/join/{es_id}')
|
||||
->get()
|
||||
->action('\OCA\Office\Controller', 'joinSession')
|
||||
->action('\OCA\Documents\Controller', 'joinSession')
|
||||
;
|
||||
$this->create('office_session_join', 'ajax/session/join/{es_id}')
|
||||
$this->create('documents_session_join', 'ajax/session/join/{es_id}')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'joinSession')
|
||||
->action('\OCA\Documents\Controller', 'joinSession')
|
||||
;
|
||||
|
||||
$this->create('office_session_save', 'ajax/session/save')
|
||||
$this->create('documents_session_save', 'ajax/session/save')
|
||||
->post()
|
||||
->action('\OCA\Office\Controller', 'save')
|
||||
->action('\OCA\Documents\Controller', 'save')
|
||||
;
|
||||
|
||||
|
||||
$this->create('office_user_avatar', 'ajax/user/avatar')
|
||||
$this->create('documents_user_avatar', 'ajax/user/avatar')
|
||||
->get()
|
||||
->action('\OCA\Office\UserController', 'sendAvatar')
|
||||
->action('\OCA\Documents\UserController', 'sendAvatar')
|
||||
;
|
||||
|
||||
$this->create('office_user_invite', 'ajax/user/invite')
|
||||
$this->create('documents_user_invite', 'ajax/user/invite')
|
||||
->post()
|
||||
->action('\OCA\Office\UserController', 'invite')
|
||||
->action('\OCA\Documents\UserController', 'invite')
|
||||
;
|
||||
|
||||
$this->create('office_user_search', 'ajax/user/search')
|
||||
$this->create('documents_user_search', 'ajax/user/search')
|
||||
->get()
|
||||
->action('\OCA\Office\UserController', 'search')
|
||||
->action('\OCA\Documents\UserController', 'search')
|
||||
;
|
||||
|
@ -3,7 +3,7 @@
|
||||
font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0;
|
||||
}
|
||||
|
||||
#office-content{
|
||||
#documents-content{
|
||||
padding-top: 3em;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 328 B |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
18
index.php
18
index.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
|
||||
@ -22,17 +22,17 @@
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
\OCP\User::checkLoggedIn();
|
||||
\OCP\JSON::checkAppEnabled('office');
|
||||
\OCP\App::setActiveNavigationEntry( 'office_index' );
|
||||
\OCP\JSON::checkAppEnabled('documents');
|
||||
\OCP\App::setActiveNavigationEntry( 'documents_index' );
|
||||
|
||||
\OCP\Util::addStyle( 'office', 'style' );
|
||||
\OCP\Util::addStyle( 'office', 'dojo-app' );
|
||||
\OCP\Util::addStyle( 'office', 'editor' );
|
||||
\OCP\Util::addScript('office', 'office');
|
||||
\OCP\Util::addStyle( 'documents', 'style' );
|
||||
\OCP\Util::addStyle( 'documents', 'dojo-app' );
|
||||
\OCP\Util::addStyle( 'documents', 'editor' );
|
||||
\OCP\Util::addScript('documents', 'documents');
|
||||
|
||||
$tmpl = new \OCP\Template('office', 'documents', 'user');
|
||||
$tmpl = new \OCP\Template('documents', 'documents', 'user');
|
||||
|
||||
$tmpl->printPage();
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require,dojo,runtime */
|
||||
var officeMain = {
|
||||
var documentsMain = {
|
||||
useUnstable : false,
|
||||
onStartup: function() {
|
||||
"use strict";
|
||||
OC.addScript('office', 'webodf_bootstrap', function() {
|
||||
OC.addScript('office', 'webodf-debug').done(function() {
|
||||
OC.addScript('documents', 'webodf_bootstrap', function() {
|
||||
OC.addScript('documents', 'webodf-debug').done(function() {
|
||||
require({}, ["dojo/ready"], function(ready) {
|
||||
ready(function() {
|
||||
require({}, ["webodf/editor/Editor"], function(Editor) {
|
||||
if (Editor && typeof(Editor) === 'function') {
|
||||
officeMain.initialized = 1;
|
||||
documentsMain.initialized = 1;
|
||||
} else {
|
||||
alert("initialization of webodf/editor/Editor\n" +
|
||||
"failed somehow...");
|
||||
@ -19,7 +19,7 @@ var officeMain = {
|
||||
});
|
||||
});
|
||||
});
|
||||
//setInterval(officeMain.updateInfo, 10000);
|
||||
//setInterval(documentsMain.updateInfo, 10000);
|
||||
},
|
||||
initSession: function(response) {
|
||||
"use strict";
|
||||
@ -30,7 +30,7 @@ var officeMain = {
|
||||
return;
|
||||
}
|
||||
|
||||
OC.addScript('office', 'editor/boot_editor').done(function() {
|
||||
OC.addScript('documents', 'editor/boot_editor').done(function() {
|
||||
var doclocation = response.es_id;
|
||||
|
||||
// fade out file list and show WebODF canvas
|
||||
@ -82,7 +82,7 @@ var officeMain = {
|
||||
cb(memberId);
|
||||
},
|
||||
callback: function(webodfEditorInstance) {
|
||||
officeMain.webodfEditorInstance = webodfEditorInstance;
|
||||
documentsMain.webodfEditorInstance = webodfEditorInstance;
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -93,24 +93,24 @@ var officeMain = {
|
||||
startSession: function(fileid) {
|
||||
"use strict";
|
||||
console.log('starting session for fileid '+fileid);
|
||||
if (officeMain.initialized === undefined) {
|
||||
if (documentsMain.initialized === undefined) {
|
||||
alert("WebODF Editor not yet initialized...");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(
|
||||
OC.Router.generate('office_session_start'),
|
||||
OC.Router.generate('documents_session_start'),
|
||||
{'fileid': fileid},
|
||||
officeMain.initSession
|
||||
documentsMain.initSession
|
||||
);
|
||||
},
|
||||
|
||||
joinSession: function(esId) {
|
||||
console.log('joining session '+esId);
|
||||
$.post(
|
||||
OC.Router.generate('office_session_join') + '/' + esId,
|
||||
OC.Router.generate('documents_session_join') + '/' + esId,
|
||||
{},
|
||||
officeMain.initSession
|
||||
documentsMain.initSession
|
||||
);
|
||||
},
|
||||
|
||||
@ -120,13 +120,13 @@ var officeMain = {
|
||||
fileIds.push($(e).attr('data-file'));
|
||||
});
|
||||
$.post(
|
||||
OC.Router.generate('office_session_info'),
|
||||
OC.Router.generate('documents_session_info'),
|
||||
{items: fileIds},
|
||||
function (response){
|
||||
if (response && response.info && response.info.length){
|
||||
for (var i=0;i<response.info.length;i++){
|
||||
$('.documentslist li[data-file='+ response.info[i].file_id +'] .session-info').text(
|
||||
t('office', 'Users in session:')
|
||||
t('documents', 'Users in session:')
|
||||
+ response.info[i].users
|
||||
);
|
||||
}
|
||||
@ -144,12 +144,12 @@ var officeMain = {
|
||||
$('input[name=invitee\\[\\]]').each(function(i, e) {
|
||||
users.push($(e).val());
|
||||
});
|
||||
$.post(OC.Router.generate('office_user_invite'), {users: users});
|
||||
$.post(OC.Router.generate('documents_user_invite'), {users: users});
|
||||
},
|
||||
onClose: function() {
|
||||
"use strict";
|
||||
|
||||
officeMain.webodfEditorInstance.shutdown(function() {
|
||||
documentsMain.webodfEditorInstance.shutdown(function() {
|
||||
// successfull shutdown - all is good.
|
||||
|
||||
// Fade out odf-toolbar
|
||||
@ -177,7 +177,7 @@ function getMimeIcon(mime){
|
||||
if(getMimeIcon.cache[mime]){
|
||||
def.resolve(getMimeIcon.cache[mime]);
|
||||
}else{
|
||||
jQuery.getJSON( OC.filePath('office','ajax','mimeicon.php'), {mime: mime})
|
||||
jQuery.getJSON( OC.filePath('documents','ajax','mimeicon.php'), {mime: mime})
|
||||
.done(function(data){
|
||||
getMimeIcon.cache[mime]=data.path;
|
||||
def.resolve(getMimeIcon.cache[mime]);
|
||||
@ -192,37 +192,37 @@ function getMimeIcon(mime){
|
||||
getMimeIcon.cache={};
|
||||
|
||||
// fill the albums from Gallery.images
|
||||
var officeDocuments = {
|
||||
var documentsDocuments = {
|
||||
_documents: [],
|
||||
_sessions: []
|
||||
};
|
||||
officeDocuments.loadDocuments = function () {
|
||||
documentsDocuments.loadDocuments = function () {
|
||||
var self = this;
|
||||
var def = new $.Deferred();
|
||||
jQuery.getJSON(OC.filePath('office', 'ajax', 'documents.php'))
|
||||
jQuery.getJSON(OC.filePath('documents', 'ajax', 'documents.php'))
|
||||
.done(function (data) {
|
||||
self._documents = data.documents;
|
||||
def.resolve();
|
||||
})
|
||||
.fail(function(data){
|
||||
console.log(t('office','Failed to load documents.'));
|
||||
console.log(t('documents','Failed to load documents.'));
|
||||
});
|
||||
return def;
|
||||
};
|
||||
officeDocuments.loadSessions = function () {
|
||||
documentsDocuments.loadSessions = function () {
|
||||
var self = this;
|
||||
var def = new $.Deferred();
|
||||
jQuery.getJSON(OC.filePath('office', 'ajax', 'sessions.php'))
|
||||
jQuery.getJSON(OC.filePath('documents', 'ajax', 'sessions.php'))
|
||||
.done(function (data) {
|
||||
self._sessions = data.sessions;
|
||||
def.resolve();
|
||||
})
|
||||
.fail(function(data){
|
||||
console.log(t('office','Failed to load sessions.'));
|
||||
console.log(t('documents','Failed to load sessions.'));
|
||||
});
|
||||
return def;
|
||||
};
|
||||
officeDocuments.renderDocuments = function () {
|
||||
documentsDocuments.renderDocuments = function () {
|
||||
|
||||
//remove all but template
|
||||
$('.documentslist .document:not(.template)').remove();
|
||||
@ -261,15 +261,15 @@ $(document).ready(function() {
|
||||
$('.documentslist').on('click', 'li', function(event) {
|
||||
event.preventDefault();
|
||||
if ($(this).attr('data-esid')){
|
||||
officeMain.joinSession($(this).attr('data-esid'));
|
||||
documentsMain.joinSession($(this).attr('data-esid'));
|
||||
} else if ($(this).attr('data-id')){
|
||||
officeMain.startSession($(this).attr('data-id'));
|
||||
documentsMain.startSession($(this).attr('data-id'));
|
||||
}
|
||||
});
|
||||
|
||||
$('#content').on('click', '#odf_close', officeMain.onClose);
|
||||
$('#content').on('click', '#odf_invite', officeMain.onInvite);
|
||||
$('#content').on('click', '#invite-send', officeMain.sendInvite);
|
||||
$('#content').on('click', '#odf_close', documentsMain.onClose);
|
||||
$('#content').on('click', '#odf_invite', documentsMain.onInvite);
|
||||
$('#content').on('click', '#invite-send', documentsMain.sendInvite);
|
||||
$('#content').on('click', '#invitee-list li', function(){
|
||||
$(this).remove();
|
||||
});
|
||||
@ -278,7 +278,7 @@ $(document).ready(function() {
|
||||
minLength: 1,
|
||||
source: function(search, response) {
|
||||
$.get(
|
||||
OC.Router.generate('office_user_search'),
|
||||
OC.Router.generate('documents_user_search'),
|
||||
{search: $('#inivite-input').val()},
|
||||
function(result) {
|
||||
if (result.status === 'success' && result.data.length > 0) {
|
||||
@ -293,7 +293,7 @@ $(document).ready(function() {
|
||||
event.preventDefault();
|
||||
var item = $(
|
||||
'<li title="'
|
||||
+ t('office', 'Remove from the list')
|
||||
+ t('documents', 'Remove from the list')
|
||||
+ '" >'
|
||||
+ el.item.label
|
||||
+ '<input type="hidden" name="invitee[]" value="'
|
||||
@ -306,14 +306,14 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
//TODO load list of files
|
||||
jQuery.when(officeDocuments.loadDocuments(), officeDocuments.loadSessions())
|
||||
jQuery.when(documentsDocuments.loadDocuments(), documentsDocuments.loadSessions())
|
||||
.then(function(){
|
||||
officeDocuments.renderDocuments();
|
||||
documentsDocuments.renderDocuments();
|
||||
});
|
||||
//TODO show no docs please upload
|
||||
//TODO load list of sessions, and add 'active' as icon overlay
|
||||
//TODO when clicking on a document without a session initialize it
|
||||
//TODO when ending a session as the last user close session?
|
||||
|
||||
OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup);
|
||||
OC.addScript('documents', 'dojo-amalgamation', documentsMain.onStartup);
|
||||
});
|
@ -8,11 +8,11 @@ if (navigator && navigator.language.match(/^(de)/)) {
|
||||
dojoConfig = {
|
||||
locale: usedLocale,
|
||||
paths: {
|
||||
"webodf/editor": OC.appswebroots.office + "/js/editor",
|
||||
"dijit": OC.appswebroots.office + "/resources/dijit",
|
||||
"dojox": OC.appswebroots.office + "/resources/dojox",
|
||||
"dojo": OC.appswebroots.office + "/resources/dojo",
|
||||
"resources": OC.appswebroots.office + "/resources"
|
||||
"webodf/editor": OC.appswebroots.documents + "/js/editor",
|
||||
"dijit": OC.appswebroots.documents + "/resources/dijit",
|
||||
"dojox": OC.appswebroots.documents + "/resources/dojox",
|
||||
"dojo": OC.appswebroots.documents + "/resources/dojo",
|
||||
"resources": OC.appswebroots.documents + "/resources"
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -95,10 +95,10 @@ var webodfEditor = (function () {
|
||||
case "owncloud":
|
||||
require({ }, ["webodf/editor/server/pullbox/serverFactory"], function (ServerFactory) {
|
||||
serverFactory = new ServerFactory();
|
||||
server = serverFactory.createServer({url: "./office/ajax/otpoll.php"});
|
||||
server = serverFactory.createServer({url: "./documents/ajax/otpoll.php"});
|
||||
server.getGenesisUrl = function(sid) {
|
||||
// what a dirty hack :)
|
||||
return OC.Router.generate('office_genesis')+'/' +sid;
|
||||
return OC.Router.generate('documents_genesis')+'/' +sid;
|
||||
};
|
||||
server.connect(8000, callback);
|
||||
});
|
||||
|
@ -1,15 +1,15 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
var officeSettings = {
|
||||
var documentsSettings = {
|
||||
save : function() {
|
||||
var data = {
|
||||
unstable : $('#webodf-unstable').attr('checked')==="checked"
|
||||
};
|
||||
$.post(OC.filePath('office', 'ajax', 'settings.php'), data, officeSettings.afterSave);
|
||||
$.post(OC.filePath('documents', 'ajax', 'settings.php'), data, documentsSettings.afterSave);
|
||||
},
|
||||
afterSave : function(){
|
||||
officeMain.useUnstable = $('#webodf-unstable').attr('checked')==="checked"
|
||||
documentsMain.useUnstable = $('#webodf-unstable').attr('checked')==="checked"
|
||||
}
|
||||
};
|
||||
$('#webodf-unstable').change(officeSettings.save);
|
||||
$('#webodf-unstable').change(documentsSettings.save);
|
||||
});
|
@ -8,11 +8,11 @@ if (navigator && navigator.language.match(/^(de)/)) {
|
||||
dojoConfig = {
|
||||
locale: usedLocale,
|
||||
paths: {
|
||||
"webodf/editor": OC.appswebroots.office + "/js/editor",
|
||||
"dijit": OC.appswebroots.office + "/js/editor/dijit",
|
||||
"dojox": OC.appswebroots.office + "/js/editor/dojox",
|
||||
"dojo": OC.appswebroots.office + "/js/editor/dojo",
|
||||
"resources": OC.appswebroots.office + "/js/editor/resources"
|
||||
"webodf/editor": OC.appswebroots.documents + "/js/editor",
|
||||
"dijit": OC.appswebroots.documents + "/js/editor/dijit",
|
||||
"dojox": OC.appswebroots.documents + "/js/editor/dojox",
|
||||
"dojo": OC.appswebroots.documents + "/js/editor/dojo",
|
||||
"resources": OC.appswebroots.documents + "/js/editor/resources"
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,7 +9,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Download {
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,9 +9,9 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office\Download;
|
||||
use OCA\Office\View;
|
||||
class Range extends \OCA\Office\Download {
|
||||
namespace OCA\Documents\Download;
|
||||
use OCA\Documents\View;
|
||||
class Range extends \OCA\Documents\Download {
|
||||
|
||||
// Start of the range
|
||||
protected $start;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,9 +9,9 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office\Download;
|
||||
namespace OCA\Documents\Download;
|
||||
|
||||
class Simple extends \OCA\Office\Download {
|
||||
class Simple extends \OCA\Documents\Download {
|
||||
|
||||
|
||||
public function __construct($view, $filepath){
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,11 +9,11 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Helper{
|
||||
|
||||
const APP_ID = 'office';
|
||||
const APP_ID = 'documents';
|
||||
|
||||
public static function getRandomColor(){
|
||||
$str = dechex(floor(rand(0, 16777215)));
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,7 +10,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Invite {
|
||||
const STATUS_SENT = 0;
|
||||
@ -18,7 +18,7 @@ class Invite {
|
||||
const STATUS_ACCEPTED = 2;
|
||||
|
||||
public static function add($esId, $userId){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_invite` (`es_id`, `uid`, `status`, `sent_on`) VALUES (?, ?, ?, ?) ');
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*documents_invite` (`es_id`, `uid`, `status`, `sent_on`) VALUES (?, ?, ?, ?) ');
|
||||
$query->execute(array(
|
||||
$esId,
|
||||
$userId,
|
||||
@ -26,11 +26,11 @@ class Invite {
|
||||
time()
|
||||
));
|
||||
|
||||
return \OCP\DB::insertid(`*PREFIX*office_invite`);
|
||||
return \OCP\DB::insertid(`*PREFIX*documents_invite`);
|
||||
}
|
||||
|
||||
public static function accept($esId){
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*office_invite` SET `status`=? WHERE `es_id`=? AND `uid`=?');
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*documents_invite` SET `status`=? WHERE `es_id`=? AND `uid`=?');
|
||||
$query->execute(array(
|
||||
self::STATUS_ACCEPTED,
|
||||
$esId,
|
||||
@ -39,7 +39,7 @@ class Invite {
|
||||
}
|
||||
|
||||
public static function decline($esId){
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*office_invite` SET `status`=? WHERE `es_id`=? AND `uid`=?');
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*documents_invite` SET `status`=? WHERE `es_id`=? AND `uid`=?');
|
||||
$query->execute(array(
|
||||
self::STATUS_DECLINED,
|
||||
$esId,
|
||||
@ -49,13 +49,13 @@ class Invite {
|
||||
|
||||
|
||||
public static function getAllInvites(){
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_invite` WHERE `uid`= ?');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_invite` WHERE `uid`= ?');
|
||||
$result = $query->execute(array(\OCP\User::getUser()));
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
public static function getSenderStatusesAsArray(){
|
||||
$l10n = \OCP\Util::getL10N('office');
|
||||
$l10n = \OCP\Util::getL10N('documents');
|
||||
|
||||
return array(
|
||||
self::STATUS_SENT => $l10n->t('Sent'),
|
||||
@ -65,7 +65,7 @@ class Invite {
|
||||
}
|
||||
|
||||
public static function getRecipientStatusesAsArray(){
|
||||
$l10n = \OCP\Util::getL10N('office');
|
||||
$l10n = \OCP\Util::getL10N('documents');
|
||||
|
||||
return array(
|
||||
self::STATUS_SENT => $l10n->t('Incoming'),
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,7 +10,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Member {
|
||||
|
||||
@ -20,7 +20,7 @@ class Member {
|
||||
const MEMBER_STATUS_INACTIVE = 2;
|
||||
|
||||
public static function add($esId, $displayname, $color){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_member` (`es_id`, `uid`, `color`, `last_activity`) VALUES (?, ?, ?, ?) ');
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*documents_member` (`es_id`, `uid`, `color`, `last_activity`) VALUES (?, ?, ?, ?) ');
|
||||
$query->execute(array(
|
||||
$esId,
|
||||
\OCP\User::getUser(),
|
||||
@ -28,11 +28,11 @@ class Member {
|
||||
time()
|
||||
));
|
||||
|
||||
return \OCP\DB::insertid(`*PREFIX*office_member`);
|
||||
return \OCP\DB::insertid(`*PREFIX*documents_member`);
|
||||
}
|
||||
|
||||
public static function getMember($id){
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_member` WHERE `member_id`= ?');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_member` WHERE `member_id`= ?');
|
||||
$result = $query->execute(array($id));
|
||||
return $result->fetchRow();
|
||||
}
|
||||
@ -45,13 +45,13 @@ class Member {
|
||||
|
||||
$placeholders = array_fill(0, $memberCount, '?');
|
||||
$stmt = implode(', ', $placeholders);
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_member` WHERE `member_id`IN (' . $stmt . ')');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_member` WHERE `member_id`IN (' . $stmt . ')');
|
||||
$result = $query->execute($ids);
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
public static function updateMemberActivity($memberId){
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*office_member` SET `last_activity`=? WHERE `member_id`=?');
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*documents_member` SET `last_activity`=? WHERE `member_id`=?');
|
||||
$query->execute(array(
|
||||
time(),
|
||||
$memberId
|
||||
@ -65,7 +65,7 @@ class Member {
|
||||
$activeSince = $lastActivity;
|
||||
}
|
||||
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_member` WHERE `es_id`= ? and `last_activity` > ?');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_member` WHERE `es_id`= ? and `last_activity` > ?');
|
||||
$result = $query->execute(array($esId, $activeSince));
|
||||
return $result->fetchAll();
|
||||
}
|
||||
@ -78,7 +78,7 @@ class Member {
|
||||
public static function cleanSession($esId){
|
||||
$time = self::getInactivityPeriod();
|
||||
|
||||
$query = \OCP\DB::prepare('SELECT `member_id` FROM `*PREFIX*office_member` WHERE `es_id`= ? AND `last_activity`<? AND `status`=?');
|
||||
$query = \OCP\DB::prepare('SELECT `member_id` FROM `*PREFIX*documents_member` WHERE `es_id`= ? AND `last_activity`<? AND `status`=?');
|
||||
$result = $query->execute(array(
|
||||
$esId,
|
||||
$time,
|
||||
@ -97,7 +97,7 @@ class Member {
|
||||
* @param timestamp $time
|
||||
*/
|
||||
protected static function deactivate($esId, $time){
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*office_member` SET `status`=? WHERE `es_id`=? AND `last_activity`<?');
|
||||
$query = \OCP\DB::prepare('UPDATE `*PREFIX*documents_member` SET `status`=? WHERE `es_id`=? AND `last_activity`<?');
|
||||
$query->execute(array(
|
||||
self::MEMBER_STATUS_INACTIVE,
|
||||
$esId,
|
||||
|
12
lib/op.php
12
lib/op.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,12 +9,12 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Op {
|
||||
|
||||
public static function add($esId, $memberId, $opspec){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_op` (`es_id`, `member`, `opspec`) VALUES (?, ?, ?) ');
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*documents_op` (`es_id`, `member`, `opspec`) VALUES (?, ?, ?) ');
|
||||
$query->execute(array(
|
||||
$esId,
|
||||
$memberId,
|
||||
@ -22,7 +22,7 @@ class Op {
|
||||
));
|
||||
// throw something - if query fails - thats fatal
|
||||
|
||||
return \OCP\DB::insertid(`*PREFIX*office_op`);
|
||||
return \OCP\DB::insertid(`*PREFIX*documents_op`);
|
||||
}
|
||||
|
||||
public static function addOpsArray($esId, $memberId, $ops){
|
||||
@ -38,7 +38,7 @@ class Op {
|
||||
* @returns "" when there are no Ops, or the seq of the last Op
|
||||
*/
|
||||
public static function getHeadSeq($esId){
|
||||
$query = \OCP\DB::prepare('SELECT `seq` FROM `*PREFIX*office_op` WHERE `es_id`=? ORDER BY `seq` DESC LIMIT 1');
|
||||
$query = \OCP\DB::prepare('SELECT `seq` FROM `*PREFIX*documents_op` WHERE `es_id`=? ORDER BY `seq` DESC LIMIT 1');
|
||||
$result = $query->execute(array(
|
||||
$esId
|
||||
))
|
||||
@ -67,7 +67,7 @@ class Op {
|
||||
if ($seq == ""){
|
||||
$seq = -1;
|
||||
}
|
||||
$query = \OCP\DB::prepare('SELECT `opspec` FROM `*PREFIX*office_op` WHERE `es_id`=? AND `seq`>? ORDER BY `seq` ASC');
|
||||
$query = \OCP\DB::prepare('SELECT `opspec` FROM `*PREFIX*documents_op` WHERE `es_id`=? AND `seq`>? ORDER BY `seq` ASC');
|
||||
$result = $query->execute(array($esId, $seq));
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,7 +9,7 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Request {
|
||||
protected $data = array();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,12 +9,12 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Session {
|
||||
|
||||
public static function add($genesis, $hash, $fileId){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `file_id`) VALUES (?, ?, ?, ?, ?) ');
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*documents_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `file_id`) VALUES (?, ?, ?, ?, ?) ');
|
||||
|
||||
$data = array(
|
||||
'es_id' => self::getUniqueSessionId(),
|
||||
@ -32,20 +32,20 @@ class Session {
|
||||
}
|
||||
|
||||
public static function getAll(){
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session`');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_session`');
|
||||
$result = $query->execute();
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
public static function getSession($id){
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `es_id`= ?');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_session` WHERE `es_id`= ?');
|
||||
$result = $query->execute(array($id));
|
||||
return $result->fetchRow();
|
||||
}
|
||||
|
||||
public static function getInfo($esId){
|
||||
|
||||
$query = \OCP\DB::prepare('SELECT s.*, COUNT(`m`.`member_id`) AS users FROM `*PREFIX*office_session` AS s LEFT JOIN `*PREFIX*office_member` AS m ON `s`.`es_id`=`m`.`es_id` AND `m`.`status`='. Member::MEMBER_STATUS_ACTIVE .' AND `m`.`uid` != ? WHERE `s`.`es_id` = ? GROUP BY `m`.`es_id`');
|
||||
$query = \OCP\DB::prepare('SELECT s.*, COUNT(`m`.`member_id`) AS users FROM `*PREFIX*documents_session` AS s LEFT JOIN `*PREFIX*documents_member` AS m ON `s`.`es_id`=`m`.`es_id` AND `m`.`status`='. Member::MEMBER_STATUS_ACTIVE .' AND `m`.`uid` != ? WHERE `s`.`es_id` = ? GROUP BY `m`.`es_id`');
|
||||
$result = $query->execute(
|
||||
array(
|
||||
\OCP\User::getUser(),
|
||||
@ -61,7 +61,7 @@ class Session {
|
||||
}
|
||||
|
||||
public static function getSessionByFileId($fileId){
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `file_id`= ?');
|
||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*documents_session` WHERE `file_id`= ?');
|
||||
$result = $query->execute(array($fileId));
|
||||
return $result->fetchRow();
|
||||
}
|
||||
@ -74,7 +74,7 @@ class Session {
|
||||
|
||||
$placeholders = array_fill(0, $fileIdCount, '?');
|
||||
$stmt = implode(', ', $placeholders);
|
||||
$query = \OCP\DB::prepare('SELECT s.*, COUNT(`m`.`member_id`) AS users FROM `*PREFIX*office_session` AS s LEFT JOIN `*PREFIX*office_member` AS m ON `s`.`es_id`=`m`.`es_id` AND `m`.`status`='. Member::MEMBER_STATUS_ACTIVE .' AND `m`.`uid` != ? WHERE `s`.`file_id` IN (' . $stmt .') GROUP BY `m`.`es_id`');
|
||||
$query = \OCP\DB::prepare('SELECT s.*, COUNT(`m`.`member_id`) AS users FROM `*PREFIX*documents_session` AS s LEFT JOIN `*PREFIX*documents_member` AS m ON `s`.`es_id`=`m`.`es_id` AND `m`.`status`='. Member::MEMBER_STATUS_ACTIVE .' AND `m`.`uid` != ? WHERE `s`.`file_id` IN (' . $stmt .') GROUP BY `m`.`es_id`');
|
||||
$result = $query->execute(
|
||||
array_merge(array(\OCP\User::getUser()), $fileIds)
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2012 Frank Karlitschek frank@owncloud.org
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class Storage {
|
||||
|
||||
|
26
lib/view.php
26
lib/view.php
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -9,25 +9,25 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
class View extends \OC\Files\View{
|
||||
const OFFICE_DIRNAME='/office';
|
||||
protected static $officeView;
|
||||
const DOCUMENTS_DIRNAME='/documents';
|
||||
protected static $documentsView;
|
||||
|
||||
public static function initOfficeView($uid){
|
||||
public static function initDocumentsView($uid){
|
||||
$view = new \OC\Files\View('/' . $uid);
|
||||
if (!$view->is_dir(self::OFFICE_DIRNAME)) {
|
||||
$view->mkdir(self::OFFICE_DIRNAME);
|
||||
if (!$view->is_dir(self::DOCUMENTS_DIRNAME)) {
|
||||
$view->mkdir(self::DOCUMENTS_DIRNAME);
|
||||
}
|
||||
|
||||
//if (!self::$officeView){
|
||||
// self::$officeView = new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
||||
//if (!self::$documentsView){
|
||||
// self::$documentsView = new \OC\Files\View('/' . $uid . self::DOCUMENTS_DIRNAME);
|
||||
//}
|
||||
|
||||
// it was a bad idea to use a static method.
|
||||
// to be changed later
|
||||
return new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
||||
return new \OC\Files\View('/' . $uid . self::DOCUMENTS_DIRNAME);
|
||||
}
|
||||
|
||||
public static function storeDocument($uid, $filePath){
|
||||
@ -43,13 +43,13 @@ class View extends \OC\Files\View{
|
||||
|
||||
$newName = '/' . sha1($view->file_get_contents($relPath)) . '.odt';
|
||||
|
||||
$view->copy($relPath, self::OFFICE_DIRNAME . $newName);
|
||||
$view->copy($relPath, self::DOCUMENTS_DIRNAME . $newName);
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
return $newName;
|
||||
}
|
||||
|
||||
public static function getHashByGenesis($uid, $genesisPath){
|
||||
$officeView = self::initOfficeView($uid);
|
||||
return sha1($officeView->file_get_contents($genesisPath));
|
||||
$documentsView = self::initDocumentsView($uid);
|
||||
return sha1($documentsView->file_get_contents($genesisPath));
|
||||
}
|
||||
}
|
||||
|
10
settings.php
10
settings.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
* ownCloud - Documents App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
@ -10,12 +10,12 @@
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
namespace OCA\Documents;
|
||||
|
||||
\OCP\Util::addScript('office', 'settings');
|
||||
\OCP\Util::addScript('documents', 'settings');
|
||||
|
||||
$tmpl = new \OCP\Template('office', 'settings');
|
||||
$unstable = \OCP\Config::getAppValue('office', 'unstable', 'false');
|
||||
$tmpl = new \OCP\Template('documents', 'settings');
|
||||
$unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false');
|
||||
$tmpl->assign('unstable', $unstable);
|
||||
|
||||
return $tmpl->fetchPage();
|
||||
|
@ -5,7 +5,7 @@
|
||||
<button id="invite-send"><?php p('Send Invitation') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="office-content">
|
||||
<div id="documents-content">
|
||||
<div id="editor-content">
|
||||
<ul class="documentslist">
|
||||
<li class="add-document">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<fieldset class="personalblock" id="office">
|
||||
<legend><strong><?php p($l->t('Office')) ?></strong></legend>
|
||||
<fieldset class="personalblock" id="documents">
|
||||
<legend><strong><?php p($l->t('Documents')) ?></strong></legend>
|
||||
<table class="nostyle">
|
||||
<tbody><tr>
|
||||
<td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user