From 25a766a00933ccbe5c24dc4c91bc93587e033abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20T=C3=A4tzner?= Date: Thu, 7 Mar 2013 18:25:31 +0100 Subject: implement folder modify and delete api calls --- appinfo/routes.php | 67 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 26 deletions(-) (limited to 'appinfo') diff --git a/appinfo/routes.php b/appinfo/routes.php index 1427d4443..095e03f83 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -26,7 +26,7 @@ require_once \OC_App::getAppPath('news') . '/appinfo/bootstrap.php'; function callController($controllerName, $methodName, $urlParams, $disableAdminCheck=true, $isAjax=false){ $container = createDIContainer(); - + // run security checks $security = $container['Security']; runSecurityChecks($security, $isAjax, $disableAdminCheck); @@ -60,7 +60,7 @@ function callAjaxController($controllerName, $methodName, $urlParams, $disableAd */ function runSecurityChecks($security, $isAjax=false, $disableAdminCheck=true){ if($disableAdminCheck){ - $security->setIsAdminCheck(false); + $security->setIsAdminCheck(false); } if($isAjax){ @@ -80,19 +80,19 @@ function runSecurityChecks($security, $isAjax=false, $disableAdminCheck=true){ * Normal Routes */ $this->create('news_index', '/')->action( - function($params){ + function($params){ callController('NewsController', 'index', $params, true); } ); $this->create('news_index_feed', '/feed/{feedid}')->action( - function($params){ + function($params){ callController('NewsController', 'index', $params, true); } ); $this->create('news_export_opml', '/export/opml')->action( - function($params){ + function($params){ callController('NewsController', 'exportOPML', $params, true); } ); @@ -102,13 +102,13 @@ $this->create('news_export_opml', '/export/opml')->action( * AJAX Routes */ $this->create('news_ajax_init', '/ajax/init')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'init', $params); } ); $this->create('news_ajax_setshowall', '/ajax/setshowall')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'setShowAll', $params); } ); @@ -118,25 +118,25 @@ $this->create('news_ajax_setshowall', '/ajax/setshowall')->action( * Folders */ $this->create('news_ajax_collapsefolder', '/ajax/collapsefolder')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'collapseFolder', $params); } ); $this->create('news_ajax_changefoldername', '/ajax/changefoldername')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'changeFolderName', $params); } ); $this->create('news_ajax_createfolder', '/ajax/createfolder')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'createFolder', $params); } ); $this->create('news_ajax_deletefolder', '/ajax/deletefolder')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'deleteFolder', $params); } ); @@ -146,31 +146,31 @@ $this->create('news_ajax_deletefolder', '/ajax/deletefolder')->action( * Feeds */ $this->create('news_ajax_loadfeed', '/ajax/loadfeed')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'loadFeed', $params); } ); $this->create('news_ajax_deletefeed', '/ajax/deletefeed')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'deleteFeed', $params); } ); $this->create('news_ajax_movefeedtofolder', '/ajax/movefeedtofolder')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'moveFeedToFolder', $params); } ); $this->create('news_ajax_updatefeed', '/ajax/updatefeed')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'updateFeed', $params); } ); $this->create('news_ajax_createfeed', '/ajax/createfeed')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'createFeed', $params); } ); @@ -180,13 +180,13 @@ $this->create('news_ajax_createfeed', '/ajax/createfeed')->action( * Items */ $this->create('news_ajax_setitemstatus', '/ajax/setitemstatus')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'setItemStatus', $params); } ); $this->create('news_ajax_setallitemsread', '/ajax/setallitemsread')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'setAllItemsRead', $params); } ); @@ -196,7 +196,7 @@ $this->create('news_ajax_setallitemsread', '/ajax/setallitemsread')->action( * Import stuff */ $this->create('news_ajax_importOPML', '/import')->action( - function($params){ + function($params){ callAjaxController('NewsAjaxController', 'uploadOPML', $params); } ); @@ -205,13 +205,13 @@ $this->create('news_ajax_importOPML', '/import')->action( /** * External API */ - -/** + +/** * Feed API */ \OCP\API::register( - 'get', '/news/feeds', + 'get', '/news/feeds', function($urlParams) { $container = createDIContainer(); return $container['FeedApi']->getAll($urlParams); @@ -219,7 +219,7 @@ $this->create('news_ajax_importOPML', '/import')->action( 'news', \OC_API::USER_AUTH ); \OCP\API::register( - 'get', '/news/feeds/{feedid}', + 'get', '/news/feeds/{feedid}', function($urlParams) { $container = createDIContainer(); return $container['FeedApi']->getById($urlParams); @@ -227,7 +227,7 @@ $this->create('news_ajax_importOPML', '/import')->action( 'news', \OC_API::USER_AUTH ); \OCP\API::register( - 'post', '/news/feeds/create', + 'post', '/news/feeds/create', function($urlParams) { $container = createDIContainer(); return $container['FeedApi']->create($urlParams); @@ -235,7 +235,7 @@ $this->create('news_ajax_importOPML', '/import')->action( 'news', \OC_API::USER_AUTH ); -/** +/** * Folder API */ @@ -247,7 +247,6 @@ $this->create('news_ajax_importOPML', '/import')->action( }, 'news', \OC_API::USER_AUTH ); - \OCP\API::register( 'post', '/news/folders/create', function($urlParams) { @@ -255,4 +254,20 @@ $this->create('news_ajax_importOPML', '/import')->action( return $container['FolderApi']->create($urlParams); }, 'news', \OC_API::USER_AUTH +); +\OCP\API::register( + 'get', '/news/folders/{folderid}/delete', + function($urlParams) { + $container = createDIContainer(); + return $container['FolderApi']->delete($urlParams); + }, + 'news', \OC_API::USER_AUTH +); +\OCP\API::register( + 'post', '/news/folders/{folderid}/modify', + function($urlParams) { + $container = createDIContainer(); + return $container['FolderApi']->modify($urlParams); + }, + 'news', \OC_API::USER_AUTH ); \ No newline at end of file -- cgit v1.2.3