/ Forums / Advansys Formativ / Formativ Creator / Problems getting applet to work with Formativ 2.7 and Groupwise 2014 R2

  • Creator
    Topic
  • #5196
    dfischer
    Participant

      Hello there,

      I´m struggling to get a custom Formativ Applet to work with Grouwise 2014 R2 and Formativ 2.7. It is a very complex one which is in use for many years now in our company and it acts as a show stopper for the rollout of GW 2014 Client right now. We used the plugin since Groupwise 7 and it worked without any problems also for GW8 and 2012.

      The Situation:
      – Groupwise Backend is already updated to 2014 since last weekend.
      – GW Clients on our employees workstations are still GW 2012 (and there the applet is working).
      – GW 2012 client leads to single-sign-on difficulties in combination with 2014 backend so we are forced to update all clients as soon as possible to 2014.
      – Before we can do this our custom applet called “HTML Email” must be working with 2014 client.

      The “HTML Email” applet does the following:
      It is integrated with the Mail-OnSend Event (before) and brings up a custom form with a html preview of the mail and also the ability to load several html layouts with company logos and also signatures for our employees into the mail code. The data for the layouts and signatures is directly loaded from our Oracle database. Also the solution covers some DMS functionality and puts a custom email “barcode” to the document which is then recognized by our DMS application.

      The Problem:
      To accomplish the above mentioned functionality, the HTML part of the composed mail is loaded and modified by the solution directly before the mail is sent. This is done with the following sample code snippet:


      Dim oHTMLDom: Set oHTMLDom = utilities.HTMLDom
      Dim oHTMLView: Set oHTMLView = oHTMLDom.Document
      Set oHTMLDom = Nothing
      Dim res: res = utilities.IHTMLDocumentFromView(oHTMLView)
      Dim strHTMLFull: strHTMLFull = oHTMLView.body.parentElement.outerHTML
      Dim strHTMLBody: strHTMLBody = oHTMLView.body.innerHTML

      'For Debugging purposes:
      Set oFS = CreateObject("Scripting.FileSystemObject")
      FileWrite "C:test.htm", oHTMLView.body.parentElement.outerHTML

      This technically does still work and we get some HTML as a result, but: For GW 2012 and previous versions the result was the composed mail itself and the Applet could work with that code. With GW 2014 we don´t even get the mail content but instead a wild construct of html code with several .css and .js implementations and also e.g. the mail “To” element represented as html code.

      I assume the cause for this will be that GW 2014 uses a similar approach like our Applet and modifies the mail Content itself before it is sent. The Problem: This is not done when the “before send” event fires. So what we need is a possibility to

      1.) Get the complete mail content as HTML before the item is sent
      2.) Also modify this Content by our Applet before sent.

      This is the Major Problem right now. Another side Problem: The new “add signature” function in the mail window will definetly entangle our employees. Is there a way to disable this or maybe to use it with our Applet instead of the gw functionality?

      Thanks in advance for any help!

    • Author
      Replies
    • #10005
      Support 2
      Moderator

        Hello and thank you for your post and the information about your solution, which sounds great. As you have discovered, GroupWise 2014 introduced significant change in the way the GroupWise message view is rendered. More of the user interface functions are combined with the content within a complex HTML/jscript/CSS framework. Unfortunately this means you cannot use the utilities.HTMLDom with the GroupWise 2014 client in the same way as previous versions. There is an alternative approach which we are currently implementing in our Stationery and Multiple Signature applets and I will illustrate the alternative method to Utilities.HTMLDom below.

        Sub Main(Client, GWEvent)
        
        	dim gClient
        	set gClient = Client
        
        	'When you need to read/write the content of a composing message, use this approach:
        
        	dim iDoc 'HTML DOM Document Object
        	dim sHTML
        
                'Editing access to the IHTMLDocument interface provided by the Internet Explorer browser.
        	set iDoc = gClient.ClientState.HTMLEditor 
        
        	' Display the HTML DOM content below DOCTYPE! tag
        	sHTML = iDoc.documentElement.outerHTML
        
        	msgbox sHTML
        	
        End Sub

        If you want to get the HTML DOM Document content from a received message, use the following:

        'Viewing access to the ITHMLDocument interface provided by the Internet Explorer browser.
        set iDoc = gClient.ClientState.HTMLViewer

        The GroupWise Client API references for these commands are found here:

        http://www.novell.com/document…o/data/hye3ji8g.html

        With respect to signature prompt control in GroupWise 2014, we anticipated this requirement and upon request Novell added the IsSignatureAllowed property, which uses SignatureInsertionConstants shown below.

        0 – eGWSignatureNone – disables all signature insertions
        1 – eGWSignatureWithMessage – allows the signature to be inserted into the message
        2 – eGWSignatureWithPrompt – allows the signature prompt at send time
        1 – eGWSignatureDefault – currently defined as eGWSignatureWithMessage

        A test applet example is shown below.

        Sub Main(Client, GWEvent)
           set myClientState = Client.ClientState
           if myClientState.IsSignatureAllowed then
             myClientState.IsSignatureAllowed = 0
             'MsgBox("Signature disabled [" + ToStr(SigState) + "]")
             MsgBox("Signature DISABLED")
           else
             myClientState.IsSignatureAllowed = 1
             'MsgBox("Signature enabled [" + ToStr(SigState) + "]")
             MsgBox("Signature ENABLED")
           end if
        End Sub

        Novell have made some adjustments for our Stationery and Multiple Signatures solution. We are also implementing the adoDbStream function in our Stationery solution which enables the streaming a file to disk and also to set the character encoding when saving. This can help with preserving UTF8 and ANSI encoded files. If you want further information we can email you directly.

        We are interested in learning more your Formativ solution and hope the above information enables you to move past this technical road block. If you wish to send more details via email, please email them to support AT advansyscorp.com.

        Kind Regards,

        Advansys Support

        #10003
        dfischer
        Participant

          Hello,

          thank you for the fast and helpful response! I have tested your alternative method in a short sample applet with success. The next step is now to implement it in our applet and this will take some time (about 2.400 lines of code which are several years old…). I´ll start this work now and keep you updated.

          After solving our actual urgent problem I would be happy to send you some further information about our applet, I´ll do this by mail then. The biggest part of it is very specific for our company (DMS System “Optimal Systems OS.ECM”, Oracle Database with custom tables for layouts, signatures and employee data)… but maybe it is still interesting for you somehow 🙂

          Kind Regards
          Daniel Fischer

          #10004
          Support 2
          Moderator

            Hello Daniel,

            Thank you for your quick feedback and we look forward to learning how you progress.

            At a convenient time for you, we are certainly interested in learning more about your solution.

            Kind Regards,

            Advansys Support

            #10000
            dfischer
            Participant

              Hello again,

              to give a short update: Our applet is nearly finished and works great.

              There is one thing left which is a bit “unattractive” with the applets form:

              There is a “EmbeddedWB” element on it which shows the mail preview with signature / layout. With Formativ 2.6 this element was not editable and always showed the vertical scrollbar (automatically disabled as long as content fits on one page).

              Now with Formativ 2.7 the scrollbar is not present at start but it shows when content exceeds one page as one difference – but this is OK. The disturbing thing is that the control element is editable now! It is possible to delete the preview text or add something to it inside the EmbeddedWB control – this should be prevented.

              I did not find a solution to this and tried the most properties already without success. Any ideas?

              #10001
              Support 2
              Moderator

                Hello Daniel and thank you for the positive update. With respect to the EmbeddedWB, there were no Formativ code changes made to this component between version 2.6 and 2.7. As EmbeddedWB is a wrapper for the IE ActiveX, if your code has not changed then it may be the underlying IE component’s behavior has changed.

                Before we can provide additional feedback we need to replicate and review the behavior you describe. Are you able to provide the source code for simple test applet which illustrates this issue?

                Does the behavior change between Formativ 2.6 and 2.7 regardless of underlying Windows OS version?

                You may also use Techsmith’s free Jing software to record a short video of the applet behavior with Formativ 2.6 and 2.7 and send us the links to review.

                Techsmith Jing: https://www.techsmith.com/jing.html

                Please send information via email to support AT advansyscorp.com.

                Kind Regards,

                Advansys Support

                #10002
                dfischer
                Participant

                  Good morning,

                  the Windows version seems to be irrelevant – we could reproduce the different behaviour on the same Windows 7 Workstation. With GW 2012 and Formativ 2.6 the preview is not editable there, with GW 2014 and Formativ 2.7 its content can be accessed and changed by the user.

                  The IE was also one of my first ideas but on the above mentioned test workstation the IE 11 is present and was not changed for the tests with GW2012 / Formativ 2.6 or GW2014 / Formativ 2.7.

                  I will set up a short test applet for you and send it via mail then.

                  Thanks in advance Smile

                  #9999
                  dfischer
                  Participant

                    Hello,

                    right now I found the cause of the Problem! This is the Groupwise 2014 Default HTML content for a new message with only the word “test” in body:

                    <html><head>
                    <meta http-equiv="X-UA-Compatible" content="IE=11">
                    <meta name="Generator" content="Novell Groupwise Client (Version 14.2.0  Build: 122716)">
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="C:UsersDFISCH~1.SEEAppDataLocalTempXPgrpwiseGWReply.css" rel="stylesheet"></head>
                    <body style="font: 10pt/normal Segoe UI; margin: 16px 16px 4px; font-size-adjust: none; font-stretch: normal;" contenteditable="true"><div class="GroupWiseMessageBody active" id="GroupWiseSection_1457080157000_Daniel.Fischer@seele.com_0F23E78118F70000818E001185C16B56_">test</div></body></html>
                    

                    The Problem is the body tag and there the contenteditable=”true”…

                    I have to do some testing now. Maybe I can easily set this to false for the preview and afterwards to true again when the mail is sent.

                    #10006
                    Support 2
                    Moderator

                      Hello Daniel,

                      Thank you for the update and that does make sense. At this stage I cannot think of a reason why you could not manipulate the HTML tag styles/attributes to suit your preview requirements.

                      We look forward to hearing how you progress.

                      Kind Regards,

                      Advansys Support

                      #10007
                      dfischer
                      Participant

                        Hello Support,

                        very good News: Today I have launched an internal Test for our Applet at the IT department and it seems to be stable now.

                        It was very difficult in the end to handle all the changes of GroupWise 2014 concerning HTML structure with our Applet. To be honest I am a Little bit bugged out about these changes now. The idea of the new div containers with classnames like GroupWiseMessageBody or GroupWiseReplyHeader is nice and helpful but the implementation in the different use cases seems to be defective or at least sloppy. I don´t know if you have contact to somebody at Novell who is responsible for this, I really hope they make it better with a future release…

                        I would not be surprised if you have the same issues with your stationery applet. What I´m talking about is the following in Detail:

                        For a new Mail (not Reply / Forward) the first line is surrounded by <div class=”GroupWiseMessageBody active” id=”…”> and this container closes right after the first line. All further lines come with another “<div class=”GroupWiseMessageBody active”> – container around them. In case of reply or forward there is just one “GroupwiseMessageBody active” and at this time it goes around the whole new content – that makes more sense. Also there are some bugs in the handling of original mail content. The body gets some ridiculous <meta…> Tags along with them and also some unnecessary line breaks. Also the original mail contents and their headers overlap their code (meta tags) sometimes.

                        All these things had to be solved manually. Here is some code snippet I wrote for this…I know it is dirty somehow but it seems to work stable with our Applet:

                          'Separate head and foot content and put a div with GroupWiseMessageBody and ID around Body
                          Set oHTMLView = oClient.ClientState.HTMLEditor
                          Dim oBody: Set oBody = oHTMLView.body
                          Dim strBody: strBody = oBody.innerHTML
                          If InStr(1, strBody, "<bodycontent>", 1) = 0 And InStr(1, strBody, "</bodycontent>", 1) = 0 Then
                            oBody.innerHTML = "<bodycontent>" & strBody & "</bodycontent>"
                          End If
                          strBody = oBody.innerHTML
                          Dim strTemp: strTemp = oHTMLView.documentElement.outerHTML
                          strTemp = Replace(strTemp, strBody, "<bodyreplaced/>", 1, 1, 1)
                          strTemp = Split(strTemp, "<bodyreplaced/>", -1, 1)
                          strHTMLHead = Replace(strTemp(0), "contenteditable=""true""", "contenteditable=""false""", 1, -1, 1)
                          strHTMLFoot = strTemp(UBound(strTemp))
                          strTemp = ""
                          Dim oRegEx: Set oRegEx = CreateObject("VBScript.RegExp")
                          oRegEx.Global = True
                          oRegEx.IgnoreCase = True
                          oRegEx.Pattern = "<div(s|n)*class=""GroupWiseMessageBody active""(s|n)*id=""[^""]*"">"
                          Dim oMatches: Set oMatches = oRegEx.Execute(strBody)
                          If oMatches.Count = 1 Then
                            strHTMLHead = strHTMLHead & oMatches(0).Value
                            strHTMLFoot = "</div>" & strHTMLFoot
                            strBody = oRegEx.Replace(strBody, "")
                            Dim p1: p1 = InStr(1, strBody, "<div", 1)
                            Dim p2: p2 = InStr(1, strBody, "</div>", 1)
                            If p1 > 0 And p2 > 0 And p2 < p1 Then
                              strBody = Replace(strBody, "</div>", "", 1, 1, 1)
                            End If
                          End If
                        
                          'Separate new and old content from Body
                          strHTMLNew = ""
                          strHTMLOld = ""
                          Dim oGWBodyReply: Set oGWBodyReply = oBody.getElementsByClassName("GroupwiseReplyHeader")
                          If oGWBodyReply.Length > 0 Then
                            Dim oGWBodyReplyElement
                            For Each oGWBodyReplyElement in oGWBodyReply
                              strHTMLOld = strHTMLOld & oGWBodyReplyElement.parentElement.outerHTML
                              strBody = Replace(strBody, oGWBodyReplyElement.parentElement.outerHTML, "", 1, -1, 1)
                            Next
                          End If
                          strHTMLNew = strBody
                        
                          'Remove meta and bodycontent - Tags and double Line Breaks from content
                          strHTMLNew = Replace(strHTMLNew, "<bodycontent>", "", 1, -1, 1)
                          strHTMLNew = Replace(strHTMLNew, "</bodycontent>", "", 1, -1, 1)
                          Dim oMeta: Set oMeta = oBody.getElementsByTagName("meta")
                          If oMeta.Length > 0 Then
                            Dim oMetaTag
                            For Each oMetaTag in oMeta
                              strHTMLNew = Replace(strHTMLNew, oMetaTag.outerHTML, "", 1, -1, 1)
                              strHTMLOld = Replace(strHTMLOld, oMetaTag.outerHTML, "", 1, -1, 1)
                            Next
                          End If
                          While InStr(1, strHTMLNew, vbLf & vbLf, 0) > 0
                            strHTMLNew = Replace(strHTMLNew, vbLf & vbLf, vbLf, 1, -1, 0)
                          Wend
                          While InStr(1, strHTMLOld, vbLf & vbLf, 0) > 0
                            strHTMLOld = Replace(strHTMLOld, vbLf & vbLf, vbLf, 1, -1, 0)
                          Wend
                        
                          'Remove trailing empty Lines from new content
                          Dim strAppend: strAppend = ""
                          oRegEx.Pattern = "</div>(s|n)*</div>(s|n)*$"
                          If oRegEx.Test(strHTMLNew) Then
                            strAppend = "</div>"
                            strHTMLNew = oRegEx.Replace(strHTMLNew, strAppend)
                          End If
                          oRegEx.Pattern = "(<div(n|s|class=""GroupWiseMessageBody active"")*>(s|n| |<br>)*</div>(s|n| |<br>)*)*$"
                          strHTMLNew = oRegEx.Replace(strHTMLNew, "")
                          oRegEx.Pattern = "(s|n| |<br>)*</div>(s|n| |<br>)*$"
                          strHTMLNew = oRegEx.Replace(strHTMLNew, "<br></div>")
                          strHTMLNew = strHTMLNew & strAppend
                        
                          'This codes gives us strHTMLHead, strHTMLNew, strHTMLOld, strHTMLFoot and these components can then later be used with or inserted into our different html layouts or alternatively just put together in this order for a Default HTML Mail without layout.
                        

                        As soon as I find the time for it I´m going to provide you with further Information about our Applet by mail as promised.

                        #10008
                        Support 2
                        Moderator

                          Hello Daniel,

                          Thank you very much for your feedback and for sharing the code. Yes, indeed, we had to adapt to the many changes we discovered in GroupWise 2014 and we have worked with Micro Focus engineering to help streamline functionality. Like every choice of technology and new implementations, there are always trade-offs and sometimes unintended consequences.

                          Our stationery solution uses the FileRetrieve token to load the initial HTML stationery file into a GroupWise draft message and we use the DOM to massage the HTML content it when necessary. Your implementation appears more modular and perhaps offers changes to the message layout at different stages of the process.

                          We look forward to learning more of your progress and will notify Micro Focus engineering of your efforts and results.

                          Kind Regards,

                          Advansys Support

                        Viewing 10 replies - 1 through 10 (of 10 total)
                        • You must be logged in to reply to this topic.