<inp2:adm_SetPopupSize width="1100" height="700"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" section="in-portal:configure_themes" prefix="theme" title_preset="block_edit"/>

<!-- 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('theme-file','OnSaveBlock');
						}
					) );

				a_toolbar.AddButton(
					new ToolBarButton(
						'cancel',
						'<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>',
						function() {
							<inp2:m_if check="adm_UsePopups">
								window_close();
							<inp2:m_else/>
								submit_event('theme-file', 'OnGoBack');
							</inp2:m_if>
						}
					)
				);

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

<inp2:theme-file_SaveWarning name="grid_save_warning"/>
<inp2:theme-file_ErrorWarning name="form_error_warning"/>

<inp2:m_RenderElement name="inp_edit_hidden" prefix="theme-file" field="ThemeId"/>
<input type="hidden" id="block" name="block" value="<inp2:m_Get name='block'/>"/>
<input type="hidden" id="theme_id" name="theme_id" value="<inp2:m_Get name='theme_id'/>"/>
<input type="hidden" id="source" name="source" value="<inp2:m_Get name='source'/>"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="inp_label" prefix="theme-file" field="FileName" title="la_fld_FileName"/>
		<inp2:m_RenderElement name="inp_label" prefix="theme-file" field="BlockPosition" title="la_fld_BlockPosition"/>

		<inp2:m_if check="adm_UsePopups">
			<inp2:m_RenderElement name="inp_edit_codepress" prefix="theme-file" field="FileContents" title="la_fld_FileContents"/>
		<inp2:m_else/>
			<inp2:m_RenderElement name="inp_edit_codepress" prefix="theme-file" field="FileContents" title="la_fld_FileContents" style="width: 100%; height: 500px;"/>
		</inp2:m_if>

		<!--<inp2:m_RenderElement name="inp_edit_filler" control_options="{height: 8}"/>-->
	</table>
</div>

<script type="text/javascript">
Application.setHook(
	new Array ('theme-file:OnSaveBlock'),
	function($event) {
		FileContents.toggleEditor(); // enable textarea back to save data
		$event.status = true;
	}
);
</script>
<inp2:m_include t="incs/footer"/>