Focal Point
[CLOSED / SHARING] Composer / JavaScript question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7057094326

August 24, 2012, 11:57 AM
Doug
[CLOSED / SHARING] Composer / JavaScript question
This may be concidered "Esoteric Minutiae" (I like that phrase). However, someone has asked a question about this and I don't see how to do it. So, here's one for all the Focal Pointers out there:

Is it possible to tell if you are in the component editor (AKA: HTM Composer) or actually running. I have a one-line javascript that puts a running clock on my launch page (a nice to have feature for your tool box)... It's active even in the composer. Weird. It creates a distracting flicker and interferes with updating properties. Is there a way to disable or bypass it while in the composer? Neither "visibility=hidden" or "disabled=true work".

BTW: Here's the code
<!-- Generated by Report Layout Painter -->
<!-- EsotericMinutiae.htm: Douglas Lee, c/o: Chris Johnson -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META id=mycharsetmeta content="text/html; charset=UTF-8" http-equiv=Content-Type>
<META id=Generation content="Gen 3.0">
<SCRIPT id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}
</SCRIPT>

<SCRIPT id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls);
</SCRIPT>

<SCRIPT id=IBI_nls type=text/javascript src="/ibi_html/javaassist/nls.js"></SCRIPT>

<SCRIPT id=IBI_nlsVars type=text/javascript src="/ibi_html/javaassist/nlsvars.js"></SCRIPT>

<SCRIPT id=IBI_ibigbl type=text/javascript src="/ibi_html/javaassist/ibi/html/js/ibigbl.js"></SCRIPT>

<SCRIPT id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");
</SCRIPT>
<TITLE></TITLE>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
	// set a timer to fire every second to update the time display
	setInterval(function(){document.getElementById("tod_text").firstChild.nodeValue = new Date();}, 1000);  

	UpdateData();
}
//End function window_onload


</SCRIPT>

<SCRIPT for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>

<META name=GENERATOR content="MSHTML 8.00.6001.19258"></HEAD>
<BODY style="Z-INDEX: 0; BACKGROUND-COLOR: #99ffff; OVERFLOW: auto" bgColor=#ffffff elementtype="21" edaconnectionrequired="false" nextelementuniquenumber="58">                   
<SPAN style="Z-INDEX: 33; POSITION: absolute; BACKGROUND-COLOR: black; WIDTH: 1080px; HEIGHT: 9px; FONT-SIZE: 1pt; TOP: 70px; LEFT: 20px" id=line2 tabIndex=0 elementtype="5"></SPAN>          
<SPAN style="Z-INDEX: 0; POSITION: absolute; TEXT-ALIGN: right; WIDTH: 230px; FONT-FAMILY: Calibri; HEIGHT: 20px; FONT-SIZE: 10pt; TOP: 30px; FONT-WEIGHT: bold; LEFT: 870px" id=tod_text tabIndex=32>Fri Aug 24 10:29:43 CDT 2012</SPAN> 
<SPAN style="Z-INDEX: 38; POSITION: absolute; TEXT-ALIGN: right; WIDTH: 230px; FONT-FAMILY: Calibri; HEIGHT: 20px; FONT-SIZE: 10pt; TOP: 50px; FONT-WEIGHT: bold; LEFT: 870px" id=MRUser language=javascript tabIndex=33>Logged on as: !IBI.AMP.IBIMR_user;</SPAN>                    
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=layoutinfo type=hidden>
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_domain value=yardmana/yardmana.htm type=hidden name="IBIMR_domain">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=IBIMR_folder value=#reportsry1rf type=hidden name="IBIMR_folder">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibif_ex value=app/launchpage1.htm type=hidden name="ibif_ex">
<INPUT style="POSITION: absolute; TOP: -100px; LEFT: -100px" id=ibiapp_app value=yardmanagementsystem type=hidden ismre="1" name="ibiapp_app">
<xml id=focus_xmlelement>
<script type="text/xml">
	
<rootxmlnode top="20" left="1119" width="150" height="130">
		
<variables>
		</variables>
		
<input_controls>
		</input_controls>
		
<other_bound_objects></other_bound_objects>
		
<requests></requests></rootxmlnode></script>
</xml></BODY>
<SCRIPT id=IBI_loader type=text/javascript>
doBeforeLoad();
</SCRIPT>
</HTML>

This message has been edited. Last edited by: Doug,




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
August 24, 2012, 12:56 PM
Francis Mariani
You might be able to test the location variable value. I think when an html document is opened in HTML Composer, the JS location variable will contain "blank.html".


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 24, 2012, 01:40 PM
Doug
I'm not familiar with "JS location variable". Is it a "document.item.value" or something?
August 24, 2012, 01:55 PM
Francis Mariani
DevGuru: JavaScript > OBJECT: Location

I would add an if statement in your function to test the existence of "blank.htm":

function window_onload() {
if (location.indexof("blank.htm") =-1) { 
	// set a timer to fire every second to update the time display
	setInterval(function(){document.getElementById("tod_text").firstChild.nodeValue = new Date();}, 1000);  

	UpdateData();
}
}


This is untested code.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 24, 2012, 02:49 PM
Doug
This is a case of Focal Point working as designed: Great minds thinking alike.

1) Thanks Francis, for pointing us in the right direction and for your solution which is very similar to the solution which Chris (the person who asked the original question) came up with.

2) Thanks Chris for your solution, as follows:
                // set a timer to fire every second to update the time display, but only display a placeholder in composer
                if (location.href.indexOf("WFServlet") > -1) {
                                document.getElementById("tod_text").firstChild.nodeValue = new Date();
                                setInterval(function(){document.getElementById("tod_text").firstChild.nodeValue = new Date();}, 1000);  
                } else {
                                document.getElementById("tod_text").firstChild.nodeValue = new Date();
                }              


August 27, 2012, 03:58 AM
Wep5622
No need to repeat that initialisation:
// set a timer to fire every second to update the time display, but only display a placeholder in composer
document.getElementById("tod_text").firstChild.nodeValue = new Date();
if (location.href.indexOf("WFServlet") > -1) {
	setInterval(function(){document.getElementById("tod_text").firstChild.nodeValue = new Date();}, 1000);
}



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :