diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2017-04-18 13:12:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 13:12:28 +0200 |
commit | 64f1d8f77a75332b731124c5ebab4bed7a512081 (patch) | |
tree | 41b087f24db4f4fce2e94a811d8554c91637d137 /src | |
parent | c5ba478dc326ee43c5861fc170d1121b6224d847 (diff) | |
parent | e9c80c99bda57905e481dc7eb7748a3b5c0d9ac9 (diff) | |
download | wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.tar.gz wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.tar.zst wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.zip |
Merge pull request #3024 from wallabag/store-date
Added publication date and author
Diffstat (limited to 'src')
16 files changed, 121 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index bbb1fb53..b71c467c 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -122,6 +122,24 @@ class Entry | |||
122 | private $updatedAt; | 122 | private $updatedAt; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * @var \DateTime | ||
126 | * | ||
127 | * @ORM\Column(name="published_at", type="datetime", nullable=true) | ||
128 | * | ||
129 | * @Groups({"entries_for_user", "export_all"}) | ||
130 | */ | ||
131 | private $publishedAt; | ||
132 | |||
133 | /** | ||
134 | * @var array | ||
135 | * | ||
136 | * @ORM\Column(name="published_by", type="json_array", nullable=true) | ||
137 | * | ||
138 | * @Groups({"entries_for_user", "export_all"}) | ||
139 | */ | ||
140 | private $publishedBy; | ||
141 | |||
142 | /** | ||
125 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) | 143 | * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) |
126 | * @ORM\JoinTable | 144 | * @ORM\JoinTable |
127 | * | 145 | * |
@@ -676,4 +694,44 @@ class Entry | |||
676 | 694 | ||
677 | return $this; | 695 | return $this; |
678 | } | 696 | } |
697 | |||
698 | /** | ||
699 | * @return \Datetime | ||
700 | */ | ||
701 | public function getPublishedAt() | ||
702 | { | ||
703 | return $this->publishedAt; | ||
704 | } | ||
705 | |||
706 | /** | ||
707 | * @param \Datetime $publishedAt | ||
708 | * | ||
709 | * @return Entry | ||
710 | */ | ||
711 | public function setPublishedAt(\Datetime $publishedAt) | ||
712 | { | ||
713 | $this->publishedAt = $publishedAt; | ||
714 | |||
715 | return $this; | ||
716 | } | ||
717 | |||
718 | /** | ||
719 | * @return string | ||
720 | */ | ||
721 | public function getPublishedBy() | ||
722 | { | ||
723 | return $this->publishedBy; | ||
724 | } | ||
725 | |||
726 | /** | ||
727 | * @param string $publishedBy | ||
728 | * | ||
729 | * @return Entry | ||
730 | */ | ||
731 | public function setPublishedBy($publishedBy) | ||
732 | { | ||
733 | $this->publishedBy = $publishedBy; | ||
734 | |||
735 | return $this; | ||
736 | } | ||
679 | } | 737 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index f222dd88..d45aef88 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -79,6 +79,14 @@ class ContentProxy | |||
79 | $entry->setContent($html); | 79 | $entry->setContent($html); |
80 | $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); | 80 | $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); |
81 | 81 | ||
82 | if (isset($content['date']) && null !== $content['date'] && '' !== $content['date']) { | ||
83 | $entry->setPublishedAt(new \DateTime($content['date'])); | ||
84 | } | ||
85 | |||
86 | if (!empty($content['authors'])) { | ||
87 | $entry->setPublishedBy($content['authors']); | ||
88 | } | ||
89 | |||
82 | $entry->setLanguage(isset($content['language']) ? $content['language'] : ''); | 90 | $entry->setLanguage(isset($content['language']) ? $content['language'] : ''); |
83 | $entry->setMimetype(isset($content['content_type']) ? $content['content_type'] : ''); | 91 | $entry->setMimetype(isset($content['content_type']) ? $content['content_type'] : ''); |
84 | $entry->setReadingTime(Utils::getReadingTime($html)); | 92 | $entry->setReadingTime(Utils::getReadingTime($html)); |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index ff89a6d1..72493fe3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' | 225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' |
226 | created_at: 'Oprettelsesdato' | 226 | created_at: 'Oprettelsesdato' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Gem ny artikel' | 230 | page_title: 'Gem ny artikel' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 99b15b0d..dbad8b16 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' | 225 | annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' |
226 | created_at: 'Erstellungsdatum' | 226 | created_at: 'Erstellungsdatum' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Neuen Artikel speichern' | 230 | page_title: 'Neuen Artikel speichern' |
229 | placeholder: 'https://website.de' | 231 | placeholder: 'https://website.de' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 273ba25d..7da9fe6b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' | 225 | annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' |
226 | created_at: 'Creation date' | 226 | created_at: 'Creation date' |
227 | published_at: 'Publication date' | ||
228 | published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Save new entry' | 230 | page_title: 'Save new entry' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 87c6954f..6e21614e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | annotations_on_the_entry: '{0} Sin anotaciones|{1} Una anotación|]1,Inf[ %count% anotaciones' | 225 | annotations_on_the_entry: '{0} Sin anotaciones|{1} Una anotación|]1,Inf[ %count% anotaciones' |
226 | created_at: 'Fecha de creación' | 226 | created_at: 'Fecha de creación' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Guardar un nuevo artículo' | 230 | page_title: 'Guardar un nuevo artículo' |
229 | placeholder: 'http://sitioweb.com' | 231 | placeholder: 'http://sitioweb.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index caafd6d7..b938c80a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'اصلی' | 224 | original_article: 'اصلی' |
225 | annotations_on_the_entry: '{0} بدون حاشیه|{1} یک حاشیه|]1,Inf[ %nbحاشیه% annotations' | 225 | annotations_on_the_entry: '{0} بدون حاشیه|{1} یک حاشیه|]1,Inf[ %nbحاشیه% annotations' |
226 | created_at: 'زمان ساخت' | 226 | created_at: 'زمان ساخت' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'ذخیرهٔ مقالهٔ تازه' | 230 | page_title: 'ذخیرهٔ مقالهٔ تازه' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 72366513..9abcda45 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: "original" | 224 | original_article: "original" |
225 | annotations_on_the_entry: "{0} Aucune annotation|{1} Une annotation|]1,Inf[ %count% annotations" | 225 | annotations_on_the_entry: "{0} Aucune annotation|{1} Une annotation|]1,Inf[ %count% annotations" |
226 | created_at: "Date de création" | 226 | created_at: "Date de création" |
227 | published_at: "Date de publication" | ||
228 | published_by: "Publié par" | ||
227 | new: | 229 | new: |
228 | page_title: "Sauvegarder un nouvel article" | 230 | page_title: "Sauvegarder un nouvel article" |
229 | placeholder: "http://website.com" | 231 | placeholder: "http://website.com" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 52f05b87..58d0962a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'originale' | 224 | original_article: 'originale' |
225 | annotations_on_the_entry: '{0} Nessuna annotazione|{1} Una annotazione|]1,Inf[ %count% annotazioni' | 225 | annotations_on_the_entry: '{0} Nessuna annotazione|{1} Una annotazione|]1,Inf[ %count% annotazioni' |
226 | created_at: 'Data di creazione' | 226 | created_at: 'Data di creazione' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Salva un nuovo contenuto' | 230 | page_title: 'Salva un nuovo contenuto' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index c8b0e783..825a0efd 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | annotations_on_the_entry: "{0} Pas cap d'anotacion|{1} Una anotacion|]1,Inf[ %count% anotacions" | 225 | annotations_on_the_entry: "{0} Pas cap d'anotacion|{1} Una anotacion|]1,Inf[ %count% anotacions" |
226 | created_at: 'Data de creacion' | 226 | created_at: 'Data de creacion' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Enregistrar un novèl article' | 230 | page_title: 'Enregistrar un novèl article' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index e586ea84..b02aa4ec 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'oryginalny' | 224 | original_article: 'oryginalny' |
225 | annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' | 225 | annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' |
226 | created_at: 'Czas stworzenia' | 226 | created_at: 'Czas stworzenia' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Zapisz nowy wpis' | 230 | page_title: 'Zapisz nowy wpis' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 09ddd7f8..8aa7e5af 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | annotations_on_the_entry: '{0} Sem anotações|{1} Uma anotação|]1,Inf[ %nbAnnotations% anotações' | 225 | annotations_on_the_entry: '{0} Sem anotações|{1} Uma anotação|]1,Inf[ %nbAnnotations% anotações' |
226 | created_at: 'Data de criação' | 226 | created_at: 'Data de criação' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Salvar nova entrada' | 230 | page_title: 'Salvar nova entrada' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index cdd0be9f..ce8d8d52 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'original' | 224 | original_article: 'original' |
225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' | 225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' |
226 | created_at: 'Data creării' | 226 | created_at: 'Data creării' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Salvează un nou articol' | 230 | page_title: 'Salvează un nou articol' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index ae05e036..d8903608 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -224,6 +224,8 @@ entry: | |||
224 | original_article: 'orijinal' | 224 | original_article: 'orijinal' |
225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' | 225 | # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' |
226 | created_at: 'Oluşturulma tarihi' | 226 | created_at: 'Oluşturulma tarihi' |
227 | # published_at: 'Publication date' | ||
228 | # published_by: 'Published by' | ||
227 | new: | 229 | new: |
228 | page_title: 'Yeni makaleyi kaydet' | 230 | page_title: 'Yeni makaleyi kaydet' |
229 | placeholder: 'http://website.com' | 231 | placeholder: 'http://website.com' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index 5d5e6dd8..426ce91c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig | |||
@@ -44,9 +44,23 @@ | |||
44 | 44 | ||
45 | <div id="article-informations"> | 45 | <div id="article-informations"> |
46 | <i class="tool icon icon-calendar" title="{{ 'entry.view.created_at'|trans }}"> | 46 | <i class="tool icon icon-calendar" title="{{ 'entry.view.created_at'|trans }}"> |
47 | {{ entry.createdAt|date('Y-m-d') }} | 47 | {{ entry.createdAt|date('Y-m-d H:i') }} |
48 | </i> | 48 | </i> |
49 | 49 | ||
50 | {% if entry.publishedAt is not null %} | ||
51 | <i class="tool icon icon-pencil2" title="{{ 'entry.view.published_at'|trans }}"> | ||
52 | {{ entry.publishedAt|date('Y-m-d H:i') }} | ||
53 | </i> | ||
54 | {% endif %} | ||
55 | |||
56 | {% if entry.publishedBy is not empty %} | ||
57 | <i class="tool icon icon-users" title="{{ 'entry.view.published_by'|trans }}"> | ||
58 | {% for author in entry.publishedBy %} | ||
59 | {{ author }}{% if not loop.last %}, {% endif %} | ||
60 | {% endfor %} | ||
61 | </i> | ||
62 | {% endif %} | ||
63 | |||
50 | <i class="tool icon icon-time"> | 64 | <i class="tool icon icon-time"> |
51 | {% set readingTime = entry.readingTime / app.user.config.readingSpeed %} | 65 | {% set readingTime = entry.readingTime / app.user.config.readingSpeed %} |
52 | {% if readingTime > 0 %} | 66 | {% if readingTime > 0 %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 8e60e2b4..8be5fd0d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | |||
@@ -138,7 +138,7 @@ | |||
138 | <span>scuttle</span> | 138 | <span>scuttle</span> |
139 | </a> | 139 | </a> |
140 | </li> | 140 | </li> |
141 | {% endif %} | 141 | {% endif %} |
142 | {% if craue_setting('share_diaspora') %} | 142 | {% if craue_setting('share_diaspora') %} |
143 | <li> | 143 | <li> |
144 | <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|striptags|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank"> | 144 | <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|striptags|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank"> |
@@ -226,8 +226,22 @@ | |||
226 | </li> | 226 | </li> |
227 | <li> | 227 | <li> |
228 | <i class="material-icons" title="{{ 'entry.view.created_at'|trans }}">today</i> | 228 | <i class="material-icons" title="{{ 'entry.view.created_at'|trans }}">today</i> |
229 | {{ entry.createdAt|date('Y-m-d') }} | 229 | {{ entry.createdAt|date('Y-m-d H:i') }} |
230 | </li> | ||
231 | {% if entry.publishedAt is not null %} | ||
232 | <li> | ||
233 | <i class="material-icons" title="{{ 'entry.view.published_at'|trans }}">create</i> | ||
234 | {{ entry.publishedAt|date('Y-m-d H:i') }} | ||
230 | </li> | 235 | </li> |
236 | {% endif %} | ||
237 | {% if entry.publishedBy is not empty %} | ||
238 | <li> | ||
239 | <i class="material-icons" title="{{ 'entry.view.published_by'|trans }}">person</i> | ||
240 | {% for author in entry.publishedBy %} | ||
241 | {{ author }}{% if not loop.last %}, {% endif %} | ||
242 | {% endfor %} | ||
243 | </li> | ||
244 | {% endif %} | ||
231 | <li> | 245 | <li> |
232 | <i class="material-icons link">link</i> | 246 | <i class="material-icons link">link</i> |
233 | <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|striptags }}" class="tool"> | 247 | <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|striptags }}" class="tool"> |