-
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
25 changed files
with
2,287 additions
and
2 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/pages/cirkwi/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.ICirkwiView" | ||
class=".view.CirkwiViewView" | ||
template="view.pt" | ||
permission="zope2.View" | ||
layer="imio.smartweb.core.interfaces.IImioSmartwebCoreLayer" | ||
/> | ||
|
||
</configure> |
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,25 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from imio.smartweb.common.config import DESCRIPTION_MAX_LENGTH | ||
from imio.smartweb.core.contents import IPages | ||
from imio.smartweb.core.contents import Pages | ||
from imio.smartweb.locales import SmartwebMessageFactory as _ | ||
from zope.interface import implementer | ||
from zope import schema | ||
|
||
|
||
class ICirkwiView(IPages): | ||
"""Marker interface and Dexterity Python Schema for SectionCirkwi""" | ||
|
||
cirkwi_widget_id = schema.TextLine( | ||
title=_("Cirkwi widget ID"), | ||
description=_( | ||
"Specify your cirkwi widget ID. You can find it when you create a new widget in Cirkwi." | ||
), | ||
required=True, | ||
) | ||
|
||
|
||
@implementer(ICirkwiView) | ||
class CirkwiView(Pages): | ||
"""SectionCirkwi class""" |
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,13 @@ | ||
<html | ||
metal:use-macro="context/main_template/macros/master" | ||
i18n:domain="imio.smartweb"> | ||
<body> | ||
<metal:main fill-slot="content-core"> | ||
<div class="full-width"> | ||
<div class="cirkwi_richtext" tal:content="structure context/text/output|nothing"></div> | ||
<div class="cirkwi_contents" tal:content="structure view/get_cirkwi_html" /> | ||
</div> | ||
</metal:main> | ||
|
||
</body> | ||
</html> |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from Products.Five.browser import BrowserView | ||
|
||
import requests | ||
|
||
|
||
class CirkwiViewView(BrowserView): | ||
|
||
cirwki_api_uri = "https://www.modulesbox.com/fr/api/module/" | ||
|
||
def get_cirkwi_html(self): | ||
cirkwi_widget_id = self.context.cirkwi_widget_id | ||
url = f"{self.cirwki_api_uri}{cirkwi_widget_id}" | ||
response = requests.get(url) | ||
if response.status_code != 200: | ||
return response.status_code | ||
return response.text |
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
42 changes: 42 additions & 0 deletions
42
src/imio/smartweb/core/profiles/default/types/imio.smartweb.CirkwiView.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,42 @@ | ||
<?xml version="1.0"?> | ||
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
name="imio.smartweb.DirectoryView" | ||
meta_type="Dexterity FTI" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<!-- Basic properties --> | ||
<property | ||
i18n:translate="" | ||
name="title">Cirkwi view</property> | ||
<property | ||
i18n:translate="" | ||
name="description">Display cirkwi informations and map.</property> | ||
|
||
<property name="icon_expr">string:file-person</property> | ||
|
||
<!-- Hierarchy control --> | ||
<property name="global_allow">True</property> | ||
|
||
<!-- Schema, class and security --> | ||
<property name="add_permission">imio.smartweb.core.AddCirkwiView</property> | ||
<property name="klass">imio.smartweb.core.contents.CirkwiView</property> | ||
<property name="schema">imio.smartweb.core.contents.ICirkwiView</property> | ||
|
||
<!-- Enabled behaviors --> | ||
<property name="behaviors" purge="false"> | ||
<element value="plone.namefromtitle"/> | ||
<element value="plone.excludefromnavigation"/> | ||
<element value="plone.shortname"/> | ||
<element value="plone.publication"/> | ||
<element value="plone.basic"/> | ||
<element value="plone.locking"/> | ||
<element value="plone.leadimage"/> | ||
<element value="plone.richtext"/> | ||
<element value="imio.smartweb.listing"/> | ||
<element value="imio.smartweb.topics"/> | ||
<element value="imio.smartweb.iam"/> | ||
<element value="plone.categorization"/> | ||
<element value="collective.autopublishing.behavior.IAutoPublishing"/> | ||
</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
6 changes: 6 additions & 0 deletions
6
src/imio/smartweb/core/tests/resources/cirkwi_bad_widget_mock.html
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,6 @@ | ||
<div id="content-core"> | ||
<div class="full-width"> | ||
<div class="cirkwi_richtext"></div> | ||
<div class="cirkwi_contents">404</div> | ||
</div> | ||
</div> |
Oops, something went wrong.