Sample ops
This commit is contained in:
parent
fe7a2124bd
commit
9bf29b2913
@ -34,6 +34,7 @@
|
|||||||
* @source: http://www.webodf.org/
|
* @source: http://www.webodf.org/
|
||||||
* @source: http://gitorious.org/webodf/webodf/
|
* @source: http://gitorious.org/webodf/webodf/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// OCP\JSON::checkLoggedIn();
|
// OCP\JSON::checkLoggedIn();
|
||||||
// OCP\JSON::checkAppEnabled('office');
|
// OCP\JSON::checkAppEnabled('office');
|
||||||
// session_write_close();
|
// session_write_close();
|
||||||
@ -51,21 +52,37 @@ function bogusSession($i){
|
|||||||
|
|
||||||
$command = isset($_POST['command']) ? $_POST['command'] : '';
|
$command = isset($_POST['command']) ? $_POST['command'] : '';
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
$response = array();
|
||||||
|
|
||||||
switch ($command){
|
switch ($command){
|
||||||
case 'session-list':
|
case 'session-list':
|
||||||
$bogusSessionList = array();
|
$response["session_list"] = array(bogusSession(0), bogusSession(1));
|
||||||
$bogusSessionList["session_list"] = array(bogusSession(0), bogusSession(1));
|
|
||||||
print json_encode($bogusSessionList, JSON_PRETTY_PRINT) . "\n";
|
|
||||||
break;
|
break;
|
||||||
case 'join-session':
|
case 'join-session':
|
||||||
print "true";
|
|
||||||
break;
|
break;
|
||||||
case 'sync-ops':
|
case 'sync-ops':
|
||||||
// completely bogus
|
// 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;
|
break;
|
||||||
default:
|
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');
|
OCP\JSON::checkAppEnabled('office');
|
||||||
session_write_close();
|
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'];
|
$file = $_GET['filepath'];
|
||||||
\OCP\Preview::show($file,120,120);
|
\OCP\Preview::show($file, 120, 120);
|
||||||
|
10
lib/op.php
10
lib/op.php
@ -4,4 +4,14 @@ namespace OCA\Office;
|
|||||||
|
|
||||||
class Op {
|
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