[Checkins] SVN: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/ - check in action link target work

Jens Vagelpohl jens at dataflake.org
Fri May 15 10:10:38 EDT 2009


Log message for revision 99980:
  - check in action link target work
  

Changed:
  U   Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/ursine/main_template.pt
  U   Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/werebear/main_template.pt
  U   Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/zpt_generic/main_template.pt
  U   Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/configure.zcml
  U   Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/to22.py

-=-
Modified: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/ursine/main_template.pt
===================================================================
--- Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/ursine/main_template.pt	2009-05-15 13:56:23 UTC (rev 99979)
+++ Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/ursine/main_template.pt	2009-05-15 14:10:38 UTC (rev 99980)
@@ -52,7 +52,8 @@
  <ul id="object_actions_menu">
   <li tal:repeat="action globals/object_actions">
   <a href="#object_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title"
       i18n:translate="">OBJECT ACTION_TITLE</a><br />
   </li>
@@ -61,7 +62,8 @@
  <ul id="workflow_actions_menu">
   <li tal:repeat="action globals/workflow_actions">
   <a href="#workflow_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title"
       i18n:translate="">OBJECT ACTION_TITLE</a><br />
   </li>
@@ -70,7 +72,8 @@
  <ul id="folder_actions_menu">
   <li tal:repeat="action globals/folder_actions">
   <a href="#folder_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title"
       i18n:translate="">FOLDER ACTION_TITLE</a><br />
   </li>
@@ -79,7 +82,8 @@
  <ul id="add_actions_menu">
   <li tal:repeat="action globals/add_actions">
   <a href="#add_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title"
       i18n:translate="">ADD ACTION_TITLE</a><br />
   </li>
@@ -88,7 +92,8 @@
  <ul id="user_actions_menu">
   <li tal:repeat="action globals/user_actions">
    <a href="#user_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title" i18n:translate="">USER ACTION TITLE</a>
   </li>
  </ul>
@@ -96,7 +101,8 @@
  <ul id="global_actions_menu">
   <li tal:repeat="action globals/global_actions">
    <a href="#global_action"
-      tal:attributes="href action/url"
+      tal:attributes="href action/url;
+                      target action/link_target|nothing"
       tal:content="action/title" i18n:translate="">GLOBAL ACTION TITLE</a>
   </li>
  </ul>

Modified: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/werebear/main_template.pt
===================================================================
--- Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/werebear/main_template.pt	2009-05-15 13:56:23 UTC (rev 99979)
+++ Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/werebear/main_template.pt	2009-05-15 14:10:38 UTC (rev 99980)
@@ -97,7 +97,8 @@
             tal:attributes="src icon_url;
                             alt action/title;
                             title action/title"/>   
-    <a href="" tal:attributes="href action/url"
+    <a href="" tal:attributes="href action/url;
+                               target action/link_target|nothing"
                 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"
@@ -160,7 +161,8 @@
                             alt action/title;
                             title action/title"/>
       <a href=""
-         tal:attributes="href action/url"
+         tal:attributes="href action/url;
+                         target action/link_target|nothing"
          tal:content="action/title"
          i18n:translate="">View</a><br />
      </span>
@@ -197,7 +199,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="content_submit_form"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Submit</a><br />
       </span>
@@ -216,7 +219,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="../folder_contents"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Folder contents</a><br />
       </span>
@@ -240,7 +244,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="+Document"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Document</a><br />
       </span>
@@ -259,7 +264,8 @@
                             alt action/title;
                             title action/title"/>
       <a href="undo_form"
-         tal:attributes="href action/url"
+         tal:attributes="href action/url;
+                         target action/link_target|nothing"
          tal:content="action/title"
          i18n:translate="">Undo</a><br />
      </span>

Modified: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/zpt_generic/main_template.pt
===================================================================
--- Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/zpt_generic/main_template.pt	2009-05-15 13:56:23 UTC (rev 99979)
+++ Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/skins/zpt_generic/main_template.pt	2009-05-15 14:10:38 UTC (rev 99980)
@@ -124,7 +124,8 @@
             tal:attributes="src icon_url;
                             alt action/title;
                             title action/title"/>   
