-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
315 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
14 changes: 14 additions & 0 deletions
14
src/imio/smartweb/core/contents/sections/external_content/configure.zcml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:browser="http://namespaces.zope.org/browser"> | ||
|
||
<browser:page | ||
name="view" | ||
for="imio.smartweb.core.contents.ISectionExternalContent" | ||
class="imio.smartweb.core.contents.sections.external_content.views.ExternalContentView" | ||
template="view.pt" | ||
permission="zope2.View" | ||
layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer" | ||
/> | ||
|
||
</configure> |
32 changes: 32 additions & 0 deletions
32
src/imio/smartweb/core/contents/sections/external_content/content.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from imio.smartweb.common.config import DESCRIPTION_MAX_LENGTH | ||
from imio.smartweb.core.contents.sections.base import ISection | ||
from imio.smartweb.core.contents.sections.base import Section | ||
from imio.smartweb.locales import SmartwebMessageFactory as _ | ||
from zope.interface import implementer | ||
from zope import schema | ||
|
||
|
||
class ISectionExternalContent(ISection): | ||
"""Marker interface and Dexterity Python Schema for SectionVideo""" | ||
|
||
description = schema.Text( | ||
title=_("Description"), | ||
description=_( | ||
"Use **text** to set text in bold. Limited to ${max} characters.", | ||
mapping={"max": DESCRIPTION_MAX_LENGTH}, | ||
), | ||
max_length=DESCRIPTION_MAX_LENGTH, | ||
required=False, | ||
) | ||
|
||
external_content_url = schema.URI( | ||
title=_("External content url"), | ||
required=True, | ||
) | ||
|
||
|
||
@implementer(ISectionExternalContent) | ||
class SectionExternalContent(Section): | ||
"""SectionVideo class""" |
31 changes: 31 additions & 0 deletions
31
src/imio/smartweb/core/contents/sections/external_content/view.pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" | ||
xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
lang="en" | ||
metal:use-macro="context/@@main_template/macros/master" | ||
i18n:domain="plone"> | ||
<body> | ||
|
||
<metal:main fill-slot="content-core"> | ||
<metal:content-core define-macro="content-core"> | ||
<metal:macro use-macro="context/@@sections_macros/section_edition" /> | ||
<div class="container section-container section-video" | ||
id="" | ||
tal:attributes="id string:container-section-${context/id}"> | ||
|
||
<metal:macro use-macro="context/@@sections_macros/section_title" /> | ||
|
||
<p tal:replace="structure context/@@description" /> | ||
|
||
<div tal:define="collapse_klass python: 'collapse' if context.collapsible_section else ''" | ||
tal:attributes="class string:body-section ratio ratio-16x9 ${collapse_klass}; | ||
id string:body-section-${context/id}" | ||
tal:content="structure view/get_embed_external_content" /> | ||
|
||
</div> | ||
</metal:content-core> | ||
</metal:main> | ||
|
||
</body> | ||
</html> |
31 changes: 31 additions & 0 deletions
31
src/imio/smartweb/core/contents/sections/external_content/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from embeddify import Embedder | ||
from embeddify import Plugin | ||
from imio.smartweb.core.contents.sections.views import SectionView | ||
from imio.smartweb.locales import SmartwebMessageFactory as _ | ||
|
||
|
||
class ExternalContentView(SectionView): | ||
def get_embed_external_content(self, width="100%", height=600): | ||
plugins = [EaglebePlugin(), UnknowServicePlugin()] | ||
plugin_config = { | ||
"eaglebeplugin": {"width": width}, | ||
"unknowserviceplugin": {"width": width}, | ||
} | ||
embedder = Embedder(plugins=plugins, plugin_config=plugin_config) | ||
url = self.context.external_content_url | ||
return embedder(url, config={"width": width}) | ||
|
||
|
||
class EaglebePlugin(Plugin): | ||
def __call__(self, parts, config={}): | ||
if "app.eaglebe.com" in parts.netloc: | ||
return f'<iframe class="eaglebe" src="{parts.geturl()}" scrolling="no" width="{config["width"]}">' | ||
# | ||
return None | ||
|
||
|
||
class UnknowServicePlugin(Plugin): | ||
def __call__(self, parts, config={}): | ||
return _("<p class='unknow_service'>Unknow service</p>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/imio/smartweb/core/profiles/default/types/imio.smartweb.SectionExternalContent.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
name="imio.smartweb.SectionExternalContent" | ||
meta_type="Dexterity FTI" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<!-- Basic properties --> | ||
<property | ||
i18n:translate="" | ||
name="title">External content section</property> | ||
<property | ||
i18n:translate="" | ||
name="description">External content section for a page</property> | ||
|
||
<property name="icon_expr">string:window-plus</property> | ||
|
||
<!-- Hierarchy control --> | ||
<property name="global_allow">False</property> | ||
<property name="filter_content_types">True</property> | ||
|
||
<!-- Schema, class and security --> | ||
<!-- if we can add a page, we can add a page section --> | ||
<property name="add_permission">imio.smartweb.core.CanManageSectionExternalContent</property> | ||
<property name="klass">imio.smartweb.core.contents.SectionExternalContent</property> | ||
<property name="schema">imio.smartweb.core.contents.ISectionExternalContent</property> | ||
|
||
<!-- Enabled behaviors --> | ||
<property name="behaviors" purge="false"> | ||
<element value="plone.namefromtitle"/> | ||
<element value="plone.locking"/> | ||
<element value="plone.shortname"/> | ||
<element value="plone.imagecropping"/> | ||
<element value="imio.smartweb.topics"/> | ||
</property> | ||
|
||
</object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/imio/smartweb/core/upgrades/profiles/1037_to_1038/rolemap.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<rolemap> | ||
|
||
<permissions> | ||
<permission name="imio.smartweb.core: Can add section External Content" acquire="True"> | ||
<role name="Manager"/> | ||
<role name="Site Administrator"/> | ||
<role name="Local Manager" /> | ||
</permission> | ||
</permissions> | ||
|
||
</rolemap> |
4 changes: 4 additions & 0 deletions
4
src/imio/smartweb/core/upgrades/profiles/1037_to_1038/types.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<object name="portal_types" meta_type="Plone Types Tool"> | ||
<object meta_type="Dexterity FTI" name="imio.smartweb.SectionExternalContent"/> | ||
</object> |
11 changes: 11 additions & 0 deletions
11
src/imio/smartweb/core/upgrades/profiles/1037_to_1038/types/imio.smartweb.Page.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
name="imio.smartweb.Page" | ||
meta_type="Dexterity FTI" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<property name="allowed_content_types" purge="false"> | ||
<element value="imio.smartweb.SectionExternalContent" /> | ||
</property> | ||
|
||
</object> |
11 changes: 11 additions & 0 deletions
11
src/imio/smartweb/core/upgrades/profiles/1037_to_1038/types/imio.smartweb.PortalPage.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
name="imio.smartweb.PortalPage" | ||
meta_type="Dexterity FTI" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<property name="allowed_content_types" purge="false"> | ||
<element value="imio.smartweb.SectionExternalContent" /> | ||
</property> | ||
|
||
</object> |
11 changes: 11 additions & 0 deletions
11
src/imio/smartweb/core/upgrades/profiles/1037_to_1038/types/imio.smartweb.Procedure.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
name="imio.smartweb.Procedure" | ||
meta_type="Dexterity FTI" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<property name="allowed_content_types" purge="false"> | ||
<element value="imio.smartweb.SectionExternalContent" /> | ||
</property> | ||
|
||
</object> |
Oops, something went wrong.