Switch to fileid
This commit is contained in:
parent
da12ca4b55
commit
70a20ebc93
@ -29,7 +29,7 @@
|
||||
<comments>To be sure the genesis did not change</comments>
|
||||
</field>
|
||||
<field>
|
||||
<name>document_path</name>
|
||||
<name>file_id</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
|
@ -1 +1 @@
|
||||
0.5.2
|
||||
0.5.3
|
@ -91,7 +91,7 @@ var officeMain = {
|
||||
}
|
||||
|
||||
$.post(OC.Router.generate('office_session_start'),
|
||||
{'path': filepath},
|
||||
{'fileid': filepath},
|
||||
officeMain.initSession
|
||||
);
|
||||
},
|
||||
@ -101,6 +101,7 @@ var officeMain = {
|
||||
officeMain.initSession
|
||||
);
|
||||
},
|
||||
|
||||
updateSessions: function() {
|
||||
$('#editing-sessions').load(OC.Router.generate('office_session_listhtml'), {});
|
||||
},
|
||||
|
@ -13,15 +13,15 @@ namespace OCA\Office;
|
||||
|
||||
class Session {
|
||||
|
||||
public static function add($genesis, $hash, $documentPath){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `document_path`) VALUES (?, ?, ?, ?, ?) ');
|
||||
public static function add($genesis, $hash, $fileId){
|
||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `file_id`) VALUES (?, ?, ?, ?, ?) ');
|
||||
|
||||
$data = array(
|
||||
'es_id' => self::getUniqueSessionId(),
|
||||
'genesis_url' => $genesis,
|
||||
'genesis_hash' => $hash,
|
||||
'owner' => \OCP\User::getUser(),
|
||||
'document_path' => $documentPath
|
||||
'file_id' => $fileId
|
||||
);
|
||||
$result = $query->execute(array_values($data));
|
||||
|
||||
|
15
lib/view.php
15
lib/view.php
@ -30,14 +30,21 @@ class View extends \OC\Files\View{
|
||||
return new \OC\Files\View('/' . $uid . self::OFFICE_DIRNAME);
|
||||
}
|
||||
|
||||
public static function storeDocument($uid, $path){
|
||||
public static function storeDocument($uid, $fileid){
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$view = new \OC\Files\View('/' . $uid);
|
||||
$newName = '/' . sha1($view->file_get_contents('/files' . $path)) . '.odt';
|
||||
$path = \OC\Files\Cache\Cache::getById($fileid);
|
||||
if (is_null($path)){
|
||||
// No longer exists
|
||||
} else {
|
||||
$path = $path[1];
|
||||
}
|
||||
|
||||
$view->copy('/files' . $path, self::OFFICE_DIRNAME . $newName);
|
||||
$view = new \OC\Files\View('/' . $uid);
|
||||
$newName = '/' . sha1($view->file_get_contents($path)) . '.odt';
|
||||
|
||||
$view->copy( $path, self::OFFICE_DIRNAME . $newName);
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
return $newName;
|
||||
}
|
||||
|
@ -15,14 +15,14 @@
|
||||
<div id="editor-content">
|
||||
<table class="documentslist" >
|
||||
<?php foreach($_['list'] as $entry) { ?>
|
||||
<tr data-file="<?php \OCP\Util::encodePath(p($entry['path'])) ?>">
|
||||
<tr data-file="<?php p($entry['fileid']) ?>">
|
||||
<td width="1">
|
||||
<img align="left" src="<?php p(\OCP\Util::linkToAbsolute('office','ajax/thumbnail.php').'?filepath='.\OCP\Util::encodePath($entry['path'])) ?>" />
|
||||
</td>
|
||||
<td width="1">
|
||||
<!-- <td width="1">
|
||||
<img align="left" src="<?php p( \OCP\Util::linkToAbsolute('office','img/office.png')) ?>" />
|
||||
</td>
|
||||
<td>
|
||||
</td> -->
|
||||
<td width="100%">
|
||||
<a target="_blank" href="<?php p(\OCP\Util::linkToRoute('download', array('file' => $entry['path']))) ?>"><?php p($entry['name'])?></a>
|
||||
</td>
|
||||
<td><?php p(\OCP\Util::formatDate(intval($entry['mtime']))); ?></td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user