2013-06-10 2 views
3

Я новичок на альфреско. Я пытаюсь выполнить следующую задачу во всём мире и отразить модификацию в alfresco share. Я пытаюсь создать новое правило-действие под названием XCopy, которое будет идентично функции копирования. единственное другое - это имя. Должна быть возможность прикрепить правило, заданное для данной папки, и должно принять местоположение файла для копирования.Добавить пользовательское правило действий в Alfresco 4

Я в порядке с конфигурацией пружины в модуле под открытым небом. но меня путают с конфигурацией модуля доступа. Может ли кто-нибудь предложить мне способ добавить мои собственные действия к этой акции? Спасибо.

ответ

3

Вы должны настроить файл rule-config-action.get.config.xml, расположенный на сайте-webscripts \ org \ alfresco \ components \ rules \ config, скопировав тот же файл в веб-расширение с той же структурой папок. Добавьте свое настраиваемое действие в меню <> < group>, а затем в < настроить>. сказать,

<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> 

Добавление пользовательских JavaScript JS в правиле-details.get.head.ftl и правила-edit.get.head.ftl

<!--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> 

создать правило-конфиг-действие-обычай. JS в/компонентов/правила/папки конфигурации тестовой под корневой папке на

Добавить ниже кода, если для открытия выбора файла в долевом,

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

Пожалуйста, дайте мне знать, если вам нужна дополнительная помощь для того же

+0

Отличный ответ с большой пример, поясняющий все необходимые шаги. – Zlatko

Смежные вопросы