diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-06-24 19:16:50 -0400 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-27 01:05:36 +0200 |
commit | bc68f14c4baba0438bf019af144564eec6624760 (patch) | |
tree | a90dca4210376ff5aa98a197927ad527364b8fde /core/ajax | |
parent | 819811461535cceb8208651f6a131cbb97efd169 (diff) | |
download | nextcloud-server-bc68f14c4baba0438bf019af144564eec6624760.tar.gz nextcloud-server-bc68f14c4baba0438bf019af144564eec6624760.zip |
Prepare drop down UI for share API
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index f87c12dbb59..11fee4a000b 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -20,23 +20,40 @@ */ OCP\JSON::checkLoggedIn(); -switch ($_POST['action']) { - case 'share': - $return = OCP\Share::share($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); - ($return) ? OCP\JSON::success() : OCP\JSON::error(); - break; - case 'unshare': - $return = OCP\Share::unshare($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith']); - ($return) ? OCP\JSON::success() : OCP\JSON::error(); - break; - case 'setTarget': - $return = OCP\Share::setTarget($_POST['itemType'], $_POST['item'], $_POST['newTarget']); - ($return) ? OCP\JSON::success() : OCP\JSON::error(); - break; - case 'setPermissions': - $return = OCP\Share::setPermissions($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); - ($return) ? OCP\JSON::success() : OCP\JSON::error(); - break; +if (isset($_POST['action'])) { + switch ($_POST['action']) { + case 'share': + $return = OCP\Share::share($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); + // TODO May need to return private link + ($return) ? OCP\JSON::success() : OCP\JSON::error(); + break; + case 'unshare': + $return = OCP\Share::unshare($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith']); + ($return) ? OCP\JSON::success() : OCP\JSON::error(); + break; + case 'setTarget': + $return = OCP\Share::setTarget($_POST['itemType'], $_POST['item'], $_POST['newTarget']); + ($return) ? OCP\JSON::success() : OCP\JSON::error(); + break; + case 'setPermissions': + $return = OCP\Share::setPermissions($_POST['itemType'], $_POST['item'], $_POST['shareType'], $_POST['shareWith'], $_POST['permissions']); + ($return) ? OCP\JSON::success() : OCP\JSON::error(); + break; + } +} else if (isset($_GET['fetch'])) { + switch ($_GET['fetch']) { + case 'getItemsSharedStatuses': + $return = OCP\Share::getItemsSharedStatuses($_POST['itemType']); + ($return) ? OCP\JSON::success(array('data' => $return)) : OCP\JSON::error(); + break; + case 'getItemShared': + $return = OCP\Share::getItemShared($_POST['itemType'], $_POST['item']); + ($return) ? OCP\JSON::success(array('data' => $return)) : OCP\JSON::error(); + break; + case 'getShareWith': + // TODO Autocomplete for all users, groups, etc. + break; + } } ?>
\ No newline at end of file |