Ero sivun ”Widget:LeväseurantataulukkoALL” versioiden välillä
Järvi-meriwikistä
Rivi 91: | Rivi 91: | ||
resultItem = request.query.results[i].printouts; | resultItem = request.query.results[i].printouts; | ||
resultObj = new Object(); | resultObj = new Object(); | ||
+ | resultObj.hasObses = false; | ||
resultObj.site = request.query.results[i].fulltext; | resultObj.site = request.query.results[i].fulltext; | ||
resultObj.SiteID = resultItem.SiteID[0]; | resultObj.SiteID = resultItem.SiteID[0]; | ||
Rivi 127: | Rivi 128: | ||
algalNum = rowRequest.query.results[e].printouts.Levätilanne[0]; | algalNum = rowRequest.query.results[e].printouts.Levätilanne[0]; | ||
resultArr[this.index].weeks[week] = algalNum; | resultArr[this.index].weeks[week] = algalNum; | ||
+ | resultArr[this.index].hasObses = true; | ||
} | } | ||
for (var f=minWeek; f<(maxWeek+1); f++) { | for (var f=minWeek; f<(maxWeek+1); f++) { | ||
Rivi 151: | Rivi 153: | ||
function dataReady() { | function dataReady() { | ||
+ | |||
console.log( resultArr ); | console.log( resultArr ); | ||
+ | |||
var output = ""; | var output = ""; | ||
output += '<div class="mw-content-ltr">' | output += '<div class="mw-content-ltr">' | ||
Rivi 169: | Rivi 173: | ||
//exportCsv = "Havaintopaikka;Vesistö;Merialue;Kunta;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39"; | //exportCsv = "Havaintopaikka;Vesistö;Merialue;Kunta;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39"; | ||
− | for (c = 0; c < resultArr.length; c++) { | + | for (c = 0; c < resultArr.length; c++) { |
− | output += '<tr>'; | + | |
− | + | if ( resultArr[ c ].hasObses ) { | |
− | + | ||
− | + | output += '<tr>'; | |
− | + | if (resultArr[c].type == 'Meri') { | |
− | + | output += '<td data-sort-value="1" valign="middle" class="smwtype_qty">'; | |
− | + | output += '<a href="' + resultArr[c].url + '">'; | |
− | + | output += '<img alt="Merialue" src="//www.jarviwiki.fi/w/images/a/ac/Pm_hp_asiantuntija_1_27x27.png" width="27" height="27" style="vertical-align: middle" />'; | |
− | + | output += '</a></td>'; | |
− | + | } else { | |
− | + | output += '<td data-sort-value="0" valign="middle" class="smwtype_qty">'; | |
− | + | output += '<a href="' + resultArr[c].url + '">'; | |
− | + | output += '<img alt="Sisävesi" src="//www.jarviwiki.fi/w/images/f/f3/Pm_hp_asiantuntija_2_27x27.png" width="27" height="27" style="vertical-align: middle" />'; | |
− | + | output += '</a></td>'; | |
+ | } | ||
+ | output += '<td class="smwtype_wpg"><a href="' + resultArr[c].wBodyUrl + '">' + resultArr[c].wBody + '</a></td>'; | ||
+ | output += '<td class="smwtype_wpg">' + resultArr[c].basin + '</td>'; | ||
− | + | nimi = resultArr[c].site; | |
− | + | nimi = nimi.substr(nimi.lastIndexOf('/')); | |
− | + | if (nimi.indexOf('(') != -1) { | |
− | + | nimi = nimi.substr(nimi.indexOf('(')); | |
− | + | nimi = nimi.substr(1); | |
− | + | nimi = nimi.substr(0, nimi.length-1); | |
− | + | } else { | |
− | + | nimi = ''; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | output += '<td class="smwtype_wpg">' + nimi + '</td>'; | ||
+ | output += '<td class="smwtype_wpg"><a href="' + resultArr[c].munUrl + '">' + resultArr[c].mun + '</a></td>'; | ||
+ | for (var d = minWeek; d < (maxWeek+1); d++) { | ||
+ | switch (resultArr[c].weeks[d]) { | ||
+ | case -1: | ||
+ | if (expert && d == curWeek) { | ||
+ | output += '<td data-sort-value="-1" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:none;">'; | ||
+ | output += '<a href="//www.jarviwiki.fi/wiki/Toiminnot:Lomakemuokkaus/Lev%C3%A4havainto/' + encodeURI(resultArr[c].site) + '">[+]</a>'; | ||
+ | output += '</td>'; | ||
+ | } else { | ||
+ | output += '<td data-sort-value="-1" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:none;">-</td>'; | ||
+ | } | ||
+ | break; | ||
+ | case 0: | ||
+ | output += '<td data-sort-value="0" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:none;">0</td>'; | ||
+ | break; | ||
+ | case 1: | ||
+ | output += '<td data-sort-value="1" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:#6a9d38;">1</td>'; | ||
+ | break; | ||
+ | case 2: | ||
+ | output += '<td data-sort-value="2" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:#fd9f00;">2</td>'; | ||
+ | break; | ||
+ | case 3: | ||
+ | output += '<td data-sort-value="3" class="smwtype_qty" style="text-align: center; vertical-align: middle; background-color:#c80000;">3</td>'; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | output += '</tr>'; | ||
} | } | ||
− | |||
} | } | ||
output += '</tbody><tfoot></tfoot></table></div>'; | output += '</tbody><tfoot></tfoot></table></div>'; |