【问题标题】:Add custom action-rule to in Alfresco 4在 Alfresco 4 中添加自定义操作规则
【发布时间】:2013-06-10 10:10:01
【问题描述】:

我是露天的新手。我正在尝试在 alfresco 中执行以下任务并在 alfresco 共享中反映修改。 我要做的是创建一个名为 XCopy 的新规则操作,这与复制功能相同。唯一不同的是名字。应该可以附加为给定文件夹定义的规则,并且应该接受要复制的文件位置。

我对 alfresco 模块中的弹簧配置没问题。但我对共享模块配置感到困惑。有人可以建议我将自定义操作添加到共享中吗? 谢谢。

【问题讨论】:

    标签: java alfresco alfresco-share


    【解决方案1】:

    您必须通过将相同的文件复制到具有相同文件夹结构的 Web 扩展来自定义位于 site-webscripts\org\alfresco\components\rules\config 的 rule-config-action.get.config.xml。在

    中添加您的自定义操作,然后在 中添加。 说,
    <group>
       <action name="copy"/>
       <action name="move"/>
        <action name="xcopy"/>
    </group>
    <customise>
          <item id="select">Select</item>
           ......
          <action name="copy">Copy</action>
          <action name="move">Move</action>
          <action name="xcopy">CreateLinkToDocument</action>    <!--xcopy should be id of spring bean configured as action-executer -->
    </customise>
    

    在 rule-details.get.head.ftl 和 rule-edit.get.head.ftl 中添加自定义 javascript js

    <!--Custom javascript file include for detail mode -->
    <@script type="text/javascript" src="${page.url.context}/test/components/rules/config/rule-config-action-custom.js"></@script>
    

    在共享根文件夹下的 test/components/rules/config 文件夹中创建 rule-config-action-custom.js

    将以下代码添加到 if 以在 Share 中打开文件选择器,

    if (typeof SomeCo == "undefined" || !SomeCo)
    {
       var SomeCo = {};
    }
    
    /**
     * RuleConfigActionCustom.
     *
     * @namespace SomeCo
     * @class SomeCo.RuleConfigActionCustom
     */
    (function()
    {
    
       /**
        * YUI Library aliases
        */
       var Dom = YAHOO.util.Dom,
          Selector = YAHOO.util.Selector,
          Event = YAHOO.util.Event;
    
       /**
        * Alfresco Slingshot aliases
        */
        var $html = Alfresco.util.encodeHTML,
           $hasEventInterest = Alfresco.util.hasEventInterest;
    
       SomeCo.RuleConfigActionCustom = function(htmlId)
       {
          SomeCo.RuleConfigActionCustom.superclass.constructor.call(this, htmlId);
    
          // Re-register with our own name
          this.name = "SomeCo.RuleConfigActionCustom";
          Alfresco.util.ComponentManager.reregister(this);
    
          // Instance variables
          this.customisations = YAHOO.lang.merge(this.customisations, SomeCo.RuleConfigActionCustom.superclass.customisations);
          this.renderers = YAHOO.lang.merge(this.renderers, SomeCo.RuleConfigActionCustom.superclass.renderers);
    
          return this;
       };
    
       YAHOO.extend(SomeCo.RuleConfigActionCustom, Alfresco.RuleConfigAction,
       {
    
          /**
           * CUSTOMISATIONS
           */
    
          customisations:
          {         
              CreateLinkToDocument:
             {
                text: function(configDef, ruleConfig, configEl)
                {
                     // Display as path
                     this._getParamDef(configDef, "destination-folder")._type = "path";
                     return configDef;
                },
                edit: function(configDef, ruleConfig, configEl)
                {
                    // Hide all parameters since we are using a cusotm ui but set default values
                    this._hideParameters(configDef.parameterDefinitions);
    
                    // Make parameter renderer create a "Destination" button that displays an destination folder browser
                    configDef.parameterDefinitions.push({
                       type: "arca:destination-dialog-button",
                       displayLabel: this.msg("label.to"),
                       _buttonLabel: this.msg("button.select-folder"),
                       _destinationParam: "destination-folder"
                    });
                    return configDef;
                }
             },
          },
    
       });
    
    })();
    

    查看此内容以供参考:http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf

    如果您需要更多帮助,请告诉我

    【讨论】:

    • 优秀的答案,很好的例子解释了所有需要的步骤。
    猜你喜欢
    • 1970-01-01
    • 2014-10-30
    • 1970-01-01
    • 1970-01-01
    • 2015-10-11
    • 2011-10-12
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多