Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Quentin CHEVILLON
opacce
Commits
861af7c0
Commit
861af7c0
authored
Aug 11, 2021
by
efalcy
Committed by
Sebastien ANDRE
Aug 12, 2021
Browse files
hotline#135950 : add cookies consent on article summary
parent
64173db2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
58 additions
and
21 deletions
+58
-21
VERSIONS_HOTLINE/135950
VERSIONS_HOTLINE/135950
+1
-0
application/modules/admin/views/scripts/cms/viewcms.phtml
application/modules/admin/views/scripts/cms/viewcms.phtml
+2
-2
library/Class/Article.php
library/Class/Article.php
+10
-0
library/Class/ICal/Event.php
library/Class/ICal/Event.php
+1
-1
library/ZendAfi/View/Helper/Article/RenderAbstract.php
library/ZendAfi/View/Helper/Article/RenderAbstract.php
+3
-4
library/ZendAfi/View/Helper/Article/RenderFullContent.php
library/ZendAfi/View/Helper/Article/RenderFullContent.php
+2
-2
library/ZendAfi/View/Helper/Article/RenderWall.php
library/ZendAfi/View/Helper/Article/RenderWall.php
+2
-2
library/templates/Intonation/Library/View/Wrapper/Article.php
...ary/templates/Intonation/Library/View/Wrapper/Article.php
+1
-1
library/templates/Intonation/Library/Widget/Free/View.php
library/templates/Intonation/Library/Widget/Free/View.php
+2
-2
library/templates/Intonation/View/RenderArticle.php
library/templates/Intonation/View/RenderArticle.php
+2
-2
tests/library/Class/ArticleTest.php
tests/library/Class/ArticleTest.php
+23
-3
tests/scenarios/Templates/TemplatesFreeTest.php
tests/scenarios/Templates/TemplatesFreeTest.php
+9
-2
No files found.
VERSIONS_HOTLINE/135950
0 → 100644
View file @
861af7c0
- ticket #135950 : Cookies : Prise en charge des contenus d'articles
\ No newline at end of file
application/modules/admin/views/scripts/cms/viewcms.phtml
View file @
861af7c0
...
...
@@ -8,11 +8,11 @@ echo '<h1>'.($this->article->titre).'</h1>';
if
(
$this
->
article
->
hasSummary
())
{
echo
"<h2>Résumé</h2>"
;
echo
$this
->
article
->
description
;
echo
$this
->
article
->
getSummaryWithCookiesConsent
()
;
echo
"<h2>Article</h2>"
;
}
echo
$this
->
article
->
getFullContent
();
echo
$this
->
article
->
getFullContent
WithCookiesConsent
();
$url
=
'url='
.
BASE_URL
.
'/admin/cms?z='
.
$this
->
sess_id_zone
.
'&b='
.
$this
->
sess_id_site
;
...
...
library/Class/Article.php
View file @
861af7c0
...
...
@@ -1101,6 +1101,16 @@ class Class_Article extends Storm_Model_Abstract {
}
public
function
getFullContentWithCookiesConsent
()
{
return
Class_AdminVar_Cookies
::
manager
()
->
replace
(
$this
->
getFullContent
());
}
public
function
getSummaryWithCookiesConsent
()
{
return
Class_AdminVar_Cookies
::
manager
()
->
replace
(
$this
->
getSummary
());
}
/**
* @return string
*/
...
...
library/Class/ICal/Event.php
View file @
861af7c0
...
...
@@ -58,7 +58,7 @@ class Class_ICal_Event extends \Eluceo\iCal\Component\Event {
ENT_QUOTES
|
ENT_XHTML
,
'UTF-8'
);
$event
->
setDescription
(
$text_description
);
$event
->
setDescriptionHTML
(
$article
->
getFullContent
());
$event
->
setDescriptionHTML
(
$article
->
getFullContent
WithCookiesConsent
());
if
(
$image
=
$article
->
getFirstImageAbsoluteURL
())
$event
->
setImage
(
$image
);
...
...
library/ZendAfi/View/Helper/Article/RenderAbstract.php
View file @
861af7c0
...
...
@@ -95,14 +95,13 @@ abstract class ZendAfi_View_Helper_Article_RenderAbstract
public
function
renderContent
(
$article
)
{
$content
=
(
$article
->
hasSummary
())
?
$this
->
renderSummary
(
$article
)
:
$article
->
getFullContent
();
:
$article
->
getFullContent
WithCookiesConsent
();
return
$this
->
view
->
article_ReplaceWidgets
(
$content
);
}
public
function
renderSummary
(
$article
)
{
return
$article
->
getSummary
()
.
$this
->
renderReadFullArticle
(
$article
);
return
$article
->
getSummary
WithCookiesConsent
()
.
$this
->
renderReadFullArticle
(
$article
);
}
...
...
@@ -141,4 +140,4 @@ abstract class ZendAfi_View_Helper_Article_RenderAbstract
public
function
renderArticleInfo
(
$article
)
{
return
$this
->
view
->
tagArticleInfo
(
$article
);
}
}
\ No newline at end of file
}
library/ZendAfi/View/Helper/Article/RenderFullContent.php
View file @
861af7c0
...
...
@@ -30,7 +30,7 @@ class ZendAfi_View_Helper_Article_RenderFullContent extends ZendAfi_View_Helper_
public
function
renderContent
(
$article
)
{
$content
=
Class_AdminVar_Cookies
::
manager
()
->
replace
(
$article
->
getFullContent
(
)
);
$content
=
$article
->
getFullContent
WithCookiesConsent
();
return
$this
->
view
->
article_ReplaceWidgets
(
$content
);
}
...
...
@@ -55,4 +55,4 @@ class ZendAfi_View_Helper_Article_RenderFullContent extends ZendAfi_View_Helper_
->
setStrategy
(
'Article_List'
)),
[
'class'
=>
'print'
]);
}
}
\ No newline at end of file
}
library/ZendAfi/View/Helper/Article/RenderWall.php
View file @
861af7c0
...
...
@@ -44,7 +44,7 @@ class ZendAfi_View_Helper_Article_RenderWall extends ZendAfi_View_Helper_Article
public
function
renderSummary
(
$article
)
{
return
$article
->
getSummary
();
return
$article
->
getSummary
WithCookiesConsent
();
}
...
...
@@ -52,4 +52,4 @@ class ZendAfi_View_Helper_Article_RenderWall extends ZendAfi_View_Helper_Article
return
''
;
}
}
?>
\ No newline at end of file
?>
library/templates/Intonation/Library/View/Wrapper/Article.php
View file @
861af7c0
...
...
@@ -85,7 +85,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
public
function
getFullDescription
()
{
return
$this
->
getBadges
()
.
$this
->
_view
->
tagArticleEvent
(
$this
->
_model
)
.
$this
->
_model
->
getSummary
();
.
$this
->
_model
->
getSummary
WithCookiesConsent
();
}
...
...
library/templates/Intonation/Library/Widget/Free/View.php
View file @
861af7c0
...
...
@@ -40,7 +40,7 @@ class Intonation_Library_Widget_Free_View extends Zendafi_View_Helper_Accueil_Ba
$edit_link
=
$this
->
view
->
div
([
'class'
=>
'position_absolute'
],
$edit_link
);
$content
=
Class_AdminVar_Cookies
::
manager
()
->
replace
(
$this
->
_article
->
getFullContent
(
)
);
$content
=
$this
->
_article
->
getFullContent
WithCookiesConsent
();
return
$this
->
view
->
article_ReplaceWidgets
(
$content
)
.
$edit_link
;
}
...
...
@@ -70,4 +70,4 @@ class Intonation_Library_Widget_Free_View extends Zendafi_View_Helper_Accueil_Ba
[
$this
->
_article
]);
}];
}
}
\ No newline at end of file
}
library/templates/Intonation/View/RenderArticle.php
View file @
861af7c0
...
...
@@ -34,7 +34,7 @@ class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper {
$this
->
view
->
cardify
(
$osm_wrapper
));
$location_content
=
$this
->
view
->
grid
(
$grid_content
);
$full_content
=
Class_AdminVar_Cookies
::
manager
()
->
replace
(
$article
->
getFullContent
(
)
);
$full_content
=
$article
->
getFullContent
WithCookiesConsent
();
$body_content
=
[
$article
->
getCacherTitre
()
?
''
...
...
@@ -71,4 +71,4 @@ class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper {
$this
->
_div
([
'class'
=>
'article_location_static_map'
],
$this
->
view
->
mapForLieu
(
$location
,
[
'size'
=>
''
]))];
}
}
\ No newline at end of file
}
tests/library/Class/ArticleTest.php
View file @
861af7c0
...
...
@@ -388,7 +388,7 @@ class ArticleTestSmallArticle extends ModelTestCase {
/** @test */
public
function
fullContentShouldBeContenu
()
{
$this
->
assertEquals
(
$this
->
_article
->
getContenu
(),
$this
->
_article
->
getFullContent
());
$this
->
_article
->
getFullContent
WithCookiesConsent
());
}
/** @test */
...
...
@@ -454,7 +454,7 @@ class ArticleTestSummaryAndFullContentForArticleWithDescription extends ModelTes
$this
->
_article
=
$this
->
fixture
(
'Class_Article'
,
[
'id'
=>
3
,
'titre'
=>
'Fête de la pomme'
,
'description'
=>
'à Boussy'
,
'description'
=>
'à Boussy
<iframe src="http://mylinkonotherwebsite"></iframe>
'
,
'contenu'
=>
'venez nombreux!'
,
'debut'
=>
'2010-10-02T00:00:00+02:00'
,
'fin'
=>
'2010-10-03T00:00:00+02:00'
,
...
...
@@ -465,10 +465,30 @@ class ArticleTestSummaryAndFullContentForArticleWithDescription extends ModelTes
/** @test */
public
function
summaryShouldBeDescription
()
{
$this
->
assertEquals
(
'à Boussy'
,
$this
->
assertEquals
(
'à Boussy
<iframe src="http://mylinkonotherwebsite"></iframe>
'
,
$this
->
_article
->
getSummary
());
}
/** @test */
public
function
withCookiesActivatedShouldTransformIframeOnSummary
()
{
Class_Adminvar_Cookies
::
setManager
(
new
Class_Cookies_TarteAuCitron
());
$this
->
assertContains
(
'à Boussy<div class="tac_iframe" data-url="http://mylinkonotherwebsite" ></div><script>'
,
$this
->
_article
->
getSummaryWithCookiesConsent
());
}
/** @test */
public
function
withCookiesActivatedShouldTransformIframeOnDivOnContent
()
{
$this
->
_article
->
setContenu
(
'<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/4Op2W-V9BrQ" title="YouTube video player" width="560"></iframe>'
);
Class_Adminvar_Cookies
::
setManager
(
new
Class_Cookies_TarteAuCitron
());
$this
->
assertContains
(
'<div class="tac_iframe" data-url="https://www.youtube.com/embed/4Op2W-V9BrQ" height="315" width="560"></div><script>'
,
$this
->
_article
->
getFullContentWithCookiesConsent
());
}
/** @test */
public
function
fullContentShouldBeContenu
()
{
$this
->
assertEquals
(
'venez nombreux!'
,
...
...
tests/scenarios/Templates/TemplatesFreeTest.php
View file @
861af7c0
...
...
@@ -34,7 +34,7 @@ abstract class TemplatesFreeWidgetTestCase extends Admin_AbstractControllerTestC
$this
->
fixture
(
Class_Article
::
class
,
[
'id'
=>
5
,
'titre'
=>
'I have a dream'
,
'contenu'
=>
'all Bokeh should be free (of bugs ...)'
,
'contenu'
=>
'all Bokeh should be free (of bugs ...)
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/4Op2W-V9BrQ" title="YouTube video player" width="560"></iframe>
'
,
'categorie'
=>
$this
->
fixture
(
Class_ArticleCategorie
::
class
,
[
'id'
=>
3
,
'libelle'
=>
'Sofware'
])]);
...
...
@@ -63,9 +63,10 @@ abstract class TemplatesFreeWidgetTestCase extends Admin_AbstractControllerTestC
class
TemplatesFreeWidgetIndexTest
extends
TemplatesFreeWidgetTestCase
{
class
TemplatesFreeWidgetIndex
WithCookies
Test
extends
TemplatesFreeWidgetTestCase
{
public
function
setUp
()
{
parent
::
setUp
();
Class_Adminvar_Cookies
::
setManager
(
new
Class_Cookies_TarteAuCitron
());
$this
->
dispatch
(
'/opac/index/index/id_profil/1'
);
}
...
...
@@ -91,6 +92,12 @@ class TemplatesFreeWidgetIndexTest extends TemplatesFreeWidgetTestCase {
}
/** @test */
public
function
widgetOneShouldContentWithDivInsteadOfFrame
()
{
$this
->
assertXPath
(
'//div[text()="all Bokeh should be free (of bugs ...)"]//div[@class="tac_iframe"][@height="315"][@width="560"]'
);
}
/** @test */
public
function
widgetThreeTitleShouldBeBoiteSeule
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment