summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2012-03-04 00:35:37 +0100
committerBartek Przybylski <bart.p.pl@gmail.com>2012-03-04 00:35:37 +0100
commitc411826fe5e7662fb0f6dc5fbcb074c68b467ea4 (patch)
treeda23da095fcc3e034d09ab978337265c26e043ff /apps/gallery/ajax
parentf06858689f9709d3859f814ca57dfa54b9ed0865 (diff)
downloadnextcloud-server-c411826fe5e7662fb0f6dc5fbcb074c68b467ea4.tar.gz
nextcloud-server-c411826fe5e7662fb0f6dc5fbcb074c68b467ea4.zip
moving gallery op to one file, migrate gallery dialogs to oc dialogs
Diffstat (limited to 'apps/gallery/ajax')
-rw-r--r--apps/gallery/ajax/galleryOp.php19
-rw-r--r--apps/gallery/ajax/getAlbums.php41
2 files changed, 19 insertions, 41 deletions
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index c19344c0fbb..e768ce00c17 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -88,6 +88,22 @@ function handleStoreSettings($root, $order) {
OC_JSON::success(array('rescan' => $rescan));
}
+
+function handleGetGalleries() {
+ $a = array();
+
+ $result = OC_Gallery_Album::find(OC_User::getUser());
+
+ while ($r = $result->fetchRow()) {
+ $album_name = $r['album_name'];
+ $tmp_res = OC_Gallery_Photo::find($r['album_id']);
+
+ $a[] = array('name' => utf8_encode($album_name), 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
+ }
+
+ OC_JSON::success(array('albums'=>$a));
+}
+
if ($_GET['operation']) {
switch($_GET['operation']) {
case 'rename':
@@ -113,6 +129,9 @@ if ($_GET['operation']) {
case 'store_settings':
handleStoreSettings($_GET['root'], $_GET['order']);
break;
+ case 'get_galleries':
+ handleGetGalleries();
+ break;
default:
OC_JSON::error(array('cause' => 'Unknown operation'));
}
diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php
deleted file mode 100644
index be87af2abd3..00000000000
--- a/apps/gallery/ajax/getAlbums.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
-* ownCloud - gallery application
-*
-* @author Bartek Przybylski
-* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
-
-$a = array();
-
-$result = OC_Gallery_Album::find(OC_User::getUser());
-
-while ($r = $result->fetchRow()) {
- $album_name = $r['album_name'];
- $tmp_res = OC_Gallery_Photo::find($r['album_id']);
-
- $a[] = array('name' => utf8_encode($album_name), 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
-}
-
-OC_JSON::success(array('albums'=>$a));
-
-?>