[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 137/151: Remove console.log from JS Safer fun
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 137/151: Remove console.log from JS Safer function for XML (problem with escaping) |
Date: |
Sat, 4 Feb 2017 17:14:34 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 271b72551dc113976fa0364f7bd3ba411d0b6ad4
Author: Dany De Bontridder <address@hidden>
Date: Wed Jan 25 00:11:12 2017 +0100
Remove console.log from JS
Safer function for XML (problem with escaping)
---
html/js/managetable.js | 27 ++++++---------------------
include/lib/class_database.php | 7 ++++++-
include/lib/class_manage_table_sql.php | 13 ++++++++++---
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/html/js/managetable.js b/html/js/managetable.js
index 1993ad5..1449aea 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -114,8 +114,6 @@ var ManageTable = function (p_table_name)
@param req Ajax answer
*/
this.parseXML = function (req) {
- console.log(" start parsing");
- console.log(req.responseText);
try {
var xml = req.responseXML;
var status = xml.getElementsByTagName("status");
@@ -129,17 +127,11 @@ var ManageTable = function (p_table_name)
}
var answer=[];
answer['status'] = getNodeText(status[0]);
- console.log(answer);
answer['ctl'] = getNodeText(ctl[0]);
- console.log(answer);
answer['ctl_row'] = getNodeText(ctl_row[0]);
- console.log(answer);
answer['html'] = getNodeText(html[0]);
- console.log(answer);
return answer;
} catch (e) {
- console.log("erreur parsing");
- console.log(e.message);
throw e;
}
};
@@ -154,14 +146,11 @@ var ManageTable = function (p_table_name)
waiting_box();
try {
this.param['action'] = 'save';
- console.log(form_id);
var form = $(form_id).serialize(true);
- console.log(form);
this.param_add(form);
var here=this;
} catch (e) {
alert(e.message);
- console.log(e.message);
return false;
}
new Ajax.Request(this.callback, {
@@ -174,7 +163,6 @@ var ManageTable = function (p_table_name)
/// if p_ctl_row does not exist it means it is a new
/// row , otherwise an update
var answer=here.parseXML(req);
- console.log(answer);
if (answer ['status'] == 'OK') {
if ($(answer['ctl_row'])) {
$(answer['ctl_row']).update(answer['html']);
@@ -184,15 +172,16 @@ var ManageTable = function (p_table_name)
new_row.innerHTML = answer['html'];
$("tb"+answer['ctl']).appendChild(new_row);
}
+ new Effect.Highlight(answer['ctl_row'] ,{ startcolor:
'#ffff99',endcolor: '#ffffff' });
+
} else {
- console.error("Error in save");
+ smoke.alert("Changement impossible");
throw "error in save";
}
remove_waiting_box();
$("dtr").hide();
} catch (e) {
alert(e.message);
- console.log(e.message);
return false;
}
}
@@ -222,6 +211,8 @@ var ManageTable = function (p_table_name)
if (answer['status'] == 'OK') {
var x=answer['ctl_row'];
$(x).hide();
+ }else {
+ smoke.alert("Effacement impossible");
}
}
});
@@ -249,19 +240,13 @@ var ManageTable = function (p_table_name)
onSuccess: function (req) {
remove_waiting_box();
try {
- console.log("parse xml");
var x = here.parseXML(req);
- console.log("x");
- console.log(x);
- console.log("create div");
var obj = {id: control, "cssclass": "inner_box", "html":
loading()};
add_div(obj);
var pos = calcy(250);
- $(obj.id).setStyle({position: "absolute", top: pos + 'px',
width: "auto", "margin-left": "10%"});
- console.log("set dgb content")
+ $(obj.id).setStyle({position: "absolute", top: pos + 'px',
width: "auto", "margin-left": "20%"});
$(obj.id).update(x['html']);
} catch (e) {
- console.log(e.message);
smoke.alert("ERREUR " + e.message);
}
diff --git a/include/lib/class_database.php b/include/lib/class_database.php
index eff5a44..f54642d 100644
--- a/include/lib/class_database.php
+++ b/include/lib/class_database.php
@@ -142,6 +142,11 @@ class Database
{
pg_set_client_encoding($this->db, $p_charset);
}
+ function get_encoding()
+ {
+ return pg_client_encoding($this->db);
+ }
+
/**
* \brief send a sql string to the database
@@ -1151,4 +1156,4 @@ class Database
}
-/* test::test_me(); */
\ No newline at end of file
+/* test::test_me(); */
diff --git a/include/lib/class_manage_table_sql.php
b/include/lib/class_manage_table_sql.php
index 2b93548..c1019e2 100644
--- a/include/lib/class_manage_table_sql.php
+++ b/include/lib/class_manage_table_sql.php
@@ -591,7 +591,10 @@ class Manage_Table_SQL
$this->display_row($array);
$html=ob_get_contents();
ob_end_clean();
- $s3=$xml->createElement("html", html_entity_decode($html));
+ $s3=$xml->createElement("html" );
+ $t1=$xml->createTextNode($html);
+ $s3->appendChild($t1);
+
$root=$xml->createElement("data");
$root->appendChild($s1);
@@ -603,7 +606,7 @@ class Manage_Table_SQL
{
$s1=$xml->createElement("status", "NOK");
$s2=$xml->createElement("ctl_row",
- $this->object_name+"_"+$this->table->get_pk_value());
+ $this->object_name+"_"+$this->table->get_pk_value());
$s4=$xml->createElement("ctl", $this->object_name);
$s3=$xml->createElement("html", $ex->getTraceAsString());
$root=$xml->createElement("data");
@@ -632,6 +635,7 @@ class Manage_Table_SQL
{
$status="OK";
ob_start();
+
echo HtmlInput::title_box("Donnée", "dtr");
printf('<form id="frm%s_%s" method="POST"
onsubmit="%s.save(\'frm%s_%s\');return false;">',
$this->object_name, $this->table->get_pk_value(),
@@ -660,7 +664,10 @@ class Manage_Table_SQL
$ctl=$this->object_name."_".$this->table->get_pk_value();
$s2=$xml->createElement("ctl_row", $ctl);
$s4=$xml->createElement("ctl", $this->object_name);
- $s3=$xml->createElement("html", html_entity_decode($html));
+ $s3=$xml->createElement("html" );
+ $t1=$xml->createTextNode($html);
+ $s3->appendChild($t1);
+
$root=$xml->createElement("data");
$root->appendChild($s1);
$root->appendChild($s2);
- [Noalyss-commit] [noalyss] 89/151: remove debug info, (continued)
- [Noalyss-commit] [noalyss] 89/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 114/151: Move class_table_sql to lib , since it is usable without Noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 127/151: Add the noalyss version in the info page, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 121/151: Fix several issue in JS, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 98/151: Correct simul.py remove old file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 146/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 142/151: Doc : complete documentation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 119/151: correct syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 151/151: Improve description, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 145/151: change name alternate_row_color, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 137/151: Remove console.log from JS Safer function for XML (problem with escaping),
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 122/151: Test ManageTable ; fix several bugs and add the ajax answer , it not yet finished, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 62/151: Experiment less, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 149/151: Correct doxygen, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 49/151: Remove unused documentation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 100/151: Remove unused documentation, Dany De Bontridder, 2017/02/04