ev3 : unprotected chars in timeline definitions

Post Reply
jmk
Posts: 137
Joined: 31 May 2012, 12:08
Location: France

the character "'" appearing in (project) titles should be protected when used in timelines.

This should be the case in, for example, in enterprise/core_el_programme_plan.xsl.

J.-M.
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks very much for your post. This is indeed a bug.

We have identified and resolved the issue and will include this in the next release of Essential Architecture Manager.

In the meantime, you can fix this by editing the file:

common/core_utilities.xsl

In the template, RenderInstanceLinkText, we need to do the following:

Code: Select all

<xsl:value-of select="$instanceName" /> 
should become

Code: Select all

<xsl:value-of select="$instanceName"  disable-output-escaping="yes"/>
Note that there are 2 <xsl:value-of> statements in this template. Lines 880 and 884 in the current version of core_utilities.xsl

Jonathan
Essential Project Team
jmk
Posts: 137
Joined: 31 May 2012, 12:08
Location: France

Jonathan,
thanks for your answer but the fix you gave has no effect...

Test case:
Good:
1) create a plan named "My plan"
2) create a project named "Amélioration expérience utilisateur" and fill in some dates
3) publish
4) in ev3 : goto programme plan and click on "My plan"
=> the time line appears

Bad:
2) rename the project "Amélioration de l'expérience utilisateur" (We added the "de l'")
3) publish
4) in ev3 : no timeline appears.

J.-M.
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks for this. We tested with double quotes, " but apologies, we did not test the '

We'll work on this and get back to you. I think the solution should still be in the core_utilities.xsl in that template, so that this fix works for text rendered anywhere (not just plans).

Jonathan
Essential Project Team
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Just a quick post to say that I have resolved this issue and it is a bit more complex than we first suggested.

The problem lies with escaping the characters, not for XML/HTML but for Javascript - specifically the JSON data that is used by the timeline widget.

This means updates to the core_utilities.xsl and the core_el_programme_plan.xsl template. It may also mean updates to other templates and I am going to establish the impact before we release updated template code.

In the meantime, to get your View working, here is what I have done.

In core_utilities.xsl, I added a new function called renderJSText() as follows:

Code: Select all

<!-- FUNCTION TO RENDER TEXT FOR JAVASCRIPT WITH ESCAPED QUOTES -->
    <xsl:function name="eas:renderJSText" as="xs:string">
        <xsl:param name="theText"></xsl:param>
        <xsl:variable name="apos">'</xsl:variable>
        <xsl:variable name="quote">"</xsl:variable>
        <xsl:variable name="escapeApos">\\'</xsl:variable>
        <xsl:variable name="escapeQuote">\\"</xsl:variable>
        
        <xsl:variable name="anAposEscapedText" select="replace($theText, $apos, $escapeApos)"/>
        <xsl:value-of select="replace($anAposEscapedText, $quote, $escapeQuote)"></xsl:value-of>
        
    </xsl:function>
At the moment, this just handles single and double quotes. Putting this in a function means that we can add more escape sequences as we encounter them.

Then, we use this function in the core_el_programme_plan.xsl template as follows from line 181:

Code: Select all

<xsl:variable name="linkURL">
							<xsl:variable name="aProjectName" select="current()/own_slot_value[slot_reference='name']/value"/>
							<xsl:call-template name="RenderFullLinkText">
								<xsl:with-param name="theURLPrefix" select="$theURLPrefix"/>
								<xsl:with-param name="theXSL" select="'enterprise/core_el_project_summary.xsl'"></xsl:with-param>
								<xsl:with-param name="theInstanceID" select="current()/name"/>
								<xsl:with-param name="theXML">reportXML.xml</xsl:with-param>
								
								<xsl:with-param name="theHistoryLabel">Project Summary - <xsl:value-of select="eas:renderJSText($aProjectName)"/></xsl:with-param>
								<xsl:with-param name="viewScopeTerms" select="$viewScopeTerms"/>
							</xsl:call-template>
						</xsl:variable>
						<xsl:text>{'start': '</xsl:text><xsl:value-of select="$formattedStartDate"/><xsl:text>',
							'end': '</xsl:text><xsl:value-of select="$formattedEndDate"/><xsl:text>',</xsl:text>
						<xsl:text>'title': '</xsl:text><xsl:value-of select="eas:renderJSText($currentProjectName)" /><xsl:text>',</xsl:text>
						'description': '<strong>Summary</strong><br/><xsl:value-of select="eas:renderJSText($currentProjectDescription)"/><br/><br/><strong>Start Date: </strong><xsl:value-of select="$displayStartDate"/><br/><strong>End Date: </strong><xsl:value-of select="$displayEndDate"/><xsl:text>',
							'link': '</xsl:text><xsl:value-of select="$linkURL"/>
						<xsl:text>',
								caption: '</xsl:text>Project Status: <xsl:value-of select="$projectStatusName"/><xsl:text>'
									}</xsl:text><xsl:if test="not(position()=count($projects))">,</xsl:if>
I've pasted a whole block in here because it should be easier to see what is going on rather than picking out individual lines. It's worth pasting this into your XSL editor to see the code more clearly.

Wherever the name or the description of the project is to be rendered (either could contain ' or "), we use the eas:renderJSText() function to add the required escape characters.

As I say, treat this as a temporary fix at the moment - we may find a better approach when we look at the other Views that use Javascript / JSON components.

Thanks again for telling us of this bug and we will resolve it in the next minor release of Essential Viewer.

Jonathan
Essential Project Team
jmk
Posts: 137
Joined: 31 May 2012, 12:08
Location: France

Jonathan,
thanks for the fix I'll try it ASAP.

Meantime .. I wonder why the same problem does not occur in "the project network view".

If you try this view with my use case you'll there is no problem with the "'".

This behavior divergence beween the two views is rather strange as RadialGraphs also uses JSON.


BTW The "project network view" is really neat. Do you plan to define a similar view for application/(information|data) by any chance :) ?
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks for the post.
I spotted this as I was putting together this fix the other day and we are working on this now.

Thanks for the suggestion of using the network diagram for application to information/data. We'll take a look at that, too.

Have you tried the Data Object Provider Model View?

Jonathan
Essential Project Team
jmk
Posts: 137
Joined: 31 May 2012, 12:08
Location: France

Jonathan,

thanks for your last fix. It works now ...

Have you tried the Data Object Provider Model View?
I'm still struggling with the information/data paradigms so I am able to see only a few of them :)

These view are great (as the whole essential project :) but a radialgraph would give us a more global navigation tool.
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Yes, within the team we've already got a bunch of ideas where we could use things like the network widget to provide alternative (and better) views for this stuff.

We'll keep you all posted with new Views as we create them!

Jonathan
Essential Project Team
Post Reply