I created a form in a wiki web part for user to upload a Study .zip file, which contains data spreadsheets and structural meta information such as view definitions. When user clicks on submit, they will create a new Study - new subfolder is created for the study, and data is uploaded into DB.
I'm thinking to create a new Action class to do this job. How do I plug in a new Action? What do I need to build and deploy?
And is there any other approach? |
|
Lili responded: |
2010-05-10 12:35 |
No response yet, so please allow me to describe my question again to see if it's clearer this time...
I'm trying to create a new Action that will handle a few tasks in one submission. The tasks include uploading zipped data sheets, processing the data, creating a labkey "Study" subfolder, and dump the data and views into this new subfolder.
This Action will be called within a wiki web part where I have a form to submit.
Please let me know my options.
Thanks! |
|
adam responded: |
2010-05-10 13:21 |
Sounds like you want to add a new Java action. Two options:
- Create a new action class inside the StudyController. This should be fairly straightforward since you'd simply augment an existing module & controller. The StudyController has many examples you can emulate.
- Create your own Java module and add this action to a new controller. This would provide more flexibility and encapsulation; you wouldn't run the risk of merge conflicts as we release new versions of the study module. The "create_module" ant task will walk you through the creation of a new module. You can still pattern your new action based on the StudyController action classes.
Adam |
|
Lili responded: |
2010-05-10 13:46 |
Thank you, Adam. Option 1 seems easier so I will move on with that unless i have to go with option 2. I was trying to add Peter's "apisamples" module but couldn't get it added. So I'll stay away from option 2 first. For option 1, I've been looking at the "core" where we have "admin" actions such as creating folder, but then I was brought into the "security" for editing permissions, which step I need to predefine and take care of in my Action too. Besides creating an Action class, can I do all of I need in javascript by reusing/calling existing Actions sequentially? |
|
adam responded: |
2010-05-11 13:45 |
Adding your action directly to the StudyController is a fine place to start; you can always move it to a custom module later. I'm not familiar enough with your workflow to say whether Java, JavaScript, or some combination of the two is best here. Definitely review the JavaScript API, https://www.labkey.org/download/clientapi_docs/javascript-api -- building a JavaScript workflow that leverages the public API is very powerful and relatively easy. Of course, the functions you need must be exposed and keep in mind that the user doing the uploading will need all the necessary permissions. (I.e., looks like the user must have folder create permissions, study admin permissions, etc.) Adam |
|
Lili responded: |
2010-06-28 09:43 |
Thank you for the reply, Adam. I ended up with combining changes in both Java and Javascript: I added new Action classes into study, core, etc. Controllers; and then made Ajax calls to these Actions in wiki javascript. Things functions the way as we wanted. |
|
adam responded: |
2010-06-28 11:25 |
Thanks for the update -- glad things are working out for you. Adam |
|
|
|