summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-21 13:16:16 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 13:16:16 +0100
commit39d3bc61d81eae92d9615e898bc6dd6b658d71a6 (patch)
tree0914056875d52a085f31d7f7ff070b702c13d9cd
parentdb5ba2b807c3765c9d23b46cd424d2215ed3fc1c (diff)
added all controllers
-rw-r--r--controller/exportcontroller.php41
-rw-r--r--controller/feedcontroller.php12
-rw-r--r--controller/foldercontroller.php16
-rw-r--r--controller/itemcontroller.php46
-rw-r--r--controller/pagecontroller.php50
-rw-r--r--controller/usersettingscontroller.php46
-rw-r--r--dependencyinjection/dicontainer.php6
-rw-r--r--tests/controller/FolderControllerTest.php16
8 files changed, 197 insertions, 36 deletions
diff --git a/controller/exportcontroller.php b/controller/exportcontroller.php
new file mode 100644
index 000000000..6c6d8a71c
--- /dev/null
+++ b/controller/exportcontroller.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Controller;
+
+use \OCA\AppFramework\Controller\Controller;
+use \OCA\AppFramework\Core\API;
+use \OCA\AppFramework\Http\Request;
+
+
+class ExportController extends Controller {
+
+
+ public function __construct(API $api, Request $request){
+ parent::__construct($api, $request);
+ }
+
+
+} \ No newline at end of file
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php
index 4357d7682..85de04665 100644
--- a/controller/feedcontroller.php
+++ b/controller/feedcontroller.php
@@ -40,16 +40,4 @@ class FeedController extends Controller {
$this->feedMapper = $feedMapper;
}
-
- /**
- * @IsAdminExemption
- * @IsSubAdminExemption
- * @Ajax
- *
- * Returns all feeds
- */
- public function getAll(){
- $feeds = $this->feedMapper->findAll();
- return $this->renderJSON($feeds);
- }
} \ No newline at end of file
diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php
index 1bf7da664..3e631eb63 100644
--- a/controller/foldercontroller.php
+++ b/controller/foldercontroller.php
@@ -46,10 +46,8 @@ class FolderController extends Controller {
* @IsAdminExemption
* @IsSubAdminExemption
* @Ajax
- *
- * Returns all folders
*/
- public function getAll(){
+ public function folders(){
$folders = $this->folderBl->findAll($this->api->getUserId());
$result = array(
'folders' => $folders
@@ -62,20 +60,8 @@ class FolderController extends Controller {
* @IsAdminExemption
* @IsSubAdminExemption
* @Ajax
- *
- * Collapses a folder
*/
public function collapse(){
- $folderId = (int) $this->params('folderId');
-
- try {
- $this->folderMapper->setCollapsed($folderId, true);
- return $this->renderJSON(array());
- } catch (DoesNotExistException $e) {
- return $this->renderJSON(array(), $e->getMessage());
- } catch(MultipleObjectsReturnedException $e){
- return $this->renderJSON(array(), $e->getMessage());
- }
}
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
new file mode 100644
index 000000000..81e3dd972
--- /dev/null
+++ b/controller/itemcontroller.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Controller;
+
+use \OCA\AppFramework\Controller\Controller;
+use \OCA\AppFramework\Core\API;
+use \OCA\AppFramework\Http\Request;
+
+use \OCA\News\Bl\ItemBl;
+
+
+class ItemController extends Controller {
+
+ private $itemBl;
+
+ public function __construct(API $api, Request $request, ItemBl $itemBl){
+ parent::__construct($api, $request);
+ $this->itemBl = $itemBl
+ }
+
+
+
+} \ No newline at end of file
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php
new file mode 100644
index 000000000..cf934422b
--- /dev/null
+++ b/controller/pagecontroller.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Controller;
+
+use \OCA\AppFramework\Controller\Controller;
+use \OCA\AppFramework\Core\API;
+use \OCA\AppFramework\Http\Request;
+
+
+class PageController extends Controller {
+
+
+ public function __construct(API $api, Request $request){
+ parent::__construct($api, $request);
+ }
+
+
+ /**
+ * @IsAdminExemption
+ * @IsSubAdminExemption
+ * @CSRFExemption
+ */
+ public function index() {
+ }
+
+
+} \ No newline at end of file
diff --git a/controller/usersettingscontroller.php b/controller/usersettingscontroller.php
new file mode 100644
index 000000000..fd77a394f
--- /dev/null
+++ b/controller/usersettingscontroller.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@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 Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Controller;
+
+use \OCA\AppFramework\Controller\Controller;
+use \OCA\AppFramework\Core\API;
+use \OCA\AppFramework\Http\Request;
+
+use \OCA\News\Bl\FeedBl;
+
+
+class FeedController extends Controller {
+
+ private $feedBl;
+
+ public function __construct(API $api, Request $request, FeedBl $feedBl){
+ parent::__construct($api, $request);
+ $this->feedBl = $feedBl
+ }
+
+
+
+} \ No newline at end of file
diff --git a/dependencyinjection/dicontainer.php b/dependencyinjection/dicontainer.php
index 89f78cc93..4027f5589 100644
--- a/dependencyinjection/dicontainer.php
+++ b/dependencyinjection/dicontainer.php
@@ -27,7 +27,7 @@ namespace OCA\News\DependencyInjection;
use OCA\AppFramework\DependencyInjection\DIContainer as BaseContainer;
-
+use OCA\News\Controller\PageController;
use OCA\News\Controller\FolderController;
use OCA\News\Controller\FeedController;
use OCA\News\Controller\ItemController;
@@ -57,6 +57,10 @@ class DIContainer extends BaseContainer {
/**
* CONTROLLERS
*/
+ $this['PageController'] = $this->share(function($c){
+ return new PageController($c['API'], $c['Request']);
+ });
+
$this['FolderController'] = $this->share(function($c){
return new FolderController($c['API'], $c['Request'], $c['FolderBl']);
});
diff --git a/tests/controller/FolderControllerTest.php b/tests/controller/FolderControllerTest.php
index 52836b092..531584ddc 100644
--- a/tests/controller/FolderControllerTest.php
+++ b/tests/controller/FolderControllerTest.php
@@ -62,16 +62,16 @@ class FolderControllerTest extends ControllerTestUtility {
/**
* getAll
*/
- public function testGetAllCalled(){
+ public function testFoldersCalled(){
$this->folderBl->expects($this->once())
->method('findAll')
->will($this->returnValue( array() ));
- $this->controller->getAll();
+ $this->controller->folders();
}
- public function testGetAllReturnsFolders(){
+ public function testFoldersReturnsFolders(){
$return = array(
new Folder(),
new Folder(),
@@ -80,7 +80,7 @@ class FolderControllerTest extends ControllerTestUtility {
->method('findAll')
->will($this->returnValue($return));
- $response = $this->controller->getAll();
+ $response = $this->controller->folders();
$expected = array(
'folders' => $return
);
@@ -88,16 +88,16 @@ class FolderControllerTest extends ControllerTestUtility {
}
- public function testGetAllAnnotations(){
- $methodName = 'getAll';
+ public function testFoldersAnnotations(){
+ $methodName = 'folders';
$annotations = array('IsAdminExemption', 'IsSubAdminExemption', 'Ajax');
$this->assertAnnotations($this->controller, $methodName, $annotations);
}
- public function testGetAllReturnsJSON(){
- $response = $this->controller->getAll();
+ public function testFoldersReturnsJSON(){
+ $response = $this->controller->folders();
$this->assertTrue($response instanceof JSONResponse);
}