{extends file='ModulesAbstract/FileExplorer/View/_tpl/index.tpl'}


{block name="js" append}

	<script type="text/javascript">

		MVC.scheduleOnLoad(function(){
			MVC.listing.prototype.actionOnSelected = function(action, params, element){
				this.loadingMask.reposition().show();
				this.AJAX(action, params, MVC.listing._AJAX_deleteSelected_success.bind(this));
			}

			MVC.listing.prototype.actionOnCurrent = function(action, params, element){
				this.loadingMask.reposition().show();
				params['listing[selection][temporarySelectedRows][]'] = MVC.listing.installedHandlers.listing.getItemId(element);
				params['listing[selection][clear]'] = 'all';

				this.AJAX(action, params, MVC.listing._AJAX_deleteSelected_success.bind(this));
			}

			MVC.listing.prototype.moveToDeletedItemWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['moveToDeleted']['title']}",
					"{$lang['index']['moveToDeleted']['confirmation']}",
					this.actionOnCurrent.bind(this, 'moveToDeleted', { }, element)
				);
			}

			MVC.listing.prototype.moveToDeletedItemsWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['moveToDeleted']['title']}",
					"{$lang['index']['moveToDeleted']['confirmation']}",
					this.actionOnSelected.bind(this, 'moveToDeleted', { }, element)
				);
			}


			MVC.listing.prototype.processItemWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['process']['title']}",
					"{$lang['index']['process']['confirmation']}",
					this.actionOnCurrent.bind(this, 'process', {}, element)
				);
			}

			MVC.listing.prototype.processItemsWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['process']['title']}",
					"{$lang['index']['process']['confirmation']}",
					this.backend_callUpdateOperation.bind(this, 'process', null, element)
				);
			}


			MVC.listing.prototype.moveToQueueItemsWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['moveToQueue']['title']}",
					"{$lang['index']['moveToQueue']['confirmation']}",
					this.backend_callUpdateOperation.bind(this, 'moveToQueue', { path: MVC.listing.installedHandlers.listing.currentPath }, element)
				);
			}

			MVC.listing.prototype.moveToQueueItemWithConfirmation = function(element){
				MVC.callbackWithConfirmation(
					"{$lang['index']['moveToQueue']['title']}",
					"{$lang['index']['moveToQueue']['confirmation']}",
					this.actionOnCurrent.bind(this, 'moveToQueue', { path: MVC.listing.installedHandlers.listing.currentPath }, element)
				);
			}

		});

	</script>
{/block}
