for( var i = 0; i < this.keys.length; i++ ) {
var td = elem('td');
var data = '';
- if (this.caclulate[i]) { // fake data! pass the object
- td.appendChild(this.calculate[i](obj);
+ var key = this.keys[i];
+ if (this.calculate && this.calculate[key]) { // fake data! pass the object
+ td.appendChild(this.calculate[key](obj));
} else {
- data = obj[this.keys[i]]();
+ data = obj[key]();
data = this.munge(data);
- this.fleshData(td, data, this.keys[i]);
+ this.fleshData(td, data, key);
}
row.appendChild(td);
docs : function (t) {
var d = JSON2js(t.data());
if (d.version >= 4 && d.doc_url) {
- return elem(
- 'a',
- { href : d.doc_url, target : '_blank'},
- 'External Documentation'
- );
+ var args = {};
+ if (typeof xulG == 'undefined') {
+ args.href = d.doc_url;
+ args.target = '_blank';
+ } else {
+ args.href = '';
+ args.onclick = "xulG.new_tab('" + d.doc_url + "'); return false"
+ }
+ return elem('a', args, 'External Documentation')
}
return text('');
}
<!ENTITY reports.xul.template_builder.table_name.label "Table Name">
<!ENTITY reports.xul.template_builder.sql_alias.label "SQL Alias">
<!ENTITY reports.xul.template_builder.relationship.label "Relationship">
+<!ENTITY reports.xul.template_builder.field_doc.label "Field Hint">
border-left: 1px solid #808080;
}
+.oils_rpt_field_hint {
+ font-weight: bold;
+ text-decoration:underline;
+ padding-left: 5px;
+}
+
path : obj.path,
type : type,
relation : obj.relation,
- field : field
+ field : field,
+ field_doc : obj.field_doc
});
}
}
</head>
<body>
+
<div class='welcome_box'>
<span>&reports.common.logged_in_as;</span><b><span id='oils_rpt_user'></span></b>
</div>
<td><span id='oils_rpt_report_editor_template_description'></span></td>
</tr>
<tr id='oils_rpt_report_editor_template_doc_url_row'>
- <th colspan=2><a target="_blank" href="" id='oils_rpt_report_editor_template_doc_url'>&reports.oils_rpt_editor.doc_url;</a></th>
+ <th colspan="2">
+ &reports.oils_rpt_editor.doc_url;
+ <a href="" id='oils_rpt_report_editor_template_doc_url'></a>
+ </th>
</tr>
<tr>
var par = params[p];
var row = oilsRptParamEditor.row.cloneNode(true);
this.tbody.appendChild(row);
- $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path, par.field_doc)));
+ $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path)));
+
+ if (par.field_doc) {
+ $n(row, 'column').appendChild(
+ elem('div', {'class':'oils_rpt_field_hint'}, par.field_doc));
+ }
+
+ //$n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path, par.field_doc)));
$n(row, 'transform').appendChild(text(OILS_RPT_TRANSFORMS[par.column.transform].label));
$n(row, 'action').appendChild(text(OILS_RPT_FILTERS[par.op].label));
par.widget = this.buildWidget(par, $n(row, 'widget'));
var par = tparams[p];
var row = oilsRptParamEditor.row.cloneNode(true);
this.tbody.appendChild(row);
- $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path, par.field_doc)));
+ $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path)));
+ if (par.field_doc) {
+ $n(row, 'column').appendChild(
+ elem('div', {'class':'oils_rpt_field_hint'}, par.field_doc));
+ }
$n(row, 'transform').appendChild(text(OILS_RPT_TRANSFORMS[par.column.transform].label));
$n(row, 'action').appendChild(text(OILS_RPT_FILTERS[par.op].label));
par.widget = this.buildWidget(par, $n(row, 'widget'));
appendClear(DOM.oils_rpt_report_editor_template_description, tmpl.description());
if (rptObject.def.version >= 4) {
- DOM.oils_rpt_report_editor_template_doc_url.setAttribute( 'href', rptObject.def.doc_url );
+ if (URL = rptObject.def.doc_url) {
+ var link = DOM.oils_rpt_report_editor_template_doc_url;
+ link.innerHTML = URL;
+ if (typeof xulG == 'undefined') {
+ link.setAttribute('href', URL);
+ link.setAttribute('target', '_blank');
+ } else {
+ link.onclick = function() {xulG.new_tab(URL); return false}
+ }
+ }
} else {
hideMe(DOM.oils_rpt_report_editor_template_doc_url_row);
}
function(i) {
if(i)
DOM.oils_rpt_report_editor_cols.appendChild(text(i.alias));
+ if (i.field_doc) {
+ DOM.oils_rpt_report_editor_cols.appendChild(
+ elem('span', {'class':'oils_rpt_field_hint'}, i.field_doc));
+ }
DOM.oils_rpt_report_editor_cols.appendChild(document.createElement('br'));
}
);
}
/* creates a label "path" based on the column path */
-function oilsRptMakeLabel(path, hint) {
+function oilsRptMakeLabel(path) {
var parts = path.split(/-/);
var str = '';
for( var i = 0; i < parts.length; i++ ) {
}
}
- if (hint) {
- str += '<br/><b><i>' + hint + '</i></b>'
- }
-
return str;
}
var colname = item.getAttribute('idlfield');
var jointype = item.getAttribute('join');
var field_label = item.firstChild.firstChild.getAttribute('label');
- var field_doc = item.firstChild.lastChild.getAttribute('label');
+ var field_doc = '';
var table_name = getSourceDefinition(field_class);
fieldtree = tabpanel.getElementsByTagName('treechildren')[0];
for (var colname in rpt_rel_cache[relation_alias].fields[tabname]) {
+
+ // TODO: code would be clearer if we could access the loaded template
+ // version from here. Not sure how... it's not in rpt_rel_cache.
+ // Existing templates (e.g. from cloning) will not have a field_doc
+ // attribute. with() is not tolerant of nonexistent attributes.
+ if (!rpt_rel_cache[relation_alias].fields[tabname][colname].field_doc)
+ rpt_rel_cache[relation_alias].fields[tabname][colname].field_doc = '';
+
with (rpt_rel_cache[relation_alias].fields[tabname][colname]) {
fieldtree.appendChild(
createTreeItem(
);
}
- fieldtree.lastChild.firstChild.appendChild(
- createTreeCell({ label : field_doc })
- );
+ fieldtree.lastChild.firstChild.appendChild(
+ createTreeCell({ label : field_doc })
+ );
}
}
}
) continue;
}
+ // Existing templates (e.g. from cloning) will not have a field_doc
+ // attribute. with() is not tolerant of nonexistent attributes.
+ if (!rpt_rel_cache[order.relation].fields.dis_tab[order.field].field_doc)
+ rpt_rel_cache[order.relation].fields.dis_tab[order.field].field_doc = '';
+
with (rpt_rel_cache[order.relation].fields.dis_tab[order.field]) {
fieldtree.appendChild(
createTreeItem(
<hbox>
<vbox>
<label control="template-name" value="&reports.xul.template_builder.name.label;" style="height:2em"/>
- <label control="template-description" value="&reports.xul.template_builder.description.label;"/>
+ <label control="template-description" value="&reports.xul.template_builder.description.label;" style="height:3em"/>
<label control="template-doc-url" value="&reports.xul.template_builder.doc_url.label;"/>
</vbox>
<vbox flex="1">