Initial session list
This commit is contained in:
parent
842c397e38
commit
013bf8eb6e
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace OCA\Office;
|
namespace OCA\Office;
|
||||||
|
|
||||||
// Check if we are a user
|
|
||||||
\OCP\User::checkLoggedIn();
|
\OCP\User::checkLoggedIn();
|
||||||
|
|
||||||
$session = Session::getSession($_SERVER['QUERY_STRING']);
|
$session = Session::getSession($_SERVER['QUERY_STRING']);
|
||||||
|
@ -66,7 +66,7 @@ try{
|
|||||||
$esId = $request->getParam('args/es_id');
|
$esId = $request->getParam('args/es_id');
|
||||||
$memberId = $request->getParam('args/member_id');
|
$memberId = $request->getParam('args/member_id');
|
||||||
$ops = $request->getParam('args/client_ops');
|
$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);
|
$currentHead = OCA\Office\Op::getHeadSeq($esId);
|
||||||
|
|
||||||
|
9
ajax/sessions.php
Normal file
9
ajax/sessions.php
Normal file
@ -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:hover { backgound-color:#aaa; }
|
||||||
.documentslist tr td { padding:5px; }
|
.documentslist tr td { padding:5px; }
|
||||||
|
|
||||||
|
#allsessions{
|
||||||
|
position: absolute;
|
||||||
|
z-index: 100500;
|
||||||
|
top : 40px;
|
||||||
|
padding: 10px;
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#allsessions div{
|
||||||
|
margin:5px 0;
|
||||||
|
}
|
21
js/office.js
21
js/office.js
@ -95,6 +95,26 @@ var officeMain = {
|
|||||||
officeMain.onView
|
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() {
|
onClose: function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
var bodyelement = document.getElementsByTagName('body')[0];
|
var bodyelement = document.getElementsByTagName('body')[0];
|
||||||
@ -119,4 +139,5 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
$('#odf_close').live('click', officeMain.onClose);
|
$('#odf_close').live('click', officeMain.onClose);
|
||||||
OC.addScript('office', 'dojo-amalgamation', officeMain.onStartup);
|
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){
|
public static function addOpsArray($esId, $memberId, $ops){
|
||||||
$lastSeq = false;
|
$lastSeq = "";
|
||||||
foreach ($ops as $op) {
|
foreach ($ops as $op) {
|
||||||
$lastSeq = self::add($esId, $memberId, json_encode($op));
|
$lastSeq = self::add($esId, $memberId, json_encode($op));
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ class Op {
|
|||||||
$oplist = array();
|
$oplist = array();
|
||||||
$query = \OCP\DB::prepare('SELECT `opspec` FROM `*PREFIX*office_op` WHERE `es_id`=? AND `seq`>? ORDER BY `seq` ASC');
|
$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));
|
$result = $query->execute(array($esId, $seq));
|
||||||
return $result;
|
return $result->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,13 @@
|
|||||||
namespace OCA\Office;
|
namespace OCA\Office;
|
||||||
|
|
||||||
class Session {
|
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){
|
public static function getSession($id){
|
||||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `es_id`= ?');
|
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `es_id`= ?');
|
||||||
$result = $query->execute(array($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'])) { ?>
|
<?php if(empty($_['list'])) { ?>
|
||||||
<div id="emptyfolder"><?php p('No documents are found. Please upload a document into your ownCloud');?></div>
|
<div id="emptyfolder"><?php p('No documents are found. Please upload a document into your ownCloud');?></div>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user