summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-06 11:27:13 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-06 11:27:13 -0400
commit3b2c853916fb75968ae759e54bb61a8095debe7e (patch)
treea5aecb01d54747e0c249c904ba23405bd37e5c65 /apps
parent09bb3bfaf8bbc276ff23a2882d5591be542c0139 (diff)
downloadnextcloud-server-3b2c853916fb75968ae759e54bb61a8095debe7e.tar.gz
nextcloud-server-3b2c853916fb75968ae759e54bb61a8095debe7e.zip
Lots of refactoring to share API
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/appinfo/app.php8
-rw-r--r--apps/contacts/lib/addressbook.php2
-rw-r--r--apps/files_sharing/lib/share/file.php18
-rw-r--r--apps/files_sharing/lib/share/folder.php9
-rw-r--r--apps/files_sharing/sharedstorage.php2
-rw-r--r--apps/gallery/appinfo/app.php2
-rw-r--r--apps/gallery/lib/share.php2
7 files changed, 26 insertions, 17 deletions
diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php
index aa0f229dd9f..3c32f7f5c93 100644
--- a/apps/contacts/appinfo/app.php
+++ b/apps/contacts/appinfo/app.php
@@ -3,8 +3,8 @@ OC::$CLASSPATH['OC_Contacts_App'] = 'apps/contacts/lib/app.php';
OC::$CLASSPATH['OC_Contacts_Addressbook'] = 'apps/contacts/lib/addressbook.php';
OC::$CLASSPATH['OC_Contacts_VCard'] = 'apps/contacts/lib/vcard.php';
OC::$CLASSPATH['OC_Contacts_Hooks'] = 'apps/contacts/lib/hooks.php';
-OC::$CLASSPATH['OC_Share_Contact_Backend'] = 'apps/contacts/lib/share/contact.php';
-OC::$CLASSPATH['OC_Share_Addressbook_Backend'] = 'apps/contacts/lib/share/addressbook.php';
+OC::$CLASSPATH['OC_Share_Backend_Contact'] = 'apps/contacts/lib/share/contact.php';
+OC::$CLASSPATH['OC_Share_Backend_Addressbook'] = 'apps/contacts/lib/share/addressbook.php';
OC::$CLASSPATH['OC_Connector_Sabre_CardDAV'] = 'apps/contacts/lib/connector_sabre.php';
OC::$CLASSPATH['Sabre_CardDAV_VCFExportPlugin'] = 'apps/contacts/lib/VCFExportPlugin.php';
OC::$CLASSPATH['OC_Search_Provider_Contacts'] = 'apps/contacts/lib/search.php';
@@ -24,6 +24,6 @@ OCP\App::addNavigationEntry( array(
OCP\App::registerPersonal('contacts', 'settings');
OCP\Util::addscript('contacts', 'loader');
OC_Search::registerProvider('OC_Search_Provider_Contacts');
-OCP\Share::registerBackend('contact', 'OC_Share_Contact_Backend');
-OCP\Share::registerBackend('addressbook', 'OC_Share_Addressbook_Backend', 'contact');
+OCP\Share::registerBackend('contact', 'OC_Share_Backend_Contact');
+OCP\Share::registerBackend('addressbook', 'OC_Share_Backend_Addressbook', 'contact');
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index d3cceb58807..a81b1f77985 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -64,7 +64,7 @@ class OC_Contacts_Addressbook {
while( $row = $result->fetchRow()) {
$addressbooks[] = $row;
}
- $addressbooks = array_merge($addressbooks, OCP\Share::getItemsSharedWith('addressbook', OC_Share_Addressbook_Backend::FORMAT_ADDRESSBOOKS));
+ $addressbooks = array_merge($addressbooks, OCP\Share::getItemsSharedWith('addressbook', OC_Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS));
if(!$active && !count($addressbooks)) {
self::addDefault($uid);
}
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index dd63539cdfe..927e9462f23 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -20,23 +20,27 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class OC_Share_Backend_File extends OCP\Share_Backend {
+class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
const FORMAT_SHARED_STORAGE = 0;
const FORMAT_FILE_APP = 1;
const FORMAT_FILE_APP_ROOT = 2;
const FORMAT_OPENDIR = 3;
- public function getSource($item, $uid) {
- if (OC_Filesystem::file_exists($item)) {
- return array('item' => null, 'file' => $item);
- }
- return false;
+ public function isValidSource($item, $uid) {
+// if (OC_Filesystem::file_exists($item)) {
+ return true;
+// }
+// return false;
+ }
+
+ public function getFilePath($item, $uid) {
+ return $item;
}
public function generateTarget($item, $uid, $exclude = null) {
// TODO Make sure target path doesn't exist already
- return '/Shared'.$item;
+ return $item;
}
public function formatItems($items, $format, $parameters = null) {
diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php
index a43ce2b2caf..2f101d33c8a 100644
--- a/apps/files_sharing/lib/share/folder.php
+++ b/apps/files_sharing/lib/share/folder.php
@@ -25,8 +25,13 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File {
// TODO
}
- public function getChildrenSources($item) {
- return OC_FileCache::getFolderContent($item);
+ public function getChildren($itemSource) {
+ $files = OC_FileCache::getFolderContent($itemSource);
+ $sources = array();
+ foreach ($files as $file) {
+ $sources[] = $file['path'];
+ }
+ return $sources;
}
public function formatItems($items, $format, $parameters = null) {
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 2071942b062..6e37837aac9 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -38,7 +38,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
* @return Returns array with the keys path and permissions or false if not found
*/
private function getFile($target) {
- $target = $this->sharedFolder.'/'.$target;
+ $target = '/'.$target;
$target = rtrim($target, '/');
if (isset($this->files[$target])) {
return $this->files[$target];
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index 9efb4346c3e..9103f66441d 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -30,7 +30,7 @@ OC::$CLASSPATH['Pictures_Managers'] = 'gallery/lib/managers.php';
OC::$CLASSPATH['Pictures_Tiles'] = 'gallery/lib/tiles.php';
OC::$CLASSPATH['OC_Share_Backend_Photo'] = 'gallery/lib/share.php';
-OCP\Share::registerBackend('photo', new OC_Share_Backend_Photo());
+// OCP\Share::registerBackend('photo', new OC_Share_Backend_Photo());
$l = OC_L10N::get('gallery');
diff --git a/apps/gallery/lib/share.php b/apps/gallery/lib/share.php
index 6f3db45375f..d6c5f40d492 100644
--- a/apps/gallery/lib/share.php
+++ b/apps/gallery/lib/share.php
@@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class OC_Share_Backend_Photo extends OCP\Share_Backend {
+abstract class OC_Share_Photo_Backend implements OCP\Share_Backend {
public $dependsOn = 'file';
public $supportedFileExtensions = array('jpg', 'png', 'gif');