<commit_before>/**
 * 
 */
Ext.define('converter.Form', {
	extend: 'Ext.form.Panel',
	
    /* i18n */
    uploadFileLabel: "Upload File",
    selectFileButtonText: "Select File:",
    waitingMessageText: "Waiting...",
    /* ~i18n */

    width: 600,
    height: 400,
    
    initComponent: function() {
    	
	    this.items = [{
				    	items: [{
					    	xtype: 'panel',
					        height: 300,
					        margin: 2
				        }]
	    			},
	    			{
	    				xtype: 'panel',
	    				items : this.getInstitutionButtons()
	    			},
	    			{
		                xtype: 'filefield',
		                name: 'uploadfile',
		                fieldLabel: this.uploadFileLabel,
		                msgTarget: 'side',
		                allowBlank: false,
		                anchor: '100%',
		                margin: 2,
		                buttonText: this.selectFileButtonText
	    			}],
	    			
		this.buttons = [{
			text: 'Upload',
		    handler: function() {
				if(this.isValid()) {
					this.submit({
						url: 'dataportal/uploadFile',
						waitMsg: this.waitingMessageText,
				        sucess: function(form, action) {
				            			
				        },
				        failure: function(form, action) {
				            			
				        }
				    })
				} else {
					// TODO is form is not valid
				}
		    }},{
		    	text: 'Cancel'
		    }]
    	this.callParent(arguments);
    },
    
    /**
     * 
     */
	getInstitutionButtons: function() {
		
	}
});<commit_msg>Create converter institution buttons dinamically<commit_after>/**
 * 
 */
Ext.define('converter.Form', {
	extend : 'Ext.form.Panel',

	/* i18n */
	uploadFileLabel : "Upload File",
	selectFileButtonText : "Select File:",
	waitingMessageText : "Waiting...",
	uploadButtonText : "Upload",
	cancelButtonText : 'Cancel',
	/* ~i18n */

	width : 600,
	height : 400,
	getInstitutionButtonsItems : [],

	institutionPanel : Ext.create('Ext.panel.Panel', {}),

	initComponent : function() {

		this.getInstitutionButtons();

		this.items = [ {
			items : [ {
				xtype : 'panel',
				height : 300,
				margin : 2
			} ]
		}, this.institutionPanel, {
			xtype : 'filefield',
			name : 'uploadfile',
			fieldLabel : this.uploadFileLabel,
			msgTarget : 'side',
			allowBlank : false,
			anchor : '100%',
			margin : 2,
			buttonText : this.selectFileButtonText
		} ],

		this.buttons = [ {
			text : this.uploadButtonText,
			handler : function() {
				if (this.isValid()) {
					this.submit({
						url : 'dataportal/uploadFile',
						waitMsg : this.waitingMessageText,
						sucess : function(form, action) {

						},
						failure : function(form, action) {

						}
					})
				} else {
					// TODO is form is not valid
				}
			}
		}, {
			text : this.cancelButtonText
		} ]
		this.callParent(arguments);
	},

	/**
	 * 
	 */
	getInstitutionButtons : function() {

		Ext.define('Converter', {
			extend : 'Ext.data.Model',
			fields : [ 'name', 'institution_name', 'institution_realname',
					'institution_url' ]
		})

		var store = Ext.create('Ext.data.Store', {
			model : 'Converter',
			proxy : {
				type : 'ajax',
				url : 'converter',
				extraParams : {
					converters : true
				},
				reader : {
					type : 'xml',
					record : 'converter',
					root : 'converters'
				}
			}
		})

		var items = new Array();

		store.load({
			scope : this,
			callback : function(records, operation, success) {
				if (success) {
					for ( var indexRecord in records) {
						var record = records[indexRecord];
						this.institutionPanel.add(Ext.create('Ext.Button', {
							text : record.data.name,
							handler : this.assignConverter
						}))
					}
				}
			}
		});
	}
});
{'fraction_non_alphanumeric': 0.14352232265132842, 'fraction_numerical': 0.009860312243221035, 'mean_word_length': 1.8620689655172413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '2759255', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1157, 'n_words': 218}