AnsweredAssumed Answered

How show a form aikau when click on custom action on share?

Question asked by 4535992 on Dec 18, 2017

I nedd to convert some spring surf form of share for spcefici action with some dialog form aikau, but i find hard time to understand hot make a relation between the action and the widget of the popup form of aikau, i put the files i use for the current spring surf form:

 

repo-amp/src/main/java/my/stupid/alfresco/webscripts/GetPropertiesAlfrescoWebscript.java

****************************************************************************************************************

package my.stupid.alfresco.webscripts;

.....

public class GetPropertiesAlfrescoWebscript extends AbstractWebScript{
    private static Log logger = LogFactory.getLog(GetPropertiesAlfrescoWebscript.class);
    
    private AuthenticationService authenticationService;
    private SearchService searchService;
    private NodeService nodeService;
    private ContentService contentService;
    
    @Override
    public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {
        logger.debug("START GetPropertiesAlfrescoWebscript");
        String PARAM_SEARCH_PARAMETER = req.getParameter("searchParameter");
        logger.debug("PARAMETER=["+PARAM_SEARCH_PARAMETER+"]");
        try{    
            if(post=="TICKET"){
                
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("ticket", authenticationService.getCurrentTicket());
                logger.debug("GET "+GET_METHOD.TICKET.name()+ "="+jsonObject.toString());
                res.getWriter().write(jsonObject.toString());                    
            }else{
                logger.warn("XXXXXXXXXXXXXXXXXXXX");
            }                
        }catch(Throwable ej){
            throw new IOException(ej);
        }
        logger.debug("END 2 PostPropertiesWebscript");
    }

 

    public void setAuthenticationService(AuthenticationService  authenticationService) {
        this.authenticationService =  authenticationService;
    }

    public void setSearchService(SearchService searchService) {
        this.searchService = searchService;
    }

    public void setNodeService(NodeService nodeService) {
        this.nodeService = nodeService;
    }

    public void setContentService(ContentService contentService) {
        this.contentService = contentService;
    }
}

*************************************************************************************************

So i build my bean on the service-context.xml file (or any <file>-context.xml) loaded from the module-context.xml of alfresco

repo-amp/src/main/amp/config/alfresco/module/repo-amp/context/service-context.xml

****************************************************************************************************************

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   

          <bean id="webscripts.my.stupid.signmultiselect.signMultiselect.get"                                                   
          class="my.stupid.alfresco.webscripts.GetPropertiesAlfrescoWebscript"
          parent="webscript">                  
            <property name="authenticationService">
                <ref bean="AuthenticationService" />
            </property>
            <property name="contentService">
                <ref bean="ContentService"/>
            </property>
            <property name="nodeService">
                <ref bean="NodeService"/>
            </property>
            <property name="searchService">
                <ref bean="SearchService"/>
            </property>
</bean>

</beans>

****************************************************************************************************************

/repo-amp/src/main/amp/config/alfresco/module/repo-amp/module-context.xml

****************************************************************************************************************

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    <import resource="classpath:alfresco/module/${project.artifactId}/context/*-context.xml"/>
</beans>

****************************************************************************************************************

/repo-amp/src/main/amp/config/alfresco/extension/templates/webscripts/my/stupid/signmultiselect/signMultiselect.get.desc.xml

****************************************************************************************************************

<webscript>
    <shortname>ZZZZZ</shortname>
    <description>XXXXX</description>
    <url>/my/stupid/signMultiselect/repo/get</url>
    <format default="html">extension</format>
    <authentication>user</authentication>
    <transaction>required</transaction>
</webscript>

****************************************************************************************************************

/share-amp/src/main/resources/META-INF/components/sign/sign-surf-multiselect-action.js

****************************************************************************************************************

..... SOME JAVASCRIPT  (I want to replace this with the aikau widgets) ......

var urlRepoGet = encodeURI(Alfresco.constants.PROXY_URI+'my/stupid/signMultiselect/repo/get?searchParameter=TICKET');

