Initial backend for save

pull/1/head
Victor Dubiniuk 11 years ago committed by Tobias Hintze
parent 9d7983d13c
commit 32b08e7040

@ -74,6 +74,26 @@ class Controller {
\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(){
self::getUser();
$sessions = Session::getAll();

@ -59,6 +59,11 @@ $this->create('office_session_join', 'ajax/session/join/{es_id}')
->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')
->get()

Loading…
Cancel
Save