Commit 93224584 authored by Boris Kocherov's avatar Boris Kocherov

add gadget_complex_demo_form.*

parent d0e105f1
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo UI OLAP Query editor based on JSON Schema form generator</title>
<link rel="stylesheet" href="../gadget_erp5_nojqm.css">
<script src="../rsvp.js"></script>
<script src="../renderjs.js"></script>
<script src="../jio.js"></script>
<script src="gadget_complex_demo_form.js"></script>
</head>
<body>
<div data-role="page">
<div role="main" class="ui-content gadget-content">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">
Demo UI OLAP Query editor based on JSON Schema form generator
</h3>
</section>
<div data-gadget-url="../jsonform.gadget.html"
data-gadget-scope="columns"
data-gadget-sandbox="public"></div>
<div data-gadget-url="../jsonform.gadget.html"
data-gadget-scope="rows"
data-gadget-sandbox="public"></div>
<br>
<div class="ui-body-c">
<div class="field_container">
<div class="left">
<div class="ui-field-contain">
<div data-gadget-url="../jsonform.gadget.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</div>
</div>
<div class="right">
<div class="ui-field-contain">
<label for="json_document_content">OLAP query settings</label>
<textarea name="json_document_content"
id="json_document_content"
title="Json Document"
spellcheck="false"
style="height: 1024px;font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;"
readonly
></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
/*jslint nomen: true, maxlen: 200, indent: 2*/
/*global rJS, console, window, document, RSVP, jIO*/
(function (window, rJS, jIO) {
"use strict";
function transform_olap_dimensions(g, dimensions) {
var dimension;
for (dimension in dimensions) {
if (dimensions.hasOwnProperty(dimension)) {
}
}
}
function generate_schema() {
}
function render_form(gadget, scope, schema) {
return gadget.getDeclaredGadget(scope)
.push(function (g) {
return g.render({
schema: schema
});
});
}
rJS(window)
.ready(function (g) {
g.props = {};
g.props.dimensions = {
"Time": [
{title: 'Year', const: '[Time].[Time].[Year]'},
{title: 'Quarter', const: '[Time].[Time].[Quarter]'}
],
"Product": [
{title: 'Product Family', const: '[Product].[Products].[Product Family]'},
{title: 'Product Department', const: '[Product].[Products].[Product Department]'},
{title: 'Product Category', const: '[Product].[Products].[Product Category]'}
]
};
g.props.dimensions = [
{title: 'Year', const: '[Time].[Time].[Year]'},
{title: 'Quarter', const: '[Time].[Time].[Quarter]'},
{title: 'Product Family', const: '[Product].[Products].[Product Family]'},
{title: 'Product Department', const: '[Product].[Products].[Product Department]'},
{title: 'Product Category', const: '[Product].[Products].[Product Category]'}
];
return RSVP.all([
render_form(g, "columns", {
title: "columns:",
type: "array",
items: {
oneOf: g.props.dimensions
}
}),
render_form(g, "rows", {
title: "rows:",
type: "array",
items: {
oneOf: g.props.dimensions
}
})
]);
})
.allowPublicAcquisition("notifyValid", function (arr, scope) {
})
.allowPublicAcquisition("notifyInvalid", function (arr, scope) {
})
.allowPublicAcquisition("notifyChange", function (arr, scope) {
var gadget = this;
if (['rows', 'columns'].indexOf(scope) >= 0) {
return this.getDeclaredGadget(scope)
.push(function (g) {
return g.getContent();
})
.push(function (ret) {
var z = {};
z[scope] = ret;
return gadget.changeState(z);
});
}
})
.onStateChange(function () {
var g = this;
document.getElementById("json_document_content").textContent =
JSON.stringify(g.state, null, 2);
});
}(window, rJS, jIO));
\ 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