Friday, November 6, 2009

Adding an Image to a SharePoint discussion List:

My intention is to bring a Rating image in SharePoint threaded view before the “view properties”. I have some other functionality, I am trying to bring but I will discuss it once I am done with that.

What I am talking is please refer the below fig:


In the read box, I need my image. This screen is in the Threaded View of SharePoint discussion. This is a status bar and it will appear for each message.


I googled and binged but couldn’t find much help. Later I thought, how they are doing this and was viewing the source and found out the javascript being used in View Properties. I have seen something like that in Schema.xml and hence I went to that file and bingo… the javascript was there.

So I went and played with the schema.xml and I got it working. Under the Statusbar Field reference, display pattern, you need to add your stuff and it will display accordingly.










<1html><1![CDATA[]]>
<1html><1![CDATA[


<1img alt="star_1" src="/_layouts/images/star_x_grey.gif" id="star]]>

<1html><1![CDATA[_1" ONCLICK="RatingImageClicked(]]>

<1html><1![CDATA[,this)"/><1img alt="star_2" src="/_layouts/images/star_x_grey.gif" id="star]]>

<1html><1![CDATA[_2" ONCLICK="RatingImageClicked(]]>

<1html><1![CDATA[, this)" /><1img alt="star_3" src="/_layouts/images/star_x_grey.gif" id="star]]>

<1html><1![CDATA[_3" ONCLICK="RatingImageClicked(]]>

<1html><1![CDATA[, this)" /><1img alt="star_4" src="/_layouts/images/star_x_grey.gif" id="star]]>

<1html><1![CDATA[_4" ONCLICK="RatingImageClicked(]]>

<1html><1![CDATA[,this)"/><1img alt="star_5" src="/_layouts/images/star_x_grey.gif" id="star]]>

<1html><1![CDATA[_5" ONCLICK="RatingImageClicked(]]>

<1html><1![CDATA[,this)"/>
]]>



I added the above after the <1field Name="Attachments" /> under in schema.xml file.

If it helped someone, I will be glad. If you don’t get it let me know.

I have javascript to handle my functionality and you need the image. I didn’t provide that here.

PS: I have added 1 because the blog interprets the html tag and didnt show properly.

No comments:

Post a Comment