12437_v2.diff

Administrator Admin, 2009-11-04 12:27

Download (16.4 KB)

View differences:

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;
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>
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

  
3 9
.icon-grid { background-image:url('../icons/recycler2.gif') !important; }
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 grid = gridContainer.view;
163
			var recArray = gridContainer.getSelectionModel().getSelections();
164 164

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

  
......
217 217
									callback: function(options, success, response) {
218 218
										if (response.responseText === "1") {
219 219
											// reload the records and the table selector
220
											grid.getStore().reload();
220
											gridDs.reload();
221 221
											Ext.getCmp('tableSelector').store.reload();
222 222
											if (arePagesAffected) {
223 223
												Recycler.utility.updatePageTree();
......
258 258
		 * tab container
259 259
		 ****************************************************/
260 260

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

  
281
			view: new Ext.grid.GridView({
282
				forceFit:true
283
			}),
284

  
285
			bbar: [
286
				{
287

  
273 288
					/****************************************************
274
					 * Delete button
289
					 * Paging toolbar
275 290
					 ****************************************************/
291
					id: 'recordPaging',
292
					xtype: 'paging',
293
					store: gridDs,
294
					pageSize: Recycler.statics.pagingSize,
295
					displayInfo: true,
296
					displayMsg: Recycler.lang.pagingMessage,
297
					emptyMsg: Recycler.lang.pagingEmpty
298
				}
299
			],
276 300

  
301
			tbar: [
302
				Recycler.lang.search, ' ',
303
					new Ext.app.SearchField({
304
					store: gridDs,
305
					width: 200
306
				}),
307
				'-', {
308
					xtype: 'tbtext',
309
					text: Recycler.lang.depth + ':'
310
				},{
311

  
312
					/****************************************************
313
					 * Depth menu
314
					 ****************************************************/
315
	
316
					xtype: 'combo',
317
					width: 100,
318
					lazyRender: true,
319
					valueField: 'depth',
320
					displayField: 'label',
321
					id: 'depthSelector',
322
					mode: 'local',
323
					emptyText: Recycler.lang.depth,
324
					selectOnFocus: true,
325
					readOnly: true,
326
					triggerAction: 'all',
327
					editable: false,
328
					forceSelection: true,
329
					hidden: Recycler.lang.showDepthMenu,
330
					store: new Ext.data.SimpleStore({
331
						autoLoad: true,
332
						fields: ['depth','label'],
333
						data : [
334
							['0', Recycler.lang.depth_0],
335
							['1', Recycler.lang.depth_1],
336
							['2', Recycler.lang.depth_2],
337
							['3', Recycler.lang.depth_3],
338
							['4', Recycler.lang.depth_4],
339
							['999', Recycler.lang.depth_infi]
340
						]
341
					}),
342
					value: Recycler.statics.depthSelection,
343
					listeners: {
344
						'select': {
345
							fn: function(cmp, rec, index) {
346
								var depth = rec.get('depth');
347
								gridDs.setBaseParam('depth', depth);
348
								gridDs.load({
349
									params: {
350
										start: 0
351
									}
352
								});
353
	
354
								Ext.getCmp('tableSelector').store.load({
355
									params: {
356
										depth: depth
357
									}
358
								});
359
							}
360
						}
361
					}
362
				},'-',{
363
					xtype: 'tbtext',
364
					text: Recycler.lang.tableMenu_label
365
				},{
366

  
367
					/****************************************************
368
					 * Table menu
369
					 ****************************************************/
370

  
371
					xtype: 'combo',
372
					lazyRender: true,
373
					valueField: 'valueField',
374
					displayField: 'tableTitle',
375
					id: 'tableSelector',
376
					mode: 'local',
377
					emptyText: Recycler.lang.tableMenu_emptyText,
378
					selectOnFocus: true,
379
					readOnly: true,
380
					triggerAction: 'all',
381
					editable: false,
382
					forceSelection: true,
383

  
384
					store: new Ext.data.Store({
385
						autoLoad: true,
386
						url: Recycler.statics.ajaxController + '&startUid=' + Recycler.statics.startUid + '&cmd=getTables' + '&depth=' + Recycler.statics.depthSelection,
387
						reader: new Ext.data.ArrayReader({}, [
388
							{name: 'table', type: 'string'},
389
							{name: 'records', type: 'int'},
390
							{name: 'valueField', type: 'string'},
391
							{name: 'tableTitle', type: 'string'}
392
						]),
393
						listeners: {
394
							'load': {
395
								fn: function(store, records) {
396
									Ext.getCmp('tableSelector').setValue(Recycler.statics.tableSelection);
397
								},
398
								single: true
399
							}
400
						}
401
					}),
402
					valueNotFoundText: String.format(Recycler.lang.noValueFound, Recycler.statics.tableSelection),
403
					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>',
404
					listeners: {
405
						'select': {
406
							fn: function(cmp, rec, index) {
407
								var table = rec.get('valueField');
408

  
409
								// do not reload if the table selected has no deleted records - hide all records
410
								if (rec.get('records') <= 0) {
411
									gridDs.filter('uid', '-1'); // never true
412
									return false;
413
								}
414
								gridDs.setBaseParam('table', table);
415
								gridDs.load({
416
									params: {
417
										start: 0
418
									}
419
								});
420
							}
421
						}
422
					}
423
				}, {
424
					xtype: 'tbfill',
425
					width: 100
426
				}, '-', {
427
					/****************************************************
428
					 * Delete button
429
					 ****************************************************/
430
					xtype: 'button',
277 431
					id: 'deleteButton',
278 432
					text: Recycler.lang.deleteButton_text,
279 433
					tooltip: Recycler.lang.deleteButton_tooltip,
280 434
					iconCls: 'delete',
281 435
					disabled: Recycler.statics.deleteDisable,
282 436
					handler: function_delete
283
				},{
284

  
437
				}, {
285 438
					/****************************************************
286 439
					 * Undelete button
287 440
					 ****************************************************/
288

  
441
					xtype: 'button',
289 442
					id: 'undeleteButton',
290 443
					text: Recycler.lang.undeleteButton_text,
291 444
					tooltip: Recycler.lang.undeleteButton_tooltip,
......
293 446
					handler: function_undelete
294 447
				}
295 448
			],
296
			buttonAlign:'left',
297
			items:[
298
				{
299 449

  
300
					/****************************************************
301
					 * Deleted records Tab
302
					 ****************************************************/
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
										}
402
									}
403
								},'->',{
404

  
405
									/****************************************************
406
									 * Table menu
407
									 ****************************************************/
408

  
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,
421

  
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');
447

  
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
									}
462
								}
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
								}
482
							}
483
						}
484
					]
485
				}//,{
486

  
487
					/****************************************************
488
					 * Lost and found Tab
489
					 ****************************************************/
490
					/*
491
					id: 'lostAndFoundId',
492
					title: Recycler.staticsRecycler.statics.lostFoundTab,
493
					html:'Later'
494
				}	*/
495
			]
450
			sm: sm,
451
			plugins: expander,
452
			loadMask: true,
453
			stripeRows: true,
454
			width: '100%',
455
			height: 530,
456
			collapsible: false,
457
			animCollapse: false,
458
			frame: false,
459
			border: false,
460
			listeners: {
461
				resize: function(obj) {
462
					//TODO: find a way to resize columns to fit in view
463
				}
464
			}
496 465
		});
466
		gridDs.load();
497 467
	}
498 468
};
499 469