<commit_before>var pagetree = 	new Ext.tree.TreePanel({
	id: 'pageview-cattree',
	title: '<?php echo $this->translate('Category tree'); ?>',
	useArrows: true,
	autoScroll: true,
	animate: true,
	containerScroll: true,
	border: false,
	dataUrl: '<?php echo $this->url(array('controller' => 'data', 'action' => 'treesource'), 'default'); ?>',
	rootVisible: false,
	singleExpand: true,
	stopRestoring: false,
	root: {
		nodeType: 'async',
		text: 'Root',
		draggable: false,
		id: '0'
	},
	listeners: {
		click: function(node, event) {
			if (node.attributes.type == 'category') {
				node.expand();
				Ext.Loader.load(['<?php echo $this->url(array('controller' => 'data', 'action' => 'categoryoverview'), 'default'); ?>?id=' + node.id], null, this, false);
			} else {
				alert('open page: ' + node.id);
			}
		},
		contextmenu: function(node) {
			var menu = new Ext.menu.Menu();

			if (node.attributes.online == true) {
				menu.addItem({
					text: '<?php echo $this->translate('Set offline'); ?>',
					iconCls: 'cm-setoffline',
					handler: function() {
						alert('set offline');
					}
				});
			} else {
				menu.addItem({
					text: '<?php echo $this->translate('Set online'); ?>',
					iconCls: 'cm-setonline',
					handler: function() {
						alert('set online');
					}
				});				
			}
			
			if (node.attributes.type == 'category') {
				menu.addItem({
					text: '<?php echo $this->translate('Add to favorites'); ?>',
					iconCls: 'cm-bookmark-category',
					handler: function() {
						alert('add to favorites');
					}
				});
			}
			
			if (node.attributes.type == 'page' && node.attributes.indexpage == false) {
				menu.addItem({
					text: '<?php echo $this->translate('Set as index'); ?>',
					iconCls: 'cm-indexpage',
					handler: function() {
						alert('set as index');
					}
				});
			}
			
			menu.show(node.ui.getAnchor());
		}
	},
	stateEvents : ['collapsenode', 'expandnode'],
	stateId : '<?php echo 'categorytree-' . md5(__FILE__); ?>',
	stateful : true,
	getState : function () {
		var nodes = [];
		this.getRootNode().eachChild(function (child) {
			var storeTreeState = function (node, expandedNodes) {
				if(node.isExpanded() && node.childNodes.length > 0) {
					expandedNodes.push(node.getPath());
					node.eachChild(function (child) {
						storeTreeState(child, expandedNodes);
					});
				}
			};
			storeTreeState(child, nodes);
		});
		return {
			expandedNodes : nodes
		}
	},
	applyState : function (state) {
		var nodes = state.expandedNodes;
		for(var i = 0; i < nodes.length; i++) {
			if(typeof nodes[i] != 'undefined') {
				this.expandPath(nodes[i]);
			}
		}
	}
});

var recentlyOpenedPages = new Ext.grid.GridPanel({
	store: new Ext.data.ArrayStore({
		fields: [
			{name: 'id'},
			{name: 'name'},
			{name: 'category'}
		],
		data: <?php echo Aitsu_Util_Javascript :: getArrayString($this->articles, array('idart', 'title', 'name')); ?>
    }),
    columns: [
    	{dataIndex: 'name', header: 'Page', menuDisabled: true, sortable: true},
    	{dataIndex: 'category', header: 'Category', menuDisabled: true, sortable: true}
	],
	viewConfig: {
		forceFit: true,
		autoFill: true
	},
	border: false,
	title: '<?php echo $this->translate('Recently opened pages'); ?>'
});

var favorites = new Ext.grid.GridPanel({
	store: new Ext.data.ArrayStore({
		fields: [
			{name: 'id'},
			{name: 'category'}
		],
		data: <?php echo Aitsu_Util_Javascript :: getArrayString($this->favorites, array('idcat', 'name')); ?>
    }),
    columns: [
    	{dataIndex: 'category', header: 'Category', menuDisabled: true, sortable: true}
	],
	viewConfig: {
		forceFit: true,
		autoFill: true
	},
	border: false,
	title: '<?php echo $this->translate('Favorites'); ?>'
});

var west = Ext.getCmp('viewport-west');
west.setVisible(true);
west.expand(false);
west.removeAll();
west.add(new Ext.Panel({
	layout: 'accordion',
	border: false,
	layoutConfig: {
		titleCollapse: true,
        hideCollapseTool: true,
        animate: true
    },
	items: [
		pagetree,
		recentlyOpenedPages,
		favorites
	]
}));

var east = Ext.getCmp('viewport-east');
east.setVisible(false);<commit_msg>Minor changes.<commit_after>var pagetree = 	new Ext.tree.TreePanel({
	id: 'pageview-cattree',
	title: '<?php echo $this->translate('Category tree'); ?>',
	useArrows: true,
	autoScroll: true,
	animate: true,
	containerScroll: true,
	border: false,
	dataUrl: '<?php echo $this->url(array('controller' => 'data', 'action' => 'treesource'), 'default'); ?>',
	rootVisible: false,
	singleExpand: true,
	stopRestoring: false,
	root: {
		nodeType: 'async',
		text: 'Root',
		draggable: false,
		id: '0'
	},
	listeners: {
		click: function(node, event) {
			if (node.attributes.type == 'category') {
				node.expand();
				Ext.Loader.load(['<?php echo $this->url(array('controller' => 'data', 'action' => 'categoryoverview'), 'default'); ?>?id=' + node.id], null, this, false);
			} else {
				alert('open page: ' + node.id);
			}
		},
		contextmenu: function(node) {
			var menu = new Ext.menu.Menu();

			if (node.attributes.online == true) {
				menu.addItem({
					text: '<?php echo $this->translate('Set offline'); ?>',
					iconCls: 'cm-setoffline',
					handler: function() {
						alert('set offline');
					}
				});
			} else {
				menu.addItem({
					text: '<?php echo $this->translate('Set online'); ?>',
					iconCls: 'cm-setonline',
					handler: function() {
						alert('set online');
					}
				});				
			}
			
			if (node.attributes.type == 'category') {
				menu.addItem({
					text: '<?php echo $this->translate('Add to favorites'); ?>',
					iconCls: 'cm-bookmark-category',
					handler: function() {
						alert('add to favorites');
					}
				});
			}
			
			if (node.attributes.type == 'page' && node.attributes.indexpage == false) {
				menu.addItem({
					text: '<?php echo $this->translate('Set as index'); ?>',
					iconCls: 'cm-indexpage',
					handler: function() {
						alert('set as index');
					}
				});
			}
			
			menu.show(node.ui.getAnchor());
		}
	},
	stateEvents : ['collapsenode', 'expandnode'],
	stateId : '<?php echo 'categorytree-' . md5(__FILE__); ?>',
	stateful : true,
	getState : function () {
		var nodes = [];
		this.getRootNode().eachChild(function (child) {
			var storeTreeState = function (node, expandedNodes) {
				if(node.isExpanded() && node.childNodes.length > 0) {
					expandedNodes.push(node.getPath());
					node.eachChild(function (child) {
						storeTreeState(child, expandedNodes);
					});
				}
			};
			storeTreeState(child, nodes);
		});
		return {
			expandedNodes : nodes
		}
	},
	applyState : function (state) {
		var nodes = state.expandedNodes;
		for(var i = 0; i < nodes.length; i++) {
			if(typeof nodes[i] != 'undefined') {
				this.expandPath(nodes[i]);
			}
		}
	}
});

var recentlyOpenedPages = new Ext.grid.GridPanel({
	store: new Ext.data.ArrayStore({
		fields: [
			{name: 'id'},
			{name: 'name'},
			{name: 'category'}
		],
		data: <?php echo Aitsu_Util_Javascript :: getArrayString($this->articles, array('idart', 'title', 'name')); ?>
    }),
    columns: [
    	{dataIndex: 'name', header: 'Page', menuDisabled: true, sortable: true},
    	{dataIndex: 'category', header: 'Category', menuDisabled: true, sortable: true}
	],
	viewConfig: {
		forceFit: true,
		autoFill: true
	},
	border: false,
	title: '<?php echo $this->translate('Recently opened pages'); ?>'
});

var favorites = new Ext.grid.GridPanel({
	store: new Ext.data.ArrayStore({
		fields: [
			{name: 'id'},
			{name: 'category'}
		],
		data: <?php echo Aitsu_Util_Javascript :: getArrayString($this->favorites, array('idcat', 'name')); ?>
    }),
    columns: [
    	{dataIndex: 'category', header: 'Category', menuDisabled: true, sortable: true}
	],
	viewConfig: {
		forceFit: true,
		autoFill: true
	},
	border: false,
	title: '<?php echo $this->translate('Favorites'); ?>',
	listeners: {
		cellclick: function(grid, rowIndex, columnIndex, e) {
			var record = grid.getStore().getAt(rowIndex);
    		var data = record.get('id');
    		alert(data);
		}
	}
});

var west = Ext.getCmp('viewport-west');
west.setVisible(true);
west.expand(false);
west.removeAll();
west.add(new Ext.Panel({
	layout: 'accordion',
	border: false,
	layoutConfig: {
		titleCollapse: true,
        hideCollapseTool: true,
        animate: true
    },
	items: [
		pagetree,
		recentlyOpenedPages,
		favorites
	]
}));

var east = Ext.getCmp('viewport-east');
east.setVisible(false);
{'fraction_non_alphanumeric': 0.18810823641110846, 'fraction_numerical': 0.0009494422027059103, 'mean_word_length': 3.454016913319239, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1451665', 'n_tokens_mistral': 3406, 'n_tokens_neox': 2907, 'n_words': 627}