diff options
Diffstat (limited to 'src/Wallabag/CoreBundle')
17 files changed, 77 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 9a7dd4e7..a0503c39 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -685,6 +685,21 @@ class Entry | |||
685 | } | 685 | } |
686 | 686 | ||
687 | /** | 687 | /** |
688 | * Used in the entries filter so it's more explicit for the end user than the uid. | ||
689 | * Also used in the API. | ||
690 | * | ||
691 | * @VirtualProperty | ||
692 | * @SerializedName("is_public") | ||
693 | * @Groups({"entries_for_user"}) | ||
694 | * | ||
695 | * @return bool | ||
696 | */ | ||
697 | public function isPublic() | ||
698 | { | ||
699 | return null !== $this->uid; | ||
700 | } | ||
701 | |||
702 | /** | ||
688 | * @return string | 703 | * @return string |
689 | */ | 704 | */ |
690 | public function getHttpStatus() | 705 | public function getHttpStatus() |
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 556578d1..6a4c485f 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | |||
@@ -150,6 +150,20 @@ class EntryFilterType extends AbstractType | |||
150 | }, | 150 | }, |
151 | 'label' => 'entry.filters.preview_picture_label', | 151 | 'label' => 'entry.filters.preview_picture_label', |
152 | ]) | 152 | ]) |
153 | ->add('isPublic', CheckboxFilterType::class, [ | ||
154 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | ||
155 | if (false === $values['value']) { | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | // is_public isn't a real field | ||
160 | // we should use the "uid" field to determine if the entry has been made public | ||
161 | $expression = $filterQuery->getExpr()->isNotNull($values['alias'].'.uid'); | ||
162 | |||
163 | return $filterQuery->createCondition($expression); | ||
164 | }, | ||
165 | 'label' => 'entry.filters.is_public_label', | ||
166 | ]) | ||
153 | ->add('language', ChoiceFilterType::class, [ | 167 | ->add('language', ChoiceFilterType::class, [ |
154 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), | 168 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), |
155 | 'label' => 'entry.filters.language_label', | 169 | 'label' => 'entry.filters.language_label', |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 0c971863..51bb2ca2 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -120,12 +120,12 @@ class ContentProxy | |||
120 | 120 | ||
121 | $this->validateAndSetLanguage( | 121 | $this->validateAndSetLanguage( |
122 | $entry, | 122 | $entry, |
123 | isset($content['language']) ? $content['language'] : '' | 123 | isset($content['language']) ? $content['language'] : null |
124 | ); | 124 | ); |
125 | 125 | ||
126 | $this->validateAndSetPreviewPicture( | 126 | $this->validateAndSetPreviewPicture( |
127 | $entry, | 127 | $entry, |
128 | isset($content['open_graph']['og_image']) ? $content['open_graph']['og_image'] : '' | 128 | isset($content['open_graph']['og_image']) ? $content['open_graph']['og_image'] : null |
129 | ); | 129 | ); |
130 | 130 | ||
131 | // if content is an image, define it as a preview too | 131 | // if content is an image, define it as a preview too |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 6972e974..9bda4e15 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -135,6 +135,7 @@ class EntryRepository extends EntityRepository | |||
135 | * @param int $userId | 135 | * @param int $userId |
136 | * @param bool $isArchived | 136 | * @param bool $isArchived |
137 | * @param bool $isStarred | 137 | * @param bool $isStarred |
138 | * @param bool $isPublic | ||
138 | * @param string $sort | 139 | * @param string $sort |
139 | * @param string $order | 140 | * @param string $order |
140 | * @param int $since | 141 | * @param int $since |
@@ -142,18 +143,22 @@ class EntryRepository extends EntityRepository | |||
142 | * | 143 | * |
143 | * @return array | 144 | * @return array |
144 | */ | 145 | */ |
145 | public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') | 146 | public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'ASC', $since = 0, $tags = '') |
146 | { | 147 | { |
147 | $qb = $this->createQueryBuilder('e') | 148 | $qb = $this->createQueryBuilder('e') |
148 | ->leftJoin('e.tags', 't') | 149 | ->leftJoin('e.tags', 't') |
149 | ->where('e.user =:userId')->setParameter('userId', $userId); | 150 | ->where('e.user =:userId')->setParameter('userId', $userId); |
150 | 151 | ||
151 | if (null !== $isArchived) { | 152 | if (null !== $isArchived) { |
152 | $qb->andWhere('e.isArchived =:isArchived')->setParameter('isArchived', (bool) $isArchived); | 153 | $qb->andWhere('e.isArchived = :isArchived')->setParameter('isArchived', (bool) $isArchived); |
153 | } | 154 | } |
154 | 155 | ||
155 | if (null !== $isStarred) { | 156 | if (null !== $isStarred) { |
156 | $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); | 157 | $qb->andWhere('e.isStarred = :isStarred')->setParameter('isStarred', (bool) $isStarred); |
158 | } | ||
159 | |||
160 | if (null !== $isPublic) { | ||
161 | $qb->andWhere('e.uid IS '.(true === $isPublic ? 'NOT' : '').' NULL'); | ||
157 | } | 162 | } |
158 | 163 | ||
159 | if ($since > 0) { | 164 | if ($since > 0) { |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 3a3fb91d..a91a0ce4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -187,6 +187,8 @@ entry: | |||
187 | unread_label: 'Ulæst' | 187 | unread_label: 'Ulæst' |
188 | preview_picture_label: 'Har et vist billede' | 188 | preview_picture_label: 'Har et vist billede' |
189 | preview_picture_help: 'Forhåndsvis billede' | 189 | preview_picture_help: 'Forhåndsvis billede' |
190 | # is_public_label: 'Has a public link' | ||
191 | # is_public_help: 'Public link' | ||
190 | language_label: 'Sprog' | 192 | language_label: 'Sprog' |
191 | # http_status_label: 'HTTP status' | 193 | # http_status_label: 'HTTP status' |
192 | reading_time: | 194 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 85f0e1a3..e77cdca3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Ungelesene' | 188 | unread_label: 'Ungelesene' |
189 | preview_picture_label: 'Vorschaubild vorhanden' | 189 | preview_picture_label: 'Vorschaubild vorhanden' |
190 | preview_picture_help: 'Vorschaubild' | 190 | preview_picture_help: 'Vorschaubild' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Sprache' | 193 | language_label: 'Sprache' |
192 | http_status_label: 'HTTP-Status' | 194 | http_status_label: 'HTTP-Status' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 284fa2fb..50edab3a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Unread' | 188 | unread_label: 'Unread' |
189 | preview_picture_label: 'Has a preview picture' | 189 | preview_picture_label: 'Has a preview picture' |
190 | preview_picture_help: 'Preview picture' | 190 | preview_picture_help: 'Preview picture' |
191 | is_public_label: 'Has a public link' | ||
192 | is_public_help: 'Public link' | ||
191 | language_label: 'Language' | 193 | language_label: 'Language' |
192 | http_status_label: 'HTTP status' | 194 | http_status_label: 'HTTP status' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 33bb879c..6fbf00eb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Sin leer' | 188 | unread_label: 'Sin leer' |
189 | preview_picture_label: 'Tiene imagen de previsualización' | 189 | preview_picture_label: 'Tiene imagen de previsualización' |
190 | preview_picture_help: 'Imagen de previsualización' | 190 | preview_picture_help: 'Imagen de previsualización' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Idioma' | 193 | language_label: 'Idioma' |
192 | http_status_label: 'Código de estado HTTP' | 194 | http_status_label: 'Código de estado HTTP' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 90eb119c..ad7d6cd9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'خواندهنشده' | 188 | unread_label: 'خواندهنشده' |
189 | preview_picture_label: 'دارای عکس پیشنمایش' | 189 | preview_picture_label: 'دارای عکس پیشنمایش' |
190 | preview_picture_help: 'پیشنمایش عکس' | 190 | preview_picture_help: 'پیشنمایش عکس' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'زبان' | 193 | language_label: 'زبان' |
192 | # http_status_label: 'HTTP status' | 194 | # http_status_label: 'HTTP status' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index cd239b5c..c4b029c3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: "Non lus" | 188 | unread_label: "Non lus" |
189 | preview_picture_label: "A une photo" | 189 | preview_picture_label: "A une photo" |
190 | preview_picture_help: "Photo" | 190 | preview_picture_help: "Photo" |
191 | is_public_label: 'A un lien public' | ||
192 | is_public_help: 'Lien public' | ||
191 | language_label: "Langue" | 193 | language_label: "Langue" |
192 | http_status_label: "Statut HTTP" | 194 | http_status_label: "Statut HTTP" |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 5cb2a68f..4bd04aad 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | # unread_label: 'Unread' | 188 | # unread_label: 'Unread' |
189 | preview_picture_label: "Ha un'immagine di anteprima" | 189 | preview_picture_label: "Ha un'immagine di anteprima" |
190 | preview_picture_help: 'Immagine di anteprima' | 190 | preview_picture_help: 'Immagine di anteprima' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Lingua' | 193 | language_label: 'Lingua' |
192 | # http_status_label: 'HTTP status' | 194 | # http_status_label: 'HTTP status' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index bc11b2a4..a6dd4dcd 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Pas legits' | 188 | unread_label: 'Pas legits' |
189 | preview_picture_label: 'A un imatge' | 189 | preview_picture_label: 'A un imatge' |
190 | preview_picture_help: 'Imatge' | 190 | preview_picture_help: 'Imatge' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Lenga' | 193 | language_label: 'Lenga' |
192 | http_status_label: 'Estatut HTTP' | 194 | http_status_label: 'Estatut HTTP' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 033d6ac5..7312abd7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Nieprzeczytane' | 188 | unread_label: 'Nieprzeczytane' |
189 | preview_picture_label: 'Posiada podgląd obrazu' | 189 | preview_picture_label: 'Posiada podgląd obrazu' |
190 | preview_picture_help: 'Podgląd obrazu' | 190 | preview_picture_help: 'Podgląd obrazu' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Język' | 193 | language_label: 'Język' |
192 | http_status_label: 'Status HTTP' | 194 | http_status_label: 'Status HTTP' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index c70c2496..18090352 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Não Lido' | 188 | unread_label: 'Não Lido' |
189 | preview_picture_label: 'Possui uma imagem de preview' | 189 | preview_picture_label: 'Possui uma imagem de preview' |
190 | preview_picture_help: 'Imagem de preview' | 190 | preview_picture_help: 'Imagem de preview' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Idioma' | 193 | language_label: 'Idioma' |
192 | # http_status_label: 'HTTP status' | 194 | # http_status_label: 'HTTP status' |
193 | reading_time: | 195 | reading_time: |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index a5dc44f0..f8866fdc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -188,6 +188,8 @@ entry: | |||
188 | unread_label: 'Necitite' | 188 | unread_label: 'Necitite' |
189 | preview_picture_label: 'Are o imagine de previzualizare' | 189 | preview_picture_label: 'Are o imagine de previzualizare' |
190 | preview_picture_help: 'Previzualizare imagine' | 190 | preview_picture_help: 'Previzualizare imagine' |
191 | # is_public_label: 'Has a public link' | ||
192 | # is_public_help: 'Public link' | ||
191 | language_label: 'Limbă' | 193 | language_label: 'Limbă' |
192 | # http_status_label: 'HTTP status' | 194 | # http_status_label: 'HTTP status' |
193 | reading_time: | 195 | reading_time: |
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 0ba6f4f4..6c26d5bf 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 | |||
@@ -127,6 +127,11 @@ | |||
127 | {{ form_widget(form.previewPicture) }} | 127 | {{ form_widget(form.previewPicture) }} |
128 | {{ form_label(form.previewPicture) }} | 128 | {{ form_label(form.previewPicture) }} |
129 | </div> | 129 | </div> |
130 | |||
131 | <div class="input-field"> | ||
132 | {{ form_widget(form.isPublic) }} | ||
133 | {{ form_label(form.isPublic) }} | ||
134 | </div> | ||
130 | </div> | 135 | </div> |
131 | 136 | ||
132 | <div id="filter-language" class="filter-group"> | 137 | <div id="filter-language" class="filter-group"> |
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 6f657b18..5ba42057 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 | |||
@@ -103,6 +103,15 @@ | |||
103 | </div> | 103 | </div> |
104 | 104 | ||
105 | <div class="col s12"> | 105 | <div class="col s12"> |
106 | <label>{{ 'entry.filters.is_public_help'|trans }}</label> | ||
107 | </div> | ||
108 | |||
109 | <div class="input-field col s12 with-checkbox"> | ||
110 | {{ form_widget(form.isPublic) }} | ||
111 | {{ form_label(form.isPublic) }} | ||
112 | </div> | ||
113 | |||
114 | <div class="col s12"> | ||
106 | {{ form_label(form.language) }} | 115 | {{ form_label(form.language) }} |
107 | </div> | 116 | </div> |
108 | 117 | ||
@@ -121,10 +130,12 @@ | |||
121 | <div class="col s12"> | 130 | <div class="col s12"> |
122 | {{ form_label(form.readingTime) }} | 131 | {{ form_label(form.readingTime) }} |
123 | </div> | 132 | </div> |
133 | |||
124 | <div class="input-field col s6"> | 134 | <div class="input-field col s6"> |
125 | {{ form_widget(form.readingTime.left_number, {'type': 'number'}) }} | 135 | {{ form_widget(form.readingTime.left_number, {'type': 'number'}) }} |
126 | <label for="entry_filter_readingTime_left_number">{{ 'entry.filters.reading_time.from'|trans }}</label> | 136 | <label for="entry_filter_readingTime_left_number">{{ 'entry.filters.reading_time.from'|trans }}</label> |
127 | </div> | 137 | </div> |
138 | |||
128 | <div class="input-field col s6"> | 139 | <div class="input-field col s6"> |
129 | {{ form_widget(form.readingTime.right_number, {'type': 'number'}) }} | 140 | {{ form_widget(form.readingTime.right_number, {'type': 'number'}) }} |
130 | <label for="entry_filter_readingTime_right_number">{{ 'entry.filters.reading_time.to'|trans }}</label> | 141 | <label for="entry_filter_readingTime_right_number">{{ 'entry.filters.reading_time.to'|trans }}</label> |