mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Multilanguage fixes and sitelink tools update.
This commit is contained in:
@@ -48,7 +48,7 @@ class links_admin extends e_admin_dispatcher
|
||||
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'I'),
|
||||
'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'I'),
|
||||
'main/prefs' => array('caption'=> LAN_OPTIONS, 'perm' => 'I'),
|
||||
'main/sublinks' => array('caption'=> LINKLAN_4, 'perm' => 'I')
|
||||
'main/tools' => array('caption'=> ADLAN_CL_6, 'perm' => 'I')
|
||||
);
|
||||
|
||||
protected $adminMenuAliases = array(
|
||||
@@ -144,9 +144,71 @@ class links_admin_ui extends e_admin_ui
|
||||
4 => LCLAN_24, // 4 = miniwindow 600x400
|
||||
5 => LINKLAN_1 // 5 = miniwindow 800x600
|
||||
);
|
||||
|
||||
|
||||
|
||||
if(!empty($_POST['generate_lanlinks']))
|
||||
{
|
||||
$this->generateLanLinks();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function generateLanLinks()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$frm = e107::getForm();
|
||||
$rows = $sql->retrieve('links','*','',true);
|
||||
$text = '<?php';
|
||||
|
||||
$text .= "\n// e107 Custom Language File \n\n";
|
||||
$update = array();
|
||||
|
||||
foreach($rows as $row)
|
||||
{
|
||||
if(empty($row['link_name']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = str_replace('-','_',$frm->name2id($row['link_name']));
|
||||
$key = "CUSTLAN_".strtoupper($name);
|
||||
$text .= 'define("'.$key.'", "'.$row['link_name'].'");';
|
||||
$text .= "\n";
|
||||
$id = $row['link_id'];
|
||||
$update[$id] = $key;
|
||||
|
||||
// $sql->update('links', 'link_name= "'.$key.'" WHERE link_id = '.$row['link_id'].' LIMIT 1');
|
||||
}
|
||||
|
||||
if(!is_dir(e_SYSTEM."lans"))
|
||||
{
|
||||
mkdir(e_SYSTEM.'lans',0755);
|
||||
}
|
||||
|
||||
if(file_put_contents(e_SYSTEM."lans/English_custom.php",$text))
|
||||
{
|
||||
foreach($update as $id=>$val)
|
||||
{
|
||||
$sql->update('links', 'link_name= "'.$val.'" WHERE link_id = '.$id.' LIMIT 1'); //TODO add a checkbox preference for this.
|
||||
}
|
||||
|
||||
e107::getMessage()->addSuccess(LAN_CREATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
e107::getMessage()->addError(LAN_CREATED);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function handleListLinkParentBatch($selected, $value)
|
||||
{
|
||||
$field = 'link_parent';
|
||||
@@ -212,7 +274,7 @@ class links_admin_ui extends e_admin_ui
|
||||
/**
|
||||
* Sublinks generator
|
||||
*/
|
||||
public function sublinksPage()
|
||||
public function toolsPage()
|
||||
{
|
||||
$sublinks = $this->sublink_data();
|
||||
$ui = $this->getUI();
|
||||
@@ -264,10 +326,43 @@ class links_admin_ui extends e_admin_ui
|
||||
</form>
|
||||
";
|
||||
//$e107->ns->tablerender(LINKLAN_4, $emessage->render().$text);
|
||||
$this->addTitle(LINKLAN_4);
|
||||
return $text;
|
||||
// $this->addTitle(LINKLAN_4);
|
||||
|
||||
// ------------- Multilanguage Links --------------------
|
||||
$frm = e107::getForm();
|
||||
|
||||
$text2 = $frm->open('multilan-links');
|
||||
$text2 .= "<div class='alert alert-info'>This will generate LAN definitions for all your sitelinks and store them in a custom language file within your system folder and then update all your link names to use them.</div>
|
||||
|
||||
<div class='buttons-bar center'>
|
||||
".$ui->admin_button('generate_lanlinks', 'no-value', 'delete', "Generate LANs")."
|
||||
</div>";
|
||||
|
||||
$text2 .= $frm->close();
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
$tabs = array(
|
||||
0 => array('caption'=>LINKLAN_4, 'text'=>$text),
|
||||
1 => array('caption'=>"Generate LANs", 'text'=>$text2)
|
||||
);
|
||||
|
||||
return e107::getForm()->tabs($tabs); // $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sublink_data($name = "")
|
||||
{
|
||||
if(null !== $this->sublink_data) return ($name ? $this->sublink_data[$name] : $this->sublink_data);
|
||||
|
@@ -5750,26 +5750,7 @@ class e_admin_form_ui extends e_form
|
||||
|
||||
|
||||
// Let Admin know which language table is being saved to. (avoid default table overwrites)
|
||||
if(e107::getConfig()->get('multilanguage'))
|
||||
{
|
||||
$curTable = $controller->getTableName();
|
||||
|
||||
if($curTable != e107::getDb()->db_IsLang($curTable))
|
||||
{
|
||||
$lang = e107::getDb()->mySQLlanguage;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = e107::getConfig()->get('sitelanguage');
|
||||
}
|
||||
|
||||
$def = deftrue('LAN_UI_USING_DATABASE_TABLE','Using [x] database table');
|
||||
$diz = e107::getParser()->lanVars($def, $lang); // "Using ".$lang." database table";
|
||||
$text .= "<span class='e-tip' title=\"".$diz."\">";
|
||||
$text .= e107::getParser()->toGlyph('fa-hdd-o'); // '<i class="icon-hdd"></i> ';
|
||||
$text .= e107::getLanguage()->toNative($lang)."</span>";
|
||||
|
||||
}
|
||||
$text .= $this->renderLanguageTableInfo();
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
@@ -5887,6 +5868,37 @@ class e_admin_form_ui extends e_form
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
private function renderLanguageTableInfo()
|
||||
{
|
||||
$text = '';
|
||||
|
||||
if(e107::getConfig()->get('multilanguage'))
|
||||
{
|
||||
$curTable = $this->getController()->getTableName();
|
||||
|
||||
if($curTable != e107::getDb()->db_IsLang($curTable))
|
||||
{
|
||||
$lang = e107::getDb()->mySQLlanguage;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = e107::getConfig()->get('sitelanguage');
|
||||
}
|
||||
|
||||
$def = deftrue('LAN_UI_USING_DATABASE_TABLE','Using [x] database table');
|
||||
$diz = e107::getParser()->lanVars($def, $lang); // "Using ".$lang." database table";
|
||||
$text = "<span 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FIXME - use e_form::batchoptions(), nice way of buildig batch dropdown - news administration show_batch_options()
|
||||
function renderBatch($allow_delete = false,$allow_copy= false, $allow_url=false, $allow_featurebox=false)
|
||||
{
|
||||
|
@@ -183,7 +183,7 @@ class wysiwyg
|
||||
|
||||
function tinymce_lang()
|
||||
{
|
||||
$lang = e_LANGUAGE;
|
||||
$lang = 'English'; //Quick Fix e_LANGUAGE
|
||||
$tinylang = array(
|
||||
"Arabic" => "ar",
|
||||
"Bulgarian" => "bg",
|
||||
|
Reference in New Issue
Block a user