Which event called When we upload a new doc ?

OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

Which event called When we upload a new doc ?

Post by mamad » Thu Jul 26, 2018 8:13 am

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

lnovoa
Expert Boarder
Expert Boarder
Posts: 100
Joined: Tue Mar 27, 2018 8:00 am

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

Post by lnovoa » Thu Jul 26, 2018 8:47 am

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

mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

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

Post by mamad » Fri Jul 27, 2018 10:46 am

Your links are very general and refers to reading the whole documentations of openkm :D but thank you for your reply

lnovoa
Expert Boarder
Expert Boarder
Posts: 100
Joined: Tue Mar 27, 2018 8:00 am

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

Post by lnovoa » Fri Jul 27, 2018 2:47 pm

Hi!,
try to further detail your requirements to see if we can help you more in this ;).

mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

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

Post by mamad » Sat Jul 28, 2018 4:26 am

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

mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

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

Post by mamad » Sun Jul 29, 2018 7:00 am

any idea ??? :roll: :roll: :roll:

jllort
Moderator
Moderator
Posts: 10267
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post by jllort » Sun Jul 29, 2018 8:06 am

You are looking for something like https://www.youtube.com/watch?time_cont ... 0cneiizPx4 ?

mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

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

Post by mamad » Sun Jul 29, 2018 11:36 am

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

jllort
Moderator
Moderator
Posts: 10267
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post by jllort » Mon Jul 30, 2018 6:31 am

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

mamad
Senior Boarder
Senior Boarder
Posts: 69
Joined: Mon Jun 25, 2018 5:13 am

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

Post by mamad » Wed Aug 01, 2018 11:33 am

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 .

jllort
Moderator
Moderator
Posts: 10267
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

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

Post by jllort » Thu Aug 02, 2018 8:17 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests