diff options
| author | 2014-03-27 20:36:51 +0100 | |
|---|---|---|
| committer | 2014-03-27 20:36:51 +0100 | |
| commit | 9d87f2f0aa8306c3e07a79d1a100b4d41ea8bc72 (patch) | |
| tree | f7685e6c6dff2dc4c75b8d4b1b1dd16f69b8bd57 /app/views | |
| parent | c8aa451c768a3d4dfce3d19648f3c8420dedb74c (diff) | |
Export is fully implemented
- Export list of feeds (OPML)
- Export list of favourites (JSON)
- Export list of articles per feed (JSON)
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/helpers/export/articles.phtml | 64 | ||||
| -rw-r--r-- | app/views/importExport/index.phtml | 10 |
2 files changed, 42 insertions, 32 deletions
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index b7df58caf..71ac22f44 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -1,30 +1,40 @@ <?php - // TODO: A lot have to be done! $username = Minz_Session::param('currentUser', '_'); - $type_id = "TODO"; - $title = Minz_Translate::t("TODO"); - $entries = []; -?>{ - "id": "user/<?php echo str_replace("\"", "", $username); ?>/state/org.freshrss/<?php echo $type_id; ?>", - "title": "<?php echo addslashes($title); ?>", - "author": "<?php echo addslashes($username); ?>", - "items": [ - <?php $i = 0; foreach($entries as $entry) { $i++; - echo $i > 1 ? ', ': ''; ?>{ - "id": "<?php echo $entry->id(); ?>", - "categories": [<?php /* TODO */ ?>], - "title": "<?php echo addslashes($entry->title()); ?>", - "published": <?php echo $entry->date(true); ?>, - "updated": <?php echo $entry->date(true); ?>, - "content": "<?php echo addslashes($entry->content()); ?>", - "origin": { - <?php /* TODO */ ?> - "streamId": "", - "title": "", - "htmlUrl": "", - "feedUrl": "" - } + + $articles = array( + 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, + 'title' => $this->list_title, + 'author' => $username, + 'items' => array() + ); + + foreach ($this->entries as $entry) { + if (!isset($this->feed)) { + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed ()); + } else { + $feed = $this->feed; } - <?php } ?> - ] -}
\ No newline at end of file + + $articles['items'][] = array( + 'id' => $entry->id(), + 'categories' => array_values($entry->tags()), + 'title' => $entry->title(), + 'published' => $entry->date(true), + 'updated' => $entry->date(true), + 'content' => $entry->content(), + 'origin' => array( + 'streamId' => $feed->id(), + 'title' => $feed->name(), + 'htmlUrl' => $feed->website(), + 'feedUrl' => $feed->url() + ) + ); + } + + $options = 0; + if (version_compare(PHP_VERSION, '5.4.0') >= 0) { + $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; + } + + echo json_encode($articles, $options); +?> diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml index d8c76543e..b82e0d26b 100644 --- a/app/views/importExport/index.phtml +++ b/app/views/importExport/index.phtml @@ -33,11 +33,11 @@ <?php echo Minz_Translate::t ('export_starred'); ?> </label> - <label class="checkbox" for="export_all"> - <input type="checkbox" name="export_all" id="export_all" value="1" /> - <?php echo Minz_Translate::t ('export_all'); ?> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('export_all_is_long'); ?> - </label> + <select name="export_feeds[]" size="10" multiple="multiple"> + <?php foreach ($this->feeds as $feed) { ?> + <option value="<?php echo $feed->id(); ?>"><?php echo $feed->name(); ?></option> + <?php } ?> + </select> </div> </div> |
