<commit_before>/**
 * The UI Element for importing pedigrees from text representationin various formats
 *
 * @class ImportSelector
 */

var ImportSelector = Class.create( {

    initialize: function() {
        if (editor.isReadOnlyMode()) return;
        
        var _this = this;
        
        var mainDiv = new Element('div', {'class': 'import-selector'});
                        
        var promptImport = new Element('div', {'class': 'import-section'}).update("Import data:");
        this.importValue = new Element("textarea", {"id": "import", "value": "", "class": "import-textarea"});
        mainDiv.insert(promptImport).insert(this.importValue);
        
        if (!!window.FileReader && !!window.FileList) {
            // only show the upload link if browser supports FileReader/DOM File API
            // Of the browsers suported by pedigree editor, IE9 and Safari 4 & 5 do not support file API 
            var uploadFileSelector = new Element('input', {"type" : "file", "id": 'pedigreeInputFile', "style": 'display:none'});        
            uploadFileSelector.observe('change', function(event) {
                _this.handleFileUpload(this.files);
                try {
                    this.value = "";  // clear file selector
                } catch (err) {
                    // some older browsers do not allow setting value of a file input element and may generate a security error
                }
            })        
            var uploadLink = new Element('div', {'class': 'import-upload'}).update("(<a>Select a local file to be imported</a>)");
            uploadLink.observe('click', function(event) {
                var fileElem = document.getElementById("pedigreeInputFile");
                fileElem.click();
            })
            mainDiv.insert(uploadFileSelector).insert(uploadLink);
        }
        
        var _addTypeOption = function (checked, labelText, value) {
            var optionWrapper = new Element('tr');
            var input = new Element('input', {"type" : "radio", "value": value, "name": "select-type"});
            input.observe('click', _this.disableEnableOptions );
            if (checked) {
              input.checked = true;
            }
            var label = new Element('label', {'class': 'import-type-label'}).insert(input).insert(labelText);
            optionWrapper.insert(label.wrap('td'));
            return optionWrapper;
          };          
        var typeListElement = new Element('table');
        //TODO: typeListElement.insert(_addTypeOption(true,  "Autodetect", "auto"));
        typeListElement.insert(_addTypeOption(true,  "PED or LINKAGE (pre- or post- makeped)", "ped"));        
        typeListElement.insert(_addTypeOption(false, "GEDCOM", "gedcom"));
        typeListElement.insert(_addTypeOption(false, "BOADICEA", "BOADICEA"));
        typeListElement.insert(_addTypeOption(false, "Simple JSON", "simpleJSON"));
        //TODO: typeListElement.insert(_addTypeOption(false, "Phenotips Pedigree JSON", "phenotipsJSON"));

        var promptType = new Element('div', {'class': 'import-section'}).update("Data format:");
        var dataSection2 = new Element('div', {'class': 'import-block'});
        dataSection2.insert(promptType).insert(typeListElement);
        mainDiv.insert(dataSection2);

        var _addConfigOption = function (checked, labelText, value) {
            var optionWrapper = new Element('tr');
            var input = new Element('input', {"type" : "radio", "value": value, "name": "select-options" });            
            if (checked) {
              input.checked = true;<commit_msg>Issue #1783: Pedigree file import button not apparent. Fixed.<commit_after>/**
 * The UI Element for importing pedigrees from text representationin various formats
 *
 * @class ImportSelector
 */

var ImportSelector = Class.create( {

    initialize: function() {
        if (editor.isReadOnlyMode()) return;
        
        var _this = this;
        
        var mainDiv = new Element('div', {'class': 'import-selector'});
                        
        var promptImport = new Element('div', {'class': 'import-section'}).update("Import data:");
        this.importValue = new Element("textarea", {"id": "import", "value": "", "class": "import-textarea"});
        mainDiv.insert(promptImport).insert(this.importValue);
        
        if (!!window.FileReader && !!window.FileList) {
            // only show the upload link if browser supports FileReader/DOM File API
            // Of the browsers suported by pedigree editor, IE9 and Safari 4 & 5 do not support file API 
            var uploadFileSelector = new Element('input', {"type" : "file", "id": 'pedigreeInputFile', "style": 'display:none'});        
            uploadFileSelector.observe('change', function(event) {
                _this.handleFileUpload(this.files);
                try {
                    this.value = "";  // clear file selector
                } catch (err) {
                    // some older browsers do not allow setting value of a file input element and may generate a security error
                }
            })        
            var uploadButton = new Element('input', {type: 'button', 'value': 'Select file', 'class' : 'button'}).wrap('span', {'class' : 'buttonwrapper'});
            uploadButton.observe('click', function(event) {
                var fileElem = document.getElementById("pedigreeInputFile");
                fileElem.click();
            })
            mainDiv.insert(uploadFileSelector).insert(uploadButton);
        }
        
        var _addTypeOption = function (checked, labelText, value) {
            var optionWrapper = new Element('tr');
            var input = new Element('input', {"type" : "radio", "value": value, "name": "select-type"});
            input.observe('click', _this.disableEnableOptions );
            if (checked) {
              input.checked = true;
            }
            var label = new Element('label', {'class': 'import-type-label'}).insert(input).insert(labelText);
            optionWrapper.insert(label.wrap('td'));
            return optionWrapper;
          };          
        var typeListElement = new Element('table');
        //TODO: typeListElement.insert(_addTypeOption(true,  "Autodetect", "auto"));
        typeListElement.insert(_addTypeOption(true,  "PED or LINKAGE (pre- or post- makeped)", "ped"));        
        typeListElement.insert(_addTypeOption(false, "GEDCOM", "gedcom"));
        typeListElement.insert(_addTypeOption(false, "BOADICEA", "BOADICEA"));
        typeListElement.insert(_addTypeOption(false, "Simple JSON", "simpleJSON"));
        //TODO: typeListElement.insert(_addTypeOption(false, "Phenotips Pedigree JSON", "phenotipsJSON"));

        var promptType = new Element('div', {'class': 'import-section'}).update("Data format:");
        var dataSection2 = new Element('div', {'class': 'import-block'});
        dataSection2.insert(promptType).insert(typeListElement);
        mainDiv.insert(dataSection2);

        var _addConfigOption = function (checked, labelText, value) {
            var optionWrapper = new Element('tr');
            var input = new Element('input', {"type" : "radio", "value": value, "name": "select-options" });            
            if (checked) {
              input.checked = true;
{'fraction_non_alphanumeric': 0.13674748025061292, 'fraction_numerical': 0.002179242713157178, 'mean_word_length': 2.4185288640595903, 'pattern_counts': {'":': 18, '<': 5, '<?xml version=': 0, '>': 5, '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': '4743680', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1876, 'n_words': 494}