1.13 Add content

If active, users can contribute their own content. The Goobi viewer provides an upload form that can be used to create a process within Goobi workflow. The status of the process is checked regularly and visualised for the user in the interface.

The configuration is documented here from start to finish.

Goobi workflow

Within Goobi workflow, access to various REST endpoints must be enabled. To do this, the IP address of the Goobi viewer and a token for it must be stored:

goobi_rest.xml
<?xml version='1.0' encoding='UTF-8'?>
<config>
    <endpoint path="/process/details.*">
        <method name="get">
            <allow netmask="127.0.0.0/8" token="SECRETTOKEN"/>
        </method>
    </endpoint>
    <endpoint path="/processes.*">
        <method name="post">
            <allow netmask="127.0.0.0/8" token="SECRETTOKEN"/>
        </method>
    </endpoint>
</config>

In the following example, we assume that there is a project: viewer_UserUploads. This contains a production template: viewer_UserUpload. Within the production template there is a step: Check content in metadata editor.

In this step we show the email address of the submitting user, as well as the possibility to reject the submitted content and enter a reason for rejection. This is done via process properties:

goobi_processProperties.xml
<?xml version="1.0" encoding="UTF-8"?>
<config_processProperties>
    <property name="email" container="0">
        <project>viewer_UserUploads</project>
        <showStep name="Check content in metadata editor" access="read"/>
        <showProcessGroup access="read"/>
        <type>Text</type>
    </property>
    <property name="Rejected" container="0">
        <project>viewer_userUploads</project>
        <showStep name="Check content in metadata editor" access="write"/>
        <showProcessGroup access="read"/>
        <type>List</type>
        <defaultvalue>false</defaultvalue>
        <value>false</value>
        <value>true</value>
    </property>
    <property name="Rejection reason" container="0">
        <project>viewer_UserUploads</project>
        <showStep name="Check content in metadata editor" access="write"/>
        <showProcessGroup access="read"/>
        <type>text</type>
    </property>
</config_processProperties>

Goobi viewer

Within the Goobi viewer, a URL to the Goobi workflow installation used must be configured:

config_viewer.xml
<urls>
    <workflow>https://workflow.example.org/goobi/api/</workflow>
</urls>

Furthermore, the functionality must be activated and configured with the corresponding values defined in Goobi workflow:

config_viewer.xml
<upload enabled="true">
        <token>SECRETTOKEN</token>
        <docstruct>object</docstruct>
        <templateName>viewer_UserUploads</templateName>
        <rejectionPropertyName>Rejected</rejectionPropertyName>
        <rejectionReasonPropertyName>Rejection reason</rejectionReasonPropertyName>
</upload>

In order to regularly check the editing status, a cron job must be created. This checks all contributed content that has the status "WAITING" once an hour to see if there are any changes.

/etc/cron.d/intranda-goobiviewer
42 *       * * *   root  curl -s -H "Content-Type: application/json" -H "token:GOOBIVIEWERAPITOKEN" -d '{"type":"UPDATE_UPLOAD_JOBS"}' -X POST http://localhost:8080/api/v1/tasks/ 1>/dev/null

Last updated