Commit 6d5c7c19 authored by akucera's avatar akucera
Browse files

ready for data insertion

parent f7be2a0d
<div id="params" class="form-group"></div>
\ No newline at end of file
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title" data-i18n="Filters">Filters</h3></div>
<div class="panel-body">
<p data-i18n="query.filters.text"></p>
<div class="row">
<div id="params" class="form-group"></div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -90,15 +90,15 @@
$("table#dpInfo thead tr:eq(0)").html(htmlHead);
$("table#dpInfo tbody tr:eq(0)").html(htmlBody);
p.enrichPropertyValueCells("table#dpInfo", function() {
p.enrichPropertyValueCells("table#dpInfo", p.switchMaps, p.buttonEnrichCallbackLink,
p.buttonEnrichCallbackLink, p.buttonEnrichCallbackLink, p.buttonEnrichCallbackLink, p.buttonEnrichCallbackLink,
function() {
$("button.mapButton").each(function() {
var f = $(this).attr("data-field");
var propVal = $(this).attr("data-field-value");
// add map navs + actions
$("#mapTabs").append('<li role="presentation" id="nav' + p.getId(f) + '"><a href="#" data-field="' + encodeURIComponent(f) + '" data-field-value="' + encodeURIComponent(propVal) + '">'
+ $.t(f) + '</a></li>').find("li a").click(p.switchMaps);
//add actions to map buttons
$("table#dpInfo .mapButton").click(p.switchMaps);
+ $.t(f) + '</a></li>').find("li a").click(function() { p.switchMaps(SBMSPage.prototype.mapURL + "?code=" + $(this).attr("data-field-value"), this); });
});
});
$("#map").height($(window).height() - ($("body").outerHeight() - $("#map").height()) - 10);
......@@ -106,6 +106,7 @@
});
});
},
sendDpInfo: function(dp, fields, fillTableAction) {
var data = {};
......@@ -136,17 +137,16 @@
}
});
}, switchMaps: function() {
var qs = "";
var val = $(this).attr("data-field-value");
if(val != null && val != "") {
qs = "?code=" + val;
}
$("#kompasFrame").attr("src", p.mapURL + qs);
},
switchMaps: function(url,src) {
$("#kompasFrame").attr("src", url);
$("#mapTabs li").removeClass("active");
var s = $("#nav" + p.getId($(this).attr("data-field")));
var s = $("#nav" + p.getId($(src).attr("data-field")));
s.addClass("active");
}});
}
});
......
......@@ -14,7 +14,12 @@ var translation = {
"index.map": "Show on the map:",
"query.filters.text" : "Results have to meet the following criteria:",
"query.attributes.text" : "Resulting dataset will contain datapoints described by the following attributes:",
"query.groups.text" : "Result will be divided into groups according to the following criteria:",
"query.groups.text" : "Result will be divided into groups according to the following criteria:",
"button.hover.map" : "Map & Properties (BIM)",
"button.hover.bms" : "Present Value (BMS)",
"button.hover.cafm" : "Maintenance (CAFM)",
"button.hover.charts" : "Historical Data (BMS)",
"button.hover.influence" : "Influence (SBMS)",
'bmsId' : 'BMS address',
'type' : 'Object type',
'source.bimId' : 'Source',
......@@ -76,6 +81,11 @@ var translation = {
"query.filters.text" : "Výsledky musí odpovídat následujícím parametrům:",
"query.attributes.text" : "Výsledek bude o každém datovém bodu obsahovat následující informace:",
"query.groups.text" : "Výsledky buou rozčleněny do skupin na základě následujících kritérií:",
"button.hover.map" : "Poloha & Vlastnosti (BIM)",
"button.hover.bms" : "Aktuální hodnota (BMS)",
"button.hover.cafm" : "Údržba (CAFM)",
"button.hover.charts" : "Historická data (BMS)",
"button.hover.influence" : "Vliv (SBMS)",
"bmsId" : "Adresa v BMS",
"type" : "Typ objektu",
"noGrouping" : "Žádné",
......@@ -145,6 +155,7 @@ var translation = {
'Forbidden' : 'Nepovolený přístup. Vyplnili jste jméno a heslo?',
'Nothing selected' : 'Nic není vybráno',
'No results match' : 'Žádné výsledky neodpovídají',
'External application' : 'Externí aplikace',
'Air' : 'Vzduch',
'Water' : 'Voda',
'TemperatureSensor' : 'Teplotní čidlo',
......
......@@ -38,6 +38,7 @@ function SBMSPage(custom) {
SBMSPage.prototype.mapURL = "https://kompas.muni.cz/auth/";
SBMSPage.prototype.sbmsURL = "/sbms/v1/";
SBMSPage.prototype.bmsChartsURL = "https://bms.muni.cz/Charts/";
SBMSPage.prototype.cafmURL = "https://archibus.ics.muni.cz/archibus/schema/ab-products/custom/sbms/muni-helpdesk-manager-search-tabs.axvw";
SBMSPage.prototype.trendDBs = ["93", "94"];
SBMSPage.prototype.bmsURL = "https://bms.muni.cz/deltaweb/newlogin/?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5F{0}%2Easp%3FObjRef%3DBAC%2E{1}";
// "https://bms.muni.cz/deltaweb/newlogin/?Referer=/deltaweb/navigator/index.asp&FrameSrc=%2Fdeltaweb%2Fnavigator%2FObject%5F{0}%2Easp%3FObjRef%3DBAC%2E{1}";
......@@ -141,6 +142,8 @@ function SBMSPage(custom) {
var cma = params[5];
var mapFrame = params[6];
var treeSelect = params[7];
$.ajax({
type: 'GET',
cache: true,
......@@ -154,27 +157,33 @@ function SBMSPage(custom) {
var id = SBMSPage.prototype.getId(data[i]);
var app = '<label class="col-lg-' + width + ' col-md-6 control-label" for="' + id + '">' + $.t(data[i]) + '</label> <div class="col-lg-' + width + ' col-md-6">';
type = fieldsList[data[i]];
var paramVal = SBMSPage.prototype.getQueryVariable(data[i]);
var type = fieldsList[data[i]];
switch(type) {
// map select
case "bim":
app += '<div class="input-group"><input type="text" class="form-control field" id="' + id + '" />'
app += '<div class="input-group"><input type="text" class="form-control field" id="' + id + '" '
+ ((paramVal) ? 'value="' + paramVal + '"' : '') + ' />'
+ '<span class="input-group-btn"><button class="btn btn-default mapButton" data-input="' + id + '" type="button"><span class="glyphicon glyphicon-map-marker"></span></button></span></div>';
break;
// tree menus
case "sbms-tree":
app+= '<div class="input-group"><input type="text" class="form-control field" id="' + id + '" />'
app+= '<div class="input-group"><input type="text" class="form-control field" id="' + id + '" '
+ ((paramVal) ? 'value="' + paramVal + '"' : '') + ' />'
+ '<span class="input-group-btn"><button class="btn btn-default treeButton" data-input="' + id + '" type="button"><span class="glyphicon glyphicon-option-horizontal"></span></button></span></div>';
break;
// lists
case "sbms-enum":
app+= '<select id="' + id + '" class="form-control selectpicker field" data-live-search="true"></select>'
app+= '<select id="' + id + '" class="form-control selectpicker field" data-live-search="true"'
+ ((paramVal) ? 'data-active-option="' + paramVal + '"' : 'data-active-option=""') + '></select>'
break;
// free text
default:
app+= '<div class="input-group"><input type="text" class="form-control field freeform" data-text-processor="u" id="' + id + '" /><div class="input-group-btn"><button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
+'<span class="glyphicon glyphicon-menu-up" id="glyph' + id + '"></span></button>'
app+= '<div class="input-group"><input type="text" class="form-control field freeform" data-text-processor="u" id="' + id + '" '
+ ((paramVal) ? 'value="' + paramVal + '"' : '') + ' />'
+ '<div class="input-group-btn"><button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
+ '<span class="glyphicon glyphicon-menu-up" id="glyph' + id + '"></span></button>'
+ '<ul class="dropdown-menu dropdown-menu-right">'
+ '<li><a href="#" class="textProcessor" data-input-id="' + id + '" data-text-processor="u"><span class="glyphicon glyphicon-menu-up"></span> Uppercase</a></li>'
+ '<li><a href="#" class="textProcessor" data-input-id="' + id + '" data-text-processor="l"><span class="glyphicon glyphicon-menu-down"></span> Lowercase</a></li>'
......@@ -207,12 +216,14 @@ function SBMSPage(custom) {
// filling lists
$("select", "#params").each(function(key, selectEl) {
SBMSPage.prototype.loadList("types/" + SBMSPage.prototype.getField(selectEl.id) /*.replace("influenced.", "")*/, function(data, params) {
SBMSPage.prototype.loadList("types/" + SBMSPage.prototype.getField(selectEl.id), function(data, params) {
var select = $("#" + params[0]);
var attr = select.attr("data-active-option");
select.selectpicker();
var html = '<option value=""></option>';
for(i = 0; i < data.length; i++) {
html += '<option value="' + data[i] + '">' + data[i] + '</option>';
html += '<option value="' + data[i] + '" '
+ ((attr == data[i]) ? 'selected="selected"' : '') + ' >' + data[i] + '</option>';
}
select.html(html).selectpicker('refresh');
......@@ -295,31 +306,11 @@ function SBMSPage(custom) {
SBMSPage.prototype.getPropertyValueCell = function(dp, field) {
var propVal = this.getPropertyValue(dp, field);
//var tools = "";
/*
if(propVal != '') {
// result of the ajax call should be cached
$.ajax({
type: 'GET',
cache: true,
url: SBMSPage.prototype.sbmsURL + "types/field.source"
}).done( function(fieldsList) {
if(fieldsList[field] == "bim") {
$('td[data-prop-cell="' + field + '"]').append(' <button type="button" class="btn btn-default btn-xs mapButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span></button>');
}
});
}
*/
/*
if(this.getFieldDisplayCategory(field) == "map" && propVal != '') {
tools = ' <button type="button" class="btn btn-default btn-xs mapButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span></button>';
}
*/
return '<td class="propCell" data-field-value="' + propVal + '" data-field="' + field + '">' + $.t(propVal) + '</td>';
};
SBMSPage.prototype.enrichPropertyValueCells = function(parent, callback) {
SBMSPage.prototype.enrichPropertyValueCells = function(parent, callbackMap, callbackTrend, callbackBMS, callbackCAFM, callbackInfluenced, callbackInfluencing, callbackGlobal) {
if(SBMSPage.prototype.fieldCategories == null) {
$.ajax({
type: 'GET',
......@@ -327,36 +318,90 @@ function SBMSPage(custom) {
url: SBMSPage.prototype.sbmsURL + "fields/source"
}).done( function(fieldsList) {
this.fieldCategories = fieldsList;
SBMSPage.prototype.enrichPVC(parent, fieldsList, callback);
SBMSPage.prototype.enrichPVC(parent, fieldsList, callbackMap, callbackTrend, callbackBMS, callbackCAFM, callbackInfluenced, callbackInfluencing, callbackGlobal);
});
} else {
SBMSPage.prototype.enrichPVC(parent, this.fieldCategories, callback);
SBMSPage.prototype.enrichPVC(parent, this.fieldCategories, callbackMap, callbackTrend, callbackBMS, callbackCAFM, callbackInfluenced, callbackInfluencing, callbackGlobal);
}
}
SBMSPage.prototype.enrichPVC = function(parent, fl, callback) {
SBMSPage.prototype.enrichPVC = function(parent, fl, callbackMap, callbackTrend, callbackBMS, callbackCAFM, callbackInfluenced, callbackInfluencing, callbackGlobal) {
$(parent + ' td.propCell').each(function() {
var field = $(this).attr("data-field");
var propVal = $(this).attr("data-field-value");
if(propVal.trim() != "") {
var buttons = ' <div class="btn-group btn-group-xs" role="group">';
var bl = buttons.length;
//var buttonCount = 0;
if(fl[field] == "bim") {
$(this).append(' <button type="button" class="btn btn-default btn-xs mapButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span></button>');
// bim map
buttons += ' <button type="button" class="btn btn-default mapButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-map-marker" aria-hidden="true" title="' + $.t("button.hover.map") + '"></span></button>';
// cafm
// technology passport hack
if(propVal.length > 13) {
buttons += ' <button type="button" class="btn btn-default cafmButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-wrench" aria-hidden="true" title="' + $.t("button.hover.cafm") + '"></span></button>';
}
// Influencing
buttons += ' <button type="button" class="btn btn-default influencingButton" data-field="influenced.scope.bimId" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-random" aria-hidden="true" title="' + $.t("button.hover.influence") + '"></span></button>';
}
if(fl[field] == "bms") {
$(this).append(' <button type="button" class="btn btn-default btn-xs bmsButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>');
// BMS Present value
buttons += ' <button type="button" class="btn btn-default bmsButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-eye-open" aria-hidden="true" title="' + $.t("button.hover.bms") + '"></span></button>';
if(propVal.indexOf(".TL") > -1) {
// BMS Charts
for(var i = 0; i < SBMSPage.prototype.trendDBs.length; i++) {
if(propVal.startsWith(SBMSPage.prototype.trendDBs[i])) {
$(this).append(' <button type="button" class="btn btn-default btn-xs trendButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-stats" aria-hidden="true"></span></button>');
buttons += ' <button type="button" class="btn btn-default btn-xs trendButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-stats" aria-hidden="true" title="' + $.t("button.hover.charts") + '"></span></button>';
break;
}
}
} else {
// Influenced
buttons += ' <button type="button" class="btn btn-default btn-xs influencedButton" data-field="' + encodeURIComponent(field) + '" data-field-value="' + encodeURIComponent(propVal) + '"><span class="glyphicon glyphicon-random" aria-hidden="true" title="' + $.t("button.hover.influence") + '"></span></button>';
}
}
}
if(buttons.length > bl) {
$(this).append(buttons + "</div>");
}
}
});
callback();
// adding actions to buttons
$("button.mapButton").click(function() {
callbackMap(SBMSPage.prototype.mapURL + "?code=" + $(this).attr("data-field-value"), this);
});
$("button.trendButton").click(function() {
callbackTrend(SBMSPage.prototype.bmsChartsURL + "?tl=" + $(this).attr("data-field-value"), this);
});
$("button.bmsButton").click(function() {
var propVal = $(this).attr("data-field-value");
callbackBMS(SBMSPage.prototype.bmsURL.replace("{0}", propVal.replace(/[0-9\.]/g,"")).replace("{1}", propVal), this);
});
$("button.cafmButton").click(function() {
callbackCAFM(SBMSPage.prototype.cafmURL + "?wr.eq_id=" + $(this).attr("data-field-value"), this);
});
$("button.influencedButton").click(function() {
callbackInfluenced("query.html?" + $(this).attr("data-field") + "=" + $(this).attr("data-field-value") + "#QueryRelationsId", this);
});
$("button.influencingButton").click(function() {
callbackInfluencing("query.html?" + $(this).attr("data-field") + "=" + $(this).attr("data-field-value") + "#QueryRelationsIg", this);
});
callbackGlobal();
};
SBMSPage.prototype.buttonEnrichCallbackLink = function(url) {
location.href=url;
};
SBMSPage.prototype.buttonEnrichCallbackOpenWindow= function(url) {
window.open(url);
};
SBMSPage.prototype.setDpField = function(dp, field, val) {
......@@ -423,7 +468,9 @@ SBMSPage.prototype.loadPanelFromFile = function(srcSelector) {
p[src.attr("data-init-func")]();
$("#content").localize();
$('a[data-sbms-tab-href="yes"]').attr("href",src.children().first().attr("href"));
var srcHref = src.children().first().attr("href");
srcHref = srcHref.substring(srcHref.indexOf("#"));
$('a[data-sbms-tab-href="yes"]').attr("href", srcHref);
});
};
......
......@@ -145,7 +145,7 @@ var p = new SBMSPage ({
},
makeTableFromJSON: function(data, fieldsSelector, target) {
var html="<table id='jsonTable' class='table table-bordered table-hover'><thead><tr><th>group</th>";
var html="<table id='jsonTable' class='table table-bordered table-hover'><thead><tr><th>" + $.t("group") + "</th>";
var columns = 1;
/*
......@@ -193,28 +193,14 @@ var p = new SBMSPage ({
html += "</tbody></table>";
$(target).html(html);
p.enrichPropertyValueCells('#jsonTable', function() {
// adding actions to buttons
$(target + " .mapButton").click(function() {
$("#extFrame").attr("src", p.mapURL + "?code=" + $(this).attr("data-field-value"));
$("#fsSelect").dialog("open");
});
$(target + " .trendButton").click(function() {
//$("#kompasFrame").attr("src", mapURL + "?code=" + decodeURIComponent(this.id.substring(6)));
$("#extFrame").attr("src", p.bmsChartsURL + "?tl=" + $(this).attr("data-field-value"));
$("#fsSelect").dialog("open");
});
$(target + " .bmsButton").click(function() {
//$("#kompasFrame").attr("src", mapURL + "?code=" + decodeURIComponent(this.id.substring(6)));
var propVal = $(this).attr("data-field-value");
$("#extFrame").attr("src", SBMSPage.prototype.bmsURL.replace("{0}", propVal.replace(/[0-9\.]/g,"")).replace("{1}", propVal));
$("#fsSelect").dialog("open");
});
});
p.enrichPropertyValueCells('#jsonTable', p.callbackOpenDialog, p.callbackOpenDialog,
p.callbackOpenDialog, p.buttonEnrichCallbackOpenWindow,
p.buttonEnrichCallbackLink, p.buttonEnrichCallbackLink, function(){});
},
callbackOpenDialog(url) {
$("#extFrame").attr("src", url);
$("#fsSelect").dialog("open");
},
sendQuery: function () {
......@@ -290,6 +276,10 @@ var p = new SBMSPage ({
margin-top: 10px;
}
.resultsDiv {
overflow-x: auto;
}
</style>
......@@ -306,16 +296,16 @@ var p = new SBMSPage ({
<ul class="nav nav-tabs">
<li role="presentation" class="active opNav" id="navQueryDP"
data-init-func="initQueryDP"
data-incl-file="inclQueryDP.html"><a href="#QueryDP" data-i18n="Data Points">Data Points</a></li>
data-incl-file="inclQueryDP.html"><a href="query.html#QueryDP" data-i18n="Data Points">Data Points</a></li>
<li role="presentation" class="opNav" id="navQueryTrends"
data-init-func="initQueryTrends"
data-incl-file="inclQueryDP.html"><a href="#QueryTrends" data-i18n="Trends">Trends</a></li>
data-incl-file="inclQueryDP.html"><a href="query.html#QueryTrends" data-i18n="Trends">Trends</a></li>
<li role="presentation" class="opNav" id="navQueryRelationsIg"
data-init-func="initQueryRelationsIg"
data-incl-file="inclQueryRelations.html"><a href="#QueryRelationsIg"><span data-i18n="Relations">Relations</span> &ndash; <span data-i18n="Influencing">Influencing</span></a></li>
data-incl-file="inclQueryRelations.html"><a href="query.html#QueryRelationsIg"><span data-i18n="Relations">Relations</span> &ndash; <span data-i18n="Influencing">Influencing</span></a></li>
<li role="presentation" class="opNav" id="navQueryRelationsId"
data-init-func="initQueryRelationsId"
data-incl-file="inclQueryRelations.html"><a href="#QueryRelationsId"><span data-i18n="Relations">Relations</span> &ndash; <span data-i18n="Influenced">Influenced</span></a></li>
data-incl-file="inclQueryRelations.html"><a href="query.html#QueryRelationsId"><span data-i18n="Relations">Relations</span> &ndash; <span data-i18n="Influenced">Influenced</span></a></li>
</ul>
<div id="content"></div>
......@@ -350,7 +340,7 @@ var p = new SBMSPage ({
</div>
</form>
<div id="fsSelect" title="Select BIM ID and copy it using clipboard">
<div id="fsSelect" data-i18n="[title]External application" title="External application">
<iframe id="extFrame" style="width:100%;height:100%; border: 0px none transparent;" src="about:blank"></iframe>
</div>
<div id="treeSelect" title="Select value">
......
Supports Markdown
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