Javascript updates, bug fix in Form class

- Update JS files and remove some not needed code
- Bug fix in Form where the sub element list was not correctly processed
because the DB insert vars got reset on each loop run
- Add return success/failure variable to the ln10 reload
This commit is contained in:
Clemens Schwaighofer
2019-05-17 15:31:59 +09:00
parent b5290971c1
commit d47f525480
6 changed files with 21 additions and 31 deletions

View File

@@ -63,6 +63,7 @@ class L10n extends \CoreLibs\Basic
// reloads the mofile, if the location of the lang file changes
public function l10nReloadMOfile($lang, $path = DEFAULT_TEMPLATE)
{
$success = false;
$old_mofile = $this->mofile;
$old_lang = $this->lang;
@@ -80,11 +81,14 @@ class L10n extends \CoreLibs\Basic
if (is_readable($this->mofile)) {
$this->input = new FileReader($this->mofile);
$this->l10n = new GetTextReader($this->input);
// we successfully loaded
$success = true;
} else {
// else fall back to the old ones
$this->mofile = $old_mofile;
$this->lang = $old_lang;
}
return $success;
}
public function __($text)

View File

@@ -1294,6 +1294,10 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
}
reset($this->element_list);
foreach ($this->element_list as $table_name => $reference_array) {
// init arrays
$q_names = array ();
$q_data = array ();
$q_values = array ();
// get the number of keys from the elements array
$keys = array_keys($reference_array["elements"]);
// element prefix name
@@ -1314,9 +1318,6 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// go through all submitted data
// for ($i = 0; $i < count($_POST[$el_name]); $i ++)
for ($i = 0; $i < $max; $i ++) {
$q_data[$i] = '';
$q_names[$i] = '';
$q_values[$i] = '';
// if we have enable name & delete set, then only insert/update those which are flagged as active
// check if mandatory field is set, if not set "do not write flag"
if ($data_array["mandatory"] && !$_POST[$prfx.$el_name][$i]) {
@@ -1355,7 +1356,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
$q_data[$i] .= ", ";
}
// insert name part list
if ($q_names[$i]) {
if (strlen($q_names[$i])) {
$q_names[$i] .= ", ";
}
// insert value part list