summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2011-12-21 21:55:52 +0100
committerBartek Przybylski <bart.p.pl@gmail.com>2011-12-21 21:55:52 +0100
commit1383cb51e7672b422732a1d20379baaa4f3f7b62 (patch)
tree555a4c11f738b30dbacf20fc5866f34fc6eb1276 /apps/gallery/ajax
parent6a1a7fcd268e90a3b6c33f9568403a441ce983da (diff)
downloadnextcloud-server-1383cb51e7672b422732a1d20379baaa4f3f7b62.tar.gz
nextcloud-server-1383cb51e7672b422732a1d20379baaa4f3f7b62.zip
removing and renaming albums
Diffstat (limited to 'apps/gallery/ajax')
-rw-r--r--apps/gallery/ajax/galleryOp.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
new file mode 100644
index 00000000000..cd7cab202b1
--- /dev/null
+++ b/apps/gallery/ajax/galleryOp.php
@@ -0,0 +1,29 @@
+<?
+require_once('../../../lib/base.php');
+require_once('../lib/album.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('gallery');
+
+function handleRename($oldname, $newname) {
+ OC_Gallery_Album::rename($oldname, $newname, OC_User::getUser());
+}
+
+function handleRemove($name) {
+ OC_Gallery_Album::remove(OC_User::getUser(), $name);
+}
+
+if ($_GET['operation']) {
+ switch($_GET['operation']) {
+ case "rename":
+ handleRename($_GET['oldname'], $_GET['newname']);
+ OC_JSON::success(array('newname' => $_GET['newname']));
+ break;
+ case "remove":
+ handleRemove($_GET['name']);
+ OC_JSON::success();
+ break;
+ default:
+ OC_JSON::error(array('cause' => "Unknown operation"));
+ }
+}
+?> \ No newline at end of file