Commit ef07ce8b authored by Eugene Shen's avatar Eugene Shen

Update bt5 with missing Web Pages

Update IDs of missing Web Pages to add them to the business template:
erp5_page_launcher.html, gadget_erp5_chat.css,
gadget_erp5_chat_header.html, gadget_erp5_chat_header.js,
gadget_erp5_page_jio_configurator.html, and
gadget_erp5_page_jio_configurator.js.
Also add the Web Site officejs_chat.

Remove contact list from the panel gadget and delete its Web Pages:
gadget_erp5_page_contact_add.html, gadget_erp5_page_contact_add.js,
gdaget_erp5_page_contact_list.html, gadget_erp5_page_contact_list.js,
gadget_erp5_page_jio_person_view.html, and
gadget_erp5_page_jio_person_view.js.
parent 69670067
<!DOCTYPE html>
<html><!-- manifest="${manifest_url}"-->
<head>
<!-- all ${parameters} are based on the Layout Configuration in Web Site Module, and are set by /erp5/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>${application_title}</title>
<link rel="stylesheet" href="gadget_erp5_nojquery.css">
<link rel="stylesheet" href="${custom_css_url}">
<script data-renderjs-configuration="application_title" type="text/x-renderjs-configuration">${application_title}</script>
<script data-renderjs-configuration="panel_gadget" type="text/x-renderjs-configuration">${panel_gadget}</script>
<script data-renderjs-configuration="action_view" type="text/x-renderjs-configuration">${action_view}</script>
<script data-renderjs-configuration="default_view_reference" type="text/x-renderjs-configuration">${default_view_reference}</script>
<script data-renderjs-configuration="hateoas_url" type="text/x-renderjs-configuration">${hateoas_url}</script>
<script data-renderjs-configuration="frontpage_gadget" type="text/x-renderjs-configuration">${frontpage_gadget}</script>
<script data-renderjs-configuration="connect_page" type="text/x-renderjs-configuration">${connect_page}</script>
<script data-renderjs-configuration="language_map" type="text/x-renderjs-configuration">${language_map}</script>
<script data-renderjs-configuration="default_selected_language" type="text/x-renderjs-configuration">${default_selected_language}</script>
<script data-renderjs-configuration="website_url_set" type="text/x-renderjs-configuration">${website_url_set}</script>
<script data-renderjs-configuration="jio_general_query" type="text/x-renderjs-configuration">${jio_general_query}</script>
<script data-renderjs-configuration="jio_erp5_query" type="text/x-renderjs-configuration">${jio_erp5_query}</script>
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">${dropbox_app_key}</script>
<script data-renderjs-configuration="dropbox_redirect_uri" type="text/x-renderjs-configuration">${dropbox_redirect_uri}</script>
<script data-renderjs-configuration="dropbox_authentication_uri" type="text/x-renderjs-configuration">${dropbox_authentication_uri}</script>
<script data-renderjs-configuration="indexeddb_database_name" type="text/x-renderjs-configuration">${indexeddb_database_name}</script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_global.js"></script>
<script src="erp5_page_launcher.js"></script>
</head>
<body>
<div data-role="page">
<div data-gadget-url="gadget_jio.html"
data-gadget-scope="setting_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="${router_gadget}"
data-gadget-scope="router"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_erp5_notification.html"
data-gadget-scope="notification"
data-gadget-sandbox="public"></div>
<div data-gadget-url="${translation_gadget}"
data-gadget-scope="translation_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="${header_gadget}"
data-gadget-scope="header"
data-gadget-sandbox="public"></div>
<div data-gadget-url="${jio_gadget}"
data-gadget-scope="jio_gadget"
data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_erp5_editor_panel.html"
data-gadget-scope="editor_panel"
data-gadget-sandbox="public"></div>
<div data-gadget-url="${panel_gadget}"
data-gadget-scope="panel"
data-gadget-sandbox="public"></div>
<div role="main" class="ui-content gadget-content">
<div class="first-loader">
<span class="fa fa-spinner fa-spin fa-3x" />
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -67,7 +67,6 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
......@@ -82,52 +81,21 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_contact_add.html</string> </value>
<value> <string>erp5_page_launcher.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<value> <string>Starting Point</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_contact_add_html</string> </value>
<value> <string>erp5_page_launcher_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284351.46</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -139,15 +107,17 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Contact Add</string> </value>
<value> <string>ERP5 Application Launcher</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
......
.first-loader {
font-size: 100%;
}
.configurator-header {
padding: 1em 0 0 0;
font-size: 150%;
}
.configurator-welcome h3 {
color: #085078;
}
.configurator-command {
color: red;
}
.configurator-grid {
width: 100%;
display: flex;
flex-wrap: wrap;
}
.configurator-grid .spacer {
display: none;
}
.configurator-grid .grid-box {
flex-basis: 48%;
margin: 1%;
}
.configurator-button {
text-decoration: none;
padding: 0.5em 0;
height: 100%;
width: 100%;
color: #000;
background-color: #fff;
text-align: center;
border: 1px solid black;
-webkit-box-shadow: 0 2px 2px #aaa;
-moz-box-shadow: 0 2px 2px #aaa;
box-shadow: 0 2px 2px #aaa;
}
.configurator-button.active, .configurator-button:hover {
color: white;
background-color: #333;
}
.configurator-button:focus {
-webkit-box-shadow: 0 0 2px 2px #2ab;
-moz-box-shadow: 0 0 2px 2px #2ab;
box-shadow: 0 0 2px 2px #2ab;
}
.configurator-button:active {
color: white;
background-color: black;
}
.configurator-button:disabled {
color: #ddd;
background-color: gray;
}
.configurator-section {
border-style: solid;
border-width: 1px;
margin: 0 auto;
margin-top: 1em;
padding: 1em;
-webkit-border-radius: .3125em;
border-radius: .3125em;
-webkit-box-shadow: 0 2px 2px #aaa;
-moz-box-shadow: 0 2px 2px #aaa;
box-shadow: 0 2px 2px #aaa;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.configurator-section label {
color: black;
}
.panel-header {
display: flex;
align-items: center;
height: 4em;
}
.panel-header > button {
color: white;
flex: 1;
height: 100%;
margin: 0 2px 0 0;
padding: 0 0 0 1em;
}
.panel-header .fa {
float: left;
}
.panel-header > a {
height: 100%;
}
.panel-header > *:focus {
-webkit-box-shadow: 0 0 2px 2px #6ff;
-moz-box-shadow: 0 0 2px 2px #6ff;
box-shadow: 0 0 2px 2px #6ff;
}
.panel-element {
width: 100%;
padding: 0 1em;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid gray;
}
.panel-element:hover {
background-color: #333;
text-decoration: none;
}
.panel-element:nth-child(1) {
border-top: 1px solid gray;
}
.panel-listview li:focus {
-webkit-box-shadow: 0 0 2px 2px #2ab;
-moz-box-shadow: 0 0 2px 2px #2ab;
box-shadow: 0 0 2px 2px #2ab;
}
/* XXX nothing is centered vertically and the heights are all screwed up;
* do not waste your time trying, since NexediJS doesn't work either.
* height of header should be 0px on first load so it doesn't show up
*/
div[data-gadget-scope='header'] .ui-header {
align-items: center;
background-color: #085078;
}
.ui-header .header-title-link, .ui-header .header-title,
.ui-header .header-button, .ui-header form, .ui-header .header-element {
height: 100%;
}
.ui-header .header-element {
padding: 0 1em;
text-decoration: none;
}
.ui-header .header-title {
border-left: 2px solid gray;
border-right: 2px solid gray;
}
/* Chat Box */
.chat-box {
display: flex;
height: 75vh;
}
.chat-box > .chat-left-panel {
display: flex;
flex-direction: column;
height: 100%;
padding-right: 20px;
flex: 1;
}
.chat-box > .chat-right-panel {
display: flex;
flex-direction: column;
height: 100%;
flex: 4;
}
.chat-box .chat-right-panel-chat {
display: flex;
flex-direction: column;
flex: 1;
}
.chat-box .contact-list, .chat-box .chat-list {
flex: 1;
overflow: auto;
}
.chat-box h3 {
font-size: 150%;
color: red;
text-align: center;
}
.chat-form-panel form, .chat-form-panel input[type="submit"] {
display: inline;
min-width: 0;
background-color: white;
color: blue;
}
.chat-form-panel input[type="submit"]:hover,
.chat-form-panel input[type="submit"]:active {
background-color: snow;
color: midnightblue;
}
.chat-box img {
max-width: 50%;
max-height: 50%;
}
.chat-list li {
font-family: "Droid Sans Mono";
font-size: 12px;
}
.contact-list li {
color: blue;
}
.contact-list li:hover {
font-weight: bold;
cursor: pointer;
}
.contact-list li.notify {
font-weight: bold;
color: red;
}
.contact-list li.current {
color: orange;
}
.send-form {
display: flex;
}
.send-form input[type="text"] {
flex: 1;
margin: 0 1em 0 0;
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
<global name="Web Style" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -67,8 +67,8 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
......@@ -78,17 +78,9 @@
<none/>
</value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_contact_add.js</string> </value>
<value> <string>gadget_erp5_chat.css</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -98,7 +90,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_contact_add_js</string> </value>
<value> <string>gadget_erp5_chat_css</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -106,28 +98,9 @@
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284351.49</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
<value> <string>Web Style</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
......@@ -137,7 +110,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Contact Add JS</string> </value>
<value> <string>OfficeJS Chat CSS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ERP5 Header Gadget</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_erp5_chat_header.js"></script>
<script class="title_template" type="text/x-handlebars-template">
<span class="header-element">
{{title}}
</span>
</script>
<script class="button_template" type="text/x-handlebars-template">
<form>
<button class="header-element" type="submit" name="{{name}}">
<span class="fa fa-{{icon}}" aria-hidden="true"></span>
{{title}}
</button>
</form>
</script>
<script class="link_template" type="text/x-handlebars-template">
<a class="header-element {{class}}" href="{{url}}">
<span class="fa fa-{{icon}}" aria-hidden="true"></span>
{{title}}
</a>
</script>
<script class="subheader_template" type="text/x-handlebars-template">
{{#each subheader_list}}
<li>
<a class="header-element" href="{{url}}">
<span class="fa fa-{{icon}}" aria-hidden="true"></span>
{{title}}
</a>
</li>
{{/each}}
</script>
</head>
<body>
<header class="ui-header">
<div class="header-left">
</div>
<h1 class="header-title">
</h1>
<div class="header-right">
</div>
<div class="subheader">
</div>
</header>
</body>
</html>
\ No newline at end of file
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_jio_person_view.html</string> </value>
<value> <string>gadget_erp5_chat_header.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -93,13 +93,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_jio_person_view_html</string> </value>
<value> <string>gadget_erp5_chat_header_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -113,13 +111,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>ERP5 jIO Person View</string> </value>
<value> <string>Gadget ERP5 Header</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -79,7 +79,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_jio_person_view.js</string> </value>
<value> <string>gadget_erp5_chat_header.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -89,13 +89,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_jio_person_view_js</string> </value>
<value> <string>gadget_erp5_chat_header_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -109,13 +107,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>ERP5 jIO Person View JS</string> </value>
<value> <string>Gadget ERP5 Header JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -19,12 +19,6 @@
</header>
<article class="panel-listview">
<ul>
<li>
<a class="panel-element" href="#!display?n.page=contact_list">
<span class="fa fa-home" aria-hidden="true"></span>
Contact List
</a>
</li>
<li>
<a class="panel-element" href="#!display?n.page=chat_box">
<span class="fa fa-commenting-o" aria-hidden="true"></span>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>jIO Configurator Gadget</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_contact_add.js"></script>
</head>
<body>
</body>
</html>
/*globals window, RSVP, rJS*/
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80*/
(function (window, RSVP, rJS) {
'use strict';
rJS(window)
// Neither state to set nor ready to initialize
// The following functions are all acquired from erp5_launcher_nojqm.js
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('jio_post', 'jio_post')
/* Render the gadget
* Parameters: nothing
* XXX: portal_Type, document_title, parent_relative_url
* Returns: nothing
* Effects:
* - update header, page title to 'Add Contact'
* - post a new contact to jIO storage
*/
.declareMethod('render', function () {
const gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({page_title: 'New Contact'});
})
.push(function () {
const doc = {
parent_relative_url: 'person_module',
portal_type: 'Person',
};
return gadget.jio_post(doc);
})
.push(function (id) {
console.log(id);
return gadget.redirect({
command: 'display',
options: {
jio_key: id,
page: 'jio_person_view',
},
});
});
});
}(window, RSVP, rJS));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>OfficeJS Chat Contact List</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_contact_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_field_listbox_widget.html"
data-gadget-scope="listbox"
data-gadget-sandbox="public"></div>
</body>
</html>
\ No newline at end of file
/*globals window, RSVP, rJS*/
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80*/
(function (window, RSVP, rJS) {
'use strict';
/* Settings required:
* - jio_storage_description, or be redirected
*/
// XXX add more customization to allow reuse across different portal types
rJS(window)
// Neither state to set nor ready to initialize
// The following functions are all acquired from erp5_launcher_nojqm.js
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('requireSetting', 'requireSetting')
.declareAcquiredMethod('jio_post', 'jio_post')
/* Render the gadget
* Parameters:
* - get setting: jio_storage_description
* Returns: nothing
* Effects:
* - update header, page title to 'Contact List'
* - call listbox.render hardcoded, not jio_general_query
* - redirect if no jIO storage available
*/
.declareMethod('render', function () {
const gadget = this;
return gadget.requireSetting(
'jio_storage_description',
'jio_configurator',
new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
page_title: 'Contact List',
add_action: true,
});
})
.push(function () {
return gadget.getDeclaredGadget('listbox');
})
.push(function (listbox) {
return listbox.render({
gadget_title: 'Contact List',
gadget_query: {
limit: [0, 1000000],
query: 'portal_type: "Person"',
sort_on: [
['jio_configuration', 'descending'],
['modification_date', 'descending'],
],
select_list: [
'jio_configuration',
'default_email_coordinate_text',
'first_name',
'last_name',
],
},
column_list: [{
select: 'default_email_coordinate_text',
title: 'Email',
}, {
select: 'last_name',
title: 'Last Name',
}, {
select: 'first_name',
title: 'First Name',
}],
});
})
);
})
/* Add a new contact when the right button is clicked
* Parameters: nothing
* Returns: nothing
* Effects:
* - post a new contact to jIO storage
* - redirect to the contact view page
*/
.declareMethod('triggerSubmit', function () {
const gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.jio_post({
parent_relative_url: 'person_module',
portal_type: 'Person',
});
})
.push(function (id) {
return gadget.redirect({
command: 'display',
options: {
jio_key: id,
page: 'jio_person_view',
},
});
});
});
}(window, RSVP, rJS));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>jIO Configurator Gadget</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_jio_configurator.js"></script>
</head>
<body>
<article class="configurator-welcome">
<header class="configurator-header">
<h3>
<span class="fa fa-info-circle" aria-hidden="true"></span>
</h3>
</header>
</article>
<div data-gadget-url="gadget_erp5_page_jio_document_configurator.html"
data-gadget-scope="document_configurator"
data-gadget-sandbox="public"></div>
<article class="configurator-storage">
<header class="configurator-header">
<h3>
<span class="fa fa-database" aria-hidden="true"></span>
Your Storage Choice
</h3>
</header>
<section class="configurator-section">
<p>Select a storage with which to synchronize your data.</p>
<div class="configurator-grid">
<form class="grid-box select-erp5-form">
<button class="configurator-button" type="submit">ERP5</button>
</form>
<form class="grid-box select-local-form">
<button class="configurator-button" type="submit">Local is Enough</button>
</form>
<form class="grid-box select-dav-form">
<button class="configurator-button" type="submit">DAV Storage</button>
</form>
<form class="grid-box select-dropbox-form">
<button class="configurator-button" type="submit">Dropbox</button>
</form>
</div>
<section>
</article>
</body>
</html>
\ No newline at end of file
......@@ -24,7 +24,6 @@
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
......@@ -43,8 +42,6 @@
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......@@ -67,7 +64,6 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
<string>classification/collaborative/team</string>
</tuple>
</value>
......@@ -82,17 +78,9 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_contact_list.html</string> </value>
<value> <string>gadget_erp5_page_jio_configurator.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -102,32 +90,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_contact_list_html</string> </value>
<value> <string>gadget_erp5_page_jio_configurator_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.14</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -141,13 +108,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Contact List</string> </value>
<value> <string>jIO Configurator Gadget</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
......
/* jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
/* global window, document, RSVP, rJS */
(function (window, document, RSVP, rJS) {
'use strict';
/* How does redirection work in OfficeJS?
* - most gadgets redirect to the front page
* - when storage is not configured, all non-configurator gadgets
* automatically redirect to jio_configurator
* - when user is not logged in, all gadgets redirect to connect_page
* - most -> front page, non-configurator -> jio_configurator -> connect_page
*/
/* Settings required:
* - application_title
* - dropbox_app_key, iff setting Dropbox configuration
* - user_email, or be redirected
* Settings used:
* - connect_page, default: ''
* - indexeddb_database_name, default: 'jio'
* - dropbox_redirect_uri, default: window.location.origin
* - dropbox_authentication_uri, default: 'https://www.dropbox.com/1/oauth2'
* + '/authorize?client_id={0}&response_type=token&redirect_uri={1}'
* Settings modified:
* - jio_storage_name, example: 'local'
* - jio_storage_description, example: {type: 'indexeddb', database: 'foo'}
* - redirect_after_reload, to: {command: 'display', options: {page: 'sync'}}
*/
/* The following setFooConfiguration functions generate jIO configurations
* Parameters:
* - setLocalConfiguration, get setting: indexeddb_database_name
* - setDropboxConfiguration, get setting:
* dropbox_app_key, dropbox_redirect_uri, dropbox_authentication_uri
* Effects:
* - set setting:
* jio_storage_name, jio_storage_description, redirect_after_reload
* - reload, then redirect to sync
*/
function setErp5Configuration(gadget) {
return gadget.redirect({
command: 'display',
options: {page: 'jio_erp5_configurator'},
});
}
function setLocalConfiguration(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.setSetting('jio_storage_name', 'local');
})
.push(function () {
return gadget.getSetting('indexeddb_database_name', 'jio');
})
.push(function (indexeddb_database) {
const configuration = {
type: 'query',
sub_storage: {
type: 'uuid',
sub_storage: {
type: 'indexeddb',
database: indexeddb_database,
},
},
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('redirect_after_reload', {
command: 'display',
options: {page: 'sync'},
});
})
.push(function (res) {
return gadget.reload();
});
}
function setDavConfiguration(gadget) {
return gadget.redirect({
command: 'display',
options: {page: 'jio_dav_configurator'},
});
}
function setDropboxConfiguration(gadget) {
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getSetting('dropbox_app_key'),
gadget.getSetting('dropbox_redirect_uri', window.location.origin),
gadget.getSetting('dropbox_authentication_uri',
'https://www.dropbox.com/1/oauth2/authorize?'
+ 'client_id={0}&response_type=token&redirect_uri={1}'),
]);
})
.push(function (setting_list) {
window.location = setting_list[2]
.replace('{0}', setting_list[0]).replace('{1}', setting_list[1]);
return;
});
}
rJS(window)
.setState({
// Map between short names and their displayed value in storage_message
storage_name_dict: {
erp5: 'ERP5',
local: 'nothing. You are only using local storage',
dav: 'WebDAV storage',
dropbox: 'Dropbox',
},
})
// The following functions are all acquired from erp5_launcher_nojqm.js
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('translateHtml', 'translateHtml')
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('reload', 'reload')
.declareAcquiredMethod('setSetting', 'setSetting')
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('requireSetting', 'requireSetting')
/* Render the gadget
* Parameters:
* - getSetting: jio_storage_name, user_email
* Effects:
* - hide document_configurator gadget based on jio_storage_name
* - style configurator buttons based on jio_storage_name
* - update header, page title to 'Storage Configurator'
* - redirect if user not logged in
*/
.declareMethod('render', function () {
const gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting('redirect_after_reload', 'none');
})
.push(function (redirect) {
if (redirect !== 'none') {
return new RSVP.Queue()
.push(function () {
return gadget.setSetting('redirect_after_reload', null);
})
.push(function () {
return gadget.redirect(redirect);
});
} else {
return new RSVP.Queue()
.push(function () {
return gadget.getSetting('connect_page', 'none');
})
.push(function (connect_page) {
return gadget.requireSetting(
'user_email',
connect_page,
new RSVP.Queue()
.push(function () {
gadget.element.querySelector('.configurator-welcome')
.style.display = 'none';
return gadget.updateHeader({page_title: 'Storage Configurator'})
})
.push(function () {
return RSVP.all([
gadget.getSetting('application_title'),
gadget.getSetting('jio_storage_name', 'none'),
])
}).push(function (setting_list) {
gadget.element.querySelector('.configurator-document p')
.innerHTML = 'Your current remote storage is '
+ gadget.state.storage_name_dict[setting_list[1]] + '.';
switch (setting_list[1]) {
case 'erp5':
gadget.element.querySelector('form.select-erp5-form button')
.classList.add('ui-btn-active');
break;
case 'local':
gadget.element.querySelector('form.select-local-form button')
.classList.add('ui-btn-active');
break;
case 'dav':
gadget.element.querySelector('form.select-dav-form button')
.classList.add('ui-btn-active');
break;
case 'dropbox':
gadget.element.querySelector('form.select-dropbox-form '
+ 'button').classList.add('active');
break;
default:
gadget.element.querySelector('.configurator-welcome h3')
.innerHTML = 'Welcome to ' + setting_list[0]
+ '. Please start by choosing a storage.';
gadget.element.querySelector('.configurator-welcome')
.style.display = 'unset';
gadget.element.querySelector('div[data-gadget-scope='
+ 'document_configurator').style.display = 'none';
break;
}
return;
})
);
});
}
});
})
// Call a setFooConfiguration function based on the form submitted
.onEvent('submit', function (event) {
const gadget = this;
switch (event.target.className) {
case 'grid-box select-erp5-form':
return setErp5Configuration(gadget);
case 'grid-box select-local-form':
return setLocalConfiguration(gadget);
case 'grid-box select-dav-form':
return setDavConfiguration(gadget);
case 'grid-box select-dropbox-form':
return setDropboxConfiguration(gadget);
}
});
}(window, document, RSVP, rJS));
\ No newline at end of file
......@@ -24,7 +24,6 @@
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
......@@ -43,8 +42,6 @@
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......@@ -77,17 +74,9 @@
<none/>
</value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_contact_list.js</string> </value>
<value> <string>gadget_erp5_page_jio_configurator.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -97,32 +86,11 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_erp5_page_contact_list_js</string> </value>
<value> <string>gadget_erp5_page_jio_configurator_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.18</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -136,13 +104,11 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Contact List JS</string> </value>
<value> <string>jIO Configurator Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value>
<none/>
</value>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Contact View</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_erp5_page_jio_person_view.js"></script>
<script class="contact_template" type="text/x-handlebars-template">
<form class="contact-form">
<label>E-mail Address:</label>
<input type="text" name="default_email_coordinate_text"
value="{{default_email_coordinate_text}}" />
<label>Last Name:</label>
<input type="text" name="last_name" value="{{last_name}}" />
<label>First Name:</label>
<input type="text" name="first_name" value="{{first_name}}" />
<label>jIO Configuration:</label>
<input type="text" name="jio_configuration"
value="{{jio_configuration}}" />
</form>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*globals window, rJS, Handlebars, RSVP, loopEventListener, console*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS, Handlebars) {
'use strict';
/* Settings required:
* - jio_storage_description, or be redirected
*/
// Precompile Handlebars templates while loading the first gadget instance
const gadget_klass = rJS(window);
const contact_template = Handlebars.compile(gadget_klass
.__template_element.querySelector('.contact_template').innerHTML);
gadget_klass
.setState({
// Document metadata to store in jIO
doc: null,
jio_key: null,
})
// The following functions are all acquired from erp5_launcher_nojqm.js
.declareAcquiredMethod('updateHeader', 'updateHeader')
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('translateHtml', 'translateHtml')
.declareAcquiredMethod('requireSetting', 'requireSetting')
.declareAcquiredMethod('jio_allDocs', 'jio_allDocs')
.declareAcquiredMethod('jio_put', 'jio_put')
.declareAcquiredMethod('jio_get', 'jio_get')
/* Render the gadget
* Parameters: all in option_dict,
* - jio_key: the id of the document in the jIO storage
* - get setting: jio_storage_description
* Effects:
* - jIO get: the contact info associated with jio_key
* - change state: add the contact info from jIO
* - run the contact info through Handlebars to render the forms
* - redirect if no jIO storage available
*/
.declareMethod('render', function (option_dict) {
const gadget = this;
return gadget.requireSetting(
'jio_storage_description',
'jio_configurator',
new RSVP.Queue()
.push(function () {
return gadget.jio_get(option_dict.jio_key);
})
.push(function (result) {
return gadget.changeState({
jio_key: option_dict.jio_key,
doc: result
});
})
.push(function () {
return gadget.translateHtml(contact_template(gadget.state.doc));
})
.push(function (translated_html) {
gadget.element.innerHTML = translated_html;
let title;
if (gadget.state.doc.default_email_coordinate_text) {
title = gadget.state.doc.default_email_coordinate_text
+ ' | Contact';
} else {
title = 'Anonymous Contact';
}
return gadget.updateHeader({
page_title: title,
save_action: true,
});
})
);
})
/* Save current contact information when the right button is clicked
* Parameters:
* - the current values from the contact form
* Effects:
* - jIO put: the contact info from the contact form
* - redirect to the same page for a visual indication of success
*/
.declareMethod('triggerSubmit', function () {
const gadget = this;
return new RSVP.Queue()
.push(function () {
const fields = gadget.element.querySelector('.contact-form').elements;
for (let i = 0, i_len = fields.length; i < i_len; i++) {
gadget.state.doc[fields[i].name] = fields[i].value;
}
// ERP5: can not store property: modification_date
// gadget.state.doc.modification_date = new Date().toISOString();
})
.push(function () {
return gadget.jio_put(gadget.state.jio_key, gadget.state.doc);
})
.push(function () {
return gadget.redirect({
command: 'display',
options: {
jio_key: gadget.state.jio_key,
page: 'jio_person_view',
},
});
});
});
}(window, RSVP, rJS, Handlebars));
\ No newline at end of file
web_page_module/adapter_js
web_page_module/erp5_page_launcher*
web_page_module/gadget_erp5_chat_panel_*
web_page_module/gadget_erp5_chat_room_*
web_page_module/gadget_erp5_chat_webrtc_*
web_page_module/erp5_page_launcher_html
web_page_module/erp5_page_launcher_js
web_page_module/gadget_erp5_chat_css
web_page_module/gadget_erp5_chat_header_html
web_page_module/gadget_erp5_chat_header_js
web_page_module/gadget_erp5_chat_panel_html
web_page_module/gadget_erp5_chat_panel_js
web_page_module/gadget_erp5_chat_room_html
web_page_module/gadget_erp5_chat_room_js
web_page_module/gadget_erp5_chat_webrtc_html
web_page_module/gadget_erp5_chat_webrtc_js
web_page_module/gadget_erp5_nojquery_css
web_page_module/gadget_erp5_page_chat_*
web_page_module/gadget_erp5_page_contact_*
web_page_module/gadget_erp5_page_field_listbox_widget_*
web_page_module/gadget_erp5_page_jio_*_configurator_*
web_page_module/gadget_erp5_page_jio_person_view_*
web_page_module/gadget_erp5_page_sync_*
web_page_module/handlebars_js
\ No newline at end of file
web_page_module/gadget_erp5_page_chat_box_html
web_page_module/gadget_erp5_page_chat_box_js
web_page_module/gadget_erp5_page_chat_connect_html
web_page_module/gadget_erp5_page_chat_connect_js
web_page_module/gadget_erp5_page_jio_configurator_html
web_page_module/gadget_erp5_page_jio_configurator_js
web_page_module/gadget_erp5_page_jio_dav_configurator_html
web_page_module/gadget_erp5_page_jio_dav_configurator_js
web_page_module/gadget_erp5_page_jio_document_configurator_html
web_page_module/gadget_erp5_page_jio_erp5_configurator_html
web_page_module/gadget_erp5_page_jio_erp5_configurator_js
web_page_module/gadget_erp5_page_sync_html
web_page_module/gadget_erp5_page_sync_js
web_page_module/handlebars_js
web_site_module/officejs_chat
\ No newline at end of file
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