Coder Social home page Coder Social logo

news-bundle's Introduction

Contao news bundle

The news bundle adds news functionality to Contao.

Contao is an Open Source PHP Content Management System for people who want a professional website that is easy to maintain. Visit the project website for more information.

License

Contao is licensed under the terms of the LGPLv3.

Getting support

Visit the support page to learn about the available support options.

news-bundle's People

Contributors

aschempp avatar ausi avatar bezin avatar bytehead avatar dmolineus avatar es-it avatar floxn avatar fritzmg avatar heimseiten avatar leofeyer avatar lukasbableck avatar m-vo avatar marcobiedermann avatar mroi avatar mynyx avatar qzminski avatar richardhj avatar severingloeckle avatar toflar avatar tsarma avatar xchs avatar zoglo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

news-bundle's Issues

4.4.9+ still requires only core-bundle ^4.4.2

contao/core-bundle 4.4.9 introduced the Model::isPreviewMode function, which is also used in contao/news-bundle (and the other bundles) starting with 4.4.9.

However, the composer.json was never changed to reflect that new dependency, it still only says:

"contao/core-bundle": "^4.4.2"

So if the core-bundle cannot be updated to 4.4.9+ but the news-bundle for example can be updated to 4.4.9+, you will get the error

… isPreviewMode does not exist

These circumstances can happen, if your PHP version is >=7.0.0,<7.0.8. The contao/core-bundle has a dependency on

"symfony/console": "^3.3.7"

since version 4.4.8. Thus contao/core-bundle cannot be updated to 4.4.8+ under PHP >=7.0.0,<7.0.8, because symfony/console 3.3.7+ requires at least PHP 7.0.8. The contao/news-bundle can be updated to 4.4.12 without any problems under PHP >=7.0.0,<7.0.8.

News-Feed anlegen erzeugt "500 Internal Server Error"

Hallo,

wenn ich im Nachrichten-Modul einen News-Feed anlege, dann bekomme ich beim Speichern einen "500 Internal Server Error".
Ich werde zwar aus dem Backend geworfen, aber der News-Feed wird trotzdem angelegt und kann auch im Browser ausgegeben werden.
Die Exporteinstellung "Ganze Beiträge" wird ignoriert und es werden nur die Teasertexte angezeigt.
Habe ich mich nach erfolgten "Rauswurf" wieder ins Backend gehangelt und gehe ins Nachrichtenmodul, dann bekomme ich ebenfalls einen "500 Internal Server Error" und kann nichts weiter machen.

Im Debug-Modus wird mir ein
Could not find template "ce_text_bild_mittig"
angezeigt, wobei "ce_text_bild_mittig" ein eigenes abgeleitetes Template ist.

Gehe ich auf Systemwartung -> XML-Dateien neu schreiben -> Daten bereinigen dann werde ich ebenfalls mit einem "500 Internal Server Error" aus dem Backend entfernt.

Der Stack Trace
Exception:
Could not find template "ce_text_bild_mittig"

at vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateLoader.php:158
at Contao\TemplateLoader::getDefaultPath('ce_text_bild_mittig', 'html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateLoader.php:114)
at Contao\TemplateLoader::getPath('ce_text_bild_mittig', 'html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:76)
at Contao\Controller::getTemplate('ce_text_bild_mittig')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:324)
at Contao\Template->getTemplatePath('ce_text_bild_mittig', 'html5')
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php:87)
at Contao\Template->inherit()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Template.php:292)
at Contao\Template->parse()
(vendor/contao/core-bundle/src/Resources/contao/classes/FrontendTemplate.php:44)
at Contao\FrontendTemplate->parse()
(vendor/contao/core-bundle/src/Resources/contao/elements/ContentElement.php:285)
at Contao\ContentElement->generate()
(vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:575)
at Contao\Controller::getContentElement(object(ContentModel))
(vendor/contao/news-bundle/src/Resources/contao/classes/News.php:208)
at Contao\News->generateFiles(array('id' => '6', 'tstamp' => '1607600977', 'title' => 'Aktuelles vom Landesverband Sachsen', 'alias' => 'news-sachsen-rss', 'language' => 'de', 'archives' => 'a:6:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";i:4;s:1:"6";i:5;s:1:"7";}', 'format' => 'rss', 'source' => 'source_text', 'maxItems' => '40', 'feedBase' => 'https://pnp-gbs-sachsen.de/', 'description' => 'Aktuelle Nachrichten und Informationen der Deutsche Polyneuropathie Selbsthilfe e.V. Landesverband Sachsen', 'feedName' => 'news-sachsen-rss'))
(vendor/contao/news-bundle/src/Resources/contao/classes/News.php:52)
at Contao\News->generateFeed('6')
(vendor/contao/news-bundle/src/Resources/contao/dca/tl_news_feed.php:455)
at tl_news_feed->generateFeed(object(DC_Table))
(vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php:202)
at Contao\DC_Table->__construct('tl_news_feed', array('tables' => array('tl_news_archive', 'tl_news', 'tl_news_feed', 'tl_content'), 'table' => array('Contao\TableWizard', 'importTable'), 'list' => array('Contao\ListWizard', 'importList')))
(vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php:411)
at Contao\Backend->getBackendModule('news', null)
(vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php:167)
at Contao\BackendMain->run()
(vendor/contao/core-bundle/src/Controller/BackendController.php:48)
at Contao\CoreBundle\Controller\BackendController->mainAction()
(vendor/symfony/http-kernel/HttpKernel.php:158)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:80)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/index.php:31)

Der Pfad des Templates: templates/pnp-gbs-sachsen/ce_text_bild_mittig.html5

Der Error wird nur ausgelöst, wenn ich in den Exporteinstellungen "Ganze Beiträge" auswähle.

toggle visibility changes time field to current time

Reproduction

  1. Create a news entry, set the date to an arbitrary value and the time to 01:00 for example (or anything that is not "now").
  2. In the list view of the news archive, hit the toggle visibility button (green or grey eye).
  3. Now go into the settings of the previously generated news entry and note it's time setting. It will be set to the current time.

screen-shot-2017-07-18-at-13 08 30

Non-admin user can not change news teaser image

After updating Contao 4.3.x to 4.4 non-admin users can't change the news teaser image. If you click on
source file "change selection" there is an error "Not enough permissions to access news archive ID."
error
The rights for editors are set as follows:
rights_news
Before updating everything was ok.

Reduce multiple executions when using $this->hasText and $this->text in news_ templates

The template variables are missleading compared to other variables that return a pre-evaluated value. Both variables execute a function without storing the return value for further usage. Using hasText more than once will trigger a DB-query each echo, $this->text will rebuild the whole news content every time.

Inconvenient: hasText is either boolean or executes a function. Also the naming of the variables do not make clear that a function isbeing called and stand not clear against other template variables like hasSubHeadline, hasTeaser that are clearly named and understandable in their return.

A value storage would help those functions and multiple use is not a bottle neck

id is unneccessarily appended to alias

Under certain circumstances the id is appended to an auto-generated alias, although it would be unique without it. This happens when:

  • a news item with the alias field left blank is saved, but the first attempt to save it results in an error
  • an existing news item is edited, the alias field is cleared, but the auto-generated alias would be the same as before

How to reproduce this in the online demo:

  1. Create a new news item
  2. Leave the alias field blank
  3. Select no author (or do anything else that will trigger a form error)
  4. Save
  5. Correct the error
  6. Save again
    The news item's alias will now contain the id, even though it would have been unique without it.

As far as I can tell this is caused by the generateAlias method which only checks the number of the alias' occurencies. The case where the generated alias already exists, but actually belongs to the item for which it was generated is not handled.

