diff options
author | Gregor Tätzner <gregor@freenet.de> | 2012-07-08 17:37:35 +0200 |
---|---|---|
committer | Gregor Tätzner <gregor@freenet.de> | 2012-07-08 17:37:35 +0200 |
commit | 70537725190ed54a4c3cc6a1d603cf3d1582a117 (patch) | |
tree | f59f35525ddee0c96b25c7780566a74d9f538d5c /ajax/createfeed.php | |
parent | e49ddd268532cd78bdb5ef9cf9e402f5e3ba3830 (diff) |
UI and model fixes
- added dropdown menu to choose parent in addfeedfolder setting
- added edit button to folder items
- foldermapper: also load children of children to show folder
hierarchy
Diffstat (limited to 'ajax/createfeed.php')
-rw-r--r-- | ajax/createfeed.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ajax/createfeed.php b/ajax/createfeed.php new file mode 100644 index 000000000..e5c0396a6 --- /dev/null +++ b/ajax/createfeed.php @@ -0,0 +1,37 @@ +<?php +/** +* ownCloud - News app +* +* @author Alessandro Cosentino +* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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(); + +$userid = OCP\USER::getUser(); + +$feedurl = trim($_POST['feedurl']); +$folderid = trim($_POST['folderid']); + +$feed = OC_News_Utils::fetch($feedurl); +$feedmapper = new OC_News_FeedMapper(); +$feedid = $feedmapper->save($feed, $folderid); + +$l = OC_L10N::get('news'); + +if(!$feedid) { + OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.')))); + OCP\Util::writeLog('news','ajax/newfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR); + exit(); +} + +//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations +OCP\JSON::success(array('data' => array('message' => $l->t('Feed added!')))); + |