Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twonjee2002/97d2b953e9739381a9cd4e0544aee4b6 to your computer and use it in GitHub Desktop.
Save twonjee2002/97d2b953e9739381a9cd4e0544aee4b6 to your computer and use it in GitHub Desktop.
docommand
function docommand(cmdname)
{
var browser = navigator.appName.substring ( 0, 9 ); // Get the browser name
if(!FragmentUtil.checkWindowChanges(cmdname))
{
return;
}
cmdname = stripSpacesFromEnds(cmdname);
cmdname = validateCommand( cmdname);
updatedFormsField( "WS_initState", cmdname );
// Check whether this is a command line enquiry or not
var prefix = cmdname.substring(0,4);
var queryPrefix = cmdname.substring(0,6);
var menuPrefix = cmdname.substring(0,5);
var startChar = cmdname.substring(0,1);
if ( (prefix == _API_ + " ")||(cmdname == _API_))
{
//API processing
doapi(cmdname);
return;
}
if ( prefix == _TAB_ + " ")
{
// Process the TAB
dotab(cmdname);
return;
}
if ( prefix == _WSP_ + " ")
{
// Process the worksapce
doworkspace(cmdname);
return;
}
if ( prefix == _ENQ_ + " " )
{
// If this is an enquiry on an application screen that has an editable transactionId box,
// then set the dropdown field so we can pick from the result to that id box
var dropfield = '';
if(isAppAutoLaunch)
{
dropfield = '';
isAppAutoLaunch = '';
}
else
{
dropfield = getEnquiryDropfield();
}
// Process the enquiry
doEnquiryRequest(_SELECTION_, cmdname, dropfield, "", "", "", cmdname, "", _DISPLAY_);
}
else if ( prefix == _COS_ + " ")
{
// Process the composite screen
docompositescreen(cmdname);
}
else if ( ( menuPrefix == _MENU_ + " ") || ( startChar == "?" ) )
{
// Process the menu
domenu(cmdname);
}
else if ( queryPrefix == _QUERY_ + " ")
{
// Run the enquiry with no selection criteria
doenqRun(cmdname);
}
else if ( prefix == _UTIL_)
{
// Get the routine name to run
var routineName = cmdname.split(" ")[1];
// Clean up the command to just leave the arguments supplied
var args = cmdname.replace( _UTIL_ + " ", "");
args = args.replace( routineName, "");
// Remove any leading spaces from args.
args = args.replace(" ", "");
// Send utility request.
buildUtilityRequest(routineName, args, "", "", "", "", "", "", "");
}
else if ( ( menuPrefix == "https" ) || ( menuPrefix == "HTTPS" ) )
{
createWebWindow( cmdname );
}
else if ( ( prefix == "http" ) || ( prefix == "HTTP" ) )
{
createWebWindow( cmdname );
}
else if ( ( menuPrefix == "file:" ) || ( menuPrefix == "FILE:" ) )
{
createWebWindow( cmdname );
}
else if ( ( prefix == "www." ) || ( prefix == "WWW." ) )
{
createWebWindow( "http://" + cmdname );
}
else if ( ( prefix == "url " ) || ( prefix == "URL " ) )
{
var url = cmdname.substring(4, cmdname.length);
docommand( url );
}
else if ( (prefix.substring(0,3) ) == _PW_ + " ")
{
createPwProcess(cmdname);
}
else
{
processGeneralCommand(cmdname,browser);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment