Commit 9ec957ad58635c63c120d6df98f4cd4e84da67d3

  • avatar
  • shalini
  • Tue Nov 01 19:45:14 IST 2011
cleaned up the code by removing alerts and print statements
  • Diff rendering mode:
  • inline
  • side by side

server/alipi.py

28 root.make_links_absolute(d['foruri'], resolve_base_href = True)28 root.make_links_absolute(d['foruri'], resolve_base_href = True)
29 script_test = root.makeelement('script')29 script_test = root.makeelement('script')
30 root.body.append(script_test)30 root.body.append(script_test)
31 script_test.set("src", "http://192.168.100.100/server/ui.js")
32# script_test.set("src", "http://dev.a11y.in/alipi/ui.js")
31# script_test.set("src", "http://192.168.100.100/server/ui.js")
32 script_test.set("src", "http://dev.a11y.in/alipi/ui.js")
33# script_test.set("src", "http://localhost/alipi-1/server/ui.js")33# script_test.set("src", "http://localhost/alipi-1/server/ui.js")
34 script_test.set("type", "text/javascript")34 script_test.set("type", "text/javascript")
35 35
42 root.body.append(style)42 root.body.append(style)
43 style.set("rel","stylesheet")43 style.set("rel","stylesheet")
44 style.set("type", "text/css")44 style.set("type", "text/css")
45 style.set("href", "http://192.168.100.100/server/stylesheet.css")
46# style.set("href", "http://dev.a11y.in/alipi/stylesheet.css")
45# style.set("href", "http://192.168.100.100/server/stylesheet.css")
46 style.set("href", "http://dev.a11y.in/alipi/stylesheet.css")
47# style.set("href", "http://localhost/alipi-1/server/stylesheet.css")47# style.set("href", "http://localhost/alipi-1/server/stylesheet.css")
4848
49 connection = pymongo.Connection('localhost',27017)49 connection = pymongo.Connection('localhost',27017)
88 return lxml.html.tostring(root)88 return lxml.html.tostring(root)
8989
90 elif request.args.has_key('lang') == True and request.args.has_key('blog') == False:90 elif request.args.has_key('lang') == True and request.args.has_key('blog') == False:
91 print "shalini"
92 d['lang'] = request.args['lang']91 d['lang'] = request.args['lang']
93 script_test = root.makeelement('script')92 script_test = root.makeelement('script')
94 root.body.append(script_test)93 root.body.append(script_test)
95 script_test.set("src", "http://192.168.100.100/server/ui.js")
94 script_test.set("src", "http://dev.a11y.in/alipi/ui.js")
95 #script_test.set("src", "http://192.168.100.100/server/ui.js")
96 script_test.set("type", "text/javascript")96 script_test.set("type", "text/javascript")
97 root.body.set("onload","a11ypi.ren()");97 root.body.set("onload","a11ypi.ren()");
98 root.make_links_absolute(d['foruri'], resolve_base_href = True)98 root.make_links_absolute(d['foruri'], resolve_base_href = True)
101 elif request.args.has_key('interactive') == True and request.args.has_key('blog') == True:101 elif request.args.has_key('interactive') == True and request.args.has_key('blog') == True:
102 script_test = root.makeelement('script')102 script_test = root.makeelement('script')
103 root.body.append(script_test)103 root.body.append(script_test)
104 script_test.set("src", "http://192.168.100.100/server/ui.js")
104 script_test.set("src", "http://dev.a11y.in/alipi/ui.js")
105 #script_test.set("src", "http://192.168.100.100/server/ui.js")
105 script_test.set("type", "text/javascript")106 script_test.set("type", "text/javascript")
106 root.body.set("onload","a11ypi.filter()");107 root.body.set("onload","a11ypi.filter()");
107 root.make_links_absolute(d['foruri'], resolve_base_href = True)108 root.make_links_absolute(d['foruri'], resolve_base_href = True)
111 elif request.args.has_key('interactive') == False and request.args.has_key('blog') == True: 111 elif request.args.has_key('interactive') == False and request.args.has_key('blog') == True:
112 script_test = root.makeelement('script')112 script_test = root.makeelement('script')
113 root.body.append(script_test)113 root.body.append(script_test)
114 script_test.set("src", "http://192.168.100.100/server/ui.js")
114 script_test.set("src", "http://dev.a11y.in/alipi/ui.js")
115 #script_test.set("src", "http://192.168.100.100/server/ui.js")
115 script_test.set("type", "text/javascript")116 script_test.set("type", "text/javascript")
116 117
117 script_jq_mini = root.makeelement('script')118 script_jq_mini = root.makeelement('script')
124 root.body.append(style)124 root.body.append(style)
125 style.set("rel","stylesheet")125 style.set("rel","stylesheet")
126 style.set("type", "text/css")126 style.set("type", "text/css")
127 style.set("href", "http://192.168.100.100/server/stylesheet.css")
127 script_test.set("src", "http://dev.a11y.in/alipi/stylesheet.css")
128 #style.set("href", "http://192.168.100.100/server/stylesheet.css")
128129
129 connection = pymongo.Connection('localhost',27017)130 connection = pymongo.Connection('localhost',27017)
130 db = connection['alipi']131 db = connection['alipi']

server/ui.js

14 }14 }
15 var v = content.document.getElementsByTagName("body");15 var v = content.document.getElementsByTagName("body");
16 var a = content.document.createElement("script");16 var a = content.document.createElement("script");
17 a.setAttribute("src","http://192.168.100.100/server/wsgi/page_edit.js");
18// a.setAttribute("src","http://dev.a11y.in/alipi/wsgi/page_edit.js");
17// a.setAttribute("src","http://192.168.100.100/server/wsgi/page_edit.js");
18 a.setAttribute("src","http://dev.a11y.in/alipi/wsgi/page_edit.js");
19// a.setAttribute("src","http://localhost/alipi-1/server/wsgi/page_edit.js");19// a.setAttribute("src","http://localhost/alipi-1/server/wsgi/page_edit.js");
20 a.setAttribute("type","text/javascript");20 a.setAttribute("type","text/javascript");
21 v[0].appendChild(a);21 v[0].appendChild(a);
67 }67 }
68 }68 }
69 }69 }
70 xhr.open("POST","http://192.168.100.100/menu",true);
70 xhr.open("POST","http://dev.a11y.in/menu",true);
71 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");71 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
72 d = window.location.search.split('?')[1];72 d = window.location.search.split('?')[1];
73 var a =[];73 var a =[];
97 }97 }
98 }98 }
99 }99 }
100 xhr.open("POST","http://192.168.100.100/menu",true);
100 xhr.open("POST","http://dev.a11y.in/menu",true);
101 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");101 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
102 d = window.location.search.split('?')[1];102 d = window.location.search.split('?')[1];
103 var a =[];103 var a =[];
117 },117 },
118 ren: function()118 ren: function()
119 {119 {
120 alert("ren-shalini");
121 var xhr = new XMLHttpRequest();120 var xhr = new XMLHttpRequest();
122 xhr.onreadystatechange = function()121 xhr.onreadystatechange = function()
123 {122 {
158 var lang= a['lang'];158 var lang= a['lang'];
159 var data="url="+encodeURIComponent(url)+"&lang="+encodeURIComponent(lang);159 var data="url="+encodeURIComponent(url)+"&lang="+encodeURIComponent(lang);
160 160
161 xhr.open("POST","http://192.168.100.100/replace",true);
161 xhr.open("POST","http://dev.a11y.in/replace",true);
162 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");162 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
163 xhr.send(data);//163 xhr.send(data);//
164 },164 },
165 evaluate: function()165 evaluate: function()
166 {166 {
167 alert("evaluate-shalini");
168 var nodes = document.evaluate(path, document, null, XPathResult.ANY_TYPE,null);167 var nodes = document.evaluate(path, document, null, XPathResult.ANY_TYPE,null);
169 try{168 try{
170 var result = nodes.iterateNext();169 var result = nodes.iterateNext();
184 }184 }
185 else{185 else{
186 result.textContent = newContent;186 result.textContent = newContent;
187 alert(result.textContent);
188 }187 }
189 result=nodes.iterateNext();188 result=nodes.iterateNext();
190 }189 }
239 var blog= a['blog'];239 var blog= a['blog'];
240 var data="url="+encodeURIComponent(url)+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog);240 var data="url="+encodeURIComponent(url)+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog);
241 241
242 xhr.open("POST","http://192.168.100.100/filter",true);
242 xhr.open("POST","http://dev.a11y.in/filter",true);
243 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");243 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
244 xhr.send(data);//244 xhr.send(data);//
245 },245 },