Copied to clipboard

Flag this post as spam?

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


  • Rik Helsen 670 posts 873 karma points
    Nov 27, 2009 @ 16:41
    Rik Helsen
    3

    having the default macro message in WYSIWYG contain the name of the macro it's displaying

    does anyone know how i can include the macro name in the default message a macro displays when it doesn't display content in the wysiwyg editor?

     

    now it's always a box with "No macro content available for WYSIWYG editing"

    I'd like to see this become something like:

    "Control: ProductionSearchNL.ascx - No macro content available for WYSIWYG editing"
    "XSL: NavigationFromSource.xsl - No macro content available for WYSIWYG editing"

    All suggestions are more than welcome!

    Kind regards,

    Rik

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 27, 2009 @ 17:21
    Dirk De Grave
    0

    Don't think it can be done without 'hacking/modifying' the core code. But I do like your idea (+1)

    Ideally, a macro could have a 'design' mode (just as plain asp.net controls) which could be used to set the content for the rte.

    Can you log this issue on Codeplex? You'll get my vote!

     

    Cheers,

    /Dirk

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 27, 2009 @ 22:53
    Chriztian Steinmeier
    1

    Me too - I've been wanting to do this since I first saw that orangey dotted box in my editor :-)

    I just think I've nailed it - create a new XSLT file and paste the following complete code into it - just replace the ***YOUR-MACRO-ALIAS-HERE*** with the alias of your macro:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
        <!ENTITY macroAliasParam "umb_macroAlias">
        <!ENTITY umbMacroResult "/umbraco/macroResultWrapper.aspx">
        <!ENTITY myMacroAlias "***YOUR-MACRO-ALIAS-HERE***">
    ]>
    <xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library"
        exclude-result-prefixes="msxml umbraco.library">
    
        <xsl:output method="xml" omit-xml-declaration="yes"/>
    
        <xsl:param name="currentPage"/>
    
        <xsl:variable name="isRenderingForEditor" select="umbraco.library:RequestQueryString('&macroAliasParam;') = '&myMacroAlias;' and umbraco.library:RequestServerVariables('SCRIPT_NAME') = '&umbMacroResult;'" />
    
        <xsl:template match="/">
            <xsl:choose>
                <xsl:when test="$isRenderingForEditor">
                    <xsl:call-template name="RenderMacroForEditor" />
                </xsl:when>
                <xsl:otherwise>
                    <p>
                        This is a test macro!
                    </p>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    
        <xsl:template name="RenderMacroForEditor">
            <p>
                This is a custom macro we coded for you, our favorite client!
                    (Obviously we'll put your logo here!)
            </p>
        </xsl:template>
    
    </xsl:stylesheet>

    Save it and go on to edit the Macro, where you enable the Use in editor and Render content in editor settings. Save that and find a page to test your new macro on...

    You should see the contents of the named template when you're in the editor, and the contents of the otherwise instruction on the published website.

    /Chriztian

  • Rik Helsen 670 posts 873 karma points
    Dec 03, 2009 @ 09:43
    Rik Helsen
    0

    thanks a lot for this suggestion, i'll take a closer look when i'm less busy ;)

Please Sign in or register to post replies

Write your reply to:

Draft