Respond to session-list
This commit is contained in:
parent
9658890600
commit
2632387517
@ -38,24 +38,21 @@
|
||||
// OCP\JSON::checkAppEnabled('office');
|
||||
// session_write_close();
|
||||
|
||||
function bogusSession($i){
|
||||
$bs = array();
|
||||
$bs["denomination"] = "[$i] bogus session";
|
||||
$bs["id"] = "$i";
|
||||
$bs["title"] = "bogus.odt";
|
||||
$bs["mimetype"] = "application/vnd.oasis.opendocument.text";
|
||||
$bs["members"] = $bs["cursors"] = array("bob_10002", "alice_10001");
|
||||
$bs["creation_date"] = "2013-07-16T18:52:50.120Z";
|
||||
return $bs;
|
||||
}
|
||||
|
||||
$response = array();
|
||||
try{
|
||||
$request = new OCA\Office\Request();
|
||||
$command = $request->getParam('command');
|
||||
switch ($command){
|
||||
case 'session-list':
|
||||
$response["session_list"] = array(bogusSession(0), bogusSession(1));
|
||||
$sessions = OCA\Office\Session::getAllSessions();
|
||||
if (!is_array($sessions)){
|
||||
$sessions = array();
|
||||
}
|
||||
|
||||
$response["session_list"] = array_map(
|
||||
function($x){return ($x['es_id']);},
|
||||
$sessions
|
||||
);
|
||||
break;
|
||||
case 'join-session':
|
||||
$response = "true"; // should fail when session is non-existent
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - Office App
|
||||
*
|
||||
* @author Victor Dubiniuk
|
||||
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
*/
|
||||
|
||||
namespace OCA\Office;
|
||||
|
||||
// Check if we are a user
|
||||
\OCP\JSON::checkLoggedIn();
|
||||
|
||||
$genesis = @$_POST['genesis'];
|
||||
|
||||
$uid = \OCP\User::getUser();
|
||||
$officeView = View::initOfficeView($uid);
|
||||
if (!$officeView->file_exists($genesis)){
|
||||
$genesisPath = View::storeDocument($uid, $genesis);
|
||||
} else {
|
||||
$genesisPath = $genesis;
|
||||
}
|
||||
|
||||
if ($genesisPath){
|
||||
$session = Session::getSessionByPath($genesisPath);
|
||||
if (!$session){
|
||||
$hash = View::getHashByGenesis($uid, $genesisPath);
|
||||
$session = Session::addSession($genesisPath, $hash);
|
||||
}
|
||||
\OCP\JSON::success($session);
|
||||
exit();
|
||||
}
|
||||
\OCP\JSON::error();
|
@ -24,7 +24,6 @@ class Range extends \OCA\Office\Download {
|
||||
}
|
||||
|
||||
public function sendResponse(){
|
||||
$this->view = View::initOfficeView(\OCP\User::getUser());
|
||||
if (!preg_match('/^bytes=\d*-\d*(,\d*-\d*)*$/', $_SERVER['HTTP_RANGE'])){
|
||||
$this->sendNotSatisfiable();
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ class Simple extends \OCA\Office\Download {
|
||||
}
|
||||
|
||||
public function sendResponse(){
|
||||
$this->view = View::initOfficeView(\OCP\User::getUser());
|
||||
header( 'Content-Type:' . $this->getMimeType() );
|
||||
|
||||
$encodedName = rawurlencode($this->getFilename());
|
||||
|
@ -48,7 +48,7 @@ class Op {
|
||||
}
|
||||
|
||||
public static function getOpsAfterJson($esId, $seq){
|
||||
$ops =self::getOpsAfter($esId, $seq);
|
||||
$ops = self::getOpsAfter($esId, $seq);
|
||||
$ops = array_map(
|
||||
function($x){return json_decode($x['opspec']);},
|
||||
$ops
|
||||
|
Loading…
x
Reference in New Issue
Block a user