{extends file=$smarty.const.SMARTY_LAYOUT_MAIN_GENERAL_PAGINATED_LISTING}

{block name="js" append}
	<script type="text/javascript">

	/**
 	 * Open Popup for edit type
 	 * TODO: Should be fixed in MVC and not manually here
 	 */
	MVC.listing.prototype.openUpdatePopup = function(element, width, height){

		if (MVC.listing.installedHandlers.listing.selection){
			var id = MVC.listing.installedHandlers.listing.selection.getSelectedRows()[0].readAttribute('data-id');
		} else {
			var id = $(element).up('tr[data-id]').readAttribute('data-id');
		}

		return Popup2.create().setId(MVC.CURRENT_MODULE+'_update').setUrl(MVC.appUrl(MVC.CURRENT_MODULE, 'update', { 'id': id  })).setDimensions(width, height).show();
	}

	</script>
{/block}