0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-03-23 17:20:51 +01:00
parent 5640951c80
commit a5854290e9
62 changed files with 265 additions and 309 deletions

View File

@ -2,4 +2,5 @@ extends: eslint:recommended
rules:
no-undef: 0
no-redeclare: 0
no-mixed-spaces-and-tabs: 0
no-mixed-spaces-and-tabs: 0
no-console: 0

View File

@ -28,7 +28,7 @@
tip="_AddAddress"
on-click="onAddAddressClick"/>
</div>
<div id="form" class="address-list">
<div id="main" class="address-list">
<div class="card list">
<htk-radio-group
id="default-address"

View File

@ -37,7 +37,7 @@
tip="_Return"
on-click="onReturnClick"/>
</div>
<div id="form" class="address">
<div id="main" class="address">
<div class="card form">
<div>
<label><t>Name</t></label>

View File

@ -43,7 +43,7 @@
tip="_Change password"
on-click="onPassChangeClick"/>
</div>
<div id="form" class="conf">
<div id="main" class="conf">
<div class="card form">
<div>
<label for="user-name"><t>Username</t></label>

View File

@ -19,7 +19,7 @@
<h1 id="title">
<t>AccessLog</t>
</h1>
<div id="form" class="access-log">
<div id="main" class="access-log">
<div class="card form">
<p>
<htk-text form="user-form" column="Id_Cliente"/>

View File

@ -17,7 +17,7 @@
<t>connections</t>
</div>
</div>
<div id="form" class="connections">
<div id="main" class="connections">
<div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="sessions" on-status-changed="onModelStatusChange">

View File

@ -8,7 +8,7 @@
tip="_Preview"
on-click="onPreviewClick"/>
</div>
<div id="form" class="items">
<div id="main" class="items">
<div class="card form">
<div>
<label><t>Store</t></label>

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>ControlPanel</t>
</h1>
<div id="form" class="cpanel">
<div id="main" class="cpanel">
<div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model">

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>Photos</t>
</h1>
<div id="form" class="photos">
<div id="main" class="photos">
<form
id="html-form"
enctype="multipart/form-data">

View File

@ -12,7 +12,7 @@
tip="_Clean"
on-click="_onCleanClick"/>
</div>
<div id="form" class="queries">
<div id="main" class="queries">
<div class="card form">
<div>
<label><t>SQL query</t></label>

View File

@ -19,7 +19,7 @@
tip="_Preview"
on-click="onPreviewClick"/>
</div>
<div id="form" class="shelves">
<div id="main" class="shelves">
<div class="card form">
<div>
<label><t>Configuration</t></label>

View File

@ -10,7 +10,7 @@
<htk-search-entry
param="user-name"/>
</div>
<div id="form" class="users">
<div id="main" class="users">
<div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model">

View File

@ -12,7 +12,7 @@
tip="_Connections"
on-click="onSessionsClick"/>
</div>
<div id="form" class="visits">
<div id="main" class="visits">
<div class="card form">
<div>
<label><t>From</t></label>

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>ListByAgency</t>
</h1>
<div id="form" class="packages">
<div id="main" class="packages">
<div class="card">
<htk-grid>
<db-model property="model">

View File

@ -6,7 +6,7 @@
<h1 id="title">
<t>ByProvince</t>
</h1>
<div id="form" class="provinces">
<div id="main" class="provinces">
<div class="card">
<htk-grid>
<db-model property="model">

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>About</t>
</h1>
<div id="form" class="about">
<div id="main" class="about">
<div class="cols">
<div class="card">
<h1>

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>IWantCustomer</t>
</h1>
<div id="form" class="contact">
<div id="main" class="contact">
<form
id="contact-form">
<input type="hidden" name="srv" value="json:misc/contact"/>

View File

@ -9,7 +9,7 @@
tip="_Start order"
on-click="onStartOrderClick"/>
</div>
<div id="form" class="home">
<div id="main" class="home">
<div class="column mansonry" id="news-column">
<htk-repeater form-id="new">
<db-model property="model">

View File

@ -2,5 +2,5 @@
<h1 id="title">
<t>Location</t>
</h1>
<div id="form" class="location"/>
<div id="main" class="location"/>
</vn>

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>Training</t>
</h1>
<div id="form" class="training">
<div id="main" class="training">
<div class="column mansonry" id="news-column">
<htk-repeater form-id="new">
<db-model property="model">

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>AboutCompany</t>
</h1>
<div id="form" class="why">
<div id="main" class="why">
<div class="card">
<div class="body">
<ul>

View File

@ -16,7 +16,7 @@
tip="_ConfigureOrder"
on-click="onConfigureClick"/>
</div>
<div id="form" class="basket">
<div id="main" class="basket">
<div class="card form">
<div class="head">
<p>

View File

@ -139,7 +139,7 @@
<htk-search-entry
param="search"/>
</div>
<div id="form" class="catalog">
<div id="main" class="catalog">
<div id="main" class="main">
<htk-repeater
id="grid-view"

View File

@ -53,7 +53,7 @@
tip="_Cancel"
on-click="onCancelClick"/>
</div>
<div id="form" class="checkout">
<div id="main" class="checkout">
<div class="card form">
<htk-assistant
id="assistant"

View File

@ -32,7 +32,7 @@
<h1 id="title">
<t>Order summary</t>
</h1>
<div id="form" class="confirm">
<div id="main" class="confirm">
<div class="summary form card">
<div>
<div class="delivery">

View File

@ -2,7 +2,7 @@
<h1 id="title">
<t>Invoices</t>
</h1>
<div id="form" class="invoices">
<div id="main" class="invoices">
<div class="card">
<div>
<htk-grid show-header="false">

View File

@ -10,6 +10,7 @@
,"LastOrders": "Últimes comandes"
,"Show orders from": "Mostra comandes desde"
,"Balance:": "Saldo:"
,"PaymentInfo": "La quantitat mostrada és el teu saldo pendent (negatiu) o favorable a dia d'avui, no té en compte comandes del futur. Perquè la teva comanda sigui enviat, aquesta quantitat ha de ser igual o més gran que 0. Si vols fer un lliurament a compte, prem el botó de pagament, esborra la quantitat suggerida e introdueix la quantitat que vulguis."
,"MakePayment": "Realitzar pagament"

View File

@ -10,6 +10,7 @@
,"LastOrders": "Last orders"
,"Show orders from": "Show orders from"
,"Balance:": "Balance:"
,"PaymentInfo": "The amount shown is your slope (negative) or favorable balance today, it disregards future orders. For get your order shipped, this amount must be equal to or greater than 0. If you want to make a down payment, click the payment button, delete the suggested amount and enter the amount you want."
,"MakePayment": "Make payment"

View File

@ -10,6 +10,7 @@
,"LastOrders": "Últimos pedidos"
,"Show orders from": "Mostrar pedidos desde"
,"Balance:": "Saldo:"
,"PaymentInfo": "La cantidad mostrada es tu saldo pendiente (negativa) o favorable a día de hoy, no tiene en cuenta pedidos del futuro. Para que tu pedido sea enviado, esta cantidad debe ser igual o mayor que 0. Si quieres realizar una entrega a cuenta, pulsa el botón de pago, borra la cantidad sugerida e introduce la cantidad que desees."
,"MakePayment": "Realizar pago"

View File

@ -10,6 +10,7 @@
,"LastOrders": "Les dernières commandes"
,"Show orders from": "Afficher les commandes de"
,"Balance:": "Balance:"
,"PaymentInfo": "Le montant indiqué est votre pente (négative) ou balance favorable aujourd'hui, ne tient pas compte pour les commandes futures. Obtenir votre commande est expédiée, ce montant doit être égal ou supérieur à 0. Si vous voulez faire un versement, le montant suggéré effacé et entrez le montant que vous souhaitez."
,"MakePayment": "Effectuer un paiement"

View File

