[PATCH 0/2 V4] Detect and enable help page from plugins tabs

This patch set changes the way Kimchi loads Help pages of the tabs of the plugins. It also changes the Sample plugin, in order to demonstrate and show properly how to configure the a Help page Rodrigo Trujillo (2): Fix problems to open plugin's help pages Changes in sample plugin to fix and improve help configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++ plugins/sample/sample.conf.in | 5 ++ plugins/sample/ui/config/tab-ext.xml | 11 ++++- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ------------ ui/js/src/kimchi.main.js | 53 ++++++++++++++++------ 11 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl -- 1.9.3

Kimchi is currently not able to configure and open help pages of any plugin tab. This patch fixes this problem and removes the HELP button if any Kimchi tab or plugin tab do not have a help configured properly for the language being used. (eg. if plugins/<tab_html>/help/<lang>/<tab_html>.html does not exist, then the help button is disabled). A help page for a plugin tab follow same Kimchi system: - html help file should have the same name of plugin html tab file; - html files should be placed in plugin's " ui/pages/help/<LANG> " path; - plugin should add following lines to <PLUGIN_NAME>.conf: * [/help] * tools.staticdir.on = True * tools.nocache.on = True * tools.staticdir.dir = '<HELP PAGE DIRECTORY>' Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- ui/js/src/kimchi.main.js | 53 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index a3305e9..3210dd9 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -49,11 +49,16 @@ kimchi.main = function() { var path = tab['path']; var mode = tab['mode']; if (mode != 'none') { + var helpPath = kimchi.checkHelpFile(path); + var disableHelp = "" + if (helpPath == "disableHelp") + disableHelp = helpPath; tabsHtml.push( '<li>', - '<a class="item" href="', path, '">', + '<a class="item ', disableHelp,'" href="', path, '">', title, '</a>', + '<input id="helpPathId" name="helpPath" value="' + helpPath + '" type="hidden"/>', '</li>' ); } @@ -172,7 +177,15 @@ kimchi.main = function() { $('#nav-menu a').removeClass('current'); $(tab).addClass('current'); $(tab).focus(); - + // Disable Help button according to selected tab + if ($(tab).hasClass("disableHelp")) { + $('#btn-help').css('cursor', "not-allowed"); + $('#btn-help').off("click"); + } + else { + $('#btn-help').css('cursor', "pointer"); + $('#btn-help').on("click", kimchi.openHelp); + } // Load page content. loadPage(url); }; @@ -265,7 +278,7 @@ kimchi.main = function() { event.preventDefault(); }); - $('#btn-help').on('click', kimchi.getHelp); + $('#btn-help').on('click', kimchi.openHelp); }; var initUI = function() { @@ -307,15 +320,29 @@ kimchi.main = function() { }); }; -kimchi.getHelp = function(e) { - var url = window.location.hash; - var lang = kimchi.lang.get(); - url = url.replace("#tabs", "/help/" + lang); - if (url == "/help" + lang) - url = url + "/index.html" - else - url = url + ".html"; - window.open(url, "Kimchi Help"); - e.preventDefault(); +kimchi.checkHelpFile = function(path) { + var lang = kimchi.lang.get(); + var url = "" + // Find help page path according to tab name + if (/^tabs/.test(path)) + url = path.replace("tabs", "/help/" + lang); + else if (/^plugins/.test(path)) + url = path.slice(0, path.lastIndexOf('/')) + "/help/" + lang + path.slice(path.lastIndexOf('/')); + // Checking if help page exist. + $.ajax({ + url: url, + async: false, + error: function() { url = "disableHelp"; }, + success: function() { } + }); + return url; +}; + + +kimchi.openHelp = function(e) { + var tab = $('#nav-menu a.current'); + var url = $(tab).parent().find("input[name='helpPath']").val(); + window.open(url, "Kimchi Help"); + e.preventDefault(); }; -- 1.9.3

On 09/30/2014 03:37 PM, Rodrigo Trujillo wrote:
Kimchi is currently not able to configure and open help pages of any plugin tab. This patch fixes this problem and removes the HELP button if any Kimchi tab or plugin tab do not have a help configured properly for the language being used. (eg. if plugins/<tab_html>/help/<lang>/<tab_html>.html does not exist, then the help button is disabled).
A help page for a plugin tab follow same Kimchi system: - html help file should have the same name of plugin html tab file; - html files should be placed in plugin's " ui/pages/help/<LANG> " path; - plugin should add following lines to <PLUGIN_NAME>.conf: * [/help] * tools.staticdir.on = True * tools.nocache.on = True * tools.staticdir.dir = '<HELP PAGE DIRECTORY>'
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- ui/js/src/kimchi.main.js | 53 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 13 deletions(-)
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index a3305e9..3210dd9 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -49,11 +49,16 @@ kimchi.main = function() { var path = tab['path']; var mode = tab['mode']; if (mode != 'none') { + var helpPath = kimchi.checkHelpFile(path);
+ var disableHelp = "" + if (helpPath == "disableHelp") + disableHelp = helpPath;
disabledHelp = "disableHelp" ? helpPath.lenght() == 0 : ""
tabsHtml.push( '<li>', - '<a class="item" href="', path, '">', + '<a class="item ', disableHelp,'" href="', path, '">', title, '</a>', + '<input id="helpPathId" name="helpPath" value="' + helpPath + '" type="hidden"/>', '</li>' ); } @@ -172,7 +177,15 @@ kimchi.main = function() { $('#nav-menu a').removeClass('current'); $(tab).addClass('current'); $(tab).focus(); - + // Disable Help button according to selected tab + if ($(tab).hasClass("disableHelp")) { + $('#btn-help').css('cursor', "not-allowed"); + $('#btn-help').off("click"); + } + else { + $('#btn-help').css('cursor', "pointer"); + $('#btn-help').on("click", kimchi.openHelp); + } // Load page content. loadPage(url); }; @@ -265,7 +278,7 @@ kimchi.main = function() { event.preventDefault(); });
- $('#btn-help').on('click', kimchi.getHelp); + $('#btn-help').on('click', kimchi.openHelp); };
var initUI = function() { @@ -307,15 +320,29 @@ kimchi.main = function() { }); };
-kimchi.getHelp = function(e) { - var url = window.location.hash; - var lang = kimchi.lang.get(); - url = url.replace("#tabs", "/help/" + lang); - if (url == "/help" + lang) - url = url + "/index.html" - else - url = url + ".html";
- window.open(url, "Kimchi Help"); - e.preventDefault();
+kimchi.checkHelpFile = function(path) { + var lang = kimchi.lang.get(); + var url = "" + // Find help page path according to tab name + if (/^tabs/.test(path)) + url = path.replace("tabs", "/help/" + lang); + else if (/^plugins/.test(path)) + url = path.slice(0, path.lastIndexOf('/')) + "/help/" + lang + path.slice(path.lastIndexOf('/')); + // Checking if help page exist. + $.ajax({ + url: url, + async: false,
+ error: function() { url = "disableHelp"; },
Return an empty string in that case. url = ""; So the function does what it is supposed to do without joining 2 different meanings.
+ success: function() { } + }); + return url; +}; + + +kimchi.openHelp = function(e) { + var tab = $('#nav-menu a.current'); + var url = $(tab).parent().find("input[name='helpPath']").val(); + window.open(url, "Kimchi Help"); + e.preventDefault(); };

This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status +pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \ + -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g' + +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True [/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index a1fb1c2..aff0d14 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -4,7 +4,14 @@ <access role="admin" mode="admin"/> <access role="user" mode="none"/> - <title>SampleTab</title> - <path>plugins/sample/tab.html</path> + <title>SampleTab 1</title> + <path>plugins/sample/sample-tab1.html</path> + </tab> + <tab> + <access role="admin" mode="admin"/> + <access role="user" mode="none"/> + + <title>SampleTab 2</title> + <path>plugins/sample/sample-tab2.html</path> </tab> </tabs-ext> diff --git a/plugins/sample/ui/pages/Makefile.am b/plugins/sample/ui/pages/Makefile.am index ca22446..3da95a2 100644 --- a/plugins/sample/ui/pages/Makefile.am +++ b/plugins/sample/ui/pages/Makefile.am @@ -17,4 +17,4 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -EXTRA_DIST = i18n.json.tmpl tab.html.tmpl +EXTRA_DIST = i18n.json.tmpl sample-tab1.html.tmpl sample-tab2.html.tmpl diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab1.html b/plugins/sample/ui/pages/help/en_US/sample-tab1.html new file mode 100644 index 0000000..70aa1c0 --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab1.html @@ -0,0 +1 @@ +Help page for TAB 1 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab2.html b/plugins/sample/ui/pages/help/en_US/sample-tab2.html new file mode 100644 index 0000000..367318f --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab2.html @@ -0,0 +1 @@ +Help page for TAB 2 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/sample-tab1.html.tmpl b/plugins/sample/ui/pages/sample-tab1.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab1.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/sample-tab2.html.tmpl b/plugins/sample/ui/pages/sample-tab2.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab2.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl deleted file mode 100644 index 4354d81..0000000 --- a/plugins/sample/ui/pages/tab.html.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -#* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#unicode UTF-8 -<!DOCTYPE html> -<html> -<script type="text/javascript" src="plugins/sample/js/util.js"></script> -<body> - <div id="samplebody"/> -</body> -<script> - sample.description(function(r){ - \$("#samplebody").html("name: " + r.name + " version: " + r.version); - }); -</script> -</html> -- 1.9.3

