Sample ops
This commit is contained in:
parent
fe7a2124bd
commit
9bf29b2913
@ -34,6 +34,7 @@
|
||||
* @source: http://www.webodf.org/
|
||||
* @source: http://gitorious.org/webodf/webodf/
|
||||
*/
|
||||
|
||||
// OCP\JSON::checkLoggedIn();
|
||||
// OCP\JSON::checkAppEnabled('office');
|
||||
// session_write_close();
|
||||
@ -51,21 +52,37 @@ function bogusSession($i){
|
||||
|
||||
$command = isset($_POST['command']) ? $_POST['command'] : '';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$response = array();
|
||||
switch ($command){
|
||||
case 'session-list':
|
||||
$bogusSessionList = array();
|
||||
$bogusSessionList["session_list"] = array(bogusSession(0), bogusSession(1));
|
||||
print json_encode($bogusSessionList, JSON_PRETTY_PRINT) . "\n";
|
||||
$response["session_list"] = array(bogusSession(0), bogusSession(1));
|
||||
break;
|
||||
case 'join-session':
|
||||
print "true";
|
||||
|
||||
break;
|
||||
case 'sync-ops':
|
||||
// completely bogus
|
||||
print '{"result":"newOps","ops":[],"headSeq":-1}';
|
||||
/*
|
||||
* try {
|
||||
* OCA\Office\Op::add(
|
||||
* array(
|
||||
* 'es_id' => ES_ID,
|
||||
* 'seq' => SEQ,
|
||||
* 'member' => MEMBER,
|
||||
* 'opspec' => OPSPEC
|
||||
* )
|
||||
* );
|
||||
* } catch (Exception $e) {
|
||||
*
|
||||
* }
|
||||
*/
|
||||
$response['result'] = 'newOps';
|
||||
$response['ops'] = array();
|
||||
$response['headSeq'] = -1;
|
||||
break;
|
||||
default:
|
||||
print "unknown command"; // TODO send HTTP 400 response
|
||||
header('HTTP/1.1 400: BAD REQUEST');
|
||||
exit();
|
||||
}
|
||||
|
||||
\OCP\JSON::success($response);
|
||||
|
@ -25,5 +25,8 @@ OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('office');
|
||||
session_write_close();
|
||||
|
||||
// TODO: short-circuit or fix the http 500 that happens on ajax/thumbnail.php
|
||||
// or just wait unit preview is merged to core ;)
|
||||
|
||||
$file = $_GET['filepath'];
|
||||
\OCP\Preview::show($file,120,120);
|
||||
\OCP\Preview::show($file, 120, 120);
|
||||
|
12
lib/op.php
12
lib/op.php
@ -3,5 +3,15 @@
|
||||
namespace OCA\Office;
|
||||
|
||||
class Op {
|
||||
|
||||
|
||||
public function add($op){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_op` (`es_id`, `seq`, `member`, `opspec`) VALUES (?, ?, ?, ?) ');
|
||||
$result = $query->execute(array(
|
||||
$op['es_id'],
|
||||
$op['seq'],
|
||||
$op['member'],
|
||||
$op['opspec'],
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user