<inp2:m_DefaultParam prefix="widget" grid="Default" title_preset="widget_list" section="custom:widgets" edit_template="custom/widgets/widget_edit" id_field="WidgetId"/>

<inp2:m_include t="incs/header" />
<inp2:m_RenderElement name="combined_header" prefix="$prefix" section="$section" title_preset="$title_preset" pagination="1"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  		<td>
	  		<table width="100%" cellpadding="0" cellspacing="0">
	  			<tr>
	  				<td>
		  				<script type="text/javascript">
							a_toolbar = new ToolBar();

							a_toolbar.AddButton(
								new ToolBarButton(
									'new_item',
									'<inp2:m_phrase label="la_ToolTip_NewWidget" escape="1"/>::<inp2:m_phrase label="la_Add" escape="1"/>',
									function() {
										std_precreate_item('<inp2:m_Param name="prefix"/>', '<inp2:m_Param name="edit_template"/>')
									}
								)
							);

							function edit() {
							  	std_edit_item('<inp2:m_Param name="prefix"/>', '<inp2:m_Param name="edit_template"/>');
							}

							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_Delete" escape="1"/>',
									function() {
										std_delete_items('<inp2:m_Param name="prefix"/>');
									}
								)
							);

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

							a_toolbar.AddButton(
								new ToolBarButton(
									'approve',
									'<inp2:m_phrase label="la_ToolTip_Approve" escape="1"/>',
									function() {
										submit_event('<inp2:m_Param name="prefix"/>', 'OnMassApprove');
									}
			 					)
			 				);

							a_toolbar.AddButton(
								new ToolBarButton(
									'decline',
									'<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>',
									function() {
										submit_event('<inp2:m_Param name="prefix"/>', 'OnMassDecline');
									}
							 	)
							);

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

							a_toolbar.AddButton(
								new ToolBarButton(
									'export',
									'<inp2:m_phrase label="la_ToolTip_Export" escape="1"/>',
									function() {
										std_csv_export('<inp2:m_Param name="prefix"/>', '<inp2:m_Param name="grid"/>', 'export/export_progress');
									}
								)
							);

							a_toolbar.AddButton(
								new ToolBarButton(
									'import',
									'<inp2:m_phrase label="la_ToolTip_Import" escape="1"/>',
									function() {
										std_csv_import('<inp2:m_Param name="prefix"/>', '<inp2:m_Param name="grid"/>', 'import/import_start');
									}
								)
							);

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

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

							a_toolbar.Render();
						</script>
	  				</td>

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

<style type="text/css">
	.red-row td.Status {
		background-color: red;
	}
</style>

<inp2:m_DefineElement name="grid_image_td">
	<img src="<inp2:Field name='$field' format='resize:120x120'/>" <inp2:Field name='$field' format='resize:120x120;img_size' no_special='1'/> alt=""/><br />
</inp2:m_DefineElement>

<inp2:m_DefineElement name="grid_delete_td">
	<a href="<inp2:m_Link {$PrefixSpecial}_event='OnDelete' pass='m,$PrefixSpecial'/>" onclick="return confirm('Delete Record?')">Delete</a>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="grid_custom_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" grid="$grid" format="$format"/></a>
</inp2:m_DefineElement>

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

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