<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 5/17/2014 3:30 AM,
<a class="moz-txt-link-abbreviated" href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a> wrote:<br>
</div>
<blockquote
cite="mid:1400268654-25467-2-git-send-email-shaohef@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: Zhou Zheng Sheng <a class="moz-txt-link-rfc2396E" href="mailto:zhshzhou@linux.vnet.ibm.com"><zhshzhou@linux.vnet.ibm.com></a>
Add minimal UI just enough to re-produce issue 342.
<a class="moz-txt-link-freetext" href="https://github.com/kimchi-project/kimchi/issues/342">https://github.com/kimchi-project/kimchi/issues/342</a>
Signed-off-by: Zhou Zheng Sheng <a class="moz-txt-link-rfc2396E" href="mailto:zhshzhou@linux.vnet.ibm.com"><zhshzhou@linux.vnet.ibm.com></a>
Signed-off-by: ShaoHe Feng <a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
---
plugins/sample/__init__.py | 3 ++-
plugins/sample/sample.conf | 5 +++++
plugins/sample/ui/config/tab-ext.xml | 9 +++++----
plugins/sample/ui/pages/i18n.json.tmpl | 9 +++++++++
plugins/sample/ui/pages/tab.html.tmpl | 6 ++++++
5 files changed, 27 insertions(+), 5 deletions(-)
create mode 100644 plugins/sample/ui/pages/i18n.json.tmpl
create mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py
index 3183898..2101aed 100644
--- a/plugins/sample/__init__.py
+++ b/plugins/sample/__init__.py
@@ -26,6 +26,7 @@ from cherrypy import expose
from kimchi.config import PluginPaths
from kimchi.control.base import Collection, Resource
+from kimchi.root import Root
from plugins.sample.i18n import messages
from plugins.sample.model import Model
@@ -33,7 +34,7 @@ from plugins.sample.model import Model
model = Model()
-class Drawings(Resource):
+class Drawings(Root):
def __init__(self):
Resource.__init__(self, model)
self.description = Description(model)
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf
index c4e80f7..78a9f4e 100644
--- a/plugins/sample/sample.conf
+++ b/plugins/sample/sample.conf
@@ -5,3 +5,8 @@ uri = "/plugins/sample"
[/]
tools.trailing_slash.on = False
+tools.sessions.on = True
+tools.sessions.name = 'kimchi'
+tools.sessions.httponly = True
+tools.sessions.locking = 'explicit'
+tools.sessions.storage_type = 'ram'
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml
index 948fa07..b98c126 100644
--- a/plugins/sample/ui/config/tab-ext.xml
+++ b/plugins/sample/ui/config/tab-ext.xml
@@ -1,7 +1,8 @@
<?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>
+ <nls>plugins/sample/i18n.html</nls></pre>
</blockquote>
here, an nls tag is designed for user to specify which file is used
for i18n content.<br>
<br>
But go through ' [PATCH V2 5/7] Issue #342: load i18n.html of the
plugin'.<br>
<br>
In javascript code, the path is hardcoded to be below<br>
<pre wrap="">        <i>var pluginI18nUrl = 'plugins/{plugin}/i18n.json';
</i>If it is mandatory for a plugin to put i18n content to a file named i18n.html directly under the plugin folder. then remove that nls tag.
Personally, as a plugin descriptor xml file is provided for a plugin developer to specify configuration of a plugin,
I prefer to leave the nls tag there to give the plugin developer the freedom to put wherever the i18n file to be.
</pre>
<blockquote
cite="mid:1400268654-25467-2-git-send-email-shaohef@linux.vnet.ibm.com"
type="cite">
<pre wrap="">
</tab>
-</tabs-ext>-->
\ No newline at end of file
+</tabs-ext>
diff --git a/plugins/sample/ui/pages/i18n.json.tmpl b/plugins/sample/ui/pages/i18n.json.tmpl
new file mode 100644
index 0000000..a153e2d
--- /dev/null
+++ b/plugins/sample/ui/pages/i18n.json.tmpl
@@ -0,0 +1,9 @@
+#unicode UTF-8
+#import gettext
+#from kimchi.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
+#silent _ = t.gettext
+#silent _t = t.gettext
+{
+ "SampleTab": "$_("SampleTab")"
+}
diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl
new file mode 100644
index 0000000..49fc4ec
--- /dev/null
+++ b/plugins/sample/ui/pages/tab.html.tmpl
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+Hello, world
+</body>
+</html>
</pre>
</blockquote>
<br>
</body>
</html>