Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21124

Checkbox custom attributes on custom tags are not stored

    Details

      Description

      Steps to reproduce:

      Create or use one extension that defines a custom tag with a checkbox custom attribute not checked as default.

      When we check the attribute and click ok, ezoe will not apply it, if we try to edit the custom tag again we will see that the checkbox will not be checked, also if check and publish, ez publish will not save the value as well.

      test case:

      setup in content.ini settings:

      [newattr]
      CustomAttributes[]
      CustomAttributes[]=title
      CustomAttributes[]=testbox
      CustomAttributesDefaults[title]=texthere

      and in ezoe_attributes.ini:

      [CustomAttribute_newattr_title]
      Name=Some title
      Type=text

      [CustomAttribute_newattr_testbox]
      Name=TestBox
      Type=checkbox

        Issue Links

          Activity

          Hide
          Thiago Campos Viana added a comment - - edited

          Here's my workaround:

          Change extension/ezoe/design/standard/templates/ezoe/customattributes/checkbox.tpl with:

          http://pastebin.com/eCHg2Q8G

          Show
          Thiago Campos Viana added a comment - - edited Here's my workaround: Change extension/ezoe/design/standard/templates/ezoe/customattributes/checkbox.tpl with: http://pastebin.com/eCHg2Q8G
          Hide
          Thiago Campos Viana added a comment -

          Yesterday I was discussing with Peter from mugo, and he found out that the problem may relies on:

          extension/ezoe/design/standard/javascript/ezoe/popup_utils.js

          There are some references to deprecated jQuery functions, if we replace:

          o.attr("checked")

          With

          o.is(':checked')

          Then the checkbox will almost work properly, the only problem is that when we disable and enable the editor it won't save the attribute properly, maybe it is because there are more deprecated stuff being used somewhere. My workaround is still the best option.

          Show
          Thiago Campos Viana added a comment - Yesterday I was discussing with Peter from mugo, and he found out that the problem may relies on: extension/ezoe/design/standard/javascript/ezoe/popup_utils.js There are some references to deprecated jQuery functions, if we replace: o.attr("checked") With o.is(':checked') Then the checkbox will almost work properly, the only problem is that when we disable and enable the editor it won't save the attribute properly, maybe it is because there are more deprecated stuff being used somewhere. My workaround is still the best option.
          Show
          Damien Pobel (Inactive) added a comment - PR: https://github.com/ezsystems/ezpublish-legacy/pull/896
          Hide
          Damien Pobel (Inactive) added a comment -

          Thanks Thiago for your comment, that's exactly what I've found. For the disable/enable editor, I think this happens if you don't set a "Default" in the custom attribute settings and from what I see, it's a different issue that seems to have been there like for ever!

          Show
          Damien Pobel (Inactive) added a comment - Thanks Thiago for your comment, that's exactly what I've found. For the disable/enable editor, I think this happens if you don't set a "Default" in the custom attribute settings and from what I see, it's a different issue that seems to have been there like for ever!
          Hide
          Peter Keung added a comment -

          Is the value something users rely on? If not, we could just hardcode it to "1".

          Show
          Peter Keung added a comment - Is the value something users rely on? If not, we could just hardcode it to "1".
          Hide
          Thiago Campos Viana added a comment - - edited

          So, here is my final thought about the disable/enable editor problem.

          When we check the checkbox, the value that will appears is the default value in the disabled editor, ONLY when the checkbox is checked, if the checkbox isn't checked then nothing will appears, that is how it works, so if we put

          [CustomAttribute_newattr_testbox]
          Name=TestBox
          Type=checkbox
          Default=anyValueHere

          Then, when we check the checkbox and disable the editor, the custom attribute will be shown like:

          <custom name="newattr" custom:title="texthere" custom:testbox="anyValueHere"></custom>

          If we uncheck the attribute it will be:

          <custom name="newattr" custom:title="texthere"></custom>

          Finally, if we do not define a Default value in the settings, it will be the same for checked as if it is unchecked, so, basically we need define the checked value by adding the Default setting.

          Show
          Thiago Campos Viana added a comment - - edited So, here is my final thought about the disable/enable editor problem. When we check the checkbox, the value that will appears is the default value in the disabled editor, ONLY when the checkbox is checked, if the checkbox isn't checked then nothing will appears, that is how it works, so if we put [CustomAttribute_newattr_testbox] Name=TestBox Type=checkbox Default=anyValueHere Then, when we check the checkbox and disable the editor, the custom attribute will be shown like: <custom name="newattr" custom:title="texthere" custom:testbox="anyValueHere"></custom> If we uncheck the attribute it will be: <custom name="newattr" custom:title="texthere"></custom> Finally, if we do not define a Default value in the settings, it will be the same for checked as if it is unchecked, so, basically we need define the checked value by adding the Default setting.
          Show
          Damien Pobel (Inactive) added a comment - Fixed in ezpublish-legacy: master: http://github.com/ezsystems/ezpublish-legacy/commit/38d83f775b930d14d426d7dc01c0dc2d7fae0d0a
          Hide
          Damien Pobel (Inactive) added a comment -

          @Thiago: feel free to open a new issue for the disable editor problem as it's a completely different issue that mostly likely needs to be fixed in the server side handling

          Show
          Damien Pobel (Inactive) added a comment - @Thiago: feel free to open a new issue for the disable editor problem as it's a completely different issue that mostly likely needs to be fixed in the server side handling
          Hide
          Peter Keung added a comment -

          New ticket opened for disable editor problem with a proposed fix: https://jira.ez.no/browse/EZP-22435

          Show
          Peter Keung added a comment - New ticket opened for disable editor problem with a proposed fix: https://jira.ez.no/browse/EZP-22435
          Hide
          Marcos Loureiro (Inactive) added a comment -

          QA Approved

          Show
          Marcos Loureiro (Inactive) added a comment - QA Approved
          Hide
          Eduardo Fernandes (Inactive) added a comment -

          QA tested and approved for 5.3, 5.2, 5.1 & 4.7

          Show
          Eduardo Fernandes (Inactive) added a comment - QA tested and approved for 5.3, 5.2, 5.1 & 4.7

            People

            • Assignee:
              Unassigned
              Reporter:
              Thiago Campos Viana
            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour
                1d 1h