Commit e1383284 authored by efalcy's avatar efalcy
Browse files

dev #56107 : unshow admin buttons when kiosk is displayed inside article

parent eaaf6f43
......@@ -112,10 +112,13 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
//---------------------------------------------------------------------
// Rend le html_array à mettre dans une boite
//---------------------------------------------------------------------
protected function getHtmlArray()
protected function getHtmlArray($show_admin = true)
{
$content = $show_admin ?
$this->getFonctionAdmin().$this->contenu
: $this->contenu;
return ["TITRE" => $this->titre,
"CONTENU" => $this->getFonctionAdmin().$this->contenu,
"CONTENU" => $content,
"MESSAGE" => $this->message,
"RSS" => $this->rss_interne,
"TYPE_MODULE" => strtolower($this->type_module)];
......@@ -216,13 +219,13 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
}
public function getBoite() {
public function getBoite($show_admin_buttons = true) {
if (!$this->isBoiteVisible())
return '';
$closure = function() {
$closure = function() use ($show_admin_buttons) {
$template = $this->getTemplate();
$html_array = $this->getHtml();
$html_array = $this->getHtml($show_admin_buttons);
return $this->getBoiteFromTemplate($template, $html_array);
};
......
......@@ -62,7 +62,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
}
public function getHtml() {
public function getHtml($show_admin_buttons = true) {
$this->titre = $this->getTitre();
$this->rss_interne = $this->getRss();
......@@ -71,7 +71,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
: $this->getKiosqueIFrame();
$this->contenu = $this->contenu;
return $this->getHtmlArray();
return $this->getHtmlArray($show_admin_buttons);
}
......
......@@ -23,7 +23,6 @@
class ZendAfi_View_Helper_Article_ReplaceWidgets extends ZendAfi_View_Helper_BaseHelper {
public function article_ReplaceWidgets($content) {
// '|<div[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>\w+)"[^>]*>[^<]+</div>|',
return preg_replace_callback(
'|(?P<alldiv><div[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>[^"]+)[^>]*>[^<]+</div>)|',
function ($matches) {
......@@ -41,10 +40,8 @@ class ZendAfi_View_Helper_Article_ReplaceWidgets extends ZendAfi_View_Helper_Bas
parse_str(html_entity_decode($form),$prefs);
$params=['type_module'=> $code,
'preferences' => $prefs];
xdebug_break();
$helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams(null,$params,$this->view);
return $helper->getBoite();
//Class_Systeme_ModulesAccueil::moduleByCode($code)
return $helper->getBoite(false);
}
}
?>
\ No newline at end of file
......@@ -733,7 +733,7 @@ class CmsControllerArticleViewByDateWithRadioSummarySelectedTest extends Abstrac
/** @test */
public function articleTextLaFeteDeLaBananeShouldNotContainsFullArticle() {
$this->assertNotXpathContentContains('//article', ' Une fête qui glisse !');
$this->assertNotXpathContentContains('//article', ' Une fête qui glisse !', $this->_response->getBody());
}
......@@ -916,7 +916,7 @@ class CmsControllerViewNoticeMetasTest extends CmsControllerWithFeteDeLaFriteTes
/** @test */
public function pageShouldContainImageMeta() {
$this->assertXPath('//meta[@property="og:image"][@content="' . Class_Url::siteUrl() . '/userfiles/image/foo.jpg"]');
$this->assertXPath('//meta[@property="og:image"][@content="' . Class_Url::siteUrl() . '/userfiles/image/foo.jpg"]',$this->_response->getBody());
}
}
......@@ -965,8 +965,8 @@ class CmsControllerArticleViewOnPortalTest extends CmsControllerWithFeteDeLaFrit
/** @test **/
public function articleInfoShouldContainsEventBibLinkToBibViewBonlieu() {
$this->assertNotXPath('//dl[@class="article_info"]/dd[@class="event_bib_link"]');
public function articleInfoShouldNotContainsEventBibLinkToBibViewBonlieu() {
$this->assertNotXPath('//dl[@class="article_info"]/dd[@class="event_bib_link"]',$this->_response->getBody());
}
/** @test */
......@@ -1678,6 +1678,10 @@ class CmsControllerDispatchViewSummaryTest extends AbstractControllerTestCase {
class CmsControllerWithArticleWithKioskTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
protected function _loginHook($account) {
$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL;
$account->PSEUDO = "admin";
}
public function setUp() {
parent::setUp();
......@@ -1725,4 +1729,10 @@ class CmsControllerWithArticleWithKioskTest extends AbstractControllerTestCase {
}
/** @test */
public function adminButtonShouldNotBeenShow() {
$this->assertNotXPath('//a[contains(@href,"widget/edit-widget")]',$this->_response->getBody());
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment