diff --git a/appinfo/database.xml b/appinfo/database.xml index 842144bf..c657284c 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -29,7 +29,7 @@ To be sure the genesis did not change - document_path + file_id text true diff --git a/appinfo/version b/appinfo/version index 2411653a..c52db980 100755 --- a/appinfo/version +++ b/appinfo/version @@ -1 +1 @@ -0.5.2 \ No newline at end of file +0.5.3 \ No newline at end of file diff --git a/js/office.js b/js/office.js index 9eccb20f..b4ecf122 100644 --- a/js/office.js +++ b/js/office.js @@ -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'), {}); }, diff --git a/lib/session.php b/lib/session.php index d6fb55b9..f36d56d1 100644 --- a/lib/session.php +++ b/lib/session.php @@ -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)); diff --git a/lib/view.php b/lib/view.php index 6be9daa5..c9771738 100644 --- a/lib/view.php +++ b/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; + $path = \OC\Files\Cache\Cache::getById($fileid); + if (is_null($path)){ + // No longer exists + } else { + $path = $path[1]; + } + $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; return $newName; } diff --git a/templates/documents.php b/templates/documents.php index fa155798..2f0627be 100755 --- a/templates/documents.php +++ b/templates/documents.php @@ -15,14 +15,14 @@
- + - @@ -32,4 +32,4 @@
+ +
- \ No newline at end of file +