fixed and close #22

This commit is contained in:
o.pinke 2021-06-08 13:02:52 +02:00
parent dbaaa6ffa5
commit 8278e52a89
2 changed files with 72 additions and 73 deletions

View File

@ -59,15 +59,15 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
if ($action == "lang_deletelanguage") {
// finally delete from dropdown in header
$newOption = '<script>
var langList = top.header.document.getElementById("cLanguageSelect");
var thepos="";
for(var i=0;i<langList.length;i++) {
if(langList.options[i].value == ' . $idlang . ') {
thepos = langList.options[i].index;
}
}
langList.remove(thepos);
</script>';
var langList = top.header.document.getElementById("cLanguageSelect");
var thepos="";
for(var i=0;i<langList.length;i++) {
if(langList.options[i].value == ' . $idlang . ') {
thepos = langList.options[i].index;
}
}
langList.remove(thepos);
</script>';
}
if ($action == "lang_newlanguage") {
@ -79,10 +79,10 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
}
$newOption = '<script language="javascript">
var newLang = new Option("' . i18n("New language") . ' (' . $new_idlang . ')", "' . $new_idlang . '", false, false);
var langList = top.header.document.getElementById("cLanguageSelect");
langList.options[langList.options.length] = newLang;
</script>';
var newLang = new Option("' . i18n("New language") . ' (' . $new_idlang . ')", "' . $new_idlang . '", false, false);
var langList = top.header.document.getElementById("cLanguageSelect");
langList.options[langList.options.length] = newLang;
</script>';
$idlang = $new_idlang;
}
@ -106,16 +106,16 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
// update dropdown in header
$newOption = '<script language="javascript">
var langList = top.header.document.getElementById("cLanguageSelect");
var thepos="";
for(var i=0;i<langList.length;i++)
{
if(langList.options[i].value == ' . $idlang . ')
{
langList.options[i].innerHTML = \'' . $langname . ' (' . $idlang . ')\';
}
}
</script>';
var langList = top.header.document.getElementById("cLanguageSelect");
var thepos="";
for(var i=0;i<langList.length;i++)
{
if(langList.options[i].value == ' . $idlang . ')
{
langList.options[i].innerHTML = \'' . $langname . ' (' . $idlang . ')\';
}
}
</script>';
}
if (!$perm->have_perm_area_action($area, $action)) {
@ -135,14 +135,14 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
$tpl->reset();
$sql = "SELECT
A.idlang AS idlang, A.name AS name, A.active as active, A.encoding as encoding, A.direction as direction,
B.idclient AS idclient
FROM
" . $cfg["tab"]["lang"] . " AS A,
" . $cfg["tab"]["clients_lang"] . " AS B
WHERE
A.idlang = '" . Contenido_Security::toInteger($idlang) . "' AND
B.idlang = '" . Contenido_Security::toInteger($idlang) . "'";
A.idlang AS idlang, A.name AS name, A.active as active, A.encoding as encoding, A.direction as direction,
B.idclient AS idclient
FROM
" . $cfg["tab"]["lang"] . " AS A,
" . $cfg["tab"]["clients_lang"] . " AS B
WHERE
A.idlang = '" . Contenido_Security::toInteger($idlang) . "' AND
B.idlang = '" . Contenido_Security::toInteger($idlang) . "'";
$db->query($sql);
$db->next_record();
@ -201,7 +201,11 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
$eselect = new cHTMLSelectElement("sencoding");
$eselect->setStyle('width:255px');
$eselect->autoFill($charsets);
$eselect->setDefault($db->f("encoding"));
if($db->f("encoding")) {
$eselect->setDefault($db->f("encoding"));
} else {
$eselect->setDefault('utf-8');
}
$languagecode = new cHTMLSelectElement("languagecode");
$languagecode->setStyle('width:255px');
@ -256,9 +260,7 @@ if ($action == "lang_newlanguage" || $action == "lang_deletelanguage") {
if ($_REQUEST['action'] != '') {
$page->addScript('reload', $sReload);
}
$page->render();
}
}
}
?>
}

