Skip to end of metadata
Go to start of metadata

Functional Specification

OFJ-1661

There are currently three types of systems in use by OpenFISMA, they are "General Support System", "Major Application", and "Minor Application". These are hard coded into the application and cannot be modified by the administrator. We would like to create a GUI interface to modify system types very similar to the functionality created in OFJ-1284 for organization types.

Mockups

View All System Types Screen

Notice that all toolbars in this document are for illustration only. The toolbars for this feature should use the system-wide default toolbar.

 


View Single Record System Type Screen


Edit Single Record System Type Screen

Select Image Screen

This should be a dialog or menu -- not a full-page refresh. The dialog can be modal if that makes implementation easier, but a non-modal dialog is preferred.

Technical Specification

The majority of this is straight forward and will be approached similar to the implementation of OFJ-1284 where we changed the organization type enumeration into a join. It will require adding a new model, integrating that model into the search engine, and writing a migration to convert existing enumerated values into their corresponding foreign keys.

Image Picker

The unique aspect here is definitely the image picker. I'm going to implement the image picker as a javascript class wrapped by a zend form element. The image picker will take a list of image IDs as its parameter, as well as a server side URL for uploading a new image.

When the user clicks the "Select Image" button, I'll expand the icon input area to show a grid of icons. The icons will not be explicitly sorted. The currently selected icon (if any) will be highlighted with a selection box. Clicking a new icon will move the selection box and update a hidden form field that contains the corresponding image ID.

On the server side, there are three actions required.

  1. The form handler for this new model needs to be able to validate the image ID of the selected icon and save it to the SystemType model.
  2. The controller needs to serve images by image ID. The picker will construct URLs to this action in order to fetch the images that it needs.
    1. There will be no ACL for this action since it doesn't contain sensitive information (hopefully!) and 
  3. The controller needs to offer an upload image capability. This will upload an image, convert it to PNG format (if not already PNG format), resize it to the required dimensions (the required dimensions will be hardcoded to our existing icon size), store it (using File Manager), and then store a reference in a new model called System Icon.
    1. Image conversion and resizing will be performed by the php5-imagemagick plugin.

The rest of the details, such as rendering the input element, will be handled by the javascript class and it's Zend_Form_Element wrapper.

These controller actions will operate on a new model, called something like "Icon". This model will represent icons used both for system AND organization (and possibly others in the future). This model contains a few properties:

  • id
  • largeIconId => pointer to file manager representing the icon in 32 x 32 pixels
  • smallIconId =>pointer to file manager representing the icon in 16 x 16 pixels 

Notice that the same set of icons will be available to the Organization screen and the System screen – we won't keep track of which ones belong to each.

We currently have three images that can be used as system icons (the gss icon, the major app icon, and the minor app icon). These three need to be moved out of public/images and into the file manager (similar to http://git.openfisma.org/?p=openfisma.git;a=tree;f=data/uploads/70;h=ee7675a1e2783162f1db0b646086d3c9c9a59164;hb=HEAD;js=1). I'll write fixtures and a migration to add fixtures for these pre-installed icons.

Collateral Impact

The addition of the join table will affect any screen where we display a system type label and/or icon, including, but not limited to:

  • Finding Summary
  • System Inventory
  • Reports

After I implement this, I'll walk through each screen carefully to verify that I haven't broken anything.

Additional Improvements

If there's time:

  • Add the same icon picker to the organization type screen.
  • Add some additional icons beyond the 3 that we currently ship with.
  • Ability to remove icons that have been uploaded. (This functionality is not specified yet.)
Labels:
  1. Feb 16, 2012

    Comments will respect to Technical Specification:
    • A third action is required by the controller: to serve out images.  The FileManager has most of the code for this, but we stopped short of providing a controller action, for ACL reasons.
    • All that's needed to refer to an image is its ID, passing a URL to the client is redundant.
    • A new database model will be needed to manage the collection of icons (essentially two columns: id and uploadId).
    • Any standard for the sorting of the icons?
    1. Feb 22, 2012

      Updated to address your feedback.