Fixed Javascript error in admin-menu with quotes in list items
authorDan
Sat, 12 Apr 2008 09:50:49 -0400
changeset 530 8d3c49b8dc79
parent 529 7803c9db3506
child 531 510160f15a69
Fixed Javascript error in admin-menu with quotes in list items
includes/clientside/static/admin-menu.js
--- a/includes/clientside/static/admin-menu.js	Thu Apr 10 07:58:56 2008 -0400
+++ b/includes/clientside/static/admin-menu.js	Sat Apr 12 09:50:49 2008 -0400
@@ -186,7 +186,7 @@
 }
 
 function item_upstatus (b_clear) {
-	window.setTimeout('window.status="' + (b_clear ? '' : this.a_config[0] + (this.a_config[1] ? ' ('+ this.a_config[1] + ')' : '')) + '"', 10);
+	window.setTimeout('window.status="' + addslashes(b_clear ? '' : this.a_config[0] + (this.a_config[1] ? ' ('+ this.a_config[1] + ')' : '')) + '"', 10);
 }
 
 function item_init () {
@@ -212,6 +212,12 @@
 	return this.o_root.a_tpl['icon_' + ((this.n_depth ? 0 : 32) + (this.a_children.length ? 16 : 0) + (this.a_children.length && this.b_opened ? 8 : 0) + (!b_junction && this.o_root.o_selected == this ? 4 : 0) + (b_junction ? 2 : 0) + (b_junction && this.is_last() ? 1 : 0))];
 }
 
+function addslashes (text) {
+  text = text.replace(/\\/g, '\\\\');
+  text = text.replace(/"/g, '\\"');
+  return text;
+}
+
 var trees = [];
 get_element = document.all ?
 	function (s_id) { return document.all[s_id] } :