Book a Demo

Author Topic: HTML Reporting  (Read 5026 times)

slwiseman

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
HTML Reporting
« on: December 18, 2007, 09:04:41 am »
I'm trying to find out if it's possible to modify the navigation bar created within html reports so that only packages and diagrams are displayed and not the elements that are used within a diagram.  I find the current system messy and confusing for the customer and would prefer to only show them limited information.

any thoughts, etc would be much appriciated

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: HTML Reporting
« Reply #1 on: December 18, 2007, 09:45:55 pm »
I might be wrong, but AFAIK there is not much manipulation you can do to HTML generation...
Recursion definition:
If you don’t understand the definition read "Recursion definition".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: HTML Reporting
« Reply #2 on: December 19, 2007, 01:09:03 pm »
You can modify the HTML templates, but it's not quite as easy as the RTF templates.

Open the Resource Browser.  (View | Resources)  Open 'Templates', right click on 'Web Style Templates' and select 'Create HTML Template'.

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: HTML Reporting
« Reply #3 on: December 20, 2007, 09:37:13 am »
Never played with it (okay just briefly a long time ago), but there is a 'web style template' in the resources tab. It looks like you may be able to add / remove items using this?

slwiseman

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: HTML Reporting
« Reply #4 on: December 21, 2007, 02:02:40 am »
My colleague and I have worked out how to do it now.  For those of you that may be interested you need to modify the tocBuild Function which is shown below.  Basically we've added an if statement that will only include packages or diagrams into the final TOC

function tocBuild(data) {
var tocType = new Array();
var tocTypes = new Array();
var tocErrs = new Array();

for (var i=0; i<tocTab.length; i++) {

if (!tocTab[8]) tocTab[8] = 'misc';

if (tocTab[8].toLowerCase().indexOf('diagram')!=-1) tocTab[8] = "0Diagram";

if (tocTab[8].toLowerCase().indexOf('package')!=-1) tocTab[8] = "1Package";

if (!tocType[tocTab[8]])
{
tocType[tocTab[8]] = new Array();
tocTypes[tocTypes.length]=tocTab[8];
}
tocType[tocTab[8]][tocType[tocTab[8]].length] = i;
}

tocTypes.sort();

for (var i=0; i<tocTypes.length; i++)
{
for (var j=0; j<tocType[tocTypes].length; j++)
{
if ((tocTab[8].toLowerCase().indexOf('package')!=-1) || (tocTab[8].toLowerCase().indexOf('diagram')!=-1))
{
   var build = tocBuildItem(tocType[tocTypes][j]);

   if (build!=true)
   tocErrs[tocErrs.length]=build;
   }    
}
}

var errRuns=0;
var errTotal=tocErrs.length;

while(tocErrs.length!=0) {
if (errNums==tocErrs.length) { errRuns++;

if (errRuns>errTotal) { break;
}
}

var errNums=tocErrs.length;
var tmp=tocBuildItem(tocErrs.shift());

if(tmp!=true) tocErrs[tocErrs.length]=tmp;
}

while(tocErrs.length!=0) {

tocTab[tocErrs[0]][6]="0";
tocBuildItem(tocErrs.shift());
}

if (tocLastID!=0) {
var tocLastSrc = document.getElementById("toc"+tocLastID).parentNode.childNodes[document.getElementById("toc"+tocLastID).parentNode.childNodes.length-4];

tocLastSrc.src = tocLastSrc.src.substring(tocLastSrc.src.lastIndexOf('images')).replace("01","02");

}
}

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: HTML Reporting
« Reply #5 on: December 21, 2007, 04:48:20 am »
Well done! :)
Recursion definition:
If you don’t understand the definition read "Recursion definition".

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: HTML Reporting
« Reply #6 on: December 23, 2007, 03:34:12 pm »
While I haven't personally tested the modification that you posted, I thought it looked interesting and potentially useful to other people, so I have posted a copy on the EA User Group WIKI site for future reference.

HTML (Packages And Diagrams Only)

jdewitt

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: HTML Reporting
« Reply #7 on: January 04, 2008, 02:40:15 pm »
Thanks a lot for steering me in the right direction. We received several requests at my company to filter the table of contents.

The code as posted contains a bug. The 'if' statement around the tocBuildItem() function should be changed from

 if ((tocTab[8].toLowerCase().indexOf('package')!=-1) || (tocTab[8].toLowerCase().indexOf('diagram')!=-1))

to

  if ((tocTypes.toLowerCase().indexOf('package')!=-1) || (tocTypes.toLowerCase().indexOf('diagram')!=-1))

« Last Edit: January 04, 2008, 03:23:20 pm by jdewitt »