@ -10,6 +10,7 @@
,"LastOrders": "Last orders"
,"Show orders from": "-Аас харуулах захиалга"
,"Balance:": "Balance:"
,"PaymentInfo": "Үзүүлсэн хэмжээ цаашид захиалга эзэлж биш, таны налуу (сөрөг), эсвэл тааламжтай тэнцвэр нь өнөөдөр юм. Хэрэв та дүн арилгаж гэж хэлж байсан нь доош нь төлбөр хийж, өөрийн хүссэн хэмжээгээр орж хүсэж байгаа бол таны захиалга ирдэг бол авах, энэ хэмжээ тэнцүү буюу 0-ээс их байх ёстой."
,"MakePayment": "Make payment"

View File

@ -10,6 +10,7 @@
,"LastOrders": "Últimos pedidos"
,"Show orders from": "Mostrar ordens de"
,"Balance:": "Saldo:"
,"PaymentInfo": "A quantidade mostrada é seu saldo pendente (negativo) ou favorável a dia de hoje, não se vincula a pedidos futuros. Para que seu pedido seja enviado, esta quantidade deve ser igual ou superior a 0. Se queres realizar um depósito à conta, clique no botão de pagamento, apague a quantidade sugerida e introduza a quantidade que deseje."
,"MakePayment": "Realizar pagamento"

View File

@ -7,6 +7,10 @@ Hedera.Orders = new Class
{
this.tpv = new Hedera.Tpv ({conn: this.conn});
this.tpv.check (this._onTpvCheck.bind (this));
var from = new Date ();
from.setDate (from.getDate () - 25);
this.$('from').value = from;
}
,_onTpvCheck: function (tpv, tpvOrder, tpvStatus)

View File

@ -1,4 +1,9 @@
.orders .card
{
max-width: 28em;
}
/* Balance */
.balance

View File

