diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-14 13:39:53 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-14 13:39:53 -0400 |
commit | 0d5bd3a636218a18b0fa81c6897614e37943455c (patch) | |
tree | 3dc7b211ac71e0d169b01e4a2a2a7e130e50b854 | |
parent | ded448fd10b1383c5c48eb90e7659550b1db7b01 (diff) |
small things added to firstrun page and settings
-rw-r--r-- | css/news.css | 8 | ||||
-rw-r--r-- | js/news.js | 45 | ||||
-rw-r--r-- | js/settings.js | 11 | ||||
-rw-r--r-- | lib/utils.php | 7 | ||||
-rw-r--r-- | templates/addBm.php | 11 | ||||
-rw-r--r-- | templates/bookmarklet.php | 8 | ||||
-rw-r--r-- | templates/part.nofeeds.php | 11 | ||||
-rw-r--r-- | templates/settings.php | 7 |
8 files changed, 98 insertions, 10 deletions
diff --git a/css/news.css b/css/news.css index 986483225..bf1b72750 100644 --- a/css/news.css +++ b/css/news.css @@ -30,21 +30,23 @@ div.add_parentfolder { #firstrun { width: 100%; position: absolute; - top: 5em; + top: 3em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; } + #firstrun small { display: block; font-weight: normal; font-size: 0.8em; margin-bottom: 1em; } + #firstrun .button { font-size: 0.7em; } #firstrun #selections { font-size:0.8em; - margin: 2em auto auto auto; + margin: 2em auto 2em auto; clear: both; } - + /** * View above the feeds which shows the feed title * and the controls diff --git a/js/news.js b/js/news.js index bf1f36ad4..59db7cf19 100644 --- a/js/news.js +++ b/js/news.js @@ -150,6 +150,51 @@ News={ } }); }, + submitFirstRun:function(button){ + + var feedurl = $("#feed_add_url").val().trim(); + + if(feedurl.length == 0) { + OC.dialogs.alert(t('news', 'URL cannot be empty.'), t('news', 'Error')); + return false; + } + + $(button).attr("disabled", true); + $(button).prop('value', t('news', 'Adding...')); + + $.ajax({ + type: "POST", + url: OC.filePath('news', 'ajax', 'createfeed.php'), + data: { 'feedurl': feedurl, 'folderid': folderid }, + dataType: "json", + success: function(jsondata){ + if(jsondata.status == 'success'){ + $('.collapsable_container[data-id="' + folderid + '"] > ul').append(jsondata.data.listfeed); + setupFeedList(); + News.Feed.load(jsondata.data.feedid); + window.reload(); + + OC.dialogs.confirm(t('news', 'Do you want to add another feed?'), t('news', 'Feed added!'), function(answer) { + if(!answer) { + $('#addfeed_dialog').dialog('destroy').remove(); + $('ul.accordion').before(jsondata.data.part_newfeed); + } + }); + } else { + OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); + } + $("#feed_add_url").val(''); + $(button).attr("disabled", false); + $(button).prop('value', t('news', 'Add feed')); + }, + error: function(xhr) { + OC.dialogs.alert(t('news', 'Error while parsing the feed'), t('news', 'Fatal Error')); + $("#feed_add_url").val(''); + $(button).attr("disabled", false); + $(button).prop('value', t('news', 'Add feed')); + } + }); + }, 'delete':function(feedid) { $('.feeds_delete').tipsy('hide'); OC.dialogs.confirm(t('news', 'Are you sure you want to delete this feed?'), t('news', 'Warning'), function(answer) { diff --git a/js/settings.js b/js/settings.js index c5a7e43ce..6709884ec 100644 --- a/js/settings.js +++ b/js/settings.js @@ -27,7 +27,7 @@ News.Settings={ $('#opml_file').text(t('news', 'File ') + file.name + t('news', ' loaded from local filesystem.')); $('#opml_file').prop('value', file.name); }, - import:function(button){ + importOpml:function(button){ $(button).attr("disabled", true); $(button).prop('value', t('news', 'Importing...')); @@ -51,6 +51,10 @@ News.Settings={ $(button).prop('value', t('news', 'Import')); $(button).attr("disabled", false); }); + }, + exportOpml:function(button){ + //TODO + alert("test"); } } @@ -73,6 +77,9 @@ $('#file_upload_start').change(function() { }); $('#importbtn').click(function() { - News.Settings.import(this); + News.Settings.importOpml(this); }); +$('#exportbtn').click(function() { + News.Settings.exportOpml(this); +}); diff --git a/lib/utils.php b/lib/utils.php index e67ea21f5..5def91e4a 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -13,7 +13,7 @@ namespace OCA\News; // load SimplePie library -//TODO: is this file a suitable place for the following require? +//TODO: is this a suitable place for the following require? require_once('news/3rdparty/SimplePie/autoloader.php'); class Utils { @@ -44,7 +44,10 @@ class Utils { $itemTitle = $spitem->get_title(); $itemGUID = $spitem->get_id(); $itemBody = $spitem->get_content(); - $items[] = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody); + $itemAuthor = $spitem->get_author(); + $item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody); + $item->setAuthor($itemAuthor->get_name()); + $items[] = $item; } } diff --git a/templates/addBm.php b/templates/addBm.php new file mode 100644 index 000000000..e9132ca57 --- /dev/null +++ b/templates/addBm.php @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Subsribe - News - ownCloud</title> + </head> + <body> + <div class="message"><h1>Saved!</h1></div> + <a href="javascript:self.close()" >Close the window</a> + </body> +</html>
\ No newline at end of file diff --git a/templates/bookmarklet.php b/templates/bookmarklet.php new file mode 100644 index 000000000..31a654b86 --- /dev/null +++ b/templates/bookmarklet.php @@ -0,0 +1,8 @@ +<?php + +function createBookmarklet() { + $l = OC_L10N::get('news'); + echo '<small>' . $l->t('Drag this to your browser bookmarks and click on it whenever you want to subscribe to a webpage quickly:') . '</small>' + . '<a class="button bookmarklet" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(\'' . OCP\Util::linkToAbsolute('bookmarks', 'addBm.php') . '?output=popup&url=\'+c(b.location),\'bkmk_popup\',\'left=\'+((a.screenX||a.screenLeft)+10)+\',top=\'+((a.screenY||a.screenTop)+10)+\',height=230px,width=230px,resizable=1,alwaysRaised=1\');a.setTimeout(function(){d.focus()},300);})();">' + . $l->t('Subscribe') . '</a>'; +} diff --git a/templates/part.nofeeds.php b/templates/part.nofeeds.php index 3a9c14b14..c1e639321 100644 --- a/templates/part.nofeeds.php +++ b/templates/part.nofeeds.php @@ -2,7 +2,16 @@ <div id="firstrun"> <?php echo $l->t('You have no feeds in your reader.') ?> <div id="selections"> - <input type="button" id="addfeedbtn" value="<?php echo $l->t('Add feed') ?>" /> + <input type="button" id="addfeedbtn" value="<?php echo $l->t('Add feed') ?>" /><br /> <input type="button" id="importopmlbtn" value="<?php echo $l->t('Import OPML') ?>" /> </div> + <div> + <?php + require_once(OC_App::getAppPath('news') .'/templates/bookmarklet.php'); + echo $l->t('Or... '); + ?> + <div> + <?php createBookmarklet(); ?> + </div> + </div> </div>
\ No newline at end of file diff --git a/templates/settings.php b/templates/settings.php index 94b8fc2f6..b063fc1ed 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -7,7 +7,10 @@ <?php echo $l->t(' or '); ?><a href='#' class="settings" id="cloudlink"><?php echo $l->t('cloud');?></a>. </span> <input type="file" id="file_upload_start" name="files[]" /> - <input style="float: right" id="importbtn" type="submit" value="<?php echo $l->t('Import');?>" /></dd> + <input style="float: right" id="importbtn" type="submit" value="<?php echo $l->t('Import');?>" /> + </dd> <dt><?php echo $l->t('Export feeds'); ?></dt> - <dd></dd> + <dd> + <button id="exportbtn" title="<?php echo $l->t('Download OPML'); ?>">Download OPML</button> + </dd> </dl>
\ No newline at end of file |