Skip to content
Permalink
Browse files

Version 3.2110

fix bug define language
  • Loading branch information
ClicShopping ClicShopping
ClicShopping authored and ClicShopping committed Oct 8, 2019
1 parent 4ca256f commit 8d21913e9fb17242b57fe202a2a94c62e10d89f4
@@ -12,6 +12,7 @@
use ClicShopping\OM\HTML;
use ClicShopping\OM\Registry;
use ClicShopping\OM\CLICSHOPPING;
use ClicShopping\OM\FileSystem;
$CLICSHOPPING_Langues = Registry::get('Langues');
@@ -71,6 +72,14 @@ class="col-md-4 pageHeading"><?php echo '&nbsp;' . $CLICSHOPPING_Langues->getDef
</div>
</div>
<div class="separator"></div>
<?php
if (FileSystem::isWritable($CLICSHOPPING_Template->getDirectoryPathLanguage())) {
?>
<div class="alert alert-warning"
role="alert"><?php echo $CLICSHOPPING_Langues->getDef('error_language_directory_not_writeable'); ?></div>
<?php
}
?>
<div class="col-md-12 mainTitle">
<strong><?php echo $CLICSHOPPING_Langues->getDef('text_info_heading_new_language'); ?></strong></div>
<?php echo HTML::form('languages', $CLICSHOPPING_Langues->link('Langues&Insert')); ?>
@@ -63,12 +63,10 @@ text_set_default = Default

text_info_create_language = Do you wat create the directory ?



title_help = Help

text_note_create_language = <br /><strong>Notes :</strong><br /> The directories creation will be the default language directory. <br /><strong>Depends of the servers caracteristics, this operation can not work fine.</strong> Please, realise this operation manually.<br /><br />The creation directories and files are : <br />- In administration<br />- In catalog languages default directory<br /><br />- In catalog template default directory.<br />- In graphism template default directory.<br /><br />Please connect you on the market place to upload your new language and to install il with the module installaton.

text_info_delete_info = Delete Language
error_remove_default_language = Error: The default language can not be removed. Please set another language as default, and try again.

error_language_directory_not_writeable = Warning: The directory languages is not writeable. Please creae a new directory or make in 777 the languages directory and these sub-directories
@@ -68,3 +68,4 @@ text_note_create_language = <br /><strong>Notes :</strong><br /> La création de

