File Download Control for Mobile Devices

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
	xmlns:xe="http://www.ibm.com/xsp/coreex"
	xmlns:xc="http://www.ibm.com/xsp/custom">
	
	<xp:panel style="width:100% !important;">
		<xp:this.rendered><![CDATA[#{javascript:
			var al:java.util.List = document1.getAttachmentList(compositeData.field);
			if(al.isEmpty())
			{
				return false;
			}
			else
			{
				return true;
			}
		}]]></xp:this.rendered>
		<xp:label value="Attachments:" id="label1" style="fonst-size:12px; font-weight:bold;"></xp:label>
	</xp:panel>
	
	<xp:repeat id="repeatList" value="#{javascript:document1.getAttachmentList(compositeData.field)}"
		var="attachData" indexVar="attachIndex"
		rendered="#{javascript:var lastlevel=0;}" rows="300" first="0">	
		<xp:this.style><![CDATA[#{javascript:
			var al:java.util.List = document1.getAttachmentList(compositeData.field);
			if(al.isEmpty())
			{
				return "display:none";
			}
			else
			{
				return "display:inline";
			}
		}]]></xp:this.style>
		
		<xp:link id="label4">
			<xp:this.text><![CDATA[#{javascript:
				var al:java.util.List = document1.getAttachmentList(compositeData.field);
				if(!al.isEmpty())
				{
					var eo:NotesEmbeddedObject = al.get(attachIndex);
					return eo.getName();
				}
			}]]></xp:this.text>
			<xp:this.value><![CDATA[#{javascript:
				var al:java.util.List = document1.getAttachmentList(compositeData.field);
				var eo:NotesEmbeddedObject = "";
				if(!al.isEmpty())
				{
					eo = al.get(attachIndex);
					return eo.getHref();
				}
				else
				{
					return "";
				}
			}]]></xp:this.value>
		</xp:link>
		<br />
	</xp:repeat>
</xp:view>





This is a custom control that defines a property "field" of type string.

Example usage would be <xc:mobile_filedownload field="body"> this would then take the body attribute from the document.

XPages
Simon McLoughlin
February 14, 2012 2:48 AM
Rating
147

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...