Sometimes it is useful to show an external web page or component embedded in the body of a WebClient panel. An example could be showing another web site, an image, a map, a widget like a calculator, or some other item of interest. Because WebClient panels are generated as standard web pages, this is very easy to accomplish through standard CA Plex techniques combined with a bit of html and java. This example can be implemented as a reusable CA Plex pattern.
This example has been created courtesy of Lily Taharudin, principal WebClient support engineer. Lily can be reached by email at ltaharudin@adcaustin.com.
Load a web page using a page template
In this example, we are loading a set web page url onto a WebClient panel on initialization on the panel.
This technique is most useful for static url’s, like your company web site or a web component.
- Create a static in the main function for example iframe.
- Set the static control name, for example: iframe:MainArea:template=Iframe:seq=100.
-
Create a control template Iframe.ctrl with the following code and with an url (the CA web site Is the example in this case.)
<iframe src =”http://www.ca.com” width=”100%” height=”750px”>
<p>Your browser does not support iframes.</p>
</iframe>
Run Static URL from Plex Menu or Toolbar
In this example, we are dynamically loading a web page url onto a WebClient panel.
This technique is most useful for loading dynamic or changing information, like a map.
-
Create a new source code, for example call DisplayURL. The source code has one parameter of URL field. In the source code, type the following code.
import com.adcaustin.webplex.*;
WebWindowData x =(WebWindowData) (Object) fnc.getPanel().getPanelData();
x.processAction(“GoToURL”,&(1:));
- Create a new URL field which inherits from FIELDS/URL. This field should have the url value, for example: http://www.ca.com
- Create an event in the menu to call this source code.
-
Create a new triple for the iframe just like webmessages.Iframe is a FNC ~WebClient/WebUI Iframe impl name iframe
-
Create a new page template named Iframe-page.wcli. The page template should contain the following code/(!JSInit) /(!Panel:!EnableAction:GoToURL) /(!JSInit) /(!JS) /(!Panel:!Action:GoToURL) var iframe = document.createElement(“IFRAME”);
iframe.setAttribute(“src“,/(!ActionArg));
iframe.style.width = “100%”;
iframe.style.height = “750px”;
document.body.appendChild(iframe);
/(!Panel:!Action)
/(!JS)
-
The menu function should have the following triples.
Menu is a FNC ~WEBCLIENT/WebShell
Menu is a FNC ~WEBCLIENT/WebMessages
Menu is a FNC iframe
Embedding in Action
An Adobe Flash scientific calculator on a DetailPopup.
The function
The panel
The Template code (this is a flash site)
<iframe src =”http://my.hrw.com/math06_07/nsmedia/tools/Sci_Calculator/Sci_Calculator.html” width=”100%” height=”450px”>
<p>Your browser does not support iframes.</p>
</iframe>
The results