<commit_before><?xml version='1.0'?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:param name="baseActionURL">default</xsl:param>
<xsl:param name="allowRefresh">true</xsl:param>
<xsl:param name="allowReinstantiation">true</xsl:param>
<xsl:param name="showStackTrace">false</xsl:param>


<xsl:template match="error">

<xsl:apply-templates select="channel"/>

<table align="center" border="0" cellspacing="2" cellpadding="3" width="90%">
  <caption class="uportal-channel-table-caption">Error Report</caption>
  <xsl:if test="message">
  <tr>
    <th class="uportal-channel-table-header">Message</th>
    <td><xsl:value-of select="message"/></td>
  </tr>
  </xsl:if>
  <tr>
    <th class="uportal-channel-table-header">Error type</th>
    <td>
      <xsl:choose>
        <xsl:when test="@code='4'">Channel timed out (code 4)</xsl:when>
        <xsl:when test="@code='1'">Channel failed to render (code 1)</xsl:when>
        <xsl:when test="@code='2'">Channel failed to initialize (code 2)</xsl:when>
        <xsl:when test="@code='3'">Channel failed to accept runtime data (code 3)</xsl:when>
        <xsl:when test="@code='0'">General error (code 0)</xsl:when>
        <xsl:when test="@code='5'">Channel failed to accept PCS (code 5)</xsl:when>
        <xsl:when test="@code='-1'">uPortal error (code -1)</xsl:when>
      </xsl:choose>
    </td>
  </tr>
  <xsl:apply-templates select="exception"/>
</table>

<div align="center">
<form action="{$baseActionURL}" method="post">       
  <input type="hidden" name="action" value="channelFate"/>
  <xsl:if test="$allowRefresh='true'">
  <input type="submit" name="channel_fate" value="Retry"/>
  </xsl:if>
  <xsl:if test="$allowReinstantiation='true'">
  <input type="submit" name="channel_fate" value="Restart channel"/>
  </xsl:if>
  <xsl:if test="exception">
  <xsl:choose>
    <xsl:when test="$showStackTrace='true'">
      <input type="submit" name="toggle_stack_trace" value="Hide stack trace"/>
    </xsl:when>
    <xsl:otherwise>
      <input type="submit" name="toggle_stack_trace" value="Show stack trace"/>
    </xsl:otherwise>
  </xsl:choose>
  </xsl:if>
</form>
</div>

</xsl:template>


<xsl:template match="channel">
  <table align="center" width="100%"><tr><td bgcolor="#eeeeee" class="uportal-channel-warning">
    <xsl:value-of select="name"/> [ID=<xsl:value-of select="id"/>]<br/>
    is currently experiencing problems.
  </td></tr></table>
</xsl:template>

<xsl:template match="exception">
  <tr>
    <th class="uportal-channel-table-header">Problem type</th>
    <td>
      <xsl:choose>
        <xsl:when test="@code='-1'">runtime exception (code -1)</xsl:when>
        <xsl:when test="@code='0'">general rendering problem (code 0)</xsl:when>
        <xsl:when test="@code='1'">internal timeout (code 1)</xsl:when>
        <xsl:when test="@code='2'">authorization problem (code 2)</xsl:when>
        <xsl:when test="@code='3'">missing resource (code 3)</xsl:when>
      </xsl:choose>
    </td></tr>
  <xsl:if test="@code='1'">
  <tr>
    <th class="uportal-channel-table-header">Timeout limit</th>
    <td><xsl:value-of select="timeout/@value"/></td>
  </tr>
  </xsl:if>
  <xsl:if test="@code='3'">
  <tr>
    <th class="uportal-channel-table-header">Resource description</th>
    <td><xsl:value-of select="resource/description"/>&#160;</td>
  </tr>
  <tr>
    <th class="uportal-channel-table-header">Resource URI</th>
    <td><xsl:value-of select="resource/uri"/></td>
  </tr>
  </xsl:if>
  <tr>
    <th class="uportal-channel-table-header">Error message</th>
    <td><xsl:value-of select="message"/></td>
  </tr>
  <xsl:if test="$showStackTrace='true'">
  <tr>
    <th class="uportal-channel-table-header"><b>Stack trace</b></th>
    <td><xsl:value-of select="stack"/></td>
  </tr>
  </xsl:if>
</xsl:template>

