Details

      Description

      CalEventLocalServiceImpl.toICalVEvent() simply adds the description to the resulting iCal4j VEvent by calling new Description(event.getDescription()).

      This leads to HTML markup embedded in the calendar export since the implementation of LPS-7966.

      HTML markup needs to be removed from the description suring export or replaced with newlines/tabs in some cases.

      The following code snippet could be an indication on what could be possibly done:

      String descriptionStr = event.getDescription();
      		
      descriptionStr = StringUtil.trim(description);
      descriptionStr = description.replaceAll("\r|\n|\t", StringPool.BLANK);
      descriptionStr = description.replaceAll("(?i) ", StringPool.SPACE);
      descriptionStr = description.replaceAll("(?i)<li>", "\n* ");
      descriptionStr = description.replaceAll("(?i)<dd>", "\n\t");
      descriptionStr = description.replaceAll("(?i)<td>", "\t");
      descriptionStr = description.replaceAll("(?i)<a.+href=\"(.+)\"(?:/>|>.*</a>)", "$1");
      descriptionStr = description.replaceAll("(?i)</?(?:br|p|div|h.|dt|tr)/?>(?!$)", StringPool.NEW_LINE);
      descriptionStr = HtmlUtil.unescape(description);
      descriptionStr = HtmlUtil.stripHtml(description);
      descriptionStr = description.replaceAll("(?:\\n\\s*)+", StringPool.NEW_LINE);
      
      Description description = new Description(descriptionStr);
      

      In addition the HTML version of the description could be added in the X-ALT-DESC property to allow calendars like Outlook to still show the full HTML.

      final XProperty altDesc = new XProperty("X-ALT-DESC", event.getDescription());
      altDesc.getParameters().add(new XParameter("FMTTYPE", "text/html"));
      eventProps.add(altDesc);
      

      We have performed a short test in Outlook 2007 with this snippet.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dennys.barros Dennys Barros (Inactive)
              Reporter:
              sun Soeren Unruh
              Participants of an Issue:
              Recent user:
              Jonathan McCann
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 37 weeks, 2 days ago

                  Packages

                  Version Package
                  7.0.10.13 DXP SP13
                  7.0.X
                  7.1.X
                  7.2.X
                  7.3.0 CE GA1
                  7.3.1 CE GA2
                  7.3.10 DXP GA1
                  Master