XPages repeat control header facet - header

I would like to insert a link with an event handler in the first <th> tag within the header facet. See example code below:
<xp:this.facets>
<xp:text disableTheme="true" xp:key="header" escape="false">
<xp:this.value><![CDATA[
<table class="table table-striped table-hover">
<thead>
<tr>
<th>
<xp:link escape="true" text="" id="link1">
<i id="myIconLink" class="fa fa-square-o fa-lg text-success"></i>
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="tab2Panel">
<xp:this.action><![CDATA[#{javascript:
sessionScope.selectAll = "1";
}]]></xp:this.action>
</xp:eventHandler>
</xp:link>
</th>
<th>Project Title</th>
<th>Type of Expenditure</th>
<th>Plan Amount</th>
<th>Fiscal Year</th>
</tr>
</thead>
<tbody>]]>
</xp:this.value>
</xp:text>
<xp:text disableTheme="true" xp:key="footer"
escape="false">
<xp:this.value><![CDATA[
</tbody>
</table>]]></xp:this.value>
</xp:text>
</xp:this.facets>
The error I get is:
Does anyone have any suggestions on how to fix this?

You can't embed XPages tags inside the value property of a Computed Field. Any XPages tags need to be converted to Java objects by the compiler, but computed values are evaluated at runtime.
There are two possible approaches. Create the link as an HTML link calling a JSON RPC service http://www.notesin9.com/2014/05/21/tim-explains-json-rpc-codefortim/. This will ensure the HTML in the header facet is best practice.
The other is to use an xp:div for the facet instead of an xp:text, then use HTML or XPages components as required. This may probably be the easier option (unless you're fully conversant with JSON RPC service) but will affect the HTML that's outputted.

Related

How to verify an image exists within a specific element using Robot Framework

I am trying to verify that a specific image exists on a webpage in a specific element. The image:
Has no unique id
Has no unique alt
The src attribute contains a query string I am trying to ignore
Appears multiple times on the page
I can't use Page Should Contain Image because it appears multiple times but I need to verify it appears in a specific table cell. The image src looks like this:
${BaseUrl}/status_submitted.png?master_2017217_17-29
Here's the HTML surrounding the image:
<table id="mass_list" class="grid">
<tr>
<th class="shrink align_center">Status</th>
<th>Action</th>
<th class="shrink align_right">Submitted</th>
<th class="shrink">Submitted By</th>
</tr>
<tr>
<td>
<img src="https://{baseurl}/images/status_submitted.png?master_2017217_17-29" alt="Submitted" width="70" height="20" />
</td>
<td class="nowrap">
Automation Test 1488321180.7
<br />
<small class="mute">
<strong>0</strong> of <strong>2</strong> records processed
</small>
</td>
<td class="nowrap align_right">Yesterday at 4:33 PM</td>
<td class="nowrap">Tina Tester</td>
</tr>
<tr>
<td>
<img src="https://{baseurl}/images/status_submitted.png?master_2017217_17-29" alt="Submitted" width="70" height="20" />
</td>
<td class="nowrap">
Add an attribute
<br />
<small class="mute">
<strong>0</strong> of <strong>16</strong> records processed
</small>
</td>
<td class="nowrap align_right">Yesterday at 8:06 AM</td>
<td class="nowrap">Tina Tester</td>
</tr>
I need to verify that just ${BaseUrl}/status_submitted.png exists on the page within a specific table cell or xpath location. How do I do this?
Given the example document this was a rather straight forward excersise for me using nothing more than Google Chrome itself. Put the contents of the example in a file with HTML/Body tags around it and then use the right-click inspect to inspect the element in the console. Right click again on the source tag and choose Copy>Xpath.
This will result in the following xPath: //*[#id="mass_list"]/tbody/tr[2]/td[1]/img where the first number tr[2]is the row, and the second number td[1] is the column.
A second approach is to look at the image tag itself and filter based on the file path location of the images with that src attribute: //img[contains(#src, "status_submitted.png")]

Action at a paragraph field doesn't work with type command in IDE

Want to find the CSS locator to add the input in the paragraph.
<div class="fr-element fr-view" style="min-height: 400px;" dir="auto" spellcheck="true" contenteditable="true">
<p style="">
</div>
The css would be
css=.fr-view.fr-element p
You can manipulate this using javascript within the IDE:
<tr>
<td>runScript</td>
<td>document.querySelectorAll('.fr-view.fr-element p')[0].innerHTML='Some New Text'</td>
<td></td>
</tr>

CrossVideo Gallery 6.6 dotnetnuke module

I'm currently using CrossVideo Galery 6.6 with DotNetNuke (DNN). I'm looking at the IDs of HTML tags within a ViewList and I'm seeing something like
<table id="**dnn_ctr782_ViewTagList_ctl04_dlTag**" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr align="left">
<td align="left" valign="top">
<a id="**dnn_ctr782_ViewTagList_ctl04_dlTag_lnkName_0**" class="Normal" target="_self" ... >.mp4(2)</a>
<a id="**dnn_ctr782_ViewTagList_ctl04_dlTag_lnkRss_0**" ... >
...
This code snippet comes from the source code of the page at: http://dnnmodule.com/Modules/CrossVideoGallery/DNNVideoGalleryModule.aspx
I know the "782" portion of the id attribute pertains to the module id number. Can someone tell me what the “ctl05” pertains to? And is it stored within a table that I can access?
Turns out I can get the entire name by using the code in the ascx file and assign it right to a variable in javascript:
<script type="text/javascript">
m_ClientIdPrefix = '<%=this.Control.ClientID %>'; // retruns dnn_ctr2586_ViewList_ctl02
</script>
All ids will be prefixed with this when HTML is responded from the server. Useful if you want to manipulate anything on the client side of DNN.

How to "firmly" locate an element in a table? Selenium

How can I locate an element "1988" (the fourth line) in the following table:
<table border="0" width="820" cellpadding="2" cellspacing="0">
<tbody>
<tr valign="top">
<td class="default" width="100%">Results <b>1</b> to <b>10</b> of <b>1988</b></td>
</tr>
<tr valign="top">
<td class="default" bgcolor="#C0C0C0"> <font class="resultsheader"> ...etc
</tr>
</tbody>
</table>
IMPORTANT: I know one way that works (By.xpath):
driver.findElement(By.xpath("//td[#width='100%']")).getText();
However, this way does not ALWAYS work. The page is dynamic, so I need a way to locate that element no matter what changes happen to the page.
I tried the following but I am not sure:
By.xpath("//html//body//table//tbody//tr[3]//td//table//tbody//tr//td[2]//table[4]//tbody//tr[1]//td//b[3]"
If you can't change the HTML and want to use attributes for selection, you can write something like this:
//table[#border=0][#width=820]//tbody//tr[1]//td//b[3]

Jasperreports markup attribute and PDF

I'm working with Jasperrerports 3.5.1 and I have a html-styled text that I need to be printed in a PDF with the proper styles.
In the cell I want to print the styled text I have the markup property set to "HTML". I have created a this sample text:
<p>
<table border="0">
<tbody>
<tr>
<td>wewewe</td>
<td>eeeee</td>
</tr>
<tr>
<td>qwewewq</td>
<td>3333333</td>
</tr>
</tbody>
</table>
</p>
<p>4444</p>
but in the PDF it is printed as if, without any formatting.
Do you know how can I use html styles here, because using tables inside cells are one of the client's requeriments.
Thanks.
I know this question is old, but JasperReports only supports a small, very small set of HTML tags for styling. The list I found of those tags is:
b
br
font
u
i
sup
sub
li
See here for more info.
First, I'm not sure if case matters but make sure the value of the markup attribute for your textElement element in your JRXML is set to "html" (lowercase).
Second, the purpose of the markup attribute is to format text using HTML, it is meant to make text bold, italic, change font color or size, etc. Creating a table is not what this attribute is for.
You can create tables using standard JRXML, without resorting to embedding HTML, an example is bundled with the JasperReports download under ${JASPERREPORTS_HOME}/demo/samples/table
You can do something like
<textField >
<reportElement x="7" y="10" width="543" height="53"/>
<textElement markup="html">
<font size="10" pdfFontName="Helvetica" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{myElementName}]]></textFieldExpression>
</textField>
Then you can pass the following string programatically
<p style="color:red">
<table border="0">
<tbody>
<tr>
<td style="border: 1px solid">wewewe</td>
<td style="border: 1px solid">eeeee</td>
</tr>
<tr>
<td style="border: 1px solid" >qwewewq</td>
<td style="border: 1px solid">3333333</td>
</tr>
</tbody>
</table>
</p>
<p>4444</p>
I haven't found yet how to create css to apply it using classes inside a jasperreport text element.