Generate Fusebox Circuits and Fuses document

February 26, 2008

Someone has just asked on Fusebox 5 group if there is a tool for Fusebox to generate a site map for development purposes. If you’re using the new fangled noxml version have a look here. For Fusebox xml users, this should do it. Hope it is useful - let me know!

<cfset lstHidefuses = "postfuseaction,prefuseaction" />

<cfoutput>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document Fusebox Application</title>
<style type="text/css">
body{
  font-family:'Lucida Sans Unicode', 'Lucida Sans', Verdana, Arial, Helvetica, sans-serif;
  font-size:62.5%;
  line-height:1.6em;
  margin: 15px 10 20px 10px;
  padding:0;
  background-color:##FAFAFA;
  color: ##525252;
}

h1{
  font-size:1.4em;
  font-weight:bold;
  margin:0 0 16px 0;
  padding:0 0 5px 0;
  border-bottom:1px solid ##e7e7e7;
  color:##5e5e5e;
}

h2{
  font-size:1.2em;
  font-weight:bold;
  padding:12px 0px 2px 3px;
  margin:15px 0 8px 0px;
  border-bottom:1px solid ##e7e7e7;
  color:##5e5e5e;
  clear:both;
}
p, li, dd, dt{font-size:1.1em;}
p{ margin: 0 0 20px 0; }

/* Tables */
table {width:100%;}
caption {text-align:left; font-style:italic}

th {text-align:left; background-color:##CCCCCC}
.property {background-color:##F3F3F3; width:20%;}

ul##nav{
  margin:0px;
  padding:4px 0 4px 0px;
  list-style:none;
}

##nav li{
  display:inline;
  margin:0 2px 0 0;
  padding:0px 10px 0 0px;
  font-size:1.1em;
  float:left;
}
</style>
</head>

<body id="top">

<h1>Fusebox Controller Circuits (defined in fusebox.xml)</h1>

<ul id="nav">
<cfloop collection="#Application.fusebox.Circuits#" item="ndxCircuit">
  <cfif ListFindNoCase(Application.fusebox.Circuits[ndxCircuit].path, "Controller", "/") neq 0>
  <li><a href="##circuit_#ndxCircuit#">#ndxCircuit#</a></li>
  </cfif>
</cfloop>
</ul>

<cfloop collection="#Application.fusebox.Circuits#" item="ndxCircuit">
  <cfset oMetaData = Application.fusebox.Circuits[ndxCircuit] />

  <cfif ListFindNoCase(oMetaData.path, "Controller", "/") neq 0>
  <h2 id="circuit_#ndxCircuit#">#ndxCircuit#</h2>
  <p>
    <strong>Path:</strong> #oMetaData.path#<br />
    <strong>Parent:</strong> <cftry>#oMetaData.parent#<cfcatch>[none]</cfcatch></cftry>
    <strong>Access:</strong> <cftry>#oMetaData.access#<cfcatch>[none]</cfcatch></cftry>
    <strong>Permissions:</strong> <cftry>#oMetaData.permissions#<cfcatch>[none]</cfcatch></cftry>
  </p>

  <table summary="fuses in the #ndxCircuit# circuit">
    <caption>Fuses in the #ndxCircuit# circuit</caption>
    <cfloop collection="#Application.fusebox.Circuits[ndxCircuit].FuseActions#" item="ndxFuse">
      <cfif ListFindNoCase(lstHidefuses, ndxFuse) eq 0>
        <tr>
          <th scope="col" colspan="2">
            #ndxFuse# [#ndxCircuit#.#ndxFuse#]
          </th>
        </tr>
        <tr>
          <td class="property">access:</td>
          <td><cftry>#oMetaData.FuseActions[ndxFuse].access#<cfcatch>[none]</cfcatch></cftry></td>
        </tr>
        <tr>
          <td class="property">permissions:</td>
          <td><cftry>#oMetaData.FuseActions[ndxFuse].permissions#<cfcatch>[none]</cfcatch></cftry></td>
        </tr>
      </cfif>
    </cfloop>
  </table>
  <p><a href="##top">back to the top</a></p>
  </cfif>
</cfloop>

</body>
</html>
</cfoutput>

No comments

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.