Custom Site Extensions

Custom site extensions extend a site with custom logic that applies to an extensible object.

You can create custom site extensions for most Geocortex Essentials objects. To find out if you can extend a particular type of object, edit an object of that type in Manager and check whether it has a Properties hyperlink. If the object has a Properties hyperlink, you can create a custom site extension for the object. For example, to find out if you can extend print templates, edit a print template in Manager—you will see the Properties hyperlink at the bottom of the Edit Print Template page. This means that you can extend print templates.

Example

Suppose you want to configure the visibility of the fields in a layer, as well as an alias for each field. You can do this using the following site extension:

<Layer Name="Zip Codes">
   <Extensions>
      <Extension Assembly="Extensions" ClassName="Extensions.FieldsCollection">
         <FieldsCollection>
            <Field Name="PO_Name" Alias="PO Name" Visible="true" />
            <Field Name="ZIPCODE" Alias="Zip Code" Visible="true" />
         </FieldsCollection>
      </Extension>
   </Extensions>
</Layer>

Create a Custom Site Extension

The procedure below outlines the main steps to create a custom site extension.

To create a custom site extension:

  1. Create and verify the core part of your site before deploying the extended portion.

  2. In the development environment:

    1. Create a class for each extension.

    2. Implement the extension’s logic.

    3. Compile the assembly or assemblies.

  3. Deploy the assemblies and add the extension to the site

    It is important to perform these steps in the order given. Site validation will fail if you deploy a site containing references to assemblies that do not exist.

    1. Copy the assemblies to anywhere within the Sites folder.

      Deploying or redeploying a custom assembly causes all your sites to reload. The site is unavailable to users while Essentials loads the site.

      Place assemblies that will be used by only one site in the site’s folder. Create an Extensions folder up one level to deploy assemblies that will be used by more than one site.

    2. Open the Site.xml file for editing.

    3. Add an Extensions element immediately after the extensible element that the property applies to.

    4. Add an Extension element beneath the Extensions element.

    5. Give the Extension element an Assembly attribute and assign it the name of the extension’s assembly.

    6. Give the Extension element a ClassName attribute and assign it the value of the extension's class name.

    7. If you are configuring more than one extension, add a collection element beneath the Extension element.

      The collection element must be named after the class. For example, if the class name is AssemblyName.SomeCollection, then the collection element must be named SomeCollection.

    8. Add each element in the collection and give it a Name attribute, plus whatever other attributes you want it to have.

      If you are configuring a single element, you can skip this step—you do not need a collection element.

    9. Repeat steps d - h for each extension that you created for this extensible element.

    10. Repeat steps c - i for each extension class that you created.

    11. Confirm your configuration by comparing it to the following example:

      <Extensions>
         <Extension Assembly="Extensions" ClassName="Extensions.FieldsCollection">
            <FieldsCollection>
               <Field Name="PO_Name" Alias="PO Name" Visible="true" />
               <Field Name="ZIPCODE" Alias="Zip Code" Visible="true" />
            </FieldsCollection>
         </Extension>
      </Extensions>
    12. Save the Site.xml file and browse the Sites folder to confirm the extensions.

    13. Use the extensions in applications.

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 4.11