Feature #32309 » cardLayout.diff

small improvements for list module, now testmodules are list and reports - Kay Strobach, 2011-12-07 10:15

View differences:

typo3/js/extjs/iframepanel.js
78 78
		return this.body.dom.src;
79 79
	},
80 80

  
81
	getModuleWrapper: function() {
82
		return this.findParentBy(
83
			function(container, component) {
84
				if(container.id === 'typo3-contentContainerWrapper') {
85
					return true;
86
				}
87
			}
88
		);
89
	},
90

  
81 91
	setUrl: function(source) {
92
		var wrapper;
82 93
		this.setMask();
83 94
		this.body.dom.src = source;
95

  
96
			// go up the object tree and ensure, that the frame gets visible
97
		wrapper = this.getModuleWrapper();
98
		if(wrapper) {
99
			if(wrapper.get('typo3-card-' + TYPO3.ModuleMenu.App.loadedModule)) {
100
				wrapper.getLayout().setActiveItem('typo3-card-' + TYPO3.ModuleMenu.App.loadedModule);
101
			} else {
102
				wrapper.getLayout().setActiveItem(this.id);
103
			}
104
		}
84 105
	},
85 106

  
86 107
	resetUrl: function() {
typo3/js/extjs/viewportConfiguration.js
27 27
Ext.ns('TYPO3');
28 28

  
29 29
/**
30
 * The Cards Configuration for the BE Module Cards
31
 *
32
 * New items need to be appended here
33
 * cards id needs to be prepended with typo3-card- the rest of the id is the
34
 * be module name as passed it is normally in TYPO3
35
 * Cards shouldn't be simple iframes for performance reasons
36
 *
37
 * @author Kay Strobach    <typo3@kay-strobach.de>
38
*/
39

  
40
TYPO3.Viewport.ContentCards = {
41
		// Add a card to either the config or if already rendered to the wrapper
42
	addContentCard: function(name,config) {
43
		config.id = 'typo3-card-' + name;
44
		if (Ext.ready) {
45
			Ext.getCmp('typo3-contentContainerWrapper').add(config);
46
		} else {
47
			this.cards.push(config);
48
		}
49
	},
50
	cards: [
51
		{
52
			id: 'typo3-contentContainer',
53
			border: false,
54
			xtype: 'iframePanel',
55
			name: 'content'
56
		}, {
57
			//id:'typo3-card-tools_txextdevevalM1',
58
			id: 'typo3-card-web_list',
59
			html: 'extdeval',
60
			setUrl: function() {
61
				TYPO3.Flashmessage.display(
62
					1,
63
					'function called',
64
					'you fired the setUrl event of extdeval'
65
				);
66
			}
67
		}, {
68
			id: 'typo3-card-tools_txreportsM1',
69
			html: 'i´m the report card'
70
		}
71
	]
72
};
73

  
74

  
75
/**
30 76
 * The backend viewport configuration
31 77
 *
32 78
 * @author Stefan Galinski <stefan.galinski@gmail.com>
......
105 151
							border: false,
106 152
							hidden: true,
107 153
							floatable: true,
108
							xtime: 'iframePanel',
154
							xtype: 'iframePanel',
109 155
							width: 5
110 156
						},
111 157
						{
112
							id: 'typo3-contentContainer',
158
							id: 'typo3-contentContainerWrapper',
113 159
							region: 'center',
114 160
							anchor: '100% 100%',
115 161
							border: false,
116
							xtype: 'iframePanel',
117
							name: 'content'
162
							xtype: 'panel',
163
							layout: 'card',
164
							activeItem: 0,
165
							items: TYPO3.Viewport.ContentCards.cards
118 166
						}
119 167
					]
120 168
				},
typo3/js/modulemenu.js
257 257
				TYPO3.Backend.NavigationContainer.hide();
258 258
				TYPO3.Backend.NavigationDummy.show();
259 259
			}
260
			this.openInContentFrame(record.originalLink, params);
261 260
			this.loadedModule = mod;
262 261
			this.highlightModuleMenuItem(mod);
262
			this.openInContentFrame(record.originalLink, params);
263 263

  
264 264
				// compatibility
265 265
			top.currentSubScript = record.originalLink;
......
324 324
	},
325 325

  
326 326
	openInContentFrame: function(url, params) {
327
		var relatedCard, urlToLoad;
327 328
		if (top.nextLoadModuleUrl) {
328 329
			TYPO3.Backend.ContentContainer.setUrl(top.nextLoadModuleUrl);
329 330
			top.nextLoadModuleUrl = '';
330 331
		} else {
331
			TYPO3.Backend.ContentContainer.setUrl(url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : ''));
332
			relatedCard = Ext.getCmp('typo3-contentContainerWrapper').get('typo3-card-' + this.loadedModule);
333
			urlToLoad   = url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : '')
334
			if(relatedCard) {
335
				if (typeof relatedCard.setUrl === 'function') {
336
					relatedCard.setUrl(urlToLoad);
337
				}
338
				Ext.getCmp('typo3-contentContainerWrapper').getLayout().setActiveItem('typo3-card-' + this.loadedModule);
339
			} else {
340
				TYPO3.Backend.ContentContainer.setUrl(urlToLoad);
341
				Ext.getCmp('typo3-contentContainerWrapper').getLayout().setActiveItem('typo3-card-' + this.loadedModule);
342
			}
332 343
		}
333 344
	},
334 345

  
(2-2/8)