[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_generic -
get_permalink.py:1.1.2.1 main_template.pt:1.15.2.1
permalink.py:1.1.2.2 zpt_stylesheet.css:1.11.6.1
Grégoire Weber
zope.org at incept.ch
Mon Oct 4 03:56:16 EDT 2004
Update of /cvs-repository/Products/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv12999/skins/zpt_generic
Modified Files:
Tag: CMF-1_5-branch
main_template.pt permalink.py zpt_stylesheet.css
Added Files:
Tag: CMF-1_5-branch
get_permalink.py
Log Message:
- made showing permalinks configurable (by setting 'enable_permalinks' in the cmf roots property sheet
- removed the everything catching 'tal:on-error' directive from main template. The main template now asks the 'get_permalink' script for the permanent link. 'get_permalink' decides if it has to return a permalink or not
- it's now possible to ask the permalink resolver if it is turned on
- 'get_permalink' called on the object returns the permanent link (if turned on)
=== Added File Products/CMFDefault/skins/zpt_generic/get_permalink.py ===
## Script (Python) "get_permalink"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Returns the permalink url or None
##
from Products.CMFCore.utils import getToolByName
# calculate the permalink if the uid handler tool exists, permalinks
# are configured to be shown and the object is not folderish
uidtool = getToolByName(context, 'portal_uidhandler', None)
if uidtool is not None:
proptool = getToolByName(context, 'portal_properties', None)
showPermalink = getattr(proptool, 'enable_permalink', None)
isFolderish = getattr(context.aq_explicit, 'isPrincipiaFolderish', None)
if showPermalink and not isFolderish:
# returns the uid (generates one if necessary)
urltool = getToolByName(context, 'portal_url')
uid = uidtool.register(context)
url = "%s/permalink/%s" % (urltool(), uid)
return url
=== Products/CMFDefault/skins/zpt_generic/main_template.pt 1.15 => 1.15.2.1 ===
--- Products/CMFDefault/skins/zpt_generic/main_template.pt:1.15 Sun Aug 8 20:24:48 2004
+++ Products/CMFDefault/skins/zpt_generic/main_template.pt Mon Oct 4 03:56:16 2004
@@ -4,7 +4,6 @@
mtool here/portal_membership;
atool here/portal_actions;
wtool here/portal_workflow;
- uidtool here/portal_uidhandler | nothing;
portal_object utool/getPortalObject;
portal_title portal_object/Title;
object_title here/Title;
@@ -300,16 +299,15 @@
<!-- end main slot -->
</div>
-
- <div tal:condition="not:here/isPrincipiaFolderish | nothing">
- <p tal:define="uid python:uidtool.register(here);"
- tal:on-error="nothing">Permalink:
- <a href=""
- tal:define="url string:${portal_url}/permalink/${uid};"
- tal:content="url"
- tal:attributes="href url">
- the unique id</a>
- </p>
+
+ <div id="Permalink"
+ tal:define="url here/get_permalink | nothing"
+ tal:condition="url">
+ <span i18n:translate="" tal:omit-tag="">Permanent Link:</span>
+ <a href="" tal:content="url" tal:attributes="href url">
+ the permanent link if enabled
+ </a>
+ </div>
<!-- end Desktop -->
</div>
=== Products/CMFDefault/skins/zpt_generic/permalink.py 1.1.2.1 => 1.1.2.2 ===
--- Products/CMFDefault/skins/zpt_generic/permalink.py:1.1.2.1 Wed Sep 8 03:41:38 2004
+++ Products/CMFDefault/skins/zpt_generic/permalink.py Mon Oct 4 03:56:16 2004
@@ -9,8 +9,20 @@
##
from Products.CMFCore.utils import getToolByName
-uid_handler = getToolByName(context, 'portal_uidhandler')
-obj = uid_handler.getObject(traverse_subpath[0])
+subpath = traverse_subpath[0]
+uid_handler = getToolByName(context, 'portal_uidhandler', None)
+
+# appending 'isAvailable' instead of a unique id returns if
+# the site permalink feature is available.
+if str(subpath).strip() == 'isAvailable':
+ # no permalink feature without an uid handler tool being installed
+ if uid_handler is None:
+ return '0'
+ proptool = getToolByName(context, 'portal_properties', None)
+ isAvailable = getattr(proptool, 'enable_permalink', 0)
+ return str(int(isAvailable))
+
+obj = uid_handler.getObject(subpath)
ti = obj.getTypeInfo()
method_id = ti and ti.queryMethodID('view')
=== Products/CMFDefault/skins/zpt_generic/zpt_stylesheet.css 1.11 => 1.11.6.1 ===
--- Products/CMFDefault/skins/zpt_generic/zpt_stylesheet.css:1.11 Fri Jun 4 06:10:41 2004
+++ Products/CMFDefault/skins/zpt_generic/zpt_stylesheet.css Mon Oct 4 03:56:16 2004
@@ -207,7 +207,12 @@
margin-right: 2pt;
}
+#Permalink {
+ font-size: 80%;
+}
+
#ContentByline {
+ margin-top: 8pt;
font-size: 90%;
font-style: italic;
}
More information about the CMF-checkins
mailing list