/*
 * File: app/controller/RulesetLog.js
 *
 * This file was generated by Sencha Architect version 3.0.2.
 * http://www.sencha.com/products/architect/
 *
 * This file requires use of the Ext JS 4.2.x library, under independent license.
 * License of Sencha Architect does not include license for Ext JS 4.2.x. For more
 * details see http://www.sencha.com/license or contact license@sencha.com.
 *
 * This file will be auto-generated each and everytime you save your project.
 *
 * Do NOT hand edit this file.
 */

Ext.define('MyApp.controller.RulesetLog', {
	extend: 'Ext.app.Controller',

	refs: [
		{
			autoCreate: true,
			ref: 'rulesetWindow',
			selector: '#rulesetWindow',
			xtype: 'RulesetWindow'
		},
		{
			ref: 'rulesetEmptyContainer',
			selector: '#rulesetEmptyContainer'
		}
	],

	init: function(application) {
		this.control({
		    '#rulesetLogBtn': {
		        click: this.openWindow
		    }
		});
	},

	openWindow: function(btn) {
		//open the window
		this.getRulesetWindow().animateTarget = btn;

		var W = Ext.getBody().getViewSize().width;
		var H = Ext.getBody().getViewSize().height;
		this.getRulesetWindow().setWidth(W-50);
		this.getRulesetWindow().setHeight(H-50);

		this.getRulesetWindow().show();

		//create url
		var url = "../viewlog/viewlog.php";
		var params = Ext.Object.fromQueryString(document.location.search);
		params.donotshowtabs = true;
		var par = Ext.Object.toQueryString(params);

		//open url in the window
		this.getRulesetEmptyContainer().update('<iframe src="'+url+"?"+par+'" width="100%" height="100%" frameborder="0" style="border-color: white;"></iframe>');
		this.getRulesetEmptyContainer().doLayout();
	}

});
