<tal:block metal:define-macro="page" tal:define="
        curr_lang python:request.get('lang', None) or here.gl_get_selected_language();">

<metal:block use-macro="python:here.standard_template_macro('light')">
<metal:block fill-slot="body">

<script type="text/javascript" tal:attributes="src string:${here/getSitePath}/core_js"></script>
<script type="text/javascript" tal:attributes="src string:${here/getSitePath}/calendar_js"></script>
<script type="text/javascript" tal:attributes="src string:${here/getSitePath}/datetime_js"></script>
<tal:block tal:define="editor here/getEditorTool" tal:replace="structure editor/includeLibs" />

<h1 metal:define-slot="title">Add Object</h1>

<p metal:define-slot="description"><!--description--></p>

<script type="text/javascript">
<!--
function fPick(glossary_url)
{
    var frm = document.frmAdd;
    var wnd = window.open(glossary_url + '&amp;lang=' + frm.lang[frm.lang.selectedIndex].value, "pickkeyword", "height=400,width=500,status=no,resizable=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
    wnd.focus();
}

function fSet(ctrl, value)
{
    var frm = document.frmAdd;
    var items = frm[ctrl + ':utf8:ustring'];
    if (value != '')
    {
        if (items.value == '')
            items.value = value;
        else
            items.value = items.value + ', ' + value;
    }
}
// -->
</script>

<form name="frmAdd" class="add-object-form" method="post" tal:attributes="action action" enctype="multipart/form-data">

<div class="field-inline" tal:define="selected_language python:here.getSession('lang', here.gl_get_selected_language())">
    <label i18n:translate="" for="lang">Posting language</label>
    <select name="lang" id="lang">
        <option tal:repeat="item here/gl_get_languages_mapping"
            tal:attributes="value python:item['code']; selected python:item['code']==selected_language"
            tal:content="python:item['name']" />
    </select>
</div>
<div class="field">
    <label for="title"><span i18n:translate="" tal:omit-tag="">Title</span><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'title')" class="mandatory_field"> *</span></label>
    <input type="text" name="title:utf8:ustring" id="title" size="50" tal:attributes="value python:here.getSession('title', '')" />
</div>
<div class="field">
	<label for="description"><span i18n:translate="" tal:omit-tag="">Description</span><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'description')" class="mandatory_field"> *</span></label>
	<span tal:define="editor here/getEditorTool" tal:replace="structure python:editor.render('description', image_support=True)" />
	<textarea id="description" name="description:utf8:ustring" rows="20" cols="72" class="mceEditor" tal:content="python:here.getSession('description', '')" />
</div>
<div class="field" tal:define="coverage_glossary here/get_coverage_glossary">
    <label for="coverage"><span i18n:translate="" tal:omit-tag="">Geographical coverage</span><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'coverage')" class="mandatory_field"> *</span></label>
    <tal:block tal:condition="python:coverage_glossary is None">
        <p i18n:translate=""><strong i18n:name="tip" i18n:translate="">Tip:</strong>in order to specify more values, separate them by commas</p>
    </tal:block>
    <tal:block tal:condition="python:coverage_glossary is not None">
        <p i18n:translate=""><strong i18n:name="tip" i18n:translate="">Tip:</strong> you can type free text in the field below or pick words from the list. In order to specify more values, separate them by commas.</p>
    </tal:block>
    <input type="text" name="coverage:utf8:ustring" id="coverage" size="50" tal:attributes="value python:here.getSession('coverage', '')" />
    <tal:block tal:condition="python:coverage_glossary is not None">
        <label for="pick-coverage" class="invisible" i18n:translate="">Pick coverage</label><input type="button" value="Pick" id="pick-coverage" tal:attributes="onclick string:javascript:fPick('${coverage_glossary/absolute_url}/GlossMap_html?ctrl=coverage');" />
    </tal:block>
</div>
<div class="field" tal:define="keywords_glossary here/get_keywords_glossary">
    <label for="keywords"><span i18n:translate="" tal:omit-tag="">Keywords</span><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'keywords')" class="mandatory_field"> *</span></label>
    <tal:block tal:condition="python:keywords_glossary is not None">
        <p i18n:translate=""><strong i18n:name="tip" i18n:translate="">Tip:</strong> you can type free text in the field below or pick words from the list</p>
    </tal:block>
    <input type="text" name="keywords:utf8:ustring" id="keywords" size="50" tal:attributes="value python:here.getSession('keywords', '')" />
    <tal:block tal:condition="python:keywords_glossary is not None">
        <label for="pick-keywords" class="invisible" i18n:translate="">Pick keywords</label><input type="button" value="Pick" id="pick-keywords" tal:attributes="onclick string:javascript:fPick('${keywords_glossary/absolute_url}/GlossMap_html?ctrl=keywords');" />
    </tal:block>
</div>
<div class="field">
    <label for="releasedate"><span tal:omit-tag="" i18n:translate="">Release date</span> <noscript>(<em i18n:translate="">dd/mm/yyyy</em>)</noscript><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'releasedate')" class="mandatory_field"> *</span></label>
    <input type="text" name="releasedate" class="vDateField" id="releasedate" size="20" tal:attributes="value python:here.getSession('releasedate', here.utConvertDateTimeObjToString(here.utGetTodayDate()))" />
</div>
<div class="field-inline">
    <label for="discussion"><span i18n:translate="" tal:omit-tag="">Open for comments</span><span tal:condition="python:here.get_pluggable_item_property_mandatory(kind, 'discussion')" class="mandatory_field"> *</span></label>
    <input type="checkbox" name="discussion" id="discussion" tal:attributes="checked python:test(here.getSession('discussion', ''), 'checked', 'checked')" />
</div>

<tal:block metal:define-slot="custom_properties" />

<tal:block content="structure options/submitter_info_html|nothing" />

<div class="field">
    <input type="submit" value="Submit" i18n:attributes="value" />
</div>

</form>

<span tal:replace="python:here.del_pluggable_item_session(kind)" />

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

</tal:block>
