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

<inp2:m_RenderElement name="combined_header" section="in-portal:configemail" pagination="1" prefix="emailevents" grid="Emails" title_preset="email_message_list" additional_blue_bar_render_as="grid_ml_selector"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  		<td>
  			<script type="text/javascript">
  				function edit() {
	  				std_edit_item('emailevents', 'languages/email_message_edit');
	  			}

  				a_toolbar = new ToolBar();

  				<inp2:m_if check="m_IsDebugMode">
	  				a_toolbar.AddButton(
	  		  			new ToolBarButton(
	  		  		  		'new_item',
	  		  		  		'<inp2:m_phrase label="la_ToolTip_Add" escape="1"/>',
							function() {
								std_precreate_item('emailevents', 'languages/email_message_edit');
							}
						)
					);
				</inp2:m_if>

				a_toolbar.AddButton(
					new ToolBarButton(
						'edit',
						'<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Edit" escape="1"/>',
						edit
					)
				);

				<inp2:m_if check="m_IsDebugMode">
					a_toolbar.AddButton(
						new ToolBarButton(
							'delete',
							'<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
							function() {
								std_delete_items('emailevents');
							}
						)
					);
				</inp2:m_if>

				a_toolbar.AddButton( new ToolBarSeparator('sep1') );

				<inp2:m_if check="m_IsDebugMode">
					a_toolbar.AddButton(
						new ToolBarButton(
							'approve',
							'<inp2:m_phrase label="la_ToolTip_Enable" escape="1"/>',
							function() {
								submit_event('emailevents', 'OnMassApprove');
							}
						)
					);

					a_toolbar.AddButton(
						new ToolBarButton(
							'decline',
							'<inp2:m_phrase label="la_ToolTip_Disable" escape="1"/>',
							function() {
								submit_event('emailevents', 'OnMassDecline');
							}
						)
					);
				</inp2:m_if>

				a_toolbar.AddButton(
					new ToolBarButton(
						'frontend_mail',
						'<inp2:m_phrase label="la_ToolTip_Email_FrontOnly" escape="1"/>',
						function() {
							submit_event('emailevents', 'OnFrontOnly');
						}
					)
				);

				a_toolbar.AddButton( new ToolBarSeparator('sep2') );

				a_toolbar.AddButton(
					new ToolBarButton(
						'view',
						'<inp2:m_phrase label="la_ToolTip_View" escape="1"/>',
						function() {
							show_viewmenu(a_toolbar,'view');
						}
					)
				);

				a_toolbar.Render();

			</script>
		</td>
		<inp2:m_RenderElement name="search_main_toolbar" prefix="emailevents" grid="Emails"/>
	</tr>
</tbody>
</table>

<style type="text/css">
	tr.row-disabled td {
		background-color: #FFDFE0;
	}

	tr.grid-data-row-even.row-disabled td {
		background-color: #F4D4D5;
	}
</style>

<inp2:m_DefineElement name="row_class">
	<inp2:m_ifnot check="Field" field="Enabled" db="db">
		row-disabled
	</inp2:m_ifnot>
</inp2:m_DefineElement>

<inp2:m_RenderElement name="grid" PrefixSpecial="emailevents" IdField="EventId" grid="Emails" row_class_render_as="row_class"/>
<script type="text/javascript">
	Grids['emailevents'].SetDependantToolbarButtons( new Array('edit', 'delete', 'approve', 'decline', 'frontend_mail') );
</script>
<inp2:m_include t="incs/footer"/>