Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, I have 4 folders in the media tab I want to monitor, can you tell me how best to edit the xslt please?Thank you for any help!
Which way you want to monitor?
Can you please elaborate more so it would be better to answer the question.
apologies for the newbie xsl question, I'm learning as I go!
I have set one folder ID in the LatestEdits xslt code below which works great on the dashboard. But I also want to include three other media folder IDs (which is basically our entire media library).
<!-- If you don't have uComponents (or haven't activated the Media XSLT extensions), you need to put a Media Folder id in here: --> <xsl:variable name="mediaFolderId" select="1143"/> <xsl:variable name="mediaRootProxy">
(We don't have uComponents, using 7.2.1)
Thank you for any help
Can I know the purpose what you want to achieve by getting whole media folders ID in xslt?
Sure - we have 4 folders in the media root: categorised, global, promos and restricted.We have a web content team who monitor all web edits and so displaying all media changes/uploads on the Latest Edits dashbaord would be really helpful for them.
You can try this to monitor your entire Media library:
Put the ID of any of your media folders in the mediaFolderId variable.
Find these lines:
<!-- Grab the Media too -->
<xsl:variable name="media" select="$mediaRoot//*[umbracoFile]"/>
and change the 2nd one to this:
<xsl:variable name="media" select="$mediaRoot/ancestor::root//*[umbracoFile]"/>
Hope that helps!
I do want to add that if you download uComponents 6.x and unzip the package; then if you upload the uComponents.Core.dll and uComponents.XsltExtensions.dll files to the bin folder, you will actually have all of the XSLT extensions available - doing that on all my Umbraco 7 sites :-)
Thanks Chriztian, sadly couldn't get it working with that change. It works well enough with one media folder for now... Will try the uComponent suggestion next week! Thanks again :-)Adele
Yeah I was way too quick when I posted that - sorry :(
The problem is that you only get the XML from the node you request, so you can't go upwards in the tree, as I was trying...
Let me know if the uComponents DLL thing doesn't work for you, and I'll put in a fix for specifying multiple IDs.
Hi Chriztian,thanks for your help with this but I cannot get it working with uComponents DLLs. If you have time to add a fix for multiple IDs, that'd be awesome and massively appreciated!Adele :-)
So I've built a new version (but not published here yet) - could you try grabbing the file here and see if it fixes your issue?
If you've made any customization yourself to the LatestEdits.xslt file, you will of course need to merge them yourself (so backup :-)
(The basic changes are in this commit)
Thanks for your help again - tried the update from the file here but it just says "Media is not configured".
Had a look at the commit file, but it's slightly different...
The file link has on line 21
<xsl:variable name="mediaFolderId" select="0" />
but the commit file has
<xsl:variable name="mediaFolderIds" select="&mediaFolderId;" />
Sadly couldn't make either version work! Of course the original xslt still works with one folder ID :-)
This version works for me: https://github.com/greystate/LatestEditsDashboard/blob/f8b8c50cee0bffd3bc7f171c6ab0f89e6e316f68/src/LatestEdits.xslt but you need to encase your comma-separated list of media ids in single quotes, e.g:
<!ENTITY mediaFolderId "'1143,1139,1140,1141,1142'">
I also had an issue with the media item thumbnail not showing on the latest edits dashboard, so needed to change line 224 of the source above from:
<xsl:value-of select="umb:JsonToXml($file)/src" />
<xsl:value-of select="$file" />
Umbraco 7.2.4 by the way.
Hope this helps someone at some point :)
Great to know - the issue you had is probably related to using the default/legacy Upload field? I can see now that we always replace the Upload field with an Image Cropper, which explains the need for converting the JSON.
Will try to put a fix in for that. Thanks!
Ah-ha! Yes, that'd be it. If using the Image Cropper umb:JsonToXml($file)/src it returns an error, so it might be possible to check for that and default to just $file if the error is encountered. There's probably a better way to handle it, but it's an option :)
Fantastic, got it working with multiple IDs! Thank you both for your help, this package is going to be so useful for us :-)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted