NMPC#35150 (besartikel)Plaatjes kunnen tonen in suggest.

svn path=/Website/trunk/; revision=28304
This commit is contained in:
Jos Groot Lipman
2016-02-25 15:47:09 +00:00
parent 3bbab3e630
commit d966250482
4 changed files with 44 additions and 17 deletions

View File

@@ -58,11 +58,16 @@ function WriteResult2(sql, params)
(params.fldExtraParam? oRs(params.fldExtraParam).Value : null)
];
if (params.fldTitle) result.push(oRs(params.fldTitle).Value||"");
if (params.fldFoto)
if (params.fnFoto)
{
if (!params.fldTitle)
result.push("");
result.push(oRs(params.fldFoto).Value||"");
var foto = params.fnFoto(oRs);
if (foto)
{
result.push(foto);
jsonResult.anyfoto = true;
}
}
lijst.push(result);

View File

@@ -38,6 +38,7 @@ sql = "SELECT " + lcl.xsqla('bd.ins_discipline_omschrijving', 'bd.ins_discipline
+ " descr"
+ " , bes_srtdeel_key"
+ " , nvl2(isd.bes_srtdeel_image, p.prs_bedrijf_image_loc || isd.bes_srtdeel_image, null) foto"
+ " , bd.ins_discipline_key"
+ " FROM bes_srtdeel isd"
+ " , bes_srtgroep isg"
+ " , bes_discipline bd"
@@ -66,11 +67,19 @@ sql += " ORDER BY isd.bes_srtdeel_volgnr"
+ ", " + lcl.xsql('bd.ins_discipline_omschrijving', 'bd.ins_discipline_key')
+ ", " + lcl.xsql('bes_srtgroep_omschrijving','isg.bes_srtgroep_key');
function fnBesPhoto(oRs)
{
var icon = oRs("foto").Value || "";
if (icon.indexOf("/") == -1) // Nog geen enkele slash? Dan moet het wel lokaal zijn.
icon = S("bes_image_path") + oRs("ins_discipline_key").Value + "/" + icon;
return icon;
}
var params = { bAll: bAll,
fldName: "descr",
fldKey: "bes_srtdeel_key",
fldDesc: (disc_key > 0)?"bes_srtgroep_omschrijving":"ins_discipline_omschrijving",
fldFoto: "foto"
fnFoto: fnBesPhoto
}
WriteResult2(sql, params);

View File

@@ -4,7 +4,7 @@
*/
/* suggestbox styles (from 4i) */
/* suggestbox styles */
.suggest {
background-image:url(suggest.png) ;
background-repeat:no-repeat;
@@ -18,8 +18,8 @@ input.suggestBusy { background-color:#E0FFE0;
background-image:url(busybar.gif) ;
background-repeat:no-repeat;
background-position:right; }
.suggestsr, .suggestsrs {width: 100%; overflow: hidden; font-family : Verdana ;font-size: 8pt;}
.suggestsr, .suggestsrs {width: 100%; overflow: hidden; font-family : Verdana ;font-size: 8pt;}
.suggestsr, .suggestsrs {width: 100%; overflow: hidden; font-family : Verdana ;font-size: 8pt; vertical-align: middle;}
.suggestsr { background-color : #fff; color : #000; }
.suggestsrs { background-color : #36c; color : #fff; cursor : pointer; }
.suggestsr .suggestsrc { color : #008000; }
@@ -34,8 +34,13 @@ input.suggestBusy { background-color:#E0FFE0;
font-style : italic;
}
.suggestfoto {
height: 20;
img.suggestfoto, div.suggestfoto {
height: 40px;
width: auto; /* lijkt nodig voor IE9 */
float : left;
margin-left : 0px;
}
div.suggestfoto {
width: 40px;
}

View File

@@ -729,7 +729,6 @@ function Suggest(inParams)
else
$(_completeDiv).removeClass("suggestsimilar");
var hasfoto = false;
for (var i = 0; i < resultsObj.result.length; i++)
{
if (resultsObj.result[i][0])
@@ -752,16 +751,25 @@ function Suggest(inParams)
xDiv.onmousedown = function() { setValues(true);hideAutocompleteDiv(); return true; };
if (resultsObj.result[i].length > 4)
xDiv.title = resultsObj.result[i][4];
if (resultsObj.result[i].length > 5) // Image erbij
if (resultsObj.anyfoto)
{
var xFoto = thisdoc.createElement("img");
xFoto.setAttribute("src", resultsObj.result[i][5]);
xFoto.setAttribute("height", "40");
xFoto.className = "suggestfoto";
xDiv.appendChild(xFoto);
hasfoto = true;
var fotourl = resultsObj.result[i][5]
if (fotourl && fotourl.match(/\.(png|jpg|jpeg)$/)) // het is een image
{
var xFoto = thisdoc.createElement("img");
xFoto.setAttribute("src", fotourl);
xFoto.setAttribute("height", "40");
xFoto.className = "suggestfoto";
xDiv.appendChild(xFoto);
}
else
{
var xFoto = thisdoc.createElement("div");
xFoto.innerHTML = "&nbsp;";
xFoto.className = "suggestfoto";
xDiv.appendChild(xFoto);
}
}
var xSpan = thisdoc.createElement("span");
xSpan.className = "suggestsrt";
if (i == 0 &&