<metal:block metal:use-macro="here/standard_template_macro">
<metal:block fill-slot="body">

<script type="text/javascript">
  function displayElement(checkbox, elm){
    var obj = document.getElementById(elm);
    if(checkbox.checked == false){
      obj.style.display = 'block';
    }else{
      obj.style.display = 'none';
    }
  }
</script>

<h1 i18n:translate="">Edit Folder subobjects</h1>

<div class="floated-buttons">
	<span class="buttons">
		<a tal:attributes="href here/absolute_url" i18n:translate="">Back to index</a>
	</span>
</div>

<p i18n:translate="">
	Select the content types that can be added inside this folder and
	its subfolders and press <strong i18n:name="save-button" i18n:translate="">Save changes</strong>.
</p>

<tal:block tal:define="site here/getSite;
		      meta_types options/meta_types;
		      has_custom_value options/has_custom_value">

<form method="post" action="manageSubobjects" name="manageSubobjects"
      class="subobjects-management-form">
  <div>
    <input id="load_default"
      onchange = "displayElement(this, 'nypluggable_meta_types')"
      type="checkbox" name="default" value="Load default"
      i18n:attributes="value" autocomplete="off" tal:attributes="checked not:has_custom_value;"/>
    <label for="load_default" i18n:translate="">Use default subobjects </label>
    <span>(as defined in Administration - Content management -
    <a tal:attributes="href string:${site/absolute_url}/admin_folder_subobjects_html;">Folder subobjects</a>)</span>
  </div>
  <div>
    <input id="subfolders"
      type="checkbox" name="subfolders" value="Recursively for subfolders"
      i18n:attributes="value"  />
    <label for="subfolders" i18n:translate="">Recursively for subfolders</label>
  </div>
  <div id="nypluggable_meta_types"
       tal:define="all_meta_types python:here.get_meta_types(1)">
    <select name="ny_subobjects" 
      tal:attributes="size python:len(all_meta_types) or 10" 
      multiple="true">
      <tal:block repeat="item all_meta_types">
        <option tal:define="item_label python:here.get_meta_type_label(item);"
          tal:attributes="value item; selected python:item in meta_types"
          tal:content="item_label" />
      </tal:block>
    </select>
  </div>
  <div>
    <input type="hidden" name="only_nyobjects" value="1" />
    <input type="hidden" name="redirect_url" value="subobjects_html" />
    <input type="submit" name="submit" value="Save changes" 
      i18n:attributes="value" />
  </div>
</form>
<script type='text/javascript'>
  displayElement(document.manageSubobjects['default'], 'nypluggable_meta_types');
</script>
</tal:block>

</metal:block>
</metal:block>
