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

<inp2:m_RenderElement name="combined_header" prefix="widget" section="custom:widgets" title_preset="widget_list" 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('widget', 'custom/widgets/widget_edit')
										}
									)
								);

								function edit() {
								  	std_edit_item('widget', 'custom/widgets/widget_edit');
								}

								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('widget');
										}
									)
								);

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

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

								a_toolbar.AddButton(
									new ToolBarButton(
										'decline',
										'<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>',
										function() {
											submit_event('widget', '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('widget', 'Default', 'export/export_progress');
										}
									)
								);

								a_toolbar.AddButton(
									new ToolBarButton(
										'import',
										'<inp2:m_phrase label="la_ToolTip_Import" escape="1"/>',
										function() {
											std_csv_import('widget', 'Default', '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="widget" grid="Default"/>
	  			</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="widget" IdField="WidgetId" grid="Default" max_row_height="100"/>
<script type="text/javascript">
	Grids['widget'].SetDependantToolbarButtons( new Array('edit', 'delete', 'approve', 'decline') );
</script>

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