Merge branch 'master' of github.com:owncloud/news

This commit is contained in:
Alessandro Cosentino 2013-03-21 15:01:21 +01:00
Родитель c6536aa525 2452dfa401
Коммит c4073af48a
14 изменённых файлов: 518 добавлений и 129 удалений

Просмотреть файл

@ -36,22 +36,164 @@ use \OCA\News\DependencyInjection\DIContainer;
$this->create('news_index', '/')->get()->action(
function($params){
//App::main('FolderController', 'getAll', $params, new DIContainer());
App::main('PageController', 'index', $params, new DIContainer());
}
);
$this->create('news_folders', '/folders')->get()->action(
function($params){
App::main('FolderController', 'getAll', $params, new DIContainer());
}
);
/**
* External API
* Folders
*/
$this->create('news_folders', '/folders')->get()->action(
function($params){
App::main('FolderController', 'folders', $params, new DIContainer());
}
);
$this->create('news_folders_open', '/folders/{folderId}/open')->post()->action(
function($params){
App::main('FolderController', 'open', $params, new DIContainer());
}
);
$this->create('news_folders_collapse', '/folders/{folderId}/collapse')->post()->action(
function($params){
App::main('FolderController', 'collapse', $params, new DIContainer());
}
);
$this->create('news_folders_create', '/folders/create')->post()->action(
function($params){
App::main('FolderController', 'create', $params, new DIContainer());
}
);
$this->create('news_folders_delete', '/folders/{folderId}/delete')->post()->action(
function($params){
App::main('FolderController', 'delete', $params, new DIContainer());
}
);
$this->create('news_folders_rename', '/folders/{folderId}/rename')->post()->action(
function($params){
App::main('FolderController', 'rename', $params, new DIContainer());
}
);
/**
* Feeds
*/
$this->create('news_feeds', '/feeds')->get()->action(
function($params){
App::main('FeedController', 'feeds', $params, new DIContainer());
}
);
$this->create('news_feeds_active', '/feeds/active')->get()->action(
function($params){
App::main('FeedController', 'active', $params, new DIContainer());
}
);
$this->create('news_feeds_create', '/feeds/create')->post()->action(
function($params){
App::main('FeedController', 'create', $params, new DIContainer());
}
);
$this->create('news_feeds_delete', '/feeds/{feedId}/delete')->post()->action(
function($params){
App::main('FeedController', 'delete', $params, new DIContainer());
}
);
$this->create('news_feeds_update', '/feeds/{feedId}/update')->post()->action(
function($params){
App::main('FeedController', 'update', $params, new DIContainer());
}
);
$this->create('news_feeds_move', '/feeds/{feedId}/move')->post()->action(
function($params){
App::main('FeedController', 'move', $params, new DIContainer());
}
);
$this->create('news_feeds_read', '/feeds/{feedId}/read')->post()->action(
function($params){
App::main('FeedController', 'read', $params, new DIContainer());
}
);
/**
* Items
*/
$this->create('news_items', '/items')->get()->action(
function($params){
App::main('ItemController', 'items', $params, new DIContainer());
}
);
$this->create('news_items_starred', '/items/starred')->get()->action(
function($params){
App::main('ItemController', 'starred', $params, new DIContainer());
}
);
$this->create('news_items_read', '/items/{itemId}/read')->post()->action(
function($params){
App::main('ItemController', 'read', $params, new DIContainer());
}
);
$this->create('news_items_unread', '/items/{itemId}/unread')->post()->action(
function($params){
App::main('ItemController', 'unread', $params, new DIContainer());
}
);
$this->create('news_items_star', '/items/{itemId}/star')->post()->action(
function($params){
App::main('ItemController', 'star', $params, new DIContainer());
}
);
$this->create('news_items_unstar', '/items/{itemId}/unstar')->post()->action(
function($params){
App::main('ItemController', 'unstar', $params, new DIContainer());
}
);
/**
* Export
*/
$this->create('news_export_opml', '/export/opml')->get()->action(
function($params){
App::main('ExportController', 'opml', $params, new DIContainer());
}
);
/**
* User Settings
*/
$this->create('news_usersettings_read', '/usersettings/read')->get()->action(
function($params){
App::main('UserSettingsController', 'read', $params, new DIContainer());
}
);
$this->create('news_usersettings_read_show', '/usersettings/read/show')->post()->action(
function($params){
App::main('UserSettingsController', 'show', $params, new DIContainer());
}
);
$this->create('news_usersettings_read_hide', '/usersettings/read/hide')->post()->action(
function($params){
App::main('UserSettingsController', 'hide', $params, new DIContainer());
}
);
/**
* Feed API

Просмотреть файл

@ -1,33 +1,38 @@
<?php
namespace OCA\News;
/**
* 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/>.
*
*/
class FeedBl {
namespace OCA\News\Bl;
use \OCA\News\Db\Feed;
class FeedBl extends Bl {
public function __construct($feedMapper){
$this->feedMapper = $feedMapper;
}
public function getAll() {
return $this->feedMapper->findAll();
}
public function getById($feedid) {
return $this->feedMapper->findById($feedid);
}
public function delete($feedid) {
return $this->feedMapper->deleteById($feedid);
parent::__construct($feedMapper);
}
public function create($url, $folderid) {
$feed = new Feed($url);
$this->feedMapper->save($feed, $folderid);
$feed = Utils::fetch($url);
if ($feed != null) {
$this->feedMapper->save($feed, $folderid);
}
return true;
}
}

38
bl/itembl.php Normal file
Просмотреть файл

@ -0,0 +1,38 @@
<?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\Bl;
use \OCA\News\Db\Item;
class ItemBl extends Bl {
public function __construct($itemMapper){
parent::__construct($itemMapper);
}
}

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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());
}
}

Просмотреть файл

@ -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
}
}

Просмотреть файл

@ -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() {
}
}

Просмотреть файл

@ -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
}
}

Просмотреть файл

@ -27,9 +27,20 @@ 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;
use OCA\News\Controller\ExportController;
use OCA\News\Controller\UserSettingsController;
use OCA\News\Bl\FolderBl;
use OCA\News\Bl\FeedBl;
use OCA\News\Bl\ItemBl;
use OCA\News\Db\FolderMapper;
use OCA\News\Db\FeedMapper;
use OCA\News\Db\ItemMapper;
class DIContainer extends BaseContainer {
@ -46,10 +57,31 @@ 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']);
});
$this['FeedController'] = $this->share(function($c){
return new FeedController($c['API'], $c['Request'], $c['FeedBl']);
});
$this['ItemController'] = $this->share(function($c){
return new ItemController($c['API'], $c['Request'], $c['ItemBl']);
});
$this['ExportController'] = $this->share(function($c){
return new ExportController($c['API'], $c['Request'],
$c['FolderBl'], $c['FeedBl']);
});
$this['UserSettingsController'] = $this->share(function($c){
return new UserSettingsController($c['API'], $c['Request']);
});
/**
* Business
*/
@ -57,6 +89,15 @@ class DIContainer extends BaseContainer {
return new FolderBl($c['FolderMapper']);
});
$this['FeedBl'] = $this->share(function($c){
return new FeedBl($c['FeedMapper']);
});
$this['ItemBl'] = $this->share(function($c){
return new ItemBl($c['ItemMapper']);
});
/**
* MAPPERS
*/
@ -64,7 +105,13 @@ class DIContainer extends BaseContainer {
return new FolderMapper($c['API']);
});
$this['FeedMapper'] = $this->share(function($c){
return new FeedMapper($c['API']);
});
$this['ItemMapper'] = $this->share(function($c){
return new ItemMapper($c['API']);
});
}
}

Просмотреть файл