-    <a href="" tal:attributes="href action/url"
+    <a href="" tal:attributes="href action/url;
+                               target action/link_target|nothing"
                 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"
@@ -188,7 +189,8 @@
                             alt action/title;
                             title action/title"/>
       <a href=""
-         tal:attributes="href action/url"
+         tal:attributes="href action/url;
+                         target action/link_target|nothing"
          tal:content="action/title"
          i18n:translate="">View</a><br />
      </span>
@@ -226,7 +228,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="content_submit_form"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Submit</a><br />
       </span>
@@ -246,7 +249,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="../folder_contents"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Folder contents</a><br />
       </span>
@@ -271,7 +275,8 @@
                             alt action/title;
                             title action/title"/>
        <a href="+Document"
-          tal:attributes="href action/url"
+          tal:attributes="href action/url;
+                          target action/link_target|nothing"
           tal:content="action/title"
           i18n:translate="">Document</a><br />
       </span>
@@ -291,7 +296,8 @@
                             alt action/title;
                             title action/title"/>
       <a href="undo_form"
-         tal:attributes="href action/url"
+         tal:attributes="href action/url;
+                         target action/link_target|nothing"
          tal:content="action/title"
          i18n:translate="">Undo</a><br />
      </span>

Modified: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/configure.zcml
===================================================================
--- Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/configure.zcml	2009-05-15 13:56:23 UTC (rev 99979)
+++ Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/configure.zcml	2009-05-15 14:10:38 UTC (rev 99980)
@@ -83,6 +83,12 @@
         checker=".to22.check_action_icons"
         />
 
+    <genericsetup:upgradeStep
+        title="Add action link target"
+        handler=".to22.add_action_linktargets"
+        checker=".to22.check_action_linktargets"
+        />
+
   </genericsetup:upgradeSteps>
 
   <genericsetup:upgradeStep

Modified: Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/to22.py
===================================================================
--- Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/to22.py	2009-05-15 13:56:23 UTC (rev 99979)
+++ Products.CMFDefault/branches/jens_actions_linktarget/Products/CMFDefault/upgrade/to22.py	2009-05-15 14:10:38 UTC (rev 99980)
@@ -17,6 +17,7 @@
 import logging
 from urllib import quote
 
+from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
 from zope.component.interfaces import ComponentLookupError
@@ -124,3 +125,49 @@
                 changed = True
         if changed:
             logger.info("TypeInfo '%s' changed." % ti.getId())
+
+def check_action_linktargets(tool):
+    """2.1.x to 2.2.0 upgrade step checker
+    """
+    # Actions in portal_actions tool
+    atool = getToolByName(tool, 'portal_actions')
+    for ai in atool.listActions():
+        if getattr(aq_base(ai), 'link_target', None) is None:
+            return True
+
+    # Actions from TypeInformation objects
+    ttool = getToolByName(tool, 'portal_types')
+    for ti in ttool.listTypeInfo():
+        if getattr(aq_base(ti), 'link_target', None) is None:
+            return True
+
+        for ai in ti.listActions():
+            if getattr(aq_base(ai), 'link_target', None) is None:
+                return True
+    return False
+
+def add_action_linktargets(tool):
+    """2.1.x to 2.2.0 upgrade step handler
+    """
+    logger = logging.getLogger('GenericSetup.upgrade')
+
+    # Actions in portal_actions tool
+    atool = getToolByName(tool, 'portal_actions')
+    for ai in atool.listActions():
+        if getattr(aq_base(ai), 'link_target', None) is None:
+            ai.link_target = ''
+            logger.info('Action "%s" changed.' % ai.getId())
+
+    # Actions from TypeInformation objects
+    ttool = getToolByName(tool, 'portal_types')
+    for ti in ttool.listTypeInfo():
+        if getattr(aq_base(ti), 'link_target', None) is None:
+            ti.link_target = ''
+            logger.info("TypeInfo '%s' changed." % ti.getId())
+
+        for ai in ti.listActions():
+            if getattr(aq_base(ai), 'link_target', None) is None:
+                ai.link_target = ''
+                msg = 'TypeInfo "%s" action "%s" changed.'
+                logger.info(msg % (ti.getId(), ai.getId()))
+



More information about the Checkins mailing list