JavaScript Modification

This article contains the following topics:
casm1401
This article contains the following topics:
The CA SDM web interface makes extensive use of JavaScript and includes a number of JavaScript files in the /CAisd/scripts directory. If you decide to modify any of these script files, place the modified version in /CAisd/sitemods/scripts, as described in Directories Used by Your HTTP Server.
For performance reasons, the JavaScript files delivered in the /CAisd/scripts directory are compressed, with comments and unnecessary white space removed. This compression can make them difficult to read. You can find uncompressed versions of all JavaScript files in one of the following directories:
  • (UNIX) $NX_ROOT/sdk/scripts
  • (Windows) $NX_ROOT/sdk/scripts
If possible, avoid creating modified versions of entire JavaScript files, because each file contains a number of functions and you may only want to modify one function. In most cases, you can override individual functions by placing a modified version in the JavaScript file sitemods.js. We strongly recommend that you take this approach when modifying JavaScript.
sitemods.js
A skeleton
sitemods.js
file is distributed with CA SDM. All distributed HTMPL files include this file at the end of their <head> section, making it the last JavaScript file loaded. Because it is the last file, any functions defined in it override functions with the same name included earlier. This lets you provide your own version of a distributed JavaScript function without directly modifying distributed code.
This approach is not effective for functions invoked at load time in the <head> section, such as those in menubar.js and ahdmenus.js.
However, you can modify most JavaScript functions by completing the following steps:
  1. Place a modified version of the function in sitemods.js.
  2. Store the updated copy of sitemods.js in CAisd/site/mods/www/wwwroot/scripts.
Modifying Context Menus
A number of forms within CA SDM use context menus, accessed by right-clicking an object. Using the Web Screen Painter, you can modify context menus to add, remove, or modify their items.
For more information about adding menu items, see the
Web Screen Painter Help
.
Updating and Creating Change Orders as Employee User
By default, a user can only view change orders from the Employee web interface. You can enable creating and updating change orders by employees:
Follow these steps:
  1. Sign on to the web as the Administrator, and select the Administration tab.
  2. Select Access Type from the Security menu.
    The Access Type List appears.
  3. Select the Employee link to display the Employee Access Type Detail window.
  4. Set the Change Orders to "modify" under the Function Access tab and save.
  5. Click the Back button to return to the Administration tab, and then select Data Partitions, Data Partition List.
  6. Click Employee to display the Data Partition Detail window. On the Constraints List portion of the window, review the Type column for following Change_Request Tables:
    • Pre-Update
    • Create
  7. For each Table that you want to edit, click the Table name to display that table's Data Partition Constraint Detail window.
  8. Click the Edit button.
  9. Edit the constraint as follows:
    change "id = 1" to "affected_contact = @root.id".
  10. Click Save.
Now when you login to the web interface as an employee user, the
Create Change Order
link appears.
Add a "Closed Change Orders" link to the Employee Scoreboard
You can use the product to add a Closed Changes node option to the Employee web interface scoreboard.
Follow these steps:
  1. Log in to the product as an Administrator.
  2. Click the Service Desk tab.
  3. Select File, Customize Scoreboard.
    The Customize Scoreboard dialog appears.
  4. Click the Role option and select Employee in the drop-down list.
  5. Under Add New Node, click the Node's Stored Query link.
    The Stored Query List dialog appears.
  6. Search and select Closed Changes from the Stored Query list. This is typically displayed as code CHGUBIN7.
  7. Specify a location for the new node by selecting an item in the scoreboard tree on the left.
  8. Click Add New Node.
    The new node named Closed Changes is added to the scoreboard tree.
  9. Click Finished.
Download Attachments
When you download an attachment in CA SDM, it automatically displays the attachment in the browser window without prompting for a response from you. This action can be dangerous if a virus is associated with the attachment.
With CA SDM, you can force a save-as dialog that prompts you to respond if you want to save the attachment on the disk or open it. Saving an attachment can be a secure method because you can save the attachment on the disk and scan it before you can actually open it. You also have the option to force the save-as dialog only on certain attachment types.
You can force the save-as dialog to appear through the web.xml servlet configuration file. The web.xml file is located at the following paths:
Windows: $NX_ROOT\bopcfg\www\CATALINA_BASE\webapps\CAisd\WEB-INF\web.xml
Linux: $NX_ROOT is “/opt/CAisd”