wrong comment for tl_news::listNewsArticles?

The comment for tl_news::listNewsArticles says:

/**
 * Add the type of input field
 *
 * @param array $arrRow
 *
 * @return string
 */
public function listNewsArticles($arrRow)
{
	return '<div class="tl_content_left">' . $arrRow['headline'] . ' <span style="color:#999;padding-left:3px">[' . Date::parse(Config::get('datimFormat'), $arrRow['date']) . ']</span></div>';
}

Shouldn't it rather say

/**
 * Show headline and date in list
 *
 * …
 */

or something along those lines?

Just a minor thing I just noticed :)

Remove roave/security-advisories

As discussed in Mumble on Januar 18th, 2018, we want to remove roave/security-advisories from the composer.json of the managed edition as it potentially prevents end users from updating their installation through the Contao Manager.

Instead, a bundle such as https://github.com/1up-lab/ContaoSecurityCheckerBundle could be used to get notified if one of the installed packages has a security issue.

Bug newsreader content download / content downloads

Hi,

We can't use content download or content downloads in a news because the file are corrupt when downloading.

A part of the template are injected in the header and we don't have the end part of the file.

I found this issue on the demo site too. I've not test on Contao 4.0 but i've the same issue since Contao 4.1

Header of a PDF file for exemple:


<div class="layout_full block" itemscope itemtype="http://schema.org/Article">

  <h1 itemprop="name">Hello world</h1>

      <p class="info"><time datetime="2017-01-30T17:27:00+01:00" itemprop="datePublished">2017-01-30 17:27</time> par Admin  </p>
  
  
      %PDF-1.5
%âãÏÓ
10 0 obj
<</Linearized 1/L 134289/O 12/E 129957/N 1/T 133984/H [ 777 289]>>
endobj
               
90 0 obj
<</DecodeParms<</Columns 5/Predictor 12>>/Filter/FlateDecode/ID[<E182E5868FCF0E01A64FE1F579ECD28B><BC0DE23470124040AC4DE59087625AF3>]/Index[10 135]/Info 9 0 R/Length 209/Prev 133985/Root 11 0 R/Size 145/Type/XRef/W[1 3 1]>>stream
hÞbbd`�``b``‘�‘~ ’q�ˆä¬�‘<�A$×S°H�˜¼	"ÙÝ@$·�ˆäð�³Áê¹[@¤À�°9µ`2�D��ƒH¦n°-ý@’1ì'X�l;ã��™���‘ ‹$�H�o0»�Lšƒõž�³Áz�ç�Éû`R�L
!±1e�ÑU2ÌER#„ ™„ÐE�zÀì{`R˜��!â�ßÍ�›€ä�&°	��í@ø�Ó^dó���ÙH$�"ÿY��˜€±q��ã(I2ùŸ�ùÏ�€ � Øã)�
endstream
endobj
startxref
0
%%EOF...............

Best

Tag news and news archive in 4.6

Here's the page example. Should be added on bothtl_news and tl_news_archive, imho.

// Tag the response
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
    /** @var ResponseTagger $responseTagger */
    $responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
    $responseTagger->addTags(array('contao.db.tl_page.' . $objPage->id));
}

The alias-url of news with external target doesn't redirect

If you create a news-record with an external redirect, the newslist is linking the entry to the external ressource.

The previously generated alias-url of the news-entry doesn't redirect you.
The old url is still available and shows a 1 to the screen:

image

AFAIK this is a bug as the page-module is handeling this case correctly.

A new version is saved even though no changes have been made

I noticed that every time you save, a new version is created, although it hasn't been changed.

It looks like the adjustTime callback handling the date and time input is causing this behaviour.
When the form is submitted, the dc_table driver will first save the timestamps for each of these fields and the onsubmit_callback will add the two timestamp together and saves them again.
This result in an always different timestamp when loading the form and when saving (e.g. the time input only return and save the seconds from midnight to the entered hours and minutes).

