Welcome to the Learning Center

The Guide | Knowledge Base | FAQ

Browse it all or refine your selection using the filters below on the left.

Using XMP To Display Documents

Using XMP To Display Documents - From Document Exchange Professional

By: Angus Beare On: 11/03/2010

Link to this Article
https://dnndev.com/Learn/Guide/Article/Using-XMod-Pro-to-Display-Documents

One of the many great benefits of using XMod Pro is that it allows you to fill feature gaps in commercial modules to enrich the user experience.Take for example Document Exchange Professional (DMX) which is one of the top document management modules for DotNetNuke.

It’s a very powerful module with great security features. However, as with all software solutions it cannot possibly cover all the potential requirements of a project. I have found that the area where we most often require additional functionality is in the display and formatting of document links. Enter XMod Pro. With XMod Pro you can query the DMX database and display the data with document links in your DNN pages. This works very well but most importantly the security of documents is maintained by DMX. So once the documents are uploaded and the permissions set a user cannot download a document unless they have permission to.

Here is an example of the SQL:


SELECT distinct TOP 12
DMXE.CollectionID, 
DMXE.EntryID, 
DMXE.EntryType, 
DMXST.Text as DocumentTitle, 
DMXE.LastVersionID,
year(DMXE.LastModified) as LastModifiedYear,
DATENAME(month,DMXE.LastModified) as LastModifiedMonth,
day(DMXE.LastModified) as LastModifiedDay,
DMXE.Lastmodified,
DMXE.FileSize/1000 as FileSize, 
DMXEXT.ExtensionKey, 
DMXEXT.Icon16, 
DMXEXT.Icon32,
DMXLT.Text as Remarks 

FROM DMX_Entries DMXE 
inner join DMX_ShortTexts DMXST 
on DMXE.EntryID=DMXST.ObjectId and SubTypeKey='TITLE' 
inner join DMX_Extensions DMXEXT on DMXE.EntryType=DMXEXT.ExtensionKey
/* get the remarks if they exist - gus 21-4-2010 */
left outer join DMX_LongTexts DMXLT on DMXLT.ObjectId= DMXE.EntryID and DMXLT.SubTypeKey='REMARKS'
and DMXLT.TypeKey='ENT'
 
where entryID=LastVersionID 
and deleted=0
and DMXE.EntryType <> 'Collection'
and collectionID=@collectionID
order by DMXST.Text desc

The above SQL gets the top 12 documents for a given collection ID. The collection ID refers to a specific folder. So, the template shows meeting documents for a committee.

The Template might be like this:


<xmod:Template UsePaging="False" id="meetingdocs">
 
<ListDataSource CommandText="
SELECT distinct TOP 12
	DMXE.CollectionID, 
	DMXE.EntryID, 
	DMXE.EntryType, 
	DMXST.Text as DocumentTitle, 
	DMXE.LastVersionID,
	year(DMXE.LastModified) as LastModifiedYear,
	DATENAME(month,DMXE.LastModified) as LastModifiedMonth,
	day(DMXE.LastModified) as LastModifiedDay,
	DMXE.Lastmodified,
	DMXE.FileSize/1000 as FileSize, 
	DMXEXT.ExtensionKey, 
	DMXEXT.Icon16, 
	DMXEXT.Icon32,
	DMXLT.Text as Remarks 

FROM DMX_Entries DMXE 
	inner join DMX_ShortTexts DMXST 
	on DMXE.EntryID=DMXST.ObjectId and SubTypeKey='TITLE' 
	inner join DMX_Extensions DMXEXT on DMXE.EntryType=DMXEXT.ExtensionKey
	/* get the remarks if they exist - gus 21-4-2010 */
	left outer join DMX_LongTexts DMXLT on DMXLT.ObjectId= DMXE.EntryID and DMXLT.SubTypeKey='REMARKS'
	and DMXLT.TypeKey='ENT'
  
where entryID=LastVersionID 
	and deleted=0
	and DMXE.EntryType <> 'Collection'
	and collectionID=@collectionID
	order by DMXST.Text desc">

	<Parameter name="collectionID" value='[[Module:collectionID]]'/>
	
</ListDataSource>
  
<HeaderTemplate>
	<table border="0" cellspacing="3" cellpadding="3">
	<tr>
		<td width="650" class="dmx_title" bgcolor="#dbebf0">Title</td> 
		<td width="100" class="dmx_title" bgcolor="#dbebf0" align="center">Download</td>
	</tr>
</HeaderTemplate>

<ItemTemplate>
	<tr>
		<td><a class="Title" href="/DesktopModules/Bring2mind/DMX/Download.aspx?EntryId=[[EntryID]]&PortalId=0&DownloadMethod=attachment">[[DocumentTitle]][[Remarks]]</a>
		</td> 
		<td align="center"><a href="/DesktopModules/Bring2mind/DMX/Download.aspx?EntryId=[[EntryID]]&PortalId=0&DownloadMethod=attachment"><img src="http://www.dev-site.org/[[Icon16]]" /></a>
		</td>
	</tr>
</ItemTemplate>

<FooterTemplate>
	</table>
</FooterTemplate> 
     
<NoItemsTemplate>
</NoItemsTemplate>
  
</xmod:Template>

The template renders as a list of document links. Note here that these links point to a page on which the default DMX module is installed. The document Entry ID is passed in from the data and the user is then able to click a link to download the document. If they don’t have permission then they are sent to the login page.

We have completed four large document management projects using DMX as the core storage and attribute management module and XMod Pro as the listing and filtering engine. The solution works very well and is highly cost effective compared to other online document management solutions.