123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2021
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml,messages/AGS.xml,messages/portalRL.xml" requiredCapability="canUseEventStudio">
- <!--
- ===============================================================================================
- formlogic_init - standard form logic initialization
- Note the condition here which checks the dialog source[ps_nav_source] from the last stack operation against the current morphlet[m].
- The new dialog will not be pushed onto the stack if they are the same thus preventing multiple consecutives instances of the same dialog.
- ===============================================================================================
- -->
- <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" mandatory="false" condition=".[ /root/env/param[@name = 'm'] != /root/env/param[@name='ps_nav_source']]"/>
- <!--
- ================================================================================
- Page Renderer
- ================================================================================
- -->
- <xts:block id="page" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="formlogic_init">
- <!-- get the debug logic sheet -->
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <!-- get the new theme stuff -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xts:logicsheet path="ags/logicsheets/dialogs.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <!-- apply the form logic -->
- <xts:logicsheet path="logicsheets/formlogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:ags="http://developer.cognos.com/schemas/xts/ags" exclude-result-prefixes="xsl xts lyt pf dp df dbg utml xtsext">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <!-- Global template variables -->
- <pf:variables/>
- <df:variables/>
- <!-- start the output -->
- <xsl:template match="/root">
- <dp:page>
- <link href="{$skin_root}/ags/ags.css" type="text/css" rel="stylesheet"/>
- <utml:form name="pform" method="post" action="{$gateway}">
- <utml:input type="hidden" name="hid" id="hid" utml:update="false" value="ug_cr_as_ag_wrk_dfn_prm"/>
- <!-- ================================================================ -->
- <!-- HEADER -->
- <!-- ================================================================ -->
- <dp:header>
- <dp:title>
- <xts:string id="DIALOG_PARAMETER_LABEL"/>
- </dp:title>
- <dp:description>
- <xts:string id="DIALOG_PARAMETER_DESCRIPTION"/>
- </dp:description>
- <dp:close>
- <a href="#" onclick="parent.getConfigFrame().hideDialogFrame();">
- <dp:closeMarker/>
- </a>
- </dp:close>
- </dp:header>
- <!-- ================================================================ -->
- <!-- B O D Y -->
- <!-- ================================================================ -->
- <body>
- <lyt:layout style="1">
- <lyt:section>
- <!-- Name -->
- <dp:input>
- <dp:section1>
- <xts:string id="DIALOG_PARAMETER_NAME"/>
- </dp:section1>
- <!-- creates a new row -->
- <dp:section2>
- <utml:input type="text" name="parameter_name" id="parameter_name" size="50"/>
- <!-- add another hidden input here - FORM behaviour is to submit the form on ENTER if we have a single text field -->
- <!-- add another hidden text field here to stop this - we could do a form submit handler - but that's going to be hard to track -->
- <input type="text" name="cancel_enter" id="cancel_enter" size="0" style="display:none"/>
- </dp:section2>
- </dp:input>
- <!-- body -->
- <!--dp:choice>
- <dp:section1>
- <utml:input type="checkbox" name="accept_range" id="accept_range" value="false"/>
- </dp:section1>
- <dp:section2>
- <xts:string id="DIALOG_PARAMETER_CHECKBOX_ACCEPT_RANGE"/>
- </dp:section2>
- </dp:choice-->>
- </lyt:section>
- </lyt:layout>
- </body>
- <!-- ================================================================ -->
- <!-- F O O T E R -->
- <!-- ================================================================ -->
- <dp:footer>
- <df:button df:id="IDS_OK" df:style="href" df:href="#" onclick="return doOK();" />
- <df:button df:id="IDS_CANCEL" df:style="href" df:href="#" onclick="parent.getConfigFrame().hideDialogFrame();"/>
- <df:button df:id="IDS_APPLY" df:style="href" df:href="#" onclick="return doApply();"/>
- </dp:footer>
- </utml:form>
- <dp:script>
- <pf:help context="ug_cr_as_ag_wrk_dfn_prm" eventStudio="true"/>
- <script type="text/javascript" src="../ags/help.js"/>
- <script type="text/javascript">
- // get access to the config Frame
- var cf = parent.getConfigFrame();
- var adding = <xsl:choose><xsl:when test="/root/env/param[@name='method'] = 'add'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose>;
- var saved_name;
- var paramTree = new Array();
- var currentParamNode;
- var dirty=false;
- function hasChanged() {
- return dirty;
- }
- function trim(line)
- {
- var re = /^\s*|\s*$/g;
- return line.replace(re,"");
- }
- function getName()
- {
- return htmlEncode(trim(document.pform.parameter_name.value));
- }
- <!-- encode the html metacharacters -->
- function htmlEncode(string)
- {
- var returnString = string.replace(/&/g, "&amp;");
- returnString = returnString.replace(/"/g, "&quot;");
- returnString = returnString.replace(/</g, "&lt;");
- returnString = returnString.replace(/>/g, "&gt;");
- returnString = returnString.replace(/'/g, "&apos;");
- return returnString;
- }
- function onInputChanged() {
- dirty=true;
- return true;
- }
- /*
- * Initialize the define parameter dialog
- */
- function init() {
-
- cf.addEvent(document.getElementById('parameter_name'),"change",onInputChanged);
- if (!adding) {
- var nodeRef = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name = 'nodeRef']))"/>"
- if (nodeRef && nodeRef != '') {
- currentParamNode = cf.getTreeNode(cf.getParametersTree().getName(), nodeRef);
- }
- document.pform.parameter_name.value = currentParamNode.getValue().name;
- //document.pform.accept_range.checked = currentParamNode.getValue().acceptRange;
- cf.changeMenu(cf.TAB_PARAMETERS);
- if (cf.browserCheck.isIE5Up()) {
- document.pform.parameter_name.attachEvent("onblur", updateDlgParams);
- }
- else if (cf.browserCheck.isNav6Up()) {
- document.pform.parameter_name.addEventListener("blur",updateDlgParams,true);
- }
- }
- var treeNodes = cf.getTreeChildNodes(cf.getParametersTree());
- var nodeId = currentParamNode && currentParamNode != 'undefined'?currentParamNode.getId():"";
- for (var i=0;i<treeNodes.length;i++) {
- //Copy all the ones we are not editintg.
- if (nodeId != treeNodes[i].getId()) {
- paramTree.push(treeNodes[i]);
- }
- }
- //cf.showDialogFrame("30%");
- //Show it now
- cf.showDialogFrame(220);
- // set the focus into the parameter name item
- document.pform.parameter_name.focus();
- }
- //take what was passed and update it to what is on the screen, ready for a navigate away and back
- function updateDlgParams(){
- //cf.dlgSetParm("editedNode", currentParamNode);
- }
- function doApply()
- {
- var result = false;
- if (validate()) {
- // just have to create or amend the parameter
- result = process();
- dirty=false;
- }
- return result;
- }
- // function which is called when we ok
- function doOK()
- {
- var result = false;
- if (validate()) {
- // create or amend the calculation
- result = process();
- }
- if (result) {
- cf.hideDialogFrame();
- }
- return result;
- }
- // create the parameter object
- function process()
- {
- // get the name and trim whitespace from the front and the end
- var name = getName();
- // get the parameter usage boolean
- // var range = document.pform.accept_range.checked;
- // create the parameter
- var obj = cf.createParameterObj(name, false);
- // revise the item in the tree
- if(currentParamNode && currentParamNode !='undefined') {
- // just a change in expression and revise entry
- currentParamNode = cf.updateParameter(obj, currentParamNode);
- } else {
- currentParamNode = cf.updateParameter(obj);
- }
- return true;
- }
- // validate the dialog
- function validate() {
- // trim the parameter name
- var name = getName();
-
- // check that we have a parameter name
- if (name.length == 0) {
- // throw up an alert box
- alert("<xts:string id="DIALOG_PARAMETER_NO_NAME" encode="javascript"/>");
- // we're not valid
- return false;
- }
-
- //We should always compare against the tree we have copied
- //if we are adding then it will hold only the items before adding
- //a new one, and if we are editing this copy we have will exclude
- //the node we are editing.
- //if (cf.nameInTree(name,paramTree)) {
- if (cf.getNodeFromTreeWithValue(name,"name", paramTree)) {
- alert("<xts:string id="DIALOG_PARAMETER_DUPLICATE_NAME" encode="javascript"/>");
- // this is bad
- return false;
- }
- // things are ok - so can proceed
- return true;
- }
- </script>
- </dp:script>
- </dp:page>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- =========================================================================================
- D E B U G B L O C K
- =========================================================================================
- -->
- <xts:block id="debug" type="exec" mode="output" processor="XSLT" condition=".[/root/session/param[@name = 'debug'] = '1']" mandatory="false" mimeType="text/html" dependency="page">
- <!-- Get the debug logicsheet. -->
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <dbg:dumpxml select="/root"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|