Hi Guys,
So I'm a little confused on the implementation of the Upload and Download form elements in a workflow. It is required to create a new class that can handle this operation or is there a class that I'm not seeing already provided?
I've seen this post http://forum.openkm.com/viewtopic.php?t=10539 and read the form element definitions http://wiki.openkm.com/index.php/Form_E ... escription, but I'm still not clear as to what the proper procedure for implementing a download file button and an upload file for both update and creation.
For upload my understanding is that I must use something like this code in my form:
I'm not quite sure what it is that I'm missing here. I've tried this persons code http://forum.openkm.com/viewtopic.php?f ... oad#p18434 exactly and setting the action event type to NODE-ENTER I believe and that worked just fine as long as I set everything explicitly and it was sent to a different folder for a "create" scenario. I also tried modifying his code to just do an update with no luck.
And download I'm a bit more confused. Something like this form?:
Something I did realize after a while is that the ActionHandler must be assigned to the node as an event action. I set the EVENT TYPE to before-signal.
Sorry for all the information! I would love some help on this one! Thanks everyone
So I'm a little confused on the implementation of the Upload and Download form elements in a workflow. It is required to create a new class that can handle this operation or is there a class that I'm not seeing already provided?
I've seen this post http://forum.openkm.com/viewtopic.php?t=10539 and read the form element definitions http://wiki.openkm.com/index.php/Form_E ... escription, but I'm still not clear as to what the proper procedure for implementing a download file button and an upload file for both update and creation.
For upload my understanding is that I must use something like this code in my form:
Code: Select all
with the corresponding ActionHandler:
<upload name="upload" label="Update File" data="upload" type="update"></upload>
Code: Select all
I get the following error:
public class uploadUpdate implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext context) throws Exception {
String uuid = (String) context.getContextInstance().getVariable("uuid");
Upload up = new Upload();
up.setDocumentUuid(uuid);
up.setName("upload");
up.setType("update");
up.setData("upload");
up.setLabel("Update File");
context.getContextInstance().createVariable("upload", up);
}
}
Code: Select all
When I look at the Process Variables I see this:
file.pdf: Document name is diferent
Code: Select all
I have also tried this code:
{label=Update File, name=upload, width=33, height=25px, folderPath=, folderUuid=, documentName=, documentUuid=bacb6fd8-dd1f-4b95-a07b-e444ae1c5511, type=update, data=upload, validators=[]}
Code: Select all
with this result for the var "upload" and still getting the same error that the names are different:
public class uploadUpdate implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext context) throws Exception {
String uuid = (String) context.getContextInstance().getVariable("uuid");
String documentName = (String) context.getContextInstance().getVariable("name");
context.getContextInstance().createVariable("documentName",documentName);
String token = context.getToken().toString();
String folderPath = OKMRepository.getInstance().getNodePath(token, uuid);
Upload up = new Upload();
up.setDocumentUuid(uuid);
up.setDocumentName(documentName);
up.setName("upload");
up.setFolderPath(folderPath);
up.setType("update");
context.getContextInstance().createVariable("upload", up);
}
}
Code: Select all
Not sure why the documentName comes up as "null". I've also tried not setting the documentName or FolderPath since it says
{label=, name=upload, width=33, height=25px, folderPath=/okm:root/file.pdf, folderUuid=, documentName=null, documentUuid=bacb6fd8-dd1f-4b95-a07b-e444ae1c5511, type=update, data=, validators=[]}
If you want to update an existing document, then should set documentUuid and put type to update.http://wiki.openkm.com/index.php/Form_E ... escription
I'm not quite sure what it is that I'm missing here. I've tried this persons code http://forum.openkm.com/viewtopic.php?f ... oad#p18434 exactly and setting the action event type to NODE-ENTER I believe and that worked just fine as long as I set everything explicitly and it was sent to a different folder for a "create" scenario. I also tried modifying his code to just do an update with no luck.
And download I'm a bit more confused. Something like this form?:
Code: Select all
And some sort of corresponding download ActionHandler? I've dug up this page http://doxygen.openkm.com/openkm_6.2.0/ ... 19ebff588a, but I'm not exactly getting how to set the UUID and path to make sure I'm downloading the correct file into the node. <download name="download" label="Download" data="downloadThisFile">
<node label="" />
</download>
Something I did realize after a while is that the ActionHandler must be assigned to the node as an event action. I set the EVENT TYPE to before-signal.
Sorry for all the information! I would love some help on this one! Thanks everyone
