Commit 4e6fc667 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_gadget_interface_validator] Switch to erp5js gadgets

Reorganize code by parsing the appcache with jio.

Interface checking is done by a standalone gadget whch directly display the status.

Drop not needed code (do not reimplement getInterfaceList for example).

Force interface strict HTML format
parent 53d26a9d
......@@ -13,5 +13,5 @@
<script src="gadget_interface.js" type="text/javascript"></script>
</head>
<body></body>
<body><pre>In Progress</pre></body>
</html>
\ No newline at end of file
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.5552.51560.44322</string> </value>
<value> <string>968.32633.6528.12782</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1529075051.25</float>
<float>1530266131.49</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 30, maxlen: 80 */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
/*global DOMParser, document, rJS, RSVP, window,
jIO*/
(function (window, rJS, RSVP, DOMParser, jIO) {
"use strict";
function fetchAppcacheData(appcache_url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
url: appcache_url,
dataType: 'text'
});
})
.push(function (evt) {
return evt.target.responseText.split('\n');
});
//////////////////////////////////////////////
// Interface reader
//////////////////////////////////////////////
function GadgetInterface() {
if (!(this instanceof GadgetInterface)) {
return new GadgetInterface();
}
function filterGadgetList(filename_list) {
var html_list = [],
js_list = [],
gadget_list = [],
ext,
file_name,
last_index,
i;
for (i = 0; i < filename_list.length; i += 1) {
last_index = filename_list[i].lastIndexOf('.');
file_name = filename_list[i].substr(0, last_index);
ext = filename_list[i].substr(last_index + 1);
if (ext === "html") {
html_list.push(file_name);
} else if (ext === "js") {
js_list.push(file_name);
this.title = '';
this.description = '';
this.method_list = [];
}
GadgetInterface.parse = function (txt) {
var parser = (new DOMParser()).parseFromString(txt, 'text/html').body,
reader = new GadgetInterface(),
element,
sub_element,
method,
argument;
// Extract title
element = parser.firstElementChild;
if (element.tagName !== 'H1') {
throw new Error("Can't find gadget interface title from " +
element.outerHTML);
}
reader.title = element.textContent;
// Extract description
element = element.nextElementSibling;
if (element.tagName !== 'H3') {
throw new Error("Can't find gadget interface description from " +
element.outerHTML);
}
for (i = 0; i < html_list.length; i += 1) {
if (js_list.indexOf(html_list[i]) > -1) {
gadget_list.push(html_list[i] + ".html");
reader.description = element.textContent;
// Extract method list
element = element.nextElementSibling;
if (element.tagName !== 'DL') {
throw new Error("Can't find gadget interface method list from " +
element.outerHTML);
}
if (element.nextElementSibling !== null) {
// Ensure the HTML doesn't contain unexpected tags after methods
// definition
throw new Error("Unexpected element " + element.tagName +
" from " + element.outerHTML);
}
// Parse all methods
element = element.firstElementChild;
while (element !== null) {
// Loop on all methods
method = {};
// Extract method title
if (element.tagName !== 'DT') {
throw new Error("Can't find gadget interface method name from " +
element.outerHTML);
}
return gadget_list;
method.name = element.textContent;
// Extract method description
element = element.nextElementSibling;
if (element.tagName !== 'DD') {
throw new Error("Can't find gadget interface method description " +
"from " + element.outerHTML);
}
method.description = element.textContent;
function getInterfaceListFromURL(gadget_url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
url: gadget_url,
dataType: 'text'
});
})
.push(function (evt) {
var document_element = (new DOMParser()).parseFromString(
evt.target.responseText,
'text/html'
),
interface_list = [],
element,
i;
if (document_element.nodeType === 9 && document_element.head !== null) {
for (i = 0; i < document_element.head.children.length; i += 1) {
element = document_element.head.children[i];
if (element.href !== null &&
element.rel === "http://www.renderjs.org/rel/interface") {
interface_list.push(
rJS.getAbsoluteURL(element.getAttribute("href"),
window.location.href)
);
// Extract method argument list
element = element.nextElementSibling;
if (element.tagName !== 'DL') {
throw new Error("Can't find gadget interface method argument list " +
"from " + element.outerHTML);
}
// Parse all arguments
method.argument_list = [];
sub_element = element.firstElementChild;
while (sub_element !== null) {
// Loop on all arguments
argument = {};
// Extract argument name
if (sub_element.tagName !== 'DT') {
throw new Error("Can't find gadget interface argument name from " +
sub_element.outerHTML);
}
argument.name = sub_element.textContent;
argument.required =
sub_element.getAttribute("data-parameter-required") !== "optional";
argument.type = sub_element.getAttribute("data-parameter-type");
// Extract argument description
sub_element = sub_element.nextElementSibling;
if (sub_element.tagName !== 'DD') {
throw new Error("Can't find gadget interface argument description " +
"from " + sub_element.outerHTML);
}
argument.description = sub_element.textContent;
// Next argument
method.argument_list.push(argument);
sub_element = sub_element.nextElementSibling;
}
return interface_list;
});
// Next method
reader.method_list.push(method);
element = element.nextElementSibling;
}
function verifyInterfaceDefinition(interface_url) {
//to verify if interface definition follows the correct template.
var error_message = "Interface definition is incorrect: " +
"One or more required tags are missing.";
return reader;
};
GadgetInterface.fetch = function (interface_url) {
var context = this;
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
......@@ -87,61 +128,9 @@
});
})
.push(function (evt) {
var doc = (new DOMParser()).parseFromString(evt.target.responseText,
'text/html').body,
dl_list = doc.getElementsByTagName('dl'),
next_element = dl_list[0].firstElementChild,
method_len = dl_list.length - 1,
argument_len,
next_child_element,
i,
j;
if (dl_list[0].childElementCount !== 3 * method_len) {
throw new Error(error_message);
}
for (i = 0; i < method_len; i += 1) {
if ((next_element === null) ||
(next_element.localName.toLowerCase() !== 'dt')) {
throw new Error(error_message);
}
next_element = next_element.nextElementSibling;
if (next_element.localName.toLowerCase() !== 'dd') {
throw new Error(error_message);
}
next_element = next_element.nextElementSibling;
if (next_element.localName.toLowerCase() !== 'dl') {
throw new Error(error_message);
}
if (next_element.getElementsByTagName('dt').length !==
next_element.getElementsByTagName('dd').length) {
throw new Error(error_message);
}
argument_len = next_element.getElementsByTagName('dt').length;
next_child_element = next_element.firstElementChild;
for (j = 0; j < argument_len; j += 1) {
if ((next_child_element === null) ||
(next_child_element.localName.toLowerCase() !== 'dt')) {
throw new Error(error_message);
}
next_child_element = next_child_element.nextElementSibling;
if (next_child_element.localName.toLowerCase() !== 'dd') {
throw new Error(error_message);
}
next_child_element = next_child_element.nextElementSibling;
}
next_element = next_element.nextElementSibling;
}
return context.parse(evt.target.responseText);
});
}
function verifyInterfaceDeclaration(interface_url, declared_interface_list) {
//to verify if gadget declares the interface.
if (declared_interface_list.indexOf(interface_url) > -1) {
return "Success";
}
throw new Error("Interface is not declared.");
}
};
/*
function verifyMethodSignature(interface_method, gadget_method) {
......@@ -240,11 +229,8 @@
function verifyAllMethod(interface_method_list, gadget_method_list) {
//to verify all methods of gadget and interface.
return new RSVP.Queue()
.push(function () {
return verifyAllMethodDeclared(interface_method_list,
gadget_method_list[0]);
});
gadget_method_list);
/* Commented till figure out the way to fetch the argument length of a
defined function.
.push(function() {
......@@ -254,23 +240,29 @@
*/
}
rJS(window)
.declareMethod("getVerifyGadget", function (gadget_url) {
var interface_gadget = this;
return interface_gadget.declareGadget(gadget_url, {
scope: gadget_url
function getOrDeclareGadget(context, gadget_to_check_url) {
return context.getDeclaredGadget(gadget_to_check_url)
.push(undefined, function (error) {
if (error instanceof rJS.ScopeError) {
// XXX Load in an iframe
return context.declareGadget(gadget_to_check_url, {
scope: gadget_to_check_url
});
})
}
throw error;
});
}
.declareMethod("getDeclaredGadgetInterfaceList", function (gadget_data) {
if (gadget_data.constructor === String) {
return getInterfaceListFromURL(gadget_data);
function getDefinedInterfaceMethodList(interface_url) {
return GadgetInterface.fetch(interface_url)
.push(function (interface_data) {
return interface_data.method_list;
});
}
return gadget_data.getInterfaceList();
})
.declareMethod("getDeclaredGadgetMethodList", function (gadget) {
function getGadgetMethodList(context, gadget_to_check_url) {
return getOrDeclareGadget(context, gadget_to_check_url)
.push(function (gadget) {
var declared_method_dict = {},
declared_method_list = [],
item;
......@@ -287,95 +279,47 @@
declared_method_list.push(item);
}
}
return RSVP.all([
declared_method_list //,
return declared_method_list;
// gadget.getDeclaredMethodList()
]);
})
});
}
.declareMethod("getGadgetListFromAppcache", function (appcache_url) {
function verifyGadgetSingleInterfaceImplementation(interface_gadget,
gadget_to_check_url,
absolute_interface_url) {
var verify_result = {};
return new RSVP.Queue()
.push(function () {
return fetchAppcacheData(appcache_url);
})
.push(function (filename_list) {
return filterGadgetList(filename_list);
});
return RSVP.all([
getDefinedInterfaceMethodList(
absolute_interface_url
),
getGadgetMethodList(interface_gadget, gadget_to_check_url)
]);
})
.declareMethod("getAbsoluteURL", function (gadget, url) {
return gadget.getPath()
.push(function (base_url) {
return rJS.getAbsoluteURL(url, base_url);
});
.push(function (method_list) {
return verifyAllMethod(method_list[0], method_list[1]);
})
.declareMethod("getInterfaceData", function (interface_url) {
var interface_data = {
name: "",
description: "",
method_list: []
};
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
url: interface_url,
dataType: 'text'
verify_result.result = true;
return verify_result;
}, function (error) {
var interface_name = absolute_interface_url.substr(
absolute_interface_url.lastIndexOf('/') + 1
),
error_message;
error_message = "Interface Name: " + interface_name + "\n" +
"Error Details : \n" + error.message + "\n";
verify_result.result = false;
verify_result.details = error_message;
return verify_result;
});
})
.push(function (evt) {
var doc = (new DOMParser()).parseFromString(evt.target.responseText,
'text/html').body,
dl_list = doc.querySelectorAll('dl'),
dt_list = doc.querySelectorAll('dt'),
dd_list = doc.querySelectorAll('dd'),
method_len = dl_list.length - 1,
dt_count = 0,
dl_count = 1,
i,
method,
argument_len,
j,
argument_item;
interface_data.name = doc.querySelector('h1').innerHTML;
interface_data.description =
doc.querySelector('h3').innerHTML;
for (i = 0; i < method_len; i += 1) {
method = {
name: dt_list[dt_count].innerHTML,
description: dd_list[dt_count].innerHTML,
argument_list: []
};
argument_len = dl_list[dl_count].querySelectorAll('dt')
.length;
dt_count += 1;
dl_count += 1;
for (j = 0; j < argument_len; j += 1) {
argument_item = {
name: dt_list[dt_count].innerHTML,
description: dd_list[dt_count].innerHTML,
required: dt_list[dt_count]
.getAttribute("data-parameter-required") !== "optional",
type: dt_list[dt_count].getAttribute("data-parameter-type")
};
dt_count += 1;
method.argument_list.push(argument_item);
}
interface_data.method_list.push(method);
}
return interface_data;
});
})
.declareMethod("getDefinedInterfaceMethodList", function (interface_url) {
return this.getInterfaceData(interface_url)
.push(function (interface_data) {
return interface_data.method_list;
});
})
rJS(window)
/*
.declareMethod("getGadgetListImplementingInterface",
function (interface_data, gadget_source_data) {
function (interface_data, appcache_url) {
var interface_gadget = this,
interface_list,
gadget_list;
......@@ -397,25 +341,10 @@
return required_interface_list;
})
.push(function (i_list) {
var source_gadget_list = [];
interface_list = i_list;
if (!gadget_source_data) {
throw new Error(
"Invalid input: No gadget source information is provided."
);
}
if (gadget_source_data.constructor === Array) {
source_gadget_list = gadget_source_data;
} else if (gadget_source_data.constructor === String) {
source_gadget_list = interface_gadget.getGadgetListFromAppcache(
gadget_source_data
return interface_gadget.getGadgetListFromAppcache(
appcache_url
);
} else {
throw new Error(
"Invalid input: Invalid gadget source information is provided."
);
}
return source_gadget_list;
})
.push(function (g_list) {
var i,
......@@ -442,97 +371,30 @@
return result_gadget_list;
});
})
*/
.declareMethod("verifyGadgetSingleInterfaceImplementation",
function (verify_gadget, interface_url) {
var interface_gadget = this,
absolute_interface_url,
verify_result = {};
return new RSVP.Queue()
.push(function () {
return RSVP.all([
interface_gadget.getDeclaredGadgetInterfaceList(verify_gadget),
interface_gadget.getAbsoluteURL(verify_gadget, interface_url)
]);
})
.push(function (interface_detail) {
var declared_interface_list = interface_detail[0];
absolute_interface_url = interface_detail[1];
return verifyInterfaceDeclaration(absolute_interface_url,
declared_interface_list);
})
.push(function () {
return verifyInterfaceDefinition(absolute_interface_url);
})
.push(function () {
return RSVP.all([
interface_gadget.getDefinedInterfaceMethodList(
absolute_interface_url
),
interface_gadget.getDeclaredGadgetMethodList(verify_gadget)
]);
})
.push(function (method_list) {
return verifyAllMethod(method_list[0], method_list[1]);
})
.push(function () {
verify_result.result = true;
return verify_result;
}, function (error) {
var interface_name = absolute_interface_url.substr(
absolute_interface_url.lastIndexOf('/') + 1
),
error_message;
error_message = "Interface Name: " + interface_name + "\n" +
"Error Details : \n" + error.message + "\n";
verify_result.result = false;
verify_result.details = error_message;
return verify_result;
});
.declareMethod("render", function (options) {
return this.changeState(options);
})
.declareMethod("verifyGadgetInterfaceImplementation",
function (gadget_data, interface_data) {
var interface_gadget = this,
verify_gadget,
interface_list,
verify_result = {};
return new RSVP.Queue()
.push(function () {
var required_gadget;
if (!gadget_data) {
throw new Error("Invalid input: No gadget data is provided.");
}
if (gadget_data.constructor === String) {
verify_result.gadget_url = gadget_data;
required_gadget = interface_gadget.getVerifyGadget(gadget_data);
} else {
required_gadget = gadget_data;
}
return required_gadget;
})
.push(function (required_gadget) {
var required_interface_list = [];
verify_gadget = required_gadget;
if (!interface_data) {
required_interface_list =
interface_gadget.getDeclaredGadgetInterfaceList(verify_gadget);
} else if (interface_data.constructor === Array) {
required_interface_list = interface_data;
} else if (interface_data.constructor === String) {
required_interface_list.push(interface_data);
}
return required_interface_list;
.onStateChange(function () {
var context = this,
gadget_to_check;
return getOrDeclareGadget(context, context.state.gadget_to_check_url)
.push(function (result) {
gadget_to_check = result;
return gadget_to_check.getInterfaceList();
})
.push(function (required_interface_list) {
var result_list = [],
i;
interface_list = required_interface_list;
for (i = 0; i < interface_list.length; i += 1) {
for (i = 0; i < required_interface_list.length; i += 1) {
result_list.push(
interface_gadget.verifyGadgetSingleInterfaceImplementation(
verify_gadget,
interface_list[i]
verifyGadgetSingleInterfaceImplementation(
context,
context.state.gadget_to_check_url,
required_interface_list[i]
)
);
}
......@@ -548,18 +410,32 @@
error_message += (result_list[i].details + '\n');
}
}
if (failed) {
throw new Error(error_message);
if (result_list.length === 0) {
context.element.firstElementChild.textContent = 'N/A';
if (!context.state.summary) {
context.element.firstElementChild.textContent +=
'\n' + error_message;
}
} else if (failed) {
context.element.firstElementChild.textContent = 'Failure';
if (!context.state.summary) {
context.element.firstElementChild.textContent +=
'\n' + error_message;
}
} else {
context.element.firstElementChild.textContent = 'Success';
if (!context.state.summary) {
context.element.firstElementChild.textContent +=
'\n' + error_message;
}
}
})
.push(function () {
verify_result.result = true;
return verify_result;
}, function (error) {
verify_result.result = false;
verify_result.details = error.message;
return verify_result;
.push(undefined, function (error) {
console.warn(error);
context.element.firstElementChild.textContent =
"Error with gadget loading";
});
});
}(window, rJS, RSVP, DOMParser, jIO));
\ No newline at end of file
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.19656.34499.5171</string> </value>
<value> <string>968.35510.60407.49868</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1529315086.55</float>
<float>1530266417.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -100,34 +100,75 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# generated on Fri, 06 Feb 2015 15:31:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
# generated on Thu, 28 Jun 2018 15:31:33 +0000\n
CACHE:\n
https://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css\n
URI.js\n
gadget_erp5.css\n
favicon.ico\n
font-awesome/font-awesome-webfont.eot\n
font-awesome/font-awesome-webfont.woff\n
font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg#fontawesomeregular\n
erp5_launcher_nojqm.js\n
gadget_erp5_nojqm.css\n
gadget_erp5_configure_editor.html\n
gadget_erp5_configure_editor.js\n
gadget_erp5_editor_panel.html\n
gadget_erp5_editor_panel.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_field_listbox.html\n
gadget_erp5_field_listbox.js\n
gadget_erp5_field_readonly.html\n
gadget_erp5_field_readonly.js\n
gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n
gadget_erp5_form.html\n
gadget_erp5_form.js\n
gadget_erp5_header.html\n
gadget_erp5_header.js\n
gadget_erp5_label_field.html\n
gadget_erp5_label_field.js\n
gadget_erp5_notification.html\n
gadget_erp5_notification.js\n
gadget_erp5_pt_form_list.html\n
gadget_erp5_pt_form_list.js\n
gadget_erp5_pt_form_view.html\n
gadget_erp5_pt_form_view.js\n
gadget_erp5_router.html\n
gadget_erp5_router.js\n
gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n
gadget_erp5_searchfield.html\n
gadget_erp5_searchfield.js\n
gadget_erp5_sort_editor.html\n
gadget_erp5_sort_editor.js\n
gadget_global.js\n
gadget_html5_element.html\n
gadget_html5_element.js\n
gadget_html5_input.html\n
gadget_html5_input.js\n
gadget_html5_textarea.html\n
gadget_html5_textarea.js\n
gadget_erp5_global.js\n
gadget_jio.html\n
gadget_jio.js\n
gadget_translate.html\n
gadget_translate.js\n
gadget_translation.html\n
gadget_translation.js\n
gadget_translation_data.js\n
handlebars.js\n
jiodev.js\n
jquery.js\n
jquerymobile.css\n
jquerymobile.js\n
renderjs.js\n
rsvp.js\n
gadget_interface_validator_page_form.html\n
gadget_interface_validator_page_form.js\n
gadget_interface_validator_page_report.html\n
gadget_interface_validator_page_report.js\n
gadget_erp5_page_validator_report.html\n
gadget_erp5_page_validator_report.js\n
gadget_erp5_page_validator_result_list.html\n
gadget_erp5_page_validator_result_list.js\n
gadget_interface_validator_panel.html\n
gadget_interface_validator_panel.js\n
gadget_interface_validator_reportpage_interface.html\n
gadget_interface_validator_router.html\n
gadget_interface_validator_router.js\n
gadget_interface_validator_jio.html\n
gadget_interface_validator_jio.js\n
gadget_interface.html\n
gadget_interface.js\n
NETWORK:\n
*</string> </value>
</item>
......@@ -264,7 +305,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.52766.8191.15001</string> </value>
<value> <string>968.34429.27639.36556</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -282,7 +323,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1476100685.39</float>
<float>1530201523.97</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,17 +3,20 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Gadget Interface Validator Router</title>
<title>Jio Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_interface_validator_router.js" type="text/javascript"></script>
<script src="gadget_interface_validator_jio.js"
type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_selection"></div>
<div data-gadget-url='gadget_jio.html' data-gadget-scope='jio'></div>
</body>
</html>
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -75,17 +73,15 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_page_form.html</string> </value>
<value> <string>gadget_interface_validator_jio.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<value> <string>Jio access</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_interface_validator_page_form_html</string> </value>
<value> <string>gadget_interface_validator_jio_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -103,7 +99,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Formpage</string> </value>
<value> <string>Jio Gadget for Interface Validator</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -189,7 +185,7 @@
</tuple>
<state>
<tuple>
<float>1444137927.14</float>
<float>1530086705.78</float>
<string>UTC</string>
</tuple>
</state>
......@@ -234,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.46342.43288.26299</string> </value>
<value> <string>968.32517.6375.25565</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1445964472.82</float>
<float>1530087047.36</float>
<string>UTC</string>
</tuple>
</state>
......@@ -309,7 +305,7 @@
</tuple>
<state>
<tuple>
<float>1444137350.69</float>
<float>1530086631.3</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, jIO, QueryFactory, SimpleQuery */
/*jslint indent: 2, maxerr: 3, nomen: true */
(function (window, rJS, RSVP, jIO, QueryFactory, SimpleQuery) {
"use strict";
//////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////
function endsWith(str, suffix) {
// http://simonwillison.net/2006/Jan/20/escape/
suffix = suffix.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
return (new RegExp(suffix + '$', 'i')).test(str);
}
function fetchAppcacheData(appcache_url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
url: appcache_url,
dataType: 'text'
});
})
.push(function (evt) {
return evt.target.responseText.split('\n');
});
}
function filterGadgetList(filename_list) {
// XXX Filtering should be done instead by loading
// each URL and report which one are correctly
// loaded gadget
var gadget_list = [],
i;
for (i = 0; i < filename_list.length; i += 1) {
if (endsWith(filename_list[i], '.html') &&
(filename_list[i][0] !== '#')) {
gadget_list.push(filename_list[i]);
}
}
return gadget_list;
}
function wrapJioCall(gadget, method_name, argument_list) {
var storage = gadget.state_parameter_dict.jio_storage;
return storage[method_name].apply(storage, argument_list);
}
//////////////////////////////////////////////
// Storage
//////////////////////////////////////////////
function InterfaceValidatorStorage() {
return;
}
InterfaceValidatorStorage.prototype.hasCapacity = function (name) {
// XXX That's a lie
// This can not do all this thing for now
// But displaying the listbox requires those capacities
return ((name === "list") || (name === "query") ||
(name === "select") || (name === "limit") ||
(name === "sort"));
};
InterfaceValidatorStorage.prototype.buildQuery = function (options) {
// XXX HARDCODED
var query = QueryFactory.create(options.query || '');
if (!((query instanceof SimpleQuery) && (query.key === 'appcache_url'))) {
// Only accept simple query with an appcache_url
return [];
}
return fetchAppcacheData(query.value)
// return fetchAppcacheData('gadget_interface_validator_test.appcache')
.push(function (filename_list) {
return filterGadgetList(filename_list);
})
.push(function (url_list) {
// XXX Sort to stabilize the tests
url_list.sort();
var result_list = [],
i;
for (i = 0; i < url_list.length; i += 1) {
result_list.push({
id: url_list[i],
value: {url: url_list[i]},
doc: {}
});
}
return result_list;
});
};
InterfaceValidatorStorage.prototype.get = function (id) {
return {
portal_type: 'Gadget URL Definition',
url: id
};
};
jIO.addStorage('interface_validator', InterfaceValidatorStorage);
rJS(window)
.ready(function (gadget) {
return gadget.getDeclaredGadget('jio')
.push(function (jio_gadget) {
// Initialize the gadget local parameters
gadget.state_parameter_dict = {jio_storage: jio_gadget};
});
})
.declareMethod('createJio', function () {
return this.state_parameter_dict.jio_storage.createJio({
type: "interface_validator"
});
})
.declareMethod('allDocs', function () {
return wrapJioCall(this, 'allDocs', arguments);
})
.declareMethod('get', function () {
return wrapJioCall(this, 'get', arguments);
});
}(window, rJS, RSVP, jIO, QueryFactory, SimpleQuery));
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -71,7 +69,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_router.js</string> </value>
<value> <string>gadget_interface_validator_jio.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -81,7 +79,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_interface_validator_router_js</string> </value>
<value> <string>gadget_interface_validator_jio_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -99,7 +97,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Router JS</string> </value>
<value> <string>Jio Gadget for Interface Validator JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -185,7 +183,7 @@
</tuple>
<state>
<tuple>
<float>1444136829.68</float>
<float>1530086915.23</float>
<string>UTC</string>
</tuple>
</state>
......@@ -230,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.15281.35451.28142</string> </value>
<value> <string>968.34342.13291.34082</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1529052586.11</float>
<float>1530196276.82</float>
<string>UTC</string>
</tuple>
</state>
......@@ -305,7 +303,7 @@
</tuple>
<state>
<tuple>
<float>1444133648.6</float>
<float>1530086862.82</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Gadget Interface Validator Formpage</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_interface_validator_page_form.js" type="text/javascript"></script>
<!-- XXX must set theme here! -->
<script id="interface-validator-template" type="text/x-handlebars-template">
<div class="ui-grid-b ui-responsive">
<div class="ui-block-a"></div>
<div class="ui-block-b">
<form class="interface-validation-form">
<div class="ui-field-contain">
<label>Appcache URL</label>
<input type="text" name="appcache_url" placeholder="Appcache URL" value="" required>
</div>
<input data-inline="true" type="submit" value="Submit" data-theme="b" name="Submit">
</form>
<pre style="white-space: pre-wrap;">{{message}}</pre>
</div>
<div class="ui-block-c"></div>
</div>
</script>
</head>
<body>
<div class="appcache_form"></div>
<div data-gadget-url="gadget_interface.html"
data-gadget-scope="interface_gadget"
data-gadget-sandbox="public"></div>
<div class="validation_report"></div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars, $, loopEventListener */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS, RSVP, Handlebars, $, loopEventListener) {
"use strict";
var INTERFACE_GADGET_SCOPE = "interface_gadget",
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
gadget_klass = rJS(window),
source = gadget_klass.__template_element
.getElementById("interface-validator-template")
.innerHTML,
interface_validator_template = Handlebars.compile(source);
function fetchPageType(gadget_url) {
var page_type = '',
key = '_page_';
if (gadget_url.indexOf(key) > -1) {
page_type = gadget_url.substring(gadget_url.indexOf(key) + key.length,
gadget_url.lastIndexOf('.'));
}
return page_type;
}
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.ready(function (g) {
g.props = {};
})
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.content_element = element.querySelector('.appcache_form');
});
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
var error_message = '';
if (options.found !== undefined && options.found === 'false') {
error_message = "Error: Cannot load the appcache file. " +
"Please check and try again.";
}
gadget.props.content_element.innerHTML =
interface_validator_template({
message: error_message
});
$(gadget.props.element).trigger("create");
gadget.props.content_element.querySelector("input[type=submit]")
.disabled = false;
gadget.props.content_element.querySelector("input[type=text]")
.focus();
});
})
.declareService(function () {
////////////////////////////////////
// Form submit listening.
// Prevent browser to automatically handle the form submit in
// case of a bug
////////////////////////////////////
var gadget = this;
function formSubmit(submit_event) {
var interface_gadget,
appcache_url;
return new RSVP.Queue()
.push(function () {
gadget.props.content_element.querySelector("input[type=submit]")
.disabled = true;
return submit_event.target[0].value;
})
.push(function (submit_url) {
appcache_url = submit_url;
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);
})
.push(function (i_gadget) {
var required_interface =
'gadget_interface_validator_reportpage_interface.html',
gadget_source_url = 'gadget_interface_validator.appcache';
interface_gadget = i_gadget;
return interface_gadget.getGadgetListImplementingInterface(
required_interface,
gadget_source_url
);
})
.push(function (gadget_list) {
if (gadget_list.length > 0) {
var page_type = fetchPageType(gadget_list[0]);
return gadget.redirect({
page: page_type,
appcache_url: appcache_url
});
}
return gadget.redirect({
found: false
});
});
}
// Listen to form submit
return loopEventListener(
gadget.props.content_element.querySelector(
'form.interface-validation-form'
),
'submit',
false,
formSubmit
);
});
}(window, rJS, RSVP, Handlebars, $, loopEventListener));
\ No newline at end of file
......@@ -3,50 +3,20 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Gadget Interface Validator Reportpage</title>
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_reportpage_interface.html">
<title>Interface Validator Page Report</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_interface_validator_page_report.js" type="text/javascript"></script>
<script id="report-widget-table" type="text/x-handlebars-template">
<table class="ui-responsive ui-body-c ui-table-inset custom-force-list">
<thead class="ui-bar-inherit">
<tr>
{{#each column_list}}
<th>{{this}}</th>
{{/each}}
</tr>
</thead>
{{> report-widget-table-partial}}
<tfoot class="ui-bar-inherit"></tfoot>
</table>
</script>
<script id="report-widget-table-partial" type="text/x-handlebars-template">
<tbody>
{{#each row_list}}
<tr id = {{default_id}}>
{{#each cell_list}}
<td class={{default_class}}>{{value}}</td>
{{/each}}
</tr>
{{/each}}
</tbody>
</script>
<script src="gadget_erp5_page_validator_report.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_interface.html"
data-gadget-scope="interface_gadget"
data-gadget-sandbox="public"></div>
<div class="validation_report"></div>
<div data-gadget-url="gadget_erp5_pt_form_view.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</body>
</html>
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -75,7 +73,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_page_report.html</string> </value>
<value> <string>gadget_erp5_page_validator_report.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -103,7 +101,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Reportpage</string> </value>
<value> <string>Gadget Interface Validator Report</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -189,7 +187,7 @@
</tuple>
<state>
<tuple>
<float>1444139553.25</float>
<float>1530102579.71</float>
<string>UTC</string>
</tuple>
</state>
......@@ -234,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.45995.23548.62924</string> </value>
<value> <string>968.32782.54767.17032</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1445964486.74</float>
<float>1530102674.2</float>
<string>UTC</string>
</tuple>
</state>
......@@ -309,7 +307,7 @@
</tuple>
<state>
<tuple>
<float>1444138661.93</float>
<float>1530102237.61</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, Handlebars, loopEventListener, $, document */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS, RSVP, Handlebars, loopEventListener, $, document) {
/*global window, rJS*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
var INTERFACE_GADGET_SCOPE = "interface_gadget",
rJS(window)
/////////////////////////////////////////////////////////////////
// Handlebars
// Acquired methods
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
report_widget_table = Handlebars.compile(
templater.getElementById("report-widget-table").innerHTML
);
function renderInitialReport(gadget, gadget_list) {
var row_list = [],
column_list = ['Gadget Name', 'Declared Interfaces', 'Validation Status'],
cell_list,
default_status = "In Progress",
content = '',
i;
for (i = 0; i < gadget_list.length; i += 1) {
cell_list = [{
default_class: "gadget_name",
value: gadget_list[i]
}, {
default_class: "interface_list",
value: default_status
}, {
default_class: "validation_status",
value: default_status
}];
row_list.push({
"cell_list": cell_list,
"default_id": gadget_list[i].substr(0, gadget_list[i].indexOf('.'))
});
}
content += report_widget_table({
column_list: column_list,
row_list: row_list
});
gadget.props.content_element.innerHTML = content;
$(gadget.props.element).trigger("create");
}
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
function verifyGadgetImplementation(gadget, verify_gadget_url) {
var interface_gadget,
interface_list = [],
default_validation_status = {result: "N/A"};
return new RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);
})
.push(function (i_gadget) {
interface_gadget = i_gadget;
return interface_gadget.getDeclaredGadgetInterfaceList(
verify_gadget_url
);
})
.push(function (temp_interface_list) {
interface_list = temp_interface_list;
if (interface_list.length > 0) {
return interface_gadget.verifyGadgetInterfaceImplementation(
verify_gadget_url
);
}
return default_validation_status;
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
.push(function (validation_status) {
return [interface_list, validation_status];
}, function (error) {
default_validation_status.result = false;
default_validation_status.result_message = "Error with gadget loading";
default_validation_status.details = error.message;
return [interface_list, default_validation_status];
});
}
function updateReportData(gadget, report_data) {
var id = "#" + report_data.id.replace('/', '\\/'),
update_element = gadget.props.content_element.querySelector(id),
interface_data = '',
validation_status = report_data.validation_status,
validation_message = report_data.validation_message,
i,
interface_name;
if (report_data.interface_list.length) {
for (i = 0; i < report_data.interface_list.length; i += 1) {
interface_name = report_data.interface_list[i].substr(
report_data.interface_list[i].lastIndexOf('/') + 1
);
interface_data += (interface_name + '<br />');
}
} else {
interface_data = 'None';
}
if (report_data.validation_status === true) {
validation_status = "Success";
update_element.setAttribute('style', 'color: green');
}
if (report_data.validation_status === false) {
validation_status =
(validation_message !== undefined ? validation_message : "Failure");
update_element.setAttribute('style', 'cursor: pointer; color: red');
update_element.className += "error expand";
}
gadget.props.error_data[report_data.id] = report_data.error_detail;
update_element.querySelector(".validation_status").innerHTML =
validation_status;
update_element.querySelector(".validation_status").className += " final";
update_element.querySelector(".interface_list").innerHTML = interface_data;
}
function updateGadgetData(gadget, verify_gadget_url) {
return RSVP.Queue()
.push(function () {
return verifyGadgetImplementation(gadget, verify_gadget_url);
.declareMethod("render", function (options) {
return this.changeState(options);
})
.push(function (verify_result) {
var result_dict = {
id: verify_gadget_url.substr(0, verify_gadget_url.indexOf('.')),
gadget_name: verify_gadget_url,
interface_list: verify_result[0],
validation_status: verify_result[1].result,
validation_message: verify_result[1].result_message,
error_detail: verify_result[1].details
};
return updateReportData(gadget, result_dict);
});
}
function validateAppGadgetList(gadget, gadget_list) {
var i;
for (i = 0; i < gadget_list.length; i += 1) {
updateGadgetData(gadget, gadget_list[i]);
}
}
function toggleErrorRow(gadget, source_element) {
if (source_element.className.indexOf("expand") > -1) {
var error_tr = document.createElement('tr'),
error_td = error_tr.insertCell(0);
error_tr.id = source_element.id + '_errordata';
error_td.className = 'errordata';
error_td.colSpan = "3";
error_td.innerText = gadget.props.error_data[source_element.id];
source_element.parentNode.insertBefore(error_tr,
source_element.nextSibling);
source_element.className = source_element.className.replace("expand",
"shrink");
} else if (source_element.className.indexOf("shrink") > -1) {
source_element.parentNode.removeChild(source_element.nextSibling);
source_element.className = source_element.className.replace("shrink",
"expand");
}
return;
}
Handlebars.registerPartial(
"report-widget-table-partial",
templater.getElementById("report-widget-table-partial").innerHTML
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.ready(function (g) {
g.props = {};
g.props.error_data = {};
})
.onStateChange(function () {
var gadget = this;
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.content_element = element.querySelector('.validation_report');
return gadget.getUrlForList([{
command: 'display_stored_state',
options: {page: 'validator_result_list'}
}, {
command: 'selection_previous'
}, {
command: 'selection_next'
}])
.push(function (url_list) {
return gadget.updateHeader({
selection_url: url_list[0],
// previous_url: url_list[1],
// next_url: url_list[2],
page_title: gadget.state.jio_key
});
})
.declareMethod("render", function (options) {
var gadget = this,
appcache_url = options.appcache_url,
gadget_list;
return new RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);
return gadget.getDeclaredGadget('form_view');
})
.push(function (interface_gadget) {
return interface_gadget.getGadgetListFromAppcache(appcache_url);
})
.push(function (filtered_gadget_list) {
gadget_list = filtered_gadget_list;
return renderInitialReport(gadget, gadget_list);
})
.push(function () {
return validateAppGadgetList(gadget, gadget_list);
}, function () {
return gadget.redirect({
found: false
.push(function (form_gadget) {
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"title": {
description: "",
title: "Title",
"default": gadget.state.jio_key,
css_class: "",
required: null,
editable: 0,
key: "title",
hidden: 0,
type: "StringField"
},
"text_content": {
description: "",
title: "State",
"default": gadget.state.jio_key,
css_class: "",
required: null,
editable: 0,
url: "gadget_interface.html",
sandbox: "",
renderjs_extra: JSON.stringify({
gadget_to_check_url: gadget.state.jio_key,
summary: false
}),
key: "text_content",
hidden: 0,
type: "GadgetField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"center", [["title"], ["text_content"]]
]]
}
});
});
})
.declareMethod("reportPageDummyMethod1", function () {
// A dummy method to fulfil the interface implementation requirement.
return;
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared services
/////////////////////////////////////////////////////////////////
.declareService(function () {
var gadget = this;
function rowSubmit(submit_data) {
var parent_element = submit_data.target.parentElement;
if (parent_element.className.indexOf("error") > -1) {
return toggleErrorRow(gadget, parent_element);
}
}
return loopEventListener(
gadget.props.content_element,
'click',
false,
rowSubmit
);
});
}(window, rJS, RSVP, Handlebars, loopEventListener, $, document));
\ No newline at end of file
}(window, rJS));
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -71,7 +69,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_page_report.js</string> </value>
<value> <string>gadget_erp5_page_validator_report.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -99,7 +97,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Reportpage JS</string> </value>
<value> <string>Gadget Interface Validator Report JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -185,7 +183,7 @@
</tuple>
<state>
<tuple>
<float>1444138717.03</float>
<float>1530102584.66</float>
<string>UTC</string>
</tuple>
</state>
......@@ -230,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.15263.39947.11758</string> </value>
<value> <string>968.35510.31803.22118</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1529051525.57</float>
<float>1530266369.99</float>
<string>UTC</string>
</tuple>
</state>
......@@ -305,7 +303,7 @@
</tuple>
<state>
<tuple>
<float>1444138661.94</float>
<float>1530102251.09</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Interface Validator Page Result List</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_validator_result_list.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html"
data-gadget-scope="form_list"
data-gadget-sandbox="public">
</div>
</body>
</html>
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -75,7 +73,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_router.html</string> </value>
<value> <string>gadget_erp5_page_validator_result_list.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -85,7 +83,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_interface_validator_router_html</string> </value>
<value> <string>gadget_interface_validator_page_result_list_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -103,7 +101,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Router</string> </value>
<value> <string>Gadget Interface Validator Result List</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -189,7 +187,7 @@
</tuple>
<state>
<tuple>
<float>1444136839.34</float>
<float>1530085036.04</float>
<string>UTC</string>
</tuple>
</state>
......@@ -234,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.44766.54929.30600</string> </value>
<value> <string>968.32488.17521.20138</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1446476270.36</float>
<float>1530085029.94</float>
<string>UTC</string>
</tuple>
</state>
......@@ -309,7 +307,7 @@
</tuple>
<state>
<tuple>
<float>1444133648.59</float>
<float>1530084873.58</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function () {
return;
})
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, date, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
result.data.rows[i].value.validation_state = {
field_gadget_param: {
description: "",
title: "State",
"default": "",
css_class: "",
required: null,
editable: 0,
url: "gadget_interface.html",
sandbox: "",
renderjs_extra: JSON.stringify({
gadget_to_check_url: result.data.rows[i].value.url,
summary: true
}),
key: "field_my_validation_state",
hidden: 0,
type: "GadgetField"
}
};
}
return result;
});
})
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod("render", function () {
var gadget = this;
return gadget.getUrlFor({
command: 'change',
options: {page: "jabberclient_new_contact"}
})
.push(function (url) {
return gadget.updateHeader({
page_title: 'Gadgets',
page_icon: 'puzzle-piece',
filter_action: true
// add_url: url
});
})
.push(function () {
return gadget.getDeclaredGadget('form_list');
})
.push(function (form_gadget) {
var column_list = [
['url', 'Gadget'],
['validation_state', 'State']
];
return form_gadget.render({
erp5_document: {"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": 100,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs",
"portal_type": [],
"search_column_list": [['appcache_url', 'Appcache']],
"sort_column_list": [],
"sort": [],
"title": "Gadgets",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
});
});
});
}(window, rJS));
\ No newline at end of file
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -71,7 +69,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_page_form.js</string> </value>
<value> <string>gadget_erp5_page_validator_result_list.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -81,7 +79,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_interface_validator_page_form_js</string> </value>
<value> <string>gadget_interface_validator_page_result_list_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -99,7 +97,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator Formpage JS</string> </value>
<value> <string>Gadget Interface Validator Result List JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -185,7 +183,7 @@
</tuple>
<state>
<tuple>
<float>1444137933.26</float>
<float>1530085115.14</float>
<string>UTC</string>
</tuple>
</state>
......@@ -230,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.15277.3815.5239</string> </value>
<value> <string>968.34322.25774.2099</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1529052317.55</float>
<float>1530195129.2</float>
<string>UTC</string>
</tuple>
</state>
......@@ -305,7 +303,7 @@
</tuple>
<state>
<tuple>
<float>1444137350.68</float>
<float>1530085046.39</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,47 +4,72 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Gadget Interface Validator Panel</title>
<!--
data-i18n=Editable
-->
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquerymobile.js" type="text/javascript"></script>
<script id="panel-template-header" type="text/x-handlebars-template">
<div data-role="header" class="ui-bar-inherit">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">
<div class="ui-controlgroup-controls">
<form action="#" method="post">
<input type="submit" data-i18n="[value]Close" data-icon="delete" data-iconpos="notext" value="Close" />
</form>
</div>
</div>
<img class="ui-title" alt="ERP5" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAAA/CAMAAADaDqrIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMEM5NUE4MzQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMEM5NUE4NDQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAwQzk1QTgxNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAwQzk1QTgyNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+J9MJsAAAAwBQTFRF///////M//+Z//9m//8z//8A/8z//8zM/8yZ/8xm/8wz/8wA/5n//5nM/5mZ/5lm/5kz/5kA/2b//2bM/2aZ/2Zm/2Yz/2YA/zP//zPM/zOZ/zNm/zMz/zMA/wD//wDM/wCZ/wBm/wAz/wAAzP//zP/MzP+ZzP9mzP8zzP8AzMz/zMzMzMyZzMxmzMwzzMwAzJn/zJnMzJmZzJlmzJkzzJkAzGb/zGbMzGaZzGZmzGYzzGYAzDP/zDPMzDOZzDNmzDMzzDMAzAD/zADMzACZzABmzAAzzAAAmf//mf/Mmf+Zmf9mmf8zmf8Amcz/mczMmcyZmcxmmcwzmcwAmZn/mZnMmZmZmZlmmZkzmZkAmWb/mWbMmWaZmWZmmWYzmWYAmTP/mTPMmTOZmTNmmTMzmTMAmQD/mQDMmQCZmQBmmQAzmQAAZv//Zv/MZv+ZZv9mZv8zZv8AZsz/ZszMZsyZZsxmZswzZswAZpn/ZpnMZpmZZplmZpkzZpkAZmb/ZmbMZmaZZmZmZmYzZmYAZjP/ZjPMZjOZZjNmZjMzZjMAZgD/ZgDMZgCZZgBmZgAzZgAAM///M//MM/+ZM/9mM/8zM/8AM8z/M8zMM8yZM8xmM8wzM8wAM5n/M5nMM5mZM5lmM5kzM5kAM2b/M2bMM2aZM2ZmM2YzM2YAMzP/MzPMMzOZMzNmMzMzMzMAMwD/MwDMMwCZMwBmMwAzMwAAAP//AP/MAP+ZAP9mAP8zAP8AAMz/AMzMAMyZAMxmAMwzAMwAAJn/AJnMAJmZAJlmAJkzAJkAAGb/AGbMAGaZAGZmAGYzAGYAADP/ADPMADOZADNmADMzADMAAAD/AADMAACZAABmAAAzAAAAHHa7K3/AOojESZHJWZvNaKTSd63Whrbblb/fpMjks9Howtrt4e320uTx8Pb6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdfKHSQAAAOh0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ALItoLoAAAJkSURBVHja7NlZsqsgEABQ979C5kGGddxo4os0Q8BAynoFn0nUU23TNGRB9xzLdE3XdE3XdP2fLnIzF2VSrsYvC72HizAh9eZ5DVuOl15S4/jWwC+kDC8HPzCSJVHcRY8QXV2PwQuujUYTsYrvYlBv1yKLrsXHsPghnvR3Lazoip/JKuwpF8sm6/bY01Ow9CBlTXi53PNoRcUktEZT1NV1PIPnXAjtMJIMlzerFIzU1dVWF7aPj3Tetae4gjdxktG2et/qQjJ4kZFrv6ED4bK4eR1qduHzvEi4+PbGwD0EGu9CQQLFrv1F4jBc6BcuW3YhkPiPX1hOfxQvnHfh0HVMRqc4HuqiQf5k3mO6dq1s8Hx0H/Le5kq9YaNcxAcrZLpOvAv+ClcgNcZFtnrucd5Fwx4mXj0drnbBYXMuJmFDAV3Uhm4qlbHh3ddOrmholHNxFTVC+xTl2mf6pI4uVe4LwSp0DPGOmh/hAnM94bKZjkHlWuiLeV+cTab4luMKk82wy/Px2fLJskvKUk03hRf9RZ0wiYiZ4uVwVwTb9E71y0XboTYXGuTaa33Y47W5zBjXM3P11y7TfR2ycFdxyaW7uwSc5m0un9ix91m3TWJfW+1ijfW+wcVAfjS5dOP62LyvZZdcLHnA1MkFAtbgwq+Vm47po8OA1buwyy/a1ec5urzveAes2sV8kfW963mFaHNhlT0b6+Yi5+StchH1CtaK0ThXELDPLiyOPZHldzm/J1z9O/B14g7/K+DtkP7U8ivSeD4xaPCTSQvy+YIfubZWzRgtRe1iMP+3mq7pmq7p6jv+BBgAPrgi/TzwWzkAAAAASUVORK5CYII="/>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
<div class="ui-controlgroup-controls">
<a href="#" class="ui-btn ui-btn-icon-notext ui-icon-home" data-i18n="Home">Home</a>
<button data-i18n="Close" class="ui-btn ui-btn-icon-notext ui-icon-delete">Close</button>
</div>
</div>
<!--div class="panel_img">
<img class="ui-title" alt="ERP5" src="gadget_erp5_panel.png?format=png"/>
</div-->
</div>
</script>
<script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content">
<ul data-role="listview" class="ui-listview">
<li><a href="#page=form" data-i18n="Interface Validation Form">Interface Validation Form</a></li>
</ul>
<!--form class="dialog_form">
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-action ui-btn-icon-right ui-screen-hidden">Submit</button>
<div data-gadget-url="gadget_erp5_searchfield.html"
data-gadget-scope="erp5_searchfield"
data-gadget-sandbox="public"></div>
</form-->
<ul data-role="listview" class="ui-listview" data-enhanced="true"></ul>
<div data-gadget-url="gadget_erp5_field_checkbox.html"
data-gadget-scope="erp5_checkbox"
data-gadget-sandbox="public"></div>
<dl></dl>
</div>
</script>
<script id="panel-template-body-list" type="text/x-handlebars-template">
</script>
<!--script id="panel-template-body-desktop" type="text/x-handlebars-template">
<dt class="ui-content-title ui-body-c ui-btn ui-btn-icon-left ui-icon-eye" data-i18n="Views">Views</dt>
{{#each view_list}}
<dd data-role="listview" data-theme="c" data-inset="true" class="document-listview">
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
<dt class="ui-content-title ui-body-c ui-btn ui-btn-icon-left ui-icon-cogs" data-i18n="Decisions">Decisions</dt>
{{#each workflow_list}}
<dd data-role="listview" data-theme="c" data-inset="true" class="document-listview">
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
</script-->
<!-- custom script -->
<script src="gadget_interface_validator_panel.js" type="text/javascript"></script>
</head>
<body>
<div class="jqm-navmenu-panel"></div>
</body>
</html>
\ No newline at end of file
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.54879.52570.13994</string> </value>
<value> <string>968.34031.5357.24490</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1446805712.99</float>
<float>1530195837.23</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, Handlebars, jQuery, RSVP, loopEventListener */
(function (window, rJS, Handlebars, $, RSVP, loopEventListener) {
/*jslint nomen: true, indent: 2, maxerr: 3, unparam: true */
/*global window, document, rJS, Handlebars, RSVP, Node, loopEventListener */
(function (window, document, rJS, Handlebars, RSVP, Node, loopEventListener) {
"use strict";
/////////////////////////////////////////////////////////////////
// temlates
/////////////////////////////////////////////////////////////////
// Precompile templates while loading the first gadget instance
var gadget_klass = rJS(window),
source_header = gadget_klass.__template_element
template_element = gadget_klass.__template_element,
panel_template_header = Handlebars.compile(template_element
.getElementById("panel-template-header")
.innerHTML,
panel_template_header = Handlebars.compile(source_header),
source_body = gadget_klass.__template_element
.innerHTML),
panel_template_body = Handlebars.compile(template_element
.getElementById("panel-template-body")
.innerHTML,
panel_template_body = Handlebars.compile(source_body);
.innerHTML),
panel_template_body_list = Handlebars.compile(template_element
.getElementById("panel-template-body-list")
.innerHTML);
gadget_klass
.setState({
visible: false,
desktop: false
})
//////////////////////////////////////////////
// acquired method
//////////////////////////////////////////////
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
// Assign the element to a variable
// Init local properties
.ready(function (g) {
g.props = {};
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('toggle', function () {
return this.changeState({
visible: !this.state.visible
});
})
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.jelement = $(element.querySelector("div"));
.declareMethod('close', function () {
return this.changeState({
visible: false
});
})
.ready(function (g) {
g.props.jelement.panel({
display: "overlay",
position: "left",
theme: "d"
// animate: false
.declareMethod('render', function (options) {
var erp5_document = options.erp5_document,
workflow_list,
view_list,
context = this;
if (erp5_document !== undefined) {
workflow_list = erp5_document._links.action_workflow || [];
view_list = erp5_document._links.action_object_view || [];
if (workflow_list.constructor !== Array) {
workflow_list = [workflow_list];
}
if (view_list.constructor !== Array) {
view_list = [view_list];
}
// Prevent has much as possible to modify the DOM panel
// stateChange prefer to compare strings
workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list);
}
return context.getUrlParameter('editable')
.push(function (editable) {
return context.changeState({
workflow_list: workflow_list,
view_list: view_list,
global: true,
editable: options.editable || editable || false
});
});
})
.onStateChange(function (modification_dict) {
var context = this,
queue = new RSVP.Queue(),
tmp_element;
if (modification_dict.hasOwnProperty("visible")) {
if (this.state.visible) {
if (!this.element.classList.contains('visible')) {
this.element.classList.toggle('visible');
}
} else {
if (this.element.classList.contains('visible')) {
this.element.classList.remove('visible');
}
}
}
.declareMethod('render', function () {
var g = this;
return g.translateHtml(panel_template_header() + panel_template_body())
if (modification_dict.hasOwnProperty("global")) {
queue
.push(function () {
// XXX: Customize panel header!
return context.translateHtml(
panel_template_header() +
panel_template_body()
);
})
.push(function (my_translated_or_plain_html) {
g.props.jelement.html(my_translated_or_plain_html);
g.props.jelement.trigger("create");
tmp_element = document.createElement('div');
tmp_element.innerHTML = my_translated_or_plain_html;
context.element.querySelector("div").appendChild(tmp_element);
return context.listenResize();
});
})
}
.declareMethod('toggle', function () {
this.props.jelement.panel("toggle");
if (modification_dict.hasOwnProperty("editable")) {
queue
// Update the global links
.push(function () {
return RSVP.all([
context.getUrlFor({command: 'display', options: {page: "validator_form"}})
]);
})
.declareMethod('close', function () {
this.props.jelement.panel("close");
.push(function (result_list) {
return context.translateHtml(
panel_template_body_list({
"form_href": result_list[0]
})
);
})
/////////////////////////////////////////////////////////////////
// declared services
/////////////////////////////////////////////////////////////////
.declareService(function () {
var panel_gadget,
form_list,
event_list,
i,
len;
function formSubmit() {
panel_gadget.toggle();
.push(function (result) {
context.element.querySelector("ul").innerHTML = result;
});
}
panel_gadget = this;
form_list = panel_gadget.props.element.querySelectorAll('form');
event_list = [];
// XXX: not robust - Will break when search field is active
for (i = 0, len = form_list.length; i < len; i += 1) {
event_list[i] = loopEventListener(
form_list[i],
'submit',
false,
formSubmit
/*
if ((this.state.global === true) &&
(modification_dict.hasOwnProperty("desktop") ||
modification_dict.hasOwnProperty("editable") ||
modification_dict.hasOwnProperty("workflow_list") ||
modification_dict.hasOwnProperty("view_list"))) {
if (!(this.state.desktop && (this.state.view_list !== undefined))) {
queue
.push(function () {
gadget.element.querySelector("dl").textContent = '';
});
} else {
queue
.push(function () {
var i = 0,
promise_list = [],
workflow_list = JSON.parse(gadget.state.workflow_list),
view_list = JSON.parse(gadget.state.view_list);
for (i = 0; i < workflow_list.length; i += 1) {
promise_list.push(
gadget.getUrlFor({
command: 'change',
options: {
view: workflow_list[i].href,
page: undefined
}
})
);
}
for (i = 0; i < view_list.length; i += 1) {
promise_list.push(
gadget.getUrlFor({
command: 'change',
options: {
view: view_list[i].href,
page: undefined
}
})
);
}
return RSVP.all(promise_list);
})
.push(function (result_list) {
var i,
result_workflow_list = [],
result_view_list = [],
workflow_list = JSON.parse(gadget.state.workflow_list),
view_list = JSON.parse(gadget.state.view_list);
for (i = 0; i < workflow_list.length; i += 1) {
result_workflow_list.push({
title: workflow_list[i].title,
href: result_list[i]
});
}
for (i = 0; i < view_list.length; i += 1) {
result_view_list.push({
title: view_list[i].title,
href: result_list[i + workflow_list.length]
});
}
gadget.element.querySelector("dl").innerHTML = panel_template_body_desktop({
workflow_list: result_workflow_list,
view_list: result_view_list
});
});
}
}
*/
return queue;
})
return new RSVP.Queue()
.push(function () {
return RSVP.all(event_list);
.declareJob('listenResize', function () {
// resize should be only trigger after the render method
// as displaying the panel rely on external gadget (for translation for example)
var result,
event,
context = this;
function extractSizeAndDispatch() {
if (window.matchMedia("(min-width: 85em)").matches) {
return context.changeState({
desktop: true
});
}
return context.changeState({
desktop: false
});
}
result = loopEventListener(window, 'resize', false,
extractSizeAndDispatch);
event = document.createEvent("Event");
event.initEvent('resize', true, true);
window.dispatchEvent(event);
return result;
})
.onEvent('click', function (evt) {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.tagName === 'BUTTON')) {
return this.toggle();
}
}, false, false);
}(window, rJS, Handlebars, jQuery, RSVP, loopEventListener));
\ No newline at end of file
}(window, document, rJS, Handlebars, RSVP, Node, loopEventListener));
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.32925.58228.494</string> </value>
<value> <string>968.34033.5348.45653</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476099637.97</float>
<float>1530177764.85</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, document, loopEventListener, RSVP */
/*jslint nomen: true, indent: 2, maxlen: 80 */
(function (window, rJS, document, loopEventListener, RSVP) {
"use strict";
var MAIN_PAGE_PREFIX = "gadget_interface_validator_",
DEFAULT_PAGE = "form",
REDIRECT_TIMEOUT = 5000;
function listenHashChange(gadget) {
function extractHashAndDispatch(evt) {
var hash = (evt.newURL || window.location.toString()).split('#')[1],
subhashes,
subhash,
keyvalue,
index,
args = {};
if (hash !== undefined) {
subhashes = hash.split('&');
for (index in subhashes) {
if (subhashes.hasOwnProperty(index)) {
subhash = subhashes[index];
if (subhash !== '') {
keyvalue = subhash.split('=');
if (keyvalue.length === 2) {
args[decodeURIComponent(keyvalue[0])] =
decodeURIComponent(keyvalue[1]);
}
}
}
}
}
return gadget.renderApplication({
args: args
});
}
var result = loopEventListener(window, 'hashchange', false,
extractHashAndDispatch),
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
window.dispatchEvent(event);
return result;
}
rJS(window)
.ready(function (gadget) {
gadget.props = {
start_deferred: RSVP.defer()
};
})
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
key;
result = "#";
for (key in options) {
if (options.hasOwnProperty(key) && options[key] !== undefined) {
// Don't keep empty values
result += prefix + encodeURIComponent(key) + "=" +
encodeURIComponent(options[key]);
prefix = '&';
}
}
return result;
})
.declareMethod('redirect', function (options) {
return this.getCommandUrlFor(options)
.push(function (hash) {
window.location.replace(hash);
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
});
})
.declareMethod('route', function (options) {
var args = options.args,
page;
page = args.page || DEFAULT_PAGE;
return {
url: MAIN_PAGE_PREFIX + "page_" + page + ".html",
options: args
};
})
.declareAcquiredMethod('renderApplication', 'renderApplication')
.declareMethod('start', function () {
this.props.start_deferred.resolve();
})
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
});
}(window, rJS, document, loopEventListener, RSVP));
\ No newline at end of file
......@@ -6,24 +6,6 @@
</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>Authenticated</string>
<string>Author</string>
<string>Manager</string>
<string>Member</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
......@@ -67,24 +49,7 @@
<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>Authenticated</string>
<string>Author</string>
<string>Manager</string>
<string>Member</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
......@@ -111,13 +76,6 @@
<value>
<list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</list>
</value>
</item>
......@@ -136,50 +94,6 @@
<key> <string>__before_traverse__</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/bug_tracker</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_ecommerce</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_ehr</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_eprocurement</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
......@@ -188,40 +102,7 @@
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/officejs_text_editor</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/renderjs_runner</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/spread</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -230,13 +111,13 @@
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
......@@ -246,7 +127,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>frontpage_gadget_url</string> </value>
<value> <string>configuration_content_security_policy</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -256,7 +137,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_frontpage_gadget_url</string> </value>
<value> <string>configuration_translation_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -276,7 +157,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_hateoas_url</string> </value>
<value> <string>configuration_router_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -286,7 +167,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_view_action_category</string> </value>
<value> <string>configuration_manifest_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -296,7 +177,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_default_view_action_reference</string> </value>
<value> <string>configuration_jio_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -316,7 +197,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_router_gadget_url</string> </value>
<value> <string>configuration_x_frame_options</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -326,7 +207,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_jio_gadget_url</string> </value>
<value> <string>configuration_header_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -336,7 +217,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_translation_gadget_url</string> </value>
<value> <string>configuration_frontpage_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -346,7 +227,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_manifest_url</string> </value>
<value> <string>configuration_webapp_manifest_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -356,7 +237,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_header_gadget_url</string> </value>
<value> <string>configuration_stylesheet_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -366,7 +247,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_content_security_policy</string> </value>
<value> <string>configuration_default_jio_document_page_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
......@@ -379,19 +260,19 @@
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAw=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA0=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA4=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
......@@ -406,8 +287,8 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>aggregate/web_page_module/rjs_gadget_erp5_html</string>
<string>caching_policy/must-revalidate</string>
<string>aggregate/web_page_module/rjs_gadget_erp5_launcher_html</string>
</tuple>
</value>
</item>
......@@ -417,31 +298,25 @@
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' data:; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
<value> <string>default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
</item>
<item>
<key> <string>configuration_default_view_action_reference</string> </key>
<value>
<none/>
</value>
<key> <string>configuration_default_jio_document_page_gadget_url</string> </key>
<value> <string>validator_report</string> </value>
</item>
<item>
<key> <string>configuration_frontpage_gadget_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_hateoas_url</string> </key>
<value> <string>hateoas/</string> </value>
<value> <string>validator_result_list</string> </value>
</item>
<item>
<key> <string>configuration_header_gadget_url</string> </key>
<value> <string>gadget_officejs_header.html</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_erp5_jio.html</string> </value>
<value> <string>gadget_interface_validator_jio.html</string> </value>
</item>
<item>
<key> <string>configuration_manifest_url</string> </key>
......@@ -453,18 +328,32 @@
</item>
<item>
<key> <string>configuration_router_gadget_url</string> </key>
<value> <string>gadget_interface_validator_router.html</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_stylesheet_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_translation_gadget_url</string> </key>
<value> <string>gadget_translation.html</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_view_action_category</string> </key>
<key> <string>configuration_webapp_manifest_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_x_frame_options</string> </key>
<value> <string>SAMEORIGIN</string> </value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
......@@ -483,10 +372,6 @@
<none/>
</value>
</item>
<item>
<key> <string>frontpage_gadget_url</string> </key>
<value> <string>gadget_woelfel_pt_frontpage.html</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_interface_validator</string> </value>
......@@ -524,7 +409,7 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA8=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -539,68 +424,12 @@
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="7" aka="AAAAAAAAAAc=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="11" aka="AAAAAAAAAAs=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -615,7 +444,7 @@
</dictionary>
</pickle>
</record>
<record id="12" aka="AAAAAAAAAAw=">
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
......@@ -623,7 +452,7 @@
<none/>
</pickle>
</record>
<record id="13" aka="AAAAAAAAAA0=">
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -638,7 +467,7 @@
</dictionary>
</pickle>
</record>
<record id="14" aka="AAAAAAAAAA4=">
<record id="7" aka="AAAAAAAAAAc=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
......@@ -646,7 +475,7 @@
<none/>
</pickle>
</record>
<record id="15" aka="AAAAAAAAAA8=">
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -659,13 +488,13 @@
<item>
<key> <string>category_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABA=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAABE=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -674,7 +503,7 @@
</dictionary>
</pickle>
</record>
<record id="16" aka="AAAAAAAAABA=">
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......@@ -685,7 +514,9 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actor</string> </key>
......@@ -711,7 +542,7 @@
</tuple>
<state>
<tuple>
<float>1444138397.81</float>
<float>1530019487.06</float>
<string>UTC</string>
</tuple>
</state>
......@@ -720,14 +551,14 @@
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
<value> <string>embedded</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="17" aka="AAAAAAAAABE=">
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......@@ -756,7 +587,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.50251.37668.4232</string> </value>
<value> <string>968.34333.9892.31675</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -774,7 +605,7 @@
</tuple>
<state>
<tuple>
<float>1453976386.25</float>
<float>1530201187.52</float>
<string>UTC</string>
</tuple>
</state>
......
web_page_module/gadget_interface_js
web_page_module/gadget_interface_html
web_page_module/gadget_interface_validator_*
web_site_module/gadget_interface_validator*
\ No newline at end of file
web_site_module/gadget_interface_validator
\ No newline at end of file
web_page_module/gadget_interface_html
web_page_module/gadget_interface_js
web_page_module/gadget_interface_validator_*
web_site_module/gadget_interface_validator*
\ No newline at end of file
web_site_module/gadget_interface_validator
\ No newline at end of file
......@@ -20,115 +20,74 @@
<td>${base_url}/web_site_module/${application_title}/</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block tal:define="filter_section_configuration python: {'key': 'COLUMN_appcache_url', 'value': 'gadget_interface_validator_test.appcache', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_filter" />
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//form[@class='interface-validation-form']</td>
<td>waitForTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='Submit']</td>
<td>assertTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=appcache_url</td>
<td>${application_title}_test.appcache</td>
</tr>
<tr>
<td>click</td>
<td>//input[@name='Submit']</td>
<td>waitForTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//table</td>
<td>assertTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check correct use case</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_correct_implemented_gadget']//td[@class='validation_status final']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_correct_implemented_gadget']//td[@class='validation_status final']</td>
<td>Success</td>
</tr>
<tr>
<td colspan="3"><b>Check not existent gadget</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_nonexistent_gadget']//td[@class='validation_status final']</td>
<td></td>
<td>//tbody/tr/td</td>
<td>gadget_interface_validator_test_correct_implemented_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_nonexistent_gadget']//td[@class='validation_status final']</td>
<td>Error with gadget loading</td>
<td>//tbody/tr/td[2]</td>
<td>Success</td>
</tr>
<tr>
<td colspan="3"><b>Check interface with invalid syntax</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget']//td[@class='validation_status final']</td>
<td></td>
<td>assertText</td>
<td>//tbody/tr[2]/td</td>
<td>gadget_interface_validator_test_invalid_interface_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget']//td[@class='validation_status final']</td>
<td>//tbody/tr[2]/td[2]</td>
<td>Failure</td>
</tr>
<tr>
<td>click</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget']//td[@class='validation_status final']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget_errordata']//td[@class='errordata']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget_errordata']//td[@class='errordata']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget']//td[@class='validation_status final']</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//tr[@id='${application_title}_test_invalid_interface_gadget_errordata']//td[@class='errordata']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check missing interface</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_missing_interface_declaration_gadget']//td[@class='validation_status final']</td>
<td></td>
<td>assertText</td>
<td>//tbody/tr[3]/td</td>
<td>gadget_interface_validator_test_missing_interface_declaration_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_missing_interface_declaration_gadget']//td[@class='validation_status final']</td>
<td>//tbody/tr[3]/td[2]</td>
<td>N/A</td>
</tr>
......@@ -136,85 +95,44 @@
<td colspan="3"><b>Check missing method declaration</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@id='${application_title}_test_missing_method_declaration_gadget']//td[@class='validation_status final']</td>
<td></td>
<td>assertText</td>
<td>//tbody/tr[4]/td</td>
<td>gadget_interface_validator_test_missing_method_declaration_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_missing_method_declaration_gadget']//td[@class='validation_status final']</td>
<td>//tbody/tr[4]/td[2]</td>
<td>Failure</td>
</tr>
<tr>
<td colspan="3"><b>Check invalid appcache</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Interface Validation Form']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n='Interface Validation Form']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//form[@class='interface-validation-form']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=appcache_url</td>
<td>${application_title}_invalid.appcache</td>
<td colspan="3"><b>Check not existent gadget</b></td>
</tr>
<tr>
<td>click</td>
<td>//input[@name='Submit']</td>
<td></td>
<td>assertText</td>
<td>//tbody/tr[5]/td</td>
<td>gadget_interface_validator_test_nonexistent_gadget.html</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Error</td>
<td></td>
<td>assertText</td>
<td>//tbody/tr[5]/td[2]</td>
<td>Error with gadget loading</td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Error</td>
<td></td>
<!--tr>
<td colspan="3"><b>Check unknown method declaration</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td>//tr[@id='${application_title}_test_unknown_method_declaration_gadget']//td[@class='validation_status final']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n='Home']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//form[@class='interface-validation-form']</td>
<td></td>
</tr>
<td>assertText</td>
<td>//tr[@id='${application_title}_test_unknown_method_declaration_gadget']//td[@class='validation_status final']</td>
<td>Failure</td>
</tr-->
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -37,6 +37,7 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
def getBusinessTemplateList(self):
return (
'erp5_gadget_interface_validator',
'erp5_web_renderjs_ui_test',
'erp5_gadget_interface_validator_ui_test',
'erp5_ui_test_core',
)
......
......@@ -2,3 +2,4 @@ erp5_ui_test_core
erp5_ui_test
erp5_officejs
erp5_gadget_interface_validator
erp5_web_renderjs_ui_test
\ 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