Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 234493

Re: Styling email message templates in 9.1.5

$
0
0

After some researching I've found interesting things:

IN_HTMLEDITOR control property bodyHTML does not accept <style> tags. However it has another property HTML where all html source of the template is stored (including heading and custom stylesheets).

Besides the control has property BodyOnly. By default its value is "true" and if you set the value to "false" then all html template content (including custom stylesheets) will be sent as message.

 

Nevertheless if you wish to display your message in the control itself correctly you still need to set StyleText property with your custom styles (thank you Gary for this valuable advice). A good thing is you can do it dynamically (see the solution below).

 

So, as workaround [taking all the risk on your own =) ] you may try this solution:

  • Add new script references to jquery and custom file in the file InEmail.html:

...
<script language="javascript" src="InWindowScroll.js"></script>

<script language="javascript" src="jquery-1.4.2.js" type="text/JavaScript"></script>
<script language="javascript" src="Custom_InEmail.js"></script>

<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Send Email</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="infra90.css">
</head>
...

  • Create file Custom_InEmail.js with the following content:

        function PopulateMessage(rs)
        {
           if (rs.eof) return InAlert(LoadText(322),LoadText(952));
           var MsgMapRef = rs.Fields.Item("MAP_REF").value;
           var MsgFormat = rs.Fields.Item("FORMAT").value;
           var MsgSubject = TrimString(rs.Fields.Item("SUBJECT").value);
           var MsgBody = TrimString(rs.Fields.Item("BODY").value);
           var MsgPriority = rs.Fields.Item("PRIORITY").value;
           da.PARTITION.value = rs.Fields.Item("PARTITION").value;
           da.EMBEDDED_OBJECTS.value = TrimString(rs.Fields.Item("ATTACHMENTS").value);
           da.SUBJECT.value = MsgSubject;
           da.OUTPUT_FORMAT.value = MsgFormat;
           SetSelectValue(da.MESSAGE_MAP_REF, MsgMapRef);
           SetSelectValue(da.EMAIL_FORMAT, MsgFormat);
           SetRadioValue(da.PRIORITY, MsgPriority);

           var oHtmEd = document.all("EMAIL_BODY_HTML_EDITOR");

           if (MsgFormat == FORMAT_HTML || MsgFormat == FORMAT_RELATED_HTML)
           {

              //--> Customization. 2013.05.14
              oHtmEd.BodyOnly=false;
              oHtmEd.StyleText=z_get_stylesheets(MsgBody);
              //--< End of Customization
             
              document.all(oHtmEd.HTMLField).value = MsgBody;
              setHTMLEditorFormat(FORMAT_HTML);
           }
           else
           {
              document.all(oHtmEd.PlainTextField).value = MsgBody;
              setHTMLEditorFormat(FORMAT_PLAINTEXT);
           }

           InitialFormat = MsgFormat;
           InitialMapRef = MsgMapRef;
           SetFocus(da.SUBJECT);
        }

        function z_get_stylesheets(sHtml) {
            var ret='';
            var tpl_doc=$('<div id="root_node">'+sHtml+'</div>').filter('#root_node')[0];
            $(tpl_doc).find("style").each(function() {ret+=$(this).html();});
            return ret;
        }

  • Recycle IIS application pool used by VSM web site and clear the local client cache [<Ctrl>+<Shift>+<1>].

 

I will repeat this should be used just as workaround. Permanent HTMLEditor control fixes and enhancements would be really very useful in the future.

 

Regs, Gytis


Viewing all articles
Browse latest Browse all 234493

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>