Fix #5856 - language translations of countries and languages etc.
authorAlan Knowles <alan@roojs.com>
Mon, 15 Apr 2019 06:47:12 +0000 (14:47 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 15 Apr 2019 06:47:12 +0000 (14:47 +0800)
DataObjects/I18n.php
I18n.php
Pman.I18n.js

index 3f52fb5..c85a036 100644 (file)
@@ -127,9 +127,23 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
             $this->buildDB(); // ensure we have the full database...
             
             $this->selectAdd("
+                id as id,
                 i18n_translate(ltype, lkey, 'en') as lval_en
             ");
         }
+        
+        if (!empty($q['_as_code_and_title'])) {
+            $tn = $this->tableName();
+            
+            $this->selectAdd();
+            $this->selectAdd("
+                    {$tn}.lval as title,
+                    {$tn}.lkey as code
+            ");
+            if (!empty($q['_title'])) {
+                $this->whereAdd("{$tn}.lval like '{$this->escape($_REQUEST['_title'])}%'");
+            }
+        }
          
         if (!empty($q['!code'])) {
             $this->whereAddIn('!lkey', explode(',', $q['!code']), 'string'); 
@@ -140,6 +154,10 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject
             $this->whereAdd("upper(lval) LIKE '%{$v}%'");
         }
         
+         if (!empty($q['query']['name_starts'])) {
+            $this->whereAdd("lval LIKE '". $this->escape($q['query']['name_starts']). "%'");
+        }
+        
         if (!empty($q['_filtered']) && !empty($this->ltype)) {
             $cfg = $this->cfg();
             $filter = $cfg[$this->ltype];
index 15f1198..8367964 100644 (file)
--- a/I18n.php
+++ b/I18n.php
@@ -120,7 +120,7 @@ class Pman_Core_I18n extends Pman
         
         
         $i = DB_DataObject::Factory('I18n');
-        
+        $i->is_active = 1;
         switch($s) {
             case 'Lang':
                  
index eefef4d..d59683b 100644 (file)
@@ -212,7 +212,8 @@ Pman.I18n = {
         reader: Pman.I18n.reader,
         listeners : {
              
-            loadexception : Pman.loadException
+            loadexception : Pman.loadException,
+           
     
         },
         remoteSort: false,