Initial backend for save
This commit is contained in:
parent
9d7983d13c
commit
32b08e7040
@ -74,6 +74,26 @@ class Controller {
|
|||||||
\OCP\JSON::error();
|
\OCP\JSON::error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function save(){
|
||||||
|
$uid = self::getUser();
|
||||||
|
$esId = @$_POST['es_id'];
|
||||||
|
$memberId = @$_POST['member_id'];
|
||||||
|
$content = @$_POST['content'];
|
||||||
|
if ($esId && $content){
|
||||||
|
$session = Session::getSession($esId);
|
||||||
|
$fileInfo = \OC\Files\Cache\Cache::getById($session['file_id']);
|
||||||
|
$path = $fileInfo[1];
|
||||||
|
$view = new \OC\Files\View('/' . $session['owner']);
|
||||||
|
|
||||||
|
$canWrite = ($view->file_exists($path) && $view->isUpdatable($path)) || $view->isCreatable($path);
|
||||||
|
if ($canWrite){
|
||||||
|
$view->file_put_contents($path, $content);
|
||||||
|
} else {
|
||||||
|
// TODO: report an error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function listSessions(){
|
public static function listSessions(){
|
||||||
self::getUser();
|
self::getUser();
|
||||||
$sessions = Session::getAll();
|
$sessions = Session::getAll();
|
||||||
|
@ -59,6 +59,11 @@ $this->create('office_session_join', 'ajax/session/join/{es_id}')
|
|||||||
->action('\OCA\Office\Controller', 'joinSession')
|
->action('\OCA\Office\Controller', 'joinSession')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
$this->create('office_session_save', 'ajax/session/save')
|
||||||
|
->post()
|
||||||
|
->action('\OCA\Office\Controller', 'save')
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
$this->create('office_user_avatar', 'ajax/user/avatar')
|
$this->create('office_user_avatar', 'ajax/user/avatar')
|
||||||
->get()
|
->get()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user