Actions

actions在 plone的文件說明中,指的是按了之後會有一些行為的元素,例如login / logout, view / edit / delete, copy / paste等等…

 

自定義一個action,可以寫在default/profiles/actions.xml,例如下例

<?xml version="1.0"?>
<object name="portal_actions" meta_type="Plone Actions Tool"
        xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  <object name="user" meta_type="CMF Action Category">
    <object name="ora_sync" meta_type="CMF Action" i18n:domain="tbfac.newcontent" insert-before="logout">
      <property name="title" i18n:translate="">ZRATEST</property>
      <property name="description" i18n:translate="">ORA test description</property>
      <property name="url_expr">string:${portal_url}/@@syncall</property>
      <property name="icon_expr"></property>
      <property name="available_expr"></property>
      <property name="permissions">
        <element value="Manage portal"/>
      </property>
      <property name="visible">True</property>
    </object>
  </object>
</object>

上例產生的action,會在右上方登入者的menu下拉式選單中出現,

另一例如下:

<?xml version="1.0"?>
<object name="portal_actions" meta_type="Plone Actions Tool"
   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
 <object name="document_actions" meta_type="CMF Action Category">
  <object name="sendto" meta_type="CMF Action" i18n:domain="plone">
   <property name="title" i18n:translate="">Send this</property>
   <property name="description" i18n:translate=""></property>
   <property name="url_expr">string:$object_url/sendto_form</property>
   <property name="icon_expr"></property>
   <property name="available_expr">object/@@shareable</property>
   <property name="permissions">
    <element value="Allow sendto"/>
   </property>
   <property name="visible">True</property>
  </object>
</object>

本例則會在 plone.abovecontenttitle.documentactions  這個 viewlet 中出現。