cross site system-view tag issue

jvienneau's Avatar

jvienneau

08 Sep, 2014 08:43 PM

I have an server side include that needs different paths for images in order to render in Cascade and have the correct path once published. So I'm keeping the include in one site so other sites can pull from it.

[system-view:external]<img alt="Logo: Wesleyan University" src="/resources/images/${logoname}"/>[/system-view:external]
[system-view:internal]<img alt="Logo: Wesleyan University" src="${logopath}"/>[/system-view:internal]

This seems to work as expected in the page that is the include but when I try and pull this into another site, the entire section is surrounded by the system-view internal pseudo tag. What I am trying to say is that it seems to work but the pseudo tag is printed to the page. Any ideas?

  1. 1 Posted by Ryan Griffith on 09 Sep, 2014 12:58 PM

    Ryan Griffith's Avatar

    Hi,

    I would like to try and test this locally if possible. When you have a moment, please provide the contents of the Format as well as a sample XML from a page that is within the same Site and a page that is in another Site. You can obtain the sample XML by editing the Format and using the Preview Options, and selecting the appropriate context Block and Page.

    Also, what version of Cascade Server are you currently running?

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by jvienneau on 09 Sep, 2014 01:41 PM

    jvienneau's Avatar

    Hi Ryan,

    I’m using a data definition block which is included in a region on both a local site and another site. Same data definition block and same velocity script on both. I don’t get the [system-view:internal] on the site that contains the data definition block and velocity script. The data definition block and script is in the default region on the local site and in an additional region(not default) on the other site.

    Upon investigating more, I suspect the issue is in the other site template, where I would only like to have a region viewable internally. I would like to use the same velocity script and data definition block for both the include and the internal view for Cascade. Is there another way to do this? It mostly works with the exception of the other site printing the [system-view:internal]. Are these pseudo tags handled like they are “nested"? I can have separate velocity scripts without pseudo tags(which I believe would work) but it would be nice to have them combined into one.

    Thanks for your help,
    Jason

    Include site template

    <system-region name=“DEFAULT”/>
    

    Other site template

    [system-view:internal]
    <system-region name="INCLUDE-HEADER"/>
    [/system-view:internal]
    [system-view:external]
    <!--#include virtual="[system-asset:id=462691d28185062c40287b90868b8545]site://Resources/includes/header[/system-asset]" -->
    [/system-view:external]
    

    Data definition block

    <system-data-structure>
        <logo type="file">
            <content/>
            <path>/images/logo.gif</path>
            <link>site://Resources/images/logo.gif</link>
            <site>Resources</site>
            <name>logo.gif</name>
        </logo>
        <tools type="block">
            <content>
                <system-data-structure>
                    <menu-item>
                        <item-text>Portfolio</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>https://webapps.wesleyan.edu/portal</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>Directory</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>Library</item-text>
                        <internal-link type="page">
                            <content/>
                            <path>/index</path>
                            <dynamic-metadata>
                                <name>hidefrommenu</name>
                                <value>No</value>
                            </dynamic-metadata>
                            <link>site://Library/index</link>
                            <site>Library</site>
                            <name>index</name>
                            <display-name>Library Home</display-name>
                            <title>Library</title>
                        </internal-link>
                        <external-link/>
                    </menu-item>
                    <menu-item>
                        <item-text>OneStop</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>WesConnect</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>Calendar</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>WesMaps</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>WFS</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>Moodle</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>EMS</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                    <menu-item>
                        <item-text>GApps</item-text>
                        <internal-link>
                            <path>/</path>
                        </internal-link>
                        <external-link>#</external-link>
                    </menu-item>
                </system-data-structure>
            </content>
            <path>/includes/menus/tools</path>
            <site>Resources</site>
            <name>tools</name>
        </tools>
    </system-data-structure>
    

    The velocity script

    #import('/_internal/formats/menus/list-menu-macro')
    
    #set ($tools = $_XPathTool.selectNodes($contentRoot, "//system-data-structure/tools/content/system-data-structure/menu-item"))
    #set ($logoname = $_XPathTool.selectSingleNode($contentRoot, "//system-data-structure/logo/name").value)
    #set ($logopath = $_XPathTool.selectSingleNode($contentRoot, "//system-data-structure/logo/link").value)
    
    ## Black bar for medium screens and up
    <section class="navigation-section show-for-medium-up">
        <header class="blackbar">
            <div class="row">
                <div class="large-8 medium-7 columns logo">
                    [system-view:external]<img alt="Logo: Wesleyan University" src="/resources/images/${logoname}"/>[/system-view:external]
                    [system-view:internal]<img alt="Logo: Wesleyan University" src="${logopath}"/>[/system-view:internal]
                </div>
                <div class="large-1 medium-2 columns"><a class="small button dropdown tools" data-dropdown="dropTools" href="#">Tools</a><br/>
                    <ul class="f-dropdown" data-dropdown-content="" id="dropTools">
                        #foreach($tool in $tools)
                            <li>#printMenuItem($tool)</li>
                        #end
                    </ul>
                </div>
                <div class="large-3 medium-3 columns">
                    <form action="http://www.wesleyan.edu/search/search-results.html" id="cse-search-box">
                    <div class="row">
                        <div class="large-12 columns">
                            <div class="row collapse">
                            <div class="medium-8 columns"><input name="cx" type="hidden" value="001254463385620737445:nbar83le1bc"/> <input name="cof" type="hidden" value="FORID:11"/> <input name="ie" type="hidden" value="UTF-8"/> <input class="tiny" name="q" size="15" type="text"/></div>
                            <div class="medium-4 columns"><button class="button postfix search radius">Search</button></div>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </header>
    </section>
    ## Black bar for medium screens and up
    

    With macro

    #macro(printMenuItem $element)
        #set($text = $element.getChild('item-text').value)
        #set($internalLink = $element.getChild('internal-link').getChild('link').text)
        #set($internalPath = $element.getChild('internal-link').getChild('path').text)
        #set($externalLink = $element.getChild('external-link').text)
        #set($path = "")
        
        ## If there is no internal page selected, set path to external link
        #if($internalPath == '/')
            #set($path = $externalLink)
        #else
            #set($path = $internalLink)
        #end
        
        <a href="$path">${_EscapeTool.html($text)}</a>
    #end
    
  3. 3 Posted by jvienneau on 09 Sep, 2014 01:45 PM

    jvienneau's Avatar

    I'm running version 7.10.2.

  4. 4 Posted by jvienneau on 12 Sep, 2014 01:03 PM

    jvienneau's Avatar

    I added a conditional statement so the psuedo tags are only applied to the include page and not other pages. It is working for me now.

    #set ($pagename = $currentPage.name)
    #if($pagename == "header")
    [system-view:external]<img alt="Logo: Wesleyan University" src="/resources/images/${logoname}"/>[/system-view:external]
    [system-view:internal]<img alt="Logo: Wesleyan University" src="${logopath}"/>[/system-view:internal]
    #else
    <img alt="Logo: Wesleyan University" src="${logopath}"/>
    #end
    
  5. jvienneau closed this discussion on 12 Sep, 2014 01:35 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac