{extends file=$smarty.const.SMARTY_LAYOUT_MAIN_GENERAL_PAGINATED_LISTING}

{block name="js" append}
	<script type="text/javascript">
		MVC.scheduleOnLoad(function(){

			MVC.listing.prototype.moveUpCurrentItem = function(element){
				this.backend_callUpdateOperation('moveUp', {
					'listing[selection][add][]':	this.getItemId(element),
					'listing[selection][clear]' :	'all'
				});
			}

			MVC.listing.prototype.moveDownCurrentItem= function(element){
				this.backend_callUpdateOperation('moveDown', {
					'listing[selection][add][]':	this.getItemId(element),
					'listing[selection][clear]' :	'all'
				});
			}
		
			MVC.listing.prototype.moveUpSelected = function(button){
				this.backend_callUpdateOperation('moveUp', null, button);
			}

			MVC.listing.prototype.moveDownSelected= function(button){
				this.backend_callUpdateOperation('moveDown', null, button);
			}
	
			MVC.listing.prototype.deleteCurrentItemWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"",
					"{$lang['delete']['confirmation']}",
					this.backend_callUpdateOperation.bind(this, 'delete', {
						'listing[selection][add][]':	this.getItemId(element),
						'listing[selection][clear]' :	'all'
					})
				);
			}

			MVC.listing.prototype.resetModuleSettings = function() {
				this.backend_callUpdateOperation('reset', { });
			}
			
			MVC.listing.prototype.resetWithConfirmation = function(button) {
				MVC.callbackWithConfirmation(
					"",
					"{$lang['reset']['confirmation']}",
					this.resetModuleSettings.bind(this)
				);
			}
			
			MVC.listing.prototype.saveModuleSettings = function() {
				this.backend_callUpdateOperation('save', { });
			}
			
			
			MVC.listing.prototype.saveWithConfirmation = function(element) {
				MVC.callbackWithConfirmation(
					"",
					"{$lang['save']['confirmation']}",
					this.saveModuleSettings.bind(this)
				);
			}

		});
	</script>
{/block}