@ -1,5 +1,7 @@
<vn>
<vn-group>
<vn-param id="from"/>
<vn-hash-param type="Date" key="from" param="from"/>
<db-form id="debt">
<db-model property="model">
<custom>
@ -37,13 +39,24 @@
alt="Info"/>
</div>
</div>
<div id="form" class="orders">
<div id="main" class="orders">
<div class="card form">
<div>
<label><t>Show orders from</t></label>
<htk-date-chooser param="from"/>
</div>
</div>
<div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="tickets">
<custom>
CALL clientTicketList ()
CALL clientTicketList (#from, NULL)
</custom>
<sql-batch property="batch">
<custom>
<item name="from" param="from"/>
</custom>
</sql-batch>
</db-model>
<custom>
<a id="link" class="list-row" title="_SeeOrder">

View File

@ -15,9 +15,8 @@ Hedera.Ticket = new Class
,onPrintClick: function ()
{
var batch = new Sql.Batch ();
batch.addValue ('ticket', this.$('ticket-id').value);
this.gui.openReport ('delivery-note', batch);
var params = {ticket: this.$('ticket-id').value};
this.gui.openReport ('delivery-note', params);
}
,subtotalRenderer: function (column, form)

View File

@ -24,7 +24,7 @@
tip="_Delivery note"
on-click="onPrintClick"/>
</div>
<div id="form" class="ticket">
<div id="main" class="ticket">
<div class="card form">
<div class="head">
<div>

View File

@ -34,7 +34,7 @@
tip="_Return"
on-click="onReturnClick"/>
</div>
<div id="form" class="new">
<div id="main" class="new">
<div class="card form">
<div>
<label><t>Title</t></label>

View File

@ -8,7 +8,7 @@
tip="_AddNew"
on-click="onAddClick"/>
</div>
<div id="form" class="news">
<div id="main" class="news">
<div class="card">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="news-model" updatable="true">

5
forms/preview/locale/ca.json Executable file
View File

@ -0,0 +1,5 @@
{
"Report": "Informe"
,"Preview": "Visualització prèvia"
,"Print": "Imprimir"
}

5
forms/preview/locale/en.json Executable file
View File

@ -0,0 +1,5 @@
{
"Report": "Report"
,"Preview": "Preview"
,"Print": "Print"
}

5
forms/preview/locale/es.json Executable file
View File

@ -0,0 +1,5 @@
{
"Report": "Informe"
,"Preview": "Vista preliminar"
,"Print": "Imprimir"
}

5
forms/preview/locale/fr.json Executable file
View File

@ -0,0 +1,5 @@
{
"Report": "Rapport"
,"Preview": "Avant-première"
,"Print": "Imprimer"
}

5
forms/preview/locale/mn.json Executable file
View File

@ -0,0 +1,5 @@
{
"Report": "тайлан"
,"Preview": "Урьдчилан харах"
,"Print": "хэвлэх"
}

View File

@ -0,0 +1,5 @@
{
"Report": "Relatório"
,"Preview": "Vsualização"
,"Print": "Impressão"
}

43
forms/preview/preview.js Normal file
View File

@ -0,0 +1,43 @@
Hedera.Preview = new Class
({
Extends: Hedera.Form
,activate: function ()
{
var reportName = Vn.Hash.get ('report');
if (!reportName)
{
Htk.Toast.showError (_('Report name not set'));
return;
}
this.gui.loaderPush ();
var module = new Hedera.Module ('reports', reportName);
module.load (this._onReportLoad.bind (this));
}
,_onReportLoad: function (module)
{
this.gui.loaderPop ();
if (module.error)
{
Htk.Toast.showError (_('Error loading report'));
return;
}
var batch = new Sql.Batch ();
batch.addValues (Vn.Hash._hashMap);
var report = new module.klass (module, this.gui);
report.open (batch, this.node);
}
,onPrintClick: function ()
{
this.doc.defaultView.print ();
}
});

0
forms/preview/style.css Normal file
View File

12
forms/preview/ui.xml Executable file
View File

@ -0,0 +1,12 @@
<vn>
<h1 id="title">
<t>Preview</t>
</h1>
<div id="actions">
<htk-bar-button
icon="print"
tip="_Print"
on-click="onPrintClick"/>
</div>
<div id="main" class="report"/>
</vn>

View File

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg7384"
sodipodi:docname="print.svg"
version="1.1"
inkscape:version="0.48.5 r10040"
height="16"
width="16">
<metadata
id="metadata90">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
inkscape:cy="72.4546"
pagecolor="#555753"
borderopacity="1"
showborder="false"
inkscape:bbox-paths="false"
guidetolerance="10"
inkscape:window-width="1310"
showguides="true"
inkscape:snap-bbox="true"
inkscape:pageshadow="2"
inkscape:guide-bbox="true"
inkscape:snap-nodes="true"
bordercolor="#666666"
objecttolerance="10"
id="namedview88"
showgrid="false"
inkscape:window-maximized="0"
inkscape:window-x="54"
inkscape:window-y="27"
gridtolerance="10"
inkscape:window-height="701"
inkscape:current-layer="layer10"
inkscape:zoom="2.0390625"
inkscape:cx="-25.548654"
inkscape:pageopacity="1">
<inkscape:grid
spacingx="1px"
spacingy="1px"
id="grid4866"
empspacing="2"
enabled="true"
type="xygrid"
snapvisiblegridlinesonly="true"
visible="true" />
</sodipodi:namedview>
<title
id="title9167">Gnome Symbolic Icon Theme</title>
<defs
id="defs7386" />
<g
inkscape:label="status"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer9"
style="display:inline" />
<g
inkscape:label="devices"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer10">
<g
inkscape:label="accessories-calculator"
transform="translate(94,-60)"
id="g10819"
style="fill:#333333;fill-opacity:1" />
<g
inkscape:label="Layer 1"
transform="translate(142,338)"
id="layer1-6"
style="fill:#333333;fill-opacity:1">
<path
inkscape:connector-curvature="0"
d="M 2,4 C 1.5,4 1,4.5 1,5 l 0,4 c 0,0.5 0.5,1 1,1 l 1,0 0,-2 10,0 0,2 1,0 c 0.5,0 1,-0.5 1,-1 L 15,5 C 15,4.5 14.5,4 14,4 L 2,4 z"
id="path3520"
sodipodi:nodetypes="ccccccccccccc"
style="fill:#333333;fill-opacity:1;stroke:none" />
<path
inkscape:connector-curvature="0"
d="M 4,1 4,3 12,3 12,1 4,1 z"
id="path4804"
sodipodi:nodetypes="ccccc"
style="fill:#333333;fill-opacity:1;stroke:none" />
<path
inkscape:connector-curvature="0"
d="M 4,9.0000001 4,14 l 8,0 0,-5 -8,10e-8 z M 5,10 l 6,0 0,1 -6,0 0,-1 z m 0,2 5,0 0,1 -5,0 0,-1 z"
id="path4806"
sodipodi:nodetypes="ccccccccccccccc"
style="fill:#333333;fill-opacity:1;stroke:none" />
</g>
</g>
<g
inkscape:label="apps"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer11" />
<g
inkscape:label="actions"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer12" />
<g
inkscape:label="places"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer13" />
<g
inkscape:label="mimetypes"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer14" />
<g
inkscape:label="emblems"
transform="translate(-142,-338)"
inkscape:groupmode="layer"
id="layer15" />
</svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,7 +1,7 @@
module.exports = new Class
({
Extends: Vn.Object
Extends: Htk.Component
,isOpen: false
,uiLoaded: false
@ -13,20 +13,6 @@ module.exports = new Class
this.hash = gui.hash;
this.formInfo = formInfo;
}
/**
* Gets an object from the builder associated to this form.
*
* @param {string} objectId The object identifier
* @return {Object} The object, or %null if not found
*/
,$: function (objectId)
{
if (this.builder)
return this.builder.getById (objectId);
return null;
}
,loadUi: function ()
{
@ -37,10 +23,8 @@ module.exports = new Class
builder.signalData = this;
builder.add ('conn', this.conn);
builder.loadXml ('forms/'+ this.formInfo.path +'/ui.xml');
var res = this.builder = builder.load ();
this.node = res.$('form');
res.link ();
var res = this.builderResultInit (builder);
var models = res.getByTagName ('db-model');
@ -51,7 +35,7 @@ module.exports = new Class
for (var i = 0; i < queries.length; i++)
queries[i].conn = this.conn;
if (this.node)
{
this.gui.setForm (this.node);

View File

@ -24,7 +24,6 @@ module.exports = new Class
,forms: {}
,activeForm: null
,activeCss: null
,requestedForm: null
,menuShown: false
,menuOptions: {}
@ -398,9 +397,6 @@ module.exports = new Class
this.choosedOption = newChoosedOption;
}
this.activeCss = 'forms/'+ formPath +'/style.css';
Vn.includeCss (this.activeCss);
var formInfo = this.forms[formPath];
if (!formInfo)
@ -409,7 +405,7 @@ module.exports = new Class
this.forms[formPath] = formInfo;
}
formInfo.addCallback (callback);
formInfo.load (callback);
}
,_onFormLoad: function (formInfo)
@ -459,50 +455,30 @@ module.exports = new Class
{
if (this.activeForm)
{
this.activeForm.formInfo.unload ();
this.activeForm.close ();
this.activeForm.unref ();
this.activeForm = null;
}
if (this.activeCss)
{
Vn.excludeCss (this.activeCss);
this.activeCss = null;
}
if (this.choosedOption)
{
Vn.Node.removeClass (this.choosedOption, 'selected');
this.choosedOption = null;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Reports
,openReport: function (reportName, batch)
{
this.loaderPush ();
var module = new Module ('reports', reportName);
module.addCallback (this._onReportLoad.bind (this, batch));
}
,_onReportLoad: function (batch, module)
,openReport: function (reportName, params)
{
this.loaderPop ();
if (module.error)
{
Htk.Toast.showError (_('Error loading report'));
return;
}
var report = new module.klass (module, this);
report.open (batch);
var hashParams = {
form: 'preview',
report: reportName
};
Vn.Hash.set (Object.assign (hashParams, params));
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant
,supplantUser: function (user, callback)
{
this._conn.supplantUser (user,

View File

@ -29,13 +29,31 @@ module.exports = new Class
this.path = path;
this.moduleName = moduleName;
}
,addCallback: function (callback)
,getCssPath: function ()
{
if (!this.ready)
this.callbacks.push (callback);
else
return this.basePath +'/'+ this.path +'/style.css';
}
,includeCss: function ()
{
Vn.includeCss (this.getCssPath ());
}
,unload: function ()
{
Vn.excludeCss (this.getCssPath ());
}
,load: function (callback)
{
if (this.ready)
{
this.includeCss ();
callback (this);
}
else
this.callbacks.push (callback);
}
,onLocaleReady: function (success)
@ -78,6 +96,7 @@ module.exports = new Class
var callbacks = this.callbacks;
this.callbacks = null;
this.includeCss ();
for (var i = 0; i < callbacks.length; i++)
callbacks[i] (this);

View File

@ -1,7 +1,7 @@
module.exports = new Class
({
Extends: Vn.Object
Extends: Htk.Component
,initialize: function (moduleInfo, gui)
{
@ -11,23 +11,10 @@ module.exports = new Class
this.parent (null);
}
/**
* Gets an object from the builder associated to this report.
*
* @param {string} objectId The object identifier
* @return {Object} The object, or %null if not found
*/
,$: function (objectId)
{
if (this.builderResult)
return this.builderResult.getById (objectId);
return null;
}
,open: function (batch)
,open: function (batch, body)
{
this.batch = batch;
this.body = body;
this.createWindow ();
}
@ -36,53 +23,25 @@ module.exports = new Class
this.window.print ();
}
,includeCss: function (path)
{
var basePath = location.protocol +'//'+ location.host;
basePath += location.port ? ':'+ location.port : '';
basePath += location.pathname.substring (0,
location.pathname.lastIndexOf ('/'));
var link = this.doc.createElement ('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = basePath +'/'+ path + Vn.getVersion ();
var head = this.doc.getElementsByTagName ('head')[0];
head.appendChild (link);
}
,createWindow: function ()
{
var reportWindow = window.open (
'js/hedera/report.html', '_blank',
'height=650, width=950, resizable=yes, fullscreen=no,'+
'titlebar=no, menubar=no, toolbar=no, location=no, scrollbars=yes'
);
if (!reportWindow)
{
Htk.Toast.showError (
_('Please unlock popups and try again'));
return false;
}
var iframe = this.iframe = this.createElement ('iframe');
iframe.src = 'js/hedera/report.html';
iframe.style.display = 'none';
document.body.appendChild (iframe);
var reportWindow = iframe.contentWindow;
reportWindow.addEventListener ('load',
this._onWindowLoad.bind (this));
this.window = reportWindow;
return true;
}
,_onWindowLoad: function ()
{
this.doc = this.window.document
this.includeCss ('reports/'+ this.info.path +'/style.css');
var printButton = this.doc.getElementById ('print');
printButton.addEventListener ('click', this.print.bind (this));
Vn.Node.setText (printButton, _('Print'));
this.onWindowCreate ();
}
@ -94,9 +53,7 @@ module.exports = new Class
builder.add ('conn', this.conn);
builder.loadXml ('reports/'+ this.info.path +'/ui.xml');
var res = this.builderResult = builder.load ();
res.link ();
this.doc.body.appendChild (res.$('report'));
var res = this.builderResultInit (builder);
this.body.appendChild (res.$('report'));
}
});

View File

@ -28,8 +28,15 @@ module.exports = new Class
var res = this.builder = builder.load ();
this._node = res.$('main');
res.link ();
return res;
}
/**
* Gets an object from the builder associated to this component.
*
* @param {string} objectId The object identifier
* @return {Object} The object, or %null if not found
*/
,$: function (id)
{
if (this.builder)

View File

@ -90,7 +90,7 @@ module.exports = new Class
return token;
}
,render: function (batch)
,render: function ()
{
var v = this._value;
@ -105,8 +105,8 @@ module.exports = new Class
case 'object':
if (v instanceof Date)
return Vn.Date.strftime (v, '\'%Y-%m-%d\'');
default:
return 'NULL';
}
return 'NULL';
}
});

