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

<inp2:m_Get name="section" result_to_var="section"/>
<inp2:m_RenderElement name="combined_header" prefix="emailevents.module" section="$section" perm_event="emailevents:OnLoad" grid="EmailSettings" title_preset="email_settings_list" pagination="1"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  		<td>
	  		<script type="text/javascript">
				//do not rename - this function is used in default grid for double click!
	  			function edit() {
	  				Application.SetVar('remove_specials[emailevents.module]', 1);
	  				std_edit_item('emailevents.module', 'config/config_email_edit');
	  			}

	  			var a_toolbar = new ToolBar();

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

				a_toolbar.AddButton(
					new ToolBarButton(
						'select_user',
						'<inp2:m_phrase label="la_ToolTip_SelectUser" escape="1"/>',
						function () {
							openSelector('emailevents.module', '<inp2:m_t t="user_selector" pass="all,emailevents.module" escape="1"/>', 'FromUserId', null, 'OnSaveSelected');
						}
					)
				);

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

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

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

				a_toolbar.AddButton(
					new ToolBarButton(
						'frontend_mail',
						'<inp2:m_phrase label="la_ToolTip_Email_FrontOnly" escape="1"/>',
						function() {
							submit_event('emailevents.module','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.module" grid="EmailSettings"/>
	</tr>
</tbody>
</table>

<inp2:m_DefineElement name="from_user_td">
	<inp2:m_if check="Field" name="$field" db="db" equals_to="">
		Root
	<inp2:m_else/>
		<inp2:Field name="$field"/>
	</inp2:m_if>
</inp2:m_DefineElement>

<inp2:m_RenderElement name="grid" PrefixSpecial="emailevents.module" IdField="EventId" grid="EmailSettings" menu_filters="yes"/>
<script type="text/javascript">
	Grids['emailevents.module'].SetDependantToolbarButtons( new Array('frontend_mail', 'select_user', 'approve', 'decline', 'edit') );
</script>

<input type="hidden" name="emailevents.module_PopupSelectedUser" value=""/>

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