<dtml-var manage_page_header>
<dtml-var manage_tabs>

<dtml-let specs=listElementSpecs
          def_spec="specs and specs[0][0] or None"
          current="REQUEST.get( 'element', def_spec )">

<h3> Update Element Metadata Policies </h3>

<table class="FormLayout">

 <tr>
  <th> Element: </th>
  <td colspan="3"> 
   <dtml-in listElementSpecs>
    <dtml-let key=sequence-key>
     <dtml-if expr="key == current">
     &dtml-key;  &nbsp;
     <dtml-else>
      <a href="&dtml-URL;?element=&dtml-key;"> &dtml-key; </a> &nbsp;
     </dtml-if>
    </dtml-let>
   </dtml-in>
  </td>
 </tr>

 <dtml-if def_spec>
 <dtml-let spec="getElementSpec( element=current )"
           multi="spec.isMultiValued()"
           tokenz="multi and ':tokens' or ''"
 >

 <dtml-in expr="spec.listPolicies()" sort>
 <dtml-let key=sequence-key
           typ="key or '<default>'"
           policy=sequence-item
           rqd="policy.isRequired() and 'checked' or ''"
           canRemove="key is not _.None"
           supply="policy.supplyDefault() and 'checked' or ''"
           rawdef="policy.defaultValue()"
           defval="(multi and ( _.string.join( rawdef ), ) or ( rawdef, ))[0]"
           enforce="policy.enforceVocabulary() and 'checked' or ''"
           vocab="_.string.join( policy.allowedVocabulary(), '\n' )"
 >

 <form action="&dtml-absolute_url;" method="POST">
 <input type="hidden" name="element" value="&dtml-current;"> 
 <input type="hidden" name="content_type" value="&dtml-typ;"> 

 <tr style="background-color: DarkGray; color: DarkBlue">
  <th colspan="4"> <br> </th>
 </tr>

 <tr valign="top">
  <th> Content type </th>
  <td>
    <dtml-if "typ == '<default>'">
      &dtml-typ;
    <dtml-else>
      <dtml-let typeinfo="portal_types.getTypeInfo(typ)">
        <dtml-if typeinfo>
          <dtml-var "typeinfo.Title()" html_quote>
        <dtml-else>
          &dtml-typ; (deleted)
        </dtml-if>
      </dtml-let>
    </dtml-if>
  </td>
  <th> Required? </th>
  <td>
    <input type="checkbox" name="is_required:boolean" &dtml-rqd;>
    <input type="hidden" name="is_required:int:default" value="0">
  </td>
 </tr>
 
 <tr valign="top">
  <th> Supply default? </th>
  <td>
    <input type="checkbox" name="supply_default:boolean" &dtml-supply;>
    <input type="hidden" name="supply_default:int:default" value="0">
  </td>
  <th> Default </th>
  <td> <input type="text" name="default_value&dtml-tokenz;"
              value="&dtml-defval;" size="40"> </td>
 </tr>
 
 <tr valign="top">
  <th> Enforce vocabulary? </th>
  <td>
    <input type="checkbox" name="enforce_vocabulary:boolean" &dtml-enforce;>
    <input type="hidden" name="enforce_vocabulary:int:default" value="0">
  </td>
  <th> Vocabulary </th>
  <td> <textarea name="allowed_vocabulary:lines"
                 rows="5" cols="20">&dtml-vocab;</textarea>
 </tr>
 
 <tr valign="top">
  <td> <br> </td>
  <td colspan="3">
   <input type="submit" name="updateElementPolicy:method" value=" Update ">
   <dtml-if canRemove>
    <input type="submit" name="removeElementPolicy:method" value=" Remove ">
   </dtml-if>
  </td>
 </tr>

 </form>
 </dtml-let>
 </dtml-in>

 <form action="&dtml-absolute_url;" method="POST">
 <input type="hidden" name="element" value="&dtml-current;"> 

 <tr style="background-color: DarkGray; color: DarkBlue">
  <th colspan="4"> &lt;new type&gt; </th>
 </tr>

 <tr valign="top">
  <th> Content type </th>

  <dtml-let typeinfos="portal_types.listTypeInfo()">
  <td>
   <select name="content_type">
    <dtml-in typeinfos>
     <option value="&dtml-getId;"> &dtml-Title; </option>
    </dtml-in>
   </select>
  </td>
  </dtml-let>

  <th> Required? </th>
  <td>
    <input type="checkbox" name="is_required:boolean">
    <input type="hidden" name="is_required:int:default" value="0">
  </td>
 </tr>
 
 <tr valign="top">
  <th> Supply default? </th>
  <td>
    <input type="checkbox" name="supply_default:boolean">
    <input type="hidden" name="supply_default:int:default" value="0">
  </td>
  <th> Default </th>
  <td> <input type="text" name="default_value&dtml-tokenz;" size="40"> </td>
 </tr>
 
 <tr valign="top">
  <th> Enforce vocabulary? </th>
  <td>
    <input type="checkbox" name="enforce_vocabulary:boolean">
    <input type="hidden" name="enforce_vocabulary:int:default" value="0">
  </td>
  <th> Vocabulary </th>
  <td> <textarea name="allowed_vocabulary:lines"
                 rows="5" cols="20"></textarea>
 </tr>
 
 <tr valign="top">
  <td> <br> </td>
  <td>
   <input type="submit" name="addElementPolicy:method" value=" Add ">
  </td>
 </tr>

 </form>

 <tr style="background-color: DarkGray; color: DarkBlue">
  <th colspan="4"> <br> </th>
 </tr>

 </dtml-let>
 </dtml-if>
</table>

</dtml-let>

<dtml-var manage_page_footer>
