Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plone5 #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ IMPORTANT! For Plone 3.0.x you should use plone.browserlayer 1.0.rc3. Be sure to
Notes
-----

* For Plone 5 versions - use Plone SEO 5.0 release and up https://pypi.python.org/pypi/quintagroup.seoptimizer/5.0. In your buildout.cfg file's egg section set product version::

[buildout]
....
eggs =
...
quintagroup.seoptimizer >=5.0

* For Plone 4 versions - use Plone SEO 4.0 release and up https://pypi.python.org/pypi/quintagroup.seoptimizer/4.0. In your buildout.cfg file's egg section set product version::

[buildout]
Expand Down
10 changes: 7 additions & 3 deletions quintagroup/seoptimizer/adapters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from zope.interface import implements
from zope.component import queryAdapter
from zope.component import queryMultiAdapter
from zope.component import getUtility
from plone.registry.interfaces import IRegistry

from quintagroup.seoptimizer.util import SortedDict
from quintagroup.seoptimizer.interfaces import IMetaKeywords, IMappingMetaTags
Expand Down Expand Up @@ -47,14 +49,16 @@ class MappingMetaTags(object):

def __init__(self, context):
self.context = context
pps = queryMultiAdapter((self.context, self.context.REQUEST),
name="plone_portal_state")
self.gseo = queryAdapter(pps.portal(), ISEOConfigletSchema)
# pps = queryMultiAdapter((self.context, self.context.REQUEST),
# name="plone_portal_state")
# self.gseo = queryAdapter(pps.portal(), ISEOConfigletSchema)
self.gseo = getUtility(IRegistry).forInterface(ISEOConfigletSchema)

def getMappingMetaTags(self):
""" See interface.
"""
metadata_name = SortedDict()

if self.gseo:
for mt in self.gseo.metatags_order:
if mt in METADATA_MAPS:
Expand Down
11 changes: 9 additions & 2 deletions quintagroup/seoptimizer/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
own, .interfaces.IPloneSEOLayer layer -->

<!-- Registries for configlet -->
<adapter factory=".seo_configlet.SEOConfigletAdapter" />
<!-- old <adapter factory=".seo_configlet.SEOConfigletAdapter" />

<browser:page
name="seo-controlpanel"
Expand All @@ -43,7 +43,14 @@
layer=".interfaces.IPloneSEOLayer"
permission="cmf.ManagePortal"
/>

-->
<!-- Control panel form -->
<browser:page
name="seo-controlpanel"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
class=".seo_configlet.SEOConfigletControlPanel"
permission="cmf.ManagePortal"
/>
<!-- The customized title -->
<browser:viewlet
name="plone.htmlhead.title"
Expand Down
34 changes: 34 additions & 0 deletions quintagroup/seoptimizer/browser/controlpanel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from plone.app.registry.browser import controlpanel

from collective.gtags.interfaces import ITagSettings
from collective.gtags import MessageFactory as _

try:
# only in z3c.form 2.0
from z3c.form.browser.textlines import TextLinesFieldWidget
except ImportError:
from plone.z3cform.textlines import TextLinesFieldWidget

class TagSettingsEditForm(controlpanel.RegistryEditForm):

schema = ITagSettings
label = _(u"Tagging settings")
description = _(u"Please enter details of available tags")

def updateFields(self):
super(TagSettingsEditForm, self).updateFields()
self.fields['tags'].widgetFactory = TextLinesFieldWidget
self.fields['unique_categories'].widgetFactory = TextLinesFieldWidget
self.fields['required_categories'].widgetFactory = TextLinesFieldWidget

def updateWidgets(self):
super(TagSettingsEditForm, self).updateWidgets()
self.widgets['tags'].rows = 8
self.widgets['tags'].style = u'width: 30%;'
self.widgets['unique_categories'].rows = 8
self.widgets['unique_categories'].style = u'width: 30%;'
self.widgets['required_categories'].rows = 8
self.widgets['required_categories'].style = u'width: 30%;'

class TagSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
form = TagSettingsEditForm
1 change: 1 addition & 0 deletions quintagroup/seoptimizer/browser/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ def validateKeywords():
""" 1. Get *text* parameter from request
2. Parse *text* and validate each extracted keyword
for appearing on the context page """

Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,4 @@ customMetaTagsFunctions.getParentElementById = function(currnode, id) {
}

return parent;
}
};
Loading