diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f2412175880..fdfbdf1f1dd 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +31,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/rssparser.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; // Load translation files required by the page $langs->load("admin"); @@ -222,10 +224,14 @@ print '
'; print ''; print ''; print ''; -print '


'; +print ''; print ''; +print '
'.$langs->trans('RssNote'); +print '
'.$langs->trans('JumpToBoxes').''; + +print '

'; $sql = "SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def"; $sql .= " WHERE file = 'box_external_rss.php'"; @@ -235,8 +241,9 @@ dol_syslog("select rss boxes", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $boxlist = InfoBox::listBoxes($db, 'activated', -1, null); + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { @@ -312,6 +319,13 @@ if ($resql) print ""; } + // Active + $active = _isInBoxList($idrss, $boxlist) ? 'yes' : 'no'; + print ''; + print ''.$langs->trans('WidgetEnabled').''; + print ''.yesno($active).''; + print ""; + print ''; print ""; @@ -327,3 +341,23 @@ else // End of page llxFooter(); $db->close(); + +/** + * Check if the given RSS feed if inside the list of boxes/widgets + * + * @param int $idrss The id of the RSS feed + * @param array $boxlist A list with boxes/widgets + * @return bool true if the rss feed is inside the box/widget list, otherwise false + */ +function _isInBoxList($idrss, array $boxlist) +{ + foreach($boxlist as $box) + { + if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) + { + return true; + } + } + + return false; +} diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9baa074eb75..6c9bc75ae48 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1990,3 +1990,5 @@ EmailTemplate=Template for email EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF. FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book. +RssNote=Note: Each RSS feed must be separate activate as a widget to show it for a user. +JumpToBoxes=Jump to Setup -> Widgets