#from kojiweb import util

#include "includes/header.chtml"

  #if $tag
  <h4>Edit tag $tag.name</h4>
  #else
  <h4>Create tag</h4>
  #end if

  <form action="#if $tag then 'tagedit' else 'tagcreate'#">
    $util.authToken($self, form=True)
    <table>
      <tr>
        <th>Name</th>
        <td>
          <input type="text" name="name" value="#if $tag then $tag.name else ''#"/>
          #if $tag
          <input type="hidden" name="tagID" value="$tag.id"/>
          #end if
        </td>
      </tr>
      <tr>
        <th>Arches</th>
        <td><input type="text" name="arches" value="#if $tag then $tag.arches else ''#"/></td>
      </tr>
      <tr>
        <th>Locked</th>
        <td><input type="checkbox" name="locked" value="yes" #if $tag and $tag.locked then 'checked="checked"' else ''#/></td>
      </tr>
      <tr>
        <th>Permission</th>
        <td>
          <select name="permission">
            <option value="none" #if $tag and not $tag.perm_id then 'selected="selected"' else ''#>none</option>
            #for $permission in $permissions
            <option value="$permission.id" #if $tag and $tag.perm_id == $permission.id then 'selected="selected"' else ''#>$permission.name</option>
            #end for
          </select>
        </td>
      </tr>
      #if $mavenEnabled
      <tr>
        <th>Maven Support?</th>
        <td><input type="checkbox" name="maven_support" value="yes" #if $tag and $tag.maven_support then 'checked="checked"' else ''#>
      </tr>
      <tr>
        <th>Include All Maven Builds?</th>
        <td><input type="checkbox" name="maven_include_all" value="yes" #if $tag and $tag.maven_include_all then 'checked="checked"' else ''#>
      </tr>
      #end if
      <tr>
        <td>
          #if $tag
          <button type="submit" name="save" value="Save">Save</button>
          #else
          <button type="submit" name="add" value="Add">Add</button>
          #end if
        </td>
        <td><button type="submit" name="cancel" value="Cancel">Cancel</button></td>
      </tr>
    </table>
  </form>

#include "includes/footer.chtml"
