mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +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:
@@ -7212,33 +7212,41 @@ class e_admin_form_ui extends e_form
|
|||||||
|
|
||||||
private function renderLanguageTableInfo()
|
private function renderLanguageTableInfo()
|
||||||
{
|
{
|
||||||
$text = '';
|
|
||||||
|
|
||||||
if(e107::getConfig()->get('multilanguage'))
|
if(!e107::getConfig()->get('multilanguage'))
|
||||||
{
|
{
|
||||||
$curTable = $this->getController()->getTableName();
|
return null;
|
||||||
$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 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;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4065,7 +4065,7 @@ var_dump($select_options);*/
|
|||||||
return $def_options;
|
return $def_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
|
function columnSelector($columnsArray, $columnsDefault = array(), $id = 'column_options')
|
||||||
{
|
{
|
||||||
$columnsArray = array_filter($columnsArray);
|
$columnsArray = array_filter($columnsArray);
|
||||||
|
|
||||||
@@ -4083,16 +4083,16 @@ var_dump($select_options);*/
|
|||||||
|
|
||||||
foreach($columnsArray as $key => $fld)
|
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')
|
if (empty($fld['forced']) && empty($fld['nolist']) && vartrue($fld['type'])!='hidden' && vartrue($fld['type'])!='upload')
|
||||||
{
|
{
|
||||||
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
|
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
|
||||||
$ttl = isset($fld['title']) ? defset($fld['title'], $fld['title']) : $key;
|
$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 .= "
|
$text .= "
|
||||||
<li role='menuitem'><a href='#'>
|
<li role='menuitem'><a href='#'>
|
||||||
".$this->checkbox('e-columns[]', $key, $checked,'label='.$ttl)."
|
".$this->checkbox('e-columns[]', $key, $checked,'label='.$ttl)."
|
||||||
|
@@ -867,6 +867,16 @@ class e_db_mysql implements e_db
|
|||||||
return $this->mySQLrows;
|
return $this->mySQLrows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hasLanguage() alias
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
function db_IsLang($table, $multiple=false)
|
||||||
|
{
|
||||||
|
return $this->hasLanguage($table, $multiple);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* insert() alias
|
* insert() alias
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@@ -1467,7 +1477,7 @@ class e_db_mysql implements e_db
|
|||||||
* @access private
|
* @access private
|
||||||
* @return mixed the name of the language table (eg. lan_french_news) or an array of all matching language tables. (with mprefix)
|
* @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.
|
//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)
|
// WARNING!!! FALSE is critical important - if missed, expect dead loop (prefs are calling db handler as well when loading)
|
||||||
|
@@ -91,7 +91,7 @@ class plugin_blank_admin_ui extends e_admin_ui
|
|||||||
* Example: 'r.blank'
|
* Example: 'r.blank'
|
||||||
* @var string
|
* @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
|
* 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_name' => array('title'=> 'Name', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => ''),
|
||||||
'blank_version' => array('title'=> 'Version', 'type' => 'number', '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_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_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_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),
|
'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),
|
'test_list_1' => array('title'=> 'test 1', 'type' => 'boolean', 'data' => false, 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
||||||
|
Reference in New Issue
Block a user