View | Details | Raw Unified | Return to bug 41293 | Differences between
and this patch

Collapse All | Expand All

(-)umc/js/schoolwizards/Grid.js (-1 / +1 lines)
 Lines 181-187    Link Here 
181
					label: _('School')
181
					label: _('School')
182
				});
182
				});
183
			}
183
			}
184
			columns = columns.concat(this.getGridColumns());
184
			columns = this.getGridColumns().concat(columns);
185
			return columns;
185
			return columns;
186
		},
186
		},
187
187
(-)umc/js/schoolwizards/UserGrid.js (-3 / +15 lines)
 Lines 32-45    Link Here 
32
define([
32
define([
33
	"dojo/_base/declare",
33
	"dojo/_base/declare",
34
	"dojo/_base/lang",
34
	"dojo/_base/lang",
35
	"dojo/_base/array",
35
	"dojo/string",
36
	"dojo/topic",
37
	"umc/widgets/TextBox",
36
	"umc/widgets/TextBox",
38
	"umc/widgets/ComboBox",
37
	"umc/widgets/ComboBox",
39
	"umc/modules/schoolwizards/UserWizard",
38
	"umc/modules/schoolwizards/UserWizard",
40
	"umc/modules/schoolwizards/Grid",
39
	"umc/modules/schoolwizards/Grid",
41
	"umc/i18n!umc/modules/schoolwizards"
40
	"umc/i18n!umc/modules/schoolwizards"
42
], function(declare, lang, array, topic, TextBox, ComboBox, UserWizard, Grid, _) {
41
], function(declare, lang, string, TextBox, ComboBox, UserWizard, Grid, _) {
43
42
44
	return declare("umc.modules.schoolwizards.UserGrid", [Grid], {
43
	return declare("umc.modules.schoolwizards.UserGrid", [Grid], {
45
44
 Lines 49-55    Link Here 
49
		objectNameSingular: _('school user'),
48
		objectNameSingular: _('school user'),
50
		firstObject: _('the first school user'),
49
		firstObject: _('the first school user'),
51
		createObjectWizard: UserWizard,
50
		createObjectWizard: UserWizard,
51
		sortFields: ['name'],
52
52
53
		getGridColumnsWithSchool: function() {
54
			return this.getGridColumns();
55
		},
56
53
		getGridColumns: function() {
57
		getGridColumns: function() {
54
			return [{
58
			return [{
55
				name: 'display_name',
59
				name: 'display_name',
 Lines 72-77    Link Here 
72
//				label: _('E-Mail address'),
76
//				label: _('E-Mail address'),
73
//				description: _('E-Mail address of the %s.', this.objectNameSingular)
77
//				description: _('E-Mail address of the %s.', this.objectNameSingular)
74
			}, {
78
			}, {
79
				name: 'schools',
80
				label: _('School'),
81
				formatter: lang.hitch(this, function(schools, id) {
82
					var escaped_schools_str = string.escape(schools.join(', '));
83
					return '<span title="' + escaped_schools_str + '">' + escaped_schools_str + '</span>';
84
				}),
85
				styles: 'white-space: nowrap; text-overflow: ellipsis;',
86
			}, {
75
				name: 'empty',  // workaround: EnhancedGrid
87
				name: 'empty',  // workaround: EnhancedGrid
76
				label: '&nbsp;',
88
				label: '&nbsp;',
77
				width: '10px',
89
				width: '10px',
(-)umc/js/schoolwizards/UserGridChooseSchool.js (+134 lines)
Line 0    Link Here 
1
/*
2
 * Copyright 2012-2016 Univention GmbH
3
 *
4
 * http://www.univention.de/
5
 *
6
 * All rights reserved.
7
 *
8
 * The source code of this program is made available
9
 * under the terms of the GNU Affero General Public License version 3
10
 * (GNU AGPL V3) as published by the Free Software Foundation.
11
 *
12
 * Binary versions of this program provided by Univention to you as
13
 * well as other copyrighted, protected or trademarked materials like
14
 * Logos, graphics, fonts, specific documentations and configurations,
15
 * cryptographic keys etc. are subject to a license agreement between
16
 * you and Univention and not subject to the GNU AGPL V3.
17
 *
18
 * In the case you use this program under the terms of the GNU AGPL V3,
19
 * the program is provided in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public
25
 * License with the Debian GNU/Linux or Univention distribution in file
26
 * /usr/share/common-licenses/AGPL-3; if not, see
27
 * <http://www.gnu.org/licenses/>.
28
 */
29
30
/*global define*/
31
32
define([
33
	"dojo/_base/declare",
34
	"dojo/_base/lang",
35
	"dojo/_base/array",
36
	"umc/widgets/Form",
37
	"umc/widgets/ContainerWidget",
38
	"umc/widgets/Button",
39
	"umc/widgets/ComboBox",
40
	"umc/widgets/Text",
41
	"umc/modules/schoolwizards/UserGrid",
42
	"umc/i18n!umc/modules/schoolwizards"
43
], function(declare, lang, array, Form, ContainerWidget, Button, ComboBox, Text, UserGrid, _) {
44
45
	return declare("umc.modules.schoolwizards.UserGridChooseSchool", [ContainerWidget], {
46
		userGrid: null,
47
		baseTitle: null,
48
		_form: null,
49
50
		postMixInProperties: function() {
51
			this.baseTitle = this.module.get('title');
52
		},
53
54
		buildRendering: function() {
55
			this.inherited(arguments);
56
57
			var headerTextWidget = this.createHeader();			
58
			this._form = this.createForm();
59
			this._form.on('submit', lang.hitch(this, 'buildGrid'));
60
61
			this.addChild(headerTextWidget);
62
			this.addChild(this._form);
63
		},
64
65
		createHeader: function() {
66
			var headerText = _("Select a school on which you like to work on");
67
			return new Text({
68
				content: _('<h1>' + headerText + '<h1>'),
69
				'class': 'umcPageHeader'
70
			});
71
		},
72
73
		createForm: function() {
74
			return new Form({
75
				widgets: [{
76
					type: ComboBox,
77
					name: 'schools',
78
					label: _('School'),
79
					size: 'OneThirds',
80
					staticValues: this.schools
81
				}],
82
				buttons: [{
83
					name: 'submit',
84
					label: _('Next')
85
				}],
86
				layout: [
87
					['schools', 'submit'],
88
				]
89
			});
90
		},
91
92
		buildGrid: function() {
93
			var selectedSchool = array.filter(this.schools, lang.hitch(this, function(school) {
94
				return school.id === this._form.getWidget('schools').getValue();
95
			}))[0];
96
			var _backToSchool = new Button({
97
				name: 'back',
98
				label: 'Back',
99
				region: 'footer',
100
				onClick: lang.hitch(this, 'chooseDifferentSchool')
101
			});
102
			var userGrid = new UserGrid({
103
				description: this.description,
104
				schools: [selectedSchool],
105
				udmLinkEnabled: this.udmLinkEnabled,
106
				autoSearch: this.autoSearch,
107
				umcpCommand: lang.hitch(this, 'umcpCommand'),
108
				moduleFlavor: this.moduleFlavor,
109
				module: this.module
110
			});
111
112
			//add UserGrid to module
113
			userGrid.addChild(_backToSchool);
114
			this.module.addChild(userGrid);
115
			this.module.selectChild(userGrid);
116
117
			//append title with the selected school
118
			var titleAppendix = lang.replace(": {0}", [selectedSchool.label]);
119
			this.module.set('title', this.baseTitle + titleAppendix);
120
121
			this.userGrid = userGrid;
122
		},
123
124
		chooseDifferentSchool: function() {
125
			this.module.removeChild(this.userGrid);
126
			this.userGrid.destroyRecursive();
127
128
			this.module.set('title', this.baseTitle);
129
130
			this.module.selectChild(this);
131
		}
132
	});
133
});
134
(-)umc/js/schoolwizards/UserWizard.js (-2 / +13 lines)
 Lines 38-47    Link Here 
38
	"umc/widgets/TextBox",
38
	"umc/widgets/TextBox",
39
	"umc/widgets/Text",
39
	"umc/widgets/Text",
40
	"umc/widgets/ComboBox",
40
	"umc/widgets/ComboBox",
41
	"umc/widgets/MultiSelect",
41
	"umc/widgets/PasswordInputBox",
42
	"umc/widgets/PasswordInputBox",
42
	"umc/modules/schoolwizards/Wizard",
43
	"umc/modules/schoolwizards/Wizard",
43
	"umc/i18n!umc/modules/schoolwizards"
44
	"umc/i18n!umc/modules/schoolwizards"
44
], function(declare, lang, array, topic, tools, TextBox, Text, ComboBox, PasswordInputBox, Wizard, _) {
45
], function(declare, lang, array, topic, tools, TextBox, Text, ComboBox, MultiSelect, PasswordInputBox, Wizard, _) {
45
46
46
	return declare("umc.modules.schoolwizards.UserWizard", [Wizard], {
47
	return declare("umc.modules.schoolwizards.UserWizard", [Wizard], {
47
		description: _('Create a new user'),
48
		description: _('Create a new user'),
 Lines 151-156    Link Here 
151
						// ...and another one for Bug #30109
152
						// ...and another one for Bug #30109
152
						return this.getWidget('item', 'password').isValid();
153
						return this.getWidget('item', 'password').isValid();
153
					})
154
					})
155
				}, {
156
					type: MultiSelect,
157
					name: 'schools',
158
					label: _('School'),
159
					_setValueAttr: function(values) {
160
						this.set('dynamicValues', function() {return values;});
161
						return;
162
					},
163
					plugins: null
154
				}],
164
				}],
155
				layout: [
165
				layout: [
156
					['firstname', 'lastname'],
166
					['firstname', 'lastname'],
 Lines 157-163    Link Here 
157
					['name'],
167
					['name'],
158
					['school_class', 'newClass'],
168
					['school_class', 'newClass'],
159
					['email'],
169
					['email'],
160
					['password']
170
					['password'],
171
					['schools']
161
				]
172
				]
162
			};
173
			};
163
		},
174
		},
(-)umc/js/schoolwizards.js (-3 / +3 lines)
 Lines 37-50    Link Here 
37
	"umc/tools",
37
	"umc/tools",
38
	"umc/dialog",
38
	"umc/dialog",
39
	"umc/widgets/Module",
39
	"umc/widgets/Module",
40
	"umc/modules/schoolwizards/UserGrid",
40
	"umc/modules/schoolwizards/UserGridChooseSchool",
41
	"umc/modules/schoolwizards/ClassGrid",
41
	"umc/modules/schoolwizards/ClassGrid",
42
	"umc/modules/schoolwizards/ComputerGrid",
42
	"umc/modules/schoolwizards/ComputerGrid",
43
	"umc/modules/schoolwizards/SchoolGrid",
43
	"umc/modules/schoolwizards/SchoolGrid",
44
	"umc/i18n!umc/modules/schoolwizards"
44
	"umc/i18n!umc/modules/schoolwizards"
45
], function(declare, lang, all, topic, tools, dialog, Module, UserGrid, ClassGrid, ComputerGrid, SchoolGrid, _) {
45
], function(declare, lang, all, topic, tools, dialog, Module, UserGridChooseSchool, ClassGrid, ComputerGrid, SchoolGrid, _) {
46
	var grids = {
46
	var grids = {
47
		'schoolwizards/users': UserGrid,
47
		'schoolwizards/users': UserGridChooseSchool,
48
		'schoolwizards/classes': ClassGrid,
48
		'schoolwizards/classes': ClassGrid,
49
		'schoolwizards/computers': ComputerGrid,
49
		'schoolwizards/computers': ComputerGrid,
50
		'schoolwizards/schools': SchoolGrid
50
		'schoolwizards/schools': SchoolGrid

Return to bug 41293