123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2014
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" messageBase="messages/portal.xml, messages/portalRL.xml">
- <!--
- ===============================================================================================
- formlogic_init
-
- Standard form logic initialization
- ===============================================================================================
- -->
- <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
-
- <!--
- ===============================================================================================
- get_advanced_settings - get advanced settings
- ===============================================================================================
- -->
- <xts:block id="get_advanced_settings" type="exec" processor="XSLT" mandatory="false" condition=".[/root/env/param[@name='m_class']='userInterfaceProfile']" mode="interpret">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <advancedSettings>
- <xts:function name="getConfiguration">
- <xts:param name="COGADMIN.UIPROFILES.DEVELOPER_MODE"/>
- </xts:function>
- </advancedSettings>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <!-- Load object-specific property tabs map ============================================================== -->
- <xts:block id="getTabs" dependency="get_advanced_settings" type="exec" mode="interpret" processor="XML" path="/portal/uiobjects_tabs.xml"/>
-
- <!--
- ===============================================================================================
- getObjects - get object class names
- ===============================================================================================
- -->
- <xts:block id="classNames" type="exec" mode="input" processor="XML" path="/portal/uiExtensions.xml">
- <xts:logicsheet path="/logicsheets/uiobjects/uiobjects_names.xslt"/>
- </xts:block>
- <!--
- ================================================================================
- get_content
-
- Retrieve the object details from Content Manager.
- ================================================================================
- -->
- <xts:block id="get_content" processor="XSLT" type="exec" mode="interpret">
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="env-param" match="/root/env/param" use="@name"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
- <search>
- <xsl:value-of select="key('env-param','m_obj')"/>
- <xsl:text>[permission('setPolicy')]</xsl:text>
- </search>
- <properties>
- <cm:property name="defaultName"/>
- <cm:property name="permissions"/>
- <cm:property name="searchPath"/>
- <cm:property name="storeID"/>
- <cm:property name="policies"/>
- <cm:property name="launchableType"/>
- <xsl:if test="/root/env/param[@name='m_class'] = 'package'">
- <cm:property name="userInterfaces"/>
- </xsl:if>
- </properties>
- <options schemaInfo="true"/>
- </query>
- </xts:transform>
- </send:request>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ================================================================================
- render_page
-
- Render the HTML page.
- ================================================================================
- -->
- <xts:block id="render_page" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="get_content formlogic_init getTabs classNames">
- <!-- portal specific information -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <!-- get the presentation theme -->
- <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/confirm.xslt"/>
- <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
- <!-- apply the form logic -->
- <xts:logicsheet path="logicsheets/formlogic.xslt"/>
- <xts:logicsheet path="logicsheets/validation.xslt"/>
- <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
- 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:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/"
- xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
- xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
- xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
- xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts xsl cm pf df dp dc lyt utml cp cf cml xtsext">
-
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
- <!-- current file name -->
- <xsl:variable name="mname" select="'properties_privileges.xts'"/>
- <!-- add any theme variables -->
- <pf:variables/>
- <xsl:variable name="object" select="/root/cm:queryResponse/*"/>
- <!-- start the output -->
- <xsl:template match="/root">
- <!-- get passed in parameters -->
- <xsl:variable name="canWrite" select="contains(concat(' ',$object/cm:permissions,' '),' write ')"/>
- <xsl:variable name="canSetPolicy" select="contains(concat(' ', $object/cm:permissions, ' '), ' setPolicy ')"/>
- <xsl:variable name="has_read_permission" select="contains(concat(' ', $object/cm:permissions, ' '), 'read')"/>
- <xsl:variable name="has_write_permission" select="contains(concat(' ', $object/cm:permissions, ' '), 'write')"/>
- <xsl:variable name="has_traverse_permission" select="contains(concat(' ', $object/cm:permissions, ' '), 'traverse')"/>
- <xsl:variable name="showOKCancel" select="$canWrite or $canSetPolicy"/>
- <xsl:variable name="browserTitle">
- <xsl:choose>
- <xsl:when test="key('env-param','from_cogadmin')='true'">
- <xsl:choose>
- <xsl:when test="key('env-param', 'containerLabel') and key('env-param', 'containerLabel') != ''">
- <xts:string id="IDS_PERMISSIONS_TITLE"><xts:param name="objectName"><span lang="{$contentLocale}"><xsl:value-of select="key('env-param', 'containerLabel')"/></span></xts:param></xts:string>
- </xsl:when>
- <xsl:when test="$object/cm:defaultName and $object/cm:defaultName != ''">
- <xts:string id="IDS_PERMISSIONS_TITLE"><xts:param name="objectName"><span lang="{$contentLocale}"><xsl:value-of select="/root/cm:queryResponse/*/cm:defaultName"/></span></xts:param></xts:string>
- </xsl:when>
- <xsl:otherwise>
- <xts:string id="IDS_PERMISSIONS"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$object/cm:defaultName and $object/cm:defaultName != ''">
- <xts:string id="IDS_PROPERTIES_TITLE">
- <xts:param name="objectName">
- <xsl:value-of select="xtsext:enforceBTD($object/cm:defaultName, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
- </xts:param>
- </xts:string>
- </xsl:when>
- <xsl:otherwise>
- <xts:string id="IDS_PROPERTIES"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="is3rdPartyNS" select="starts-with(/root/cm:queryResponse/*/cm:searchPath,'CAMID(') and not(starts-with(/root/cm:queryResponse/*/cm:searchPath,'CAMID(":')) and not(starts-with(/root/cm:queryResponse/*/cm:searchPath, concat(/root/session/param[@name='e_hp'],'/folder')))"/>
- <xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
- <dp:meta>
- <!-- Standard meta tags -->
- <pf:meta/>
- </dp:meta>
- <dp:script>
- <!-- Help system -->
- <pf:help context="HID_PERMISSIONS"/>
- <xsl:if test="$canWrite">
- <script language="JavaScript">
- function confirmCancel()
- {
- var confirmationRequired = false;
- var form = document.pform;
- var isDirty = com.cognos.admin.publicParam.states["PERMISSIONS_EDITOR"].isDirty;
- if (!isDirty) {
- var isAcquired = <xsl:value-of select="/root/cm:queryResponse/*/cm:policies/@acquired"/>;
- isDirty = isAcquired != com.cognos.admin.publicParam.states["PERMISSIONS_EDITOR"].acquired;
- }
- if (isDirty == true) {
- confirmationRequired = true;
- }
- else {
- for (var i = 0; i < form.length; i++) {
- if (form.elements[i] && form.elements[i].name && form.elements[i].name.indexOf('changed_') == 0 && form.elements[i].value && form.elements[i].value == '1') {
- confirmationRequired = true;
- break;
- }
- }
- }
- if (confirmationRequired == true)
- {
- return window.confirm("<xts:string id="IDS_PROP_CANCEL_CONFIRM" encode="javascript"/>");
- }
- else
- {
- return true;
- }
- }
- </script>
- <script language="javascript" src="{$webcontent}/{$app}/js/utilities.js"/>
- </xsl:if>
- </dp:script>
- <utml:form name="pform" method="post" action="{$gateway}">
- <utml:read-only>
- <xsl:choose>
- <xsl:when test="$canWrite">false</xsl:when>
- <xsl:otherwise>true</xsl:otherwise>
- </xsl:choose>
- </utml:read-only>
- <!--
- this defines the form command operation to be performed when all the collected properties are submitted.
- -->
- <utml:input type="hidden" name="ifrmcmd" value="save" utml:update="false"/>
- <!-- dialog header -->
- <dp:header useBackURL="not($showOKCancel)">
- <!-- header titles-->
- <dp:title>
- <xsl:copy-of select="$browserTitle"/>
- </dp:title>
- </dp:header>
- <!-- property tabs -->
- <xsl:if test="not(key('env-param','from_cogadmin')='true') and key('env-param','m_class')!='modelView'">
- <df:propertiesTabs select="privileges">
- <df:hasRead><xsl:value-of select="$has_read_permission"/></df:hasRead>
- <df:hasTraverse><xsl:value-of select="$has_traverse_permission"/></df:hasTraverse>
- <df:hasSetPolicy>
- <xsl:value-of select="$canSetPolicy"/>
- </df:hasSetPolicy>
- </df:propertiesTabs>
- </xsl:if>
- <xsl:call-template name="create-fragment-UI">
- <xsl:with-param name="form-read-only" select="$form-read-only"/>
- <xsl:with-param name="is3rdPartyNS" select="$is3rdPartyNS"/>
- </xsl:call-template>
- <dp:footer>
- <xsl:choose>
- <xsl:when test="$showOKCancel">
- <df:button df:id="IDS_OK" utml:validate="true" df:style="submit"/>
- <xsl:choose>
- <xsl:when test="key('env-param', 'ps_nav_stack') and not(key('env-param', 'ps_nav_stack') = '') ">
- <df:button df:id="IDS_CANCEL" df:style="stack-down" onclick="{$dc-confirm-cancel}"/>
- </xsl:when>
- <xsl:otherwise>
- <df:button df:id="IDS_CANCEL" df:style="back-url" onclick="{$dc-confirm-cancel}"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <df:button df:id="IDS_CLOSE" df:style="back-url"/>
- </xsl:otherwise>
- </xsl:choose>
- </dp:footer>
- </utml:form>
- </dp:page>
- </xsl:template>
- <!-- Generate all the markup necessary to embed the permissions fragment in the property page -->
- <xsl:template name="create-fragment-UI">
- <xsl:param name="form-read-only"/>
- <xsl:param name="is3rdPartyNS"/>
- <script type="text/javascript">
- _F_Config = new Object();
- _F_Config.init = function(){
- this.gateway = "<xsl:value-of select="$gateway"/>";
- this.application = "/cogadmin";
- this.webContent = "<xsl:value-of select="$webRoot"/>";
- };
- _F_Config.init();
-
- var contextPath = _F_Config.webContent;
- </script>
- <script type="text/javascript" src="{ $gateway }/dashboard/messages/messages/pfmessages?section=JS"/>
- <script type="text/javascript" src="{ $webRoot }/dojo16/dojo/dojo.js"/>
- <script type="text/javascript" src="{ $webRoot }/fragments/xdojo/core.js"/>
- <script type="text/javascript" src="{ $webRoot }/fragments/fragments.js"/>
- <script type="text/javascript" src="{ $webRoot }/common/framework/validator/CValidator.js"/>
- <script type="text/javascript" src="{ $webRoot }/fragments/uicommon.js"/>
- <script type="text/javascript">
- var myfragEditor = null;
- var divEditor = null;
-
- function validate()
- {
- saveFragmentState();
- var callbackEnv = com.cognos.admin.publicParam.callbackEnv;
- if (callbackEnv){
- var privileges = new com.cognos.admin.extension.Privileges (callbackEnv);
- if (privileges.getUnsetEntries()) {
- var confirm = window.confirm("<xts:string id="IDS_PROP_PERMISSIONS_DELETE_USER_CONFIRM" encode="javascript"/>");
- if (confirm) {
- privileges.removeUnsetEntries();
- saveFragmentState();
- }
- else {
- return false;
- }
- }
- // alert user that if no entries are selected that policies will be acquired from the parent
- if (!privileges.privileges || privileges.privileges.length == 0) {
- return (window.confirm("<xts:string id="IDS_PROP_PERMISSIONS_SWITCH_CONFIRM" encode="javascript"/>"))
- }
- }
- return true;
- }
-
- function saveFragmentState()
- {
- var f = document.pform;
- f.m_permissions_fragstate.value = myfragEditor.state;
- f.m_permissions_overridePolicy.value = $("PERMISSIONS_EDITORoverridePolicy").checked;
- f.m_permissions_replace.value = $("PERMISSIONS_EDITORclearChildPolicies").checked;
- f.m_permissions_JSON.value = com.cognos.admin.util.Tools.JSON.stringify(com.cognos.admin.publicParam.states["PERMISSIONS_EDITOR"].privileges);
- }
- function fragContentDiv(sId)
- {
- var div = document.createElement("DIV");
- div.id = sId;
- div.className = "boxBody";
- div.style.position = "absolute";
- div.style.overflow = "auto";
- document.body.appendChild(div);
-
- var waitDiv = ui_templates.get(
- ui_templates.contentTemplate,
- 'CONTENTID', 'PERMISSIONS_EDITORcontent',
- 'CONTENTCLASS', 'cogstyle-htabs-page-content'
- );
- div.innerHTML = waitDiv;
- return div;
- }
-
- function fragResize()
- {
- _F_log("I", "resize");
- var viewArea = $("myfragdisplay");
- var cy = document.body.clientHeight;
- cy = Math.max(cy - 150, 400);
- xHeight(viewArea, cy);
-
- var x = xPageX(viewArea);
- var y = xPageY(viewArea);
- var w = xWidth(viewArea) - 5;
- var h = xHeight(viewArea);
- xResizeTo(divEditor, w, h);
- xShow(divEditor);
- viewArea.appendChild(divEditor);
- if (myfragEditor.onresize) {
- myfragEditor.onresize();
- }
- }
-
- function fragInit()
- {
- <xsl:variable name="hide-string"><xts:string id="IDS_FRAG_HIDE"/></xsl:variable>
- ui_error.prototype.template = "\<div id=\"_THIS_errormsg\"\>\</div\>\<div\>" +
- "\<a id=\"_THIS_error_showdetails\"\><xts:string id="IDS_FRAG_ERROR_SHOW_DETAILS" encode="javascript"/>\</a\> | " +
- "\<a id=\"_THIS_error_retry\"\><xts:string id="IDS_FRAG_ERROR_RETRY" encode="javascript"/>\</a\> | " +
- "<xts:string id="IDS_FRAG_HIDE_MESSAGE" encode="javascript"><xts:param name="0">\<a id=\"_THIS_error_hide\"\><xsl:value-of select="$hide-string"/>\</a\></xts:param></xts:string>" +
- "\</div\>";
-
- _F_init();
-
- divEditor = fragContentDiv("PERMISSIONS_EDITORcontent");
- myfragEditor = new fragment("/fragmentproducer/cogadmin/policy/permissions", "PERMISSIONS_EDITOR");
- var params = "object=<xsl:value-of select="xtsext:urlencode($object/cm:storeID)"/>";
- <xsl:if test="key('env-param', 'm_permissions_JSON')!= ''">
- params += "&privileges=<xsl:value-of select="xtsext:urlencode(key('env-param', 'm_permissions_JSON'))" disable-output-escaping="yes"/>";
- </xsl:if>
- <xsl:choose>
- <xsl:when test="key('env-param', 'm_permissions_overridePolicy')='false'">
- params += "&acquired=true";
- </xsl:when>
- <xsl:when test="key('env-param', 'm_permissions_overridePolicy')='true'">
- params += "&acquired=false";
- </xsl:when>
- </xsl:choose>
- <xsl:if test="key('env-param', 'm_permissions_replace')='true'">
- params += "&deleteChildPolicies=true";
- </xsl:if>
- <xsl:if test="$is3rdPartyNS">
- params += "&3rdPartyNS=true";
- </xsl:if>
- <xsl:if test="key('env-param', 'm_permissions_fragstate')!=''">
- params += "&frag-state=<xsl:value-of select="xtsext:urlencode(key('env-param', 'm_permissions_fragstate'))" disable-output-escaping="yes"/>";
- </xsl:if>
- //Overide processErrorHref method within fragments.js
- myfragEditor.processErrorHref = function() {
- var href = window.location.href;
- var iFrames = window.parent.document.getElementsByTagName("iframe");
- if (iFrames.length > 0) {
- //It's being rendered within a dialog so use the 'dialog'location for the backURL instead.
- href = iFrames[iFrames.length-1].src;
- }
- return href;
- }
- myfragEditor.retrieve(params);
-
- setTimeout(function(){
- fragResize();
- },0);
- xAddEventListener(window, "resize", fragResize);
- }
- xAddEventListener(window, "load", fragInit);
-
- </script>
- <table cellspacing="0" cellpadding="3" border="0" width="100%" role="presentation">
- <tbody>
- <tr>
- <td height="1" width="1"/>
- <td width="100%">
- <div id="myfragdisplay" style="width: 100%; height: 400px;"/>
- </td>
- </tr>
- </tbody>
- </table>
- <utml:input type="hidden" name="m_permissions_overridePolicy"/>
- <utml:input type="hidden" name="m_permissions_JSON"/>
- <utml:input type="hidden" name="m_permissions_replace"/>
- <utml:input type="hidden" name="m_permissions_fragstate"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- debug - display debug information
- ===============================================================================================
- -->
- <xts:block id="debug" dependency="render_page" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
- <!-- get the debug logic sheet -->
- <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" omit-xml-declaration="yes"/>
- <xsl:template match="/">
- <dbg:dumpxml select="/root"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|