# HG changeset patch # User Thierry Florac # Date 1404289828 -7200 # Node ID 3d75d7c045930039b919bd5abbd40d0c6f67a2db # Parent dbed1ff1e070f2c3f515350a7e12ceb993d8e23a Added UserVoice API diff -r dbed1ff1e070 -r 3d75d7c04593 src/ztfy/myams/configuration.py --- a/src/ztfy/myams/configuration.py Wed Jul 02 10:30:01 2014 +0200 +++ b/src/ztfy/myams/configuration.py Wed Jul 02 10:30:28 2014 +0200 @@ -12,20 +12,21 @@ # import local interfaces from zope.annotation.interfaces import IAnnotations -from zope.location.location import locate from ztfy.myams.interfaces import IMyAMSApplication -from ztfy.myams.interfaces.configuration import IMyAMSStaticConfiguration, \ - IMyAMSConfigurationTarget, IMyAMSConfiguration +from ztfy.myams.interfaces.configuration import IMyAMSStaticConfiguration, IMyAMSConfigurationTarget, IMyAMSConfiguration # import Zope3 packages from zope.component import adapter, queryUtility from zope.container.contained import Contained from zope.interface import implementer, implements +from zope.location.location import locate from zope.schema.fieldproperty import FieldProperty from ztfy.extfile.blob import BlobImage, BlobFile from ztfy.file.property import FileProperty # import local packages +from ztfy.mail.adapter import getPrincipalAddress +from ztfy.utils.request import queryRequest from ztfy.utils.traversing import getParent @@ -36,6 +37,7 @@ application_package = 'ztfy.myams' application_name = u'MyAMS' + version_location = u'menus' include_top_links = True include_site_search = True include_mobile_search = True @@ -68,6 +70,7 @@ custom_css = FileProperty(IMyAMSConfiguration['custom_css'], klass=BlobFile) custom_js = FileProperty(IMyAMSConfiguration['custom_js'], klass=BlobFile) google_analytics_key = FieldProperty(IMyAMSConfiguration['google_analytics_key']) + uservoice_api_key = FieldProperty(IMyAMSConfiguration['uservoice_api_key']) @property def static_configuration(self): @@ -75,6 +78,16 @@ if application is not None: return queryUtility(IMyAMSStaticConfiguration, name=application.configuration_name) + @property + def user_email(self): + request = queryRequest() + if request is None: + return None + address = getPrincipalAddress(request.principal) + if not address: + return None + return address[0][1] + MYAMS_CONFIGURATION_KEY = 'ztfy.myams.configuration' diff -r dbed1ff1e070 -r 3d75d7c04593 src/ztfy/myams/interfaces/configuration.py --- a/src/ztfy/myams/interfaces/configuration.py Wed Jul 02 10:30:01 2014 +0200 +++ b/src/ztfy/myams/interfaces/configuration.py Wed Jul 02 10:30:28 2014 +0200 @@ -12,7 +12,7 @@ # import Zope3 packages from zope.interface import Interface, Attribute -from zope.schema import TextLine, Bool +from zope.schema import TextLine, Bool, Choice # import local packages from ztfy.file.schema import ImageField, FileField @@ -33,6 +33,11 @@ version = Attribute(_("Application version")) + version_location = Choice(title=_("Version location"), + required=False, + values=(u'menus', u'shortcuts'), + default=u'menus') + include_top_links = Bool(title=_("Include top links?"), default=True, required=True) @@ -117,8 +122,14 @@ google_analytics_key = TextLine(title=_("Google Analytics key"), required=False) + uservoice_api_key = TextLine(title=_("UserVoice API key"), + description=_("This is the name of UserVoice javascript file"), + required=False) + static_configuration = Attribute(_("Application static configuration utility")) + user_email = Attribute(_("Current user email address")) + class IMyAMSConfigurationTarget(Interface): """MyAMS configuration marker interface""" diff -r dbed1ff1e070 -r 3d75d7c04593 src/ztfy/myams/templates/layout.pt --- a/src/ztfy/myams/templates/layout.pt Wed Jul 02 10:30:01 2014 +0200 +++ b/src/ztfy/myams/templates/layout.pt Wed Jul 02 10:30:28 2014 +0200 @@ -90,7 +90,12 @@ FLORAC Thierry -
+
+ +
+ - version +
+
@@ -125,7 +130,7 @@ -
+
- version
@@ -179,5 +184,40 @@ ''' % {'key': config.google_analytics_key}"> + + + + + + +