Here’s a snippet from the PTC Express newsletter. You never know how well something will get saved and archived, so we’ve reproduced it here. Generally, we post code to the Adepters Code Archive. However, this article went out from the PTC Express news letter and it’s getting some attention in places that don’t really understand the impact or how to present the information as the code that it is. So, we’ll join the club, improve the article, and continue adding value to the community at large.

Let us present:

Creating an Update Button in Arbortext Digital Media Publisher (DMP)

It’s a fairly straight-forward process to add a button to Arbortext Digital Media Publisher (DMP).  This is a gentle introduction to getting started with customizing DMP. In March, the Arbortext User group meeting was all about DMP. There’s some amazing things that you can do with it. The full application is customizable.

DMP is part of the Arbortext Publishing Engine.  If you don’t already know DMP, you should get to know it:  DMP assembles documents and multimedia files for publication. Out of the box, DMP provides capabilities for distributing updates to your digital media via the web.

This article describes how to create an update button that your customers can select and that will initiate a download all of the updated pages on your website and store them locally for later offline viewing.

Produced with DMP by PTC documentation staff

Arbortext Help Center is produced with DMP by PTC documentation staff

Creating the button that performs this functionality is not completely intuitive. Here’s what you need to do to create the “Update” button with DMP.

First: Configure the dmp.properties File

To make certain that the button will work properly once it is placed into the DMP image, set the following options in dmp.properties file to enable update pack generation:

# updateStatus: how the update should be proceeded. There are three possible values
#
# 0:  Disable update, no update is generated (but update button and
#     configuration is available in Consumer).
# 1:  Manual update: Consumer user can update content by clicking
#     the update button
# 2:  At launch: Consumer will check for update each time the application
#     is starting
# 3:  Auto update: Consumer will update at scheduled time. updateSchedule
#     property must be set.
#

updateStatus=0

# updateFrom: the version that the update is based on. The version must
#             be older than the version of the current project. This
#             property uses the same format as the "version" property
#             defined above, e.g. 1.0, 2.0.1, etc. It is an error if
#             the version is the same or newer than the current version.
#

updateFrom = 1.0

# updateUrl
# The url pointing to the folder that contains update
# manifest file. It can be a remote URL or local directory.
#
# For a remote URL, it should always starts with "http" or "https".
# For a local directory, if a relative path is specified, it is relative
# to $CONSUMER_INSTALL_DIR/project/WEB-INF. For example, if updateUrl is
# set to "../_updateFolder", it indicates
#
# $CONSUMER_INSTALL_DIR/project/_updateFolder
#

updateUrl = updatepack

# updateConfigurable
#
# Whether Consumer user is able to configure update properties.
#
# true: show update configuration page in Consumer
# false: don’t show configuration page
#
# Note: update configuration page will not show even if this value is set
#       to true if
#       1. Consumer is not installed, or
#       2. Web deployment and the request is not from localhost
#

updateConfigurable = true

# updateSchedule
# The schedule to run update. This property value is required only if
# updateStatus is set to "3". The updateSchedule has the format of
# [UpdateType]:[DayOfMonth]:[DayOfWeek]:[HourOfDay]
# UpdateType: d (daily), w (weekly), m (monthly)
# DayOfMonth: 1-31
# DayOfWeek: 1-7
# HourOfDay: 0-23
#
# For example, to run update at 3am every day, the updateSchedule should
# look like: updateSchedule = d:0:0:2
# To run update at 3am every Friday: updateSchedule=w:0:5:2
# To run update at 3am the fifth day of each month at 3am:
# updateSchedule=m:5:0:2

updateSchedule=w:0:1:0

Second: Check other properties in the dmp.properties File

Make certain the following property values do not change between the base release and all updates. Changes to these values will cause updates not be properly recognized.

  • companyName
  • projectId
  • projectName
  • outputroot

Third: Create the Button

To create an “Update” button in DMP, follow these steps:

  1. Create a new “Welcome” page by opening up your text editor and placing the following template code at the top:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
              xmlns:atidmc="http://www.arbortext.com/namespace/dmc/consumer">
       <jsp:output doctype-root-element="html"
                doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
                doctype-system="" />
       <jsp:directive.page language="java" errorPage="error.jspx"
                contentType="text/html; charset=UTF-8" />
       <atidmc:layout var="layout" />
       <html>
          <head>
             <title>Cerify Automated Verification and Checking System</title>
          </head>
          <link rel="Stylesheet" type="text/css" media="all"
                href="${layout.template}/css/dmc.css"></link>
          <body>
          <div id="config">
    
  2. Under the <div> tag, place the content you want displayed to your users as the first page of your DMP image. For example:
    <p>The DMP Help Center itself is an application of DMP. You can search
    the documentation using the search controls on the upper-left side of
    the window. The Help Center also provides an index to the HTML and PDF
    documentation. (To view the PDF documentation, you must have Adobe
    Acrobat Reader installed and correctly configured on your system.).</p>
    
  3. Directly under this new content, add the following code:
    <form method="get"
          name="update"
          id="update"
          accept-charset="utf-8"
          action="../_update"
          enctype="application/x-www-form-urlencoded"
          target="_parent">
       <input type="submit" name="update" value="update"/>
    </form>
    
  4. Remember to keep your tags balanced and make sure you close the code with the following:
          </div>
        </body>
      </html>
    </jsp:root>
    
  5. Save this file as:
    <DMP_INSTALL_DIR>\templates\simple\yourcompany.jspx
    
    Note: If working with frames, choose the frame directory.
    
  6. Open the template.xml file.
    <DMP_INSTALL_DIR>\templates\simple\template.xml
    

    Note: If working with frames, choose the frame directory.

  7. Change the Page type=”Intro” to the following:
    <Page type="INTRO">
    <Url locale="*" href="yourcompany.jspx" />
    
  8. Run the dmp.bat file. You should see your button displayed. When you click this button, DMP will check for updates.
    see the results

    see the results

    You should see that the content shows “current” because an update pack has not yet been generated.

  9. Create and deploy the updates pack.Click the update button again. You will notice a series of steps being performed by your image followed with a completion status.Your content is now up-to-date. Practice adjusting the duration of the updates by opening the dmp.properties and setting the updateSchedule to different codes. The default code is:
    updateSchedule=w:0:1:0

    Setting the update to Schedule as described above will set the update to run on the fifth day of each month at 3am.

    The update button will work in both standalone mode and Web application mode.

Get useful tips and valuable resources every month

Join the thousands who know just how much we share.

Powered by ConvertKit
%d bloggers like this: