Tuesday, June 1, 2021

Javascript Injection in Manage 2000 Web Functions Q&A



What is it?

WEB.CONSTANTS and FN.BUILD have prompts for Custom Javascript.

The scripts stored in WEB.CONSTANTS and FN.BUILD are downloaded to any Manage 2000 web site accessing that Manage 2000 account, during IIS application initialization. 

The scripts in WEB.CONSTANTS are injected into every web page. 



FN.BUILD script entries are only injected into web pages of that particular function.


In order to ensure that all other resources are loaded, scripts should be enclosed in a jQuery document ready call:

<script>
$j(document).ready(function(){...}
</script>


What is its upgrade path expense profile?

Since the scripts are stored in Manage 2000 files on the Unidata server, any custom scripts automatically migrate to new service packs and survive web server replacements.  It is possible some adjustment to script logic may be required due to changes in the mark-up or code-behind of web functions, but for the most part the scripts float along with other configuration items stored in any Manage 2000 User type account like ACME.MAIN.

In what release did it become available?

Custom Javascript Injection was first introduced in Manage 2000 release 8.1 sp1.

How can it be used?

Manage 2000 web functions include access to jQuery.js and Prototype.js.  In desktop view jQueryUI is also available, and in mobile view jQueryMobile is available.  There are also many Manage 2000 javascript functions available from the roiGlobal.js library.  Therefor brief scripts can accomplish significant adjustments to the Manage 2000 web functions.

For instance, 8.1sp4 introduced many collapsible panels which improve navigation on mobile devices. However, they quickly become annoying on desktop devices with large screens. A standard solution is coming in 8.1sp5 which will add the overlooked state memory to the panels so they remain in the state last set by the user. For those on 8.1sp4 a simple solution to this annoyance can be made through Custom Javascript Injection:

<script>
$j(document).ready(function(){
$j('.accordion-expand-all a').trigger( "click" );});
</script>

Add this to WEB.CONSTANTS and restart the IIS application accessing the account and EVERY page with collapsible panels will begin with all of the panels expanded.

This becomes a very powerful way to make adjustments to Manage 2000 web functions without introducing custom components on the web server.