{* DO NOT EDIT THIS FILE! Use an override template instead. *}

<form action={'content/action'|ezurl} method="post">

{def $languages=fetch('content', 'prioritized_languages')
     $classes=fetch( 'content', 'can_instantiate_class_list', hash( 'parent_node', $node_id ) )
     $class=false()
     $can_create=false()}

{foreach $classes as $tmp_class}
    {if $tmp_class.id|eq($class_id)}
        {set $class=$tmp_class}
        {break}
    {/if}
{/foreach}

{if or($class|not,$class.can_instantiate_languages|not)}
    
    <p>{'You do not have permissions to create an object of the requested class in any language.'}</p>

{else}

    {set $can_create=true()}
    {def $language_codes=$class.can_instantiate_languages}

    <fieldset>
    <legend>{'Existing languages'|i18n('design/standard/content/create_languages')}</legend>
    <p>{'Select the language in which you want to create an object'|i18n('design/standard/content/create_languages')}:</p>

    {foreach $languages as $language}
        {if $language_codes|contains($language.locale)}
            <label>
                <input name="ContentLanguageCode" type="radio" value="{$language.locale}"{run-once} checked="checked"{/run-once} /> {$language.name|wash}
            </label>
            <div class="labelbreak"></div>
        {/if}
    {/foreach}

    </fieldset>

{/if}

<input type="hidden" name="NodeID" value="{$node_id|wash}" />
<input type="hidden" name="ClassID" value="{$class_id|wash}" />
{if $assignment_remote_id}
    <input type="hidden" name="AssignmentRemoteID" value="{$assignment_remote_id|wash}" />
{/if}
{if $redirect_uri_after_publish}
    <input type="hidden" name="RedirectURIAfterPublish" value="{$redirect_uri_after_publish|wash}" />
{/if}
{if $redirect_uri_after_discard}
    <input type="hidden" name="RedirectIfDiscarded" value="{$redirect_uri_after_discard|wash}" />
{/if}
<input type="hidden" name="CancelURI" value="content/view/full/{$node_id|wash}" />

<div class="block">
    {if $can_create}
        <input class="button" type="submit" name="NewButton" value="{'Create'|i18n('design/standard/content/create_languages')}" />
    {/if}
    <input class="button" type="submit" name="CancelButton" value="{'Cancel'|i18n('design/standard/content/create_languages')}" />
</div>

</form>
