Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      I am playing with Table and had a Decorator set up to display three clickable images (read, edit and delete). Each of these ActionLinks was represented with a label that held an image.

      E.g.
      viewLink.setListener(this, "onViewClick");
      viewLink.setLabel("<img src=\"/dca/images/buttons/lightbulb.gif\">");
      viewLink.setAttribute("title", "View access control details");

      This worked until I moved to Click 0.15, which uses HTMLStringBuffer to render the link in the Decorator.

      Line 574 in ActionLink has 'buffer.appendEscaped(getLabel());'

      This is escaping the brackets around the <img src=...> labels that I am assigning. Eg I get <img src=...

      Maybe a solution is to set a boolean on the ActionLink/Control to indicate whether to allow HTML in the label?

      Eg

      viewLink.shouldEscapeHTML(false)?

      And in ActionLink (and elsewhere in toString methods in Control subclasse?)

      line 574:
      if (shouldEscapeHTML) buffer.appendEscaped(getLabel())
      else buffer.append(getLabel());

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        I think the solution is just to append the raw string value:

        buffer.append(getLabel());

        Show
        medgar Malcolm Edgar added a comment - I think the solution is just to append the raw string value: buffer.append(getLabel());
        Hide
        ghopson Geoff Hopson added a comment -

        That is the simple solution, yes, but I quite like the idea of an HTML-safe-by-default approach, with the onus on the developer to override when required (as implied with the boolean setting).

        Show
        ghopson Geoff Hopson added a comment - That is the simple solution, yes, but I quite like the idea of an HTML-safe-by-default approach, with the onus on the developer to override when required (as implied with the boolean setting).
        Hide
        medgar Malcolm Edgar added a comment -

        This rendering fix is now tied up with the new i18n work, and wont be checked into CVS until next week.

        This fix will be available in release 0.16

        Show
        medgar Malcolm Edgar added a comment - This rendering fix is now tied up with the new i18n work, and wont be checked into CVS until next week. This fix will be available in release 0.16
        Hide
        medgar Malcolm Edgar added a comment -

        Fix is checked into CVS.

        Show
        medgar Malcolm Edgar added a comment - Fix is checked into CVS.

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            ghopson Geoff Hopson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development