Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

Generate Zip File Process Tool plugin allows user users to zip all files residing in a file upload form field of the selected form. The plugin also offers the option to password-protect the generated zip file.

If you do not have a zip extractor, you can download from https://www.7-zip.org/download.html.

Plugin Information

Plugins Available in the Bundle:

  1. Generate Zip File Process Tool

This plugin bundle is compatible with Joget DX 8.

Expected Outcome

In the following outputs, all the files in the file upload field are compiled into a zip file. 

No password zip generation

Image Added

Figure 1: No password

Password-protected zip generation

Image Added

Figure 2: Password-protected

How to use the plugin

The plugin has numerous use cases, this article will explain how to use the plugin by building an example app.

First, you can obtain the plugin jar file from the latest release atYou can check the source code: https://github.com/jogetoss/generate-zip-file/releases.

Upload the plugin jar file in Joget by going to 

https://www.7-zip.org/download.html

You can download the plugin here:

View file
namegenerate-zip-file-8.0-SNAPSHOT.jar
height150

Sample Output

No password

Image Removed

How to use the plugin

Image Removed

...

Settings → Manage Plugins.

Step 1

Create a form, drag a single text field, and file upload form element into it. Configure each form element as shown below:

Field Label Field ID
Item Nameitem_name
File Upload file_upload
Zip Uploadzip_file_upload

Image Added

Figure 3: Form layout

Tick the "Enable Multiple Files Upload" option for the File Upload form element. This will allow multiple files to be uploaded.
Image Added

Figure 4: Tick "Enable Multiple Files Upload"

Once completed, generate a CRUD through the "Generate App" option

Step 2

Go to "Settings" > "Advanced", and scroll down to the "Post Form Submission Processing" section. In the Post Processing Tool field, select "Generate Zip Tool". Change the "Run Tool on" from "Data Creation" to "Both data creation and update". This configuration will run the plugin upon new record creation or update. 

Image Added

Figure 5: Configure Post Form Submission Processing

Step 3

Configure the Generate Zip Tool plugin

From

Image Added

Figure 6: Plugin "From" properties configuration

LabelField
Select Form to obtain file

Select the form created in step 1

File Upload Field ID of the file

Insert the ID of the file upload form element

Image Added

Figure 7: File Upload ID

Record ID 

Record ID uses the hash variable "#form.generated_zip_sample.id#" This will point to the record ID in the selected record row that executes the process tool plugin. In this example, generated_zip_sample is the table name. You may replace the table name in the hash variable with yours.

Image Added

Figure 8: Form table name

To

Image Added

Figure 9: Plugin "To" properties configuration

Label Field
Select Form to Store ZipSelect the form created in step 1
Target Form Field ID to store Zip File

Insert the ID of the zip file upload form element

Image Added

Figure 10: Zip File Upload ID

Target Record ID

Record ID uses the hash variable "#form.generated_zip_sample.id#" This will point to the record ID in the selected record row that executes the process tool plugin. In this example, generated_zip_sample is the table name. You may replace the table name in the hash variable with yours.

Image Added

Figure 11: Form table name 

Zip File NameThe Zip file name is "Zip File #data.mm ss a#" in this example. It will display the time generated and ensure that the Zip file name will be dynamic. 
Zip Password(optional)Insert any password. The password used in this example is "test".

Once finished, save the changes.

Step 4

Test the app, upon "new record creation" or "record update". The plugin will generate a Zip File in the configured File Upload form element as shown below:

No password zip generation

Image Added

Figure 12: No password

Password-protected zip generation

Image Added

Figure 13: Password-protected

Generate Zip Plugin Properties

From

Image Added

Figure 14: Plugin "From" properties

FieldDescription
Select Form to obtain file Select the form to obtain the desired files
Form Field ID of the file

The form field ID of the file upload form element contains the files you wish to zip.

Warning

It must be a File Upload form element otherwise, it wouldn't work.


Record ID The record ID that stored the files

To

Image Added

Figure 15: Plugin "To" properties

FieldDescription
Select Form to Store ZipSelect the form to store the generated zip file
Target Form Field ID to store Zip FileForm Upload field in the selected form to store the generated Zip File
Target Record IDThe record ID to store the zip files
Zip File NameGenerated zip file name
Zip Password (optional)

Zip password

Info

Inputting a password to this field will enable the plugin to generate a password-protect zip.


Source Code and Plugin Download

You can obtain the jar file by the latest release at https://github.com/jogetoss/generate-zip-file/releases.

Demo App Download

View file
nameAPP_mp_generateZipsample.jwa
height250

Image Removed

Image Removed

Generate Zip Plugin Properties

...