Initial session list

pull/1/head
Victor Dubiniuk 11 years ago committed by Tobias Hintze
parent 842c397e38
commit 013bf8eb6e

@ -11,7 +11,6 @@
namespace OCA\Office;
// Check if we are a user
\OCP\User::checkLoggedIn();
$session = Session::getSession($_SERVER['QUERY_STRING']);

@ -66,7 +66,7 @@ try{
$esId = $request->getParam('args/es_id');
$memberId = $request->getParam('args/member_id');
$ops = $request->getParam('args/client_ops');
$hasOps = is_array($ops) && count($ops>0);
$hasOps = is_array($ops) && count($ops)>0;
$currentHead = OCA\Office\Op::getHeadSeq($esId);

@ -0,0 +1,9 @@
<?php
namespace OCA\Office;
\OCP\User::checkLoggedIn();
\OCP\JSON::success(array(
'sessions' => Session::getAllSessions()
));

@ -4,3 +4,14 @@
.documentslist tr:hover { backgound-color:#aaa; }
.documentslist tr td { padding:5px; }
#allsessions{
position: absolute;
z-index: 100500;
top : 40px;
padding: 10px;
background: #ccc;
}
#allsessions div{
margin:5px 0;
}

@ -95,6 +95,26 @@ var officeMain = {
officeMain.onView
);
},
showSessions : function(){
if ($('#allsessions').length){
$('#allsessions').remove();
return;
}
$.post(OC.filePath('office', 'ajax', 'sessions.php'), {}, officeMain.onSessions);
},
onSessions : function(response){
if (response && response.sessions){
$(response.sessions).each( function(i, s){ officeMain.addSession(s) } );
}
},
addSession : function(s){
if (!$('#allsessions').length){
$(document.body).append('<div id="allsessions"></div>');
}
$('#allsessions').append('<div>'+s.es_id+ '</div>');
},
onClose: function() {
"use strict";
var bodyelement = document.getElementsByTagName('body')[0];
@ -119,4 +139,5 @@ $(document).ready(function() {
});
$('#odf_close').live('click', officeMain.onClose);
OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup);
$('#session-list').click(officeMain.showSessions);
});

@ -17,7 +17,7 @@ class Op {
}
public static function addOpsArray($esId, $memberId, $ops){
$lastSeq = false;
$lastSeq = "";
foreach ($ops as $op) {
$lastSeq = self::add($esId, $memberId, json_encode($op));
}
@ -52,7 +52,7 @@ class Op {
$oplist = array();
$query = \OCP\DB::prepare('SELECT `opspec` FROM `*PREFIX*office_op` WHERE `es_id`=? AND `seq`>? ORDER BY `seq` ASC');
$result = $query->execute(array($esId, $seq));
return $result;
return $result->fetchAll();
}
}

@ -3,6 +3,13 @@
namespace OCA\Office;
class Session {
public static function getAllSessions(){
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session`');
$result = $query->execute();
return $result->fetchAll();
}
public static function getSession($id){
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `es_id`= ?');
$result = $query->execute(array($id));

@ -1,4 +1,4 @@
<div id="controls"></div>
<div id="controls"><button id="session-list"><?php p($l->t('Sessions')) ?></button></div>
<?php if(empty($_['list'])) { ?>
<div id="emptyfolder"><?php p('No documents are found. Please upload a document into your ownCloud');?></div>
<?php } else { ?>

Loading…
Cancel
Save