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

<!-- galaxyExportOptions.jsp -->

<script type="text/javascript">

  jQuery(document).ready(function() {
     initForm();
     jQuery("#URL").val("${viewURL}");

     if ("${exportAsBED}" == "false") {
       jQuery("input[name='exportOptions']").filter("[value='feature']").attr('disabled', 'disabled');
     }

     jQuery("input[name='exportOptions']").filter("[value='view']").attr('checked', true);

     if (jQuery("input[name='sequencePath']").length>1) {

        jQuery("#firstPathRadio").attr('checked', true);
        jQuery("input[name='sequencePath']").each(function(i) {
                jQuery(this).attr('disabled', 'disabled');
        });
     }

    jQuery("#ajaxLoading").hide()
            .ajaxStart(function(){
                jQuery("input[name='submit']").attr("disabled", "disabled");
                jQuery(this).fadeIn();
            })
            .ajaxStop(function(){
                jQuery(this).fadeOut();
                jQuery("input[name='submit']").removeAttr('disabled');
             });

      jQuery("input[name='exportOptions']").bind("click", exportRadioClicks);
      jQuery("input[name='sequencePath']").bind("click", pathRadioClicks);

  });

  function exportRadioClicks()
  {
    initForm();

     // if sequencePath radio exsits by jQuery("input[name='sequencePath']").length
     if (jQuery(this).val() == "view" && jQuery("input[name='sequencePath']").length==1) {

        jQuery("#URL").val("${viewURL}");

     } else
     if (jQuery(this).val() == "view" && jQuery("input[name='sequencePath']").length>1) {

        jQuery("input[name='sequencePath']").each(function(i) {
                    jQuery(this).attr('disabled', 'disabled');
        });

        jQuery("#URL").val("${viewURL}");

     } else
     if (jQuery(this).val() == "feature" && jQuery("input[name='sequencePath']").length>1) {

        jQuery("input[name='sequencePath']").each(function(i) {
                    jQuery(this).removeAttr('disabled');
        });

        var pathVal = jQuery("input[name='sequencePath']:checked").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" }; // the index of the column
        </c:forEach>

        // Use ajax to get the GALAXY_URL, data_type, genome build and extra info back from galaxyExportAction
        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3]);
        });

     } else
     if (jQuery(this).val() == "feature" && jQuery("input[name='sequencePath']").length==1) {

        var pathVal = jQuery("input[name='sequencePath']").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" };
        </c:forEach>

        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3]);
        });
     }
  }

  function pathRadioClicks()
  {
    initForm();

    if (jQuery("input[name='sequencePath']").length>1) {

        var pathVal = jQuery("input[name='sequencePath']:checked").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" };
        </c:forEach>

        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3]);
        });
    }
  }

  function initForm()
  {
    jQuery("#data_type").val("");
    jQuery("#URL").val("");
    jQuery("#info").val("");
    jQuery("#db").val("");
  }

</script>

<style type="text/css">

ol { margin-left:1.5em; padding-left:0px; }
li { margin-bottom:0.5em; }<commit_msg>Galaxy - trim genome build string<commit_after><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!-- galaxyExportOptions.jsp -->

<script type="text/javascript">

  jQuery(document).ready(function() {
     initForm();
     jQuery("#URL").val("${viewURL}");

     if ("${exportAsBED}" == "false") {
       jQuery("input[name='exportOptions']").filter("[value='feature']").attr('disabled', 'disabled');
     }

     jQuery("input[name='exportOptions']").filter("[value='view']").attr('checked', true);

     if (jQuery("input[name='sequencePath']").length>1) {

        jQuery("#firstPathRadio").attr('checked', true);
        jQuery("input[name='sequencePath']").each(function(i) {
                jQuery(this).attr('disabled', 'disabled');
        });
     }

    jQuery("#ajaxLoading").hide()
            .ajaxStart(function(){
                jQuery("input[name='submit']").attr("disabled", "disabled");
                jQuery(this).fadeIn();
            })
            .ajaxStop(function(){
                jQuery(this).fadeOut();
                jQuery("input[name='submit']").removeAttr('disabled');
             });

      jQuery("input[name='exportOptions']").bind("click", exportRadioClicks);
      jQuery("input[name='sequencePath']").bind("click", pathRadioClicks);

  });

  function exportRadioClicks()
  {
    initForm();

     // if sequencePath radio exsits by jQuery("input[name='sequencePath']").length
     if (jQuery(this).val() == "view" && jQuery("input[name='sequencePath']").length==1) {

        jQuery("#URL").val("${viewURL}");

     } else
     if (jQuery(this).val() == "view" && jQuery("input[name='sequencePath']").length>1) {

        jQuery("input[name='sequencePath']").each(function(i) {
                    jQuery(this).attr('disabled', 'disabled');
        });

        jQuery("#URL").val("${viewURL}");

     } else
     if (jQuery(this).val() == "feature" && jQuery("input[name='sequencePath']").length>1) {

        jQuery("input[name='sequencePath']").each(function(i) {
                    jQuery(this).removeAttr('disabled');
        });

        var pathVal = jQuery("input[name='sequencePath']:checked").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" }; // the index of the column
        </c:forEach>

        // Use ajax to get the GALAXY_URL, data_type, genome build and extra info back from galaxyExportAction
        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3].trim());
        });

     } else
     if (jQuery(this).val() == "feature" && jQuery("input[name='sequencePath']").length==1) {

        var pathVal = jQuery("input[name='sequencePath']").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" };
        </c:forEach>

        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3].trim());
        });
     }
  }

  function pathRadioClicks()
  {
    initForm();

    if (jQuery("input[name='sequencePath']").length>1) {

        var pathVal = jQuery("input[name='sequencePath']:checked").val();
        var idx;
        <c:forEach var="pathIndexMap" items="${pathIndexMap}">
            if (pathVal == "${pathIndexMap.key}") { idx = "${pathIndexMap.value}" };
        </c:forEach>

        jQuery.get("${WEB_PROPERTIES['webapp.baseurl']}/${WEB_PROPERTIES['webapp.path']}/galaxyExportAction.do", { tableName: "${table}", index: idx, prefix: pathVal}, function(data){
          dataArray = data.split(">>>>>"); //size = 4
          jQuery("#data_type").val("bed");
          jQuery("#URL").val(dataArray[0]);
          jQuery("#info").val("Column features:" + dataArray[1] + "; Organisms:" + dataArray[2]);
          jQuery("#db").val(dataArray[3].trim());
        });
    }
  }

  function initForm()
  {
    jQuery("#data_type").val("");
    jQuery("#URL").val("");
    jQuery("#info").val("");
    jQuery("#db").val("");
  }

</script>

<style type="text/css">

ol { margin-left:1.5em; padding-left:0px; }
li { margin-bottom:0.5em; }
{'fraction_non_alphanumeric': 0.22343430408103632, 'fraction_numerical': 0.005064770624330379, 'mean_word_length': 3.2151067323481115, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 69, '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': '4040797', 'n_tokens_mistral': 3193, 'n_tokens_neox': 3124, 'n_words': 446}