<commit_before><h3>{{ tr.sget('translate_article_in', lang.string|upper) }}</h3>
<form action="javascript:void(0)" id ="form{{ uid }}">
	
	<input type="hidden" name="id" value="{{ transl.id }}" />
  <input type="hidden" name="lang" value="{{ lang.id }}" />
	<!-- STATUS -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Status</label></div>
		<div class="col-sm-2 col-sm-offset-5">
			<select name="status">
				<option{% if transl.status == false %} selected="selected"{% endif %} value="0">{{ tr.get('not_translated') }}</option>
				<option{% if transl.status %} selected="selected"{% endif %} value="1">{{ tr.get('translated') }}</option>
			</select>
		</div>
	</div>
	
	<!-- TITLE -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Title</label></div>
		<div class="col-sm-4">
			<div class="well orig">{{ art.title }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<input type="text" name="title" value="{{ transl.title }}" />
		</div>
	</div>
	
	<!-- Keywords -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Keywords</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 100px;">{{ art.keywords }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="keywords" style="width:100%; height: 100px;">{{ transl.keywords }}</textarea>
		</div>
	</div>

	
	<!-- SUMMARY -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Summary</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 200px;">{{ art.summary|raw }}</div>
		</div>
    <div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="summary" class="tiny" id="summary{{ uid }}" style="width: 100%; height: 200px;">{{ transl.summary }}</textarea>
		</div>
	</div>
	
	<!-- TEXT -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Text</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 300px;">{{ art.text|raw }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="text" class="tiny" id="text{{ uid }}" style="width: 100%; height: 300px;">{{ transl.text }}</textarea>
		</div>
	</div>
	
  <!-- CUSTOM FIELDS -->
  {% if custom_fields %}
    {% for field in custom_fields %}
      {% if field.translate %}
        <div class="row form-group">
          <div class="col-sm-1"><label>{{ field.label }}</label></div>
          <div class="col-sm-4">
            <div class="well orig" style="overflow: auto; height: 200px;">{{ art[field.name]|raw }}</div>
          </div>
          <div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
          <div class="col-sm-6 transl">
            <textarea name="{{ field.name }}" style="width: 100%; height: 200px;">{{ transl[field.name] }}</textarea>
          </div>
        </div>
      {% endif %}
    {% endfor %}
  {% endif %}
	<p>
		<button type="submit" class="btn btn-success">{{ tr.get('save') }}</button>
		<button type="reset" class="btn btn-default">{{ tr.get('reset') }}</button>
	</p>
	
</form>

<script>
	$('#form{{ uid }}').on('submit', function(){
	
	tinyMCE.triggerSave();
	
	$.post(
			'controller.php?obj=article_ctrl&method=saveTransl&param[]={{ art.id }}',
			$('#form{{ uid }}').serialize(),
			function(data){
				admin.message(data.text, data.status);
				
				if (data.status == 'success'){
					admin.tabs.closeActive('article/translate/{{ lang.id }}/{{ art.id }}');
				}
			},
			'json'
		);	
});

	tinyMCE.execCommand("mceAddControl", true, "summary{{ uid }}");
	tinyMCE.execCommand("mceAddControl", true, "text{{ uid }}");

	$('#form{{ uid }} .copy').on('click', function(){
		var text = $(this).parents('.form-group').find('.orig').html();
		input = $(this).parents('.form-group').find('.transl > :input');
		
		if (input.hasClass('tiny')){
      console.log('tino');
			tinyMCE.get(input.attr('id')).setContent(text);
		} else {
			input.val(text);
		}
	
	});
</script><commit_msg>Rich custom fields also in translation form<commit_after><h3>{{ tr.sget('translate_article_in', lang.string|upper) }}</h3>
<form action="javascript:void(0)" id ="form{{ uid }}">
	
	<input type="hidden" name="id" value="{{ transl.id }}" />
  <input type="hidden" name="lang" value="{{ lang.id }}" />
	<!-- STATUS -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Status</label></div>
		<div class="col-sm-2 col-sm-offset-5">
			<select name="status">
				<option{% if transl.status == false %} selected="selected"{% endif %} value="0">{{ tr.get('not_translated') }}</option>
				<option{% if transl.status %} selected="selected"{% endif %} value="1">{{ tr.get('translated') }}</option>
			</select>
		</div>
	</div>
	
	<!-- TITLE -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Title</label></div>
		<div class="col-sm-4">
			<div class="well orig">{{ art.title }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<input type="text" name="title" value="{{ transl.title }}" />
		</div>
	</div>
	
	<!-- Keywords -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Keywords</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 100px;">{{ art.keywords }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="keywords" style="width:100%; height: 100px;">{{ transl.keywords }}</textarea>
		</div>
	</div>

	
	<!-- SUMMARY -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Summary</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 200px;">{{ art.summary|raw }}</div>
		</div>
    <div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="summary" class="tiny" id="summary{{ uid }}" style="width: 100%; height: 200px;">{{ transl.summary }}</textarea>
		</div>
	</div>
	
	<!-- TEXT -->
	<div class="row form-group">
		<div class="col-sm-1"><label>Text</label></div>
		<div class="col-sm-4">
			<div class="well orig" style="overflow: auto; height: 300px;">{{ art.text|raw }}</div>
		</div>
		<div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
		<div class="col-sm-6 transl">
			<textarea name="text" class="tiny" id="text{{ uid }}" style="width: 100%; height: 300px;">{{ transl.text }}</textarea>
		</div>
	</div>
	
  <!-- CUSTOM FIELDS -->
  {% if custom_fields %}
    {% for field in custom_fields %}
      {% if field.translate %}
        <div class="row form-group">
          <div class="col-sm-1"><label>{{ field.label }}</label></div>
          <div class="col-sm-4">
            <div class="well orig" style="overflow: auto; height: 200px;">{{ art[field.name]|raw }}</div>
          </div>
          <div class="col-sm-1"><button type="button" class="btn btn-default copy"> &gt;&gt; </button></div>
          <div class="col-sm-6 transl">
            <textarea name="{{ field.name }}" style="width: 100%; height: 200px;"
                      {% if field.richtext %}
                        id="richtext{{ uid ~ field.name }}"
                        class="tiny"
                      {% endif %}
                      >{{ transl[field.name] }}</textarea>
          </div>
        </div>
      {% endif %}
    {% endfor %}
  {% endif %}
	<p>
		<button type="submit" class="btn btn-success">{{ tr.get('save') }}</button>
		<button type="reset" class="btn btn-default">{{ tr.get('reset') }}</button>
	</p>
	
</form>

<script>
	$('#form{{ uid }}').on('submit', function(){
	
	tinyMCE.triggerSave();
	
	$.post(
			'controller.php?obj=article_ctrl&method=saveTransl&param[]={{ art.id }}',
			$('#form{{ uid }}').serialize(),
			function(data){
				admin.message(data.text, data.status);
				
				if (data.status == 'success'){
					admin.tabs.closeActive('article/translate/{{ lang.id }}/{{ art.id }}');
				}
			},
			'json'
		);	
});

	tinyMCE.execCommand("mceAddControl", true, "summary{{ uid }}");
	tinyMCE.execCommand("mceAddControl", true, "text{{ uid }}");
  {% if custom_fields %}
    {% for field in custom_fields %}
      tinyMCE.execCommand("mceAddControl", true, "richtext{{ uid ~ field.name }}");
    {% endfor %}
  {% endif %}

	$('#form{{ uid }} .copy').on('click', function(){
		var text = $(this).parents('.form-group').find('.orig').html();
		input = $(this).parents('.form-group').find('.transl > :input');
		
		if (input.hasClass('tiny')){
			tinyMCE.get(input.attr('id')).setContent(text);
		} else {
			input.val(text);
		}
	
	});
</script>
{'fraction_non_alphanumeric': 0.24688252023627216, 'fraction_numerical': 0.014001312623058412, 'mean_word_length': 3.5397219463753724, 'pattern_counts': {'":': 0, '<': 249, '<?xml version=': 0, '>': 251, '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': '2217096', 'n_tokens_mistral': 3544, 'n_tokens_neox': 3132, 'n_words': 664}