text_info_delete_info = Supprimer cette langue
error_remove_default_language = Erreur : La langue par défaut ne peut être supprimée. Merci de choisir une nouvelle langue par défaut et réessayer.
error_language_directory_not_writeable = Attention : le répertoire Languages n'est pas en mode écriture. Veuillez soit créer un nouveau répertoire dans langage ou mettre le répertoires langages en mode écriture
@@ -29,7 +29,6 @@ public function execute()
{
$CLICSHOPPING_Language = Registry::get('Language');
$CLICSHOPPING_MessageStack = Registry::get('MessageStack');
$CLICSHOPPING_Language = Registry::get('Language');
if (isset($_GET['search']) && !empty($_GET['search'])) {
$search = HTML::sanitize($_GET['search']);
@@ -79,7 +78,7 @@ public function execute()
}
}
// add new_definition_key
// add new_definition_key
if (isset($new_definition_key)) {
foreach ($_POST['new_definition_value'] as $key => $value) {
$sql_data_array = ['content_group' => $content_group,
@@ -111,7 +110,7 @@ public function execute()
if (!isset($definition_values[$new_definition_key][$key])) {
$new_definition_values[$new_definition_key][$key] = $value;
} else {
$CLICSHOPPING_MessageStack->add($this->app > getDef('ms_error_db_save', ['definition_key' => $new_definition_key]), 'error');
$CLICSHOPPING_MessageStack->add($this->app->getDef('ms_error_db_save', ['definition_key' => $new_definition_key]), 'error');
$new_definition_key_error = true;
}
}
@@ -126,7 +125,6 @@ public function execute()
$this->app->db->delete(':table_languages_definitions', $where_array);
foreach ($definition_values as $definition_key => $language_definition) {
foreach ($language_definition as $language_id => $definition_value) {
$sql_data_array = ['content_group' => $content_group,
@@ -136,7 +134,6 @@ public function execute()
];
$this->app->db->save(':table_languages_definitions', $sql_data_array);
}
}
}
@@ -154,12 +151,11 @@ public function execute()
$path_name = str_replace("-", "/", substr($content_group, ($groups[0] != 'Apps' ? strlen($groups[0]) : strlen($groups[0] . '-' . $groups[1] . '-' . $groups[2])))) . ".txt";
for ($i = 0, $n = count($languages); $i < $n; $i++) {
$language_dir = CLICSHOPPING::getConfig('dir_root', ($groups[0] == 'Apps' ? 'Shop' : $groups[0])) . ($groups[0] == 'Apps' ? 'includes/OSC/Apps/' . $groups[1] . '/' . $groups[2] . '/' : 'includes/') . 'languages/' . $languages[$i]['directory'];
$language_dir = CLICSHOPPING::getConfig('dir_root', ($groups[0] == 'Apps' ? 'Shop' : $groups[0])) . ($groups[0] == 'Apps' ? 'includes/ClicShopping/Apps/' . $groups[1] . '/' . $groups[2] . '/' : 'includes/') . 'languages/' . $languages[$i]['directory'];
if (!is_file($language_dir . $path_name)) {
if (!is_dir($language_dir . $path_to_file)) {
if (!mkdir($concurrentDirectory = $language_dir . $path_to_file, 0777, true) && !is_dir($concurrentDirectory)) {
if (@!mkdir($concurrentDirectory = $language_dir . $path_to_file, 0777, true) && !is_dir($concurrentDirectory)) {
$CLICSHOPPING_MessageStack->add($this->app->getDef('ms_error_create', ['pathname' => $language_dir . $path_to_file]), 'error');
}
}
@@ -182,10 +178,11 @@ public function execute()
if ($Qdefinitions->fetch() !== false) {
do {
$data = $Qdefinitions->value('definition_key') . ' = ' . $Qdefinitions->value('definition_value');
file_put_contents($language_dir . $path_name, $data . PHP_EOL, FILE_APPEND | LOCK_EX);
if (is_file($language_dir . $path_name)) {
@file_put_contents($language_dir . $path_name, $data . PHP_EOL, FILE_APPEND | LOCK_EX);
}
} while ($Qdefinitions->fetch());
}
}
@@ -28,6 +28,8 @@
if ($CLICSHOPPING_MessageStack->exists('content_group')) {
echo $CLICSHOPPING_MessageStack->get('content_group');
}
echo HTML::form('define_language', $CLICSHOPPING_DefineLanguage->link('DefineLanguage&Save&ContentGroup=' . $_GET['ContentGroup'], 'post', 'enctype="multipart/form-data"'));
?>
<div class="contentBody">
<div class="row">
@@ -40,7 +42,6 @@ class="col-md-1 logoHeading"><?php echo HTML::image($CLICSHOPPING_Template->getI
class="col-md-6 pageHeading"><?php echo '&nbsp;' . $CLICSHOPPING_DefineLanguage->getDef('heading_title'); ?></span>
<span class="col-md-5 text-md-right">
<?php
echo HTML::form('define_language', $CLICSHOPPING_DefineLanguage->link('DefineLanguage&Save&ContentGroup=' . $_GET['ContentGroup'], 'post', 'enctype="multipart/form-data"'));
echo '&nbsp;';
echo HTML::button($CLICSHOPPING_DefineLanguage->getDef('button_back'), null, $CLICSHOPPING_DefineLanguage->link('DefineLanguage'), 'primary') . ' ' . HTML::button($CLICSHOPPING_DefineLanguage->getDef('button_save'), null, null, 'success') . ' ';
?>
@@ -50,23 +51,25 @@ class="col-md-6 pageHeading"><?php echo '&nbsp;' . $CLICSHOPPING_DefineLanguage-
</div>
</div>
<div class="separator"></div>
<ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="myTab">
<div class="alert alert-info" role="alert" id="alert">
<?php echo $CLICSHOPPING_DefineLanguage->getDef('alert_info_language'); ?>
</div>
<ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="myTab">
<?php
for ($i = 0, $n = count($languages); $i < $n; $i++) {
echo '<li class="nav-item " ' . ($i === 0 ? 'active"' : '') . '><a href="#tab' . $i . '" data-target="#section_general_content_' . $languages[$i]['directory'] . '" role="tab" data-toggle="tab" class="nav-link">' . $CLICSHOPPING_Language->getImage($languages[$i]['code']) . '&nbsp;' . $languages[$i]['name'] . '</a></li>';
}
echo '<li class="nav-item"><a data-target="#section_general_content_translation_tab" role="tab" data-toggle="tab" class="nav-link">' . HTML::button($CLICSHOPPING_DefineLanguage->getDef('section_heading_translations'), null, null, 'primary', null, 'sm') . '</a></li>';
echo '<li class="nav-item"><a data-target="#section_general_content_translation_tab" role="tab" data-toggle="tab" class="nav-link">' . HTML::button($CLICSHOPPING_DefineLanguage->getDef('section_heading_translations'), null, null, 'primary', null, 'sm') . '</a></li>';
?>
</ul>
</ul>

<div class="tabsClicShopping">
<div class="tab-content">
<?php
for ($i = 0, $n = count($languages); $i < $n; $i++) {
?>
<div class="row adminformTitle" id="section_general_content_<?php echo $languages[$i]['directory']; ?>"
class="tab-pane <?php echo($i === 0 ? 'active' : ''); ?>">
<div class="adminformTitle tab-pane <?php echo($i === 0 ? 'active' : ''); ?>" id="section_general_content_<?php echo $languages[$i]['directory']; ?>">
<table class="table table-hover">
<thead>
<tr class="dataTableHeadingRow">
@@ -81,10 +84,11 @@ class="tab-pane <?php echo($i === 0 ? 'active' : ''); ?>">
definition_value
from :table_languages_definitions
where content_group = :content_group
and (definition_key like " . "'%" . $search . "%'" . " or definition_value like " . "'%" . $search . "%'" . ")
and (definition_key like ' . $search . ' or definition_value like ' . $search . ')
and languages_id = :languages_id
order by definition_key
');
$Qdefinitions->bindValue(':search', '%"' . $search . '"%');
} else {
$Qdefinitions = $CLICSHOPPING_DefineLanguage->db->prepare('select id,
definition_key,
@@ -115,30 +119,6 @@ class="tab-pane <?php echo($i === 0 ? 'active' : ''); ?>">
<?php
}
?>
<script>
var definition_key = '';
$('#rowDelConfirm').on('hidden.bs.modal', function (e) {
});
function NewDef(defVar, place) {
$(place).replaceWith('<textarea class="form-control" name="' + defVar + '"></textarea>');
}
function DeleteDef(defVar) {
definition_key = defVar;
$('#modalDefinitionKey').html(definition_key);
$('#rowDelConfirm').modal('show');
}
$(function () {
$('#rowDelConfirmButtonDelete').on('click', function () {
$('#rowDelConfirm').modal('hide');
$("." + definition_key).remove();
$('form[name="define_language"]').append('<input type="hidden" name="delete[' + definition_key + ']" value="">');
});
});
</script>
<style>
.table-hover > tbody > tr.new_definition_row:hover > td,
.new_definition_row > td {
@@ -160,15 +140,16 @@ function DeleteDef(defVar) {
$Qdefinitions = $CLICSHOPPING_DefineLanguage->db->prepare('select distinct definition_key
from :table_languages_definitions
where content_group = :content_group
and (definition_key like " . "'%" . $search . "%'" . " or definition_value like " . "'%" . $search . "%'" . ")
and (definition_key like :search or definition_value like :search)
order by definition_key
');
$Qdefinitions->bindValue(':search', '%"' . $search . '"%');
} else {
$Qdefinitions = $CLICSHOPPING_DefineLanguage->db->prepare('select distinct definition_key
from :table_languages_definitions
where content_group = :content_group
order by definition_key
');
from :table_languages_definitions
where content_group = :content_group
order by definition_key
');
}
$Qdefinitions->bindValue(':content_group', $_GET['ContentGroup']);
@@ -185,13 +166,13 @@ function DeleteDef(defVar) {
<?php
for ($i = 0, $n = count($languages); $i < $n; $i++) {
$Tdefinitions = $CLICSHOPPING_DefineLanguage->db->prepare('select definition_key,
definition_value
from :table_languages_definitions
where content_group = :content_group
and languages_id = :languages_id
and definition_key = :definition_key
order by languages_id
');
definition_value
from :table_languages_definitions
where content_group = :content_group
and languages_id = :languages_id
and definition_key = :definition_key
order by languages_id
');
$Tdefinitions->bindValue(':content_group', $_GET['ContentGroup']);
$Tdefinitions->bindValue(':definition_key', $Qdefinitions->value('definition_key'));
$Tdefinitions->bindInt(':languages_id', $languages[$i]['id']);
@@ -248,7 +229,6 @@ class="fas fa-plus"
</tbody>
</table>
</div>
</form>

<div class="modal fade" id="rowDelConfirm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
@@ -279,4 +259,29 @@ class="modal-title"><?php echo $CLICSHOPPING_DefineLanguage->getDef('text_langua
</div><!-- /.modal -->
</div>
</div>
</div>
<script>
var definition_key = '';
$('#rowDelConfirm').on('hidden.bs.modal', function (e) {
});
function NewDef(defVar, place) {
$(place).replaceWith('<textarea class="form-control" name="' + defVar + '"></textarea>');
}
function DeleteDef(defVar) {
definition_key = defVar;
$('#modalDefinitionKey').html(definition_key);
$('#rowDelConfirm').modal('show');
}
$(function () {
$('#rowDelConfirmButtonDelete').on('click', function () {
$('#rowDelConfirm').modal('hide');
$("." + definition_key).remove();
$('form[name="define_language"]').append('<input type="hidden" name="delete[' + definition_key + ']" value="">');
});
});
</script>
</div>
</form>
@@ -72,3 +72,4 @@ image_filter = Filter

error_language_directory_not_writeable = The language directory is not writeable

alert_info_language = if you do not see all language, please click on the different language on the catalog to activate the cache
@@ -70,3 +70,5 @@ image_edit = Editer
image_filter = Filtrer

error_language_directory_not_writeable = Le répertoire de langue n'est pas en mode écriture

alert_info_language = Si vous ne voyez pas tous les langages, veuillez cliquez sur les differents langages dans le catalogue afin de créer le cache
@@ -1,5 +1,6 @@
Update from 3.2110

Inscrease theme system flexibility
refactoring image
new ckeditor
Add hooks for header and Footer
Add hooks for header and Footer
fix bug define languages

0 comments on commit 8d21913

Please sign in to comment.
You can’t perform that action at this time.