Plugin Directory

Changeset 1203565


Ignore:
Timestamp:
07/21/2015 10:49:28 PM (11 years ago)
Author:
smithworx
Message:

plugin and PHP compatability improvements

Location:
lingotek-translation
Files:
85 added
8 edited

Legend:

Unmodified
Added
Removed
  • lingotek-translation/trunk/admin/actions.php

    r1202583 r1203565  
    273273
    274274        $document = $this->lgtm->get_group($this->type, $id);
     275        $id = $document->desc_array['lingotek']['source'];
    275276
    276277        if ($this->lgtm->can_upload($this->type, $id) || (isset($document->source) && 'string' != $this->type && $this->lgtm->can_upload($this->type, $document->source))) {
  • lingotek-translation/trunk/admin/admin.php

    r1202665 r1203565  
    4545    //The main array consists of
    4646    //ids and nonces. Each id has a source language, languages with statuses, and a workbench link
    47     $content_metadata = [];
     47    $content_metadata = array();
    4848    foreach($object_ids as $object_id) {
    4949      $id = $object_id;
     
    5353      $content_metadata[$id]['source'] = $source_language;
    5454      $content_metadata[$id]['doc_id'] = $document->document_id;
    55       $content_metadata[$id][$source_language]['status'] = $document->status;
     55      $content_metadata[$id]['source_id'] = $document->source;
     56      $target_status = $document->status == 'edited' || $document->status == null ? 'edited' : 'current';
     57      $content_metadata[$id][$source_language]['status'] = $document->source == $object_id ? $document->status : $target_status;
    5658      if(is_array($document->translations)){
    5759        foreach($document->translations as $locale => $translation_status){
  • lingotek-translation/trunk/admin/filters-columns.php

    r1200580 r1203565  
    6464     * @param int $object_id id of the current object in row
    6565     */
    66     protected function _column($type, $column, $object_id) {
     66    protected function _column($type, $column, $object_id, $custom_data = NULL) {
    6767        $action = 'post' == $type ? 'inline-save' : 'inline-save-tax';
    6868        $inline = defined('DOING_AJAX') && $_REQUEST['action'] == $action && isset($_POST['inline_lang_choice']);
     
    7272
    7373        if (false === strpos($column, 'language_') || !$lang) {
    74             return '';
     74            if ($custom_data) {
     75                return $custom_data;
     76            }
     77            else {
     78                return '';
     79            }
    7580    }
    7681
     
    168173     * @param int term_id
    169174     */
    170     public function term_column($empty, $column, $term_id) {
     175    public function term_column($custom_data, $column, $term_id) {
    171176        $this->content_type = $GLOBALS['taxonomy'];
    172         return $this->_column('term', $column, $term_id);
     177        if (!$custom_data) {
     178            return $this->_column('term', $column, $term_id);
     179        }
     180        else {
     181            return $this->_column('term', $column, $term_id, $custom_data);
     182        }
    173183    }
    174184}
  • lingotek-translation/trunk/admin/post-actions.php

    r1200580 r1203565  
    9595    public function manage_actions() {
    9696        global $typenow;
    97     printf('<div id="auto-update" class="hidden"></div>');
    9897        $post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
    9998
  • lingotek-translation/trunk/css/admin.css

    r1193542 r1203565  
    1515    display: none;
    1616}
    17 
     17.ui-dialog {
     18    box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24),0 17px 50px 0 rgba(0, 0, 0, 0.19);
     19    padding: 10px;
     20    font-weight: 700;
     21}
     22.ui-dialog button {
     23  position:absolute;
     24  right: 0;
     25  top: 0;
     26  float: right;
     27  background-color: #0091CD;
     28  color: white;
     29  border:none;
     30  outline:none;
     31}
     32.ui-dialog button:hover {
     33  background-color: #007fb4;
     34}
    1835/* icons color */
    1936.lingotek-color {
  • lingotek-translation/trunk/js/updater.js

    r1202665 r1203565  
    1313    var taxonomy_type = url.substring(begin);
    1414  }
    15  
    1615
    1716  if($('.edit-tags-php').length > 0){
     
    4241    });
    4342  },10000);
    44  
    4543
    4644  function update_indicators(data){
     
    5048    $('.lingotek-download').remove();
    5149    for(var key in data){
     50      var source_id = key != data[key]['source_id'] ? data[key]['source_id'] : key;
    5251      var tr = $(tr_id + key);
    5352      if(data[key]['source'] === false){
    54         updateUploadBulkLink(tr, data, key, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
     53        updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
    5554        continue;
    5655      }
     
    5958      }
    6059      for(var locale in data[key]){
    61         if(locale === 'source' || locale === 'doc_id'){
     60        if(locale === 'source' || locale === 'doc_id' || locale === 'source_id'){
    6261          continue;
    6362        }
     
    7776              else {
    7877                var request_link = $('<a></a>').attr('href', relative_url
    79                       + '/post.php?post= ' + key
     78                      + '/post.php?post=' + source_id
    8079                      + '&action=edit');
    8180              }
     
    8584            }
    8685            else {
    87               $(td).find('.lingotek-color').remove();
    88               var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
    89                 .attr('title','Current')
    90                 .attr('target','_blank')
    91                 .addClass('lingotek-color dashicons dashicons-edit');
    92               $(td).append(request_link);
     86              updateWorkbenchIcon(td, data, key, locale, 'Current', 'edit');
    9387            }
    9488            break;
    9589          case 'pending':
    96             $(td).find('.pll_icon_edit').remove();
    9790            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')
    101               .attr('target','_blank')
    102               .addClass('lingotek-color dashicons dashicons-clock');
    103             $(td).append(request_link);
     91            updateWorkbenchIcon(td, data, key, locale, 'In Progress', 'clock');
    10492            break;
    10593          case 'importing':
     
    10997            break;
    11098          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')
    115                 .attr('target','_blank')
    116                 .addClass('lingotek-color dashicons dashicons-edit');
    117               $(td).append(request_link);
     99            updateWorkbenchIcon(td, data, key, locale, 'The target translation is no longer current as the source content has been updated', 'edit');
    118100            break;
    119101          case 'edited':
    120102            $(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);
     103            updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
     104            updateUploadIndicator(td, data, source_id, locale);
    132105            break;
    133106          case 'ready':
     
    140113              $(td).find('.lingotek-color').remove();
    141114              $(td).find('.pll_icon_edit').remove();
    142               updateIndicator(td, data, key, locale, 'upload', 'Upload Now', 'upload');
     115              updateUploadIndicator(td, data, key, locale);
    143116            }
    144117            else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
    145118              break;
    146119            }
    147             else if(source !== false && data[key][source]['status'] === 'current'){
     120            else if(source !== false && data[key][source]['status'] === 'current' && key == data[key]['source_id']){
    148121              $(td).find('.pll_icon_add').remove();
    149122              $(td).find('.pll_icon_edit').remove();
     
    164137    }
    165138  }
     139
     140  function updateWorkbenchIcon(td, data, key, locale, title, icon){
     141    $(td).find('.pll_icon_edit').remove();
     142    $(td).find('.lingotek-color').remove();
     143    var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
     144      .attr('title',title)
     145      .attr('target','_blank')
     146      .addClass('lingotek-color dashicons dashicons-' + icon);
     147    $(td).append(request_link);
     148  }
     149
    166150  function updateGenericBulkLink(tr, data, key, action, title, text){
    167151    var row_actions = $(tr).find('.row-actions');
     
    183167     }
    184168  }
     169
    185170  function updateUploadBulkLink(tr, data, key, action, title, text){
    186171      var row_actions = $(tr).find('.row-actions');
     
    204189     }
    205190  }
     191
     192  function updateUploadIndicator(td, data, key, locale){
     193    $(td).find('.lingotek-color').remove();
     194    var request_link = $('<a></a>').attr('href', relative_url
     195      + page_params + 'post=' + key
     196      + '&locale=' + locale
     197      + '&action=lingotek-upload'
     198      + '&noheader=1'
     199      + '&_wpnonce=' + data['upload_nonce'])
     200      .attr('title','Upload Now')
     201      .addClass('lingotek-color dashicons dashicons-upload');
     202    $(td).append(request_link);
     203  }
     204
    206205  function updateIndicator(td, data, key, locale, action, title, dashicon){
    207206    $(td).find('.lingotek-color').remove();
  • lingotek-translation/trunk/lingotek.php

    r1202665 r1203565  
    33Plugin name: Lingotek Translation
    44Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
    5 Version: 1.0.3
     5Version: 1.0.4
    66Author: Lingotek and Frédéric Demarle
    77Author uri: http://lingotek.com
     
    1616    exit();
    1717
    18 define('LINGOTEK_VERSION', '1.0.3'); // plugin version (should match above meta)
     18define('LINGOTEK_VERSION', '1.0.4'); // plugin version (should match above meta)
    1919define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
    2020define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
  • lingotek-translation/trunk/readme.txt

    r1202665 r1203565  
    55Requires at least: 3.8
    66Tested up to: 4.2
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    116116== Changelog ==
    117117
     118= 1.0.4 (2015-07-21) =
     119
     120* Plugin and PHP compatability improvements
     121
    118122= 1.0.3 (2015-07-20) =
    119123
Note: See TracChangeset for help on using the changeset viewer.