</xsl:stylesheet><commit_msg>Improved stylesheet.  I'm checking this in for <NAME>.<commit_after><?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" indent="yes"/>
  <xsl:param name="baseActionURL">baseActionURL_false</xsl:param>
  <xsl:variable name="baseMediaURL">media/org/jasig/portal/channels/CError/</xsl:variable>
  <xsl:param name="allowRefresh">true</xsl:param>
  <xsl:param name="allowReinstantiation">true</xsl:param>
  <xsl:param name="showStackTrace">true</xsl:param>
  <xsl:template match="error">
    <table border="0" width="100%" cellspacing="0" cellpadding="4">
      <tr>
        <td colspan="2" nowrap="nowrap" align="center" class="uportal-background-med">
          <p class="uportal-channel-title">Error Report</p>
        </td>
      </tr>
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Channel ID: </p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:value-of select="channel/id"/>
        </td>
      </tr>
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Message: </p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:if test="not(message) or message = ''">Message not available</xsl:if>
          <xsl:value-of select="message"/>
        </td>
      </tr>
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Error type: </p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:choose>
            <xsl:when test="@code='4'">Channel timed out (code 4)</xsl:when>
            <xsl:when test="@code='1'">Channel failed to render (code 1)</xsl:when>
            <xsl:when test="@code='2'">Channel failed to initialize (code 2)</xsl:when>
            <xsl:when test="@code='3'">Channel failed to accept runtime data (code 3)</xsl:when>
            <xsl:when test="@code='0'">General error (code 0)</xsl:when>
            <xsl:when test="@code='5'">Channel failed to accept PCS (code 5)</xsl:when>
            <xsl:when test="@code='-1'">uPortal error (code -1)</xsl:when>
          </xsl:choose>
        </td>
      </tr>
      <xsl:apply-templates select="exception"/>
      <tr>
        <td valign="top" align="right" class="uportal-background-med">
          <xsl:if test="$allowRefresh='true'">
            <a>
              <xsl:attribute name="href"><xsl:value-of select="string($baseActionURL)"/>action=retry</xsl:attribute>
              <img border="0" width="16" height="16" alt="Retry the channel">
                <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>error_refresh.gif</xsl:attribute>
              </img>
            </a>
            <img alt="interface image" border="0" width="10" height="10">
              <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>transparent.gif</xsl:attribute>
            </img>
          </xsl:if>
          <xsl:if test="$allowReinstantiation='true'">
            <a>
              <xsl:attribute name="href"><xsl:value-of select="string($baseActionURL)"/>action=restart</xsl:attribute>
              <img border="0" width="16" height="16" alt="Restart the channel">
                <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>error_reboot.gif</xsl:attribute>
              </img>
            </a>
            <img alt="interface image" border="0" width="10" height="10">
              <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>transparent.gif</xsl:attribute>
            </img>
          </xsl:if>
          <xsl:if test="exception">
            <xsl:choose>
              <xsl:when test="$showStackTrace='true' and */stack">
                <a>
                  <xsl:attribute name="href"><xsl:value-of select="string($baseActionURL)"/>action=toggle_stack_trace</xsl:attribute>
                  <img border="0" width="16" height="16" alt="Hide stack trace">
                    <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>error_hide_trace.gif</xsl:attribute>
                  </img>
                </a>
              </xsl:when>
              <xsl:otherwise>
                <a>
                  <xsl:attribute name="href"><xsl:value-of select="string($baseActionURL)"/>action=toggle_stack_trace</xsl:attribute>
                  <img border="0" width="16" height="16" alt="Show stack trace">
                    <xsl:attribute name="src"><xsl:value-of select="string($baseMediaURL)"/>error_show_trace.gif</xsl:attribute>
                  </img>
                </a>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:if>
        </td>
        <td valign="middle" align="center" class="uportal-background-med"/>
      </tr>
      <tr>
        <td/>
      </tr>
    </table>

    <xsl:if test="$showStackTrace='true'">
      <xsl:call-template name="stackTrace"/>
    </xsl:if>
  </xsl:template>
  <xsl:template match="exception">
    <tr>
      <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
        <p class="uportal-channel-error">Problem type: </p>
      </td>
      <td width="100%" valign="top" align="left" class="uportal-channel-error">
        <xsl:choose>
          <xsl:when test="@code='-1'">Runtime exception (code -1)</xsl:when>
          <xsl:when test="@code='0'">General rendering problem (code 0)</xsl:when>
          <xsl:when test="@code='1'">Internal timeout (code 1)</xsl:when>
          <xsl:when test="@code='2'">Authorization problem (code 2)</xsl:when>
          <xsl:when test="@code='3'">Missing resource (code 3)</xsl:when>
        </xsl:choose>
      </td>
    </tr>
    <xsl:if test="@code='1'">
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Timeout limit</p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:if test="not(timeout/@value)">Timeout limit not available</xsl:if>
          <xsl:value-of select="timeout/@value"/>
        </td>
      </tr>
    </xsl:if>
    <xsl:if test="@code='3'">
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Resource description</p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:if test="not(resource/description) or resource/description = ''">Resource description not available</xsl:if>
          <xsl:value-of select="resource/description"/>
        </td>
      </tr>
      <tr>
        <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
          <p class="uportal-channel-error">Resource URI</p>
        </td>
        <td width="100%" valign="top" align="left" class="uportal-channel-error">
          <xsl:if test="not(resource/uri) or resource/uri = ''">Resource URI not available</xsl:if>
          <xsl:value-of select="resource/uri"/>
        </td>
      </tr>
    </xsl:if>
    <tr>
      <td nowrap="nowrap" valign="top" align="right" class="uportal-background-light">
        <p class="uportal-channel-error">Error message</p>
      </td>
      <td width="100%" valign="top" align="left" class="uportal-channel-error">
        <xsl:if test="not(message) or message = ''">Error message not available</xsl:if>
        <xsl:value-of select="message"/>
      </td>
    </tr>
  </xsl:template>
  <xsl:template name="stackTrace">
    <br/>
    <table border="0" width="100%" cellspacing="0" cellpadding="4">
      <tr>
        <td valign="top" align="center" class="uportal-background-med">
          <p class="uportal-channel-title">Stack Trace</p>
        </td>
      </tr>
      <tr>
        <td valign="top" align="left" class="uportal-channel-code">
          <p class="uportal-channel-code">
            <xsl:value-of select="exception/stack"/>
          </p>
        </td>
      </tr>
      <tr>
        <td valign="top" align="left" class="uportal-background-med">
          <img border="0" src="transparent.gif" width="1" height="1"/>
        </td>
      </tr>
    </table>
  </xsl:template>
</xsl:stylesheet>
{'fraction_non_alphanumeric': 0.19777383448943378, 'fraction_numerical': 0.01226004194224875, 'mean_word_length': 3.0934301749752393, 'pattern_counts': {'":': 0, '<': 384, '<?xml version=': 2, '>': 384, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '418705', 'n_tokens_mistral': 4326, 'n_tokens_neox': 3929, 'n_words': 728}