Ticket #9522 (closed Bug: fixed+released)

Opened 2 years ago

Last modified 2 years ago

Impossible to add a criteria in a collection in 3.3.1

Reported by: ebrehault Owned by: davisagli
Priority: major Milestone: 3.3.5
Component: Archetypes Keywords: collection criteria
Cc: yulka, kaeru, pupq

Description

Hello,

It is not possible to add a criteria in a collection in Plone 3.3.1.

steps to reproduce:

  • create a new fresh Plone 3.3.1 site,
  • add a collection,
  • go to Criteria tab,
  • the field Criteria type is corrupted (with FF, you get HTML code into the select list, with Safari, it is just empty), and it is impossible to add a criteria

Fix: the problem comes from the updateCriterionType javascript function in Products/ATContentTypes/skins/ATContentTypes/criterion_edit_form.cpt

replace lines 46-47: return '<option value="' + entry.value + '">' + entry.label + '<' + '/option>';

with: return '<option value="' + entry.value + '">' + entry.label + '<' + '/option>';

Eric BREHAULT

Attachments

AT.patch Download (846 bytes) - added by kiorky 2 years ago.
fix for collection criterions

Change History

comment:1 Changed 2 years ago by yulka

  • Cc yulka added

comment:2 Changed 2 years ago by kaeru

  • Cc kaeru added

I can confirm

comment:3 Changed 2 years ago by kiorky

I reproduced also. Attaching a patch relative to Eric fix.

Changed 2 years ago by kiorky

fix for collection criterions

comment:4 Changed 2 years ago by davisagli

  • Status changed from new to assigned
  • Cc pupq added
  • Owner changed from nouri to davisagli

Sorry, I introduced this in r86779 while trying to make this template support Chameleon.

The suggested fix would break Chameleon again, but I have a better fix that I will apply shortly.

comment:5 follow-up: ↓ 9 Changed 2 years ago by davisagli

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:6 Changed 2 years ago by davisagli

Released in ATContentTypes 1.3.4 which should make it into the next Plone 3 release.

comment:7 Changed 2 years ago by davisagli

(It should be possible to force the use of the new ATContentTypes package with Plone 3.3.1 by using a versions block in buildout:

[buildout] ... versions = versions

... [versions] Products.ATContentTypes = 1.3.4

Rerun buildout and confirm that the correct version was selected by checking that it is listed in your bin/instance script (bin\instance-script on Windows).

Don't forget to remove this version pin if you later upgrade to a newer Plone version!)

comment:8 Changed 2 years ago by davisagli

Let's try that again with proper formatting...

(It should be possible to force the use of the new ATContentTypes package with Plone 3.3.1 by using a versions block in buildout:

[buildout]
...
versions = versions

...
[versions]
Products.ATContentTypes = 1.3.4

Rerun buildout and confirm that the correct version was selected by checking that it is listed in your bin/instance script (bin\instance-script on Windows).

Don't forget to remove this version pin if you later upgrade to a newer Plone version!)

comment:9 in reply to: ↑ 5 Changed 2 years ago by herrmann

  • Status changed from closed to reopened
  • Resolution fixed deleted

Replying to davisagli:

Fixed in http://dev.plone.org/collective/changeset/98057

That patch does not fix it yet. In Firefox 3.0.14 I get an error and it's still impossible to add criteria.

The problem is that the CDATA block added by the patch isn't commented in ECMAscript syntax, causing the JS engine to try to interpret it. So we need to precede the opening as well as the closing of the CDATA tag with double slashes to comment it out. I've testes this solution, and the following patch will fix that:

diff -ur Products.ATContentTypes-1.3.3-py2.4.egg/Products/ATContentTypes/skins/ATContentTypes/criterion_edit_form.cpt Products.ATContentTypes-1.3.3-py2.4.egg.new/Products/ATContentTypes/skins/ATContentTypes/criterion_edit_form.cpt
--- Products.ATContentTypes-1.3.3-py2.4.egg/Products/ATContentTypes/skins/ATContentTypes/criterion_edit_form.cpt	2009-09-25 15:31:28.000000000 -0300
+++ Products.ATContentTypes-1.3.3-py2.4.egg.new/Products/ATContentTypes/skins/ATContentTypes/criterion_edit_form.cpt	2009-09-25 15:30:48.000000000 -0300
@@ -25,7 +25,7 @@
     </tal:js>
 
     <script type="text/javascript">
-<[CDATA[
+//<![CDATA[
 (function($) {
 function showHelp() {
     $(this).siblings('.formHelp').text($(this).find('option:selected').attr('title') || '\u00A0');
@@ -54,7 +54,7 @@
     $('#field').change(selectField).change();
 })
 })(jQuery);
-]]>
+//]]>
     </script>
 </tal:defines>
 </metal:head>

Please get that patch into the trunk or the next Plone 3 release will still have the same bug! I'm not sure if this is usual procedure, but I'm reopening the ticket for now.

comment:10 follow-up: ↓ 11 Changed 2 years ago by davisagli

  • Status changed from reopened to closed
  • Resolution set to fixed+released

herrmann, the ATContentTypes 1.3.4 release that I made on Tuesday does in fact include the necessary double-slash comments. I added them in a subsequent checkin that wasn't linked from this ticket.

comment:11 in reply to: ↑ 10 Changed 2 years ago by herrmann

Replying to davisagli:

herrmann, the ATContentTypes 1.3.4 release that I made on Tuesday does in fact include the necessary double-slash comments. I added them in a subsequent checkin that wasn't linked from this ticket.

Sorry for having reopened it, I should have checked the 1.3.4 release first. Since I saw no comment here about it, I just assumed it wasn't fixed yet.

comment:12 Changed 2 years ago by jakob

Nice! very good fix!

Note: See TracTickets for help on using tickets.