Wednesday, 03 March 2010 11:00

Add Diagram Feedback and Comment Link to HTML Report

Written by
Rate this item
(3 votes)

This describes a modification to the HTML report template which adds a link to each diagram which allows feedback to be provided by email on the diagram being viewed. The email captures the comments together with diagram identity and a hyperlink back to the diagram being commented on.

Specifically the email generated by the hyperlink provides:

  • a hyperlink to the diagram commented on
  • the GUID
  • diagram author name
  • diagram modification date
  • feedback comment

Modify the HTML Report Template

  • Under the Resources pane select the Web Style Templates
  • Right-click to select 'Create HTML Template'
  • Give it a suitable name.
  • Under the list of templates that appear in the left pane select 'Body - Diagram'
  • Somewhere around line 4 you will see 

<div class="PageBody">

 #IMAGE#

 <div class="ObjectTitle">#NAME# : #TYPE# diagram</div>

  • Insert the following javascript

 

 

 

<script type="text/javascript">

//-----------------------------------

function feedbackEmailLink(emailAddress,guidString,title,modified,author,modelRootToIndexHTM)

{

 var oGuid=guidString.substring(1,guidString.length-1);

 //url for EA object of form http://path/path/path/Index.htm?guid=xxxxxxxxxxxx

 var oURL=modelRootToIndexHTM +'/index.htm?guid=' + oGuid;

 var eMailSubject='subject=Feedback on - '+ title +' - by '+ author;

 var bodyNewLine='%0A';

 var objectHyperlinkString =  oURL;

 var eMailBody='Diagram Title - ' +title +bodyNewLine + 'ID - ' + oGuid + bodyNewLine + 'URL - ' + oURL + bodyNewLine +'Author - ' + author + bodyNewLine + 'Modified Date - ' + modified + bodyNewLine+ bodyNewLine + 'Feedback Comment' + bodyNewLine ;

 var eMailLinkText='<a href="mailto:'+emailAddress+'?'+ eMailSubject+ '&body='+eMailBody + '">Send feedback on this view</a>';

return eMailLinkText;

}

 

//-----------------------------------

</script>

 

<div>
 #IMAGE#
 <div>#NAME# : #TYPE# diagram</div>
  • Look further down until you see the following:

 

 

 

 <tr>

 <td width="15%" class="ObjectDetailsTopic">Modified:</td>

 <td width="85%" class="ObjectDetailsValue">#MODDATE#</td>

 </tr>

 

 

  • After this point you want to insert a new row into the table with the link to create the feedback email. Paste the following afterwards:

 

 

 

 <tr id="contact">

 <td width="15%" class="ObjectDetailsTopic">Feedback:</td>

 <td width="85%" class="ObjectDetailsTopic">

 <script type="text/javascript">

 document.write(feedbackEmailLink('YOUR_EMAIL','#GUID#','#NAME#','#MODDATE#','#AUTHOR#','http://YOUR_URL'));

 </script>

 </td>

 

 

 </tr>

  • replacing YOUR_EMAIL with the email address you want it to go to and YOUR_URL with the base URL (folder in which the index.html of the exported model sits)
  • Save the modified template.

Use of the Template

  1. In the Project Browser select the folder/package to be exported
  2. Right-click and select Documentation | HTML Report
  3. In the Generate HTMl Report window that appears select the Style drop-down list and select the template you've just saved.

That's it!

 

The End Result

 Snapshot of a diagram with the custom feedback link

 

and when the reader clicks on the link he/she gets:

 

Snapshot of the customised email that results from clicking on the feedback link

 

 

Other Possibilities

You can also use the same method to display a permalink (url) for each diagram so that visitors can link directly to a specific diagram.

 

This can be seen in an online repository http://trak-community.org/TRAK_Demo_Repository/

Diagram showing a permalink created during HTML export.

 

 

Read 12501 times
wikitect

Nic Plum

Eclectica Systems Ltd. (Consultant)

Nic is a long time systems engineer/thinker who has worked mostly in aerospace and defence but has diversified into big government projects and more recently rail and transport. He views enterprise architecture and modelling as one of the essentials to any toolkit. Over the last year he has co-created TRAK - an architecture framework based on MODAF - using EA and has developed an MDG Technology to implement it within EA - and learnt a lot in the process! TRAK is a simple, pragmatic, no-nonsense framework which is based firmly around the user (not the specifier or tool vendor ;-) ) - it has to be easy to user & 'obvious'...

sf.net/p/mdgfortrak

1 comment

  • Comment Link FatmaYB Wednesday, 05 February 2014 14:09 posted by FatmaYB

    Hi Nic,
    Thank you very much for this usefull code.
    I need to change html icons to use my client website standard icons but I don't know what i have to change in HTML report template.
    Could you please help me to fix this issue?
    Thanks in advance

    Regards,

    Fatma Yilmaz
    Data Architect
    FYB London Ltd

Login to post comments