[IMP] html_template more generic
bzr revid: al@openerp.com-20111018201337-tuh6wglp1qrixx5h
This commit is contained in:
parent
8e2ea9a656
commit
da7e08aa1b
|
@ -9,7 +9,6 @@ import operator
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import simplejson
|
import simplejson
|
||||||
import textwrap
|
|
||||||
import time
|
import time
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
import zlib
|
import zlib
|
||||||
|
@ -41,7 +40,7 @@ def concat_files(file_list):
|
||||||
files_concat = "".join(files_content)
|
files_concat = "".join(files_content)
|
||||||
return files_concat,files_timestamp
|
return files_concat,files_timestamp
|
||||||
|
|
||||||
home_template = textwrap.dedent("""<!DOCTYPE html>
|
html_template = """<!DOCTYPE html>
|
||||||
<html style="height: 100%%">
|
<html style="height: 100%%">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
@ -51,15 +50,15 @@ home_template = textwrap.dedent("""<!DOCTYPE html>
|
||||||
%(javascript)s
|
%(javascript)s
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
var c = new openerp.init(%(modules)s);
|
var s = new openerp.init(%(modules)s);
|
||||||
var wc = new c.web.WebClient("oe");
|
%(init)s
|
||||||
wc.start();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body id="oe" class="openerp"></body>
|
<body id="oe" class="openerp"></body>
|
||||||
</html>
|
</html>
|
||||||
""")
|
"""
|
||||||
|
|
||||||
class WebClient(openerpweb.Controller):
|
class WebClient(openerpweb.Controller):
|
||||||
_cp_path = "/web/webclient"
|
_cp_path = "/web/webclient"
|
||||||
|
|
||||||
|
@ -118,10 +117,11 @@ class WebClient(openerpweb.Controller):
|
||||||
js = "\n ".join('<script type="text/javascript" src="%s"></script>'%i for i in self.manifest_list(req, None, 'js'))
|
js = "\n ".join('<script type="text/javascript" src="%s"></script>'%i for i in self.manifest_list(req, None, 'js'))
|
||||||
css = "\n ".join('<link rel="stylesheet" href="%s">'%i for i in self.manifest_list(req, None, 'css'))
|
css = "\n ".join('<link rel="stylesheet" href="%s">'%i for i in self.manifest_list(req, None, 'css'))
|
||||||
|
|
||||||
r = home_template % {
|
r = html_template % {
|
||||||
'javascript': js,
|
'javascript': js,
|
||||||
'css': css,
|
'css': css,
|
||||||
'modules': simplejson.dumps(self.server_wide_modules(req)),
|
'modules': simplejson.dumps(self.server_wide_modules(req)),
|
||||||
|
'init': 'new s.web.WebClient("oe").start();',
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue