⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fancy-hist.xsl

📁 JSP页面代码排错
💻 XSL
📖 第 1 页 / 共 4 页
字号:
            var bug              = document.getElementById(bugId);

            if ( bugplaceholder==null) {
               alert(buguid+'-ph-'+list+' - '+buguid+' - bugplaceholder==null');
               return;
            }
            if ( bug==null) {
               alert(buguid+'-ph-'+list+' - '+buguid+' - bug==null');
               return;
            }

            var newBug = bug.innerHTML;
            var pattern = document.getElementById('tip-'+patternId).innerHTML;
            toggle(containerId);
            bugplaceholder.innerHTML = newBug + pattern;
         }
         function toggle(foo) {
            if( document.getElementById(foo).style.display == "none") {
               show(foo);
            } else {
               if( document.getElementById(foo).style.display == "block") {
                  hide(foo);
               } else {
                  show(foo);
               }
            }
         }
         function show(foo) {
            document.getElementById(foo).style.display="block";
         }
         function hide(foo) {
            document.getElementById(foo).style.display="none";
         }

         window.onload = function(){
            init();
         };
      ]]></xsl:text></script>
      <script type='text/javascript'>
         // versions fields: release id, release label
         var versions = new Array(
            <xsl:for-each select="/BugCollection/History/AppVersion">
               [ "<xsl:value-of select="@sequence" />", "<xsl:value-of select="@release" />" ],
            </xsl:for-each>
               [ "<xsl:value-of select="/BugCollection/@sequence" />", "<xsl:value-of select="/BugCollection/@release" />" ]
            );

         // categories fields: category id, category label
         var categories = new Array(
            <xsl:for-each select="/BugCollection/BugCategory">
               <xsl:sort select="@category" order="ascending" />
               [ "<xsl:value-of select="@category" />", "<xsl:value-of select="Description" />" ],
            </xsl:for-each>
               [ "", "" ]
            );

         // codes fields: code id, code label
         var codes = new Array(
            <xsl:for-each select="/BugCollection/BugCode">
               <xsl:sort select="@abbrev" order="ascending" />
               [ "<xsl:value-of select="@abbrev" />", "<xsl:value-of select="Description" />" ],
            </xsl:for-each>
               [ "", "" ]
            );

         // patterns fields: category id, code id, pattern id, pattern label
         var patterns = new Array(
            <xsl:for-each select="/BugCollection/BugPattern">
               <xsl:sort select="@type" order="ascending" />
               [ "<xsl:value-of select="@category" />", "<xsl:value-of select="@abbrev" />", "<xsl:value-of select="@type" />", "<xsl:value-of select="translate(ShortDescription, '&quot;', $apos)" />" ],

            </xsl:for-each>
               [ "", "", "", "" ]
            );

         // class stats fields: class name, package name, isInterface, total bugs, bugs p1, bugs p2, bugs p3, bugs p4
         var classStats = new Array(
            <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats/ClassStats">
               <xsl:sort select="@class" order="ascending" />
               [ "<xsl:value-of select="@class" />", "<xsl:value-of select="../@package" />", "<xsl:value-of select="@interface" />", "<xsl:value-of select="@bugs" />", "<xsl:value-of select="@priority_1" />", "<xsl:value-of select="@priority_2" />", "<xsl:value-of select="@priority_3" />", "<xsl:value-of select="@priority_4" />" ],
            </xsl:for-each>
               [ "", "", "", "", "", "", "", "" ]
            );

         // package stats fields: package name, total bugs, bugs p1, bugs p2, bugs p3, bugs p4
         var packageStats = new Array(
            <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats">
               <xsl:sort select="@package" order="ascending" />
               [ "<xsl:value-of select="@package" />", "<xsl:value-of select="@total_bugs" />", "<xsl:value-of select="@priority_1" />", "<xsl:value-of select="@priority_2" />", "<xsl:value-of select="@priority_3" />", "<xsl:value-of select="@priority_4" />" ],
            </xsl:for-each>
               [ "", "", "", "", "", "" ]
            );


         // bugs fields: bug id, category id, code id, pattern id, priority, release id, class name, packagename (populated by javascript)
         var bugs = new Array(
            <xsl:for-each select="/BugCollection/BugInstance[string-length(@last)=0]">

               [ "<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />",
                 "<xsl:value-of select="@category" />",
                 "<xsl:value-of select="@abbrev" />",
                 "<xsl:value-of select="@type" />",
                 <xsl:value-of select="@priority" />,
                 <xsl:choose><xsl:when test='string-length(@first)=0'>0</xsl:when><xsl:otherwise><xsl:value-of select="@first" /></xsl:otherwise></xsl:choose>,
                 "<xsl:value-of select="Class/@classname" />",
                 ""],
            </xsl:for-each>
               [ "", "", "", "", 0, 0, "", "" ]
            );

         // bugs fields: bug id, category id, code id, pattern id, priority, first release id, fixed release id, class name
         var fixedBugs = new Array(
            <xsl:for-each select="/BugCollection/BugInstance[string-length(@last)>0]">

               [ "<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" />",
                 "<xsl:value-of select="@category" />",
                 "<xsl:value-of select="@abbrev" />",
                 "<xsl:value-of select="@type" />",
                 <xsl:value-of select="@priority" />,
                 <xsl:choose><xsl:when test='string-length(@first)=0'>0</xsl:when><xsl:otherwise><xsl:value-of select="@first" /></xsl:otherwise></xsl:choose>,
                 <xsl:choose><xsl:when test='string-length(@last)>0'><xsl:value-of select="@last" /></xsl:when><xsl:otherwise>-42</xsl:otherwise></xsl:choose>,
                 "<xsl:value-of select="Class/@classname" />" ],
            </xsl:for-each>
               [ "", "", "", "", 0, 0, 0, "" ]
            );

      </script>
   </head>
   <body>
      <h3>
         <a href="http://findbugs.sourceforge.net">FindBugs</a> (<xsl:value-of select="/BugCollection/@version" />) 
         Analysis for 
         <xsl:choose>
            <xsl:when test='string-length(/BugCollection/Project/@projectName)>0'><xsl:value-of select="/BugCollection/Project/@projectName" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="/BugCollection/Project/@filename" /></xsl:otherwise>
         </xsl:choose>
      </h3>

      <div id='menuWrapper' style=''>
         <div id="navcontainer">
            <ul id="navlist">
               <li><a id='summary'           class="current" href="#" onclick="selectMenu('summary'); return false;"         >Summary</a></li>
               <li><a id='history'           class="none"    href="#" onclick="selectMenu('history'); return false;"         >History</a></li>
               <li><a id='listByCategories'  class="none"    href="#" onclick="selectMenu('listByCategories'); return false;">Browse By Categories</a></li>
               <li><a id='listByPackages'    class="none"    href="#" onclick="selectMenu('listByPackages'); return false;"  >Browse by Packages</a></li>
               <li><a id='info'              class="none"    href="#" onclick="selectMenu('info'); return false;"            >Info</a></li>
            </ul>
         </div>
      </div>

      <div id='displayWrapper'>

      <div style='height:25px;'>
         <div id='messageContainer' style='float:right;'>
            Computing data...
         </div>
         <div id='filterWrapper' style='display:none;'>
            <form name='findbugsForm'>
               <div id='filterContainer' >
                  <select name='versions' onchange='filter()'>
                     <option value="loading">Loading filter...</option>
                  </select>
                  <select name='priorities' onchange='filter()'>
                     <option value="loading">Loading filter...</option>
                  </select>
               </div>
            </form>
         </div>
         <div id='historyControlWrapper' style='display:none;'>
           <form name="findbugsHistoryControlForm">
             <div id='historyControlContainer'>
               <input type='checkbox' name='includeFixedIntroducedBugs'
                      value='checked' alt='Include fixed introduced bugs.'
                      onclick='includeFixedIntroducedBugsInHistory()' />
               Include counts of introduced bugs that were fixed in later releases.
             </div>
           </form>
         </div>
      </div>
         <div id='summaryContainer'          class='displayContainer'>
            <h3>Package Summary</h3>
            <table>
               <tr>
                  <th>Package</th>
                  <th>Code Size</th>
                  <th>Bugs</th>
                  <th>Bugs p1</th>
                  <th>Bugs p2</th>
                  <th>Bugs p3</th>
                  <th>Bugs Exp.</th>
               </tr>
               <tr>
                  <td class='summary-name'>
                     Overall
                     (<xsl:value-of select="/BugCollection/FindBugsSummary/@num_packages" /> packages),
                     (<xsl:value-of select="/BugCollection/FindBugsSummary/@total_classes" /> classes)
                  </td>
                  <td class='summary-size'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_size" /></td>
                  <td class='summary-priority-all'><xsl:value-of select="/BugCollection/FindBugsSummary/@total_bugs" /></td>
                  <td class='summary-priority-1'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_1" /></td>
                  <td class='summary-priority-2'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_2" /></td>
                  <td class='summary-priority-3'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_3" /></td>
                  <td class='summary-priority-4'><xsl:value-of select="/BugCollection/FindBugsSummary/@priority_4" /></td>
               </tr>
               <xsl:for-each select="/BugCollection/FindBugsSummary/PackageStats">
                  <xsl:sort select="@package" order="ascending" />
                  <xsl:if test="@total_bugs!='0'" >
                     <tr>
                        <td class='summary-name'><xsl:value-of select="@package" /></td>
                        <td class='summary-size'><xsl:value-of select="@total_size" /></td>
                        <td class='summary-priority-all'><xsl:value-of select="@total_bugs" /></td>
                        <td class='summary-priority-1'><xsl:value-of select="@priority_1" /></td>
                        <td class='summary-priority-2'><xsl:value-of select="@priority_2" /></td>
                        <td class='summary-priority-3'><xsl:value-of select="@priority_3" /></td>
                        <td class='summary-priority-4'><xsl:value-of select="@priority_4" /></td>
                     </tr>
                  </xsl:if>
               </xsl:for-each>
            </table>
         </div>

         <div id='infoContainer'             class='displayContainer'>
            <div id='analyzed-files'>
               <h3>Analyzed Files:</h3>
               <ul>
                  <xsl:for-each select="/BugCollection/Project/Jar">
                     <li><xsl:apply-templates /></li>
                  </xsl:for-each>
               </ul>
            </div>
            <div id='used-libraries'>
               <h3>Used Libraries:</h3>
               <ul>
                  <xsl:for-each select="/BugCollection/Project/AuxClasspathEntry">
                     <li><xsl:apply-templates /></li>
                  </xsl:for-each>
                  <xsl:if test="count(/BugCollection/Project/AuxClasspathEntry)=0" >
                     <li>None</li>
                  </xsl:if>
               </ul>
            </div>
            <div id='analysis-error'>
               <h3>Analysis Errors:</h3>
               <ul>
                  <xsl:variable name="error-count"
                                select="count(/BugCollection/Errors/MissingClass)" />
                  <xsl:if test="$error-count=0" >
                     <li>None</li>
                  </xsl:if>
                  <xsl:if test="$error-count>0" >
                     <li>Missing ref classes for analysis:
                        <ul>
                           <xsl:for-each select="/BugCollection/Errors/MissingClass">
                              <li><xsl:apply-templates /></li>
                           </xsl:for-each>
                        </ul>
                     </li>
                  </xsl:if>
               </ul>
            </div>
         </div>
         <div id='historyContainer'          class='displayContainer'>Loading...</div>
         <div id='listByCategoriesContainer' class='displayContainer'>Loading...</div>
         <div id='listByPackagesContainer'   class='displayContainer'>Loading...</div>
      </div>

      <div id='bug-collection' style='display:none;'>
      <!-- advanced tooltips -->
      <xsl:for-each select="/BugCollection/BugPattern">
         <xsl:variable name="b-t"><xsl:value-of select="@type" /></xsl:variable>
         <div>
            <xsl:attribute name="id">tip-<xsl:value-of select="$b-t" /></xsl:attribute>
            <xsl:attribute name="class">tip</xsl:attribute>
            <xsl:value-of select="/BugCollection/BugPattern[@type=$b-t]/Details" disable-output-escaping="yes" />
         </div>
      </xsl:for-each>

      <!-- bug descriptions - hidden -->
      <xsl:for-each select="/BugCollection/BugInstance[not(@last)]">
            <div style="display:none;" class='bug'>
               <xsl:attribute name="id">b-uid-<xsl:value-of select="@instanceHash" />-<xsl:value-of select="@instanceOccurrenceNum" /></xsl:attribute>
               <xsl:for-each select="*/Message">
                  <div class="b-r"><xsl:apply-templates /></div>
               </xsl:for-each>
               <div class="b-d">
                  <xsl:value-of select="LongMessage" disable-output-escaping="no" />
               </div>
            </div>
      </xsl:for-each>
      </div>
   </body>
</html>
</xsl:template>


</xsl:transform>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -