PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.4
VikBooking Hotel Booking Engine & PMS v1.6.4
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / admin / views / translations / tmpl / default.php

default.php in VikBooking Hotel Booking Engine & PMS 1.6.4, at admin/views/translations/tmpl/default.php

559 lines 21.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage com_vikbooking
5 * @author Alessio Gaggii - e4j - Extensionsforjoomla.com
6 * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 * @link https://vikwp.com
9 */
10
11 defined('ABSPATH') or die('No script kiddies please!');
12
13 $vbo_tn = $this->vbo_tn;
14
15 $vbo_app = VikBooking::getVboApplication();
16 $vbo_app->loadVisualEditorAssets();
17
18 $editor = JEditor::getInstance(JFactory::getApplication()->get('editor'));
19
20 $langs = $vbo_tn->getLanguagesList();
21 $xml_tables = $vbo_tn->getTranslationTables();
22 $active_table = '';
23 $active_table_key = '';
24
25 // JS lang vars
26 JText::script('VBO_COPY_ORIGINAL_TN');
27
28 if (!(count($langs) > 1)) {
29 //Error: only one language is published. Translations are useless
30 ?>
31 <p class="err"><?php echo JText::translate('VBTRANSLATIONERRONELANG'); ?></p>
32 <form name="adminForm" id="adminForm" action="index.php" method="post">
33 <input type="hidden" name="task" value="">
34 <input type="hidden" name="option" value="com_vikbooking">
35 </form>
36 <?php
37 } elseif (!count($xml_tables) || strlen($vbo_tn->getError())) {
38 //Error: XML file not readable or errors occurred
39 ?>
40 <p class="err"><?php echo $vbo_tn->getError(); ?></p>
41 <form name="adminForm" id="adminForm" action="index.php" method="post">
42 <input type="hidden" name="task" value="">
43 <input type="hidden" name="option" value="com_vikbooking">
44 </form>
45 <?php
46 } else {
47 $cur_langtab = VikRequest::getString('vbo_lang', '', 'request');
48 $table = VikRequest::getString('vbo_table', '', 'request');
49 if (!empty($table)) {
50 $table = $vbo_tn->replacePrefix($table);
51 }
52 ?>
53
54 <form action="index.php?option=com_vikbooking&amp;task=translations" method="post" onsubmit="return vboCheckChanges();">
55 <div style="width: 100%; display: inline-block;" class="btn-toolbar vbo-btn-toolbar" id="filter-bar">
56 <div class="btn-group pull-right">
57 <button class="btn" type="submit"><?php echo JText::translate('VBOGETTRANSLATIONS'); ?></button>
58 </div>
59 <div class="btn-group pull-right">
60 <select name="vbo_table">
61 <option value="">-----------</option>
62 <?php
63 foreach ($xml_tables as $key => $value) {
64 $active_table = $vbo_tn->replacePrefix($key) == $table ? $value : $active_table;
65 $active_table_key = $vbo_tn->replacePrefix($key) == $table ? $key : $active_table_key;
66 ?>
67 <option value="<?php echo $key; ?>"<?php echo $vbo_tn->replacePrefix($key) == $table ? ' selected="selected"' : ''; ?>><?php echo $value; ?></option>
68 <?php
69 }
70 ?>
71 </select>
72 </div>
73 </div>
74 <input type="hidden" name="vbo_lang" class="vbo_lang" value="<?php echo $vbo_tn->default_lang; ?>">
75 <input type="hidden" name="option" value="com_vikbooking" />
76 <input type="hidden" name="task" value="translations" />
77 </form>
78 <form name="adminForm" id="adminForm" action="index.php" method="post">
79 <div class="vbo-translation-langtabs">
80 <?php
81 foreach ($langs as $ltag => $lang) {
82 $is_def = ($ltag == $vbo_tn->default_lang);
83 $lcountry = substr($ltag, 0, 2);
84 $flag = '';
85 if (!defined('ABSPATH') && is_file(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'mod_languages' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $lcountry . '.gif')) {
86 $flag = '<img src="' . JUri::root() . 'media/mod_languages/images/' . $lcountry . '.gif"/>';
87 }
88 ?><div class="vbo-translation-tab<?php echo $is_def ? ' vbo-translation-tab-default' : ''; ?>" data-vbolang="<?php echo $ltag; ?>">
89 <?php
90 if (!empty($flag)) {
91 ?>
92 <span class="vbo-translation-flag"><?php echo $flag; ?></span>
93 <?php
94 }
95 ?>
96 <span class="vbo-translation-langname"><?php echo $lang['name']; ?></span>
97 </div><?php
98 }
99
100 if (!defined('ABSPATH')) {
101 ?>
102 <div class="vbo-translation-tab vbo-translation-tab-ini" data-vbolang="">
103 <span class="vbo-translation-iniflag">.INI</span>
104 <span class="vbo-translation-langname"><?php echo JText::translate('VBTRANSLATIONINISTATUS'); ?></span>
105 </div>
106 <?php
107 }
108 ?>
109 </div>
110 <div class="vbo-translation-tabscontents">
111 <?php
112 $table_cols = !empty($active_table_key) ? $vbo_tn->getTableColumns($active_table_key) : array();
113 $table_def_dbvals = !empty($active_table_key) ? $vbo_tn->getTableDefaultDbValues($active_table_key, array_keys($table_cols)) : array();
114 if (!empty($active_table_key)) {
115 echo '<input type="hidden" name="vbo_table" value="'.$active_table_key.'"/>'."\n";
116 }
117 foreach ($langs as $ltag => $lang) {
118 $is_def = ($ltag == $vbo_tn->default_lang);
119 ?>
120 <div class="vbo-translation-langcontent" style="display: <?php echo $is_def ? 'block' : 'none'; ?>;" id="vbo_langcontent_<?php echo $ltag; ?>">
121 <?php
122 if (empty($active_table_key)) {
123 ?>
124 <p class="warn"><?php echo JText::translate('VBTRANSLATIONSELTABLEMESS'); ?></p>
125 <?php
126 } elseif (strlen($vbo_tn->getError()) > 0) {
127 ?>
128 <p class="err"><?php echo $vbo_tn->getError(); ?></p>
129 <?php
130 } else {
131 ?>
132 <fieldset class="adminform">
133 <legend class="adminlegend"><?php echo $active_table; ?> - <?php echo $lang['name'].($is_def ? ' - '.JText::translate('VBTRANSLATIONDEFLANG') : ''); ?></legend>
134 <div class="vbo-translations-tab-container">
135 <?php
136 if ($is_def) {
137 //Values of Default Language to be translated
138 foreach ($table_def_dbvals as $reference_id => $values) {
139 ?>
140 <div class="vbo-translations-default-element">
141 <div class="vbo-translations-element-title" data-reference="<?php echo $ltag.'-'.$reference_id; ?>">
142 <div class="vbo-translate-element-cell"><?php echo $vbo_tn->getRecordReferenceName($table_cols, $values); ?></div>
143 </div>
144 <div class="vbo-translations-element-contents">
145 <?php
146 foreach ($values as $field => $def_value) {
147 $title = $table_cols[$field]['jlang'];
148 $type = $table_cols[$field]['type'];
149 if ($type == 'html') {
150 $def_value = strip_tags($def_value);
151 }
152 ?>
153 <div class="vbo-translations-element-row" data-reference="<?php echo $ltag.'-'.$reference_id; ?>">
154 <div class="vbo-translations-element-lbl"><?php echo $title; ?></div>
155 <div class="vbo-translations-element-val" data-origvalue="<?php echo $reference_id . '-' . $field; ?>"><?php echo $type != 'json' ? $def_value : ''; ?></div>
156 </div>
157 <?php
158 if ($type == 'json') {
159 $tn_keys = $table_cols[$field]['keys'];
160 $keys = !empty($tn_keys) ? explode(',', $tn_keys) : array();
161 $json_def_values = json_decode($def_value, true);
162 if (count($json_def_values) > 0) {
163 foreach ($json_def_values as $jkey => $jval) {
164 if ((!in_array($jkey, $keys) && count($keys) > 0) || empty($jval)) {
165 continue;
166 }
167 $json_lbl = '&nbsp;';
168 if (!is_numeric($jkey)) {
169 $guess_lbl = JText::translate('VBO_' . strtoupper($jkey));
170 $json_lbl = $guess_lbl != 'VBO_' . strtoupper($jkey) ? $guess_lbl : ucwords($jkey);
171 }
172 ?>
173 <div class="vbo-translations-element-row vbo-translations-element-row-nested" data-reference="<?php echo $ltag.'-'.$reference_id; ?>">
174 <div class="vbo-translations-element-lbl"><?php echo $json_lbl; ?></div>
175 <div class="vbo-translations-element-val" data-origvalue="<?php echo $reference_id . '-' . $field . '-' . $jkey; ?>"><?php echo $jval; ?></div>
176 </div>
177 <?php
178 }
179 }
180 }
181 ?>
182 <?php
183 }
184 ?>
185 </div>
186 </div>
187 <?php
188 }
189 } else {
190 //Translation Fields for this language
191 $lang_record_tn = $vbo_tn->getTranslatedTable($active_table_key, $ltag);
192 foreach ($table_def_dbvals as $reference_id => $values) {
193 ?>
194 <div class="vbo-translations-language-element">
195 <div class="vbo-translations-element-title" data-reference="<?php echo $ltag.'-'.$reference_id; ?>">
196 <div class="vbo-translate-element-cell"><?php echo $vbo_tn->getRecordReferenceName($table_cols, $values); ?></div>
197 </div>
198 <div class="vbo-translations-element-contents">
199 <?php
200 foreach ($values as $field => $def_value) {
201 $title = $table_cols[$field]['jlang'];
202 $type = $table_cols[$field]['type'];
203 if ($type == 'skip') {
204 continue;
205 }
206 $tn_value = '';
207 $tn_class = ' vbo-missing-translation';
208 if (array_key_exists($reference_id, $lang_record_tn) && array_key_exists($field, $lang_record_tn[$reference_id]['content']) && strlen($lang_record_tn[$reference_id]['content'][$field])) {
209 if (in_array($type, array('text', 'textarea', 'html'))) {
210 $tn_class = ' vbo-field-translated';
211 } else {
212 $tn_class = '';
213 }
214 }
215 ?>
216 <div class="vbo-translations-element-row<?php echo $tn_class; ?>" data-reference="<?php echo $ltag.'-'.$reference_id; ?>" data-copyoriginal="<?php echo $reference_id . '-' . $field; ?>">
217 <div class="vbo-translations-element-lbl"><?php echo $title; ?></div>
218 <div class="vbo-translations-element-val">
219 <?php
220 if ($type == 'text') {
221 if (array_key_exists($reference_id, $lang_record_tn) && array_key_exists($field, $lang_record_tn[$reference_id]['content'])) {
222 $tn_value = $lang_record_tn[$reference_id]['content'][$field];
223 }
224 ?>
225 <input type="text" name="tn[<?php echo $ltag; ?>][<?php echo $reference_id; ?>][<?php echo $field; ?>]" value="<?php echo htmlspecialchars($tn_value); ?>" size="40" placeholder="<?php echo htmlspecialchars($def_value); ?>"/>
226 <?php
227 } elseif ($type == 'textarea') {
228 if (array_key_exists($reference_id, $lang_record_tn) && array_key_exists($field, $lang_record_tn[$reference_id]['content'])) {
229 $tn_value = $lang_record_tn[$reference_id]['content'][$field];
230 }
231 ?>
232 <textarea name="tn[<?php echo $ltag; ?>][<?php echo $reference_id; ?>][<?php echo $field; ?>]" rows="7" cols="170"><?php echo $tn_value; ?></textarea>
233 <?php
234 } elseif ($type == 'html') {
235 if (array_key_exists($reference_id, $lang_record_tn) && array_key_exists($field, $lang_record_tn[$reference_id]['content'])) {
236 $tn_value = $lang_record_tn[$reference_id]['content'][$field];
237 }
238 if (defined('ABSPATH') && interface_exists('Throwable')) {
239 /**
240 * With PHP >= 7 supporting throwable exceptions for Fatal Errors
241 * we try to avoid issues with third party plugins that make use
242 * of the WP native function get_current_screen().
243 *
244 * @wponly
245 */
246 try {
247 echo $editor->display( "tn[".$ltag."][".$reference_id."][".$field."]", $tn_value, '100%', 350, 70, 20, true, "tn_".$ltag."_".$reference_id."_".$field );
248 } catch (Throwable $t) {
249 echo $t->getMessage() . ' in ' . $t->getFile() . ':' . $t->getLine() . '<br/>';
250 }
251 } else {
252 // we cannot catch Fatal Errors in PHP 5.x
253 echo $editor->display( "tn[".$ltag."][".$reference_id."][".$field."]", $tn_value, '100%', 350, 70, 20, true, "tn_".$ltag."_".$reference_id."_".$field );
254 }
255 }
256 ?>
257 </div>
258 </div>
259 <?php
260 if ($type == 'json') {
261 $tn_keys = $table_cols[$field]['keys'];
262 $keys = !empty($tn_keys) ? explode(',', $tn_keys) : array();
263 $json_def_values = json_decode($def_value, true);
264 if (count($json_def_values)) {
265 $tn_json_value = array();
266 if (array_key_exists($reference_id, $lang_record_tn) && array_key_exists($field, $lang_record_tn[$reference_id]['content'])) {
267 $tn_json_value = json_decode($lang_record_tn[$reference_id]['content'][$field], true);
268 }
269 foreach ($json_def_values as $jkey => $jval) {
270 if ((!in_array($jkey, $keys) && count($keys) > 0) || empty($jval)) {
271 continue;
272 }
273 $json_lbl = '&nbsp;';
274 if (!is_numeric($jkey)) {
275 $guess_lbl = JText::translate('VBO_' . strtoupper($jkey));
276 $json_lbl = $guess_lbl != 'VBO_' . strtoupper($jkey) ? $guess_lbl : ucwords($jkey);
277 }
278 ?>
279 <div class="vbo-translations-element-row vbo-translations-element-row-nested" data-reference="<?php echo $ltag.'-'.$reference_id; ?>" data-copyoriginal="<?php echo $reference_id . '-' . $field . '-' . $jkey; ?>">
280 <div class="vbo-translations-element-lbl"><?php echo $json_lbl; ?></div>
281 <div class="vbo-translations-element-val">
282 <?php
283 if (strlen($jval) > 40) {
284 // check if this translation field requires the rich text visual editor
285 if ($jkey == 'tpl_text' && strpos($jval, '<') !== false) {
286 // the original field contains HTML code built through the visual editor
287 $veditor_name = 'tn[' . $ltag . '][' . $reference_id . '][' . $field . '][' . $jkey . ']';
288 $veditor_id = 'tn_' . $ltag . '_' . $reference_id . '_' . $field . '_' . $jkey;
289 $tarea_attr = array(
290 'id' => $veditor_id,
291 'rows' => '7',
292 'cols' => '170',
293 'style' => 'min-width: 60%;',
294 );
295 $editor_opts = array(
296 'modes' => array(
297 'text',
298 'visual',
299 ),
300 );
301 echo $vbo_app->renderVisualEditor($veditor_name, (isset($tn_json_value[$jkey]) ? $tn_json_value[$jkey] : ''), $tarea_attr, $editor_opts);
302 } else {
303 ?>
304 <textarea rows="7" cols="170" style="min-width: 60%;" name="tn[<?php echo $ltag; ?>][<?php echo $reference_id; ?>][<?php echo $field; ?>][<?php echo $jkey; ?>]"><?php echo isset($tn_json_value[$jkey]) ? $tn_json_value[$jkey] : ''; ?></textarea>
305 <?php
306 }
307 } else {
308 ?>
309 <input type="text" name="tn[<?php echo $ltag; ?>][<?php echo $reference_id; ?>][<?php echo $field; ?>][<?php echo $jkey; ?>]" value="<?php echo isset($tn_json_value[$jkey]) ? $tn_json_value[$jkey] : ''; ?>" size="40" placeholder="<?php echo htmlspecialchars($jval); ?>"/>
310 <?php
311 }
312 ?>
313 </div>
314 </div>
315 <?php
316 }
317 }
318 }
319 }
320 ?>
321 </div>
322 </div>
323 <?php
324 }
325 }
326 ?>
327 </div>
328 </fieldset>
329 <?php
330 }
331 ?>
332 </div>
333 <?php
334 }
335
336 // ini files status
337 if (!defined('ABSPATH')) {
338 $all_inis = $vbo_tn->getIniFiles();
339 ?>
340 <div class="vbo-translation-langcontent" style="display: none;" id="vbo_langcontent_ini">
341 <fieldset class="adminform">
342 <legend class="adminlegend">.INI <?php echo JText::translate('VBTRANSLATIONINISTATUS'); ?></legend>
343 <div class="vbo-translations-tab-container">
344 <?php
345 foreach ($all_inis as $initype => $inidet) {
346 $inipath = $inidet['path'];
347 ?>
348 <div class="vbo-translations-ini-element">
349 <div class="vbo-translations-element-title">
350 <div class="vbo-translate-element-cell"><?php echo JText::translate('VBINIEXPL'.strtoupper($initype)); ?></div>
351 </div>
352 <div class="vbo-translations-element-contents">
353 <?php
354 foreach ($langs as $ltag => $lang) {
355 $t_file_exists = file_exists(str_replace('en-GB', $ltag, $inipath));
356 $t_parsed_ini = $t_file_exists ? parse_ini_file(str_replace('en-GB', $ltag, $inipath)) : false;
357 ?>
358 <div class="vbo-translations-element-row <?php echo $t_file_exists ? 'vbo-field-translated' : 'vbo-missing-translation'; ?>">
359 <div class="vbo-translations-element-lbl"><?php echo ($ltag == 'en-GB' ? 'Native ' : '').$lang['name']; ?></div>
360 <div class="vbo-translations-element-val">
361 <span class="vbo-inifile-totrows <?php echo $t_file_exists ? 'vbo-inifile-exists' : 'vbo-inifile-notfound'; ?>"><?php echo $t_file_exists && $t_parsed_ini !== false ? JText::translate('VBOINIDEFINITIONS').': '.count($t_parsed_ini) : JText::translate('VBOINIMISSINGFILE'); ?></span>
362 <span class="vbo-inifile-path <?php echo $t_file_exists ? 'vbo-inifile-exists' : 'vbo-inifile-notfound'; ?>"><?php echo JText::translate('VBOINIPATH').': '.str_replace('en-GB', $ltag, $inipath); ?></span>
363 </div>
364 </div>
365 <?php
366 }
367 ?>
368 </div>
369 </div>
370 <?php
371 }
372 ?>
373 </div>
374 </fieldset>
375 </div>
376 <?php
377 // end ini files status
378 }
379 ?>
380 </div>
381 <input type="hidden" name="vbo_lang" class="vbo_lang" value="<?php echo $vbo_tn->default_lang; ?>">
382 <input type="hidden" name="task" value="translations">
383 <input type="hidden" name="option" value="com_vikbooking">
384 <?php echo JHtml::fetch('form.token'); ?>
385
386 <div class="vbo-translations-lim-wrap">
387 <table align="center">
388 <tr>
389 <td align="center"><?php echo $vbo_tn->getPagination(); ?></td>
390 </tr>
391 <tr>
392 <td align="center">
393 <select name="limit" onchange="vboHandleCustomLimit(this.value);">
394 <option value="2"<?php echo $vbo_tn->lim == 2 ? ' selected="selected"' : ''; ?>>2</option>
395 <option value="5"<?php echo $vbo_tn->lim == 5 ? ' selected="selected"' : ''; ?>>5</option>
396 <option value="10"<?php echo $vbo_tn->lim == 10 ? ' selected="selected"' : ''; ?>>10</option>
397 <option value="20"<?php echo $vbo_tn->lim == 20 ? ' selected="selected"' : ''; ?>>20</option>
398 </select>
399 </td>
400 </tr>
401 </table>
402 </div>
403 </form>
404
405 <script type="text/Javascript">
406 var vbo_tn_changes = false;
407 var vbo_copy_delay = 500;
408 var vbo_copy_timeout = null;
409
410 function vboHandleCustomLimit(lim) {
411 var cur_limstart = document.adminForm.limitstart;
412 if (typeof cur_limstart === 'undefined') {
413 // append hidden input field to form
414 var limstart_node = document.createElement('INPUT');
415 limstart_node.setAttribute('type', 'hidden');
416 limstart_node.setAttribute('name', 'limitstart');
417 limstart_node.setAttribute('value', '0');
418 document.adminForm.appendChild(limstart_node);
419 } else {
420 // update existing value
421 document.adminForm.limitstart.value = '0';
422 }
423 // submit form
424 document.adminForm.submit();
425 }
426
427 function vboCheckChanges() {
428 if (!vbo_tn_changes) {
429 return true;
430 }
431 return confirm("<?php echo addslashes(JText::translate('VBTANSLATIONSCHANGESCONF')); ?>");
432 }
433
434 function vboHoverCopyTranslation(elem) {
435 if (!elem) {
436 return false;
437 }
438 var copy_reference = elem.attr('data-copyoriginal');
439 if (!copy_reference) {
440 return false;
441 }
442 var orig_elem = jQuery('.vbo-translations-element-val[data-origvalue="' + copy_reference + '"]');
443 if (!orig_elem || !orig_elem.length || !orig_elem.html().length) {
444 return false;
445 }
446 // check if translation field has got a value
447 var tn_field_val = elem.find('.vbo-translations-element-val').find('input,textarea').val();
448 if (!tn_field_val) {
449 // append button to copy the original content
450 elem.
451 find('.vbo-translations-element-lbl').
452 append('<div class="vbo-tn-copyoriginal"><span title="' + Joomla.JText._('VBO_COPY_ORIGINAL_TN') + '" onclick="vboApplyCopyTranslation(this);"><?php VikBookingIcons::e('copy'); ?></span></div>');
453 }
454 }
455
456 function vboApplyCopyTranslation(elem) {
457 elem = jQuery(elem).closest('.vbo-translations-element-row[data-copyoriginal]');
458 if (!elem || !elem.length) {
459 return false;
460 }
461 var copy_reference = elem.attr('data-copyoriginal');
462 if (!copy_reference) {
463 return false;
464 }
465 var orig_elem = jQuery('.vbo-translations-element-val[data-origvalue="' + copy_reference + '"]');
466 if (!orig_elem || !orig_elem.length) {
467 return false;
468 }
469
470 // make sure to remove any copy-from-original button
471 jQuery('.vbo-tn-copyoriginal').remove();
472
473 // set original content to translation field
474 var input = elem.find('.vbo-translations-element-val').find('input');
475 if (input && input.length) {
476 input.val(orig_elem.html()).trigger('change');
477 }
478 var tarea = elem.find('.vbo-translations-element-val').find('textarea');
479 if (tarea && tarea.length) {
480 tarea.val(orig_elem.html()).trigger('change');
481 }
482
483 // grab lang tag, which could be part of the ID of a WYSIWYG editor
484 var lang_reference_arr = elem.attr('data-reference').split('-');
485 lang_reference_arr.splice((lang_reference_arr.length - 1), 1);
486 var current_lang = lang_reference_arr.join('-');
487 var wysiwyg_hipo_id = current_lang + '-' . copy_reference;
488 wysiwyg_hipo_id.replaceAll('-', '_');
489
490 // attempt to inject value inside wysiwyg editor
491 try {
492 // native wysiwyg editor
493 if (typeof Joomla !== undefined && Joomla.editors && Joomla.editors.instances) {
494 if (Joomla.editors.instances.hasOwnProperty(wysiwyg_hipo_id)) {
495 Joomla.editors.instances[wysiwyg_hipo_id].setValue(orig_elem.html());
496 }
497 }
498 } catch(e) {
499 // do nothing
500 }
501 }
502
503 jQuery(document).ready(function() {
504
505 jQuery('.vbo-translation-tab').click(function() {
506 var langtag = jQuery(this).attr('data-vbolang');
507 if (jQuery('#vbo_langcontent_'+langtag).length) {
508 jQuery('.vbo_lang').val(langtag);
509 jQuery('.vbo-translation-tab').removeClass('vbo-translation-tab-default');
510 jQuery(this).addClass('vbo-translation-tab-default');
511 jQuery('.vbo-translation-langcontent').hide();
512 jQuery('#vbo_langcontent_'+langtag).fadeIn();
513 } else {
514 jQuery('.vbo-translation-tab').removeClass('vbo-translation-tab-default');
515 jQuery(this).addClass('vbo-translation-tab-default');
516 jQuery('.vbo-translation-langcontent').hide();
517 jQuery('#vbo_langcontent_ini').fadeIn();
518 }
519 });
520
521 jQuery('#adminForm input[type=text], #adminForm textarea').change(function() {
522 vbo_tn_changes = true;
523 });
524
525 jQuery('.vbo-translations-element-row[data-copyoriginal]').hover(function() {
526 var elem = jQuery(this);
527 vbo_copy_timeout = setTimeout(function() {
528 vboHoverCopyTranslation(elem);
529 }, vbo_copy_delay);
530 }, function() {
531 // cancel scheduled hovering function
532 clearTimeout(vbo_copy_timeout);
533 // make sure to remove any copy-from-original button
534 jQuery('.vbo-tn-copyoriginal').remove();
535 });
536 <?php
537 if (!empty($cur_langtab)) {
538 ?>
539 jQuery('.vbo-translation-tab').each(function() {
540 var langtag = jQuery(this).attr('data-vbolang');
541 if (langtag != '<?php echo $cur_langtab; ?>') {
542 return true;
543 }
544 if (jQuery('#vbo_langcontent_'+langtag).length) {
545 jQuery('.vbo_lang').val(langtag);
546 jQuery('.vbo-translation-tab').removeClass('vbo-translation-tab-default');
547 jQuery(this).addClass('vbo-translation-tab-default');
548 jQuery('.vbo-translation-langcontent').hide();
549 jQuery('#vbo_langcontent_'+langtag).fadeIn();
550 }
551 });
552 <?php
553 }
554 ?>
555 });
556 </script>
557 <?php
558 }
559