<!DOCTYPE htm
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="layout.html" />
    <head>
        <script type="text/javascript" src="${chrome.htdocs_location}js/wikitoolbar.js"></script>
        <script type="text/javascript">
            /* <![CDATA[ */
            jQuery(document).ready(function($) {
                /* only enable control elements for the currently selected action */
                var actions = $("#action input[name='action']");
                function updateActionFields()
                {
                    actions.each(function() {
                        $(this).siblings().find("*[@id]").enable($(this).checked());
                        $(this).siblings().filter("*[@id]").enable($(this).checked());
                    })
                }
                actions.click(updateActionFields);
                updateActionFields();
                $("#schedule_deadline").datepicker({"dateFormat" : "dd.mm.yy"});
        });
        /* ]]> */
        </script>
        <title>${title}</title>
    </head>
    <body>
        <div id="content">
            <div id='rendezvous-main'>
                <form name="new_rendezvous" class='rendezvous-wizard' uri="" method="post" mime-type="text/plain" action="">
                    <input py:if="rendezvous.rendezvous_id != 0" type="hidden" name="rendezvous_id" value="${rendezvous.rendezvous_id}"/>
                    <fieldset id="properties">
                    <legend>${title}</legend>
                    <table class="rendezvous-wizard" py:with="dt = rendezvous.schedule_deadline.astimezone(selected_tz)">
                        <tr><th><label for="name">Title</label></th><td><input id="name" type="text" size="50" maxlength="50" name="name" value="${rendezvous.name}"/></td></tr>
                        <tr><th><label for="author">Author</label></th><td>
                            <py:choose test="">
                                <input py:when="not rendezvous.rendezvous_id or 'RENDEZVOUS_ADMIN' in perm" id="author" type="text" size="50" maxlength="50" name="author" value="${rendezvous.rendezvous_id and rendezvous.author or authname}"/>
                                <py:otherwise>${rendezvous.author}</py:otherwise>
                            </py:choose>
                        </td></tr>
                        <tr><th><label for="email">Email</label></th><td><input id="email" type="text" size="50" maxlength="100" name="email" value="${rendezvous.email}"/></td></tr>
                        <tr><th><label for="rtype">Type</label></th><td><select id="rtype" name="type_name" size="1"><option py:for="rtype in types" selected="${rtype.type_id == rendezvous.type_id and 'checked' or None}">${rtype.name}</option></select></td></tr>
                        <tr><th><label for="min_votes">Minimum votes</label></th>
                            <td><input id="min_votes" type="input" name="min_votes" size="4" maxlength="4" value="${rendezvous.min_votes}" /></td>
                        </tr>
                        <tr><th><label for="schedule_deadline">Voting deadline</label></th>
                            <td><input id="schedule_deadline" type="input" name="schedule_deadline_date" size="10" maxlength="10" value="${dt.strftime('%d.%m.%Y')}" />
                                <input id="schedule_deadline_time" type="input" size="5" maxlength="5" name="schedule_deadline_time" value="${dt.strftime('%H:%M')}" /> ${dt.tzinfo.tzname(None)}</td>
                        </tr>
                        <tr><th><label for="location">Locations</label></th>
                            <td><select id="location" name="location" size="1">
                            <option py:for="location in locations" selected="${location.location_id == rendezvous.location_id and 'checked' or None}">${location.name} :${location.coordinate_str()}</option>
                            </select>
                            <a py:if="'RENDEZVOUS_LOCATION_MODIFY' in perm" href="${href.location(location and location.location_id or 0)}">edit/search locations</a></td>
                        </tr>
                        <tr><th><label for="description">Description</label></th><td><textarea id="description" class="wikitext" rows="20" cols="100" name="description" py:content="rendezvous.description"></textarea></td></tr>
                    </table>
                    </fieldset>
                    <!--! Workflow support -->
                    <fieldset  py:if="rendezvous.rendezvous_id != 0" id="action">
                        <legend>${_("Workflow")}</legend>
                        <div py:for="key, label, controls, hints in action_controls">
                        <input type="radio" id="action_$key" name="action" value="$key" checked="${cstatus == key and 'checked' or None}" />
                            <label for="action_$key">$label</label>
                            $controls
                            <span class="hint" py:for="hint in hints">$hint</span>
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend >Tags</legend>
                        <div>
                            <input id="tags" type="text" size="70" maxlength="70" name="tags" value="${rendezvous.tags}"/>
                        </div>
                    </fieldset>
                    <div class="mybuttons">
                        <input type="reset" value="Reset"/>
                        <py:choose test="">
                        <py:when test="rendezvous.rendezvous_id != 0">
                        <input type="submit" name="edit" value="edit"/>
                        <input type="submit" name="delete" value="delete"/>
                        </py:when>
                        <input py:otherwise="" type="submit" name="add" value="add"/>
                        </py:choose>
                    </div>
                </form>
            </div>
        </div>
    </body>
</html>