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