This is the same in the calendar-bundle when time is added.

I don't know a solution right now. One solution could be to use a single field with 'regx'=>'datim'. But that is not user friendly when time is not relevant.

Unknown method isPreviewMode

I get this Error in Contao / news-bundle V4.4.12 and PHP 7.1.13

Unknown method isPreviewMode

  at vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php:1025
  at Contao\Model::__callStatic('isPreviewMode', array(array()))
     (vendor/contao/news-bundle/src/Resources/contao/models/NewsModel.php:273)
  at Contao\NewsModel::countPublishedByPids(array('1'), null)
     (vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsList.php:183)
  at Contao\ModuleNewsList->countItems(array('1'), null)
     (vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsList.php:100)
  at Contao\ModuleNewsList->compile()
     (vendor/contao/core-bundle/src/Resources/contao/modules/Module.php:227)
  at Contao\Module->generate()
     (vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsList.php:64)
  at Contao\ModuleNewsList->generate()
     (vendor/contao/core-bundle/src/Resources/contao/elements/ContentModule.php:69)
  at Contao\ContentModule->generate()
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:485)
  at Contao\Controller::getContentElement(object(ContentModel), 'main')
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:186)
  at Contao\ModuleArticle->compile()
     (vendor/contao/core-bundle/src/Resources/contao/modules/Module.php:227)
  at Contao\Module->generate()
     (vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php:67)
  at Contao\ModuleArticle->generate(false)
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:424)
  at Contao\Controller::getArticle(object(ArticleModel), true, false, 'main')
     (vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php:282)
  at Contao\Controller::getFrontendModule('0', 'main')
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:177)
  at Contao\PageRegular->prepare(object(PageModel))
     (vendor/contao/core-bundle/src/Resources/contao/pages/PageRegular.php:49)
  at Contao\PageRegular->getResponse(object(PageModel), true)
     (vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:302)
  at Contao\FrontendIndex->renderPage(object(Collection))
     (vendor/contao/core-bundle/src/Resources/contao/controllers/FrontendIndex.php:77)
  at Contao\FrontendIndex->run()
     (vendor/contao/core-bundle/src/Controller/FrontendController.php:42)
  at Contao\CoreBundle\Controller\FrontendController->indexAction()
  at call_user_func_array(array(object(FrontendController), 'indexAction'), array())
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:153)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:171)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/app_dev.php:64)```

Newslist is rendered as text

Hello, is there any explanation, why the newslist module is rendered as text?

All other modules are rendered correct in 4.13.35, only this one makes some problems.

Example output:
<!-- TEMPLATE START: vendor/contao/news-bundle/src/Resources/contao/templates/news/news_full.html5 --> <div class="layout_full block first last even"> <h1>Test</h1> <p class="info"><time datetime="2023-12-20T17:00:00+01:00">20.12.2023 17:00</time> von Me </p> <h2>subheadline</h2> 1 </div> <!-- TEMPLATE END: vendor/contao/news-bundle/src/Resources/contao/templates/news/news_full.html5 -->

news-bundle proprietary?

Affected version(s)
4.7.7

Description
Hallo ich wollte das nur mal festgehalten haben. Ich war gestern in einer 4.7.7 Installation auf udmedia und dort waren alle Bundels mitinstalliert außer News. Deswegen wollte ich News nachinstallieren. Ich war sehr verwundert zu sehen, dass News dort als kostenpflichtiges Bundle ausgezeichnet war mit dem Hinweis "proprietary". Man konnte es auch nicht installieren. Der Button zum Hinzufügen enthielt einen Text ähnlich "Näheres auf der Homepage". Der Klick auf den Button führte aber wieder auf die selbe Seite auf der ich war.

Keine Ahnung, was da los war. Ne Stunde später war der Fehler dann verschwunden.

How to reproduce
Can not reproduce this.

Show the reader if an item has been selected

Please add the handling for the ModuleNewsReader into the ModuleNewsList, just like the ModuleEventList handles the request for ModuleEventReader.

Both listing modules ModuleNewsList and ModuleEventList do the same steps in the generate methode

  1. show backend information
  2. sortOutProtected
  3. return '' if there are no archives left
  4. call parent generate function

But the ModuleEventList also does this between step 3 and 4
https://github.com/contao/calendar-bundle/blob/f18b9130ba4d02ef0c189ed5fb16ef8d2922c8ec/src/Resources/contao/modules/ModuleEventlist.php#L75-L79

// Show the event reader if an item has been selected
if ($this->cal_readerModule > 0  && (isset($_GET['events']) || (\Config::get('useAutoItem') && isset($_GET['auto_item']))))
{
	return $this->getFrontendModule($this->cal_readerModule, $this->strColumn);
}

I see no reason why the ModuleNewsReader cannot also this step.
In my opinion this would improve consistency and makes it easier to great nice URLs.

feature: exclude reader page from sitemap and forward to or display latest news

By default, the reader page also gets included into the sitemap, which means search engines might index an otherwise empty page (since there is no output from the reader module when there is no parameter). People often wish to exclude it from the sitemap for that reason, or at least make it so that the reader page either forwads to or displays the latest news entry (though the latter would be duplicate content and inserting a canonical tag in such a case wouldn't make much sense imho).

So this feature request would generally be about handling empty reader pages. The reader module could provide two additional options:

  • Redirect to newest entry
  • Hide page from sitemap

When the first option is active, the reader module would simply search for the first news archive, that has the redirect page set to itself and generate an URL to the latest news entry from there and execute a redirect.

Furthermore, the getSearchablePages Hook would look for any reader modules on pages when $blnIsSitemap is true and remove the page from $arrPages whenever the second option of the module is set.

Feature: Sortierfunktion für Nachrichtenliste

Die Ausgabe der Nachrichtenliste sollte um eine Sortierfunktion ergänzt werden, so dass über das Modul gesteuert werden kann, in welcher Reihenfolge die News ausgegeben werden.

  • absteigend (Datum)
  • aufsteigen (Datum)
  • A - Z (Titel)
  • Z - A (Titel)
  • Zufällig

Früher gab es eine Erweiterung news_sorted. Aus meiner Sicht eine hilfreiche Funktion die in den Core integriert werden sollte.

Newsletter::send does not work with MySQL 5.7.5+

As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY which means when you are grouping rows and then selecting something out of that groups, you need to explicitly say which row should that selection be made from.

https://stackoverflow.com/a/38551525/374996

In Contao, the following error will occur with MySQL 5.7.5+

Fatal error: Uncaught exception Exception with message Query error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database_name.r.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SELECT *, r.email FROM tl_newsletter_recipients r LEFT JOIN tl_member m ON(r.email=m.email) WHERE r.pid='1' AND r.active=1 GROUP BY r.email ORDER BY r.email LIMIT 0,10) thrown in system/modules/core/library/Contao/Database/Statement.php on line 295

#0 system/modules/core/library/Contao/Database/Statement.php(264): Contao\Database\Statement->query()
#1 system/modules/newsletter/classes/Newsletter.php(149): Contao\Database\Statement->execute('1')
#2 system/modules/core/classes/Backend.php(430): Contao\Newsletter->send(Object(Contao\DC_Table))
#3 system/modules/core/controllers/BackendMain.php(131): Contao\Backend->getBackendModule('newsletter')
#4 contao/main.php(20): Contao\BackendMain->run()
#5 {main}

See also terminal42/contao-leads#49

Make image link to news by default

Everytime we're working on a new Contao site one of the things we have to do is to adjust the listing templates to make the image link to the article.

Is there any particular reason or has this been discussed before why the image should not link to the article by default?

From an endusers perspective it's mostly expected that clicking the image would take you to the complete article.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.