[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ Add alternate main_templates / skins / profiles using 'ursine_globals'.
Tres Seaver
tseaver at palladion.com
Mon Oct 6 23:05:23 EDT 2008
Log message for revision 91829:
Add alternate main_templates / skins / profiles using 'ursine_globals'.
Changed:
U Products.CMFDefault/trunk/Products/CMFDefault/directories.zcml
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/README.txt
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/skins.xml
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/README.txt
A Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/skins.xml
U Products.CMFDefault/trunk/Products/CMFDefault/profiles.zcml
A Products.CMFDefault/trunk/Products/CMFDefault/skins/ursine/
A Products.CMFDefault/trunk/Products/CMFDefault/skins/ursine/main_template.pt
A Products.CMFDefault/trunk/Products/CMFDefault/skins/werebear/
A Products.CMFDefault/trunk/Products/CMFDefault/skins/werebear/main_template.pt
-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/directories.zcml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/directories.zcml 2008-10-07 03:04:22 UTC (rev 91828)
+++ Products.CMFDefault/trunk/Products/CMFDefault/directories.zcml 2008-10-07 03:05:23 UTC (rev 91829)
@@ -10,4 +10,8 @@
<cmf:registerDirectory name="zpt_generic"/>
+ <cmf:registerDirectory name="ursine"/>
+
+ <cmf:registerDirectory name="werebear"/>
+
</configure>
Added: Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/README.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/README.txt (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/README.txt 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,17 @@
+'ursa' profile
+==============
+
+This profile supplies an alternate main template to the one provided
+in the 'zpt_generic' skins directory, with two optimizations:
+
+- it uses the 'ursine_globals' view to look up its globals, rather than
+ using the usual Python script implementation: that view can be (and *is*)
+ tested, tweaked, and profiled as normal Python code.
+
+- it also strips away all non-essential rendering, leaving a "pure" /
+ semantic HTML interface, which should be easier to re-theme with a
+ tool such as Deliverance.
+
+Together, these two optimizations should provide about a twenty-five to
+thirty percent speed boost (e.g., 23ms on the empty site root vs 33ms for
+the standard view; YMMV, of course).
Added: Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/skins.xml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/skins.xml (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/profiles/ursa/skins.xml 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<object name="portal_skins" meta_type="CMF Skins Tool" allow_any="False"
+ cookie_persistence="False" default_skin="Basic"
+ request_varname="portal_skin">
+ <object name="ursine" meta_type="Filesystem Directory View"
+ directory="Products.CMFDefault:skins/ursine"/>
+ <skin-path name="ursa" based-on="Basic">
+ <layer name="ursine" insert-after="custom"/>
+ </skin-path>
+</object>
Added: Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/README.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/README.txt (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/README.txt 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,13 @@
+'were' profile
+==============
+
+This profile supplies an alternate main template to the one provided
+in the 'zpt_generic' skins directory, offering the following optimization
+opportunity:
+
+- it uses the 'ursine_globals' view to look up its globals, rather than
+ the usual Python script implementation: that view can be (and *is*) tested,
+ tweaked, and profiled as normal Python code
+
+This skin should provide about a ten percent speed boost (e.g., 30ms vs.
+33-34ms for the empty site root; YMMV, of course).
Added: Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/skins.xml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/skins.xml (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/profiles/were/skins.xml 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<object name="portal_skins" meta_type="CMF Skins Tool" allow_any="False"
+ cookie_persistence="False" default_skin="Basic"
+ request_varname="portal_skin">
+ <object name="werebear" meta_type="Filesystem Directory View"
+ directory="Products.CMFDefault:skins/werebear"/>
+ <skin-path name="were" based-on="Basic">
+ <layer name="werebear" insert-after="custom"/>
+ </skin-path>
+</object>
Modified: Products.CMFDefault/trunk/Products/CMFDefault/profiles.zcml
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/profiles.zcml 2008-10-07 03:04:22 UTC (rev 91828)
+++ Products.CMFDefault/trunk/Products/CMFDefault/profiles.zcml 2008-10-07 03:05:23 UTC (rev 91829)
@@ -26,4 +26,20 @@
for="Products.CMFCore.interfaces.ISiteRoot"
/>
+ <genericsetup:registerProfile
+ name="ursa"
+ title="CMF 'Bare' skin"
+ description="Provide skin w/ stripped-down main template."
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ for="Products.CMFCore.interfaces.ISiteRoot"
+ />
+
+ <genericsetup:registerProfile
+ name="were"
+ title="CMF 'Bare' / hybrid skin"
+ description="Use stripped-down globals in regular main template."
+ provides="Products.GenericSetup.interfaces.EXTENSION"
+ for="Products.CMFCore.interfaces.ISiteRoot"
+ />
+
</configure>
Added: Products.CMFDefault/trunk/Products/CMFDefault/skins/ursine/main_template.pt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/skins/ursine/main_template.pt (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/skins/ursine/main_template.pt 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,106 @@
+<metal:macro metal:define-macro="master"
+><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<html tal:define="globals context/@@ursine_globals"
+ i18n:domain="cmf_default">
+<head>
+ <title tal:content="globals/page_title">Title goes here</title>
+ <metal:slot define-slot="base" />
+ <metal:slot define-slot="styles" />
+</head>
+
+<body>
+
+ <div id="Desktop">
+
+ <div id="Breadcrumbs">
+ <span class="breadcrumb"
+ tal:repeat="bc globals/breadcrumbs">
+ <a href="."
+ tal:attributes="href bc/url"
+ tal:content="bc/id">ID</a>
+ </span>
+ </div>
+
+ <p id="DesktopStatusBar"
+ tal:condition="globals/status_message"
+ tal:content="globals/status_message"
+ i18n:translate="">Status message.</p>
+
+ <metal:slot metal:define-slot="body">
+ <metal:slot metal:define-slot="header" />
+ <metal:slot metal:define-slot="main" />
+ </metal:slot>
+
+ </div>
+
+ <div id="object_meta">
+ <img id="object_icon"
+ src="icon" align="left" title="Type" alt="[X]" height="16" width="16"
+ tal:condition="globals/icon"
+ tal:attributes="src globals/icon;
+ alt globals/typename;
+ "
+ i18n:attributes="alt" />
+ <div id="object_id"
+ tal:content="globals/trunc_id">ID</div>
+ <div id="object_type"
+ tal:content="globals/typename">TYPENAME</div>
+ <div id="workflow_state"
+ tal:content="globals/wf_state">WORKFLOW STATE</div>
+ </div>
+
+ <ul id="object_actions_menu">
+ <li tal:repeat="action globals/object_actions">
+ <a href="#object_action"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">OBJECT ACTION_TITLE</a><br />
+ </li>
+ </ul>
+
+ <ul id="workflow_actions_menu">
+ <li tal:repeat="action globals/workflow_actions">
+ <a href="#workflow_action"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">OBJECT ACTION_TITLE</a><br />
+ </li>
+ </ul>
+
+ <ul id="folder_actions_menu">
+ <li tal:repeat="action globals/folder_actions">
+ <a href="#folder_action"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">FOLDER ACTION_TITLE</a><br />
+ </li>
+ </ul>
+
+ <ul id="add_actions_menu">
+ <li tal:repeat="action globals/add_actions">
+ <a href="#add_action"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">ADD ACTION_TITLE</a><br />
+ </li>
+ </ul>
+
+ <ul id="user_actions_menu">
+ <li tal:repeat="action globals/user_actions">
+ <a href="#user_action"
+ tal:attributes="href action/url"
+ tal:content="action/title" i18n:translate="">USER ACTION TITLE</a>
+ </li>
+ </ul>
+
+ <ul id="global_actions_menu">
+ <li tal:repeat="action globals/global_actions">
+ <a href="#global_action"
+ tal:attributes="href action/url"
+ tal:content="action/title" i18n:translate="">GLOBAL ACTION TITLE</a>
+ </li>
+ </ul>
+
+</body>
+</html>
+</metal:macro>
Added: Products.CMFDefault/trunk/Products/CMFDefault/skins/werebear/main_template.pt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/skins/werebear/main_template.pt (rev 0)
+++ Products.CMFDefault/trunk/Products/CMFDefault/skins/werebear/main_template.pt 2008-10-07 03:05:23 UTC (rev 91829)
@@ -0,0 +1,312 @@
+<metal:macro metal:define-macro="master"
+><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<html tal:define="globals context/@@ursine_globals"
+>
+
+<head>
+ <title tal:content="context/expanded_title">Title goes here</title>
+
+ <metal:slot define-slot="base" />
+
+ <link rel="stylesheet" type="text/css" href="zpt_stylesheet.css"
+ tal:attributes="href context/zpt_stylesheet.css/absolute_url" />
+ <metal:slot define-slot="style_slot" />
+</head>
+
+<body>
+
+<div metal:define-macro="top_bar">
+
+ <!-- hack around netscape 4.x to ensure table is solid -->
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+
+ <!-- Top bar -->
+ <table id="Masthead"
+ width="100%" cellpadding="0" cellspacing="0" border="0">
+
+ <tr>
+ <td id="PortalLogo">
+ <a href="." tal:attributes="href string:${globals/portal_url}/"
+ ><img src="Zope_logo.gif" alt="Zope Logo"
+ border="0" width="87" height="38"
+ tal:attributes="src string:${globals/portal_url}/Zope_logo.gif" /></a>
+ </td>
+
+ <td id="PortalTitle">
+ <span tal:content="string:${globals/portal_title}">Site Title</span>
+ </td>
+
+ <td id="NavBar" i18n:domain="cmf_default">
+ <form action="search" method="get"
+ tal:attributes="action string:${globals/portal_url}/search">
+ <a href="."
+ tal:attributes="href string:${globals/portal_url}/"
+ i18n:translate="">home</a>
+ <span tal:condition="globals/membersfolder" tal:omit-tag="">
+ <a href="roster"
+ tal:attributes="href python: globals.membersfolder.absolute_url()"
+ tal:content="python: globals.membersfolder.getId().lower()"
+ i18n:translate="">members</a>
+ </span>
+ <a href="recent_news"
+ tal:attributes="href string:${globals/portal_url}/recent_news"
+ i18n:translate="">news</a>
+ <a href="search_form"
+ tal:attributes="href string:${globals/portal_url}/search_form"
+ i18n:translate="">search</a>
+
+ <input name="SearchableText" size="16" />
+ <input type="image" name="go" value="go" src="go.gif"
+ align="middle"
+ tal:attributes="src string:${globals/portal_url}/go.gif" />
+ </form>
+ </td>
+ </tr>
+
+ </table>
+ <!-- end topbar -->
+
+ </td>
+ </tr>
+ </table>
+ <!-- end NS4 hack -->
+
+<!-- end top_bar-->
+</div>
+
+<div metal:define-macro="user_menu_bar"
+ tal:define="uname globals/membername" >
+
+ <!-- hack around netscape 4.x to ensure table is solid -->
+ <table width="100%" border="0" cellpadding="0" cellspacing="0"
+ i18n:domain="cmf_default">
+ <tr>
+ <td>
+
+ <!-- user_menu_bar -->
+ <table id="MemberActionsBox"
+ width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="ActionTitle" tal:content="uname">Guest</td>
+ <td class="ActionLink" align="right">
+ <tal:span tal:repeat="action globals/user_actions"
+ ><img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href="" tal:attributes="href action/url"
+ tal:content="action/title" i18n:translate="">Login</a
+ ><tal:span tal:condition="not: repeat/action/end"> |</tal:span></tal:span>
+ <tal:span tal:condition="nothing"
+ ><a href="">Join</a></tal:span> </td>
+ </tr>
+ </table>
+ <!-- end user_menu_bar -->
+
+ </td>
+ </tr>
+ </table>
+ <!-- end NS4 hack -->
+
+<!-- end user_menu_bar div-->
+</div>
+
+<div id="main_body" i18n:domain="cmf_default">
+
+ <table class="Forematter"
+ width="100%" border="0" cellpadding="0" cellspacing="0" >
+ <tr>
+ <td width="200px">
+
+ <!-- actions box -->
+ <table class="ContextActionsBox"
+ width="100%"
+ style="float: left;"
+ metal:define-macro="actions_box">
+
+ <!-- object actions -->
+ <tr class="ContextActionsRow">
+
+ <td class="ActionTitle"
+ tal:define="getIcon python: hasattr(context, 'getIcon') and context.getIcon();
+ icon python: getIcon or getattr(context, 'icon', '');
+ typ python: getattr(context, 'Type', '');
+ objID python: context.truncID(context.getId(), size=15)">
+
+ <img src="icon" align="left" title="Type" alt="[X]"
+ height="16" width="16"
+ tal:condition="icon"
+ tal:attributes="src string:${globals/portal_url}/${icon};
+ alt typ; "
+ i18n:attributes="alt" />
+
+ <span tal:replace="structure objID">ID</span>
+ </td>
+ </tr>
+
+ <tr class="ContextActionsRow"
+ tal:condition="globals/object_actions"
+ >
+
+ <td class="ActionLink">
+
+ <span tal:repeat="action globals/object_actions">
+ <img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href=""
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">View</a><br />
+ </span>
+
+ <span tal:condition="nothing">
+ <a href="">Edit</a><br />
+ </span>
+
+ <span tal:condition="nothing">
+ <a href="">Metadata</a><br />
+ </span>
+
+ </td>
+ </tr>
+
+ <!-- workflow actions -->
+ <tr class="ContextActionsRow"
+ tal:condition="globals/workflow_actions" >
+
+ <td class="ActionLink">
+
+ <span class="ObjectStatus">
+ <span tal:omit-tag=""
+ i18n:translate="">Status:</span>
+ <span tal:omit-tag=""
+ tal:content="globals/wf_state"
+ i18n:translate="">Private</span><br />
+ </span>
+
+ <span tal:repeat="action globals/workflow_actions">
+ <img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href="content_submit_form"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">Submit</a><br />
+ </span>
+ </td>
+ </tr>
+
+ <!-- folder actions -->
+ <tr class="ContextActionsRow"
+ tal:condition="globals/folder_actions"
+ >
+ <td class="ActionLink">
+ <span tal:repeat="action globals/folder_actions">
+ <img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href="../folder_contents"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">Folder contents</a><br />
+ </span>
+ </td>
+ </tr>
+
+ <!-- add actions -->
+ <tr class="ContextActionsRow"
+ tal:condition="globals/add_actions"
+ >
+ <td class="ActionLink">
+ <span class="ObjectStatus">
+ <span tal:omit-tag=""
+ i18n:translate="">Add...</span><br />
+ </span>
+
+ <span tal:repeat="action globals/add_actions">
+ <img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href="+Document"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">Document</a><br />
+ </span>
+ </td>
+ </tr>
+
+ <!-- global actions -->
+ <tr class="ContextActionsRow"
+ tal:condition="globals/global_actions"
+ >
+ <td class="ActionLink">
+ <span tal:repeat="action globals/global_actions">
+ <img src="" alt="" title=""
+ tal:define="icon_url action/icon|nothing"
+ tal:attributes="src icon_url;
+ alt action/title;
+ title action/title"/>
+ <a href="undo_form"
+ tal:attributes="href action/url"
+ tal:content="action/title"
+ i18n:translate="">Undo</a><br />
+ </span>
+ </td>
+ </tr>
+ </table>
+ <!-- end actions_box -->
+
+ </td>
+
+ <td width="16px"> </td>
+
+ <td id="ForematterCell">
+ <div id="Desktop">
+
+ <p id="Breadcrumbs">
+ <span tal:repeat="bc context/breadcrumbs"
+ ><a href="."
+ tal:attributes="href bc/url" tal:content="bc/id"
+ >ID</a><span tal:condition="not: repeat/bc/end"> / </span>
+ </span>
+ </p>
+
+ <p id="DesktopStatusBar"
+ tal:condition="globals/status_message"
+ tal:content="globals/status_message"
+ i18n:translate="">Status message.</p>
+
+<metal:slot metal:define-slot="body"
+><metal:slot metal:define-slot="header" />
+<metal:slot metal:define-slot="main" /></metal:slot>
+
+ <div id="Permalink"
+ tal:define="url context/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>
+
+ </div>
+ </td>
+ </tr>
+ </table>
+
+</div>
+
+</body>
+</html></metal:macro>
More information about the Checkins
mailing list