View File

@ -1,5 +1,6 @@
var Object = require ('./object');
var Type = require ('./type');
/**
* Creates a object from a XML specification.
@ -400,6 +401,9 @@ module.exports = new Class
var method = this._getMethod (value);
newValue = method ? method.bind (this.signalData) : null;
break;
case Type:
newValue = window[value];
break;
default:
if (propInfo.enumType)
newValue = propInfo.enumType[value];
@ -521,7 +525,7 @@ module.exports = new Class
for (var i = 1; i < arguments.length; i++)
logArgs.push (arguments[i]);
console.warn.apply (null, logArgs);
console.warn.apply (console, logArgs);
}
,_addLink: function (context, prop, objectId)

4
js/vn/enum.js Normal file
View File

@ -0,0 +1,4 @@
/**
* Base type for ennumerations.
*/
module.exports = function () {};

View File

@ -2,6 +2,8 @@
var Object = require ('./object');
var Param = require ('./param');
var Hash = require ('./hash');
var Type = require ('./type');
var VnDate = require ('./date');
module.exports = new Class
({
@ -50,7 +52,7 @@ module.exports = new Class
},
type:
{
type: Object
type: Type
,set: function (x)
{
this._type = x;
@ -77,26 +79,47 @@ module.exports = new Class
this._onHashChange ();
}
,parseHashValue: function (v, type)
{
if (v === '')
return null;
if (type && v !== undefined && v !== null)
switch (type)
{
case Boolean:
return (/^(true|1)$/i).test (v);
case Number:
return 0 + new Number (v);
case Date:
return new Date(v);
}
return v;
}
,renderHashValue: function (v)
{
switch (typeof v)
{
case 'number':
return v;
case 'boolean':
return (v) ? 'true' : 'false';
case 'object':
if (v instanceof Date)
return VnDate.strftime (v, '%Y-%m-%d');
}
return v;
}
,_onHashChange: function ()
{
if (this._hashLock || !this._key || !this._listener)
return;
var newValue = Hash.get (this._key);
if (newValue === '')
newValue = null;
if (this._type && newValue !== undefined && newValue !== null)
switch (this._type)
{
case Boolean:
newValue = (/^(true|1)$/i).test (newValue);
break;
case Number:
newValue = 0 + new Number (newValue);
break;
}
var newValue = this.parseHashValue (Hash.get (this._key), this._type);
this._hashLock = true;
this._setValue (newValue, true);
@ -115,7 +138,7 @@ module.exports = new Class
this._hashLock = true;
var map = {};
map[this._key] = newValue;
map[this._key] = this.renderHashValue(newValue);
Hash.add (map);
this._hashLock = false;

View File

@ -126,7 +126,7 @@ module.exports =
var kvPair = kvPairs[i].split ('=', 2);
if (kvPair[0])
newMap[kvPair[0]] = kvPair[1];
newMap[kvPair[0]] = decodeURIComponent(kvPair[1]);
}
this._hashMap = newMap;

4
js/vn/type.js Normal file
View File

@ -0,0 +1,4 @@
/**
* Type that references another type.
*/
module.exports = function () {};

View File

@ -10,7 +10,7 @@ module.exports =
{
if (a === b)
return true;
if (typeof a === typeof b && a instanceof Date)
if (a instanceof Date && b instanceof Date)
return a.getTime () === b.getTime ();
return false;

View File

@ -3,7 +3,8 @@ require ('mootools');
Vn = module.exports = {
Locale : require ('./locale')
,Enum : function () {}
,Enum : require ('./enum')
,Type : require ('./type')
,Object : require ('./object')
,Browser : require ('./browser')
,Cookie : require ('./cookie')