Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"App:dtml/manage_navbar.dtml": improper handling of single addable meta type #505

Closed
d-maurer opened this issue Feb 15, 2019 · 0 comments

Comments

@d-maurer
Copy link
Contributor

commented Feb 15, 2019

manage_navbar.dtml contains

<select id="addItemSelect" class="form-control-sm" name=":action"
  data-title-active="Select type to add"
  data-title-inactive="STATUS INACTIVE: New Object can only be Added in the List View"
  title="Select type to add"
  onchange="addItem( elm=this, base_url='<dtml-var "REQUEST.get('URL1','')">'); this.selectedIndex = 0;"
  ><option value="" selected="selected">Select type to add</option>
  <dtml-if "_.len(filtered_meta_types) > 1"
    ><dtml-in filtered_meta_types mapping sort=name
      ><dtml-if action><option value="&dtml.html_quote-action;">&dtml-name;</option>
      </dtml-if
    ></dtml-in
  ></dtml-if>
</select>

Obviously, no add type to select is shown, if filtered_meta_types returns a sequence with just one element. Upfront logic make the element inactive in this case.

Zope 2 handled the case "len(filtered_meta_types) == 1" specially by replacing the "select type to add" directly by an "add XXXX" control in this case. While this is nice, the case is sufficiently rare that in my view its special casing is not mandatory. Therefore, I suggest to remove the <dtml-if "_.len(filtered_meta_types) > 1">.

@d-maurer d-maurer added the bug label Feb 15, 2019

d-maurer added a commit that referenced this issue Feb 16, 2019

dataflake added a commit that referenced this issue Feb 17, 2019

Zmi add fix #505 (single add item) and #506 ("addItemSelect" handling) (
#508)

* fix for #505: no special handling for single `filtered_meta_types` in `App.dtml.manage_navbar.dtml`
fix for #506: generate the `addItemSelect` form only for a context with unacquired `filtered_meta_types`

* Improve on fix for #506: ensure that `filtered_meta_type` is called with the "normal" acquisition wrapper - in case, that `filtered_meta_type` relies on implicit acquisition

* apply first part of `drfho`s change request (remove commented JS block)

* - removed unnecessary condition and fix misplaced tag opening/closing

drfho pushed a commit that referenced this issue Feb 17, 2019

dataflake added a commit that referenced this issue Feb 18, 2019

ZMI-add does not recognize absolute urls #490 (#501)
* Pull Request: fixed 'ZMI-add does not recognize absolute urls #490'

* revised: avoid modal dialog for adding CMFPlone

* added javascript parameter 'zmi_dialog' to addItem() function

* added isUrl check to form element in modal win

* fixed JS function isURL()

* revised fix for #505/507: monotonized addItem-select, html conformance

* Simplified URL check for modal dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.