diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2016-11-19 11:53:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 11:53:41 +0100 |
commit | 8add306204f2ad331dafe091bb9d168ce7781df7 (patch) | |
tree | 109a91745ba45ae886222d2e34b9491a2d0d3b00 /src | |
parent | b060fbdfe763bf4fa2b17d43bccc6751cefd0d2c (diff) | |
parent | d215273c65ed7aecf0a1f887c91752eaf41d191b (diff) | |
download | wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.tar.gz wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.tar.zst wallabag-8add306204f2ad331dafe091bb9d168ce7781df7.zip |
Merge pull request #2601 from wallabag/store-http-status
Added http_status in Entry entity
Diffstat (limited to 'src')
17 files changed, 73 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index f59c445f..3cf9ac1a 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -181,6 +181,15 @@ class Entry | |||
181 | private $isPublic; | 181 | private $isPublic; |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * @var string | ||
185 | * | ||
186 | * @ORM\Column(name="http_status", type="text", nullable=true) | ||
187 | * | ||
188 | * @Groups({"entries_for_user", "export_all"}) | ||
189 | */ | ||
190 | private $httpStatus; | ||
191 | |||
192 | /** | ||
184 | * @Exclude | 193 | * @Exclude |
185 | * | 194 | * |
186 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") | 195 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") |
@@ -669,4 +678,24 @@ class Entry | |||
669 | { | 678 | { |
670 | $this->uuid = null; | 679 | $this->uuid = null; |
671 | } | 680 | } |
681 | |||
682 | /** | ||
683 | * @return int | ||
684 | */ | ||
685 | public function getHttpStatus() | ||
686 | { | ||
687 | return $this->httpStatus; | ||
688 | } | ||
689 | |||
690 | /** | ||
691 | * @param int $httpStatus | ||
692 | * | ||
693 | * @return Entry | ||
694 | */ | ||
695 | public function setHttpStatus($httpStatus) | ||
696 | { | ||
697 | $this->httpStatus = $httpStatus; | ||
698 | |||
699 | return $this; | ||
700 | } | ||
672 | } | 701 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 3c597b5d..8e2883f7 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -11,6 +11,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType; | |||
11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; | 11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; |
12 | use Symfony\Component\Form\AbstractType; | 12 | use Symfony\Component\Form\AbstractType; |
13 | use Symfony\Component\Form\FormBuilderInterface; | 13 | use Symfony\Component\Form\FormBuilderInterface; |
14 | use Symfony\Component\HttpFoundation\Response; | ||
14 | use Symfony\Component\OptionsResolver\OptionsResolver; | 15 | use Symfony\Component\OptionsResolver\OptionsResolver; |
15 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | 16 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
16 | 17 | ||
@@ -90,6 +91,21 @@ class EntryFilterType extends AbstractType | |||
90 | }, | 91 | }, |
91 | 'label' => 'entry.filters.domain_label', | 92 | 'label' => 'entry.filters.domain_label', |
92 | ]) | 93 | ]) |
94 | ->add('httpStatus', TextFilterType::class, [ | ||
95 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | ||
96 | $value = $values['value']; | ||
97 | if (false === array_key_exists($value, Response::$statusTexts)) { | ||
98 | return; | ||
99 | } | ||
100 | |||
101 | $paramName = sprintf('%s', str_replace('.', '_', $field)); | ||
102 | $expression = $filterQuery->getExpr()->eq($field, ':'.$paramName); | ||
103 | $parameters = array($paramName => $value); | ||
104 | |||
105 | return $filterQuery->createCondition($expression, $parameters); | ||
106 | }, | ||
107 | 'label' => 'entry.filters.http_status_label', | ||
108 | ]) | ||
93 | ->add('isArchived', CheckboxFilterType::class, [ | 109 | ->add('isArchived', CheckboxFilterType::class, [ |
94 | 'label' => 'entry.filters.archived_label', | 110 | 'label' => 'entry.filters.archived_label', |
95 | ]) | 111 | ]) |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 1986ab33..178910ab 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -66,6 +66,7 @@ class ContentProxy | |||
66 | $entry->setUrl($content['url'] ?: $url); | 66 | $entry->setUrl($content['url'] ?: $url); |
67 | $entry->setTitle($title); | 67 | $entry->setTitle($title); |
68 | $entry->setContent($html); | 68 | $entry->setContent($html); |
69 | $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); | ||
69 | 70 | ||
70 | $entry->setLanguage($content['language']); | 71 | $entry->setLanguage($content['language']); |
71 | $entry->setMimetype($content['content_type']); | 72 | $entry->setMimetype($content['content_type']); |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index c24c5965..c41a2b1a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Har et vist billede' | 178 | preview_picture_label: 'Har et vist billede' |
179 | preview_picture_help: 'Forhåndsvis billede' | 179 | preview_picture_help: 'Forhåndsvis billede' |
180 | language_label: 'Sprog' | 180 | language_label: 'Sprog' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Læsetid i minutter' | 183 | label: 'Læsetid i minutter' |
183 | from: 'fra' | 184 | from: 'fra' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 561d276e..c0d815ad 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Vorschaubild vorhanden' | 178 | preview_picture_label: 'Vorschaubild vorhanden' |
179 | preview_picture_help: 'Vorschaubild' | 179 | preview_picture_help: 'Vorschaubild' |
180 | language_label: 'Sprache' | 180 | language_label: 'Sprache' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Lesezeit in Minuten' | 183 | label: 'Lesezeit in Minuten' |
183 | from: 'von' | 184 | from: 'von' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index ec49368c..cceff5c7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Has a preview picture' | 178 | preview_picture_label: 'Has a preview picture' |
179 | preview_picture_help: 'Preview picture' | 179 | preview_picture_help: 'Preview picture' |
180 | language_label: 'Language' | 180 | language_label: 'Language' |
181 | http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Reading time in minutes' | 183 | label: 'Reading time in minutes' |
183 | from: 'from' | 184 | from: 'from' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 15d0c3cf..358c1999 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Hay una foto' | 178 | preview_picture_label: 'Hay una foto' |
179 | preview_picture_help: 'Foto de preview' | 179 | preview_picture_help: 'Foto de preview' |
180 | language_label: 'Idioma' | 180 | language_label: 'Idioma' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Duración de lectura en minutos' | 183 | label: 'Duración de lectura en minutos' |
183 | from: 'de' | 184 | from: 'de' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index e7fa4f86..0546815e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'دارای عکس پیشنمایش' | 178 | preview_picture_label: 'دارای عکس پیشنمایش' |
179 | preview_picture_help: 'پیشنمایش عکس' | 179 | preview_picture_help: 'پیشنمایش عکس' |
180 | language_label: 'زبان' | 180 | language_label: 'زبان' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'زمان خواندن به دقیقه' | 183 | label: 'زمان خواندن به دقیقه' |
183 | from: 'از' | 184 | from: 'از' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index f85a797d..ec90f9af 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: "A une photo" | 178 | preview_picture_label: "A une photo" |
179 | preview_picture_help: "Photo" | 179 | preview_picture_help: "Photo" |
180 | language_label: "Langue" | 180 | language_label: "Langue" |
181 | http_status_label: 'Statut HTTP' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: "Durée de lecture en minutes" | 183 | label: "Durée de lecture en minutes" |
183 | from: "de" | 184 | from: "de" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 8a8469d2..2c9924aa 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: "Ha un'immagine di anteprima" | 178 | preview_picture_label: "Ha un'immagine di anteprima" |
179 | preview_picture_help: 'Immagine di anteprima' | 179 | preview_picture_help: 'Immagine di anteprima' |
180 | language_label: 'Lingua' | 180 | language_label: 'Lingua' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Tempo di lettura in minuti' | 183 | label: 'Tempo di lettura in minuti' |
183 | from: 'da' | 184 | from: 'da' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index d37dc724..4af8b8fc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'A una fotò' | 178 | preview_picture_label: 'A una fotò' |
179 | preview_picture_help: 'Fotò' | 179 | preview_picture_help: 'Fotò' |
180 | language_label: 'Lenga' | 180 | language_label: 'Lenga' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Durada de lectura en minutas' | 183 | label: 'Durada de lectura en minutas' |
183 | from: 'de' | 184 | from: 'de' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index da95e470..53c60ad2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Posiada podgląd obrazu' | 178 | preview_picture_label: 'Posiada podgląd obrazu' |
179 | preview_picture_help: 'Podgląd obrazu' | 179 | preview_picture_help: 'Podgląd obrazu' |
180 | language_label: 'Język' | 180 | language_label: 'Język' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Czas czytania w minutach' | 183 | label: 'Czas czytania w minutach' |
183 | from: 'od' | 184 | from: 'od' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 5d2607af..4b02cf36 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Possui uma imagem de preview' | 178 | preview_picture_label: 'Possui uma imagem de preview' |
179 | preview_picture_help: 'Imagem de preview' | 179 | preview_picture_help: 'Imagem de preview' |
180 | language_label: 'Idioma' | 180 | language_label: 'Idioma' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Tempo de leitura em minutos' | 183 | label: 'Tempo de leitura em minutos' |
183 | from: 'de' | 184 | from: 'de' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 6b51d9ce..a8f5aad3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Are o imagine de previzualizare' | 178 | preview_picture_label: 'Are o imagine de previzualizare' |
179 | preview_picture_help: 'Previzualizare imagine' | 179 | preview_picture_help: 'Previzualizare imagine' |
180 | language_label: 'Limbă' | 180 | language_label: 'Limbă' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Timp de citire în minute' | 183 | label: 'Timp de citire în minute' |
183 | from: 'de la' | 184 | from: 'de la' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 9c392433..7cc0a54e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -178,6 +178,7 @@ entry: | |||
178 | preview_picture_label: 'Resim önizlemesi varsa' | 178 | preview_picture_label: 'Resim önizlemesi varsa' |
179 | preview_picture_help: 'Resim önizlemesi' | 179 | preview_picture_help: 'Resim önizlemesi' |
180 | language_label: 'Dil' | 180 | language_label: 'Dil' |
181 | # http_status_label: 'HTTP status' | ||
181 | reading_time: | 182 | reading_time: |
182 | label: 'Dakika cinsinden okuma süresi' | 183 | label: 'Dakika cinsinden okuma süresi' |
183 | from: 'başlangıç' | 184 | from: 'başlangıç' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index 5d657c7e..86c1c5ec 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -112,6 +112,13 @@ | |||
112 | </div> | 112 | </div> |
113 | </div> | 113 | </div> |
114 | 114 | ||
115 | <div id="filter-http-status" class="filter-group"> | ||
116 | {{ form_label(form.httpStatus) }} | ||
117 | <div class="input-field "> | ||
118 | {{ form_widget(form.httpStatus) }} | ||
119 | </div> | ||
120 | </div> | ||
121 | |||
115 | <div id="filter-reading-time" class="filter-group"> | 122 | <div id="filter-reading-time" class="filter-group"> |
116 | <div class=""> | 123 | <div class=""> |
117 | {{ form_label(form.readingTime) }} | 124 | {{ form_label(form.readingTime) }} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 1225e680..a0205ffb 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | |||
@@ -163,6 +163,14 @@ | |||
163 | </div> | 163 | </div> |
164 | 164 | ||
165 | <div class="col s12"> | 165 | <div class="col s12"> |
166 | {{ form_label(form.httpStatus) }} | ||
167 | </div> | ||
168 | |||
169 | <div class="input-field col s12"> | ||
170 | {{ form_widget(form.httpStatus) }} | ||
171 | </div> | ||
172 | |||
173 | <div class="col s12"> | ||
166 | {{ form_label(form.readingTime) }} | 174 | {{ form_label(form.readingTime) }} |
167 | </div> | 175 | </div> |
168 | <div class="input-field col s6"> | 176 | <div class="input-field col s6"> |