123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2013, 2019
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml" resolverBase="prompting" requiredCapability="canUsePortalAdministrationTool">
- <xts:block id="getContent" processor="XSLT" type="exec">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
-
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- 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="session-param" match="/root/session/param" use="@name"/>
- <xsl:template match="/">
-
- <xsl:variable name="path" select="string(/root/env/param[@name='m_path'])"/>
-
- <xts:sequence>
- <xsl:if test="$path != ''">
- <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">
- <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <cm:search>~</cm:search>
- <cm:properties>
- <cm:property name="defaultName"/>
- </cm:properties>
- </cm:query>
- </xts:transform>
- </send:request>
- </xts:transform>
- </xts:append>
- </xsl:if>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <xts:block id="format" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="getContent">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
- <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/controls/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
- <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:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:crn="http://developer.cognos.com/crconfig/1/"
- 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: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:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
- xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
- xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
- exclude-result-prefixes="xsl cf cp pf df dp lyt cm cml utml xts 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="'new_general.xts'"/>
- <xsl:variable name="promptLocale" select="$productLocale"/>
- <xsl:variable name="promptFormName" select="'pform'"/>
- <xsl:variable name="skin" select="key('user-param', 'skin')"/>
- <pf:variables/>
- <!-- variables for modal dialogs -->
- <pf:modalVariables/>
- <!-- Prompt Control XSL include -->
- <xsl:include href="p_include.xsl"/>
- <pf:serialize-xml/>
-
- <!-- start the output -->
- <xsl:template match="/root">
- <xsl:variable name="wizardTitle">
- <xts:string id="IDS_IMPORT_VIZ_NEW_VIZ_TITLE"/>
- </xsl:variable>
- <xsl:variable name="browserTitle">
- <xsl:text/>
- <xts:string id="IDS_IMPORT_VIZ_SELECT_VIZ_TITLE_NAME_LOCATION">
- <xts:param name="wizardTitle">
- <xsl:value-of select="$wizardTitle"/>
- </xts:param>
- </xts:string>
- <xsl:text/>
- </xsl:variable>
- <xsl:variable name="upload-form-url">
- <xsl:value-of select="$gateway"/>
- <xsl:text/>/vis/gallery<xsl:text/>
- <xsl:text/>?maskResponses=true<xsl:text/> <!-- override default vis response to fix iframe load issue -->
- </xsl:variable>
- <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>
- <script language="javascript">
- function validate()
- {
- var f = document.pform;
- return true;
- }
- </script>
-
- <style TYPE="text/css">
- .browse-button-link
- {
- position: absolute;
- right: 0; top: 0;
- cursor: pointer;
- opacity: 0.0000;
- filter: alpha(opacity=0);
- }
- </style>
-
- <script type="text/javascript">
- var file_selection_list = [];
- var current_file_input_idx = 0;
- var current_file_loading_idx = -1;
-
- function acceptsFileExtension(filename) {
- var ext = filename.match(/\.([^\.]*)$/)[1];
- return (ext == 'zip');
- }
- function onFileSelection() {
- <!-- Update the selection box -->
- var updateSelectionDisplayArea = function(fileDisplayName) {
- var fileSelectionDiv = document.getElementById("fileSelectionDiv");
- <xsl:variable name="hint"><xts:string id="IDS_IMPORT_VIZ_REMOVE_SELECTION_HINT"/></xsl:variable>
- fileDisplayName = fileDisplayName.replace(/.*\\/g, "");
- var newSelectionEntryHTML = '<div id="selectedFileInput_$pos$" style="margin:1px;">' +
- '<span>$filename$<a href="#" onclick="javascript:removeSelection($pos$)"><img style="margin-left:1px" id="deleteimg_$pos$" align="absmiddle" border="0px" src="{$image_root}action_delete.gif" alt="{$hint}" title="{$hint}"/></a></span>' +
- '</div>';
- newSelectionEntryHTML = newSelectionEntryHTML.replace(/\$pos\$/g, "" + current_file_input_idx).replace(/\$filename\$/g, "" + fileDisplayName);
- var newSelectionEntryDiv = document.createElement("div");
- fileSelectionDiv.appendChild(newSelectionEntryDiv);
- newSelectionEntryDiv.innerHTML = newSelectionEntryHTML;
-
- file_selection_list[current_file_input_idx] = true;
- }
-
- <!-- Tuck away the current and create the next file input element -->
- var createNextFileInput = function() {
- // hide current file input div
- var current_fileInputDiv = document.getElementById("fileInputDiv_" + current_file_input_idx);
- current_fileInputDiv.style.display = "none";
-
- // create next file input field to accept next selection
- current_file_input_idx += 1;
- var next_fileInputDiv = document.createElement("div");
- next_fileInputDiv.setAttribute("id", "fileInputDiv_" + current_file_input_idx);
- current_fileInputDiv.parentNode.appendChild(next_fileInputDiv);
- var nextfileinput =
- '<span style="position:relative;" id="span_file_input_$pos$">' +
- '<input type="file" id="file_input_$pos$" name="file_input_$pos$" accept=".zip" class="browse-button-link" onchange="javascript:onFileSelection()"/>' +
- '<span class="formText"><span class="vizImportBrowse"><xts:string id="IDS_IMPORT_VIZ_BROWSE"/></span></span>' +
- '</span>';
- nextfileinput = nextfileinput.replace(/\$pos\$/g, "" + current_file_input_idx);
- next_fileInputDiv.innerHTML = nextfileinput;
- }
-
- var fi = document.getElementById("file_input_" + current_file_input_idx);
-
- // Check for acceptable extension
- <xsl:if test="false()"> <!-- currently not supported -->
- if (!acceptsFileExtension(fi.value)) {
- fi.value = "";
- alert("Extension unknown!");
- return;
- }
- </xsl:if>
-
- updateSelectionDisplayArea(fi.value);
- createNextFileInput();
- updateImportButtonState();
- }
- function removeSelection(entry) {
- //delete the entry in the file list
- var div = document.getElementById("selectedFileInput_" + entry);
- div.parentNode.removeChild(div);
- //delete the input field
- var fi = document.getElementById("file_input_" + entry);
- if (current_file_input_idx > 1) {
- fi.parentNode.removeChild(fi);
- delete file_selection_list[entry];
- } else {
- delete file_selection_list[entry];
- }
-
- updateImportButtonState();
- }
-
- function upload_iframe_onload(response) {
- if (current_file_loading_idx == -1) {
- return;
- }
-
- var uploadingSuccessful = false;
- var uploadingDetails = '<xts:string id="IDS_IMPORT_VIZ_IMPORT_ERROR" encode="javascript"/>';
-
- try {
- if (response && response.match(/[^\{]*(\{.*\}).*/)) {
- response = response.match(/[^\{]*(\{.*\}).*/)[1];
- var response = eval("(" + response + ")");
- if (response.Status >= 200 && response.Status < 300) {
- uploadingSuccessful = true;
- } else {
- uploadingSuccessful = false;
- uploadingDetails = response.Description;
- }
- }
- } catch (e) {
- // a 500 or 400 http status can wind up here especially with IE access denied error
- uploadingSuccessful = false;
- }
-
- // update the file's uploading status
- if (true) {
- var div = document.getElementById("selectedFileInput_" + current_file_loading_idx);
- if (div != null) {
- var spanstatus = document.createElement("span");
- var status = uploadingSuccessful ? '<xts:string id="IDS_IMPORT_VIZ_STATUS_SUCCEEDED" encode="javascript"/>' : '<xts:string id="IDS_IMPORT_VIZ_STATUS_FAILED" encode="javascript"/>';
- var span = '<span style="margin-left:5px;">' + status;
- if (!uploadingSuccessful) {
- span += '<img align="absmiddle" style="margin-left:3px;" border="0px" src="{$image_root}msg_error_8.gif" alt="$hint$" title="$hint$"/>';
- span = span.replace(/\$hint\$/g, "" + uploadingDetails);
- }
- span += '</span>';
- spanstatus.innerHTML = span;
- div.appendChild(spanstatus);
- }
- }
-
- doUpload();
- updateImportButtonState();
- }
- function getFileSelectionListSize() {
- var s = 0;
- for (var k in file_selection_list) {
- s++;
- }
- return s;
- }
-
- function updateImportButtonState() {
- var id_uploadText = document.getElementById("id_uploadText");
- if (getFileSelectionListSize() == 0) {
- id_uploadText.className = "commandButtonInactive";
- id_uploadText.onmouseover = function() { return false; }
- id_uploadText.onmouseout = function() { return false; }
- id_uploadText.onmousedown = function() { return false; }
- } else {
- id_uploadText.className = "commandButton";
- id_uploadText.onmouseover = function() { this.className="commandButtonOver"; }
- id_uploadText.onmouseout = function() { this.className="commandButton"; }
- id_uploadText.onmousedown = function() { this.className="commandButtonDown"; }
- }
- }
-
- function setReplaceWarningVisibility(isVisible) {
- var warn = document.getElementById("id_replaceExistingWarning");
- if(isVisible) {
- warn.style.visibility="visible";
- } else {
- warn.style.visibility="hidden";
- }
- }
- function doUpload() {
-
- if (getFileSelectionListSize() == 0) {
- return;
- }
-
- try {
- for (var i in file_selection_list) {
- var url = "<xsl:value-of select="$upload-form-url"/>";
- var upload_form = document.upload_form;
- var replaceEntries = document.pform.id_replaceCheckbox.checked;
-
- if(replaceEntries) {
- url += "&updateAction=UPDATE";
- } else {
- url += "&updateAction=FAIL";
- }
- var fi = document.getElementById("file_input_" + i);
- if (fi) {
- current_file_loading_idx = i;
- upload_form.appendChild(fi);
-
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.onreadystatechange = function() {
- if (this.readyState === 4) {
- upload_iframe_onload(this.responseText);
- }
- }
- xmlhttp.open("POST", url, true);
- var xsrf_token_value = "<xsl:value-of select="xtsext:javascriptencode(string(/root/cookies/cookie[@name='XSRF-TOKEN']))"/>";
- xmlhttp.setRequestHeader("X-XSRF-TOKEN", xsrf_token_value);
- xmlhttp.send(new FormData(upload_form));
- fi.parentNode.removeChild(fi);
- delete file_selection_list[i];
- var div = document.getElementById("selectedFileInput_" + i);
- div.className = "vizImportListInactiveEntry";
- var deleteimg = document.getElementById("deleteimg_" + i);
- deleteimg.parentNode.removeChild(deleteimg);
- return;
- }
- }
- } catch (e) {
- alert(e);
- }
-
- updateImportButtonState();
- }
-
- function doClose() {
- if (getFileSelectionListSize() > 0) {
- if (confirm('<xts:string id="IDS_IMPORT_VIZ_DISCARD_SELECTION" encode="javascript"/>')) {
- location.href = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='backURL']))"/>";
- }
- } else {
- location.href = "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='backURL']))"/>";
- }
- }
-
- </script>
-
- <script language="javascript" src="{$webcontent}/{$app}/js/utilities.js"/>
- <!-- Help system -->
- <pf:help context="HID_IMPORT_VISUALIZATION"/>
- </dp:script>
-
- <!-- ================================================================ -->
- <!-- H E A D E R -->
- <!-- ================================================================ -->
- <dp:header>
- <dp:title>
- <xsl:value-of select="$browserTitle"/>
- </dp:title>
- <dp:description>
- <xts:string id="IDS_IMPORT_VIZ_NEW_VIZ_INTRO"/>
- </dp:description>
- <dp:close>
- <span id="xbuttonClose" style="position: absolute;margin-top: -9999px; "><xts:string id="IDS_CLOSE"/></span>
- <xsl:choose>
- <xsl:when test="$isModal">
- <a href="javascript:processModalCommand('close')" aria-labelledby="xbuttonClose">
- <dp:closeMarker/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <a href="{/root/env/param[@name = 'backURL']}">
- <xsl:attribute name="onClick">javascript:resetPageState()</xsl:attribute>
- <xsl:attribute name="aria-labelledby">xbuttonClose</xsl:attribute>
- <dp:closeMarker/>
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </dp:close>
- </dp:header>
-
- <iframe src="about:blank" id="upload_iframe" name="upload_iframe" style="position:absolute;left:-999px;top:-999px" onload="javascript:upload_iframe_onload()"></iframe>
-
-
- <lyt:layout style="1">
- <lyt:section>
- <dp:list>
- <dp:section>
- <div style="margin:10px;">
- <form style="margin-top:5px" name="pform" method="post"
- enctype="multipart/form-data"
- action="">
- <table cellpadding="0" cellspacing="0">
- <!-- browse button -->
- <tr>
- <td class="formLabel"><xts:string id="IDS_IMPORT_VIZ_SELECTED_VISUALIZATIONS"/></td>
- <td align="right">
- <div id="fileInputDiv_0">
- <span style="position:relative;" id="span_file_input_0">
- <input type="file" id="file_input_0" name="file_input_0" accept=".zip" class="browse-button-link" onchange="javascript:onFileSelection()"/>
- <span class="formText"><span class="vizImportBrowse"><xts:string id="IDS_IMPORT_VIZ_BROWSE"/></span></span>
- </span>
- </div>
- </td>
- </tr>
- <!-- selection display area -->
- <tr>
- <td colspan="2">
- <div style="margin-left:10px;margin-top:10px">
- <div id="fileSelectionDiv" class="vizImportList">
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <img height="12" width="1" border="0" src="{concat($webcontent, '/images/space.gif')}"/>
- </td>
- </tr>
- <!-- import button -->
- <tr>
- <td colspan="2" align="right">
-
- <a id="id_uploadAnchor" href="#" onclick="javascript:doUpload()">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <span id="id_uploadText" class="commandButtonInactive">
- <xsl:attribute name="style">padding-right:10px; padding-left:10px; padding-top:2px; padding-bottom:3px;</xsl:attribute>
- <xts:string id="IDS_IMPORT_VIZ_IMPORT"/>
- </span>
- </td>
- </tr>
- </table>
- </a>
- </td>
- </tr>
- </table>
- <img height="12" width="1" border="0" src="{concat($webcontent, '/images/space.gif')}" />
- <table cellpadding="0" cellspacing="2">
- <!-- replace existing checkbox -->
- <tr>
- <td colspan="2" >
- <span class="formText"><xts:string id="IDS_IMPORT_VIZ_REPLACE_WARNING"/></span>
- </td>
- </tr>
- <!-- replace existing checkbox -->
- <tr>
- <td width="1">
- <input type="checkbox" name="id_replaceCheckbox" id="id_replaceCheckbox"
- onclick="javascript:setReplaceWarningVisibility(document.pform.id_replaceCheckbox.checked)"/>
- </td>
- <td class="formText" >
- <label for="id_replaceCheckbox">
- <xts:string id="IDS_IMPORT_VIZ_REPLACE"/>
- </label>
- </td>
- </tr>
- <!-- replace warning -->
- <tr>
- <td colspan="2">
- <div id="id_replaceExistingWarning" style="visibility: hidden;">
- <table border="0" cellpadding="1" cellspacing="0">
- <tr>
- <td>
- <img border="0" height="16" width="16" src="{concat($webcontent, '/', $app, '/images/msg_warning_16.gif')}">
- <xsl:attribute name="alt"><xts:string id="IDS_STATUS_WARN" encode="html"/></xsl:attribute>
- </img>
- </td>
- <td>
- <img height="12" width="1" border="0" src="{concat($webcontent, '/images/space.gif')}" />
- </td>
- <td>
- <span class="formText"><xts:string id="IDS_IMPORT_VIZ_REPLACE_WARNING_DETAIL"/></span>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- <form name="upload_form" method="post" enctype="multipart/form-data" action="" target="upload_iframe"></form>
-
- </dp:section>
- </dp:list>
- </lyt:section>
- </lyt:layout>
-
-
- <!-- ================================================================ -->
- <!-- F O O T E R -->
- <!-- ================================================================ -->
- <dp:footer>
- <df:button df:id="IDS_CLOSE" df:style="href" df:href="#" onclick="doClose(event);"/>
- </dp:footer>
- </dp:page>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <!-- Debug -->
- <!-- ============================================================================= -->
- <xts:block id="debug" dependency="format" condition=".[ /root/session/param[@name='debug'] = '1' ]" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <!-- debug logic sheet -->
- <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>
|