One of my cliens wanted to display “! Updated Today” icon (just like New icon) against all of those documents which are updated today so that their users can easily identify these documents. Since the customer just wanted this behaviour in some of the document libraries instead of all of them therefore, I opted to update the “AllItems.aspx” in Sharepoint Designer. By using a few lines of xsl code, I was able to achieve it. Following is the step-by-step procedure:
- Open the target page (normally it will be “AllItems.aspx”) in Sharepoint Designer
- Right click the ListViewWebPart and select Convert to XSLT Data View”
- Switch to Code view and search for
<xsl:if test="ddwrt:IfNew(string(@Created))"><IMG SRC="/_layouts/1033/images/new.gif" alt="New" /></xsl:if>
- press Enter after the closing tag of above line i.e.
</xsl:if>
- Insert the following lines
- Save the file and refresh your browser.Bingo! you will start getting “! Updated Today” indicator against all those files which are updated today similar to following:
<xsl:if test=”ddwrt:FormatDate(string(@Modified), number($Language), 1)=ddwrt:FormatDate(ddwrt:TodayIso(), number($Language), 1)”>
<xsl:if test="ddwrt:FormatDate(string(@Modified), number($Language), 1)!=ddwrt:FormatDate(string(@Created), number($Language), 1)">
<span style="background-color:maroon;color:white"> ! Updated Today</span>
</xsl:if>
</xsl:if>
Hi,
When you convert to XSLT Data View, I lose the “edit in datasheet” functionality. Any idea how this can be resolved?
Thanks
Regards
Chris
When a new document is uploaded a green color text “! new” appears next to the newly uploaded document. How do I make this appear at document library level for example “shared documents ! new” whenever a new document/folder is uploaded/created in a document library?
This code works great on my sharepoint list. Thank you. Is there any way to make the “! Updated Today” indicator show for the last seven days? I am not a programmer so I do not understand the formatting involved to do this. Again Thanks!!
this code that I inserted into the allitems.aspx did not work. Maybe I’m missing something….can you please help me?
i’d also like this for all site libraries.
Hi Cis,
Are you getting any error?
Thank you, I figured it out. The open quotes were Italicized. I’d like this for all sites and document libraries which file to I edit?? Thank you very much, this is awesome.
Hi, I realise a long time has passed and no-one may be monitoring this article any more, but I have been trying to implement the code and I just get an error message. Is this code designed to work on a CQWP as well as a Data View? Also, can the code be placed within the ItemStyle.xsl file?
Many thanks,
Luke