diff --git a/e107_admin/links.php b/e107_admin/links.php
index c5ed8da94..629f0004d 100644
--- a/e107_admin/links.php
+++ b/e107_admin/links.php
@@ -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 = '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
";
//$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 .= "
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.
+
+
+ ".$ui->admin_button('generate_lanlinks', 'no-value', 'delete', "Generate LANs")."
+
";
+
+ $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);
diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php
index 87efe33be..0095d230d 100644
--- a/e107_handlers/admin_ui.php
+++ b/e107_handlers/admin_ui.php
@@ -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 .= "";
- $text .= e107::getParser()->toGlyph('fa-hdd-o'); // ' ';
- $text .= e107::getLanguage()->toNative($lang)."";
-
- }
+ $text .= $this->renderLanguageTableInfo();
$text .= "
@@ -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 = "";
+ $text .= e107::getParser()->toGlyph('fa-hdd-o'); // ' ';
+ $text .= e107::getLanguage()->toNative($lang)."";
+
+ }
+
+ 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)
{
diff --git a/e107_plugins/tinymce4/wysiwyg.php b/e107_plugins/tinymce4/wysiwyg.php
index e3c031bde..7d8c19eb3 100644
--- a/e107_plugins/tinymce4/wysiwyg.php
+++ b/e107_plugins/tinymce4/wysiwyg.php
@@ -183,7 +183,7 @@ class wysiwyg
function tinymce_lang()
{
- $lang = e_LANGUAGE;
+ $lang = 'English'; //Quick Fix e_LANGUAGE
$tinylang = array(
"Arabic" => "ar",
"Bulgarian" => "bg",