12437_v3.diff

Administrator Admin, 2009-11-04 17:44

Download (18.7 KB)

View differences:

typo3/sysext/recycler/ext_conf_template.txt (revision 0)
1
# cat=general; type=int; label= height of recycler grid
2
gridHeight = 600
typo3/sysext/recycler/mod1/index.php (working copy)
88 88
	public function render() {
89 89
		global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
90 90

  
91
		$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $GLOBALS['LANG']->getLL('description'));
91 92
		if ($this->isAccessibleForCurrentUser) {
92 93
			$this->loadHeaderData();
93 94
				// div container for renderTo
94
			$this->content.= '<div id="recyclerContent"></div>';
95
			$this->content .= '<div id="recyclerContent"></div>';
95 96
		} else {
96 97
			// If no access or if ID == zero
97
			$this->content.= $this->doc->spacer(10);
98
			$this->content .= $this->doc->spacer(10);
98 99
		}
99 100
	}
100 101

  
......
111 112
			$this->getTemplateMarkers()
112 113
		);
113 114
		$content.= $this->doc->endPage();
114
		$content.= $this->doc->insertStylesAndJS($this->content);
115 115

  
116 116
		$this->content = null;
117 117
		$this->doc = null;
......
178 178
	 * @return	array		The JavaScript configuration
179 179
	 */
180 180
	protected function getJavaScriptConfiguration() {
181
		$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['recycler']);
182
		$gridHeight = isset($extConf['gridHeight']) ? $extConf['gridHeight'] : 600;
181 183
		$configuration = array(
182 184
			'pagingSize' => $this->recordsPageLimit,
183 185
			'showDepthMenu' => 1,
......
189 191
			'deleteDisable' => $this->allowDelete ? 0 : 1,
190 192
			'depthSelection' => $this->getDataFromSession('depthSelection', 0),
191 193
			'tableSelection' => $this->getDataFromSession('tableSelection', 'pages'),
194
			'gridHeight' => $gridHeight,
192 195
		);
193 196
		return $configuration;
194 197
	}
typo3/sysext/recycler/mod1/locallang.xml (working copy)
7 7
	<data type="array">
8 8
		<languageKey index="default" type="array">
9 9
			<label index="title">Recycler</label>
10
			<label index="description">The recycler allows you to select any deleted data and undelete it. You can undelete recursive if the parent of element is deleted too.</label>
10 11
			<label index="label_alltables">All tables</label>
11 12
			<label index="js.label_lostandfound">Lost and found</label>
12 13
			<label index="js.label_deletedTab">Deleted data</label>
......
31 32
			<label index="js.label_title_delete">Delete?</label>
32 33
			<label index="js.label_text_delete">Delete records from tables: </label>
33 34
			<label index="js.label_boxLabel_undelete_recursive">Undelete recursively</label>
35
			<label index="js.label_tableMenu_label">Table:</label>
34 36
			<label index="js.label_tableMenu_emptyText">Choose a table...</label>
35 37
			<label index="js.label_filter_emptyText">Keyword</label>
36 38
			<label index="js.label_search">Search:</label>
37 39
			<label index="js.label_pagingMessage">Displaying records {0} - {1} of {2}</label>
38 40
			<label index="js.label_pagingEmpty">No records to display</label>
39 41
			<label index="js.label_noValueFound">No records for {0}</label>
42
			<label index="js.label_records">Records</label>
43
			<label index="js.label_table">Table</label>
40 44
		</languageKey>
41 45
	</data>
42 46
</T3locallang>
typo3/sysext/recycler/mod1/mod_template.html (working copy)
14 14
	<!-- Content of module, for instance listing, info or editing -->
15 15
	<div id="typo3-docbody">
16 16
		<div id="typo3-inner-docbody">
17
			<h1>###TITLE###</h1>
18 17
			###CONTENT###
19 18
		</div>
20 19
	</div>
typo3/sysext/recycler/res/css/customExtJs.css (working copy)
1
body#ext-recycler-mod1-index-php {
2
	margin-left: 0;
3
}
4
#recyclerContent {
5
	margin: 10px 0 0 4px;
6
}
1 7
body .x-panel { margin-bottom:20px; }
2 8

  
9
.x-toolbar-ct .x-toolbar-left {
10
	width: 400px;
11
}
12

  
13
.x-toolbar-ct .x-toolbar-right {
14
	
15
}
16

  
3 17
.icon-grid { background-image:url('../icons/recycler2.gif') !important; }
4 18

  
5 19
#button-grid .x-panel-body {
typo3/sysext/recycler/res/js/t3_recycler.js (working copy)
159 159

  
160 160
		var rowAction = function(ob, confirmQuestion, cmd, confirmTitle, confirmText) {
161 161
				// get the 'undeleted records' grid object
162
			var grid = tabs.getComponent(0).getComponent(0);
163
			recArray = grid.getSelectionModel().getSelections();
162
			var recArray = gridContainer.getSelectionModel().getSelections();
164 163

  
165 164
			if (recArray.length > 0) {
166 165

  
......
217 216
									callback: function(options, success, response) {
218 217
										if (response.responseText === "1") {
219 218
											// reload the records and the table selector
220
											grid.getStore().reload();
219
											gridDs.reload();
221 220
											Ext.getCmp('tableSelector').store.reload();
222 221
											if (arePagesAffected) {
223 222
												Recycler.utility.updatePageTree();
......
255 254
		};
256 255

  
257 256
		/****************************************************
258
		 * tab container
257
		 * grid container
259 258
		 ****************************************************/
260

  
261
		var tabs = new Ext.TabPanel({
259
		var gridContainer = new Ext.grid.GridPanel ({
260
			layout: 'fit',
262 261
			renderTo: Recycler.statics.renderTo,
263
			layoutOnTabChange: true,
264
			activeTab: 0,
265
			width: '99%',
266
			height: 600,
262
			width: '98%',
263
			height: parseInt(Recycler.statics.gridHeight),
267 264
			frame: true,
268
			border: false,
269
			defaults: {autoScroll: true},
265
			border: true,
266
			defaults: {autoScroll: false},
270 267
			plain: true,
271
			buttons: [{
268
			id: 'delRecordId',
269
			loadMask: true,
270
			store: gridDs,
271
			cm: new Ext.grid.ColumnModel([
272
				sm,
273
				expander,
274
				{header: "UID", width: 10, sortable: true, dataIndex: 'uid'},
275
				{header: "PID", width: 10, sortable: true, dataIndex: 'pid'},
276
				{id: 'record', header: Recycler.lang.records, width: 60, sortable: true, dataIndex: 'record', renderer: renderTopic},
277
				{id: 'table', header: Recycler.lang.table, width: 20, sortable: true, dataIndex: 'tableTitle'}
278
			]),
272 279

  
280
			viewConfig: {
281
				forceFit: true
282
			},
283
			
284
			sm: sm,
285
			plugins: [expander, new Ext.ux.plugins.FitToParent()],
286
			loadMask: true,
287
			stripeRows: true,
288
			collapsible: false,
289
			animCollapse: false,
290
			
291
			bbar: [
292
				{
293

  
273 294
					/****************************************************
295
					 * Paging toolbar
296
					 ****************************************************/
297
					id: 'recordPaging',
298
					xtype: 'paging',
299
					store: gridDs,
300
					pageSize: Recycler.statics.pagingSize,
301
					displayInfo: true,
302
					displayMsg: Recycler.lang.pagingMessage,
303
					emptyMsg: Recycler.lang.pagingEmpty
304
				}, '-', {
305
					/****************************************************
274 306
					 * Delete button
275 307
					 ****************************************************/
276

  
308
					xtype: 'button',
309
					width: 80,
277 310
					id: 'deleteButton',
278 311
					text: Recycler.lang.deleteButton_text,
279 312
					tooltip: Recycler.lang.deleteButton_tooltip,
280 313
					iconCls: 'delete',
281 314
					disabled: Recycler.statics.deleteDisable,
282 315
					handler: function_delete
283
				},{
284

  
316
				}, {
285 317
					/****************************************************
286 318
					 * Undelete button
287 319
					 ****************************************************/
288

  
320
					xtype: 'button',
321
					width: 80,
289 322
					id: 'undeleteButton',
290 323
					text: Recycler.lang.undeleteButton_text,
291 324
					tooltip: Recycler.lang.undeleteButton_tooltip,
......
293 326
					handler: function_undelete
294 327
				}
295 328
			],
296
			buttonAlign:'left',
297
			items:[
298
				{
299 329

  
330
			tbar: [
331
				Recycler.lang.search, ' ',
332
					new Ext.app.SearchField({
333
					store: gridDs,
334
					width: 200
335
				}),
336
				'-', {
337
					xtype: 'tbtext',
338
					text: Recycler.lang.depth + ':'
339
				},{
340

  
300 341
					/****************************************************
301
					 * Deleted records Tab
342
					 * Depth menu
302 343
					 ****************************************************/
303

  
304
					id: 'delRecordId',
305
					title: Recycler.lang.deletedTab,
306
					items: [
307
						{
308

  
309
							/****************************************************
310
							 * Grid
311
							 ****************************************************/
312

  
313
							xtype: 'grid',
314
							loadMask: true,
315
							store: gridDs,
316
							cm: new Ext.grid.ColumnModel([
317
								sm,
318
								expander,
319
								{header: "UID", width: 10, sortable: true, dataIndex: 'uid'},
320
								{header: "PID", width: 10, sortable: true, dataIndex: 'pid'},
321
								{id:'record',header: "Records", width: 60, sortable: true, dataIndex: 'record', renderer: renderTopic},
322
								{header: "Table", width: 20, sortable: true, dataIndex: 'tableTitle'}
323
							]),
324

  
325
							view: new Ext.grid.GridView({
326
								forceFit:true
327
							}),
328

  
329
							bbar: [
330
								{
331

  
332
									/****************************************************
333
									 * Paging toolbar
334
									 ****************************************************/
335
									id: 'recordPaging',
336
									xtype: 'paging',
337
									store: gridDs,
338
									pageSize: Recycler.statics.pagingSize,
339
									displayInfo: true,
340
									displayMsg: Recycler.lang.pagingMessage,
341
									emptyMsg: Recycler.lang.pagingEmpty
342
								}
343
							],
344

  
345
							tbar: [
346
									Recycler.lang.search, ' ',
347
										new Ext.app.SearchField({
348
										store: gridDs,
349
										width: 200
350
									}),
351
									'->', {
352

  
353
									/****************************************************
354
									 * Depth menu
355
									 ****************************************************/
356

  
357
									xtype: 'combo',
358
									lazyRender: true,
359
									valueField: 'depth',
360
									displayField: 'label',
361
									id: 'depthSelector',
362
									mode: 'local',
363
									emptyText: Recycler.lang.depth,
364
									selectOnFocus: true,
365
									readOnly: true,
366
									triggerAction: 'all',
367
									editable: false,
368
									forceSelection: true,
369
									hidden: Recycler.lang.showDepthMenu,
370
									store: new Ext.data.SimpleStore({
371
										autoLoad: true,
372
										fields: ['depth','label'],
373
										data : [
374
											['0', Recycler.lang.depth_0],
375
											['1', Recycler.lang.depth_1],
376
											['2', Recycler.lang.depth_2],
377
											['3', Recycler.lang.depth_3],
378
											['4', Recycler.lang.depth_4],
379
											['999', Recycler.lang.depth_infi]
380
										]
381
									}),
382
									value: Recycler.statics.depthSelection,
383
									listeners: {
384
										'select': {
385
											fn: function(cmp, rec, index) {
386
												var store = tabs.getComponent(0).getComponent(0).getStore();
387
												var depth = rec.get('depth');
388
												gridDs.setBaseParam('depth', depth);
389
												store.load({
390
													params: {
391
														start: 0
392
													}
393
												});
394

  
395
												Ext.getCmp('tableSelector').store.load({
396
													params: {
397
														depth: depth
398
													}
399
												});
400
											}
401
										}
344
	
345
					xtype: 'combo',
346
					width: 150,
347
					lazyRender: true,
348
					valueField: 'depth',
349
					displayField: 'label',
350
					id: 'depthSelector',
351
					mode: 'local',
352
					emptyText: Recycler.lang.depth,
353
					selectOnFocus: true,
354
					readOnly: true,
355
					triggerAction: 'all',
356
					editable: false,
357
					forceSelection: true,
358
					hidden: Recycler.lang.showDepthMenu,
359
					store: new Ext.data.SimpleStore({
360
						autoLoad: true,
361
						fields: ['depth','label'],
362
						data : [
363
							['0', Recycler.lang.depth_0],
364
							['1', Recycler.lang.depth_1],
365
							['2', Recycler.lang.depth_2],
366
							['3', Recycler.lang.depth_3],
367
							['4', Recycler.lang.depth_4],
368
							['999', Recycler.lang.depth_infi]
369
						]
370
					}),
371
					value: Recycler.statics.depthSelection,
372
					listeners: {
373
						'select': {
374
							fn: function(cmp, rec, index) {
375
								var depth = rec.get('depth');
376
								gridDs.setBaseParam('depth', depth);
377
								gridDs.load({
378
									params: {
379
										start: 0
402 380
									}
403
								},'->',{
381
								});
382
	
383
								Ext.getCmp('tableSelector').store.load({
384
									params: {
385
										depth: depth
386
									}
387
								});
388
							}
389
						}
390
					}
391
				},'-',{
392
					xtype: 'tbtext',
393
					text: Recycler.lang.tableMenu_label
394
				},{
404 395

  
405
									/****************************************************
406
									 * Table menu
407
									 ****************************************************/
396
					/****************************************************
397
					 * Table menu
398
					 ****************************************************/
408 399

  
409
									xtype: 'combo',
410
									lazyRender: true,
411
									valueField: 'valueField',
412
									displayField: 'tableTitle',
413
									id: 'tableSelector',
414
									mode: 'local',
415
									emptyText: Recycler.lang.tableMenu_emptyText,
416
									selectOnFocus: true,
417
									readOnly: true,
418
									triggerAction: 'all',
419
									editable: false,
420
									forceSelection: true,
400
					xtype: 'combo',
401
					lazyRender: true,
402
					valueField: 'valueField',
403
					displayField: 'tableTitle',
404
					id: 'tableSelector',
405
					mode: 'local',
406
					emptyText: Recycler.lang.tableMenu_emptyText,
407
					selectOnFocus: true,
408
					readOnly: true,
409
					triggerAction: 'all',
410
					editable: false,
411
					forceSelection: true,
421 412

  
422
									store: new Ext.data.Store({
423
										autoLoad: true,
424
										url: Recycler.statics.ajaxController + '&startUid=' + Recycler.statics.startUid + '&cmd=getTables' + '&depth=' + Recycler.statics.depthSelection,
425
										reader: new Ext.data.ArrayReader({}, [
426
											{name: 'table', type: 'string'},
427
											{name: 'records', type: 'int'},
428
											{name: 'valueField', type: 'string'},
429
											{name: 'tableTitle', type: 'string'}
430
										]),
431
										listeners: {
432
											'load': {
433
												fn: function(store, records) {
434
													Ext.getCmp('tableSelector').setValue(Recycler.statics.tableSelection);
435
												},
436
												single: true
437
											}
438
										}
439
									}),
440
									valueNotFoundText: String.format(Recycler.lang.noValueFound, Recycler.statics.tableSelection),
441
									tpl: '<tpl for="."><tpl if="records &gt; 0"><div ext:qtip="{table} ({records})" class="x-combo-list-item">{tableTitle} ({records}) </div></tpl><tpl if="records &lt; 1"><div ext:qtip="{table} ({records})" class="x-combo-list-item x-item-disabled">{tableTitle} ({records}) </div></tpl></tpl>',
442
									listeners: {
443
										'select': {
444
											fn: function(cmp, rec, index) {
445
												var store = gridDs;
446
												var table = rec.get('valueField');
413
					store: new Ext.data.Store({
414
						autoLoad: true,
415
						url: Recycler.statics.ajaxController + '&startUid=' + Recycler.statics.startUid + '&cmd=getTables' + '&depth=' + Recycler.statics.depthSelection,
416
						reader: new Ext.data.ArrayReader({}, [
417
							{name: 'table', type: 'string'},
418
							{name: 'records', type: 'int'},
419
							{name: 'valueField', type: 'string'},
420
							{name: 'tableTitle', type: 'string'}
421
						]),
422
						listeners: {
423
							'load': {
424
								fn: function(store, records) {
425
									Ext.getCmp('tableSelector').setValue(Recycler.statics.tableSelection);
426
								},
427
								single: true
428
							}
429
						}
430
					}),
431
					valueNotFoundText: String.format(Recycler.lang.noValueFound, Recycler.statics.tableSelection),
432
					tpl: '<tpl for="."><tpl if="records &gt; 0"><div ext:qtip="{table} ({records})" class="x-combo-list-item">{tableTitle} ({records}) </div></tpl><tpl if="records &lt; 1"><div ext:qtip="{table} ({records})" class="x-combo-list-item x-item-disabled">{tableTitle} ({records}) </div></tpl></tpl>',
433
					listeners: {
434
						'select': {
435
							fn: function(cmp, rec, index) {
436
								var table = rec.get('valueField');
447 437

  
448
												// do not reload if the table selected has no deleted records - hide all records
449
												if (rec.get('records') <= 0) {
450
													store.filter('uid', '-1'); // never true
451
													return false;
452
												}
453
												gridDs.setBaseParam('table', table);
454
												store.load({
455
													params: {
456
														start: 0
457
													}
458
												});
459
											}
460
										}
461
									}
438
								// do not reload if the table selected has no deleted records - hide all records
439
								if (rec.get('records') <= 0) {
440
									gridDs.filter('uid', '-1'); // never true
441
									return false;
462 442
								}
463
							],
464

  
465
							sm: sm,
466
							plugins: expander,
467
							loadMask: true,
468
							stripeRows: true,
469
							width: '100%',
470
							height: 530,
471
							collapsible: false,
472
							animCollapse: false,
473
							frame: false,
474
							border: false,
475
							listeners: {
476
								'render': {
477
									fn: function(cmp) {
478
										cmp.getStore().load();
479
									},
480
									single: true
481
								}
443
								gridDs.setBaseParam('table', table);
444
								gridDs.load({
445
									params: {
446
										start: 0
447
									}
448
								});
482 449
							}
483 450
						}
484
					]
485
				}//,{
486

  
487
					/****************************************************
488
					 * Lost and found Tab
489
					 ****************************************************/
490
					/*
491
					id: 'lostAndFoundId',
492
					title: Recycler.staticsRecycler.statics.lostFoundTab,
493
					html:'Later'
494
				}	*/
451
					}
452
				}
495 453
			]
454

  
496 455
		});
456
		gridDs.load();
497 457
	}
498 458
};
499 459

  
......
504 464
			top.content.nav_frame.Tree.refresh();
505 465
		}
506 466
	}
507
};
467
};
468

  
469
/* plugin for resize of grid in single container */
470
Ext.namespace('Ext.ux.plugins');
471
Ext.ux.plugins.FitToParent = Ext.extend(Object, {
472
	constructor : function(parent) {
473
		this.parent = parent;
474
	},
475
	init : function(c) {
476
		c.on('render', function(c) {
477
			c.fitToElement = Ext.get(this.parent
478
					|| c.getDomPositionEl().dom.parentNode);
479
			if (!c.doLayout) {
480
				this.fitSizeToParent();
481
				Ext.EventManager.onWindowResize(this.fitSizeToParent, this);
482
			}
483
		}, this, {
484
			single : true
485
		});
486
		if (c.doLayout) {
487
			c.monitorResize = true;
488
			c.doLayout = c.doLayout.createInterceptor(this.fitSizeToParent);
489
		}
490
	},
491
	fitSizeToParent : function() {
492
		var pos = this.getPosition(true), size = this.fitToElement
493
				.getViewSize();
494
		this.setSize(size.width - pos[0], size.height - pos[1]);
495
	}
496
});