To add an item description to the Repository, you need to add a new TOKEN to the Dashboard templating code. It's really not too difficult.
First, we need to add a handler for the new token we're going to create. In the RepositoryDashboard.ascx.vb file, look for the Case statement in the lstObjects_ItemDataBound() function. You'll see a case statement where it determines which Dashboard mode you are using ( ie: index, top10downloads, top10rated, etc ) which you've set in the Dashboard modules settings page.
So, for this example, let's say you want to add a description token to the top10downloads mode of the template you're using ( the changes would be the same for whichever mode you want to add this token to, or you could just add the token to all modes ). Within the "Case "top10Downloads"" you'll see another Case statement which handles the tokens, FILENAME, COUNT, IMAGE, etc. Add a new case statement for DESCRIPTION as follows
Case "DESCRIPTION"
Dim objLabel As New Label
Dim sDesciption as String = ""
Dim iWidth As Integer = CInt(oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "DESCRIPTION", "Width", "-1"))
If iWidth <> -1 Then
sDesciption = HtmlUtils.Shorten(objItem.Description, iWidth, "...")
Else
sDesciption = Server.HtmlDecode(objItem.Description)
End If
objLabel.Text = sDesciption
objLabel.CssClass = oRepositoryBusinessController.GetSkinAttribute(xmlDoc, "DESCRIPTION", "CssClass", "normal")
objPlaceHolder.Controls.Add(objLabel) |
There are 2 settings in the .xml file associated with your template that will allow you to have some control over the format and display of the description. a "Width" setting that you can use to display some number of characters of the Description, and the "CssClass" setting to control the style applied to the token.
<Object>
<Token>[DESCRIPTION]</Token>
<Settings>
<Setting>
<Name>CssClass</Name>
<Value>normal</Value>
</Setting>
<Setting>
<Name>Width</Name>
<Value>20</Value>
</Setting>
</Settings>
</Object> |
So, in the example above, I'm setting the class to "normal" and indicating that I only want to display 20 characters. If the Width setting was missing, or set to -1, then it would display the entire description.
And then, finally, you would then be able to use your new [DESCRIPTION] token in your dashboard template. So again, in this example I would edit "dashboard.downloads.html" and add the token where I wanted it to appear.
<TABLE CLASS="normal" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDERWIDTH="0">
<TR WIDTH="100%" style="padding-bottom: 3px;">
<TD CLASS="SubHead" ALIGN="Left" WIDTH="75%" VALIGN="Top">[FILENAME]<br>[DESCRIPTION]</TD>
<TD CLASS="SubHead" ALIGN="Right" WIDTH="25%" VALIGN="Top">[COUNT]</TD>
</TR>
</TABLE> |
That should do it :) Let me know if you have any problems/questions.