<inp2:adm_SetPopupSize width="850" height="600"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="lang" section="in-portal:configure_lang" title_preset="export_language"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">
				a_toolbar = new ToolBar();
				a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
							submit_event('lang','OnExportProgress');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
							submit_event('lang', 'OnGoBack');
						}
				 ) );

				a_toolbar.Render();
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:phrases.export_SaveWarning name="grid_save_warning"/>
<inp2:phrases.export_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="!la_section_General!"/>

		<inp2:m_if check="phrases.export_FieldVisible" field="LangFile">
			<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
				<inp2:m_RenderElement name="inp_edit_field_caption" prefix="phrases.export" field="LangFile" title="la_fld_ExportFileName"/>
				<td class="control-cell">
					<inp2:lang_ExportPath/> <input type="text" name="<inp2:phrases.export_InputName field='LangFile'/>" id="<inp2:phrases.export_InputName field='LangFile'/>" value="<inp2:phrases.export_Field field='LangFile'/>" />
				</td>
				<inp2:m_RenderElement name="inp_edit_error" prefix="phrases.export" field="LangFile"/>
			</tr>
		</inp2:m_if>

		<inp2:m_RenderElement name="inp_edit_checkboxes" prefix="phrases.export" field="PhraseType" title="!la_fld_ExportPhraseTypes!"/>

		<inp2:m_DefineElement name="export_module_element">
			<tr>
				<td>
					<input type="checkbox" <inp2:m_param name='checked'/> id="<inp2:{$prefix}_InputName field='$field'/>_<inp2:m_param name='key'/>" value="<inp2:m_param name='key'/>" onclick="update_checkbox_options(/^<inp2:{$prefix}_InputName field='$field' as_preg='1'/>_([0-9A-Za-z-]+)/, '<inp2:{$prefix}_InputName field='$field'/>');"/>
				</td>
				<td>
					<label for="<inp2:{$prefix}_InputName field='$field'/>_<inp2:m_param name='key'/>">
						<inp2:m_param name="option"/>
					</label>
				</td>
				<td align="right">
					<inp2:$prefix_PhraseCount module="$key"/>
				</td>
				<td align="right">
					<inp2:$prefix_EventCount module="$key"/>
				</td>
			</tr>
		</inp2:m_DefineElement>

		<inp2:m_if check="phrases.export_FieldVisible" field="PhraseType">
			<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
				<inp2:m_RenderElement name="inp_edit_field_caption" prefix="phrases.export" field="Module" title="la_fld_ExportModules"/>
				<td class="control-cell">
					<input type="button" class="button" id="btn-select-all" value="<inp2:m_Phrase name='la_btn_SelectAll' no_editing='1'/>"/>
					<input type="button" class="button" id="btn-unselect" value="<inp2:m_Phrase name='la_btn_Unselect' no_editing='1'/>"/>
					<br/><br/>

					<style type="text/css">
						table#modules {
							border-collapse: collapse;
						}

						table#modules td, table#modules th {
							border: 1px solid black;
							padding: 3px;
						}
					</style>

					<table id="modules" border="1">
						<tr>
							<th align="center" colspan="2"><inp2:m_Phrase name="la_col_Module"/></th>
							<th align="center"><inp2:m_Phrase name="la_col_Phrases"/></th>
							<th align="center"><inp2:m_Phrase name="la_col_EmailEvents"/></th>
						</tr>
						<inp2:phrases.export_PredefinedOptions prefix="phrases.export" field="Module" block="export_module_element" no_empty="1" selected="checked"/>
					</table>

					<script type="text/javascript">
						$(document).ready(
							function () {
								$('#btn-select-all, #btn-unselect').click(
									function ($e) {
										var $checked = $(this).attr('id') == 'btn-select-all' ? 'checked' : '';
										var $reg_exp = /^<inp2:phrases.export_InputName field='Module' as_preg='1'/>_([0-9A-Za-z-]+)/;

										$("input[type='checkbox']", '#modules').attr('checked', $checked);
										update_checkbox_options($reg_exp, '<inp2:phrases.export_InputName field='Module'/>');
									}
								);
							}
						);
					</script>

					<inp2:m_RenderElement prefix="phrases.export" name="inp_edit_hidden" field="Module" db="db"/>
				</td>
				<inp2:m_RenderElement name="inp_edit_error" prefix="phrases.export" field="Module"/>
			</tr>
		</inp2:m_if>

		<inp2:m_RenderElement name="inp_edit_textarea" prefix="phrases.export" field="ExportPhrases" title="!la_fld_ExportPhrases!" allow_html="0" hint_label="la_hint_ExportPhrases"/>
		<inp2:m_RenderElement name="inp_edit_textarea" prefix="phrases.export" field="ExportEmailEvents" title="!la_fld_ExportEmailEvents!" allow_html="0" hint_label="la_hint_ExportEmailEvents"/>

		<inp2:m_RenderElement name="inp_edit_checkbox" prefix="phrases.export" field="DoNotEncode" title="!la_fld_DoNotEncode!"/>
		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<inp2:m_include t="incs/footer"/>
