summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax
diff options
context:
space:
mode:
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