//http://<MY_IP_ADDRESS>:8080/share/proxy/alfresco/my/stupid/signMultiselect/repo/get?searchParameter=TICKET"
 log('urlRepoGet string = ' + urlRepoGet);
//Alfresco.util.Ajax.jsonGet( //still the same error
Alfresco.util.Ajax.request(
 {
         method: Alfresco.util.Ajax.GET,
         responseContentType: Alfresco.util.Ajax.JSON,
         url: urlRepoGet,//Alfresco.constants.PROXY_URI+"/abd/signMultiselect/repo/get"
         successCallback:
          {
                fn: function handleSuccess(data)
                 {
                   log('Result Multiselect : ' + data.serverResponse.responseText);//

                  //build my dialog form with classi javascript

..... SOME JAVASCRIPT ......

****************************************************************************************************************

src\main\resources\alfresco\web-extension\site-data\extensions\my-module-id.xml

**************************************************************************************************************

<extension>
    <modules>
        <module>
            <id>SignSurfAction</id>
            <version>${project.version}</version>
            <auto-deploy>true</auto-deploy>
            <configurations>
                
                <config evaluator="string-compare" condition="DocumentLibrary">                                             
                    <indicators>                    

                    </indicators>

                    <toolbar-actions>
                          <action type="action-link" id="sign-surf-action" label="menu.selected-items.signSurfAction" />
                      </toolbar-actions>
                                           
                      <multi-select>                       
                         <action type="action-link"
                         id="onActionSignSurfActionMultiSelect"
                         label="it.abd.sign.menu.selected-items.signSurfAction"
                         icon="sign-surf-multiselect-action"
                         asset="document"
                         permission="Write"/>
                      </multi-select>
                                    
                </config>
                
                <config evaluator="string-compare" condition="DocLibActions">
                    <actions>
                       <action id="sign-surf-multiselect-action"
                           type="javascript"
                           label="it.abd.sign.action.signSurfAction.label">
                          <param name="function">onActionSignSurfActionMultiSelect</param>
                          <param name="successMessage">it.abd.sign.action.signed.msg.success</param>
                          <param name="failureMessage">it.abd.sign.action.signed.msg.failure</param>
                          <evaluator>it.abd.alfresco.evaluator.isSignable</evaluator>
                          <permissions>
                            <permission allow="true">Write</permission>
                          </permissions>
                       </action>
                    </actions>

                    <actionGroups>
                        <actionGroup id="document-browse">                       
                                <action index="400" id="sign-surf-action" />
                                 <action index="105" id="sign-surf-multiselect-action" />
                        </actionGroup>                                        
                    </actionGroups>
                </config>

                <config evaluator="string-compare" condition="DocLibCustom">
                    <dependencies>                          
                        <css src="/webdesktop-share-amp/css/toolbar/custom-toolbar.css"/>                  
                        <js src="components/sign/sign-surf-multiselect-action.js" />
                        <js src="components/sign/signABD.js" />
                        <css src="components/sign/sign-surf-multiselect-action.css" />              
                    </dependencies>
                </config>
                

                <config evaluator="string-compare" condition="signSurfAction"> <!-- ID for the Repository Action that this form is associated with -->
                    <forms>                  
                        <form>                                   
                            <!-- WORK FINE MY FORM WITH SPRING SURF BUT I WANT TO REPLACE WITH A DIALOG FORM POPUP AIKAU -->
                        </form>      
                    </forms>
                </config>   
        </module>
    </modules>
</extension>

*********************************************************************************************************************************

 

My question is i want to replace the "classic" spring surf use for manage the  "action to call" with the aikau widgets dialog popup, but i find really hard time to make it work, or for make appaear the dialog popup of aikau when i click on the actionm,

 

i can't  find any documentation for my specific case, to call a dialog popup of aikau by click on a custom action on share.

Anyone know some tutorial or a example of my use case ?

 

ty in advance.

Outcomes