<inp2:m_DefaultParam prefix="spam-report" grid="Default"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" section="in-portal:spam_reports" prefix="$prefix" grid="$grid" title_preset="spam_report_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() {
	  				std_edit_temp_item('<inp2:m_Param name="prefix"/>', 'spam_reports/spam_report_edit');
	  			}

	  			var a_toolbar = new ToolBar();

				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
					)
				);

				a_toolbar.AddButton(
					new ToolBarButton(
						'delete',
						'<inp2:m_phrase label="la_ToolTip_DeleteSpamReportOnly" escape="1"/>',
						function() {
							std_delete_items('<inp2:m_Param name="prefix"/>')
						}
					)
				);

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

				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="$prefix" grid="$grid"/>
	</tr>
</tbody>
</table>

<inp2:m_DefineElement name="grid_edit_item_td">
	<a href="<inp2:ItemEditLink/>" title="<inp2:m_Phrase name='la_Text_Edit' no_editing='1'/>" onclick="return direct_edit('<inp2:m_param name="PrefixSpecial"/>', this.href);"><inp2:Field field="$field"/></a>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="grid_item_prefix_td">
	 <inp2:Field field="$field"/>

	 <inp2:m_if check="IsReviewReport">
	 	(<a class="delete-item-link" item_prefix="<inp2:Field name='ItemPrefix' db='db'/>" href="<inp2:AssocItemDeleteLink/>"><inp2:m_Phrase name="la_btn_DeleteReview"/></a>)
	 </inp2:m_if>
</inp2:m_DefineElement>

<inp2:m_RenderElement name="grid" PrefixSpecial="$prefix" IdField="ReportId" grid="$grid"/>
<script type="text/javascript">
	Grids['<inp2:m_Param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete') );

	$(document).ready(
		function () {
			$('a.delete-item-link').click(
				function ($e) {
					var $item_prefix = $(this).attr('item_prefix'),
						$confirm_msg = {
							'rev$': '<inp2:m_Phrase name="lu_AssociatedReviewRemovalConfirmation" js_escape="1"/>'
						};

					for (var $regex in $confirm_msg) {
						var $regexp = new RegExp($regex);

						if ( $regexp.test($item_prefix) ) {
							return confirm( $confirm_msg[$regex] );
						}
					}

					return false;
				}
			);
		}
	);
</script>
<inp2:m_include t="incs/footer"/>