<commit_before>(function(angular) {
	'use strict';

	angular.module('xpsui:services')
	/**
	 *
	 * Factory used for generation of forms by schema definitions.
	 *
	 * @class FormGenerator
	 * @module client
	 * @submodule services
	 */
	.factory('xpsui:FormGenerator', ['xpsui:logging', '$compile', 'xpsui:ComponentGenerator', '$timeout', '$translate', function(log, $compile, componentGenerator, $timeout, $translate) {
		function FormGenerator() {
		}

		FormGenerator.prototype.MODE = {
			VIEW: 'view',
			EDIT: 'edit',
			VIEWEDIT: 'viewedit'
		};

		FormGenerator.prototype.generateLabel = function(schemaFragment) {
			// TODO translation
			var isRequired = (schemaFragment.required ? ' x-required': '');
			var fieldsetClass = 'x-fieldset-label';

			return angular.element('<div class="' + fieldsetClass + ' ' + isRequired + '" >' 
				+ '<span>' + (schemaFragment.transCode ?
					$translate.instant(schemaFragment.transCode) : schemaFragment.title
				) + '</span>' 
			+ '</div>');
		};

		FormGenerator.prototype.generateField = function(schemaFragment, schemaPath, modelPath, mode) {
			var field;

			if (mode === this.MODE.VIEWEDIT) {
				field = angular.element('<div></div>');
				field.attr('xpsui-form-control', 'x');
				field.attr('xpsui-inlineedit', this.MODE.VIEW);
				field.attr('xpsui-model', modelPath);
				field.attr('xpsui-schema', schemaPath);
			} else if (mode === this.MODE.EDIT) {

				if (schemaFragment.type === 'array') {
					if (schemaFragment.items && schemaFragment.items.render && schemaFragment.items.render.component ) {
						field = angular.element('<div xpsui-array-control-edit="'+schemaFragment.items.render.component+'"></div>');
					} else {
						field = angular.element('<div xpsui-array-control-edit></div>');
					}
					field.attr('xpsui-schema', schemaPath);
				} else if(schemaFragment.objectLink2) {
					field = angular.element('<div xpsui-objectlink2-edit></div>');
					field.attr('xpsui-schema', schemaPath);
				} else if(schemaFragment.uploadableImage
					|| (schemaFragment.render && schemaFragment.render.component === 'psui-uploadable-image')){
					field = angular.element('<div xpsui-uploadable-image xpsui-imageresizor /></div>');
					field.attr('xpsui-schema', schemaPath);
					var width = schemaFragment.uploadableImage ? 
						schemaFragment.uploadableImage.width : schemaFragment.render.width;
					var height = schemaFragment.uploadableImage ? 
						schemaFragment.uploadableImage.height : schemaFragment.render.height;

					field.attr('psui-imageresizor-width', width);
					field.attr('psui-imageresizor-height', height);
					field.attr('style', 'width: 100% !important;'
						+ (height ? 'height:'+height+'px !important;':'height:150px')
						+ 'background-size: contain;'
						+ 'background-position: top left;'
					);
				} else if (schemaFragment.enum) {
					field = angular.element('<div xpsui-select-edit></div>');
					field.attr('xpsui-schema', schemaPath);
				} else if (schemaFragment.render && schemaFragment.render.component  ){
					if ( schemaFragment.render.component=="psui-textarea" ) {
						field = angular.element('<div xpsui-textarea-edit></div>');
					} else if ( schemaFragment.render.component=="psui-datepicker" ) {
						field = angular.element('<div xpsui-date-edit xpsui-calendar ></div>');
					} else if (schemaFragment.render.component=="psui-contenteditable") {
						field = angular.element('<div xpsui-contenteditable></div>');<commit_msg>[FIXED #91257784] Form generator and uploadable files<commit_after>(function(angular) {
	'use strict';

	angular.module('xpsui:services')
	/**
	 *
	 * Factory used for generation of forms by schema definitions.
	 *
	 * @class FormGenerator
	 * @module client
	 * @submodule services
	 */
	.factory('xpsui:FormGenerator', ['xpsui:logging', '$compile', 'xpsui:ComponentGenerator', '$timeout', '$translate', function(log, $compile, componentGenerator, $timeout, $translate) {
		function FormGenerator() {
		}

		FormGenerator.prototype.MODE = {
			VIEW: 'view',
			EDIT: 'edit',
			VIEWEDIT: 'viewedit'
		};

		FormGenerator.prototype.generateLabel = function(schemaFragment) {
			// TODO translation
			var isRequired = (schemaFragment.required ? ' x-required': '');
			var fieldsetClass = 'x-fieldset-label';

			return angular.element('<div class="' + fieldsetClass + ' ' + isRequired + '" >' 
				+ '<span>' + (schemaFragment.transCode ?
					$translate.instant(schemaFragment.transCode) : schemaFragment.title
				) + '</span>' 
			+ '</div>');
		};

		FormGenerator.prototype.generateField = function(schemaFragment, schemaPath, modelPath, mode) {
			var field;

			if (mode === this.MODE.VIEWEDIT) {
				field = angular.element('<div></div>');
				field.attr('xpsui-form-control', 'x');
				field.attr('xpsui-inlineedit', this.MODE.VIEW);
				field.attr('xpsui-model', modelPath);
				field.attr('xpsui-schema', schemaPath);
			} else if (mode === this.MODE.EDIT) {

				if (schemaFragment.type === 'array') {
					if (schemaFragment.items && schemaFragment.items.render && schemaFragment.items.render.component ) {
						field = angular.element('<div xpsui-array-control-edit="'+schemaFragment.items.render.component+'"></div>');
					} else {
						field = angular.element('<div xpsui-array-control-edit></div>');
					}
					field.attr('xpsui-schema', schemaPath);
				} else if(schemaFragment.objectLink2) {
					field = angular.element('<div xpsui-objectlink2-edit></div>');
					field.attr('xpsui-schema', schemaPath);
				} else if(schemaFragment.uploadableImage
					|| (schemaFragment.render && schemaFragment.render.component === 'psui-uploadable-image')){
					field = angular.element('<div xpsui-uploadable-image xpsui-imageresizor /></div>');
					field.attr('xpsui-schema', schemaPath);
					var width = schemaFragment.uploadableImage ? 
						schemaFragment.uploadableImage.width : schemaFragment.render.width;
					var height = schemaFragment.uploadableImage ? 
						schemaFragment.uploadableImage.height : schemaFragment.render.height;

					field.attr('psui-imageresizor-width', width);
					field.attr('psui-imageresizor-height', height);
					field.attr('style', 'width: 100% !important;'
						+ (height ? 'height:'+height+'px !important;':'height:150px')
						+ 'background-size: contain;'
						+ 'background-position: top left;'
					);
				} else if (schemaFragment.enum) {
					field = angular.element('<div xpsui-select-edit></div>');
					field.attr('xpsui-schema', schemaPath);
				} else if (schemaFragment.render && schemaFragment.render.component  ){
					if ( schemaFragment.render.component=="psui-textarea" ) {
						field = angular.element('<div xpsui-textarea-edit></div>');
					} else if ( schemaFragment.render.component=="psui-datepicker" ) {
						field = angular.element('<div xpsui-date-edit xpsui-calendar ></div>');
					} else if (schemaFragment.render.component=="psui-contenteditable") {
						field = angular.element('<div xpsui-contenteditable></div>');

					} else if (schemaFragment.render.component=="psui-uploadable-file") {
						field = angular.element('<div xpsui-uploadable-file></div>');
{'fraction_non_alphanumeric': 0.16521617069062325, 'fraction_numerical': 0.003368893879842785, 'mean_word_length': 3.9894957983193278, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '3305559', 'n_tokens_mistral': 2615, 'n_tokens_neox': 2145, 'n_words': 365}