<commit_before><%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page session="false"%>
<%@ page import="edu.asu.conceptpower.core.ConceptEntry"%>

<script>
    $(function() {
        $("#addsynonym").click(function() {
            $("#dialog").dialog({
                width : 'auto'
            });
            $("#synonymsDialogTable").show();
        });
    });

    $(document).ready(definedatatable);
    $(document).ready(definedatatableForSynonymAdd);

    function definedatatable() {
        $('#synonymstable').dataTable(
                {
                    "bJQueryUI" : true,
                    "sPaginationType" : "full_numbers",
                    "bAutoWidth" : false,
                    "bStateSave" : true,
                    "aoColumns" : [ {
                        "sTitle" : "Term",
                        "mDataProp" : "Word",
                    }, {
                        "sTitle" : "POS",
                        "mDataProp" : "Pos",
                    }, {
                        "sTitle" : "Description",
                        "mDataProp" : "Description",
                    }, {
                        "sTitle" : "Add",
                        "mDataProp" : "Id"
                    } ],
                    "fnRowCallback" : function(nRow, aData, iDisplayIndex) {
                        $('td:eq(3)', nRow).html(
                                '<a onclick="synonymAdd(\'' + aData.Id
                                        + '\')">Add</a>');
                        return nRow;
                    }
                });
    };

    $(function() {
        $("#synonymsearch")
                .click(
                        function() {
                            $("#synonymViewDiv").show();
                            $("#synonymstable").show();
                            var synonymname = $("#synonymname").val();
                            $
                                    .ajax({
                                        type : "GET",
                                        url : "${pageContext.servletContext.contextPath}/conceptEditSynonymView",
                                        data : {
                                            synonymname : synonymname
                                        },
                                        success : function(response) {
                                            var synonym = JSON.parse(response);
                                            var len = synonym.Total;
                                            for (var i = 0; i < len; i++) {
                                                $('#synonymstable')
                                                        .dataTable()
                                                        .fnAddData(
                                                                synonym.synonyms[i]);
                                            }

                                        }
                                    });
                        });
    });

    var synonymAdd = function(synonymid) {
        $("#dialog").dialog("close");
        $("#synonymsDialogTable").hide();
        $
                .ajax({
                    type : "GET",
                    url : "${pageContext.servletContext.contextPath}/getConceptAddSynonyms",
                    data : {
                        synonymid : synonymid
                    },
                    success : function(response) {
                        var synonym = JSON.parse(response);
                        var eachSynonym = synonym.synonyms[0];

                        //Adding synonymId to the existing list
                        var list = document.getElementById("synonymsids").value;
                        list += eachSynonym.Id + ',';
                        $("#synonymsids").val(list);

                        $('#addedSynonymsTable')
                        .dataTable()
                        .fnAddData(
                        		eachSynonym);
                    }
                });
    };
	
    
    
    function definedatatableForSynonymAdd() {
        $('#addedSynonymsTable').dataTable(
                {
                    "bJQueryUI" : true,
                    "bAutoWidth" : false,
                    "bStateSave" : true,
                    "aoColumns" : [ {
                    	"sTitle" : "Remove",
                        "mDataProp" : "Id"
                    }, {
                    	"sTitle" : "Word",
                        "mDataProp" : "Word",
                    }, {
                    	"sTitle" : "Description",
                        "mDataProp" : "Description",
                    }
                    ],
                    "fnRowCallback" : function(nRow, aData, iDisplayIndex) {
                        $('td:eq(0)', nRow).html(
                           '<a onclick="synonymTemporaryRemove(\'' + aData.Id
                           + '\')">Remove</a>');
                        return nRow;
                    },
                    "fnCreatedRow": function( nRow, aData, iDataIndex ) {
                        $(nRow).attr('id', aData.Id);
                        $(nRow).attr('class', '');
                    }
                });
    };
    
    
    
    $(document)
            .ready(
                    function() {
                        $('#synonyms').dataTable({
                            "bJQueryUI" : true,
                            "sPaginationType" : "full_numbers",
                            "bAutoWidth" : false
                        });
                        var conceptid = $('#conceptid').val();
                        $("#addedSynonyms").show();
                        $("#addedSynonymsTable").show();
                        $
                                .ajax({
                                    type : "GET",
                                    url : "${pageContext.servletContext.contextPath}/getConceptEditSynonyms",
                                    data : {
                                        conceptid : conceptid
                                    },
                                    success : function(response) {
                                        var border = response.length > 0 ? 1
                                                : 0;
                                        var synonym = JSON.parse(response);
                                        var total = synonym.Total;
                                        // var arr = new Array();
                                        for (var i = 0; i < total; i++) {
                                            
                                            $('#addedSynonymsTable')
                                            .dataTable()
                                            .fnAddData(
                                            		synonym.synonyms[i]);
                                        }
                                    }
                                });
                    });

    var synonymTemporaryRemove = function(synonymid) {
        var count = $('#addedSynonymsTable tr').length;
        $('#' + synonymid).remove();
        //Removing synonymId from existing list
        var list = document.getElementById("synonymsids").value;
        document.getElementById("synonymsids").value = removeList(list,
                synonymid, ',');
    };

    var removeList = function(list, synonymid, separator) {
        separator = separator || ",";
        var values = list.split(separator);
        for (var i = 0; i < values.length; i++) {
            if (values[i] == synonymid) {
                values.splice(i, 1);
                return values.join(separator);
            }
        }
        return list;<commit_msg>CHanges for table removal<commit_after><%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page session="false"%>
<%@ page import="edu.asu.conceptpower.core.ConceptEntry"%>

<script>
    $(function() {
        $("#addsynonym").click(function() {
            $("#dialog").dialog({
                width : 'auto'
            });
            $("#synonymsDialogTable").show();
        });
    });

    $(document).ready(definedatatable);
    $(document).ready(definedatatableForSynonymAdd);

    function definedatatable() {
        $('#synonymstable').dataTable(
                {
                    "bJQueryUI" : true,
                    "sPaginationType" : "full_numbers",
                    "bAutoWidth" : false,
                    "bStateSave" : true,
                    "aoColumns" : [ {
                        "sTitle" : "Term",
                        "mDataProp" : "Word",
                    }, {
                        "sTitle" : "POS",
                        "mDataProp" : "Pos",
                    }, {
                        "sTitle" : "Description",
                        "mDataProp" : "Description",
                    }, {
                        "sTitle" : "Add",
                        "mDataProp" : "Id"
                    } ],
                    "fnRowCallback" : function(nRow, aData, iDisplayIndex) {
                        $('td:eq(3)', nRow).html(
                                '<a onclick="synonymAdd(\'' + aData.Id
                                        + '\')">Add</a>');
                        return nRow;
                    }
                });
    };

    $(function() {
        $("#synonymsearch")
                .click(
                        function() {
                            $("#synonymViewDiv").show();
                            $("#synonymstable").show();
                            var synonymname = $("#synonymname").val();
                            $
                                    .ajax({
                                        type : "GET",
                                        url : "${pageContext.servletContext.contextPath}/conceptEditSynonymView",
                                        data : {
                                            synonymname : synonymname
                                        },
                                        success : function(response) {
                                            var synonym = JSON.parse(response);
                                            var len = synonym.Total;
                                            for (var i = 0; i < len; i++) {
                                                $('#synonymstable')
                                                        .dataTable()
                                                        .fnAddData(
                                                                synonym.synonyms[i]);
                                            }

                                        }
                                    });
                        });
    });

    var synonymAdd = function(synonymid) {
        $("#dialog").dialog("close");
        $("#synonymsDialogTable").hide();
        $
                .ajax({
                    type : "GET",
                    url : "${pageContext.servletContext.contextPath}/getConceptAddSynonyms",
                    data : {
                        synonymid : synonymid
                    },
                    success : function(response) {
                        var synonym = JSON.parse(response);
                        var eachSynonym = synonym.synonyms[0];

                        //Adding synonymId to the existing list
                        var list = document.getElementById("synonymsids").value;
                        alert(list);
                        list += eachSynonym.Id + ',';
                        $("#synonymsids").val(list);

                        $('#addedSynonymsTable')
                        .dataTable()
                        .fnAddData(
                        		eachSynonym);
                    }
                });
    };
	
    
    
    function definedatatableForSynonymAdd() {
        $('#addedSynonymsTable').dataTable(
                {
                    "bJQueryUI" : true,
                    "bAutoWidth" : false,
                    "bStateSave" : true,
                    "aoColumns" : [ {
                    	"sTitle" : "Remove",
                        "mDataProp" : "Id"
                    }, {
                    	"sTitle" : "Word",
                        "mDataProp" : "Word",
                    }, {
                    	"sTitle" : "Description",
                        "mDataProp" : "Description",
                    }
                    ],
                    "fnRowCallback" : function(nRow, aData, iDisplayIndex) {
                        $('td:eq(0)', nRow).html(
                           '<a onclick="synonymTemporaryRemove(\'' + aData.Id
                           + '\')">Remove</a>');
                        return nRow;
                    },
                    "fnCreatedRow": function( nRow, aData, iDataIndex ) {
                        $(nRow).attr('id', aData.Id);
                        $(nRow).attr('class', '');
                    }
                });
    };
    
    
    
    $(document)
            .ready(
                    function() {
                        $('#synonyms').dataTable({
                            "bJQueryUI" : true,
                            "sPaginationType" : "full_numbers",
                            "bAutoWidth" : false
                        });
                        var conceptid = $('#conceptid').val();
                        $("#addedSynonyms").show();
                        $("#addedSynonymsTable").show();
                        $
                                .ajax({
                                    type : "GET",
                                    url : "${pageContext.servletContext.contextPath}/getConceptEditSynonyms",
                                    data : {
                                        conceptid : conceptid
                                    },
                                    success : function(response) {
                                        var border = response.length > 0 ? 1
                                                : 0;
                                        var synonym = JSON.parse(response);
                                        var total = synonym.Total;
                                        // var arr = new Array();
                                        for (var i = 0; i < total; i++) {
                                            
                                            $('#addedSynonymsTable')
                                            .dataTable()
                                            .fnAddData(
                                            		synonym.synonyms[i]);
                                        }
                                    }
                                });
                    });

    var synonymTemporaryRemove = function(synonymid) {
        var count = $('#addedSynonymsTable tr').length;
        alert(count);
        $('#' + synonymid).remove();
        //Removing synonymId from existing list
        var list = document.getElementById("synonymsids").value;
        alert(list);
        document.getElementById("synonymsids").value = removeList(list,
                synonymid, ',');
    };

    var removeList = function(list, synonymid, separator) {
        separator = separator || ",";
        var values = list.split(separator);
        for (var i = 0; i < values.length; i++) {
            if (values[i] == synonymid) {
                values.splice(i, 1);
                return values.join(separator);
            }
        }
        return list;
{'fraction_non_alphanumeric': 0.11551831160769709, 'fraction_numerical': 0.0012414649286157666, 'mean_word_length': 0.7796310615265658, 'pattern_counts': {'":': 2, '<': 31, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 122, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6003549', 'n_tokens_mistral': 3574, 'n_tokens_neox': 3343, 'n_words': 561}