Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • AdeleMB 15 posts 39 karma points
    May 08, 2015 @ 11:19
    AdeleMB
    0

    Media folder id

    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!

  • Urvish 252 posts 776 karma points
    May 08, 2015 @ 11:51
    Urvish
    0

    Hi AdeleMB,

    Which way you want to monitor?

    Can you please elaborate more so it would be better to answer the question.

    Regards,

    Urvish Mandaliya

  • AdeleMB 15 posts 39 karma points
    May 08, 2015 @ 12:00
    AdeleMB
    0

    Hi Urvish,

    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

  • Urvish 252 posts 776 karma points
    May 08, 2015 @ 12:08
    Urvish
    0

    Hi AdeleMB,

    Can I know the purpose what you want to achieve by getting whole media folders ID in xslt?

    Regards,

    Urvish Mandaliya

  • AdeleMB 15 posts 39 karma points
    May 08, 2015 @ 12:20
    AdeleMB
    0

    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.

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    May 08, 2015 @ 13:42
    Chriztian Steinmeier
    0

    Hi AdeleMB,

    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!

    /Chriztian

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    May 08, 2015 @ 13:44
    Chriztian Steinmeier
    0

    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 :-)

    /Chriztian

  • AdeleMB 15 posts 39 karma points
    May 08, 2015 @ 15:28
    AdeleMB
    0

    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

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    May 08, 2015 @ 19:44
    Chriztian Steinmeier
    0

    Hi again,

    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.

    /Chriztian

  • AdeleMB 15 posts 39 karma points
    May 12, 2015 @ 17:00
    AdeleMB
    0

    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 :-)

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    May 13, 2015 @ 22:45
    Chriztian Steinmeier
    0

    Hi 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)

    /Chriztian

  • AdeleMB 15 posts 39 karma points
    May 15, 2015 @ 16:37
    AdeleMB
    0

    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 :-)

  • Dan 1288 posts 3921 karma points c-trib
    Jun 02, 2015 @ 15:17
    Dan
    0

    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:attribute name="src">
        <xsl:value-of select="umb:JsonToXml($file)/src" />
        <xsl:text>?width=200&amp;height=200&amp;mode=crop</xsl:text>
    </xsl:attribute>
    

    ...to:

    <xsl:attribute name="src">
        <xsl:value-of select="$file" />
        <xsl:text>?width=200&amp;height=200&amp;mode=crop</xsl:text>
    </xsl:attribute>
    

    Umbraco 7.2.4 by the way.

    Hope this helps someone at some point :)

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jun 02, 2015 @ 15:21
    Chriztian Steinmeier
    1

    Hi Dan,

    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!

    /Chriztian

  • Dan 1288 posts 3921 karma points c-trib
    Jun 02, 2015 @ 15:26
    Dan
    0

    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 :)

  • AdeleMB 15 posts 39 karma points
    Jun 02, 2015 @ 16:46
    AdeleMB
    0

    Fantastic, got it working with multiple IDs! Thank you both for your help, this package is going to be so useful for us :-)

Please Sign in or register to post replies

Write your reply to:

Draft