Page 1 of 1

Which event called When we upload a new doc ?

PostPosted:Thu Jul 26, 2018 8:13 am
by mamad
hi guys,
From development point of view :
I want to open a form (like a dialog with input fields) to get some extra informations about the doc from user, when document is uploaded.
so my question has two part:
1- What event called when a new documents is uploaded and how handle that ?
2- how make a new form (with GWT) and show it to get some extra information from user ?
I know my question is very total but i will appreciate if you give me at least some useful link to learn about it

Re: Which event called When we upload a new doc ?

PostPosted:Thu Jul 26, 2018 8:47 am
by lnovoa
Hi!,
here are links to your questions.
With automation, you can develop your scripts and there is also a list of actions implemented.
scripts
https://docs.openkm.com/kcenter/view/ok ... ation.html
list automations
https://docs.openkm.com/kcenter/view/ok ... ation.html

For frontend development, this can help you.
https://docs.openkm.com/kcenter/view/ok ... pment.html

There is a development of the environment for Openkm. It is ready to develop.
This is the link:
https://www.openkm.com/en/download.html

Re: Which event called When we upload a new doc ?

PostPosted:Fri Jul 27, 2018 10:46 am
by mamad
Your links are very general and refers to reading the whole documentations of openkm :D but thank you for your reply

Re: Which event called When we upload a new doc ?

PostPosted:Fri Jul 27, 2018 2:47 pm
by lnovoa
Hi!,
try to further detail your requirements to see if we can help you more in this ;).

Re: Which event called When we upload a new doc ?

PostPosted:Sat Jul 28, 2018 4:26 am
by mamad
ok, thank you, i will explain my full requiremens now:
i want to open a form(like a jframe in swing, actually a UI Panel with some textboxes and a button) every time user upload a document in openKM. This form should get some string data from the text boxes in that form and store this information in openKM database by clicking a confirm button inside form.this info will holds for future use.
so to be more clear my requirements include :
1- Set a Handler to handle uploading document's event
2- when the event called,i mean after user uploaded the document,open a form
3- get information from user by some text boxes inside the form
4- Connect to openKm database(preferably with JDBC)
5- Store these data in the corresponding table
6- Retrieve that data from database by executing the proper query every time i need
Is it clear enough now ? :wink:
Thanks in advance

Re: Which event called When we upload a new doc ?

PostPosted:Sun Jul 29, 2018 7:00 am
by mamad
any idea ??? :roll: :roll: :roll:

Re: Which event called When we upload a new doc ?

PostPosted:Sun Jul 29, 2018 8:06 am
by jllort
You are looking for something like https://www.youtube.com/watch?time_cont ... 0cneiizPx4 ?

Re: Which event called When we upload a new doc ?

PostPosted:Sun Jul 29, 2018 11:36 am
by mamad
yes , great
i want a new window opens after uploading docs( like what happend in the video )but i want to design this window by myself (i want it have a couple of labels and text boxes and also a button for confirm) so after pressing the button i want to save data of textboxes in database
my requirements are very simple and i can design this form and handle the inputs with html or swing in less than one minutes but i dont know how do it in openkm and It 's really driving me crazy :cry: :shock: :(

Re: Which event called When we upload a new doc ?

PostPosted:Mon Jul 30, 2018 6:31 am
by jllort
You should use an action named "AddPropertyGroupToWizard" and there indicate what is the chosen property group ( this action might be linked with document creation event ). The property group is stored in OpenKM database.

If you also want to save in your own database then should intercept the "Set metadata group" event and from there get the metadata values - for it should create your own action an capture data - and do what you wish ( take a look at line 503 of DbPropertyGroupModule.java for better understanding about how are passed the metadata values into the automation action class ). Data is stored into OKM_NODE_PROPERTY table.

This is the way what comes by default with OpenKM, the easiest if you are interested in how it works the wizard should debug FancyFileUpload.java class in combination with WizardPop.java ( what is called into FancyFileUpload class ).

Re: Which event called When we upload a new doc ?

PostPosted:Wed Aug 01, 2018 11:33 am
by mamad
Hi jllort , thank you again for your time
I readed the documentation and now i know how make my own action and run it when documen uploaded
The database part is ok too .
But i still have problem with the UI part of my question .
I don't know how simply create a new UI panel and show it with my desired design ( include some text box , check box , label and button ) and give data from the textboxes .
would you please give me just a simple example about how create a simple UI panel and get data from that ? ( FancyFileUpload.java is about 1000 lines of codes and i don't have enough time to read all of that :cry: )

for example , this is my action that will be run when document is created :
Code: Select all
public class MyAction implements Action {
    
    @Override
    public void executePre(HashMap<String, Object> env, Object... params) {
    }
    
    @Override
    public void executePost(HashMap<String, Object> env, Object... params) {
        
        // => open a ui panel with three textboxes and a button
        // => when user pressed button store textboxes values in Variables TB1,TB2,TB3
    }
}
would you please help me fill the commented part inside executePost method ???
every help will be appreciate .

Re: Which event called When we upload a new doc ?

PostPosted:Thu Aug 02, 2018 8:17 am
by jllort
Create a metadata group, configure automation with AddPropertyGroupToWizard and then check what happens.

1- In the current development version this steps https://docs.openkm.com/kcenter/view/ok ... tions.html is not necessary for enabling automation.
2- Register metadata definition what shown below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.3//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.3.dtd">
<property-groups>
  <property-group label="Consulting" name="okg:consulting">
    <input label="Input label" name="okp:consulting.input1" />
    <separator label="Separator label" name="okp:consulting.separator" /> 
    <input label="Input label" name="okp:consulting.input2" />
  </property-group>
</property-groups>
3- In the automation action set AddPropertyGroupToWizard with group okg:consulting

From automation you fire metadata to be shown, the fields you are looking for.
When you success on it, link the automation with your action and debug the values into HashMap -> you will see everything no need there ( node uuid, etc... ) from there with API call you can retrieve metadata etc... https://docs.openkm.com/kcenter/view/ok ... group.html