rename office -> documents

pull/1/head
Jörn Friedrich Dreyer 11 years ago
parent 3e59604485
commit 7bc25ec0ce

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,7 +10,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Controller { class Controller {
@ -23,8 +23,8 @@ class Controller {
$session = Session::getSession(@$args['es_id']); $session = Session::getSession(@$args['es_id']);
$filename = isset($session['genesis_url']) ? $session['genesis_url'] : ''; $filename = isset($session['genesis_url']) ? $session['genesis_url'] : '';
$officeView = View::initOfficeView($session['owner']); $documentsView = View::initDocumentsView($session['owner']);
$download = new Download($officeView, $filename); $download = new Download($documentsView, $filename);
$download->sendResponse(); $download->sendResponse();
} }
@ -57,7 +57,7 @@ class Controller {
//If there is no existing session we need to start a new one //If there is no existing session we need to start a new one
if (!$session || empty($session)){ if (!$session || empty($session)){
$officeView = View::initOfficeView($uid); $documentsView = View::initDocumentsView($uid);
$genesisPath = View::storeDocument($uid, $path); $genesisPath = View::storeDocument($uid, $path);
if (!$genesisPath){ if (!$genesisPath){
@ -173,7 +173,7 @@ class Controller {
$invites = array(); $invites = array();
} }
$tmpl = new \OCP\Template('office', 'part.sessions', ''); $tmpl = new \OCP\Template('documents', 'part.sessions', '');
$tmpl->assign('invites', $invites); $tmpl->assign('invites', $invites);
$tmpl->assign('sessions', $sessions); $tmpl->assign('sessions', $sessions);
echo $tmpl->fetchPage(); echo $tmpl->fetchPage();

@ -3,8 +3,8 @@
// Init owncloud // Init owncloud
\OCP\User::checkLoggedIn(); \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)); OCP\JSON::success(array('documents' => $documents));

@ -36,31 +36,31 @@
*/ */
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('office'); OCP\JSON::checkAppEnabled('documents');
// session_write_close(); // session_write_close();
$response = array(); $response = array();
try{ try{
$request = new OCA\Office\Request(); $request = new OCA\Documents\Request();
$command = $request->getParam('command'); $command = $request->getParam('command');
switch ($command){ switch ($command){
case 'query_memberdata_list': case 'query_memberdata_list':
$esId = $request->getParam('args/es_id'); $esId = $request->getParam('args/es_id');
$inactiveMembers = \OCA\Office\Member::cleanSession($esId); $inactiveMembers = \OCA\Documents\Member::cleanSession($esId);
if (is_array($inactiveMembers)){ if (is_array($inactiveMembers)){
foreach ($inactiveMembers as $member){ 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'); $ids = $request->getParam('args/member_ids');
$members = OCA\Office\Member::getMembersAsArray($ids); $members = OCA\Documents\Member::getMembersAsArray($ids);
$response["memberdata_list"] = array_map( $response["memberdata_list"] = array_map(
function($x){ function($x){
$x['display_name'] = \OCP\User::getDisplayName($x['uid']); $x['display_name'] = \OCP\User::getDisplayName($x['uid']);
// Stub // Stub
$x['avatar_url'] = \OCP\Util::linkToRoute('office_user_avatar'); $x['avatar_url'] = \OCP\Util::linkToRoute('documents_user_avatar');
return $x; return $x;
}, },
$members $members
@ -75,9 +75,9 @@ try{
$ops = $request->getParam('args/client_ops'); $ops = $request->getParam('args/client_ops');
$hasOps = is_array($ops) && count($ops)>0; $hasOps = is_array($ops) && count($ops)>0;
$currentHead = OCA\Office\Op::getHeadSeq($esId); $currentHead = OCA\Documents\Op::getHeadSeq($esId);
try { try {
OCA\Office\Member::updateMemberActivity($memberId); OCA\Documents\Member::updateMemberActivity($memberId);
} catch (\Exception $e){ } catch (\Exception $e){
} }
@ -88,7 +88,7 @@ try{
if ($hasOps) { if ($hasOps) {
// incoming ops without conflict // incoming ops without conflict
// Add incoming ops, respond with a new head // 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["result"] = 'added';
$response["head_seq"] = $newHead ? $newHead : $currentHead; $response["head_seq"] = $newHead ? $newHead : $currentHead;
} else { } else {
@ -98,7 +98,7 @@ try{
$response["head_seq"] = $currentHead; $response["head_seq"] = $currentHead;
} }
} else { // HEADs do not match } 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["head_seq"] = $currentHead;
$response["result"] = $hasOps ? 'conflict' : 'new_ops'; $response["result"] = $hasOps ? 'conflict' : 'new_ops';
} }

@ -1,10 +1,10 @@
<?php <?php
namespace OCA\Office; namespace OCA\Documents;
// Init owncloud // Init owncloud
\OCP\User::checkLoggedIn(); \OCP\User::checkLoggedIn();
\OCP\JSON::checkAppEnabled('office'); \OCP\JSON::checkAppEnabled('documents');
$sessions = Session::getAll(); $sessions = Session::getAll();
if (!is_array($sessions)){ if (!is_array($sessions)){

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,21 +10,21 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
\OCP\JSON::callCheck(); \OCP\JSON::callCheck();
$unstable = isset($_POST['unstable']) ? $_POST['unstable'] : null; $unstable = isset($_POST['unstable']) ? $_POST['unstable'] : null;
if (!is_null($unstable)){ if (!is_null($unstable)){
\OCP\JSON::checkAdminUser(); \OCP\JSON::checkAdminUser();
\OCP\Config::setAppValue('office', 'unstable', $unstable); \OCP\Config::setAppValue('documents', 'unstable', $unstable);
\OCP\JSON::success(); \OCP\JSON::success();
exit(); exit();
} }
if (isset($_GET['unstable'])){ if (isset($_GET['unstable'])){
\OCP\JSON::success(array( \OCP\JSON::success(array(
'value' => \OCP\Config::getAppValue('office', 'unstable', 'false') 'value' => \OCP\Config::getAppValue('documents', 'unstable', 'false')
)); ));
} }
exit(); exit();

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,7 +10,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class UserController { class UserController {

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Frank Karlitschek * @author Frank Karlitschek
* @copyright 2011 Frank Karlitschek karlitschek@kde.org * @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::register(array('order' => 70, 'id' => 'documents', 'name' => 'Documents'));
OCP\App::registerAdmin('office', 'settings'); OCP\App::registerAdmin('documents', 'settings');
OCP\App::addNavigationEntry(array( OCP\App::addNavigationEntry(array(
'id' => 'office_index', 'id' => 'documents_index',
'order' => 80, 'order' => 80,
'href' => OCP\Util::linkTo('office', 'index.php'), 'href' => OCP\Util::linkTo('documents', 'index.php'),
'icon' => OCP\Util::imagePath('office', 'office.png'), 'icon' => OCP\Util::imagePath('documents', 'documents.png'),
'name' => 'Office') 'name' => 'Documents')
); );
OC::$CLASSPATH['OCA\Office\Controller'] = 'office/ajax/controller.php'; OC::$CLASSPATH['OCA\Documents\Controller'] = 'documents/ajax/controller.php';
OC::$CLASSPATH['OCA\Office\UserController'] = 'office/ajax/userController.php'; OC::$CLASSPATH['OCA\Documents\UserController'] = 'documents/ajax/userController.php';
OC::$CLASSPATH['OCA\Office\Download\Simple'] = 'office/lib/download/simple.php'; OC::$CLASSPATH['OCA\Documents\Download\Simple'] = 'documents/lib/download/simple.php';
OC::$CLASSPATH['OCA\Office\Download\Range'] = 'office/lib/download/range.php'; OC::$CLASSPATH['OCA\Documents\Download\Range'] = 'documents/lib/download/range.php';

@ -5,7 +5,7 @@
<overwrite>false</overwrite> <overwrite>false</overwrite>
<charset>utf8</charset> <charset>utf8</charset>
<table> <table>
<name>*dbprefix*office_session</name> <name>*dbprefix*documents_session</name>
<declaration> <declaration>
<field> <field>
<name>es_id</name> <name>es_id</name>
@ -20,7 +20,7 @@
<default></default> <default></default>
<notnull>false</notnull> <notnull>false</notnull>
<length>512</length> <length>512</length>
<comments>Relative to owner office storage /welcome.odt</comments> <comments>Relative to owner documents storage /welcome.odt</comments>
</field> </field>
<field> <field>
<name>genesis_hash</name> <name>genesis_hash</name>
@ -45,7 +45,7 @@
</field> </field>
<index> <index>
<name>office_session_ei_index</name> <name>documents_session_ei_idx</name>
<primary>true</primary> <primary>true</primary>
<unique>true</unique> <unique>true</unique>
<field> <field>
@ -57,7 +57,7 @@
</table> </table>
<table> <table>
<name>*dbprefix*office_member</name> <name>*dbprefix*documents_member</name>
<declaration> <declaration>
<field> <field>
<name>member_id</name> <name>member_id</name>
@ -109,7 +109,7 @@
</table> </table>
<table> <table>
<name>*dbprefix*office_op</name> <name>*dbprefix*documents_op</name>
<declaration> <declaration>
<field> <field>
<name>seq</name> <name>seq</name>
@ -151,7 +151,7 @@
</field> </field>
</index> </index>
<index> <index>
<name>office_op_eis_index</name> <name>documents_op_eis_idx</name>
<unique>true</unique> <unique>true</unique>
<field> <field>
<name>es_id</name> <name>es_id</name>
@ -165,7 +165,7 @@
</declaration> </declaration>
</table> </table>
<table> <table>
<name>*dbprefix*office_invite</name> <name>*dbprefix*documents_invite</name>
<declaration> <declaration>
<field> <field>
<name>es_id</name> <name>es_id</name>

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<info> <info>
<id>office</id> <id>documents</id>
<name>Office</name> <name>Documents</name>
<description>An ownCloud app to work with office documents</description> <description>An ownCloud app to work with office documents</description>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>Frank Karlitschek</author> <author>Frank Karlitschek</author>

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,73 +9,73 @@
* later. * later.
*/ */
$this->create('office_genesis', 'ajax/genesis/{es_id}') $this->create('documents_genesis', 'ajax/genesis/{es_id}')
->post() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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() ->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; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0;
} }
#office-content{ #documents-content{
padding-top: 3em; 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

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Frank Karlitschek * @author Frank Karlitschek
* @copyright 2011 Frank Karlitschek karlitschek@kde.org * @copyright 2011 Frank Karlitschek karlitschek@kde.org
@ -22,17 +22,17 @@
*/ */
namespace OCA\Office; namespace OCA\Documents;
\OCP\User::checkLoggedIn(); \OCP\User::checkLoggedIn();
\OCP\JSON::checkAppEnabled('office'); \OCP\JSON::checkAppEnabled('documents');
\OCP\App::setActiveNavigationEntry( 'office_index' ); \OCP\App::setActiveNavigationEntry( 'documents_index' );
\OCP\Util::addStyle( 'office', 'style' ); \OCP\Util::addStyle( 'documents', 'style' );
\OCP\Util::addStyle( 'office', 'dojo-app' ); \OCP\Util::addStyle( 'documents', 'dojo-app' );
\OCP\Util::addStyle( 'office', 'editor' ); \OCP\Util::addStyle( 'documents', 'editor' );
\OCP\Util::addScript('office', 'office'); \OCP\Util::addScript('documents', 'documents');
$tmpl = new \OCP\Template('office', 'documents', 'user'); $tmpl = new \OCP\Template('documents', 'documents', 'user');
$tmpl->printPage(); $tmpl->printPage();

@ -1,15 +1,15 @@
/*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require,dojo,runtime */ /*globals $,OC,fileDownloadPath,t,document,odf,webodfEditor,alert,require,dojo,runtime */
var officeMain = { var documentsMain = {
useUnstable : false, useUnstable : false,
onStartup: function() { onStartup: function() {
"use strict"; "use strict";
OC.addScript('office', 'webodf_bootstrap', function() { OC.addScript('documents', 'webodf_bootstrap', function() {
OC.addScript('office', 'webodf-debug').done(function() { OC.addScript('documents', 'webodf-debug').done(function() {
require({}, ["dojo/ready"], function(ready) { require({}, ["dojo/ready"], function(ready) {
ready(function() { ready(function() {
require({}, ["webodf/editor/Editor"], function(Editor) { require({}, ["webodf/editor/Editor"], function(Editor) {
if (Editor && typeof(Editor) === 'function') { if (Editor && typeof(Editor) === 'function') {
officeMain.initialized = 1; documentsMain.initialized = 1;
} else { } else {
alert("initialization of webodf/editor/Editor\n" + alert("initialization of webodf/editor/Editor\n" +
"failed somehow..."); "failed somehow...");
@ -19,7 +19,7 @@ var officeMain = {
}); });
}); });
}); });
//setInterval(officeMain.updateInfo, 10000); //setInterval(documentsMain.updateInfo, 10000);
}, },
initSession: function(response) { initSession: function(response) {
"use strict"; "use strict";
@ -30,7 +30,7 @@ var officeMain = {
return; return;
} }
OC.addScript('office', 'editor/boot_editor').done(function() { OC.addScript('documents', 'editor/boot_editor').done(function() {
var doclocation = response.es_id; var doclocation = response.es_id;
// fade out file list and show WebODF canvas // fade out file list and show WebODF canvas
@ -82,7 +82,7 @@ var officeMain = {
cb(memberId); cb(memberId);
}, },
callback: function(webodfEditorInstance) { callback: function(webodfEditorInstance) {
officeMain.webodfEditorInstance = webodfEditorInstance; documentsMain.webodfEditorInstance = webodfEditorInstance;
} }
} }
); );
@ -93,24 +93,24 @@ var officeMain = {
startSession: function(fileid) { startSession: function(fileid) {
"use strict"; "use strict";
console.log('starting session for fileid '+fileid); console.log('starting session for fileid '+fileid);
if (officeMain.initialized === undefined) { if (documentsMain.initialized === undefined) {
alert("WebODF Editor not yet initialized..."); alert("WebODF Editor not yet initialized...");
return; return;
} }
$.post( $.post(
OC.Router.generate('office_session_start'), OC.Router.generate('documents_session_start'),
{'fileid': fileid}, {'fileid': fileid},
officeMain.initSession documentsMain.initSession
); );
}, },
joinSession: function(esId) { joinSession: function(esId) {
console.log('joining session '+esId); console.log('joining session '+esId);
$.post( $.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')); fileIds.push($(e).attr('data-file'));
}); });
$.post( $.post(
OC.Router.generate('office_session_info'), OC.Router.generate('documents_session_info'),
{items: fileIds}, {items: fileIds},
function (response){ function (response){
if (response && response.info && response.info.length){ if (response && response.info && response.info.length){
for (var i=0;i<response.info.length;i++){ for (var i=0;i<response.info.length;i++){
$('.documentslist li[data-file='+ response.info[i].file_id +'] .session-info').text( $('.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 + response.info[i].users
); );
} }
@ -144,12 +144,12 @@ var officeMain = {
$('input[name=invitee\\[\\]]').each(function(i, e) { $('input[name=invitee\\[\\]]').each(function(i, e) {
users.push($(e).val()); users.push($(e).val());
}); });
$.post(OC.Router.generate('office_user_invite'), {users: users}); $.post(OC.Router.generate('documents_user_invite'), {users: users});
}, },
onClose: function() { onClose: function() {
"use strict"; "use strict";
officeMain.webodfEditorInstance.shutdown(function() { documentsMain.webodfEditorInstance.shutdown(function() {
// successfull shutdown - all is good. // successfull shutdown - all is good.
// Fade out odf-toolbar // Fade out odf-toolbar
@ -177,7 +177,7 @@ function getMimeIcon(mime){
if(getMimeIcon.cache[mime]){ if(getMimeIcon.cache[mime]){
def.resolve(getMimeIcon.cache[mime]); def.resolve(getMimeIcon.cache[mime]);
}else{ }else{
jQuery.getJSON( OC.filePath('office','ajax','mimeicon.php'), {mime: mime}) jQuery.getJSON( OC.filePath('documents','ajax','mimeicon.php'), {mime: mime})
.done(function(data){ .done(function(data){
getMimeIcon.cache[mime]=data.path; getMimeIcon.cache[mime]=data.path;
def.resolve(getMimeIcon.cache[mime]); def.resolve(getMimeIcon.cache[mime]);
@ -192,37 +192,37 @@ function getMimeIcon(mime){
getMimeIcon.cache={}; getMimeIcon.cache={};
// fill the albums from Gallery.images // fill the albums from Gallery.images
var officeDocuments = { var documentsDocuments = {
_documents: [], _documents: [],
_sessions: [] _sessions: []
}; };
officeDocuments.loadDocuments = function () { documentsDocuments.loadDocuments = function () {
var self = this; var self = this;
var def = new $.Deferred(); var def = new $.Deferred();
jQuery.getJSON(OC.filePath('office', 'ajax', 'documents.php')) jQuery.getJSON(OC.filePath('documents', 'ajax', 'documents.php'))
.done(function (data) { .done(function (data) {
self._documents = data.documents; self._documents = data.documents;
def.resolve(); def.resolve();
}) })
.fail(function(data){ .fail(function(data){
console.log(t('office','Failed to load documents.')); console.log(t('documents','Failed to load documents.'));
}); });
return def; return def;
}; };
officeDocuments.loadSessions = function () { documentsDocuments.loadSessions = function () {
var self = this; var self = this;
var def = new $.Deferred(); var def = new $.Deferred();
jQuery.getJSON(OC.filePath('office', 'ajax', 'sessions.php')) jQuery.getJSON(OC.filePath('documents', 'ajax', 'sessions.php'))
.done(function (data) { .done(function (data) {
self._sessions = data.sessions; self._sessions = data.sessions;
def.resolve(); def.resolve();
}) })
.fail(function(data){ .fail(function(data){
console.log(t('office','Failed to load sessions.')); console.log(t('documents','Failed to load sessions.'));
}); });
return def; return def;
}; };
officeDocuments.renderDocuments = function () { documentsDocuments.renderDocuments = function () {
//remove all but template //remove all but template
$('.documentslist .document:not(.template)').remove(); $('.documentslist .document:not(.template)').remove();
@ -261,15 +261,15 @@ $(document).ready(function() {
$('.documentslist').on('click', 'li', function(event) { $('.documentslist').on('click', 'li', function(event) {
event.preventDefault(); event.preventDefault();
if ($(this).attr('data-esid')){ if ($(this).attr('data-esid')){
officeMain.joinSession($(this).attr('data-esid')); documentsMain.joinSession($(this).attr('data-esid'));
} else if ($(this).attr('data-id')){ } 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_close', documentsMain.onClose);
$('#content').on('click', '#odf_invite', officeMain.onInvite); $('#content').on('click', '#odf_invite', documentsMain.onInvite);
$('#content').on('click', '#invite-send', officeMain.sendInvite); $('#content').on('click', '#invite-send', documentsMain.sendInvite);
$('#content').on('click', '#invitee-list li', function(){ $('#content').on('click', '#invitee-list li', function(){
$(this).remove(); $(this).remove();
}); });
@ -278,7 +278,7 @@ $(document).ready(function() {
minLength: 1, minLength: 1,
source: function(search, response) { source: function(search, response) {
$.get( $.get(
OC.Router.generate('office_user_search'), OC.Router.generate('documents_user_search'),
{search: $('#inivite-input').val()}, {search: $('#inivite-input').val()},
function(result) { function(result) {
if (result.status === 'success' && result.data.length > 0) { if (result.status === 'success' && result.data.length > 0) {
@ -293,7 +293,7 @@ $(document).ready(function() {
event.preventDefault(); event.preventDefault();
var item = $( var item = $(
'<li title="' '<li title="'
+ t('office', 'Remove from the list') + t('documents', 'Remove from the list')
+ '" >' + '" >'
+ el.item.label + el.item.label
+ '<input type="hidden" name="invitee[]" value="' + '<input type="hidden" name="invitee[]" value="'
@ -306,14 +306,14 @@ $(document).ready(function() {
}); });
//TODO load list of files //TODO load list of files
jQuery.when(officeDocuments.loadDocuments(), officeDocuments.loadSessions()) jQuery.when(documentsDocuments.loadDocuments(), documentsDocuments.loadSessions())
.then(function(){ .then(function(){
officeDocuments.renderDocuments(); documentsDocuments.renderDocuments();
}); });
//TODO show no docs please upload //TODO show no docs please upload
//TODO load list of sessions, and add 'active' as icon overlay //TODO load list of sessions, and add 'active' as icon overlay
//TODO when clicking on a document without a session initialize it //TODO when clicking on a document without a session initialize it
//TODO when ending a session as the last user close session? //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 = { dojoConfig = {
locale: usedLocale, locale: usedLocale,
paths: { paths: {
"webodf/editor": OC.appswebroots.office + "/js/editor", "webodf/editor": OC.appswebroots.documents + "/js/editor",
"dijit": OC.appswebroots.office + "/resources/dijit", "dijit": OC.appswebroots.documents + "/resources/dijit",
"dojox": OC.appswebroots.office + "/resources/dojox", "dojox": OC.appswebroots.documents + "/resources/dojox",
"dojo": OC.appswebroots.office + "/resources/dojo", "dojo": OC.appswebroots.documents + "/resources/dojo",
"resources": OC.appswebroots.office + "/resources" "resources": OC.appswebroots.documents + "/resources"
} }
}; };

@ -95,10 +95,10 @@ var webodfEditor = (function () {
case "owncloud": case "owncloud":
require({ }, ["webodf/editor/server/pullbox/serverFactory"], function (ServerFactory) { require({ }, ["webodf/editor/server/pullbox/serverFactory"], function (ServerFactory) {
serverFactory = new ServerFactory(); serverFactory = new ServerFactory();
server = serverFactory.createServer({url: "./office/ajax/otpoll.php"}); server = serverFactory.createServer({url: "./documents/ajax/otpoll.php"});
server.getGenesisUrl = function(sid) { server.getGenesisUrl = function(sid) {
// what a dirty hack :) // what a dirty hack :)
return OC.Router.generate('office_genesis')+'/' +sid; return OC.Router.generate('documents_genesis')+'/' +sid;
}; };
server.connect(8000, callback); server.connect(8000, callback);
}); });

@ -1,15 +1,15 @@
$(document).ready(function(){ $(document).ready(function(){
var officeSettings = { var documentsSettings = {
save : function() { save : function() {
var data = { var data = {
unstable : $('#webodf-unstable').attr('checked')==="checked" 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(){ 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 = { dojoConfig = {
locale: usedLocale, locale: usedLocale,
paths: { paths: {
"webodf/editor": OC.appswebroots.office + "/js/editor", "webodf/editor": OC.appswebroots.documents + "/js/editor",
"dijit": OC.appswebroots.office + "/js/editor/dijit", "dijit": OC.appswebroots.documents + "/js/editor/dijit",
"dojox": OC.appswebroots.office + "/js/editor/dojox", "dojox": OC.appswebroots.documents + "/js/editor/dojox",
"dojo": OC.appswebroots.office + "/js/editor/dojo", "dojo": OC.appswebroots.documents + "/js/editor/dojo",
"resources": OC.appswebroots.office + "/js/editor/resources" "resources": OC.appswebroots.documents + "/js/editor/resources"
} }
}; };

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,7 +9,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Download { class Download {

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,9 +9,9 @@
* later. * later.
*/ */
namespace OCA\Office\Download; namespace OCA\Documents\Download;
use OCA\Office\View; use OCA\Documents\View;
class Range extends \OCA\Office\Download { class Range extends \OCA\Documents\Download {
// Start of the range // Start of the range
protected $start; protected $start;

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,9 +9,9 @@
* later. * 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){ public function __construct($view, $filepath){

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,11 +9,11 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Helper{ class Helper{
const APP_ID = 'office'; const APP_ID = 'documents';
public static function getRandomColor(){ public static function getRandomColor(){
$str = dechex(floor(rand(0, 16777215))); $str = dechex(floor(rand(0, 16777215)));

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,7 +10,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Invite { class Invite {
const STATUS_SENT = 0; const STATUS_SENT = 0;
@ -18,7 +18,7 @@ class Invite {
const STATUS_ACCEPTED = 2; const STATUS_ACCEPTED = 2;
public static function add($esId, $userId){ 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( $query->execute(array(
$esId, $esId,
$userId, $userId,
@ -26,11 +26,11 @@ class Invite {
time() time()
)); ));
return \OCP\DB::insertid(`*PREFIX*office_invite`); return \OCP\DB::insertid(`*PREFIX*documents_invite`);
} }
public static function accept($esId){ 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( $query->execute(array(
self::STATUS_ACCEPTED, self::STATUS_ACCEPTED,
$esId, $esId,
@ -39,7 +39,7 @@ class Invite {
} }
public static function decline($esId){ 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( $query->execute(array(
self::STATUS_DECLINED, self::STATUS_DECLINED,
$esId, $esId,
@ -49,13 +49,13 @@ class Invite {
public static function getAllInvites(){ 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())); $result = $query->execute(array(\OCP\User::getUser()));
return $result->fetchAll(); return $result->fetchAll();
} }
public static function getSenderStatusesAsArray(){ public static function getSenderStatusesAsArray(){
$l10n = \OCP\Util::getL10N('office'); $l10n = \OCP\Util::getL10N('documents');
return array( return array(
self::STATUS_SENT => $l10n->t('Sent'), self::STATUS_SENT => $l10n->t('Sent'),
@ -65,7 +65,7 @@ class Invite {
} }
public static function getRecipientStatusesAsArray(){ public static function getRecipientStatusesAsArray(){
$l10n = \OCP\Util::getL10N('office'); $l10n = \OCP\Util::getL10N('documents');
return array( return array(
self::STATUS_SENT => $l10n->t('Incoming'), self::STATUS_SENT => $l10n->t('Incoming'),

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,7 +10,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Member { class Member {
@ -20,7 +20,7 @@ class Member {
const MEMBER_STATUS_INACTIVE = 2; const MEMBER_STATUS_INACTIVE = 2;
public static function add($esId, $displayname, $color){ 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( $query->execute(array(
$esId, $esId,
\OCP\User::getUser(), \OCP\User::getUser(),
@ -28,11 +28,11 @@ class Member {
time() time()
)); ));
return \OCP\DB::insertid(`*PREFIX*office_member`); return \OCP\DB::insertid(`*PREFIX*documents_member`);
} }
public static function getMember($id){ 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)); $result = $query->execute(array($id));
return $result->fetchRow(); return $result->fetchRow();
} }
@ -45,13 +45,13 @@ class Member {
$placeholders = array_fill(0, $memberCount, '?'); $placeholders = array_fill(0, $memberCount, '?');
$stmt = implode(', ', $placeholders); $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); $result = $query->execute($ids);
return $result->fetchAll(); return $result->fetchAll();
} }
public static function updateMemberActivity($memberId){ 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( $query->execute(array(
time(), time(),
$memberId $memberId
@ -65,7 +65,7 @@ class Member {
$activeSince = $lastActivity; $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)); $result = $query->execute(array($esId, $activeSince));
return $result->fetchAll(); return $result->fetchAll();
} }
@ -78,7 +78,7 @@ class Member {
public static function cleanSession($esId){ public static function cleanSession($esId){
$time = self::getInactivityPeriod(); $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( $result = $query->execute(array(
$esId, $esId,
$time, $time,
@ -97,7 +97,7 @@ class Member {
* @param timestamp $time * @param timestamp $time
*/ */
protected static function deactivate($esId, $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( $query->execute(array(
self::MEMBER_STATUS_INACTIVE, self::MEMBER_STATUS_INACTIVE,
$esId, $esId,

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,12 +9,12 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Op { class Op {
public static function add($esId, $memberId, $opspec){ 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( $query->execute(array(
$esId, $esId,
$memberId, $memberId,
@ -22,7 +22,7 @@ class Op {
)); ));
// throw something - if query fails - thats fatal // 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){ 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 * @returns "" when there are no Ops, or the seq of the last Op
*/ */
public static function getHeadSeq($esId){ 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( $result = $query->execute(array(
$esId $esId
)) ))
@ -67,7 +67,7 @@ class Op {
if ($seq == ""){ if ($seq == ""){
$seq = -1; $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)); $result = $query->execute(array($esId, $seq));
return $result->fetchAll(); return $result->fetchAll();
} }

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,7 +9,7 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Request { class Request {
protected $data = array(); protected $data = array();

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,12 +9,12 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Session { class Session {
public static function add($genesis, $hash, $fileId){ 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( $data = array(
'es_id' => self::getUniqueSessionId(), 'es_id' => self::getUniqueSessionId(),
@ -32,20 +32,20 @@ class Session {
} }
public static function getAll(){ 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(); $result = $query->execute();
return $result->fetchAll(); return $result->fetchAll();
} }
public static function getSession($id){ 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)); $result = $query->execute(array($id));
return $result->fetchRow(); return $result->fetchRow();
} }
public static function getInfo($esId){ 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( $result = $query->execute(
array( array(
\OCP\User::getUser(), \OCP\User::getUser(),
@ -61,7 +61,7 @@ class Session {
} }
public static function getSessionByFileId($fileId){ 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)); $result = $query->execute(array($fileId));
return $result->fetchRow(); return $result->fetchRow();
} }
@ -74,7 +74,7 @@ class Session {
$placeholders = array_fill(0, $fileIdCount, '?'); $placeholders = array_fill(0, $fileIdCount, '?');
$stmt = implode(', ', $placeholders); $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( $result = $query->execute(
array_merge(array(\OCP\User::getUser()), $fileIds) array_merge(array(\OCP\User::getUser()), $fileIds)
); );

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Frank Karlitschek * @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org * @copyright 2012 Frank Karlitschek frank@owncloud.org
@ -22,7 +22,7 @@
*/ */
namespace OCA\Office; namespace OCA\Documents;
class Storage { class Storage {

@ -1,6 +1,6 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -9,25 +9,25 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
class View extends \OC\Files\View{ class View extends \OC\Files\View{
const OFFICE_DIRNAME='/office'; const DOCUMENTS_DIRNAME='/documents';
protected static $officeView; protected static $documentsView;
public static function initOfficeView($uid){ public static function initDocumentsView($uid){
$view = new \OC\Files\View('/' . $uid); $view = new \OC\Files\View('/' . $uid);
if (!$view->is_dir(self::OFFICE_DIRNAME)) { if (!$view->is_dir(self::DOCUMENTS_DIRNAME)) {
$view->mkdir(self::OFFICE_DIRNAME); $view->mkdir(self::DOCUMENTS_DIRNAME);
} }
//if (!self::$officeView){ //if (!self::$documentsView){
// self::$officeView = new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME); // self::$documentsView = new \OC\Files\View('/' . $uid . self::DOCUMENTS_DIRNAME);
//} //}
// it was a bad idea to use a static method. // it was a bad idea to use a static method.
// to be changed later // 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){ public static function storeDocument($uid, $filePath){
@ -43,13 +43,13 @@ class View extends \OC\Files\View{
$newName = '/' . sha1($view->file_get_contents($relPath)) . '.odt'; $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; \OC_FileProxy::$enabled = $proxyStatus;
return $newName; return $newName;
} }
public static function getHashByGenesis($uid, $genesisPath){ public static function getHashByGenesis($uid, $genesisPath){
$officeView = self::initOfficeView($uid); $documentsView = self::initDocumentsView($uid);
return sha1($officeView->file_get_contents($genesisPath)); return sha1($documentsView->file_get_contents($genesisPath));
} }
} }

@ -1,7 +1,7 @@
<?php <?php
/** /**
* ownCloud - Office App * ownCloud - Documents App
* *
* @author Victor Dubiniuk * @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
@ -10,12 +10,12 @@
* later. * later.
*/ */
namespace OCA\Office; namespace OCA\Documents;
\OCP\Util::addScript('office', 'settings'); \OCP\Util::addScript('documents', 'settings');
$tmpl = new \OCP\Template('office', 'settings'); $tmpl = new \OCP\Template('documents', 'settings');
$unstable = \OCP\Config::getAppValue('office', 'unstable', 'false'); $unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false');
$tmpl->assign('unstable', $unstable); $tmpl->assign('unstable', $unstable);
return $tmpl->fetchPage(); return $tmpl->fetchPage();

@ -5,7 +5,7 @@
<button id="invite-send"><?php p('Send Invitation') ?></button> <button id="invite-send"><?php p('Send Invitation') ?></button>
</div> </div>
</div> </div>
<div id="office-content"> <div id="documents-content">
<div id="editor-content"> <div id="editor-content">
<ul class="documentslist"> <ul class="documentslist">
<li class="add-document"> <li class="add-document">

@ -1,5 +1,5 @@
<fieldset class="personalblock" id="office"> <fieldset class="personalblock" id="documents">
<legend><strong><?php p($l->t('Office')) ?></strong></legend> <legend><strong><?php p($l->t('Documents')) ?></strong></legend>
<table class="nostyle"> <table class="nostyle">
<tbody><tr> <tbody><tr>
<td> <td>

Loading…
Cancel
Save