diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-05 19:46:55 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-05 19:46:55 -0400 |
commit | e4b145726f00dc57b04998a28153fb0ff887ad13 (patch) | |
tree | 855234b02e64232ed6f54657221f86b49da06b67 | |
parent | e5f291b09c4403bf5ffdd131c662f35a92ec363e (diff) |
improves delete feed feature
-rw-r--r-- | css/news.css | 2 | ||||
-rw-r--r-- | js/news.js | 4 | ||||
-rw-r--r-- | lib/feedmapper.php | 15 | ||||
-rw-r--r-- | lib/foldermapper.php | 7 | ||||
-rw-r--r-- | templates/part.feeds.php | 9 |
5 files changed, 23 insertions, 14 deletions
diff --git a/css/news.css b/css/news.css index cbfef64c2..7e7256849 100644 --- a/css/news.css +++ b/css/news.css @@ -1,7 +1,7 @@ #leftcontent { top: 3.5em !important; padding: 0; margin: 0; } #rightcontent { top: 3.5em !important; padding-top: 5px; } #feeds { background: #fff; width: 20em; left: 12.5em; top: 3.7em; bottom:3em; position: fixed; overflow: auto; padding: 0; margin: 0; } -#feeds a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; } +/* #feeds a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; } */ #bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;} #feeds_delete { position:relative; float:right; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; } #feeds_edit { position:relative; float:right; background:url('%webroot%/core/img/actions/rename.svg') no-repeat center; } diff --git a/js/news.js b/js/news.js index 05305289f..b940a3f69 100644 --- a/js/news.js +++ b/js/news.js @@ -115,4 +115,8 @@ $(document).ready(function(){ return false; }).next().hide(); + $('.feeds_list').hover(function() { + $(this).find('#feeds_delete').toggle(); + return false; + }).find('#feeds_delete').hide(); });
\ No newline at end of file diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 65b9164de..73afa0e86 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -164,15 +164,14 @@ class OC_News_FeedMapper { return deleteById($id); } - public function deleteAll($folderdid){ - $id = $feed->getId(); - - $stmt = OCP\DB::prepare(" - DELETE FROM " . self::tableName . - "WHERE id = $id - "); + //it's more complicated tan this...recursive delete, or delete with a join + public function deleteAll($folderdid){ + if ($folderid == null) { + return false; + } + $stmt = OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE folder_id = ?'); - $result = $stmt->execute(); + $result = $stmt->execute(array($folderid)); $itemMapper = new OC_News_ItemMapper(); //TODO: handle the value that the execute returns diff --git a/lib/foldermapper.php b/lib/foldermapper.php index ade54c72f..79115ec56 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -19,8 +19,11 @@ class OC_News_FolderMapper { private $userid; - public function __construct($userid){ - $this->userid = $userid; + public function __construct($userid = null){ + if ($userid !== null) { + $this->userid = $userid; + } + $userid = OCP\USER::getUser(); } public function root(){ diff --git a/templates/part.feeds.php b/templates/part.feeds.php index 96810992f..adcbe8411 100644 --- a/templates/part.feeds.php +++ b/templates/part.feeds.php @@ -5,19 +5,22 @@ echo '<ul style="margin-left:' . 10*$depth . 'px;"> <li style="background-image:url(' . OC_Helper::imagePath('core', 'filetypes/folder.png') . '); background-repeat:no-repeat; background-position:0px 8px; padding-left: 20px; ">' . '<span class="collapsable">' . $folder->getName() . '</span>'; +/* if ($depth != 0) { echo '<button class="svg action" id="feeds_delete" onClick="(News.Folder.delete(' . $folder->getId(). '))" title="' . $l->t('Delete folder') . '"></button>'; } +*/ echo '<ul>'; $children = $folder->getChildren(); foreach($children as $child) { if ($child instanceOf OC_News_Folder){ print_folder($child, $depth+1); } - elseif ($child instanceOf OC_News_Feed) { - echo '<li><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>'; + elseif ($child instanceOf OC_News_Feed) { //onhover $(element).attr('id', 'newID'); + + echo '<li class="feeds_list"><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>'; echo '<button class="svg action" id="feeds_delete" onClick="(News.Feed.delete(' . $child->getId(). '))" title="' . $l->t('Delete feed') . '"></button>'; - echo '<button class="svg action" id="feeds_edit" title="' . $l->t('Edit feed') . '"></button>'; +// echo '<button class="svg action" id="feeds_edit" title="' . $l->t('Edit feed') . '"></button>'; echo '</li>'; } else { |