Add Diagram Feedback and Comment Link to HTML Report

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. An example using this to add a diagram permalink is at http://trak-community.org/TRAK_Demo_Repository/

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.

 

 

About the Author

Nic Plum

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'...

Comments

  • It is possible to use any of the recognised fields in http://www.sparxsystems.com/enterprise_architect_user_guide/report_gener.... I assume it allows any field to be used and this table shows what field is used in what HTML template. For example, this tip modifies body - diagram and therefore any of the fields in the first 'Body - Diagram' row can be used. My suggestion would be to add 2 extra table rows (.... etc) and see if the result shows. Have you tried this already?

  • Dear Nic, since I couldn't find a solution, (how) is it also possible to add/use fields like #PRIORITY# or #DIFF# in the "Body – Object" section? Thanks and regards!

  • Dear Nic, since I couldn't find a solution, (how) is it also possible to add/use fields like #PRIORITY# or #DIFF# in the "Body – Object" section? Thanks and regards!

    • Have a look at the help page "HTML Template Fragments", where all fields usable in the inulidual sections are listed. #PRIORITY# or #DIFF# don't seem to be availabe in any body sections though