123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2009
- 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
- ===============================================================================================
- -->
- <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt"/>
- <!--
- ================================================================================
- 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/condition-ui-templates.xslt"/>
- <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/controls/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/controls/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:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
- xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/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:agscnd="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/condition/"
- xmlns:ags="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/condition/"
- xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg utml xtsext agscnd agsdlg cm ags">
-
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
- <!-- Global template variables -->
- <pf:variables/>
- <df:variables/>
- <dp:variables/>
- <pf:gen-icon/>
- <xsl:variable name="form-read-only">false</xsl:variable>
- <!-- start the output -->
- <xsl:template match="/root">
- <xsl:text disable-output-escaping="yes"><!DOCTYPE html></xsl:text>
- <dp:page>
- <!-- specify the style sheet(used to render the active/inactive hint text)
- todo move this into its own xslt file. Do not put it into the dp stuff because that is relevant to the whole portal
- -->
- <link href="{$skin_root}/ags/ags.css" type="text/css" rel="stylesheet"/>
- <link href="{$skin_root}/ags/crn.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_crt_calc"/>
- <!--utml:exclusion-list>
- <xsl:value-of select="' method '"/>
- </utml:exclusion-list-->
- <!-- put some variables in for the validation -->
- <utml:input type="hidden" name="inlineSpec" id="inlineSpec" value=""/>
- <!-- hack to specify that we need to build the run options -->
- <dp:header>
- <dp:meta>
- <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
- </dp:meta>
- <dp:title>
- <xts:string id="DIALOG_DATAITEM_LABEL"/>
- </dp:title>
- <dp:description>
- <xts:string id="DIALOG_DATAITEM_DESCRIPTION"/>
- </dp:description>
- <dp:close>
- <a href="#" onclick="parent.getConfigFrame().hideDialogFrame();">
- <dp:closeMarker/>
- </a>
- </dp:close>
- </dp:header>
- <!-- ================================================================ -->
- <!-- B O D Y -->
- <!-- ================================================================ -->
- <!-- have to define the list of exluded tabs -->
- <lyt:layout style="1">
- <lyt:section>
- <dp:box title="DIALOG_DATAITEM_NAME" noSpace="true">
- <dp:boxSection valign="top" hgap="30">
- <utml:input type="text" name="dataItem_name" id="dataItem_name" size="70"/>
- <!-- 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:boxSection>
- <!-- This has been removed for now It might be reintroduced in the future -->
- <!-- This key is supposed to indicate whether this dataitme is to be added -->
- <!-- as an event key. -->
- <!--dp:boxSection valign="middle">
- <utml:input type="checkbox" name="di_insert" id="di_insert" value="false" />
- </dp:boxSection>
- <dp:boxSection>
- <xts:string id="DIALOG_DATAITEM_INCLUDE_EVENT_KEY"/>
- </dp:boxSection-->
- </dp:box>
- </lyt:section>
- <agscnd:dataItemUI>
- <agscnd:param name="textareaId">dataItem_expression</agscnd:param>
- <agscnd:param name="errorDiv">errorDataItem</agscnd:param>
- <agscnd:param name="infoDiv">infoDataItem</agscnd:param>
- </agscnd:dataItemUI>
- </lyt:layout>
- <!-- footer -->
- <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_crt_calc" eventStudio="true"/>
- <script type="text/javascript" src="../ags/help.js"/>
- <script type="text/javascript" src="../ags/dragDropHandler.js">//</script>
- <script type="text/javascript" src="../ags/agentTreeObjects.js">//</script>
- <script type="text/javascript">
- 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 dataItemTree = new Array();
- var currentDataItemNode;
- var dirty=false;
-
- function hasChanged() {
- return dirty;
- }
-
- function trim(line)
- {
- var re = /^\s*|\s*$/g;
- return line.replace(re,"");
- }
-
- function getName()
- {
- return trim(document.pform.dataItem_name.value);
- }
-
- function getExpression()
- {
- return trim(document.pform.dataItem_expression.value);
- }
-
- function processDataItem()
- {
- // get the name and the expression - and trim whitespace from the front and the end
- var name = getName();
- //hold the calculation items by their calc name as the id
- var old_name = currentDataItemNode ? currentDataItemNode.getValue().name : "?";
- cf.getAgentItemsListener().updateId(name, old_name, window.name);
-
- var expression = getExpression();
- var aggregate = "automatic";
- // create the expression
- var obj = cf.createDataItemObj(name, expression,aggregate);
- //This has been edited so we should not allow auto delete.
- obj.isDeletable = false;
-
- if (currentDataItemNode && currentDataItemNode != 'undefined') {
- aggregate = currentDataItemNode.getValue().regularAggregate;
- currentDataItemNode = cf.updateDataItem(obj,currentDataItemNode);
- } else {
- currentDataItemNode = cf.updateDataItem(obj);
- }
- return true;
- }
- function doApply()
- {
- var result = false;
- if (validate()) {
- // just have to create or amend the data item
- result = processDataItem();
- dirty=false;
- }
- return result;
- }
- // function which is called when we ok
- function doOK(evt)
- {
- var result = false;
- var name = getName();
- if (validate()) {
- // create or amend the data item
- result = processDataItem();
- }
- if (result) {
- cf.hideDialogFrame();
- }
- return result;
- }
- // function to make sure that we add a subject
- function validate()
- {
- var name = getName();
- var expression = getExpression();
- // check that we have a data item name
- if (name.length == 0) {
- // throw up an alert box
- alert("<xts:string id="DIALOG_DATAITEM_NO_NAME" encode="javascript"/>");
- // we can't exit here
- return false;
- }
- // check that we have a data item expression
- if (expression.length == 0) {
- // throw up an alert box
- alert("<xts:string id="DIALOG_DATAITEM_NO_EXPRESSION" encode="javascript"/>");
- // we can't exit here
- return false;
- }
-
- // have to make sure that we don't have special characters in the data item name either.
- // check to see if we have special characters.
- if (name.indexOf("[") >= 0 || name.indexOf("]") >=0 || name.indexOf(".") >= 0) {
- // throw up an alert box
- alert("<xts:string id="DIALOG_DATAITEM_INVALID_CHARS" encode="javascript"/>");
- // we can't exit here
- 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.getNodeFromTreeWithValue(name,"name", dataItemTree)) {
- alert("<xts:string id="DIALOG_DATAITEM_DUPLICATE_NAME" encode="javascript"/>");
- return false;
- }
- return true;
- }
- function validateSpec() {
-
- //since validating doesn't alter the state of the dialog, temporarily set the dirty flag to false, this is because the
- //validate calls checkCAF which calls the dialog commit function
- savedState = dirty;
- dirty=false;
- if (validate()) {
- var name = getName();
- var expression = getExpression();
- var aggregate = "automatic";
-
- // create the expression
- var obj = cf.createDataItemObj(name, expression, aggregate);
-
- var items = cf.getTreeValues(cf.getDataItemsTree(), new excludeName(name));
-
- var location_id = "dataItem["+ (items.length + 1) +"]/expression";
-
- if(items.length == 0){
- location_id = "dataItem/expression";
- }
-
- //we can check the expression here, to see if there are any topics
- //if not, then push a warning validation message.
- if(!checkExpressionForTopics(expression)){
- var dm = new cf.DefectMessage(cf.noTopicsValidationError_string, "warn", location_id);
- var defects = new cf.DefectMessages(new Array(dm));
-
- cf.cfgSet(cf.VALIDATE_ERRORS_KEY, defects);
- }
-
- items.push(obj);
-
- //save the items
- cf.cfgSet("inlineSpec_items",items);
-
- var cmd = cf.createValidateCommandStackObject(location_id, 'errorDataItem');
- //must validate all the agent items in case we have referenced items within the calc expression
- cf.getCommandStackManager().initiateCommandStack("checkCAF()","getReportSpec()", "doWait('validate')", cmd);
- window.setTimeout('dirty=savedState', 3000) ;
- }
- }
-
- //this very simply looks for more than zero matching pairs of []
- function checkExpressionForTopics(expression){
- areTopics = expression && expression != '';
-
- var OPEN = "[";
- var CLOSE = "]";
-
- if(areTopics){
- var lookingFor = OPEN;
- var found = false;
-
- for(var i = 0; i < expression.length; i++){
- if(expression.charAt(i) == lookingFor){
- lookingFor = lookingFor == OPEN ? CLOSE : OPEN;
- found = true;
- }
- }
-
- //found something and all matched
- areTopics = found && lookingFor == OPEN;
- }
-
- return areTopics;
- }
-
- function onInputChanged() {
- dirty=true;
- return true;
- }
-
- // function to initialize the script for the contents of the screen
- function init()
- {
-
- cf.addEvent(document.getElementById('dataItem_name'),"change",onInputChanged);
- cf.addEvent(document.getElementById('dataItem_expression'),"change",onInputChanged);
-
- cf.updateInformationTip();
- var nodeRef = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name = 'nodeRef']))"/>"
- if (nodeRef && nodeRef != '') {
- //This holds the calc info
- currentDataItemNode = cf.getTreeNode(cf.getDataItemsTree().getName(), nodeRef);
- }
- var exisiting_name = currentDataItemNode ? currentDataItemNode.getValue().name : "?";
- // cool have a built in on load handler
- droppy.registerDropZone("dataItem_expression",""," ", false, exisiting_name, "", true);
-
- //If we are editing then we perform this bit of Code.
- if (!adding) {
- document.pform.dataItem_name.value = currentDataItemNode.getValue().name;
- //This should never be set directly. We should always use the method setDopZoneValue.
- droppy.setDropZoneValue(currentDataItemNode.getValue().ref,'dataItem_expression');
- cf.changeMenu(cf.TAB_DATAITEMS);
- //only when editing
- droppy.registerPostEventHandler("dataItem_expression", "onblur",updateDlgParams);
- }
- var treeNodes = cf.getTreeChildNodes(cf.getDataItemsTree());
- var nodeId = currentDataItemNode && currentDataItemNode != 'undefined'?currentDataItemNode.getId():"";
- for (var i=0;i<treeNodes.length;i++) {
- //Copy all the ones we are not editintg.
- if (nodeId != treeNodes[i].getId()) {
- dataItemTree.push(treeNodes[i]);
- }
- }
- //cf.showDialogFrame("62%");
- //Show it now
- cf.showDialogFrame(540);
-
- //This function is used to fix scroll bar issue of dialogIFrame in Standards mode.
- resetMargin();
- // set the focus to the name of the data item
- document.pform.dataItem_name.focus();
- }
-
- function resetMargin(){
- var elementArray = document.getElementsByTagName("body");
- var iframeBody = elementArray[0];
- iframeBody.style.margin = "0px";
- }
- //take what was passed and update it to what is on the screen, ready for a navigate away and back
- //Only when editing.
- function updateDlgParams(){
- //I do not think that we will ever navigate away and back.
- //cf.dlgSetParm("editedNode", currentDataItemNode);
- }
-
- function excludeName(name){
- this.name = name;
- this.match = match;
-
- function match(tree_item){
- if(tree_item.name && tree_item.name != name){
- return true;
- }
- return false;
- }
- }
- </script>
- </dp:script>
- </dp:page>
- </xsl:template>
- <!-- pull in other templates that are needed -->
- <agscnd:buildInfoTab/>
- <agscnd:buildInfoSection/>
- <ags:buildButtons/>
- <agscnd:expressionBaseUI/>
- <agscnd:script/>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- faultHandler
- ===============================================================================================
- -->
- <xts:block id="faultHandler" type="fault" processor="XSLT">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml"/>
- <xsl:template match="/root/fault">
- <xsl:choose>
- <xsl:when test="./*[local-name() = 'exception']/*[local-name() = 'exceptionDetail']/*[local-name() = 'exception']/errorCode = 'cmArchiveEncrypted' or ./*[local-name() = 'exception']/*[local-name() = 'exceptionDetail']/*[local-name() = 'exception']/errorCode = 'cmImportCryptoFailed'">
- <copyFault>
- <xsl:copy-of select="."/>
- </copyFault>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="text()"/>
- </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>
|