<commit_before>{if $tracker_input.trackerId}
{tikimodule error=$module_params.error title=$tpl_module_title name="tracker_input" flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
	<form class="mod-tracker-input simple" method="get" action="{service controller=tracker action=insert_item}" data-location="{$tracker_input.location|escape}" data-location-mode="{$tracker_input.locationMode|escape}" data-streetview="{$tracker_input.streetview|escape}" data-success="{$tracker_input.success|json_encode|escape}">
		{foreach from=$tracker_input.textInput key=token item=label}
			<label>
				{$label|escape}
				<input type="text" name="forced~{$token|escape}"/>
			</label>
		{/foreach}
		<div class="submit">
			<input type="hidden" name="trackerId" value="{$tracker_input.trackerId|escape}"/>
			<input type="hidden" name="controller" value="tracker"/>
			<input type="hidden" name="action" value="insert_item"/>
			<input type="submit" name="create" value="{$tracker_input.submit|escape}"/>
			{foreach from=$tracker_input.hiddenInput key=f item=v}
				<input id="{$f|escape}" type="hidden" name="forced~{$f|escape}" value="{$v|escape}"/>
			{/foreach}
		</div>
	</form>

	{jq}
	function hasEmptyField(form, scope) {
		var hasEmpty = false;
		$(scope, form).each(function () {
			if ($(this).val() === '') {
				hasEmpty = true;
			}
		});

		return hasEmpty;
	}
	$('.mod-tracker-input').removeClass('mod-tracker-input').submit(function () {
		var form = this;
		if (hasEmptyField(form, ':input:not(:submit)')) {
			$(':submit', form).showError("{tr}Missing values{/tr}");
			return false;
		}

		$(this).serviceDialog({
			title: $(':submit', form).val(),
			data: $(form).serialize(),
			success: function (data) {
				$(form).trigger('insert', [ data ]);
			},
			close: function () {
				$(form).trigger('cancel');
			}
		});
		return false;
	}).each(function () {
		var form = this
			, location = $(this).data('location')
			, locationMode = $(this).data('location-mode')
			, streetview = $(this).data('streetview')
			, success = $(this).data('success')
			;

		if (success.operation === 'redirect') {
			$(form).bind('insert', function (e, data) {
				var url = success.argument;

				data.fields.itemId = data.itemId;
				data.fields.status = data.status;
				$.each(data.fields, function (k, v) {
					url = url.replace('@' + k + '@', escape(v));
				});

				document.location.href = url;
			});
		}

		if (location ) {
			var map = $(form).closest('.tab, #appframe, body').find('.map-container')[0];
			$(':submit', form).hide();
			$(map).one('initialized', function () {
				var control, button, modeManager, newMode;
				modeManager = map.modeManager;

				if (locationMode === 'marker') {
					control = $(map).setupMapSelection({
						field: $('#' + location),
						click: function () {
							$(form).submit();
						}
					});
					control.deactivate();

					modeManager.addMode({name: newMode = "{{$tpl_module_title}}", controls: [control, new OpenLayers.Control.NavToolbar()]});
				}

				button = $('<input type="submit"/>')
					.val($(':submit', form).val())
					.button()
					.click(function () {
						if (newMode) {<commit_msg>[FIX] UTF-8 handling in URLs<commit_after>{if $tracker_input.trackerId}
{tikimodule error=$module_params.error title=$tpl_module_title name="tracker_input" flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
	<form class="mod-tracker-input simple" method="get" action="{service controller=tracker action=insert_item}" data-location="{$tracker_input.location|escape}" data-location-mode="{$tracker_input.locationMode|escape}" data-streetview="{$tracker_input.streetview|escape}" data-success="{$tracker_input.success|json_encode|escape}">
		{foreach from=$tracker_input.textInput key=token item=label}
			<label>
				{$label|escape}
				<input type="text" name="forced~{$token|escape}"/>
			</label>
		{/foreach}
		<div class="submit">
			<input type="hidden" name="trackerId" value="{$tracker_input.trackerId|escape}"/>
			<input type="hidden" name="controller" value="tracker"/>
			<input type="hidden" name="action" value="insert_item"/>
			<input type="submit" name="create" value="{$tracker_input.submit|escape}"/>
			{foreach from=$tracker_input.hiddenInput key=f item=v}
				<input id="{$f|escape}" type="hidden" name="forced~{$f|escape}" value="{$v|escape}"/>
			{/foreach}
		</div>
	</form>

	{jq}
	function hasEmptyField(form, scope) {
		var hasEmpty = false;
		$(scope, form).each(function () {
			if ($(this).val() === '') {
				hasEmpty = true;
			}
		});

		return hasEmpty;
	}
	$('.mod-tracker-input').removeClass('mod-tracker-input').submit(function () {
		var form = this;
		if (hasEmptyField(form, ':input:not(:submit)')) {
			$(':submit', form).showError("{tr}Missing values{/tr}");
			return false;
		}

		$(this).serviceDialog({
			title: $(':submit', form).val(),
			data: $(form).serialize(),
			success: function (data) {
				$(form).trigger('insert', [ data ]);
			},
			close: function () {
				$(form).trigger('cancel');
			}
		});
		return false;
	}).each(function () {
		var form = this
			, location = $(this).data('location')
			, locationMode = $(this).data('location-mode')
			, streetview = $(this).data('streetview')
			, success = $(this).data('success')
			;

		if (success.operation === 'redirect') {
			$(form).bind('insert', function (e, data) {
				var url = success.argument;

				data.fields.itemId = data.itemId;
				data.fields.status = data.status;
				$.each(data.fields, function (k, v) {
					url = url.replace('@' + k + '@', encodeURIComponent(v));
				});

				document.location.href = url;
			});
		}

		if (location ) {
			var map = $(form).closest('.tab, #appframe, body').find('.map-container')[0];
			$(':submit', form).hide();
			$(map).one('initialized', function () {
				var control, button, modeManager, newMode;
				modeManager = map.modeManager;

				if (locationMode === 'marker') {
					control = $(map).setupMapSelection({
						field: $('#' + location),
						click: function () {
							$(form).submit();
						}
					});
					control.deactivate();

					modeManager.addMode({name: newMode = "{{$tpl_module_title}}", controls: [control, new OpenLayers.Control.NavToolbar()]});
				}

				button = $('<input type="submit"/>')
					.val($(':submit', form).val())
					.button()
					.click(function () {
						if (newMode) {
{'fraction_non_alphanumeric': 0.20344986908978901, 'fraction_numerical': 0.00046203603881102723, 'mean_word_length': 4.211878009630818, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '4612714', 'n_tokens_mistral': 2519, 'n_tokens_neox': 2120, 'n_words': 376}