On 09/30/2014 03:37 PM, Rodrigo Trujillo wrote:
This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status
+pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \
+ -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g'
ENABLE_SAMPLE is not used on sample.conf.in
+ +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True
[/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index a1fb1c2..aff0d14 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -4,7 +4,14 @@ <access role="admin" mode="admin"/> <access role="user" mode="none"/>
- <title>SampleTab</title> - <path>plugins/sample/tab.html</path> + <title>SampleTab 1</title> + <path>plugins/sample/sample-tab1.html</path> + </tab> + <tab> + <access role="admin" mode="admin"/> + <access role="user" mode="none"/> + + <title>SampleTab 2</title> + <path>plugins/sample/sample-tab2.html</path> </tab> </tabs-ext> diff --git a/plugins/sample/ui/pages/Makefile.am b/plugins/sample/ui/pages/Makefile.am index ca22446..3da95a2 100644 --- a/plugins/sample/ui/pages/Makefile.am +++ b/plugins/sample/ui/pages/Makefile.am @@ -17,4 +17,4 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-EXTRA_DIST = i18n.json.tmpl tab.html.tmpl +EXTRA_DIST = i18n.json.tmpl sample-tab1.html.tmpl sample-tab2.html.tmpl diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab1.html b/plugins/sample/ui/pages/help/en_US/sample-tab1.html new file mode 100644 index 0000000..70aa1c0 --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab1.html @@ -0,0 +1 @@ +Help page for TAB 1 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab2.html b/plugins/sample/ui/pages/help/en_US/sample-tab2.html new file mode 100644 index 0000000..367318f --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab2.html @@ -0,0 +1 @@ +Help page for TAB 2 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/sample-tab1.html.tmpl b/plugins/sample/ui/pages/sample-tab1.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab1.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/sample-tab2.html.tmpl b/plugins/sample/ui/pages/sample-tab2.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab2.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl deleted file mode 100644 index 4354d81..0000000 --- a/plugins/sample/ui/pages/tab.html.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -#* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#unicode UTF-8 -<!DOCTYPE html> -<html> -<script type="text/javascript" src="plugins/sample/js/util.js"></script> -<body> - <div id="samplebody"/> -</body> -<script> - sample.description(function(r){ - \$("#samplebody").html("name: " + r.name + " version: " + r.version); - }); -</script> -</html>

on 2014/10/01 02:37, Rodrigo Trujillo wrote:
This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status
+pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \ + -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g' + +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True
[/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help'
Is it also possible to do the trick as we did in Ginger using PluginPaths? kimchi.config.PluginPaths('sample').ui_dir + '/pages/help' Or we can directly edit PluginConfig in src/kimchi/config.py.in, and update the "/help" config item with the corrected path. plugin_config = { # ... '/help': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(PluginPaths(plugin_name).ui_dir, '/pages/help') 'tools.nocache.on': True } } This can avoid the sed trick in "Makefile.am" and simplifies the packaging for all the plugins, and save them from adding similar "help" config item in "plugin_name.conf" file. Otherwise all the plugins needs this sed trick in packaging system. Is it a bit overkill for a most simple sample plugin? When reviewing the Ginger part of this patch I didn't know you also made some changes in Kimchi. I think it maybe a good chance to update the Kimchi plugin framework to add support for help files. Agree? ;-)
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index a1fb1c2..aff0d14 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -4,7 +4,14 @@ <access role="admin" mode="admin"/> <access role="user" mode="none"/>
- <title>SampleTab</title> - <path>plugins/sample/tab.html</path> + <title>SampleTab 1</title> + <path>plugins/sample/sample-tab1.html</path> + </tab> + <tab> + <access role="admin" mode="admin"/> + <access role="user" mode="none"/> + + <title>SampleTab 2</title> + <path>plugins/sample/sample-tab2.html</path> </tab> </tabs-ext> diff --git a/plugins/sample/ui/pages/Makefile.am b/plugins/sample/ui/pages/Makefile.am index ca22446..3da95a2 100644 --- a/plugins/sample/ui/pages/Makefile.am +++ b/plugins/sample/ui/pages/Makefile.am @@ -17,4 +17,4 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-EXTRA_DIST = i18n.json.tmpl tab.html.tmpl +EXTRA_DIST = i18n.json.tmpl sample-tab1.html.tmpl sample-tab2.html.tmpl diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab1.html b/plugins/sample/ui/pages/help/en_US/sample-tab1.html new file mode 100644 index 0000000..70aa1c0 --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab1.html @@ -0,0 +1 @@ +Help page for TAB 1 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab2.html b/plugins/sample/ui/pages/help/en_US/sample-tab2.html new file mode 100644 index 0000000..367318f --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab2.html @@ -0,0 +1 @@ +Help page for TAB 2 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/sample-tab1.html.tmpl b/plugins/sample/ui/pages/sample-tab1.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab1.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/sample-tab2.html.tmpl b/plugins/sample/ui/pages/sample-tab2.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab2.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl deleted file mode 100644 index 4354d81..0000000 --- a/plugins/sample/ui/pages/tab.html.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -#* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#unicode UTF-8 -<!DOCTYPE html> -<html> -<script type="text/javascript" src="plugins/sample/js/util.js"></script> -<body> - <div id="samplebody"/> -</body> -<script> - sample.description(function(r){ - \$("#samplebody").html("name: " + r.name + " version: " + r.version); - }); -</script> -</html>
-- Zhou Zheng Sheng / 周征晟 E-mail: zhshzhou@linux.vnet.ibm.com Telephone: 86-10-82454397

On 10/08/2014 11:59 PM, Zhou Zheng Sheng wrote:
on 2014/10/01 02:37, Rodrigo Trujillo wrote:
This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status
+pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \ + -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g' + +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True
[/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help' Is it also possible to do the trick as we did in Ginger using PluginPaths?
kimchi.config.PluginPaths('sample').ui_dir + '/pages/help'
Or we can directly edit PluginConfig in src/kimchi/config.py.in, and update the "/help" config item with the corrected path.
plugin_config = { # ... '/help': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(PluginPaths(plugin_name).ui_dir, '/pages/help') 'tools.nocache.on': True } }
I don't think it is a good idea as you will force all plugins to have a help setup.
This can avoid the sed trick in "Makefile.am" and simplifies the packaging for all the plugins, and save them from adding similar "help" config item in "plugin_name.conf" file. Otherwise all the plugins needs this sed trick in packaging system. Is it a bit overkill for a most simple sample plugin?
When reviewing the Ginger part of this patch I didn't know you also made some changes in Kimchi. I think it maybe a good chance to update the Kimchi plugin framework to add support for help files. Agree? ;-)
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index a1fb1c2..aff0d14 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -4,7 +4,14 @@ <access role="admin" mode="admin"/> <access role="user" mode="none"/>
- <title>SampleTab</title> - <path>plugins/sample/tab.html</path> + <title>SampleTab 1</title> + <path>plugins/sample/sample-tab1.html</path> + </tab> + <tab> + <access role="admin" mode="admin"/> + <access role="user" mode="none"/> + + <title>SampleTab 2</title> + <path>plugins/sample/sample-tab2.html</path> </tab> </tabs-ext> diff --git a/plugins/sample/ui/pages/Makefile.am b/plugins/sample/ui/pages/Makefile.am index ca22446..3da95a2 100644 --- a/plugins/sample/ui/pages/Makefile.am +++ b/plugins/sample/ui/pages/Makefile.am @@ -17,4 +17,4 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-EXTRA_DIST = i18n.json.tmpl tab.html.tmpl +EXTRA_DIST = i18n.json.tmpl sample-tab1.html.tmpl sample-tab2.html.tmpl diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab1.html b/plugins/sample/ui/pages/help/en_US/sample-tab1.html new file mode 100644 index 0000000..70aa1c0 --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab1.html @@ -0,0 +1 @@ +Help page for TAB 1 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/help/en_US/sample-tab2.html b/plugins/sample/ui/pages/help/en_US/sample-tab2.html new file mode 100644 index 0000000..367318f --- /dev/null +++ b/plugins/sample/ui/pages/help/en_US/sample-tab2.html @@ -0,0 +1 @@ +Help page for TAB 2 of Kimchi's Sample plugin. diff --git a/plugins/sample/ui/pages/sample-tab1.html.tmpl b/plugins/sample/ui/pages/sample-tab1.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab1.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/sample-tab2.html.tmpl b/plugins/sample/ui/pages/sample-tab2.html.tmpl new file mode 100644 index 0000000..4354d81 --- /dev/null +++ b/plugins/sample/ui/pages/sample-tab2.html.tmpl @@ -0,0 +1,30 @@ +#* + * Project Kimchi + * + * Copyright IBM, Corp. 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *# +#unicode UTF-8 +<!DOCTYPE html> +<html> +<script type="text/javascript" src="plugins/sample/js/util.js"></script> +<body> + <div id="samplebody"/> +</body> +<script> + sample.description(function(r){ + \$("#samplebody").html("name: " + r.name + " version: " + r.version); + }); +</script> +</html> diff --git a/plugins/sample/ui/pages/tab.html.tmpl b/plugins/sample/ui/pages/tab.html.tmpl deleted file mode 100644 index 4354d81..0000000 --- a/plugins/sample/ui/pages/tab.html.tmpl +++ /dev/null @@ -1,30 +0,0 @@ -#* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#unicode UTF-8 -<!DOCTYPE html> -<html> -<script type="text/javascript" src="plugins/sample/js/util.js"></script> -<body> - <div id="samplebody"/> -</body> -<script> - sample.description(function(r){ - \$("#samplebody").html("name: " + r.name + " version: " + r.version); - }); -</script> -</html>

on 2014/10/09 20:40, Aline Manera wrote:
On 10/08/2014 11:59 PM, Zhou Zheng Sheng wrote:
on 2014/10/01 02:37, Rodrigo Trujillo wrote:
This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status
+pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \ + -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g' + +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True
[/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help' Is it also possible to do the trick as we did in Ginger using PluginPaths?
kimchi.config.PluginPaths('sample').ui_dir + '/pages/help'
Or we can directly edit PluginConfig in src/kimchi/config.py.in, and update the "/help" config item with the corrected path.
plugin_config = { # ... '/help': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(PluginPaths(plugin_name).ui_dir, '/pages/help') 'tools.nocache.on': True } }
I don't think it is a good idea as you will force all plugins to have a help setup.
OK. I agree it would be a problem if the plugin does not provide help. So what do you think of the trick I mentioned above? [/help] ... tools.staticdir.dir = kimchi.config.PluginPaths('sample').ui_dir + '/pages/help'
This can avoid the sed trick in "Makefile.am" and simplifies the packaging for all the plugins, and save them from adding similar "help" config item in "plugin_name.conf" file. Otherwise all the plugins needs this sed trick in packaging system. Is it a bit overkill for a most simple sample plugin?
When reviewing the Ginger part of this patch I didn't know you also made some changes in Kimchi. I think it maybe a good chance to update the Kimchi plugin framework to add support for help files. Agree? ;-)

On 10/09/2014 11:28 PM, Zhou Zheng Sheng wrote:
on 2014/10/09 20:40, Aline Manera wrote:
On 10/08/2014 11:59 PM, Zhou Zheng Sheng wrote:
on 2014/10/01 02:37, Rodrigo Trujillo wrote:
This patch set changes the Sample plugin, adding a new tab, modifying naming and other elements in order to show help pages properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++++++ plugins/sample/sample.conf.in | 5 ++++ plugins/sample/ui/config/tab-ext.xml | 11 ++++++-- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ---------------------- 10 files changed, 89 insertions(+), 34 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
diff --git a/configure.ac b/configure.ac index 7872db9..d363b50 100644 --- a/configure.ac +++ b/configure.ac @@ -90,7 +90,6 @@ AC_CONFIG_FILES([ plugins/Makefile plugins/sample/Makefile plugins/sample/po/Makefile.in - plugins/sample/sample.conf plugins/sample/ui/Makefile plugins/sample/ui/config/Makefile plugins/sample/ui/js/Makefile diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am index 876ab54..f8368a9 100644 --- a/plugins/sample/Makefile.am +++ b/plugins/sample/Makefile.am @@ -21,9 +21,21 @@ SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py) config.status
+pluginsdir = $(abs_top_srcdir)/plugins + all-local: while read L && test -n "$$L"; do \ dir=mo/$$L/LC_MESSAGES ; \ $(MKDIR_P) $$dir ; \ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \ done < po/LINGUAS + +all: sample.conf + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +do_substitution = \ + sed -e 's,[@]pluginsdir[@],$(pluginsdir),g' \ + -e 's,[@]ENABLE_SAMPLE[@],$(ENABLE_SAMPLE),g' + +sample.conf: sample.conf.in Makefile + $(do_substitution) < sample.conf.in > sample.conf diff --git a/plugins/sample/sample.conf.in b/plugins/sample/sample.conf.in index cf42467..7365a7c 100644 --- a/plugins/sample/sample.conf.in +++ b/plugins/sample/sample.conf.in @@ -20,3 +20,8 @@ tools.kimchiauth.on = True
[/circles] tools.kimchiauth.on = True + +[/help] +tools.staticdir.on = True +tools.nocache.on = True +tools.staticdir.dir = '@pluginsdir@/sample/ui/pages/help' Is it also possible to do the trick as we did in Ginger using PluginPaths?
kimchi.config.PluginPaths('sample').ui_dir + '/pages/help'
Or we can directly edit PluginConfig in src/kimchi/config.py.in, and update the "/help" config item with the corrected path.
plugin_config = { # ... '/help': { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(PluginPaths(plugin_name).ui_dir, '/pages/help') 'tools.nocache.on': True } } I don't think it is a good idea as you will force all plugins to have a help setup.
OK. I agree it would be a problem if the plugin does not provide help. So what do you think of the trick I mentioned above?
[/help] ... tools.staticdir.dir = kimchi.config.PluginPaths('sample').ui_dir + '/pages/help'
Yeap. It looks really good compared to the current solution. Sorry to don't mention that before. =)
This can avoid the sed trick in "Makefile.am" and simplifies the packaging for all the plugins, and save them from adding similar "help" config item in "plugin_name.conf" file. Otherwise all the plugins needs this sed trick in packaging system. Is it a bit overkill for a most simple sample plugin?
When reviewing the Ginger part of this patch I didn't know you also made some changes in Kimchi. I think it maybe a good chance to update the Kimchi plugin framework to add support for help files. Agree? ;-)

Excepted by the necessary rebase (easy to fix), the patches are good! -- Tested-by: Paulo Vital <pvital@linux.vnet.ibm.com> Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Tue, 2014-09-30 at 15:37 -0300, Rodrigo Trujillo wrote:
This patch set changes the way Kimchi loads Help pages of the tabs of the plugins. It also changes the Sample plugin, in order to demonstrate and show properly how to configure the a Help page
Rodrigo Trujillo (2): Fix problems to open plugin's help pages Changes in sample plugin to fix and improve help
configure.ac | 1 - plugins/sample/Makefile.am | 12 +++++ plugins/sample/sample.conf.in | 5 ++ plugins/sample/ui/config/tab-ext.xml | 11 ++++- plugins/sample/ui/pages/Makefile.am | 2 +- .../sample/ui/pages/help/en_US/sample-tab1.html | 1 + .../sample/ui/pages/help/en_US/sample-tab2.html | 1 + plugins/sample/ui/pages/sample-tab1.html.tmpl | 30 ++++++++++++ plugins/sample/ui/pages/sample-tab2.html.tmpl | 30 ++++++++++++ plugins/sample/ui/pages/tab.html.tmpl | 30 ------------ ui/js/src/kimchi.main.js | 53 ++++++++++++++++------ 11 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab1.html create mode 100644 plugins/sample/ui/pages/help/en_US/sample-tab2.html create mode 100644 plugins/sample/ui/pages/sample-tab1.html.tmpl create mode 100644 plugins/sample/ui/pages/sample-tab2.html.tmpl delete mode 100644 plugins/sample/ui/pages/tab.html.tmpl
participants (4)
-
Aline Manera
-
Paulo Ricardo Paz Vital
-
Rodrigo Trujillo
-
Zhou Zheng Sheng