#macro directoryCreateForm entry is_searchable=true is_exportable=true>
<@tform action='jsp/admin/plugins/directory/DoCreateEntry.jsp#list'>
<@formGroup labelFor='entry_type' labelKey='#i18n{directory.create_entry.label_type}'>
<@tag color='info' title='#i18n{directory.create_entry.label_type}'>#i18n{${entry.entryType.titleI18nKey}}@tag>
@formGroup>
<@formGroup labelFor='title' labelKey='#i18n{directory.create_entry.label_title}' helpKey='#i18n{directory.create_entry.label_title_comment}' mandatory=true>
<@input type='text' name='title' id='title' maxlength=255 />
@formGroup>
<@formGroup>
<@checkBox labelFor='mandatory' labelKey='#i18n{directory.create_entry.label_mandatory}' name='mandatory' id='mandatory' value='1' checked=getChecked('mandatory',list_param_default_values) />
@formGroup>
<#nested>
<@formGroup labelFor='help_message' labelKey='#i18n{directory.create_entry.label_help_message}' helpKey='#i18n{directory.create_entry.label_help_message_comment}'>
<@input type='textarea' name='help_message' id='help_message' rows=2>@input>
@formGroup>
<#if is_searchable>
<@formGroup labelFor='help_message_search' labelKey='#i18n{directory.create_entry.label_help_message_search}' helpKey='#i18n{directory.create_entry.label_help_message_search_comment}'>
<@input type='textarea' name='help_message_search' id='help_message_search' rows=2>@input>
@formGroup>
#if>
<#if is_searchable>
<@formGroup helpKey='#i18n{directory.create_entry.label_indexed_comment}'>
<@checkBox labelFor='indexed' labelKey='#i18n{directory.create_entry.label_indexed}' name='indexed' id='indexed' value='1' checked=getChecked('indexed',list_param_default_values) />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_advanced_search_comment}'>
<@checkBox labelFor='shown_in_advanced_search' labelKey='#i18n{directory.create_entry.label_shown_in_advanced_search}' name='shown_in_advanced_search' id='shown_in_advanced_search' value='1' checked=getChecked('shown_in_advanced_search',list_param_default_values) />
@formGroup>
<@formGroup>
<@checkBox labelFor='indexed_as_title' labelKey='#i18n{directory.create_entry.label_indexed_as_title}' name='indexed_as_title' id='indexed_as_title' value='1' checked=getChecked('indexed_as_title',list_param_default_values) />
@formGroup>
<@formGroup>
<@checkBox labelFor='indexed_as_summary' labelKey='#i18n{directory.create_entry.label_indexed_as_summary}' name='indexed_as_summary' id='indexed_as_summary' value='1' checked=getChecked('indexed_as_summary',list_param_default_values) />
@formGroup>
#if>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_result_list_comment}'>
<@checkBox labelFor='shown_in_result_list' labelKey='#i18n{directory.create_entry.label_shown_in_result_list}' name='shown_in_result_list' id='shown_in_result_list' value='1' checked=getChecked('shown_in_result_list',list_param_default_values) />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_result_record_comment}'>
<@checkBox labelFor='shown_in_result_record' labelKey='#i18n{directory.create_entry.label_shown_in_result_record}' name='shown_in_result_record' id='shown_in_result_record' value='1' checked=getChecked('shown_in_result_record',list_param_default_values) />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_history_comment}'>
<@checkBox labelFor='shown_in_history' labelKey='#i18n{directory.create_entry.label_shown_in_history}' name='shown_in_history' id='shown_in_history' value='1' checked=getChecked('shown_in_history',list_param_default_values) />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_export_comment}'>
<@checkBox labelFor='shown_in_export' labelKey='#i18n{directory.create_entry.label_shown_in_export}' name='shown_in_export' id='shown_in_export' value='1' checked=getChecked('shown_in_export',list_param_default_values) />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_completeness_comment}'>
<@checkBox labelFor='shown_in_completeness' labelKey='#i18n{directory.create_entry.label_shown_in_completeness}' name='shown_in_completeness' id='shown_in_completeness' value='1' checked=getChecked('shown_in_completeness',list_param_default_values) />
@formGroup>
<@formGroup labelFor='comment' labelKey='#i18n{directory.create_entry.label_comment}'>
<@input type='textarea' name='comment' rows=2>@input>
@formGroup>
<@formGroup>
<@button type='submit' name='save' buttonIcon='save' title='#i18n{directory.create_entry.button_save}' size='' />
<@aButton href='jsp/admin/plugins/directory/ModifyDirectory.jsp?id_directory=${entry.directory.idDirectory}' name='cancel' buttonIcon='remove' title='#i18n{directory.create_entry.button_cancel}' size='' color='btn-secondary' />
@formGroup>
@tform>
#macro>
<#macro directoryModifyForm entry is_searchable=true is_exportable=true>
<@tform action='jsp/admin/plugins/directory/DoModifyEntry.jsp#list'>
<@formGroup labelFor='entry_type' labelKey='#i18n{directory.create_entry.label_type}'>
<@tag color='info' title='#i18n{directory.create_entry.label_type}'>#i18n{${entry.entryType.titleI18nKey}}@tag>
@formGroup>
<@formGroup labelFor='title' labelKey='#i18n{directory.create_entry.label_title}' helpKey='#i18n{directory.create_entry.label_title_comment}' mandatory=true>
<@input type='text' name='title' id='title' value=entry.title maxlength=255 />
@formGroup>
<@formGroup>
<@checkBox labelFor='mandatory' labelKey='#i18n{directory.create_entry.label_mandatory}' name='mandatory' id='mandatory' value='1' checked=entry.mandatory />
@formGroup>
<#nested>
<@formGroup labelFor='help_message' labelKey='#i18n{directory.create_entry.label_help_message}' helpKey='#i18n{directory.create_entry.label_help_message_comment}'>
<@input type='textarea' name='help_message' id='help_message' rows=2>${entry.helpMessage!''}@input>
@formGroup>
<#if is_searchable>
<@formGroup labelFor='help_message_search' labelKey='#i18n{directory.create_entry.label_help_message_search}' helpKey='#i18n{directory.create_entry.label_help_message_search_comment}'>
<@input type='textarea' name='help_message_search' id='help_message_search' rows=2>${entry.helpMessageSearch!''}@input>
@formGroup>
#if>
<#if is_searchable>
<@formGroup helpKey='#i18n{directory.create_entry.label_indexed_comment}'>
<@checkBox labelFor='indexed' labelKey='#i18n{directory.create_entry.label_indexed}' name='indexed' id='indexed' value='1' checked=entry.indexed />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_advanced_search_comment}'>
<@checkBox labelFor='shown_in_advanced_search' labelKey='#i18n{directory.create_entry.label_shown_in_advanced_search}' name='shown_in_advanced_search' id='shown_in_advanced_search' value='1' checked=entry.shownInAdvancedSearch />
@formGroup>
<@formGroup>
<@checkBox labelFor='indexed_as_title' labelKey='#i18n{directory.create_entry.label_indexed_as_title}' name='indexed_as_title' id='indexed_as_title' value='1' checked=entry.indexedAsTitle />
@formGroup>
<@formGroup>
<@checkBox labelFor='indexed_as_summary' labelKey='#i18n{directory.create_entry.label_indexed_as_summary}' name='indexed_as_summary' id='indexed_as_summary' value='1' checked=entry.indexedAsSummary />
@formGroup>
#if>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_result_list_comment}'>
<@checkBox labelFor='shown_in_result_list' labelKey='#i18n{directory.create_entry.label_shown_in_result_list}' name='shown_in_result_list' id='shown_in_result_list' value='1' checked=entry.shownInResultList />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_result_record_comment}'>
<@checkBox labelFor='shown_in_result_record' labelKey='#i18n{directory.create_entry.label_shown_in_result_record}' name='shown_in_result_record' id='shown_in_result_record' value='1' checked=entry.shownInResultRecord />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_history_comment}'>
<@checkBox labelFor='shown_in_history' labelKey='#i18n{directory.create_entry.label_shown_in_history}' name='shown_in_history' id='shown_in_history' value='1' checked=entry.shownInHistory />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_export_comment}'>
<@checkBox labelFor='shown_in_export' labelKey='#i18n{directory.create_entry.label_shown_in_export}' name='shown_in_export' id='shown_in_export' value='1' checked=entry.shownInExport />
@formGroup>
<@formGroup helpKey='#i18n{directory.create_entry.label_shown_in_completeness_comment}'>
<@checkBox labelFor='shown_in_completeness' labelKey='#i18n{directory.create_entry.label_shown_in_completeness}' name='shown_in_completeness' id='shown_in_completeness' value='1' checked=entry.shownInCompleteness />
@formGroup>
<@formGroup labelFor='comment' labelKey='#i18n{directory.create_entry.label_comment}'>
<@input type='textarea' name='comment' rows=2>${entry.comment!''}@input>
@formGroup>
<@formGroup>
<@button type='submit' name='save' buttonIcon='save' title='#i18n{directory.create_entry.button_save}' size='' />
<@aButton href='jsp/admin/plugins/directory/ModifyDirectory.jsp?id_directory=${entry.directory.idDirectory}' name='cancel' buttonIcon='remove' title='#i18n{directory.create_entry.button_cancel}' size='' color='btn-secondary' />
@formGroup>
@tform>
#macro>
<#function getName code reference_list>
<#if reference_list?has_content>
<#list reference_list as reference_item>
<#if reference_item.code = code>
<#return reference_item.name>
#if>
#list>
#if>
<#return "">
#function>
<#function getChecked code reference_list>
<#if reference_list?has_content>
<#list reference_list as reference_item>
<#if reference_item.code = code>
<#if reference_item.checked>
<#return true>
<#else>
<#return false>
#if>
#if>
#list>
#if>
<#return false>
#function>
<#--
-- Get the field from a given title
-- @param entry the entry
-- @param fieldTitle the title
-- @return the field
-->
<#function getField entry fieldTitle>
<#if entry.fields?? && entry.fields?has_content>
<#list entry.fields as field>
<#if field?? && field.title?? && field.title == fieldTitle>
<#return field>
#if>
#list>
#if>
#function>
<#--
-- Get the field value from a given entry and a given title
-- @param entry the entry
-- @param fieldTitle the title
-- @return the field
-->
<#function getFieldValue entry fieldTitle>
<#if getField( entry, fieldTitle )??>
<#assign field = getField( entry, fieldTitle )>
<#return field.value>
#if>
<#return "">
#function>
<#--
-- Get the max files value of an entry
-- @param entry the entry
-- @return the number of max authorized uploaded files
-->
<#function getMaxFiles entry>
<#assign fieldMaxFiles = getFieldValue( entry, "max_files" )>
<#if fieldMaxFiles?? && fieldMaxFiles != "">
<#return fieldMaxFiles>
#if>
<#return "1">
#function>
<#--
-- Get the max size an uploaded file is authorized to have
-- @param entry the entry
-- @return the max size
-->
<#function getFileMaxSize entry>
<#assign fieldFileMaxSize = getFieldValue( entry, "file_max_size" )>
<#if fieldFileMaxSize?? && fieldFileMaxSize != "">
<#return fieldFileMaxSize>
<#else>
<#if getField( entry, "option" )??>
<#assign fieldFileMaxSize = getField( entry, "option" )>
<#return fieldFileMaxSize.width>
#if>
#if>
<#return "5242880">
#function>
<#--
-- Get the authorized file types
-- @param entry the entry
-- @return the file types
-->
<#function getFileTypes entry>
<#assign fieldFileTypes = getFieldValue( entry, "option" )>
<#if fieldFileTypes?? && fieldFileTypes != "">
<#return fieldFileTypes>
#if>
<#return "*">
#function>