editform.tpl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <div id="edit_form">
  2. <form name="edit_{$table}" method="post" action="">
  3. <input class="flat" type="hidden" name="table" value="{$table}" />
  4. <table>
  5. <tr>
  6. <th colspan="4">{$formtitle}</th>
  7. </tr>
  8. {foreach key=key item=field from=$struct}
  9. {if $field.display_in_form == 1}
  10. {if $table == 'foo' && $key == 'bar'}
  11. <tr><td>Special handling (complete table row) for {$table} / {$key}</td></tr>
  12. {else}
  13. <tr>
  14. <td class="label">{$field.label}</td>
  15. <td>
  16. {if $field.editable == 0}
  17. {if $field.type == 'enma'}
  18. {$struct.{$key}.options.{$value_{$key}}}
  19. {else}
  20. {$value_{$key}}
  21. {/if}
  22. {else}
  23. {if $table == 'foo' && $key == 'bar'}
  24. Special handling (td content) for {$table} / {$key}
  25. {elseif $field.type == 'bool'}
  26. <input class="flat" type="checkbox" value='1' name="value[{$key}]"{if {$value_{$key}} == 1} checked="checked"{/if}/>
  27. {elseif $field.type == 'enum'}
  28. <select class="flat" name="value[{$key}]">
  29. {html_options output=$struct.{$key}.options values=$struct.{$key}.options selected=$value_{$key}}
  30. </select>
  31. {elseif $field.type == 'enma'}
  32. <select class="flat" name="value[{$key}]">
  33. {html_options options=$struct.{$key}.options selected=$value_{$key}}
  34. </select>
  35. {elseif $field.type == 'list'}
  36. <select class="flat" name="value[{$key}][]" size="10" multiple="multiple">
  37. {html_options output=$struct.{$key}.options values=$struct.{$key}.options selected=$value_{$key}}
  38. </select>
  39. <!-- alternative:
  40. <div style='max-height:30em; overflow:auto;'>
  41. {html_checkboxes name="value[{$key}]" output=$struct.{$key}.options values=$struct.{$key}.options selected=$value_{$key} separator="<br />"}
  42. </div>
  43. -->
  44. {elseif $field.type == 'pass' || $field.type == 'b64p'}
  45. <input class="flat" type="password" name="value[{$key}]" />
  46. {elseif $field.type == 'txtl'}
  47. <textarea class="flat" rows="10" cols="35" name="value[{$key}]">{foreach key=key2 item=field2 from=$value_{$key}}{$field2}
  48. {/foreach}</textarea>
  49. {else}
  50. <input class="flat" type="text" name="value[{$key}]" value="{$value_{$key}}" />
  51. {/if}
  52. {/if}
  53. </td>
  54. <td>{$field.desc}</td>
  55. <td class="error_msg">{$fielderror.{$key}}</td>
  56. </tr>
  57. {/if}
  58. {/if}
  59. {/foreach}
  60. <tr>
  61. <td>&nbsp;</td>
  62. <td colspan="3"><input class="button" type="submit" name="submit" value="{$submitbutton}" /></td>
  63. </tr>
  64. </table>
  65. </form>
  66. </div>