PT Photo Gallery v2 Install

From ADF Docs
Revision as of 20:02, 22 October 2011 by Mcarroll (talk | contribs)
Jump to: navigation, search

Extract Photo Gallery Application

Download the Photo Gallery Application from the Community Site or from the SVN Repository.

Extract the zip files into the following directory: /ADF/apps/pt_photo_gallery/

ADF Configuration

The Photo Gallery Application is built within the ADF. The ADF must be installed in the site to run the Photo Gallery, follow the ADF Installation instructions.

  • Make sure the ADF is setup and running on the site. If the ADF is not setup, then follow the instructions for ADF Installation.
  • Open the sites 'ADF.cfc' (See Site Configuration (ADF.cfc) for more info) file (located in your site's /_cs_apps/ directory) in a text editor. Locate the Load the ADF Application into application space comment in the file. Add (or uncomment) the following command under the comment section:
loadApp("ptPhotoGallery");

Styles

There are several out of the box style options for the Photo Gallery application. The styles are defined in the following style sheets located in the /pt_photo_gallery/style/ directory within the ADF Photo GalleryApp directory:

  • ptPhotoGallery.css (/ADF/apps/pt_photo_gallery/style/ptPhotoGallery.css)


The recommended approach is to load this style sheet into your Base Plus One Template.

'Note:' the classes and styles defined for the Photo Gallery are targeted tightly for the layout generated by the Photo Gallery application and should not interfere with your site styles. However, it is a good idea to give these styles sheets higher precedence in your style definitions.

Import Elements

The Photo Gallery Application has several Custom Components defined within CommonSpot. The components have been exported and are available in the Photo Gallery's "exported-objects" folder located at the root of the Photo Gallery application directory (e.g. /ADF/apps/pt_photo_gallery/exported-objects/)

Optional: You may want to create a new category within the CommonSpot Element Gallery for 'Photo Gallery Elements'.

To import these objects, you will need to be an administrator for your site. If you are not a site administrator, consult your Server administrator for more information.

Import

Import Custom Elements in this order:

  1. Photo (Photo-Custom-Element.zip)
  2. Photo Category (Photo-Category-Custom-Element.zip)
  3. Photo Size (Photo-Size-Custom-Element.zip)
  4. Photo Gallery (Photo-Gallery-Custom-Element.zip)
  5. PTPhotoGallery Configuration (PTPhotoGallery-Configuration-Custom-Element.zip)

Import Metadata form:

  1. PhotoSizeRender (PhotoSizeRender-Metadata-Form.zip)
    1. Bind this form to the following Photo Gallery Render Handler
      1. Cycle
      2. Cycle Thumb Nav
      3. Grid

Verify Imports

The imported components' render handlers and custom field types must be verified. During the import process, the render handler and custom field types paths may have been changed to reflect the current site's path.

Review and update these paths to reference the ADF path. In most cases, this will just require to be unlocked and a change in the path from the site name to 'ADF'. Check the paths for the custom field types that were imported with the custom elements by unlocking them and fixing the explicit paths to point to "/ADF/extensions/".

If the custom elements that are imported contain custom field types that are already in the site, the naming convention for the custom field type will be unique. To resolve this, unlock the field types and elements, and reassign the element field type to the pre-existing field type.

Example: The Photo Category custom element contains two uses of the General Chooser field type, if the General Chooser field type is already installed on the site then the import process will attempt to import another General Chooser but with a new name such as "General Chooser_import_1250003208472." To resolve this issue, open the custom element and assign the field type (General Chooser_import_1250003208472) to the field type with the simple name General Chooser. Note that when you assign the existing general chooser you will need to click on the "properties" tab and enter "photoSizeGC" as the bean name. After reassigning the field type, delete the new imported field from the list of custom field types.

Site Configuration

The Photo Gallery App uses a custom element to store site specific configurations. The Photo Gallery App needs to know the profile element name, unique field, roles, subsite ids, and template ids for the site.

If you are installing the PT Photo Gallery application, there is no need to do anything with this element at this time. This element will be configured in a later step.

The fields for the Photo Gallery Configuration custom element are defined below.

Configuration Fields

There are six major components to the configuration:

  1. CE_FORM_ID - Photo custom element form ID within the site.
  2. ADD_URL - Site relative URL for the Photo Add page. (Example: /webadmin/photogalleryadmin/lightbox/Photo-Add.cfm)
  3. UPLOAD_FORM_URL - Site relative URL for the Photo Upload page. (Example: /webadmin/photogalleryadmin/lightbox/Photo-Upload.cfm)
  4. DISPLAY_URL - Site relative URL for rendering a photo to the user.
  5. UPLOAD_URL - URL Path on the server to store the uploaded photos. (Example: /_cs_apps/pt_photo_gallery/uploads/)
  6. UPLOAD_PATH - Server Path on the server to store the uploaded photos. (Example: D:/full/path/to/this/dir/_cs_apps/pt_photo_gallery/uploads/)
  7. UPLOAD_DOC_TYPES - Photo file types that are allowed to be uploaded. (Example: jpg,gif,bmp,png)

Build Templates/Pages

Subsites

It is highly recommended that a Photo Gallery webadmin subsite is created for Administrators and a Photo Gallery Lightbox subsite is created for the lightbox pages. This configuration allows subsite security to be used to allow only Administrators access to the webadmin subsite and also allows the CS toolbar to be turned off for the lightbox pages.

Your site may already have a webadmin and/or lightbox subsite. The steps below will add a photogallery subsite under the webadmin subsite and will add a lightbox subsite.

Web Admin

  1. Create a new subsite under the site root called webadmin.
  2. Create a new subsite under webadmin called photogallery.
  3. Configure the /webadmin/photogallery/ subsite Content Security to give 'No Rights' to 'Anonymous Users' and 'Authenticated Users'.
  4. Configure the /webadmin/photogallery/ subsite Content Security to give permissions to the group of administrators who will manage the Photos.

CCAPI

The Photo Gallery Application uses the ADF CCAPI to populate profile records and create profile pages. The CCAPI needs to be configured for the site and photo gallery application.

First, follow the steps to set up the CCAPI Config file for the site. Once that configuration is complete, follow the steps below to set up the CCAPI config for the Photo Gallery application. Make sure to update the wsVars section with the correct URLs and username/password.

Setup

  1. Create a new page called 'ccapiPhoto'. Recommend creating this page in the /webadmin/photogallery/ subsite.
  2. Add the 'Photo' element to the page.
  3. Select the 'Photo' element indicator and go to 'more...'. Select 'Name' from the menu.
  4. In the Element Name field, enter the text 'ccapiPhotoElement'.
  5. Publish this page and view in read mode.
  6. Edit the 'ccapi.xml' file for the site and add the following xml block into the <elements> section:
<Photo>
  <pageID>#####</pageID>
  <subsiteID>##</subsiteID>
  <elementType>custom</elementType>
  <controlName>ccapiPhotoElement</controlName>
</Photo>

To populate the <pageID> and <subsiteID> tags, view the source code for the 'ccapiPhoto' page that was just created.

Identify the following line in the source code and enter this numeric value into the <subsiteID> tag:

var jsSubSiteID = ##;

Identify the following line in the source code and enter this numeric value into the <pageID> tag:

var jsPageID = ####;

Reset the ADF for the server and site.

Admin Pages

Configuration

The Photo Gallery Configuration Pages will be used to manage the PTPhotoGallery Configuration custom element. Follow these steps to configure the datasheet and page for adding photos.

Steps
  1. Create a new page called 'Configuration Manager' in the /webadmin/photogallery/ subsite.
  2. In the main content of the page, add a Custom Script element.
  3. Enter the explicit module path for:
    1. /ADF/apps/pt_photo_gallery/customcf/photo_config_admin_ds.cfm
  4. From the Datasheet element interface, click the "Datasheet" icon.
  5. From the "Datasheet Views" dialog, follow the "Click here to create a new datasheet view" link.
  6. Enter the following information and then click "Next":
    1. Name: All Photo Gallery Configurations
    2. Private: unchecked
    3. Default View: unchecked
    4. Description: View to manage all of the Photo Gallery Configurations
    5. Datasheet Source: Form Result/Custom Element Sheet
  7. From the Datasheet Source dialog choose the "PTPhotoGallery Configuration" custom element and click "Next".
  8. From the Datasheet Columns Dialog choose a few columns from the Available Columns list and move them to the Selected Columns list. (UPLOAD_URL, Date Added, Last Date Modified, etc...) and then click "Finish".
  9. You will be brought to the Datasheet View page; click "Close" to return to your page.
  10. You will see the datasheet element on this page now. Click the Datasheet element interface icon again and this time choose "Edit Columns".
  11. From the Datasheet View Column Properties dialog choose the link for "Add a new action column".
  12. Within the Action Column Properties dialog enter the following information and click "Finish":
    1. Header: Edit
    2. Hide Header: Checked
    3. Column Text: edit
    4. Window Target Name: <leave blank>
    5. Modules: edit-form-data.cfm
  13. From the Datasheet View Column Properties dialog, choose the link for "Add a new action column" again.
  14. Within the Action Column Properties dialog enter the following information and click "Finish":
    1. Header: Delete
    2. Hide Header: Checked
    3. Column Text: delete
    4. Window Target Name: <leave blank>
    5. Modules: delete-form-data.cfm
  15. Close the Edit Column window.
  16. Publish the page.
Create Photo Gallery Configuration Record

Note that this step assumes that you have previously created the admin pages.

We are creating a single Photo Gallery Configuration element record to be used within the application.

Go to the Add Configuration page and submit the form to create one record.

These fields will be completed as the pages are built.

See the Site Configuration wiki page for more information on the fields and the correct values.

Reset the ADF for the server and site.

Photo Upload

The Photo Upload Page will be used to upload new photos into the Photo Element.

Steps
  1. Create a new page called 'Photo Upload' from the Lightbox Template and in the /lightbox/photogallery/ subsite.
  2. In the main content of the page, add a Custom Script element.
  3. From the Custom Script element interface, click the "Edit" icon.
  4. Enter the following text into the Explicit Module path: /ADF/apps/pt_photo_gallery/customcf/handle_photo_upload.cfm
  5. Publish the page.
Update Photo Gallery Site Config

Update the Photo Gallery Configuration for the UPLOAD FORM URL field. Edit the row in the datasheet and select the CommonSpot page that was created.

Reset the ADF for the server and site.

Photo Display

The Photo Display Page will be used to render a photo to the user.

Steps
  1. Create a new page called 'Photo Display' from the Lightbox Template and in the /lightbox/photogallery/ subsite.
  2. In the main content of the page, add a Custom Script element.
  3. From the Custom Script element interface, click the "Edit" icon.
  4. Enter the following text into the Explicit Module path: /ADF/apps/pt_photo_gallery/customcf/photo_display.cfm
  5. Publish the page.
Update Photo Gallery Site Config

Update the Photo Gallery Configuration for the DISPLAY URL field. Edit the row in the datasheet and select the CommonSpot page that was created.

Reset the ADF for the server and site.

Photo Admin Manager

The Photo, Photo Category, and Photo Size are global custom elements. Managing data for these global custom elements can be configured easily through the use of Datasheets. The following sections will describe how to configure a CommonSpot page to manage the data for the elements.

Steps
  1. Create a new page with the title 'Photo Manager' and page name 'index' from the Base Plus One template and designate creation of the page in the /webadmin/photogallery/ subsite.
  2. In the main content of the page, add a Custom Script element.
  3. From the Custom Script element interface, click the "Edit" icon.
  4. Enter the following text into the Explicit Module path: /ADF/apps/pt_photo_gallery/customcf/manager_layout.cfm
  5. Publish this page.

Photo Admin Datasheet

The Photo Gallery element is a global custom element. Managing data for global custom elements can be configured easily through the use of Datasheets. The following sections will describe how to configure the datasheet to manage the photo element data.

Steps
  1. Open the Photo Manager page in author mode.
  2. On the first tab labeled "Photo" is a Datasheet element.
  3. From the Datasheet element interface, click the "Datasheet" icon.
  4. From the "Datasheet Views" dialog, follow the "Click here to create a new datasheet view" link.
  5. Enter the following information and then click "Next":
    1. Name: All Photos
    2. Private: unchecked
    3. Default View: unchecked
    4. Description: View to manage all of the photos
    5. Datasheet Source: Form Result/Custom Element Sheet
  6. From the Datasheet Source dialog choose the "Photo" custom element and click "Next".
  7. From the Datasheet Columns Dialog select the columns PhotoID, Photo, Title, Category from the Available Columns list and move them to the Selected Columns list and then click "Finish".
  8. You will be directed to the Datasheet View page. Click "Close" to return to your page.
  9. You will now see the datasheet element on this page. Click the Datasheet element interface icon again and choose "Edit Columns".
  10. From the Datasheet View Column Properties dialog, select the PhotoID column, then edit. Update the following settings for column:
    1. Change the Render Handler to the following file: /ADF/apps/pt_photo_gallery/datasheet-modules/photo-update-edit-form-data.cfm
  11. From the Datasheet View Column Properties dialog, select the Category column, then edit. Update the following setting for column:
    1. Change the Render Handler to the following file: /ADF/apps/pt_photo_gallery/datasheet-modules/category-display-render.cfm
  12. From the Datasheet View Column Properties dialog, select the Photo column, then edit. Update the following setting for column:
    1. Change the Render Handler to the following file: /ADF/apps/pt_photo_gallery/datasheet-modules/photo-image-preview-display-render.cfm
  13. Close the Edit Column window.
  14. Set the datasheet layout to sort by the Title field and results per page to 25.
  15. Publish this page.

Photo Category Admin Datasheet

The Photo Gallery Category element is a global custom element. Managing data for global custom elements can be configured easily through the use of Datasheets. The following sections will describe how to configure the datasheet to manage photo element data.

Steps
  1. Open the Photo Manager page in author mode.
  2. On the second tab labeled Category is a Datasheet element.
  3. From the Datasheet element interface, click the "Datasheet" icon.
  4. From the "Datasheet Views" dialog, follow the "Click here to create a new datasheet view" link.
  5. Enter the following information and then click "Next":
    1. Name: All Categories
    2. Private: unchecked
    3. Default View: unchecked
    4. Description: View to manage all of the photos
    5. Datasheet Source: Form Result/Custom Element Sheet
  6. From the Datasheet Source dialog, choose the "Photo Category" custom element and click "Next".
  7. From the Datasheet Columns dialog, select the columns CategoryID, Title, and Directory from the Available Columns list and move them to the Selected Columns list.
  8. You will be directed to the Datasheet View page. Click "Close" to return to your page.
  9. You will now see the datasheet element on this page. Click the Datasheet element interface icon again and choose "Edit Columns".
  10. From the Datasheet View Column Properties dialog, select the CategoryID column, then edit. Update the following settings for column:
    1. Change the Render Handler to the following file: /ADF/extensions/datasheet-modules/1.0/edit-delete.cfm
  11. Close the Edit Columns window.
  12. Publish this page.

Photo Size Admin Datasheet

The Photo Size element is a global custom element. Managing data for global custom elements can be configured easily through the use of Datasheets. The following sections will describe how to configure the datasheet to manage the Photo Size element data.

Steps
  1. Open the Photo Manager page in authormode.
  2. On the third tab labeled "Size" is a Datasheet element.
  3. From the Datasheet element interface, click the "Datasheet" icon.
  4. From the "Datasheet Views" dialog, follow the "Click here to create a new datasheet view" link.
  5. Enter the following information and then click "Next":
    1. Name: All Photo Size
    2. Private: unchecked
    3. Default View: unchecked
    4. Description: View to manage all of the photo sizes
    5. Datasheet Source: Form Result/Custom Element Sheet
  6. From the Datasheet Source dialog, choose the "Photo_Size" custom element and click "Next".
  7. From the Datasheet Columns dialog select the columns SizeID, Title, Directory, Width, Height, Type and move them to the Selected Columns list then click "Finish".
  8. You will be directed to the Datasheet View page. Click "Close" to return to your page.
  9. You will now see the datasheet element on this page. Click the Datasheet element interface icon again and choose "Edit Columns".
  10. From the Datasheet View Column Properties dialog, select the SizeID column, then edit. Update the following settings for column:
  11. Change the Render Handler to the following file: /ADF/extensions/datasheet-modules/1.0/edit-delete.cfm
  12. Close the Edit Columns window.
  13. Publish this page.

Reset the ADF

Reset the ADF for the server and site.