<commit_before><!--!
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      i18n:domain="bhtheme"
      xmlns:bh="http://issues.apache.org/bloodhound/wiki/Ui/Dashboard"
      py:with="preview_mode = 'preview' in req.args;
          can_append = 'TICKET_APPEND' in perm(ticket.resource);
          can_create = 'TICKET_CREATE' in perm(ticket.resource) and not ticket.exists;
          can_modify = 'TICKET_CHGPROP' in perm(ticket.resource);
          can_edit = 'TICKET_EDIT_DESCRIPTION' in perm(ticket.resource);
          only_for_admin = 'TICKET_ADMIN' in perm(ticket.resource);
          has_edit_comment = 'TICKET_EDIT_COMMENT' in perm(ticket.resource);
          has_property_editor = not version and version != 0 and not cnum_edit
                                and (can_append or can_modify or can_edit or can_create);
          colspan = 'span7';
          cols_activity = 'span5'">
  <xi:include href="layout.html" />
  <xi:include href="widget_macros.html" />

  <head>
    <!--! hack for hiding the activity feed title in desktop/tablet landscape mode (the title is part of the sticky) -->
    <style>
      @media (min-width: 768px) {
        #activity h3 { display: none !important; }
      }
      @media (max-width: 767px) {
        #activity h3 { display: inherit !important; }
      }
    </style>
    <title py:choose="">
      <py:when test="ticket.exists">#${ticket.id} (${ticket.summary})</py:when>
      <py:otherwise>New Ticket</py:otherwise>
    </title>
    <script py:if="ticket.exists" type="text/javascript" src="${chrome.htdocs_location}js/threaded_comments.js"></script>
    <script type="text/javascript" py:choose="">
      jQuery(document).ready(function($) {
        /* Affixed navbar */
        $(".local-nav a").click(function() {
          $($(this).attr('href')).removeClass('collapsed')
                                 .parent().removeClass("collapsed");
        });
        $('.trac-nav').hide();
        $('.trac-topnav').hide();

        <py:if test="has_property_editor">
        // Install in place editing
        install_workflow();
        $('#edit-cancel, #edit-cancel-below').click(revert_ticket);

        var modify_elem = $('#modify');
        modify_elem.parent().hide();
        $('#propertyform .buttons [name="preview"]').hide();
        $('#comment').change(function (e) {
          $('#hidden-comment').val($('#comment').val());
        });
        $('#propertyform .buttons [name="submit"]').click(function (e) {
          if ($('button#edit-submit').length) {
            // if available trigger the edit state's update button
            $('button#edit-submit').click();
            e.preventDefault();
          }
          // otherwise the default submit comment only happens
        });

        function modify_ticket(newticket) {
          if ($('#vc-summary').is('.edit-active'))
            // Already in editable state
            return;
          $('#vc-summary').attr('contenteditable', 'true');
          $('[data-edit="inplace"]').each(function() {
              var fc = $(this).addClass('edit-active');
              var fieldnm = fc.attr('id').substr(3);
              fc.attr('data-edit-orig', fc.html());
              
              if (fieldnm != 'summary') {
                fc.empty();
              }
              var editor = $('#properties #field-' + fieldnm);
              if (editor.length == 0)
                editor = $('#editor-' + fieldnm);
              var fieldval = editor.val();
              editor = editor.clone(false);
              if (fieldnm === 'summary') {
                editor.hide().appendTo($('#dummy-vc-summary'));
              }
              else {
                editor.appendTo(fc);
              }
              editor.val(fieldval);
              if (editor.prop('tagName') === 'TEXTAREA') {
                if (editor.is('.wikitext'))
                  addWikiFormattingToolbar(editor.get(0));
              }
              if (fieldnm === 'summary') {
                editor.wrap('<div class="btn-group"></div>')
              }
            });

          // Enable automatic preview
          //$('#inplace-propertyform').autoSubmit({preview : 1}, 
          //    full_preview, '#overview .trac-loading')
          $('#inplace-propertyform').submit(function() {
              $('#hidden-comment').val($('#edit-comment').val());
            })

          $('#inplace-edit, #vc-status a').hide();
          $('#edit-state-buttons, #edit-state-buttons-below, #edit-workflow-buttons, #edit-comment').show();
          if (!newticket) {
            // disable input controls on all other forms when in modify mode
            $('.activityfeed, .relations, #attachments').css('opacity', '0.3');
            $('form:not("#inplace-propertyform") :input').attr('disabled', 'disabled');
            $('#qct-inline, #qct-inline-notice-success, #qct-inline-notice-error').hide({'duration': 400});
          }
        }

        function add_update_hidden_summary_fn() {
          $('#vc-summary').blur(function () {
            if ($('#vc-summary.edit-active').length == 1) {
              $('#dummy-vc-summary input#field-summary').val($('#vc-summary').text());
            }
          });
        }

        function revert_ticket(e) {
          $('[data-edit="inplace"]').each(function() {
              var fc = $(this).removeClass('edit-active');
              fc.html(fc.attr('data-edit-orig')).attr('data-edit-orig', '');
            });
          //remove summary field and re-add the summary blur function
          $('#dummy-vc-summary div').remove();
          add_update_hidden_summary_fn();
          $('#vc-summary').attr('contenteditable', 'false');

          $('#inplace-edit, #vc-status a').show();
          $('#edit-state-buttons, #edit-state-buttons-below, #edit-workflow-buttons, #edit-comment').hide();
          $('form:not("#inplace-propertyform") :input').removeAttr('disabled');
          $('.activityfeed, .relations, #attachments').css('opacity', '');

          e.preventDefault();
        }

        function install_workflow(){
          <py:if test="bhrelations">/*<![CDATA[*/
          $('select[id$=_resolve_resolution]').each(function () {
            var prefix = $(this).attr('id').split('_').slice(0, 2).join('_');
            $(this).parent().append('<span class="duplicate_id hide">Duplicate ID:&nbsp;' +
                                    '<input id="' + prefix + '_duplicate_id" name="duplicate_id" type="text" class="input-mini" value="${ticket_duplicate_of}" /></span>');
          });
          /*]]>*/</py:if>
          var actions_box = $('#workflow-actions')
              .click(function(e) { e.stopPropagation(); });
          $('#action').children('div').each(function() {
              var action_ui = $(this).clone(false).prependTo(actions_box)
                  .wrap('<li style="padding: 5px 10px"></li>');
              var action_trigger = action_ui.find('input[name=action]');
              var action_select_trigger = action_ui.find('select');
              var action_input_trigger = action_ui.find('input:not([name=action])');

              function action_click() {
                var action = action_ui.find('input[name=action]').val();
                var newowner = action_ui.find('input[id$=_reassign_owner]').val();
                var newresolution = action_ui.find('select[id$=_resolution]').val();
                var newlabel = action_ui.find('label[for^=action_]')
                    .text();
                if (action === 'leave')
                  newlabel = newlabel + ' as ' + $('#vc-status a').text();
                else if (newowner)
                  newlabel = newlabel + ' to ' + newowner;<commit_msg>0.8dev: Removed unused variable and spurious line break.<commit_after><!--!
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      i18n:domain="bhtheme"
      xmlns:bh="http://issues.apache.org/bloodhound/wiki/Ui/Dashboard"
      py:with="preview_mode = 'preview' in req.args;
          can_append = 'TICKET_APPEND' in perm(ticket.resource);
          can_create = 'TICKET_CREATE' in perm(ticket.resource) and not ticket.exists;
          can_modify = 'TICKET_CHGPROP' in perm(ticket.resource);
          can_edit = 'TICKET_EDIT_DESCRIPTION' in perm(ticket.resource);
          only_for_admin = 'TICKET_ADMIN' in perm(ticket.resource);
          has_edit_comment = 'TICKET_EDIT_COMMENT' in perm(ticket.resource);
          has_property_editor = not version and version != 0 and not cnum_edit
                                and (can_append or can_modify or can_edit or can_create);
          colspan = 'span7';
          cols_activity = 'span5'">
  <xi:include href="layout.html" />
  <xi:include href="widget_macros.html" />

  <head>
    <!--! hack for hiding the activity feed title in desktop/tablet landscape mode (the title is part of the sticky) -->
    <style>
      @media (min-width: 768px) {
        #activity h3 { display: none !important; }
      }
      @media (max-width: 767px) {
        #activity h3 { display: inherit !important; }
      }
    </style>
    <title py:choose="">
      <py:when test="ticket.exists">#${ticket.id} (${ticket.summary})</py:when>
      <py:otherwise>New Ticket</py:otherwise>
    </title>
    <script py:if="ticket.exists" type="text/javascript" src="${chrome.htdocs_location}js/threaded_comments.js"></script>
    <script type="text/javascript" py:choose="">
      jQuery(document).ready(function($) {
        /* Affixed navbar */
        $(".local-nav a").click(function() {
          $($(this).attr('href')).removeClass('collapsed')
                                 .parent().removeClass("collapsed");
        });
        $('.trac-nav').hide();
        $('.trac-topnav').hide();

        <py:if test="has_property_editor">
        // Install in place editing
        install_workflow();
        $('#edit-cancel, #edit-cancel-below').click(revert_ticket);

        $('#modify').parent().hide();
        $('#propertyform .buttons [name="preview"]').hide();
        $('#comment').change(function (e) {
          $('#hidden-comment').val($('#comment').val());
        });
        $('#propertyform .buttons [name="submit"]').click(function (e) {
          if ($('button#edit-submit').length) {
            // if available trigger the edit state's update button
            $('button#edit-submit').click();
            e.preventDefault();
          }
          // otherwise the default submit comment only happens
        });

        function modify_ticket(newticket) {
          if ($('#vc-summary').is('.edit-active'))
            // Already in editable state
            return;
          $('#vc-summary').attr('contenteditable', 'true');
          $('[data-edit="inplace"]').each(function() {
              var fc = $(this).addClass('edit-active');
              var fieldnm = fc.attr('id').substr(3);
              fc.attr('data-edit-orig', fc.html());
              
              if (fieldnm != 'summary') {
                fc.empty();
              }
              var editor = $('#properties #field-' + fieldnm);
              if (editor.length == 0)
                editor = $('#editor-' + fieldnm);
              var fieldval = editor.val();
              editor = editor.clone(false);
              if (fieldnm === 'summary') {
                editor.hide().appendTo($('#dummy-vc-summary'));
              }
              else {
                editor.appendTo(fc);
              }
              editor.val(fieldval);
              if (editor.prop('tagName') === 'TEXTAREA') {
                if (editor.is('.wikitext'))
                  addWikiFormattingToolbar(editor.get(0));
              }
              if (fieldnm === 'summary') {
                editor.wrap('<div class="btn-group"></div>')
              }
            });

          // Enable automatic preview
          //$('#inplace-propertyform').autoSubmit({preview : 1}, 
          //    full_preview, '#overview .trac-loading')
          $('#inplace-propertyform').submit(function() {
              $('#hidden-comment').val($('#edit-comment').val());
            })

          $('#inplace-edit, #vc-status a').hide();
          $('#edit-state-buttons, #edit-state-buttons-below, #edit-workflow-buttons, #edit-comment').show();
          if (!newticket) {
            // disable input controls on all other forms when in modify mode
            $('.activityfeed, .relations, #attachments').css('opacity', '0.3');
            $('form:not("#inplace-propertyform") :input').attr('disabled', 'disabled');
            $('#qct-inline, #qct-inline-notice-success, #qct-inline-notice-error').hide({'duration': 400});
          }
        }

        function add_update_hidden_summary_fn() {
          $('#vc-summary').blur(function () {
            if ($('#vc-summary.edit-active').length == 1) {
              $('#dummy-vc-summary input#field-summary').val($('#vc-summary').text());
            }
          });
        }

        function revert_ticket(e) {
          $('[data-edit="inplace"]').each(function() {
              var fc = $(this).removeClass('edit-active');
              fc.html(fc.attr('data-edit-orig')).attr('data-edit-orig', '');
            });
          //remove summary field and re-add the summary blur function
          $('#dummy-vc-summary div').remove();
          add_update_hidden_summary_fn();
          $('#vc-summary').attr('contenteditable', 'false');

          $('#inplace-edit, #vc-status a').show();
          $('#edit-state-buttons, #edit-state-buttons-below, #edit-workflow-buttons, #edit-comment').hide();
          $('form:not("#inplace-propertyform") :input').removeAttr('disabled');
          $('.activityfeed, .relations, #attachments').css('opacity', '');

          e.preventDefault();
        }

        function install_workflow(){
          <py:if test="bhrelations">/*<![CDATA[*/
          $('select[id$=_resolve_resolution]').each(function () {
            var prefix = $(this).attr('id').split('_').slice(0, 2).join('_');
            $(this).parent().append('<span class="duplicate_id hide">Duplicate ID:&nbsp;' +
                                    '<input id="' + prefix + '_duplicate_id" name="duplicate_id" type="text" class="input-mini" value="${ticket_duplicate_of}" /></span>');
          });
          /*]]>*/</py:if>
          var actions_box = $('#workflow-actions')
              .click(function(e) { e.stopPropagation(); });
          $('#action').children('div').each(function() {
              var action_ui = $(this).clone(false).prependTo(actions_box)
                  .wrap('<li style="padding: 5px 10px"></li>');
              var action_trigger = action_ui.find('input[name=action]');
              var action_select_trigger = action_ui.find('select');
              var action_input_trigger = action_ui.find('input:not([name=action])');

              function action_click() {
                var action = action_ui.find('input[name=action]').val();
                var newowner = action_ui.find('input[id$=_reassign_owner]').val();
                var newresolution = action_ui.find('select[id$=_resolution]').val();
                var newlabel = action_ui.find('label[for^=action_]').text();
                if (action === 'leave')
                  newlabel = newlabel + ' as ' + $('#vc-status a').text();
                else if (newowner)
                  newlabel = newlabel + ' to ' + newowner;
{'fraction_non_alphanumeric': 0.16764857289938798, 'fraction_numerical': 0.006063032660298576, 'mean_word_length': 2.2335860921028297, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '819248', 'n_tokens_mistral': 5091, 'n_tokens_neox': 4911, 'n_words': 1008}