shows feeds in the left column

This commit is contained in:
Alessandro Cosentino 2012-06-13 14:39:07 -04:00
Родитель b8ee15b220
Коммит a03926f90e
10 изменённых файлов: 60 добавлений и 137 удалений

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

@ -1,23 +1,12 @@
<?php
/**
* ownCloud - News app (feed reader)
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/

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

@ -4,20 +4,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
@ -37,10 +27,10 @@ OCP\App::setActiveNavigationEntry('news');
//OCP\Util::addscript('news','news');
OCP\Util::addStyle('news', 'news');
$foldermapper = new OC_News_FolderMapper();
$foldermapper = new OC_News_FolderMapper(OCP\USER::getUser());
//this is the root folder, which contains all sub-folders and feeds
$allfeeds = null;
$allfeeds = $foldermapper->root();
$tmpl = new OCP\Template( 'news', 'main', 'user' );
$tmpl->assign('allfeeds', $allfeeds);

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
@ -26,6 +16,10 @@
class OC_News_Collection {
private $id;
public function __construct($id){
$this->id = $id;
}
public function getId(){
return $this->id;

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
@ -29,8 +19,11 @@ class OC_News_Folder extends OC_News_Collection {
private $children;
private $parent;
public function __construct($name, $parent = null){
public function __construct($name, $id = null, $parent = null){
$this->name = $name;
if ($id !== null){
parent::__construct($id);
}
$this->children = array();
if ($parent !== null){
$this->parent = $parent;
@ -55,5 +48,9 @@ class OC_News_Folder extends OC_News_Collection {
public function addChild(OC_News_Collection $child){
$this->children[] = $child;
}
public function getChildren(){
return $children;
}
}

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
@ -26,10 +16,25 @@
class OC_News_FolderMapper {
const tableName = '*PREFIX*news_folders';
private $userid;
public function __construct($userid){
$this->userid = $userid;
}
public function root(){
$root = new OC_News_Folder('All feeds');
$stmt = OCP\DB::prepare('SELECT *
FROM ' . self::tableName .
' WHERE user_id = ? AND parent_id = ?');
$result = $stmt->execute(array($this->userid, 0));
while( $row = $result->fetchRow()){
$child = new OC_News_Folder($row['id'], $row['name']);
$root->addChild($child);
}
return $root;
}

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

@ -3,24 +3,13 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
class StatusFlag{
const Unread = 0x02;
const Important = 0x04;

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

@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/

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

@ -3,24 +3,13 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
class OC_News_Utils {
/**