From ded448fd10b1383c5c48eb90e7659550b1db7b01 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Tue, 14 Aug 2012 10:56:53 -0400 Subject: fixes url parsing component --- templates/part.items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/part.items.php b/templates/part.items.php index 486741f19..f41ea098d 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -42,7 +42,7 @@ foreach($items as $item) { echo '

' . $item->getTitle() . '

'; - echo '

' . $l->t('from') . ' ' . parse_url($item->getUrl(), PHP_URL_PATH) . '

'; + echo '

' . $l->t('from') . ' ' . parse_url($item->getUrl(), PHP_URL_HOST) . '

'; echo '
' . $item->getBody() . '
'; -- cgit v1.2.3 From 0d5bd3a636218a18b0fa81c6897614e37943455c Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Tue, 14 Aug 2012 13:39:53 -0400 Subject: small things added to firstrun page and settings --- css/news.css | 8 +++++--- js/news.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ js/settings.js | 11 +++++++++-- lib/utils.php | 7 +++++-- templates/addBm.php | 11 +++++++++++ templates/bookmarklet.php | 8 ++++++++ templates/part.nofeeds.php | 11 ++++++++++- templates/settings.php | 7 +++++-- 8 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 templates/addBm.php create mode 100644 templates/bookmarklet.php 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 @@ + + + + + Subsribe - News - ownCloud + + +

Saved!

+ Close the window + + \ 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 @@ +' . $l->t('Drag this to your browser bookmarks and click on it whenever you want to subscribe to a webpage quickly:') . '' + . '' + . $l->t('Subscribe') . ''; +} 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 @@
t('You have no feeds in your reader.') ?>
- +
+
+ t('Or... '); + ?> +
+ +
+
\ 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 @@ t(' or '); ?>t('cloud');?>. - + +
t('Export feeds'); ?>
-
+
+ +
\ No newline at end of file -- cgit v1.2.3