Versions Compared

Key

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

...

...

...

...

...

...

...

...

...

...

...

...

Insert excerpt
_Banners
_Banners
namescreen
nopaneltrue

This page is for

...

Understanding the Soft Link Between Tomcat and PhixFlow

When you want to reference a file saved on the PhixFlow server, you need to use a path that the PhixFlow Webapp can understand. The PhixFlow webapp runs within Tomcat, so only knows about files below  /opt/tomcat/webapps/phixflow 

...

application designers who need the ability to download files and/or access them programmatically.

Within your application screens, you may use images and files that have been uploaded onto the PhixFlow server. For example,

  • allowing users to download a file.
  • displaying an image based on expression logic. For example,  display a user image based on the logged in user.


Your administrator should have configured the Tomcat webserver to see specific directories by creating soft links from a source to a target. See Install the PhixFlow Webapp. Strictly speaking this is an optional step, but it part of the recommended installation for PhixFlow. If you are not sure, please talk to your system administrator.


Operating SystemSource (Tomcat)
which points to → 
Target (Directory)Example Files
Linux<path>/tomcat/webapps/phixflow/datalink

<path>/phixflow/data/phixflow/datalink/

Snapshot.

...

jpg

MyData.xlsx

Windows<path>\tomcat\webapps\phixflow\datalink<path>/phixflow/data/phixflow/datalink/

You may not want to save files under the datalink directory on the PhixFlow server. For example, you could have a directory for each project, and the files belong to a specific project. In this case, you can add a second soft link.

...


To access the files use the soft link:

  • To create a download, create an action which opens the URL: "datalink/MyData.xlsx"
    • Note, not all file types will invoke a download, for example a PDF will simply open in a new browser tab.

  • For display, an image or PDF can be embedded in a URL component using the value: url("https:datalink/Snapshot.jpg")
  • For display, images can be applied to areas by setting the CSS property background-image to: "datalink/Snapshot.jpg"

Example Setup for Images using a Soft Link

This example covers the scenario where a user has a set of logos and needs PhixFlow to display them based on the Business currently selected.

Step1: Setup the soft link

See Configuring Soft Links Between PhixFlow and Tomcat for the commands

Example locations are shown below:

Operating SystemSource (Tomcat)Target (Directory)
Linux<path>/tomcat/webapps/phixflow/datalink

<path>/

...

phixflow/data/datalink/

...

Windows<path>\tomcat\webapps\phixflow\datalink<path>/phixflow/data/

...

datalink/

...

To ensure soft links from Tomcat to PhixFlow directories are secure, configure context.xml as follows:

  1. Edit /opt/tomcat/conf/context.xml
  2. Find the line: <Resources cachingAllowed="true" cacheMaxSize="1000000" />
  3. Replace it with: <Resources allowLinking="true" cachingAllowed="true" cacheMaxSize="1000000" />

In the following commands:

  • path/folder_name is the full path to the directory to which you want to link
  • soft_link_name is the directory name you want to use as a soft link in the current directory.

On Linux use the ln command

ln -s path/folder_name soft_link_name

If a file path includes spaces, enclose it in double-quotes

On Windows use the mklink command

mklink /D soft_link_name path/folder_name

To soft link to a specific file, omit /D.

For more information about symlinks, see this article on Creating Symbolic Links.

The Path or URL to Use

Within PhixFlow, to refer to a file on the server, start the path with the datalink directory.

Examples:

  • file path:   datalink/Project1/Images/file1.png
  • URL:   url("https:datalink/MyProject/MyImage.png")

...

In your PhixFlow application, to display an image stored on the PhixFlow server, use the URL for it's location, for example:  url("https:datalink/MyProject/MyImage.png").

For example, you can configure the following CSS Properties to use an image stored on the PhixFlow server as a background image. 

...

The business logos should be uploaded onto the server into the Target directory using the appropriate protocol e.g. FTP.

It should be noted it is a good idea to create subdirectories under the Target directory for different types of information i.e. "customImages" for the customer logos we are uploading. 

In this example we will upload our images to: <path>/phixflow/data/datalink/customImages.

It is assumed that a table exists which contains the names of the Business logos. For example a Businesses table with an attribute called LogoName that holds the name of the business's logo.

Setup

  1. Create a new screen
  2. Open the palette and add one of the Complete Screens to the screen by dragging and dropping it.
  3. Open the table containing the names of the customer logo e.g. Businesses
  4. Drag the attribute containing the logo name onto the screen e.g. LogoName.
  5. Setting the background image
    1. In the palette find the Area component and drag it onto the screen.
    2. Navigate to its Style Tab and set the following:
      1. Background Repeat: no-repeat
      2. Background Size:      100%
        1. See Image Sizing for more information on this.
    3. In the CSS Properties section, click the add button and set the following:
      1. CSS Tag: background-Image
      2.  Value: "datalink/customerImages"+_form.LogoName
        1. If you are obtaining the logo name from an attribute on a grid or card component, these can be referenced using:
        2. Grid: _selected. AttributeName
        3. Card Component: _current.AttributeName
      3. Expression: Tick
    4. Save all changes
  6. The image should now display inside the Area component.