<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 06/10/2014 11:24 AM, Zhou Zheng
Sheng wrote:<br>
</div>
<blockquote cite="mid:53971523.7010706@linux.vnet.ibm.com"
type="cite">
<pre wrap="">on 2014/06/10 22:19, Zhou Zheng Sheng wrote:
</pre>
<blockquote type="cite">
<pre wrap="">on 2014/06/10 21:24, Aline Manera wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 06/09/2014 11:20 PM, Zhou Zheng Sheng wrote:
</pre>
<blockquote type="cite">
<pre wrap="">on 2014/06/10 03:21, Aline Manera wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 06/09/2014 07:08 AM, <a class="moz-txt-link-abbreviated" href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">diff --git a/plugins/sample/ui/config/tab-ext.xml
b/plugins/sample/ui/config/tab-ext.xml
index 948fa07..8e0b3d3 100644
--- a/plugins/sample/ui/config/tab-ext.xml
+++ b/plugins/sample/ui/config/tab-ext.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--<tabs-ext>
+<tabs-ext>
<tab>
- <title>Test</title>
- <filePath>plugins/sample/ui/tab.html</filePath>
+ <title>SampleTab</title>
+ <path>plugins/sample/tab.html</path>
</pre>
</blockquote>
<pre wrap="">The UI files should be in a dedicated dir, as we have for kimchi
And we could remove tab.html (which does not have any meaning) to
sampleplugin.html or something like that
</pre>
</blockquote>
<pre wrap="">Hi, this file is not handle by back-end. It's just served by back-end,
and the front-end parses this file to get the clue on where the html
file of the plugin is.
</pre>
</blockquote>
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">So "plugins/sample/ui/tab.html" here is a virtual
URI, which is mapped to pages/tab.html under the specific ui dir of this
plugin.
</pre>
</blockquote>
<pre wrap="">
1. This patch set uses plugins/sample/tab/html instead of
plugins/sample/ui/tab.html
</pre>
</blockquote>
<pre wrap="">
Sorry! I wanted to say "plugins/sample/tab.html is virtual URI", and
"plugins/sample/ui/tab.htmls" is the real file. Sorry for the misleading.
</pre>
<blockquote type="cite">
<pre wrap="">2. Where is the map to pages/tab.html?
</pre>
</blockquote>
<pre wrap="">
It works like this:
1. plugins.sample.Drawings inherits Root, and it is mounted on URI
"/plugins/sample". It also sets "self.paths = PluginPaths('sample')"
2. GET plugins/sample/tab.html -> Drawings(Root).default("tab.html") ->
template.render("tab.html").
3. When the template needs to get the actual template file name, it calls
paths = cherrypy.request.app.root.paths
filename = paths.get_template_path(resource)
So here paths is actually "PluginPaths('sample')", and calling
paths.get_template_path()
returns the result of
os.path.join(self.ui_dir, 'pages/%s.tmpl' % resource)
So actually the filename is
self.ui_dir + 'pages/tab.html'
</pre>
</blockquote>
<pre wrap="">
should be self.ui_dir + 'pages/tab.html.tmpl'
</pre>
<blockquote type="cite">
<pre wrap="">and PluginPaths.__init__ sets
self.ui_dir = self.add_prefix(os.path.join(self.plugin_dir, 'ui'))
so at last the filename is
'plugins/sample/ui' + 'pages/tab.html'
</pre>
</blockquote>
<pre wrap="">
should be 'plugins/sample/ui' + 'pages/tab.html.tmpl'
</pre>
<blockquote type="cite">
<pre wrap="">Let me add Mark Wu to the cc list. He is the designer of the plugin
framework.
</pre>
</blockquote>
</blockquote>
<br>
<br>
<font face="DejaVu Sans Mono">Thanks a lot for the explanation, Zhou
Zheng! =)<br>
<br>
Got the flow now!<br>
<br>
Sorry about too many question. I was just trying to understand
that<br>
</font>
</body>
</html>