Popup window with form

cancel
Showing results for 
Search instead for 
Did you mean: 
wity
Active Member II

Popup window with form

Jump to solution

Hello,
I'm trying to create a popup window with a form for editing a conqueror property.

Unfortunately I'm experiencing this error:

ERROR [scripts.forms.FormUIGet] [http-bio-8081-exec-3] org.alfresco.repo.forms.FormNotFoundException: 03180002 A form could not be found for item: [action] edit_uzivatele

The form I have created and "itemId" and "condition" is the same.

share-config-custom.xml

Button definition

<config evaluator="string-compare" condition="DocLibActions">
          <!-- Action definitions -->
          <actions>
               <!-- Publish Document -->
               <action id="pridat-jmeno-uzivatele" icon="ic-publish" type="javascript" label="Upravit uzivatele">
                    <param name="function">onActionFormDialog</param>
                    <param name="itemKind">action</param>
                    <param name="itemId">upravit_uzivatele</param>
                    <param name="mode">create</param>
                    <param name="destination">{node.nodeRef}</param>
                    <param name="successMessage">Hotovo</param>
                    <param name="failureMessage">Chyba</param>
               </action>

          </actions>
          <actionGroups>
               <!-- For action button to show up at document level -->
               <actionGroup id="document-browse">
                    <action index="460" id="pridat-jmeno-uzivatele" />
               </actionGroup>
               <actionGroup id="document-details">
                    <action index="400" id="pridat-jmeno-uzivatele" />
               </actionGroup>
               <!-- For action button to show up at Folder level -->
               <actionGroup id="folder-browse">
                    <action index="460" id="pridat-jmeno-uzivatele" />
               </actionGroup>
               <actionGroup id="folder-details">
                    <action index="400" id="pridat-jmeno-uzivatele" />
               </actionGroup>
          </actionGroups>
     </config>

Form definition

     <config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
          <forms>
               <form>
                    <field-visibility>
                         <show id="test:uzivatele" />
                    </field-visibility>
                    <appearance>

                    </appearance>
               </form>
          </forms>
     </config>

After click on the button: "Upravit uzivatele"

Can anyone advise me, please?

Thank you

1 Solution

Accepted Solutions
krutik_jayswal
Senior Member II

Re: Popup window with form

Jump to solution

If you would like to update the properties than you can use the edit properties form ,using it it was simple configuration only.

If you would like to update it using your custom action,you need to code it inside java file.

Fetch the entered value in java code.

set the value to document using nodeService in javafile.

View solution in original post

8 Replies
krutik_jayswal
Senior Member II

Re: Popup window with form

Jump to solution

You need to create action-executor with the bean id as "upravit_uzivatele".

Below link contains all details on this.

Adding new actions to the Document Library | Alfresco Documentation 

wity
Active Member II

Re: Popup window with form

Jump to solution

thank you for answer
I created a bean in a file: service-context.xml

like this

 <bean id="upravit_uzivatele"
   class="???"
   parent="action-executer">

<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>

but I do not know what to write to class="? ??"

action definition I have in share-config-custom.xml

krutik_jayswal
Senior Member II

Re: Popup window with form

Jump to solution

It should be path to java class. for example If you are creating java class which is sending an email inside com.email package and Class name is SendEmailActionExecutor than the value should be com.email.SendEmailActionExecutor

You need to define the java class also ,in above case it will be like below.

public class SendEmailActionExecutor extends ActionExecuterAbstractBase
{
   @Override
   public void executeImpl(Action action, NodeRef actionedUponNodeRef)
   {

   }

   @Override
   protected void addParameterDefinitions(List<ParameterDefinition> paramList)
   {

   }
}
wity
Active Member II

Re: Popup window with form

Jump to solution

Thank you very much for your advice.

I created a java class:

upravitUzivatele.java

package cz.digipaper.tutorial.doclibaction.evaluator;

import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;

import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;

import org.alfresco.service.cmr.repository.NodeRef;

import java.util.*;

/**
* Alfresco Repository Action that can send emails with file attachments.
*
* @author martin.bergljung@alfresco.com
*/

public class upravitUzivatele extends ActionExecuterAbstractBase {

     @Override
     public void executeImpl(Action action, NodeRef actionedUponNodeRef) {

     }

     @Override
     protected void addParameterDefinitions(List<ParameterDefinition> paramList) {

     }
}

and I edit bean like this: 

     <bean id="upravit_uzivatele"
            class="cz.digipaper.tutorial.doclibaction.evaluator.upravitUzivatele"
            parent="action-executer">


     </bean>

Now I don't have any error. The form is probably linked. Unfortunately, it does not appear property: 

<show id="test:uzivatele" />

But in form definition is: 

<config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
          <forms>
               <form>
                    <field-visibility>
                         <show id="test:uzivatele" />
                    </field-visibility>
                    <appearance>
                         
                         <!-- <field id="test:uzivatele" label-id="Uzivatele">
                     <control template="/org/alfresco/components/form/controls/textarea.ftl" />      
                    </field> -->

                         
                    </appearance>
               </form>
          </forms>
     </config>
krutik_jayswal
Senior Member II

Re: Popup window with form

Jump to solution

You need to define field in below section as well.

  <appearance>
                         
                         <!-- <field id="test:uzivatele" label-id="Uzivatele">
                     <control template="/org/alfresco/components/form/controls/textarea.ftl" />      
                    </field> -->

                         
                    </appearance>
wity
Active Member II

Re: Popup window with form

Jump to solution

It's starting to look good :-D 

Video Link : 1308

Unfortunately, after pressing the button, the value does not go into the property.

     <config evaluator="string-compare" condition="upravit_uzivatele"> <!-- ID for the Repository Action that this form is associated with -->
          <forms>
               <form>
                    <field-visibility>
                         <show id="test:uzivatele" />
                    </field-visibility>
                    <appearance>
                         
                          <field id="test:uzivatele" label-id="Uzivatele">
                     <control template="/org/alfresco/components/form/controls/textfield.ftl" />      
                    </field>
                         
                    </appearance>
               </form>
          </forms>
     </config>
krutik_jayswal
Senior Member II

Re: Popup window with form

Jump to solution

If you would like to update the properties than you can use the edit properties form ,using it it was simple configuration only.

If you would like to update it using your custom action,you need to code it inside java file.

Fetch the entered value in java code.

set the value to document using nodeService in javafile.

wity
Active Member II

Re: Popup window with form

Jump to solution

Hi, thank you very much for the answer.

I would like update property by using custom action. I have created a solution that writes "test" to the property test:uzivatele

Unfortunately I do not know how Fetch the entered value from my text field in form.  Can you please help me with this?

upravitUzivatele.java

public class upravitUzivatele extends ActionExecuterAbstractBase {

     private ServiceRegistry serviceRegistry;

     /** The NodeService to be used by the bean */
     protected NodeService nodeService;

     @Override
     protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {

          String novaHodnota = "test";

          QName TYPE_DIGIPAPER_UZIVATELE_PROPERTA = QName.createQName(DigipaperXmlModel.NAMESPACE_DIGIPAPER_MODEL,"uzivatele");

          serviceRegistry.getNodeService().setProperty(actionedUponNodeRef, TYPE_DIGIPAPER_UZIVATELE_PROPERTA,novaHodnota);

     }

     @Override
     protected void addParameterDefinitions(List<ParameterDefinition> paramList) {

     }

     /**
      * @param nodeService
      *            The NodeService to set.
      */

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

     public void setServiceRegistry(ServiceRegistry serviceRegistry) {
          this.serviceRegistry = serviceRegistry;
     }
}

DigipaperXmlModel.java

package cz.digipaper.tutorial.doclibaction.evaluator;

import org.alfresco.service.namespace.QName;

public class DigipaperXmlModel { //třída pro vytvoření struktury XML
     //Konstanty, ktere odpovidaji aspektum v alfresu
     
     public static final String NAMESPACE_DIGIPAPER_MODEL = "http://www.digipaper.cz/model/test/1.0";
     
     public static final QName TYPE_DIGIPAPER_UZIVATELE_PROPERTA = QName.createQName(NAMESPACE_DIGIPAPER_MODEL, "uzivatele");
}