@ -73,7 +73,7 @@ angular.module('News').factory '_Persistence', ->
getStarredItems: (onSuccess) ->
params =
onSuccess: onSuccess
@_request.get 'news_starred_items', params
@_request.get 'news_items_starred', params
starItem: (itemId) ->
@ -84,7 +84,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
itemId: itemId
@_request.post 'news_star_item', params
@_request.post 'news_items_star', params
@ -96,7 +96,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
itemId: itemId
@_request.post 'news_unstar_item', params
@_request.post 'news_items_unstar', params
readItem: (itemId) ->
@ -107,7 +107,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
itemId: itemId
@_request.post 'news_read_item', params
@_request.post 'news_items_read', params
@ -119,7 +119,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
itemId: itemId
@_request.post 'news_unread_item', params
@_request.post 'news_items_unread', params
###
@ -137,7 +137,7 @@ angular.module('News').factory '_Persistence', ->
params =
onSuccess: onSuccess
@_request.get 'news_active_feed', params
@_request.get 'news_feeds_active', params
createFeed: (url, parentFolderId, onSuccess, onFailure) ->
@ -148,7 +148,7 @@ angular.module('News').factory '_Persistence', ->
onSuccess: onSuccess
onFailure: onFailure
@_request.post 'news_create_feed', params
@_request.post 'news_feeds_create', params
deleteFeed: (feedId) ->
@ -156,7 +156,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
feedId: feedId
@_request.post 'news_delete_feed', params
@_request.post 'news_feeds_delete', params
moveFeed: (feedId, folderId) ->
@ -169,7 +169,7 @@ angular.module('News').factory '_Persistence', ->
data:
folderId: folderId
@_request.post 'news_move_feed', params
@_request.post 'news_feeds_move', params
setFeedRead: (feedId, highestItemId) ->
@ -182,7 +182,7 @@ angular.module('News').factory '_Persistence', ->
data:
highestItemId: highestItemId
@_request.post 'news_set_feed_read', params
@_request.post 'news_feeds_read', params
updateFeed: (feedId) ->
@ -193,7 +193,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
feedId: feedId
@_request.post 'news_update_feed', params
@_request.post 'news_feeds_update', params
###
@ -215,7 +215,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
folderId: folderId
@_request.post 'news_open_folder', params
@_request.post 'news_folders_open', params
collapseFolder: (folderId) ->
@ -226,7 +226,7 @@ angular.module('News').factory '_Persistence', ->
urlParams:
folderId: folderId
@_request.post 'news_collapse_folder', params
@_request.post 'news_folders_collapse', params
createFolder: (folderName, parentFolderId=0, onSuccess=null,
@ -241,7 +241,7 @@ angular.module('News').factory '_Persistence', ->
onSuccess: onSuccess
onFailure: onFailure
@_request.post 'news_create_folder', params
@_request.post 'news_folders_create', params
deleteFolder: (folderId) ->
@ -253,7 +253,7 @@ angular.module('News').factory '_Persistence', ->
folderId: folderId
@_request.post 'news_delete_folder', params
@_request.post 'news_folders_delete', params
renameFolder: (folderId, folderName) ->
@ -266,7 +266,7 @@ angular.module('News').factory '_Persistence', ->
data:
folderName: folderName
@_request.post 'news_rename_folder', params
@_request.post 'news_folders_rename', params
@ -291,21 +291,21 @@ angular.module('News').factory '_Persistence', ->
params =
onSuccess: callback
@_request.get 'news_user_settings_read', params
@_request.get 'news_usersettings_read', params
userSettingsReadShow: ->
###
Sets the reader mode to show all
###
@_request.post 'news_user_settings_read_show'
@_request.post 'news_usersettings_read_show'
userSettingsReadHide: ->
###
Sets the reader mode to show only unread
###
@_request.post 'news_user_settings_read_hide'
@_request.post 'news_usersettings_read_hide'
_trigerHideRead: ->

Просмотреть файл

@ -522,7 +522,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
params = {
onSuccess: onSuccess
};
return this._request.get('news_starred_items', params);
return this._request.get('news_items_starred', params);
};
Persistence.prototype.starItem = function(itemId) {
@ -536,7 +536,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
return this._request.post('news_star_item', params);
return this._request.post('news_items_star', params);
};
Persistence.prototype.unstarItem = function(itemId) {
@ -550,7 +550,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
return this._request.post('news_unstar_item', params);
return this._request.post('news_items_unstar', params);
};
Persistence.prototype.readItem = function(itemId) {
@ -564,7 +564,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
return this._request.post('news_read_item', params);
return this._request.post('news_items_read', params);
};
Persistence.prototype.unreadItem = function(itemId) {
@ -578,7 +578,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
return this._request.post('news_unread_item', params);
return this._request.post('news_items_unread', params);
};
/*
@ -600,7 +600,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
params = {
onSuccess: onSuccess
};
return this._request.get('news_active_feed', params);
return this._request.get('news_feeds_active', params);
};
Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onFailure) {
@ -613,7 +613,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: onSuccess,
onFailure: onFailure
};
return this._request.post('news_create_feed', params);
return this._request.post('news_feeds_create', params);
};
Persistence.prototype.deleteFeed = function(feedId) {
@ -623,7 +623,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedId: feedId
}
};
return this._request.post('news_delete_feed', params);
return this._request.post('news_feeds_delete', params);
};
Persistence.prototype.moveFeed = function(feedId, folderId) {
@ -640,7 +640,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
return this._request.post('news_move_feed', params);
return this._request.post('news_feeds_move', params);
};
Persistence.prototype.setFeedRead = function(feedId, highestItemId) {
@ -657,7 +657,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
highestItemId: highestItemId
}
};
return this._request.post('news_set_feed_read', params);
return this._request.post('news_feeds_read', params);
};
Persistence.prototype.updateFeed = function(feedId) {
@ -671,7 +671,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedId: feedId
}
};
return this._request.post('news_update_feed', params);
return this._request.post('news_feeds_update', params);
};
/*
@ -699,7 +699,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
return this._request.post('news_open_folder', params);
return this._request.post('news_folders_open', params);
};
Persistence.prototype.collapseFolder = function(folderId) {
@ -713,7 +713,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
return this._request.post('news_collapse_folder', params);
return this._request.post('news_folders_collapse', params);
};
Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onFailure) {
@ -737,7 +737,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: onSuccess,
onFailure: onFailure
};
return this._request.post('news_create_folder', params);
return this._request.post('news_folders_create', params);
};
Persistence.prototype.deleteFolder = function(folderId) {
@ -751,7 +751,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
return this._request.post('news_delete_folder', params);
return this._request.post('news_folders_delete', params);
};
Persistence.prototype.renameFolder = function(folderId, folderName) {
@ -768,7 +768,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderName: folderName
}
};
return this._request.post('news_rename_folder', params);
return this._request.post('news_folders_rename', params);
};
/*
@ -801,21 +801,21 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
params = {
onSuccess: callback
};
return this._request.get('news_user_settings_read', params);
return this._request.get('news_usersettings_read', params);
};
Persistence.prototype.userSettingsReadShow = function() {
/*
Sets the reader mode to show all
*/
return this._request.post('news_user_settings_read_show');
return this._request.post('news_usersettings_read_show');
};
Persistence.prototype.userSettingsReadHide = function() {
/*
Sets the reader mode to show only unread
*/
return this._request.post('news_user_settings_read_hide');
return this._request.post('news_usersettings_read_hide');
};
Persistence.prototype._trigerHideRead = function() {

Просмотреть файл

@ -95,7 +95,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.getStarredItems(params.onSuccess)
expect(@req.get).toHaveBeenCalledWith('news_starred_items', params)
expect(@req.get).toHaveBeenCalledWith('news_items_starred', params)
it 'send a correct star item request', =>
@ -106,7 +106,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.starItem(params.urlParams.itemId)
expect(@req.post).toHaveBeenCalledWith('news_star_item', params)
expect(@req.post).toHaveBeenCalledWith('news_items_star', params)
it 'send a correct unstar item request', =>
@ -117,7 +117,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.unstarItem(params.urlParams.itemId)
expect(@req.post).toHaveBeenCalledWith('news_unstar_item', params)
expect(@req.post).toHaveBeenCalledWith('news_items_unstar', params)
it 'send a correct read item request', =>
@ -129,7 +129,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.readItem(params.urlParams.itemId)
expect(@req.post).toHaveBeenCalledWith('news_read_item', params)
expect(@req.post).toHaveBeenCalledWith('news_items_read', params)
it 'send a correct unread item request', =>
@ -140,7 +140,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.unreadItem(params.urlParams.itemId)
expect(@req.post).toHaveBeenCalledWith('news_unread_item', params)
expect(@req.post).toHaveBeenCalledWith('news_items_unread', params)
@ -167,7 +167,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.moveFeed(params.urlParams.feedId, params.data.folderId)
expect(@req.post).toHaveBeenCalledWith('news_move_feed', params)
expect(@req.post).toHaveBeenCalledWith('news_feeds_move', params)
it 'shoud send a correct request for marking all items read', =>
@ -181,7 +181,7 @@ describe '_Persistence', ->
pers.setFeedRead(params.urlParams.feedId, params.data.highestItemId)
expect(@req.post).toHaveBeenCalledWith('news_set_feed_read', params)
expect(@req.post).toHaveBeenCalledWith('news_feeds_read', params)
it 'send a correct feed update request', =>
@ -192,7 +192,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.updateFeed(params.urlParams.feedId)
expect(@req.post).toHaveBeenCalledWith('news_update_feed', params)
expect(@req.post).toHaveBeenCalledWith('news_feeds_update', params)
it 'send a correct get active feed request', =>
@ -202,7 +202,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.getActiveFeed(params.onSuccess)
expect(@req.get).toHaveBeenCalledWith('news_active_feed', params)
expect(@req.get).toHaveBeenCalledWith('news_feeds_active', params)
it 'send a correct feed delete request', =>
@ -213,7 +213,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.deleteFeed(params.urlParams.feedId)
expect(@req.post).toHaveBeenCalledWith('news_delete_feed', params)
expect(@req.post).toHaveBeenCalledWith('news_feeds_delete', params)
it 'send a correct feed create request', =>
@ -228,7 +228,7 @@ describe '_Persistence', ->
pers.createFeed(params.data.url, params.data.parentFolderId,
params.onSuccess, params.onFailure)
expect(@req.post).toHaveBeenCalledWith('news_create_feed', params)
expect(@req.post).toHaveBeenCalledWith('news_feeds_create', params)
@ -253,7 +253,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.collapseFolder(params.urlParams.folderId)
expect(@req.post).toHaveBeenCalledWith('news_collapse_folder', params)
expect(@req.post).toHaveBeenCalledWith('news_folders_collapse', params)
it 'send a correct open folder request', =>
@ -264,7 +264,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.openFolder(params.urlParams.folderId)
expect(@req.post).toHaveBeenCalledWith('news_open_folder', params)
expect(@req.post).toHaveBeenCalledWith('news_folders_open', params)
it 'should do a proper folder create request', =>
@ -279,7 +279,7 @@ describe '_Persistence', ->
pers.createFolder(params.data.folderName, params.data.parentFolderId,
params.onSuccess, params.onFailure)
expect(@req.post).toHaveBeenCalledWith('news_create_folder', params)
expect(@req.post).toHaveBeenCalledWith('news_folders_create', params)
it 'should do a proper folder delete request', =>
@ -290,7 +290,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.deleteFolder(params.urlParams.folderId)
expect(@req.post).toHaveBeenCalledWith('news_delete_folder', params)
expect(@req.post).toHaveBeenCalledWith('news_folders_delete', params)
it 'should do a proper folder rename request', =>
@ -303,7 +303,7 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.renameFolder(params.urlParams.folderId, params.data.folderName)
expect(@req.post).toHaveBeenCalledWith('news_rename_folder', params)
expect(@req.post).toHaveBeenCalledWith('news_folders_rename', params)
###
@ -326,7 +326,7 @@ describe '_Persistence', ->
params =
onSuccess: angular.noop
expect(@req.get).toHaveBeenCalledWith('news_user_settings_read', params)
expect(@req.get).toHaveBeenCalledWith('news_usersettings_read', params)
it 'should do a proper get user settings read req and call callback', =>
@ -336,14 +336,14 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.userSettingsRead(params.onSuccess)
expect(@req.get).toHaveBeenCalledWith('news_user_settings_read', params)
expect(@req.get).toHaveBeenCalledWith('news_usersettings_read', params)
it 'should do a proper user settings read show request', =>
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.userSettingsReadShow()
expect(@req.post).toHaveBeenCalledWith('news_user_settings_read_show')
expect(@req.post).toHaveBeenCalledWith('news_usersettings_read_show')
@ -351,4 +351,4 @@ describe '_Persistence', ->
pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
pers.userSettingsReadHide()
expect(@req.post).toHaveBeenCalledWith('news_user_settings_read_hide')
expect(@req.post).toHaveBeenCalledWith('news_usersettings_read_hide')

Просмотреть файл

@ -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);
}