Introducing memberId
This commit is contained in:
parent
a6977c2316
commit
32016d8381
@ -37,14 +37,22 @@ class Controller {
|
||||
|
||||
if ($genesisPath){
|
||||
$session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath);
|
||||
if (!$session){
|
||||
$hash = View::getHashByGenesis($uid, $genesisPath);
|
||||
$session = Session::add($genesisPath, $hash, $path);
|
||||
try {
|
||||
if (!$session){
|
||||
$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();
|
||||
exit();
|
||||
}
|
||||
|
||||
public static function sendAvatar(){
|
||||
|
@ -75,6 +75,7 @@ try{
|
||||
);
|
||||
break;
|
||||
case 'sync-ops':
|
||||
case 'sync_ops':
|
||||
$seqHead = $request->getParam('args/seq_head');
|
||||
if (!is_null($seqHead)){
|
||||
$esId = $request->getParam('args/es_id');
|
||||
|
@ -61,7 +61,7 @@ var officeMain = {
|
||||
$('#preview').html(canvashtml);
|
||||
|
||||
runtime.assert(response.es_id, "invalid session id.");
|
||||
memberId = response.es_id + "member";
|
||||
memberId = response.member_id;
|
||||
webodfEditor.boot(
|
||||
{
|
||||
collaborative: "owncloud",
|
||||
|
@ -17,7 +17,7 @@ class Member {
|
||||
const DEFAULT_ACTIVITY_THRESHOLD = 600; // 10 Minutes
|
||||
|
||||
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(
|
||||
$esId,
|
||||
\OCP\User::getUser(),
|
||||
@ -54,7 +54,7 @@ class Member {
|
||||
$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));
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user