Introducing memberId
This commit is contained in:
parent
a6977c2316
commit
32016d8381
@ -37,14 +37,22 @@ class Controller {
|
|||||||
|
|
||||||
if ($genesisPath){
|
if ($genesisPath){
|
||||||
$session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath);
|
$session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath);
|
||||||
if (!$session){
|
try {
|
||||||
$hash = View::getHashByGenesis($uid, $genesisPath);
|
if (!$session){
|
||||||
$session = Session::add($genesisPath, $hash, $path);
|
$hash = View::getHashByGenesis($uid, $genesisPath);
|
||||||
|
$session = Session::add($genesisPath, $hash, $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$session['member_id'] = Member::add($session['es_id'], \OCP\User::getDisplayName(), '#00f000');
|
||||||
|
|
||||||
|
\OCP\JSON::success($session);
|
||||||
|
exit();
|
||||||
|
} catch (\Exception $e){
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
\OCP\JSON::success($session);
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
\OCP\JSON::error();
|
\OCP\JSON::error();
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sendAvatar(){
|
public static function sendAvatar(){
|
||||||
|
@ -75,6 +75,7 @@ try{
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'sync-ops':
|
case 'sync-ops':
|
||||||
|
case 'sync_ops':
|
||||||
$seqHead = $request->getParam('args/seq_head');
|
$seqHead = $request->getParam('args/seq_head');
|
||||||
if (!is_null($seqHead)){
|
if (!is_null($seqHead)){
|
||||||
$esId = $request->getParam('args/es_id');
|
$esId = $request->getParam('args/es_id');
|
||||||
|
@ -61,7 +61,7 @@ var officeMain = {
|
|||||||
$('#preview').html(canvashtml);
|
$('#preview').html(canvashtml);
|
||||||
|
|
||||||
runtime.assert(response.es_id, "invalid session id.");
|
runtime.assert(response.es_id, "invalid session id.");
|
||||||
memberId = response.es_id + "member";
|
memberId = response.member_id;
|
||||||
webodfEditor.boot(
|
webodfEditor.boot(
|
||||||
{
|
{
|
||||||
collaborative: "owncloud",
|
collaborative: "owncloud",
|
||||||
|
@ -17,7 +17,7 @@ class Member {
|
|||||||
const DEFAULT_ACTIVITY_THRESHOLD = 600; // 10 Minutes
|
const DEFAULT_ACTIVITY_THRESHOLD = 600; // 10 Minutes
|
||||||
|
|
||||||
public static function add($esId, $displayname, $color){
|
public static function add($esId, $displayname, $color){
|
||||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_member` (`es_id`, `uid`, `color`, `lastactivity`) VALUES (?, ?, ?, ?) ');
|
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_member` (`es_id`, `uid`, `color`, `last_activity`) VALUES (?, ?, ?, ?) ');
|
||||||
$query->execute(array(
|
$query->execute(array(
|
||||||
$esId,
|
$esId,
|
||||||
\OCP\User::getUser(),
|
\OCP\User::getUser(),
|
||||||
@ -54,7 +54,7 @@ class Member {
|
|||||||
$activeSince = $lastActivity;
|
$activeSince = $lastActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_member` WHERE `es_id`= ? and lastactivity > ?');
|
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_member` WHERE `es_id`= ? and last_activity > ?');
|
||||||
$result = $query->execute(array($esId, $activeSince));
|
$result = $query->execute(array($esId, $activeSince));
|
||||||
return $result->fetchAll();
|
return $result->fetchAll();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user