Commit 64a037a5 authored by Rafael Monnerat's avatar Rafael Monnerat

add language page on SlapOS console

See merge request !252
parents 00383034 c464b07a
......@@ -207,7 +207,9 @@ url_list = [
"leaflet.css",
"leaflet.js",
"tv4.min.js",
"vkbeautify.js"
"vkbeautify.js",
"gadget_erp5_page_slap_language_view.js",
"gadget_erp5_page_slap_language_view.html"
]
return url_list
<!DOCTYPE html>
<html>
<!--
data-i18n=User
data-i18n=Language
data-i18n=Update
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Page Language</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_page.html">
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_language_view.js" type="text/javascript"></script>
</head>
<body>
<form>
<button type="submit" class="ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="erp5_form"
data-gadget-sandbox="public">
</div>
<div class="dialog_button_container">
</div>
</form>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_slap_language_view.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_page_slap_language_view_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget SlapOS Language View</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1601640712.86</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, domsugar */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, domsugar) {
"use strict";
rJS(window)
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("updateHeader", "updateHeader")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this,
first_result_list;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getUrlForList([{command: 'display'}]),
gadget.getSettingList(['me', 'language_map', 'selected_language',
'default_selected_language']),
gadget.getDeclaredGadget("erp5_form"),
gadget.getTranslationList(['Language', 'User', 'Update'])
]);
})
.push(function (result_list) {
first_result_list = result_list;
var me = result_list[1][0];
if (me !== undefined) {
return gadget.jio_allDocs({
query: 'relative_url:"' + me + '"',
select_list: ['title']
});
}
})
.push(function (result) {
var user,
selected_language = first_result_list[1][2] ||
first_result_list[1][3],
key,
list_item = [],
options = JSON.parse(first_result_list[1][1]);
gadget.state.old_selected_lang = selected_language;
// Calculate user name
if (result === undefined) {
user = "Who are you?";
} else {
user = result.data.rows[0].value.title;
}
// Calculate possible language list
for (key in options) {
if (options.hasOwnProperty(key)) {
list_item.push([options[key], key]);
}
}
domsugar(gadget.element.querySelector('.dialog_button_container'), [
domsugar('input', {name: 'action_update',
type: 'submit',
value: first_result_list[3][2]})
]);
return RSVP.all([
gadget.updateHeader({
page_title: 'Language',
page_icon: 'flag',
front_url: first_result_list[0][0]
}),
first_result_list[2].render({
erp5_document: {"_embedded": {"_view": {
'User': {
"default": user,
"editable": 0,
"key": "field_user",
"title": first_result_list[3][1],
"type": "StringField"
},
'Language': {
"default": selected_language,
"editable": 1,
"items": list_item,
"key": "field_language",
"title": first_result_list[3][0],
"type": "ListField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["User"], ["Language"]]
]]
}
})
]);
});
})
.onEvent('submit', function () {
var gadget = this,
selected_lang;
return gadget.notifySubmitting()
.push(function () {
return gadget.getDeclaredGadget("erp5_form");
})
.push(function (erp5_form) {
return erp5_form.getContent();
})
.push(function (data) {
selected_lang = data.field_language;
return gadget.setSetting("selected_language", selected_lang);
})
.push(function () {
if (gadget.state.old_selected_lang !== selected_lang) {
return gadget.redirect({
command: 'change_language',
options: {
language: selected_lang
}
});
}
return gadget.notifySubmitted();
});
})
.declareMethod("triggerSubmit", function () {
return;
});
}(window, rJS, RSVP, domsugar));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_slap_language_view.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_gadget_erp5_page_slap_language_view_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget SlapOS Language View</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1601640707.77</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -12,6 +12,7 @@
data-i18n=Servers
data-i18n=Networks
data-i18n=Logout
data-i18n=Language
data-i18n=Access Monitor
-->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
......@@ -62,6 +63,7 @@
<li><a href="{{hosting_subscription_href}}" class="ui-btn ui-btn-icon-left ui-icon-gears" data-i18n="Services" accesskey="l">Services</a></li>
<li><a href="{{computer_href}}" class="ui-btn ui-btn-icon-left ui-icon-database" data-i18n="Servers" accesskey="c">Servers</a></li>
<li><a href="{{computer_network_href}}" class="ui-btn ui-btn-icon-left ui-icon-globe" data-i18n="Networks" accesskey="n">Networks</a></li>
<li><a href="{{language_href}}" class="ui-btn ui-btn-icon-left ui-icon-language" data-i18n="Language" accesskey="a">Language</a></li>
<li class="ui-last-child"><a href="{{logout_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout" accesskey="o">Logout</a></li>
</ul>
<dl></dl>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>984.41750.3569.51541</string> </value>
<value> <string>986.65492.29271.38877</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1592432119.42</float>
<float>1601549406.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -92,7 +92,8 @@
context.getUrlFor({command: 'display', options: {page: "slap_computer_list", editable: true}}),
context.getUrlFor({command: 'display', options: {page: "slap_network_list", editable: true}}),
context.getUrlFor({command: 'display', options: {page: "slap_project_list", editable: true}}),
context.getUrlFor({command: 'display', options: {page: "slap_person_view", editable: true}})
context.getUrlFor({command: 'display', options: {page: "slap_person_view", editable: true}}),
context.getUrlFor({command: 'display', options: {page: "slap_language_view"}})
]);
})
.push(function (result_list) {
......@@ -109,7 +110,8 @@
"computer_href": result_list[6],
"computer_network_href": result_list[7],
"project_href": result_list[8],
"person_href": result_list[9]
"person_href": result_list[9],
"language_href": result_list[10]
})
);
})
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>984.41613.62401.26214</string> </value>
<value> <string>986.62605.47961.15752</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -265,7 +265,7 @@
</tuple>
<state>
<tuple>
<float>1592426598.39</float>
<float>1601548137.84</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -208,4 +208,6 @@ web_page_module/rjs_leaflet_js
web_page_module/rjs_tv4_min_js
web_page_module/rjs_vkbeautify_js
web_site_module/hostingjs
web_site_module/hostingjs/**
\ No newline at end of file
web_site_module/hostingjs/**
web_page_module/rjs_gadget_erp5_page_slap_language_view_html
web_page_module/rjs_gadget_erp5_page_slap_language_view_js
\ No newline at end of file
......@@ -73,6 +73,8 @@ web_page_module/rjs_gadget_erp5_page_slap_invalidate_login_html
web_page_module/rjs_gadget_erp5_page_slap_invalidate_login_js
web_page_module/rjs_gadget_erp5_page_slap_invoice_list_html
web_page_module/rjs_gadget_erp5_page_slap_invoice_list_js
web_page_module/rjs_gadget_erp5_page_slap_language_view_html
web_page_module/rjs_gadget_erp5_page_slap_language_view_js
web_page_module/rjs_gadget_erp5_page_slap_load_schema_html
web_page_module/rjs_gadget_erp5_page_slap_load_schema_js
web_page_module/rjs_gadget_erp5_page_slap_network_list_html
......
......@@ -75,6 +75,11 @@
<td>//a[@data-i18n='Networks']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Language']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Logout']</td>
......@@ -124,6 +129,12 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
</tal:block>
<tal:block define="menu_item python: 'Language'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_language" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
</tal:block>
<tr>
<td colspan="3"><b>Access modules and verify the redirect</b></td>
</tr>
......
......@@ -42,6 +42,11 @@
</tal:block>
</tal:block>
<tal:block metal:define-macro="access_menu_item_language">
<tal:block tal:define="panel_gadget_id python: 'gadget_slapos_panel.html'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_language_base" />
</tal:block>
</tal:block>
......@@ -337,12 +342,12 @@
dummy python:context.REQUEST.set('mapping', {})">
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % header_translation"></td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[contains(text(), \'%s\')]' % header_translation"></td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % header_translation"></td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[contains(text(), \'%s\')]' % header_translation"></td>
<td></td>
</tr>
</tal:block>
......@@ -387,6 +392,44 @@
</tr>
</tal:block>
<tal:block metal:define-macro="access_menu_item_language_base">
<tr>
<td colspan="3"><b tal:content="python: 'Access Entry on the Menu for Language'"> Menu Item </b></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'%s\')]//a[@data-i18n=\'%s\']' % (panel_gadget_id, menu_item)"></td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[contains(text(), \'%s\')]' % here.Base_translateString(menu_item, lang=lang)"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_erp5_label_field.html\')]//label[text()=\'%s\']' % here.Base_translateString(menu_item, lang=lang)"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_erp5_label_field.html\')]//label[text()=\'%s\']' % here.Base_translateString(menu_item, lang=lang)"></td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="add_simple_with_title">
<tr>
<td colspan="3"><b tal:content="python: 'Add an entry with title as %s' % title"> Menu Item </b></td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment