summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-02 17:08:33 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-02 17:09:59 +0200
commitf8ce1854ba4678c001cb317329bde46008dcd1ea (patch)
tree63874865dc29088bb287052da5a450eed1f62548 /ajax
parenta5495046a484fd699717463185de3a9018f96c81 (diff)
changing folder names works now
Diffstat (limited to 'ajax')
-rw-r--r--ajax/changefoldername.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/ajax/changefoldername.php b/ajax/changefoldername.php
new file mode 100644
index 000000000..7031364f6
--- /dev/null
+++ b/ajax/changefoldername.php
@@ -0,0 +1,34 @@
+<?php
+/**
+* ownCloud - News app
+*
+* @author Bernhard Posselt
+* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
+*
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
+*
+*/
+
+// Check if we are a user
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('news');
+OCP\JSON::callCheck();
+
+$folderId = (int)$_POST['folderId'];
+$folderName = $_POST['folderName'];
+
+$folderMapper = new OCA\News\FolderMapper();
+$folder = $folderMapper->find($folderId);
+$folder->setName($folderName);
+$success = $folderMapper->update($folder);
+
+$l = OC_L10N::get('news');
+
+if(!$success) {
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error changing name of folder ' . $folderId . ' to ' . $folderName))));
+ OCP\Util::writeLog('news','ajax/setallitemsread.php: Error changing name of folder ' . $folderId . ' to ' . $folderName, OCP\Util::ERROR);
+ exit();
+}
+
+OCP\JSON::success(); \ No newline at end of file