Version Description
(2015-07-20) =
- Minor usability improvements.
Download this release
Release Info
Developer | smithworx |
Plugin | Lingotek Translation |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- admin/actions.php +1 -1
- admin/admin.php +18 -27
- admin/tutorial/credits.php +34 -3
- include/model.php +15 -2
- js/updater.js +101 -60
- lingotek.php +2 -2
- readme.txt +5 -1
admin/actions.php
CHANGED
@@ -251,7 +251,7 @@ abstract class Lingotek_Actions {
|
|
251 |
return sprintf(
|
252 |
'<a class="lingotek-color" title="%s" href="%s"%s>%s</a>',
|
253 |
self::$actions[$action]['description'],
|
254 |
-
wp_nonce_url(
|
255 |
empty($warning) ? '' : self::$confirm_message,
|
256 |
self::$actions[$action]['action']
|
257 |
);
|
251 |
return sprintf(
|
252 |
'<a class="lingotek-color" title="%s" href="%s"%s>%s</a>',
|
253 |
self::$actions[$action]['description'],
|
254 |
+
wp_nonce_url(defined('DOING_AJAX') && DOING_AJAX ? add_query_arg($args, wp_get_referer()) : add_query_arg($args), 'lingotek-' .$action),
|
255 |
empty($warning) ? '' : self::$confirm_message,
|
256 |
self::$actions[$action]['action']
|
257 |
);
|
admin/admin.php
CHANGED
@@ -32,44 +32,35 @@ class Lingotek_Admin {
|
|
32 |
}
|
33 |
public function ajax_get_current_status(){
|
34 |
global $wpdb;
|
|
|
35 |
$languages = pll_languages_list(array('fields' => 'locale'));
|
36 |
$object_ids = $_POST['check_ids'];
|
37 |
if($object_ids === null){
|
38 |
return;
|
39 |
}
|
40 |
$terms = isset($_POST['terms_translations']);
|
41 |
-
$taxonomy = $terms ? '
|
42 |
-
: '
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$terms_query = $wpdb->prepare("SELECT term_tax.*, terms.name AS doc_id, wp_tr.object_id FROM wp_term_taxonomy term_tax "
|
47 |
-
. "INNER JOIN wp_terms terms ON term_tax.term_id = terms.term_id "
|
48 |
-
. "INNER JOIN wp_term_relationships wp_tr ON term_tax.term_taxonomy_id = wp_tr.term_taxonomy_id "
|
49 |
-
. "WHERE taxonomy = '$taxonomy' "
|
50 |
-
. "AND wp_tr.object_id in ($relationship_placeholders)", $object_ids);
|
51 |
-
$results = $wpdb->get_results($terms_query);
|
52 |
-
|
53 |
-
//package up the db results into an associative array. The main array consists of
|
54 |
//ids and nonces. Each id has a source language, languages with statuses, and a workbench link
|
55 |
$content_metadata = [];
|
56 |
-
foreach($
|
57 |
-
$id = $
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
: pll_get_post_language($post_data['source'], 'locale');
|
62 |
-
|
63 |
$content_metadata[$id]['source'] = $source_language;
|
64 |
-
$content_metadata[$id]['doc_id'] = $
|
65 |
-
$content_metadata[$id][$source_language]['status'] = $
|
66 |
-
|
67 |
-
$
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
}
|
71 |
}
|
72 |
-
|
73 |
//fills in missing languages to be able to update all the ones listed on Wordpress
|
74 |
foreach($languages as $language){
|
75 |
foreach($content_metadata as $group => $status){
|
32 |
}
|
33 |
public function ajax_get_current_status(){
|
34 |
global $wpdb;
|
35 |
+
$lgtm = &$GLOBALS['wp_lingotek']->model;
|
36 |
$languages = pll_languages_list(array('fields' => 'locale'));
|
37 |
$object_ids = $_POST['check_ids'];
|
38 |
if($object_ids === null){
|
39 |
return;
|
40 |
}
|
41 |
$terms = isset($_POST['terms_translations']);
|
42 |
+
$taxonomy = $terms ? 'term'
|
43 |
+
: 'post';
|
44 |
+
|
45 |
+
//The main array consists of
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
//ids and nonces. Each id has a source language, languages with statuses, and a workbench link
|
47 |
$content_metadata = [];
|
48 |
+
foreach($object_ids as $object_id) {
|
49 |
+
$id = $object_id;
|
50 |
+
$document = $lgtm->get_group($taxonomy, $object_ids[$object_id]);
|
51 |
+
$source_language = $terms ? pll_get_term_language($document->source, 'locale')
|
52 |
+
: pll_get_post_language($document->source, 'locale');
|
|
|
|
|
53 |
$content_metadata[$id]['source'] = $source_language;
|
54 |
+
$content_metadata[$id]['doc_id'] = $document->document_id;
|
55 |
+
$content_metadata[$id][$source_language]['status'] = $document->status;
|
56 |
+
if(is_array($document->translations)){
|
57 |
+
foreach($document->translations as $locale => $translation_status){
|
58 |
+
$content_metadata[$id][$locale]['status'] = $translation_status;
|
59 |
+
$workbench_link = Lingotek_Actions::workbench_link($document->document_id, $locale);
|
60 |
+
$content_metadata[$id][$locale]['workbench_link'] = $workbench_link;
|
61 |
+
}
|
62 |
}
|
63 |
}
|
|
|
64 |
//fills in missing languages to be able to update all the ones listed on Wordpress
|
65 |
foreach($languages as $language){
|
66 |
foreach($content_metadata as $group => $status){
|
admin/tutorial/credits.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$
|
4 |
'fred'=>array(
|
5 |
'name'=>'Frédéric Demarle',
|
6 |
'title'=>'Lead Polylang Developer',
|
@@ -36,9 +36,24 @@ $people = array(
|
|
36 |
'title'=>'Tech Writer',
|
37 |
'image_url'=>'https://www.gravatar.com/avatar/56c44e12c3431aca766d06c6019201ff',
|
38 |
'url'=>'https://profiles.wordpress.org/laurakaysc'),
|
|
|
|
|
|
|
|
|
|
|
39 |
);
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
?>
|
44 |
|
@@ -49,7 +64,23 @@ shuffle($people);
|
|
49 |
<ul class="wp-people-group">
|
50 |
<?php
|
51 |
|
52 |
-
foreach($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
printf('<li class="wp-person" id="wp-person-%s">
|
54 |
<a href="%s" target="_blank"><img src="%s?s=60&d=mm&r=G" srcset="%s?s=120&d=mm&r=G 2x" class="gravatar" alt="%s"></a>
|
55 |
<a class="web" href="%s" target="_blank">%s</a>
|
1 |
<?php
|
2 |
|
3 |
+
$team = array(
|
4 |
'fred'=>array(
|
5 |
'name'=>'Frédéric Demarle',
|
6 |
'title'=>'Lead Polylang Developer',
|
36 |
'title'=>'Tech Writer',
|
37 |
'image_url'=>'https://www.gravatar.com/avatar/56c44e12c3431aca766d06c6019201ff',
|
38 |
'url'=>'https://profiles.wordpress.org/laurakaysc'),
|
39 |
+
'seth'=>array(
|
40 |
+
'name'=>'Seth White',
|
41 |
+
'title'=>'Developer',
|
42 |
+
'image_url'=>'https://www.gravatar.com/avatar/53706ce5472909827db3e582bb4bccf2',
|
43 |
+
'url'=>'https://profiles.wordpress.org/sethwhite'),
|
44 |
);
|
45 |
|
46 |
+
$contributors = array(
|
47 |
+
'larry'=>array(
|
48 |
+
'name'=>'Larry Furr',
|
49 |
+
'title'=>'',
|
50 |
+
'image_url'=>'https://www.gravatar.com/avatar/77447d8ad56b4ba5ea8f3900b3245c41',
|
51 |
+
'url'=>'https://profiles.wordpress.org/furrever'),
|
52 |
+
|
53 |
+
);
|
54 |
+
|
55 |
+
shuffle($team);
|
56 |
+
shuffle($contributors);
|
57 |
|
58 |
?>
|
59 |
|
64 |
<ul class="wp-people-group">
|
65 |
<?php
|
66 |
|
67 |
+
foreach($team as $person_key=>$person){
|
68 |
+
printf('<li class="wp-person" id="wp-person-%s">
|
69 |
+
<a href="%s" target="_blank"><img src="%s?s=60&d=mm&r=G" srcset="%s?s=120&d=mm&r=G 2x" class="gravatar" alt="%s"></a>
|
70 |
+
<a class="web" href="%s" target="_blank">%s</a>
|
71 |
+
<span class="title">%s</span>
|
72 |
+
</li>',$person_key,$person['url'],$person['image_url'],$person['image_url'],$person['name'],$person['url'],$person['name'],$person['title']);
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
76 |
+
</ul>
|
77 |
+
|
78 |
+
<h4 class="wp-people-group"><?php _e('Contributors', 'wp-lingotek'); ?></h4>
|
79 |
+
|
80 |
+
<ul class="wp-people-group">
|
81 |
+
<?php
|
82 |
+
|
83 |
+
foreach($contributors as $person_key=>$person){
|
84 |
printf('<li class="wp-person" id="wp-person-%s">
|
85 |
<a href="%s" target="_blank"><img src="%s?s=60&d=mm&r=G" srcset="%s?s=120&d=mm&r=G 2x" class="gravatar" alt="%s"></a>
|
86 |
<a class="web" href="%s" target="_blank">%s</a>
|
include/model.php
CHANGED
@@ -556,8 +556,21 @@ class Lingotek_Model {
|
|
556 |
$term_id = get_option('default_category');
|
557 |
$group = $this->get_group('term', $term_id);
|
558 |
foreach($this->pllm->get_languages_list() as $language) {
|
559 |
-
if (empty($group->source) || ($group->get_source_language()->slug != $language->slug && empty($group->translations[$language->locale])))
|
560 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
}
|
562 |
}
|
563 |
|
556 |
$term_id = get_option('default_category');
|
557 |
$group = $this->get_group('term', $term_id);
|
558 |
foreach($this->pllm->get_languages_list() as $language) {
|
559 |
+
if (empty($group->source) || ($group->get_source_language()->slug != $language->slug && empty($group->translations[$language->locale]))) {
|
560 |
+
if ($language->slug != $this->pllm->options['default_lang']) {
|
561 |
+
$sources[$language->slug]--;
|
562 |
+
}
|
563 |
+
}
|
564 |
+
}
|
565 |
+
// Remove category targets from being counted until they are downloaded. Fixed target categories being counted as source languages.
|
566 |
+
foreach ($groups as $group) {
|
567 |
+
$group = unserialize($group);
|
568 |
+
if (isset($group['lingotek']['translations'])) {
|
569 |
+
foreach ($group['lingotek']['translations'] as $locale => $status) {
|
570 |
+
if (('pending' == $status || 'ready' == $status) && $language = $this->pllm->get_language($locale))
|
571 |
+
$sources[$language->slug]--;
|
572 |
+
}
|
573 |
+
}
|
574 |
}
|
575 |
}
|
576 |
|
js/updater.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
-
var checkboxes = $('#the-list').find('input');
|
3 |
var current_ids = {};
|
4 |
var post_data = {"check_ids" : current_ids};
|
5 |
var url = window.location.href;
|
@@ -8,23 +7,28 @@ jQuery(document).ready(function($) {
|
|
8 |
var ajax_url = relative_url + '/admin-ajax.php?action=get_current_status';
|
9 |
var page_params = '/edit.php?';
|
10 |
var tr_id = '#post-';
|
|
|
11 |
if(url.indexOf('taxonomy') > -1){
|
12 |
var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
|
13 |
var taxonomy_type = url.substring(begin);
|
14 |
}
|
15 |
-
|
16 |
-
|
17 |
-
});
|
18 |
-
if(taxonomy_type === 'category'){
|
19 |
-
var uncategorized_id = 1;
|
20 |
-
current_ids[uncategorized_id] = uncategorized_id;
|
21 |
-
}
|
22 |
if($('.edit-tags-php').length > 0){
|
23 |
post_data['terms_translations'] = true;
|
24 |
page_params = '/edit-tags.php?taxonomy=' + taxonomy_type + '&';
|
25 |
tr_id = '#tag-';
|
|
|
26 |
}
|
27 |
setInterval(function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
$.ajax({
|
29 |
type: 'POST',
|
30 |
url: ajax_url,
|
@@ -40,11 +44,19 @@ jQuery(document).ready(function($) {
|
|
40 |
|
41 |
|
42 |
function update_indicators(data){
|
|
|
|
|
|
|
|
|
43 |
for(var key in data){
|
|
|
|
|
|
|
|
|
|
|
44 |
if(key.indexOf('_nonce') > -1) {
|
45 |
continue;
|
46 |
}
|
47 |
-
var tr = $(tr_id + key);
|
48 |
for(var locale in data[key]){
|
49 |
if(locale === 'source' || locale === 'doc_id'){
|
50 |
continue;
|
@@ -52,26 +64,23 @@ jQuery(document).ready(function($) {
|
|
52 |
var td = $(tr).find('td.language_' + locale);
|
53 |
switch(data[key][locale]['status']){
|
54 |
case 'current':
|
|
|
55 |
if(locale === data[key]['source']){
|
56 |
$(td).find('.lingotek-color').remove();
|
57 |
-
|
58 |
if(post_data['terms_translations'] === true){
|
59 |
var request_link = $('<a></a>').attr('href', relative_url
|
60 |
+ '/edit-tags.php?action=edit'
|
61 |
+ '&taxonomy=' + taxonomy_type
|
62 |
+ '&tag_ID=' + key
|
63 |
-
+ '&post_type=post')
|
64 |
-
.attr('title','Source uploaded')
|
65 |
-
.addClass('lingotek-color dashicons dashicons-yes');
|
66 |
}
|
67 |
else {
|
68 |
var request_link = $('<a></a>').attr('href', relative_url
|
69 |
+ '/post.php?post= ' + key
|
70 |
-
+ '&action=edit')
|
71 |
-
.attr('title','Source uploaded')
|
72 |
-
.addClass('lingotek-color dashicons dashicons-yes');
|
73 |
}
|
74 |
-
|
|
|
75 |
$(td).append(request_link);
|
76 |
}
|
77 |
else {
|
@@ -84,6 +93,8 @@ jQuery(document).ready(function($) {
|
|
84 |
}
|
85 |
break;
|
86 |
case 'pending':
|
|
|
|
|
87 |
$(td).find('.lingotek-color').remove();
|
88 |
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
89 |
.attr('title','In Progress')
|
@@ -92,18 +103,12 @@ jQuery(document).ready(function($) {
|
|
92 |
$(td).append(request_link);
|
93 |
break;
|
94 |
case 'importing':
|
95 |
-
$(td).find('.
|
96 |
-
|
97 |
-
|
98 |
-
+ '&locale=' + locale
|
99 |
-
+ '&action=lingotek-status'
|
100 |
-
+ '&noheader=1'
|
101 |
-
+ '&_wpnonce=' + data['status_nonce'])
|
102 |
-
.attr('title','Importing source')
|
103 |
-
.addClass('lingotek-color dashicons dashicons-clock');
|
104 |
-
$(td).append(request_link);
|
105 |
break;
|
106 |
case 'not-current' :
|
|
|
107 |
$(td).find('.lingotek-color').remove();
|
108 |
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
109 |
.attr('title','The target translation is no longer current as the source content has been updated')
|
@@ -112,59 +117,43 @@ jQuery(document).ready(function($) {
|
|
112 |
$(td).append(request_link);
|
113 |
break;
|
114 |
case 'edited':
|
|
|
|
|
115 |
$(td).find('.lingotek-color').remove();
|
116 |
var request_link = $('<a></a>').attr('href', relative_url
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
.attr('title','Upload Now')
|
123 |
.addClass('lingotek-color dashicons dashicons-upload');
|
124 |
$(td).append(request_link);
|
125 |
break;
|
126 |
case 'ready':
|
127 |
-
|
128 |
-
|
129 |
-
+ page_params + 'document_id=' + data[key]['doc_id']
|
130 |
-
+ '&locale=' + locale
|
131 |
-
+ '&action=lingotek-download'
|
132 |
-
+ '&noheader=1'
|
133 |
-
+ '&_wpnonce='+data['download_nonce'])
|
134 |
-
.attr('title','Ready to download')
|
135 |
-
.addClass('lingotek-color dashicons dashicons-download');
|
136 |
-
$(td).append(request_link);
|
137 |
break;
|
138 |
default:
|
|
|
139 |
if(locale === data[key]['source']){
|
140 |
$(td).find('.lingotek-color').remove();
|
141 |
-
|
142 |
-
|
143 |
-
+ '&locale=' + locale
|
144 |
-
+ '&action=lingotek-upload'
|
145 |
-
+ '&noheader=1'
|
146 |
-
+ '&_wpnonce=' + data['upload_nonce'])
|
147 |
-
.attr('title','Upload Now')
|
148 |
-
.addClass('lingotek-color dashicons dashicons-upload');
|
149 |
-
$(td).append(request_link);
|
150 |
}
|
151 |
else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
|
152 |
break;
|
153 |
}
|
154 |
-
else if(data[key][
|
155 |
$(td).find('.pll_icon_add').remove();
|
|
|
156 |
$(td).find('.lingotek-color').remove();
|
157 |
-
|
158 |
-
|
159 |
-
+ '&locale='+locale+'&action=lingotek-request'
|
160 |
-
+ '&noheader=1'
|
161 |
-
+ '&_wpnonce='+data['request_nonce'])
|
162 |
-
.attr('title','Request a translation')
|
163 |
-
.addClass('lingotek-color dashicons dashicons-plus');
|
164 |
-
$(td).append(request_link);
|
165 |
}
|
166 |
else {
|
167 |
$(td).find('.pll_icon_add').remove();
|
|
|
168 |
$(td).find('.lingotek-color').remove();
|
169 |
var indicator = $('<div></div>').addClass('lingotek-color dashicons dashicons-no');
|
170 |
$(td).append(indicator);
|
@@ -174,4 +163,56 @@ jQuery(document).ready(function($) {
|
|
174 |
}
|
175 |
}
|
176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
});
|
1 |
jQuery(document).ready(function($) {
|
|
|
2 |
var current_ids = {};
|
3 |
var post_data = {"check_ids" : current_ids};
|
4 |
var url = window.location.href;
|
7 |
var ajax_url = relative_url + '/admin-ajax.php?action=get_current_status';
|
8 |
var page_params = '/edit.php?';
|
9 |
var tr_id = '#post-';
|
10 |
+
var object_type = 'post';
|
11 |
if(url.indexOf('taxonomy') > -1){
|
12 |
var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
|
13 |
var taxonomy_type = url.substring(begin);
|
14 |
}
|
15 |
+
|
16 |
+
|
|
|
|
|
|
|
|
|
|
|
17 |
if($('.edit-tags-php').length > 0){
|
18 |
post_data['terms_translations'] = true;
|
19 |
page_params = '/edit-tags.php?taxonomy=' + taxonomy_type + '&';
|
20 |
tr_id = '#tag-';
|
21 |
+
object_type = 'term';
|
22 |
}
|
23 |
setInterval(function(){
|
24 |
+
var rows = $('#the-list').find('tr');
|
25 |
+
$(rows).each(function(){
|
26 |
+
if($(this).attr('id').length > 1){
|
27 |
+
var id = $(this).attr('id');
|
28 |
+
var object_id = id.replace( /^\D+/g, '');
|
29 |
+
current_ids[object_id] = object_id;
|
30 |
+
}
|
31 |
+
});
|
32 |
$.ajax({
|
33 |
type: 'POST',
|
34 |
url: ajax_url,
|
44 |
|
45 |
|
46 |
function update_indicators(data){
|
47 |
+
$('.lingotek-request').remove();
|
48 |
+
$('.lingotek-status').remove();
|
49 |
+
$('.lingotek-upload').remove();
|
50 |
+
$('.lingotek-download').remove();
|
51 |
for(var key in data){
|
52 |
+
var tr = $(tr_id + key);
|
53 |
+
if(data[key]['source'] === false){
|
54 |
+
updateUploadBulkLink(tr, data, key, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
|
55 |
+
continue;
|
56 |
+
}
|
57 |
if(key.indexOf('_nonce') > -1) {
|
58 |
continue;
|
59 |
}
|
|
|
60 |
for(var locale in data[key]){
|
61 |
if(locale === 'source' || locale === 'doc_id'){
|
62 |
continue;
|
64 |
var td = $(tr).find('td.language_' + locale);
|
65 |
switch(data[key][locale]['status']){
|
66 |
case 'current':
|
67 |
+
$(td).find('.pll_icon_edit').remove();
|
68 |
if(locale === data[key]['source']){
|
69 |
$(td).find('.lingotek-color').remove();
|
|
|
70 |
if(post_data['terms_translations'] === true){
|
71 |
var request_link = $('<a></a>').attr('href', relative_url
|
72 |
+ '/edit-tags.php?action=edit'
|
73 |
+ '&taxonomy=' + taxonomy_type
|
74 |
+ '&tag_ID=' + key
|
75 |
+
+ '&post_type=post');
|
|
|
|
|
76 |
}
|
77 |
else {
|
78 |
var request_link = $('<a></a>').attr('href', relative_url
|
79 |
+ '/post.php?post= ' + key
|
80 |
+
+ '&action=edit');
|
|
|
|
|
81 |
}
|
82 |
+
$(request_link).attr('title','Source uploaded')
|
83 |
+
.addClass('lingotek-color dashicons dashicons-yes');
|
84 |
$(td).append(request_link);
|
85 |
}
|
86 |
else {
|
93 |
}
|
94 |
break;
|
95 |
case 'pending':
|
96 |
+
$(td).find('.pll_icon_edit').remove();
|
97 |
+
updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
|
98 |
$(td).find('.lingotek-color').remove();
|
99 |
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
100 |
.attr('title','In Progress')
|
103 |
$(td).append(request_link);
|
104 |
break;
|
105 |
case 'importing':
|
106 |
+
$(td).find('.pll_icon_edit').remove();
|
107 |
+
updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
|
108 |
+
updateIndicator(td, data, key, locale, 'status', 'Importing Source', 'clock');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
break;
|
110 |
case 'not-current' :
|
111 |
+
$(td).find('.pll_icon_edit').remove();
|
112 |
$(td).find('.lingotek-color').remove();
|
113 |
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
114 |
.attr('title','The target translation is no longer current as the source content has been updated')
|
117 |
$(td).append(request_link);
|
118 |
break;
|
119 |
case 'edited':
|
120 |
+
$(td).find('.pll_icon_edit').remove();
|
121 |
+
updateUploadBulkLink(tr, data, key, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
|
122 |
$(td).find('.lingotek-color').remove();
|
123 |
var request_link = $('<a></a>').attr('href', relative_url
|
124 |
+
+ page_params + 'post= ' + key
|
125 |
+
+ '&locale=' + locale
|
126 |
+
+ '&action=lingotek-upload'
|
127 |
+
+ '&noheader=1'
|
128 |
+
+ '&_wpnonce=' + data['upload_nonce'])
|
129 |
.attr('title','Upload Now')
|
130 |
.addClass('lingotek-color dashicons dashicons-upload');
|
131 |
$(td).append(request_link);
|
132 |
break;
|
133 |
case 'ready':
|
134 |
+
updateGenericBulkLink(tr, data, key, 'download' , 'Download translations of this item from Lingotek TMS', 'Download translations');
|
135 |
+
updateIndicator(td, data, key, locale, 'download', 'Ready to download', 'download');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
break;
|
137 |
default:
|
138 |
+
var source = data[key]['source'];
|
139 |
if(locale === data[key]['source']){
|
140 |
$(td).find('.lingotek-color').remove();
|
141 |
+
$(td).find('.pll_icon_edit').remove();
|
142 |
+
updateIndicator(td, data, key, locale, 'upload', 'Upload Now', 'upload');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
|
145 |
break;
|
146 |
}
|
147 |
+
else if(source !== false && data[key][source]['status'] === 'current'){
|
148 |
$(td).find('.pll_icon_add').remove();
|
149 |
+
$(td).find('.pll_icon_edit').remove();
|
150 |
$(td).find('.lingotek-color').remove();
|
151 |
+
updateIndicator(td, data, key, locale, 'request', 'Request a translation', 'plus');
|
152 |
+
updateGenericBulkLink(tr, data, key, 'request' , 'Request translations of this item to Lingotek TMS', 'Request translations');
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
else {
|
155 |
$(td).find('.pll_icon_add').remove();
|
156 |
+
$(td).find('.pll_icon_edit').remove();
|
157 |
$(td).find('.lingotek-color').remove();
|
158 |
var indicator = $('<div></div>').addClass('lingotek-color dashicons dashicons-no');
|
159 |
$(td).append(indicator);
|
163 |
}
|
164 |
}
|
165 |
}
|
166 |
+
function updateGenericBulkLink(tr, data, key, action, title, text){
|
167 |
+
var row_actions = $(tr).find('.row-actions');
|
168 |
+
if($(row_actions).find('.lingotek-' + action).length === 0){
|
169 |
+
var status_update_link = $('<span class="lingotek-'+ action +'"><a class="lingotek-color"'
|
170 |
+
+ ' title="' + title + '" '
|
171 |
+
+ 'href="?document_id=' + data[key]['doc_id']
|
172 |
+
+ '&action=lingotek-' + action
|
173 |
+
+ '&noheader=1'
|
174 |
+
+ '&_wpnonce=' + data[action + '_nonce']
|
175 |
+
+ '">' + text + '</a> | </span>');
|
176 |
+
var disassociate = $(row_actions).find('.lingotek-delete');
|
177 |
+
if($(disassociate).length > 0){
|
178 |
+
$(disassociate).before(status_update_link);
|
179 |
+
}
|
180 |
+
else {
|
181 |
+
$(row_actions).append(status_update_link);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
}
|
185 |
+
function updateUploadBulkLink(tr, data, key, action, title, text){
|
186 |
+
var row_actions = $(tr).find('.row-actions');
|
187 |
+
if($(row_actions).find('.lingotek-' + action).length === 0){
|
188 |
+
var status_update_link = $('<span class="lingotek-'+ action +'"><a class="lingotek-color"'
|
189 |
+
+ ' title="' + title + '" '
|
190 |
+
+ 'href="?'
|
191 |
+
+ 'taxonomy=' + taxonomy_type
|
192 |
+
+ '&' + object_type + '=' + key
|
193 |
+
+ '&action=lingotek-' + action
|
194 |
+
+ '&noheader=1'
|
195 |
+
+ '&_wpnonce=' + data[action + '_nonce']
|
196 |
+
+ '">' + text + '</a> | </span>');
|
197 |
+
var disassociate = $(row_actions).find('.lingotek-delete');
|
198 |
+
if($(disassociate).length > 0){
|
199 |
+
$(disassociate).before(status_update_link);
|
200 |
+
}
|
201 |
+
else {
|
202 |
+
$(row_actions).append(status_update_link);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
function updateIndicator(td, data, key, locale, action, title, dashicon){
|
207 |
+
$(td).find('.lingotek-color').remove();
|
208 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
209 |
+
+ page_params + 'document_id=' + data[key]['doc_id']
|
210 |
+
+ '&locale=' + locale
|
211 |
+
+ '&action=lingotek-' + action
|
212 |
+
+ '&noheader=1'
|
213 |
+
+ '&_wpnonce='+data[action + '_nonce'])
|
214 |
+
.attr('title', title)
|
215 |
+
.addClass('lingotek-color dashicons dashicons-' + dashicon);
|
216 |
+
$(td).append(request_link);
|
217 |
+
}
|
218 |
});
|
lingotek.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin name: Lingotek Translation
|
4 |
Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
|
5 |
-
Version: 1.0.
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
@@ -15,7 +15,7 @@ GitHub Plugin URI: https://github.com/lingotek/wp-lingotek
|
|
15 |
if (!function_exists('add_action'))
|
16 |
exit();
|
17 |
|
18 |
-
define('LINGOTEK_VERSION', '1.0.
|
19 |
define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
|
20 |
define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
21 |
define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// plugin slug (should match above meta: Text Domain)
|
2 |
/*
|
3 |
Plugin name: Lingotek Translation
|
4 |
Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
|
5 |
+
Version: 1.0.3
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
15 |
if (!function_exists('add_action'))
|
16 |
exit();
|
17 |
|
18 |
+
define('LINGOTEK_VERSION', '1.0.3'); // plugin version (should match above meta)
|
19 |
define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
|
20 |
define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
21 |
define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// plugin slug (should match above meta: Text Domain)
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://lingotek.com/
|
|
4 |
Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -115,6 +115,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
|
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
118 |
= 1.0.2 (2015-07-16) =
|
119 |
|
120 |
* Real-time translation status updates!
|
4 |
Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 1.0.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 1.0.3 (2015-07-20) =
|
119 |
+
|
120 |
+
* Minor usability improvements.
|
121 |
+
|
122 |
= 1.0.2 (2015-07-16) =
|
123 |
|
124 |
* Real-time translation status updates!
|