From 1c759cda628795b17754a738c6627d704b5b2586 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Sat, 17 Aug 2013 20:09:52 +0300 Subject: [PATCH] Switch to fileid. Missed file --- ajax/controller.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/ajax/controller.php b/ajax/controller.php index e0ba5235..3d43497d 100644 --- a/ajax/controller.php +++ b/ajax/controller.php @@ -30,21 +30,16 @@ class Controller { public static function startSession($args){ $uid = self::getUser(); - $path = @$_POST['path']; + $fileid = @$_POST['fileid']; $officeView = View::initOfficeView($uid); - - if (!$officeView->file_exists($path)){ - $genesisPath = View::storeDocument($uid, $path); - } else { - $genesisPath = $path; - } + $genesisPath = View::storeDocument($uid, $fileid); if ($genesisPath){ $session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath); try { if (!$session){ $hash = View::getHashByGenesis($uid, $genesisPath); - $session = Session::add($genesisPath, $hash, $path); + $session = Session::add($genesisPath, $hash, $fileid); } $session['member_id'] = (string) Member::add($session['es_id'], \OCP\User::getUser(), self::getRandomColor()); @@ -95,6 +90,23 @@ class Controller { )); } + public static function listSessionFor(){ + self::getUser(); + $path = @$_POST['path']; + $sessions = Session::getAll(); + if (!is_array($sessions)){ + $sessions = array(); + } + + $preparedSessions = array_map( + function($x){return ($x['es_id']);}, + $sessions + ); + \OCP\JSON::success(array( + "session_list" => $preparedSessions + )); + } + public static function listSessionsHtml(){ self::getUser(); $sessions = Session::getAll();