FSN#33047 QRC Codes inline op bonnen
svn path=/Website/trunk/; revision=25915
This commit is contained in:
@@ -214,6 +214,26 @@ function notificationMail(rec, p_notificationXSL, params)
|
||||
}
|
||||
else
|
||||
{
|
||||
var startPos = strResult.indexOf("qrc=") + 4;
|
||||
var quote = strResult.substr(startPos, 1);
|
||||
var eindPos = strResult.indexOf(quote, startPos + 2);
|
||||
if (startPos > 4 && eindPos > startPos)
|
||||
{
|
||||
var qrc = strResult.substring(startPos + 1, eindPos);
|
||||
qrc = qrc.replace(/\&/g, "&"); // Het was nog HTML/XML-encoded
|
||||
var xc = new ActiveXObject("SLNKDWF.QRCode");
|
||||
xc.Text = qrc;
|
||||
__Log("Creating QRC: " + qrc);
|
||||
var oXML = new ActiveXObject("Msxml2.DOMDocument.6.0");
|
||||
var oNode = oXML.createElement("encodeddata");
|
||||
oNode.dataType = "bin.base64"; // Zeer snelle oplossing
|
||||
oNode.nodeTypedValue = xc.GetAsPNG();
|
||||
var b64 = oNode.text;
|
||||
|
||||
var newbody = strResult.substr(0, startPos - 4) + "src=\"data:image/png;base64," + b64 + "\"" + strResult.substr(eindPos + 1);
|
||||
strResult = newbody;
|
||||
}
|
||||
|
||||
Log2File(2, "Mailnotificatie als attachment");
|
||||
sendMail( sender_email
|
||||
, receiver_email
|
||||
|
||||
@@ -116,18 +116,43 @@ function sendMail( p_mailfrom
|
||||
// objMail.TextBodyPart.Charset = S("puo_mailbodycharset"); // default "unicode-1-1-utf-8
|
||||
objMail.BodyPart.Charset = S("puo_mailbodycharset"); // default "unicode-1-1-utf-8
|
||||
|
||||
// qrc="https://aasa.facilitor.nl/?mobile=1&u=opdracht&k=32751" wordt omgezet naar
|
||||
// src="cid:qrc.png"
|
||||
// Ondertussen is het al HTML dus we kunnen geen XML-query doen
|
||||
// Daarom gewoon textueel opzoeken
|
||||
var startPos = p_bodyhtml.indexOf("qrc=") + 4;
|
||||
var quote = p_bodyhtml.substr(startPos, 1);
|
||||
var eindPos = p_bodyhtml.indexOf(quote, startPos + 2);
|
||||
if (startPos > 3 && eindPos > startPos)
|
||||
{
|
||||
var qrc = p_bodyhtml.substring(startPos + 1, eindPos);
|
||||
qrc = qrc.replace(/\&/g, "&"); // Het was nog HTML/XML-encoded
|
||||
var xc = new ActiveXObject("SLNKDWF.QRCode");
|
||||
xc.Text = qrc;
|
||||
Log2File(2, "Creating QRC: " + qrc);
|
||||
var oStream = new ActiveXObject("ADODB.Stream");
|
||||
oStream.Open;
|
||||
oStream.Type = 1; // binary
|
||||
oStream.Write(xc.GetAsPNG());
|
||||
var oCrypto = new ActiveXObject("SLNKDWF.Crypto"); // Maak random naam
|
||||
var sha1 = oCrypto.hex_sha1(qrc);
|
||||
var tempfile = custabspath + "/../../temp/puo_qr_" + sha1 + ".png";
|
||||
oStream.SaveToFile(tempfile, 2); // overwrite
|
||||
newbody = p_bodyhtml.substr(0, startPos - 4) + "src=\"cid:qrc.png\"" + p_bodyhtml.substr(eindPos + 1);
|
||||
p_bodyhtml = newbody;
|
||||
objMail.addRelatedBodyPart(tempfile, "qrc.png", 0);
|
||||
if (S("puo_loglevel") < 4)
|
||||
objFso.DeleteFile(tempfile);
|
||||
}
|
||||
|
||||
Log2File(2, "Before bodyHTML");
|
||||
objMail.HtmlBody = p_bodyhtml.replace(/\<br\>/g, "\x0D\x0A<br>");
|
||||
objMail.HTMLBodyPart.Charset = S("puo_mailbodycharset");
|
||||
//objMail.HTMLBodyPart.ContentTransferEncoding = "quoted-printable";
|
||||
|
||||
var startPos = p_bodyhtml.indexOf("cid:") + 4;
|
||||
var eindPos = p_bodyhtml.indexOf(".gif") + 4;
|
||||
if (startPos == 4 || eindPos == 4 || eindPos <= startPos || eindPos - startPos > 20)
|
||||
{
|
||||
// objMail.addRelatedBodyPart(logoPathName, logoFileName, 0);
|
||||
}
|
||||
else
|
||||
var eindPos = p_bodyhtml.indexOf(".gif", startPos) + 4;
|
||||
if (startPos >= 4 && eindPos > startPos && eindPos - startPos < 20)
|
||||
{
|
||||
var logoFileName = p_bodyhtml.substring(startPos, eindPos);
|
||||
var logoPathName = custabspath + "/" + logoFileName;
|
||||
|
||||
Reference in New Issue
Block a user