1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Fixes #4083 Column selector displaying improperly defined field.

Admin-UI: Multi-language database language only displays when a table match is found.
This commit is contained in:
Cameron
2020-02-22 10:03:41 -08:00
parent 79c5b3e694
commit d23c65b30c
4 changed files with 52 additions and 34 deletions

View File

@@ -7212,33 +7212,41 @@ class e_admin_form_ui extends e_form
private function renderLanguageTableInfo()
{
$text = '';
if(e107::getConfig()->get('multilanguage'))
if(!e107::getConfig()->get('multilanguage'))
{
$curTable = $this->getController()->getTableName();
$sitelanguage = e107::getConfig()->get('sitelanguage');
if($curTable != e107::getDb()->db_IsLang($curTable))
{
$lang = e107::getDb()->mySQLlanguage;
}
else
{
$lang = $sitelanguage;
}
$def = deftrue('LAN_UI_USING_DATABASE_TABLE','Using [x] database table');
$diz = e107::getParser()->lanVars($def, $lang); // "Using ".$lang." database table";
$class = ($sitelanguage == $lang) ? "default" : "";
$text = "<span class='adminui-language-table-info ".$class." e-tip' title=\"".$diz."\">";
$text .= e107::getParser()->toGlyph('fa-hdd-o'); // '<i class="icon-hdd"></i> ';
$text .= e107::getLanguage()->toNative($lang)."</span>";
return $text;
return null;
}
return false;
$curTable = $this->getController()->getTableName();
$sitelanguage = e107::getConfig()->get('sitelanguage');
$val = e107::getDb()->hasLanguage($curTable, true);
if($val === false)
{
return null;
}
if($curTable != e107::getDb()->hasLanguage($curTable))
{
$lang = e107::getDb()->mySQLlanguage;
}
else
{
$lang = $sitelanguage;
}
$def = deftrue('LAN_UI_USING_DATABASE_TABLE','Using [x] database table');
$diz = e107::getParser()->lanVars($def, $lang); // "Using ".$lang." database table";
$class = ($sitelanguage == $lang) ? "default" : "";
$text = "<span class='adminui-language-table-info ".$class." e-tip' title=\"".$diz."\">";
$text .= e107::getParser()->toGlyph('fa-hdd-o'); // '<i class="icon-hdd"></i> ';
$text .= e107::getLanguage()->toNative($lang)."</span>";
return $text;
}

View File

@@ -4065,7 +4065,7 @@ var_dump($select_options);*/
return $def_options;
}
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
function columnSelector($columnsArray, $columnsDefault = array(), $id = 'column_options')
{
$columnsArray = array_filter($columnsArray);
@@ -4083,16 +4083,16 @@ var_dump($select_options);*/
foreach($columnsArray as $key => $fld)
{
if(!isset($fld['type']) || $fld['type'] === null) // Fixes #4083
{
continue;
}
if (empty($fld['forced']) && empty($fld['nolist']) && vartrue($fld['type'])!='hidden' && vartrue($fld['type'])!='upload')
{
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
$ttl = isset($fld['title']) ? defset($fld['title'], $fld['title']) : $key;
// $text .= "
// <div class='field-spacer'>
// ".$this->checkbox_label($ttl, 'e-columns[]', $key, $checked)."
// </div>
// ";
//
$text .= "
<li role='menuitem'><a href='#'>
".$this->checkbox('e-columns[]', $key, $checked,'label='.$ttl)."

View File

@@ -867,6 +867,16 @@ class e_db_mysql implements e_db
return $this->mySQLrows;
}
/**
* hasLanguage() alias
* @deprecated
*/
function db_IsLang($table, $multiple=false)
{
return $this->hasLanguage($table, $multiple);
}
/**
* insert() alias
* @deprecated
@@ -1467,7 +1477,7 @@ class e_db_mysql implements e_db
* @access private
* @return mixed the name of the language table (eg. lan_french_news) or an array of all matching language tables. (with mprefix)
*/
function db_IsLang($table, $multiple=false)
function hasLanguage($table, $multiple=false)
{
//When running a multi-language site with english included. English must be the main site language.
// WARNING!!! FALSE is critical important - if missed, expect dead loop (prefs are calling db handler as well when loading)

View File

@@ -91,7 +91,7 @@ class plugin_blank_admin_ui extends e_admin_ui
* Example: 'r.blank'
* @var string
*/
protected $table = "blank";
protected $table = "blank"; // must match _blank_sql.php
/**
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
@@ -252,10 +252,10 @@ class plugin_blank_admin_ui extends e_admin_ui
'blank_name' => array('title'=> 'Name', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
'blank_version' => array('title'=> 'Version', 'type' => 'number', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
'blank_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
'blank_authorURL' => array('title'=> "Url", 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
'blank_authorURL' => array('title'=> LAN_URL, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
'blank_date' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => array('type' => 'datetime')),
'blank_compatibility' => array('title'=> 'Compatible', 'type' => 'text', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
'blank_url' => array('title'=> LAN_URL, 'type' => 'file', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'readParms' => array('truncate' => 30), 'validate' => false, 'help' => 'Enter blank URL here', 'error' => 'please, enter valid URL'),
'blank_url' => array('title'=> LAN_FILE, 'type' => 'file', 'data' => 'str', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'readParms' => array('truncate' => 30), 'validate' => false, 'help' => 'Enter blank URL here', 'error' => 'please, enter valid URL'),
'blank_media' => array('title'=> "Media", 'type' => 'media', 'data' => 'json', 'width' => '20%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'readParms' => array('truncate' => 30), 'writeParms'=>array(/*'w'=>200, 'h'=>150,*/ 'image'=>1, 'video'=>1, 'youtube'=>1, 'audio'=>1, 'glyph'=>1), 'validate' => false),
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => false, 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),