View File

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,18 +28,17 @@
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$area="lang";
$area = "lang";
if (!isset($action)) $action = "";
if (!isset($action))
$action = "";
if (!is_numeric($targetclient))
{
$targetclient = $client;
if (!is_numeric($targetclient)) {
$targetclient = $client;
}
$iGetIdlang = $idlang;
@ -46,85 +46,82 @@ $iGetIdlang = $idlang;
$sql = "SELECT
*
FROM
".$cfg["tab"]["lang"]." AS A,
".$cfg["tab"]["clients_lang"]." AS B
" . $cfg["tab"]["lang"] . " AS A,
" . $cfg["tab"]["clients_lang"] . " AS B
WHERE
A.idlang=B.idlang AND
B.idclient='".Contenido_Security::toInteger($targetclient)."'
B.idclient='" . Contenido_Security::toInteger($targetclient) . "'
ORDER BY A.idlang";
$db->query($sql);
$tpl->set('s','TARGETCLIENT',$targetclient);
$tpl->set('s', 'TARGETCLIENT', $targetclient);
$iLangCount = 0;
while ($db->next_record()) {
$iLangCount++;
$idlang = $db->f("idlang");
if ($db->f("active") == 0) {
//activate
//activate
$message = i18n("Activate language");
$active = "<a title=\"$message\" href=\"".$sess->url("main.php?area=$area&action=lang_activatelanguage&frame=$frame&targetclient=$targetclient&idlang=".$db->f("idlang"))."#clickedhere\"><img src=\"".$cfg["path"]["images"]."offline.gif"."\" border=\"0\" title=\"$message\" alt=\"$message\"></a>";
$active = "<a title=\"$message\" href=\"" . $sess->url("main.php?area=$area&action=lang_activatelanguage&frame=$frame&targetclient=$targetclient&idlang=" . $db->f("idlang")) . "#clickedhere\"><img src=\"" . $cfg["path"]["images"] . "offline.gif" . "\" border=\"0\" title=\"$message\" alt=\"$message\"></a>";
} else {
//deactivate
$message = i18n("Deactivate language");
$active = "<a title=\"$message\" class=action href=\"".$sess->url("main.php?area=$area&action=lang_deactivatelanguage&frame=$frame&targetclient=$targetclient&idlang=".$db->f("idlang"))."#clickedhere\"><img src=\"".$cfg["path"]["images"]."online.gif"."\" border=\"0\" title=\"$message\" alt=\"$message\"></a>";
$message = i18n("Deactivate language");
$active = "<a title=\"$message\" class=action href=\"" . $sess->url("main.php?area=$area&action=lang_deactivatelanguage&frame=$frame&targetclient=$targetclient&idlang=" . $db->f("idlang")) . "#clickedhere\"><img src=\"" . $cfg["path"]["images"] . "online.gif" . "\" border=\"0\" title=\"$message\" alt=\"$message\"></a>";
}
// Delete Button
$deleteMsg = sprintf(i18n("Do you really want to delete the language %s?"),clHtmlSpecialChars($db->f("name")));
$deleteMsg = sprintf(i18n("Do you really want to delete the language %s?"), clHtmlSpecialChars($db->f("name")));
$deleteAct = i18n("Delete language");
$deletebutton = '<a title="'.$deleteAct.'" href="javascript://" onclick="box.confirm(\''.$deleteAct.'\', \''.$deleteMsg.'\', \'deleteLang('.$db->f("idlang").')\')"><img src="'.$cfg['path']['images'].'delete.gif" border="0" title="'.$deleteAct.'" alt="'.$deleteAct.'"></a>';
$deletebutton = '<a title="' . $deleteAct . '" href="javascript://" onclick="box.confirm(\'' . $deleteAct . '\', \'' . $deleteMsg . '\', \'deleteLang(' . $db->f("idlang") . ')\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $deleteAct . '" alt="' . $deleteAct . '"></a>';
$bgcolor = ( is_int($tpl->dyn_cnt / 2) ) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'LANGUAGE', '<a target="right_bottom" href="'.$sess->url("main.php?area=lang_edit&idlang=$idlang&frame=4").'">'.$db->f("name").'</a>&nbsp;<span style="font-size:10px">('.$idlang.')</span>');
$tpl->set('d', 'ACTIVATEBUTTON', $active);
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'LANGUAGE', '<a target="right_bottom" href="' . $sess->url("main.php?area=lang_edit&idlang=$idlang&frame=4") . '">' . $db->f("name") . '</a>&nbsp;<span style="font-size:10px">(' . $idlang . ')</span>');
$tpl->set('d', 'ACTIVATEBUTTON', $active);
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
//$tpl->set('d', 'ICON', '<a target="right_bottom" href="'.$sess->url("main.php?area=lang_edit&idlang=$idlang&frame=4").'"><img src="images/language.gif" border="0"></a>');
$tpl->set('d', 'ICON', '');
if ($iGetIdlang == $idlang) {
$tpl->set('d', 'MARKED', ' id="marked" ');
} else {
$tpl->set('d', 'MARKED', '');
}
$tpl->next();
}
$newlanguageform = '<form name=newlanguage method="post" action="'.$sess->url("main.php?area=$area&frame=$frame").'">
'.$sess->hidden_session(true).'
$newlanguageform = '<form name=newlanguage method="post" action="' . $sess->url("main.php?area=$area&frame=$frame") . '">
' . $sess->hidden_session(true) . '
<input type="hidden" name="action" value="lang_newlanguage">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td class="text_medium">'.i18n("New language").':
<tr><td class="text_medium">' . i18n("New language") . ':
<INPUT type="text" name="name">&nbsp;&nbsp;&nbsp;
<INPUT type="image" src="'.$cfg['path']['images'].'but_ok.gif" border="0">
<INPUT type="image" src="' . $cfg['path']['images'] . 'but_ok.gif" border="0">
</td></tr></table></from>';
$tpl->set('s', 'NEWLANGUAGEFORM', $newlanguageform);
$tpl->set('s', 'SID', $sess->id);
if ( $tmp_notification ) {
if ($tmp_notification) {
$noti_html = '<tr><td colspan="3">'.$tmp_notification.'</td></tr>';
$noti_html = '<tr><td colspan="3">' . $tmp_notification . '</td></tr>';
$tpl->set('s', 'NOTIFICATION', $noti_html);
} else {
$tmp_notification = $notification->returnNotification("info", i18n("Language deleted"));
$noti_html = '<tr><td colspan="3">'.$tmp_notification.'</td></tr>';
$noti_html = '<tr><td colspan="3">' . $tmp_notification . '</td></tr>';
$tpl->set('s', 'NOTIFICATION', '');
}
$tpl->set('s', 'LANG_COUNT', $iLangCount);
# Generate template
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['lang_overview']);
?>