<commit_before><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:importAttribute/>

<div class="body">
  <html:form action="/templateAction">
    <c:out value="${templateQuery.description}"/><br/><br/>
    <table border="0" class="templateForm">
      <c:set var="index" value="${0}"/>
      <c:forEach items="${templateQuery.nodes}" var="node">
        <c:forEach items="${constraints[node]}" var="con">
          <c:set var="index" value="${index+1}"/>
          <c:if test="${!empty con.description}">
            <tr>
              <td align="right" valign="top" rowspan="2">
                <c:out value="[${index}]"/>
              </td>
              <td colspan="3">
                <i><c:out value="${con.description}"/></i>
              </td>
            </tr>
          </c:if>
          <tr>
            <c:if test="${empty con.description}">
              <td align="right">
                <c:out value="[${index}]"/>
              </td>
            </c:if>
            <td>
              <c:out value="${names[con]}"/>
            </td>
            <td>
              <html:select property="attributeOps(${index})">
                <c:forEach items="${ops[con]}" var="op">
                  <html:option value="${op.key}">
                    <c:out value="${op.value}"/>
                  </html:option>
                </c:forEach>
              </html:select>
            </td>
            <td>
              <html:text property="attributeValues(${index})"/>
            </td>
          </tr>
        </c:forEach>
      </c:forEach>
    </table>
    <c:if test="${empty previewTemplate}">
      <br/>
      <html:submit property="skipBuilder"><fmt:message key="template.submitToResults"/></html:submit>
      <html:submit><fmt:message key="template.submitToQuery"/></html:submit>
    </c:if>
  </html:form>
</div>

<commit_msg>Implemented popups on template constraints.<commit_after><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:importAttribute/>

<script type="text/javascript">
  <!--

  var fixedOps = new Array();

  /***********************************************************
   * Called when user chooses a constraint operator. If the
   * user picks an operator contained in fixedOptionsOps then
   * the input box is hidden and the user can only choose
   **********************************************************/
  function updateConstraintForm(index, attrOpElement, attrOptsElement, attrValElement)
  {
    if (attrOptsElement == null)
      return;

    for (var i=0 ; i<fixedOps[index].length ; i++)
    {
      if (attrOpElement.value == fixedOps[index][i])
      {
        document.getElementById("operandEditSpan" + index).style.display = "none";
        attrValElement.value = attrOptsElement.value; // constrain value
        return;
      }
    }

    document.getElementById("operandEditSpan" + index).style.display = "";
  }

  /***********************************************************
   * Init attribute value with selected item and hide input box if
   * required
   **********************************************************/
  function initConstraintForm(index, attrOpElement, attrOptsElement, attrValElement)
  {
    if (attrOptsElement == null)
      return;

    attrValElement.value = attrOptsElement.value;
    updateConstraintForm(index, attrOpElement, attrOptsElement, attrValElement);
  }

  //-->
</script>


<div class="body">
  <html:form action="/templateAction">
    <c:out value="${templateQuery.description}"/><br/><br/>
    <table border="0" class="templateForm">
      <c:set var="index" value="${0}"/>
      <c:forEach items="${templateQuery.nodes}" var="node">
        <c:forEach items="${constraints[node]}" var="con">
          <c:set var="index" value="${index+1}"/>
          
          <script type="text/javascript">
            <!--
              fixedOps[${index-1}] = new Array();
              <c:forEach items="${fixedOps[con]}" var="op" varStatus="oi">
                fixedOps[${index-1}][${oi.count}] = "<c:out value="${op}"/>";
              </c:forEach>
            //-->
          </script>
          
          <c:if test="${!empty con.description}">
            <tr>
              <td align="right" valign="top" rowspan="2">
                <c:out value="[${index}]"/>
              </td>
              <td colspan="3">
                <i><c:out value="${con.description}"/></i>
              </td>
            </tr>
          </c:if>
          <tr>
            <c:if test="${empty con.description}">
              <td align="right">
                <c:out value="[${index}]"/>
              </td>
            </c:if>
            <td>
              <c:out value="${names[con]}"/>
            </td>
            <td valign="top">
              <html:select property="attributeOps(${index})" onchange="updateConstraintForm(${index-1}, document.templateForm['attributeOps(${index})'], document.templateForm['attributeOptions(${index})'], document.templateForm['attributeValues(${index})'])">
                <c:forEach items="${ops[con]}" var="op">
                  <html:option value="${op.key}">
                    <c:out value="${op.value}"/>
                  </html:option>
                </c:forEach>
              </html:select>
            </td>
            <td valign="top" align="center">
              <span id="operandEditSpan${index-1}">
               <html:text property="attributeValues(${index})"/>
                <%-- might want to show up arrow --%>
                <c:if test="${!empty options[con]}">
                  <im:vspacer width="5"/>
                  <img src="images/left-arrow.gif" alt="&lt;-" border="0" height="13" width="13"/>
                  <im:vspacer width="5"/>
                </c:if>
              </span>
              <c:if test="${!empty options[con]}">
                <select name="attributeOptions(${index})" onchange="this.form['attributeValues(${index})'].value=this.value;">
                <c:forEach items="${options[con]}" var="option">
                  <option value="${option}">
                    <c:out value="${option}"/>
                  </option>
                </c:forEach>
                </select>
              </c:if>
              <script type="text/javascript">
                <!--
                initConstraintForm(${index-1}, document.templateForm["attributeOps(${index})"], document.templateForm["attributeOptions(${index})"], document.templateForm["attributeValues(${index})"]);
                //-->
              </script>
            </td>
          </tr>
        </c:forEach>
      </c:forEach>
    </table>
    <c:if test="${empty previewTemplate}">
      <br/>
      <html:submit property="skipBuilder"><fmt:message key="template.submitToResults"/></html:submit>
      <html:submit><fmt:message key="template.submitToQuery"/></html:submit>
    </c:if>
  </html:form>
</div>


{'fraction_non_alphanumeric': 0.21737934827443972, 'fraction_numerical': 0.003162381410697099, 'mean_word_length': 2.153012570437798, 'pattern_counts': {'":': 0, '<': 159, '<?xml version=': 0, '>': 158, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6413606', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2081, 'n_words': 363}