View | Details | Raw Unified | Return to bug 31199
Collapse All | Expand All

(-)debian/control (+1 lines)
 Lines 8-13    Link Here 
8
 univention-management-console-dev,
8
 univention-management-console-dev,
9
 python-all
9
 python-all
10
Standards-Version: 3.8.2
10
Standards-Version: 3.8.2
11
XS-Python-Version: 2.6
11
12
12
Package: univention-system-info
13
Package: univention-system-info
13
Architecture: all
14
Architecture: all
(-)umc/js/sysinfo.js (-7 / +29 lines)
 Lines 33-39    Link Here 
33
	"dojo/_base/lang",
33
	"dojo/_base/lang",
34
	"dojo/_base/array",
34
	"dojo/_base/array",
35
	"dojo/topic",
35
	"dojo/topic",
36
	"dojo/Deferred",
36
	"umc/tools",
37
	"umc/tools",
38
	"umc/dialog",
37
	"umc/widgets/Module",
39
	"umc/widgets/Module",
38
	"umc/widgets/Wizard",
40
	"umc/widgets/Wizard",
39
	"umc/widgets/StandbyMixin",
41
	"umc/widgets/StandbyMixin",
 Lines 43-49    Link Here 
43
	"umc/widgets/TextArea",
45
	"umc/widgets/TextArea",
44
	"umc/widgets/CheckBox",
46
	"umc/widgets/CheckBox",
45
	"umc/i18n!umc/modules/sysinfo"
47
	"umc/i18n!umc/modules/sysinfo"
46
], function(declare, lang, array, topic, tools, Module, Wizard, StandbyMixin, ComboBox, TextBox, Text, TextArea, CheckBox, _) {
48
], function(declare, lang, array, topic, Deferred, tools, dialog, Module, Wizard, StandbyMixin, ComboBox, TextBox, Text, TextArea, CheckBox, _) {
47
49
48
	var SysinfoWizard = declare("umc.modules.sysinfo.Wizard", [ Wizard, StandbyMixin ], {
50
	var SysinfoWizard = declare("umc.modules.sysinfo.Wizard", [ Wizard, StandbyMixin ], {
49
51
 Lines 86-92    Link Here 
86
			}, {
88
			}, {
87
				name: 'support',
89
				name: 'support',
88
				headerText: _('Support information'),
90
				headerText: _('Support information'),
89
				helpText: _(''),
91
				helpText: '',
90
				widgets: [{
92
				widgets: [{
91
					type: Text,
93
					type: Text,
92
					name: 'firstText',
94
					name: 'firstText',
 Lines 107-113    Link Here 
107
			}, {
109
			}, {
108
				name: 'collect',
110
				name: 'collect',
109
				headerText: _('Collected data'),
111
				headerText: _('Collected data'),
110
				helpText: _(''),
112
				helpText: '',
111
				widgets: [{
113
				widgets: [{
112
					type: Text,
114
					type: Text,
113
					name: 'firstText',
115
					name: 'firstText',
 Lines 161-167    Link Here 
161
			}, {
163
			}, {
162
				name: 'transfer',
164
				name: 'transfer',
163
				headerText: _('Transfer the information'),
165
				headerText: _('Transfer the information'),
164
				helpText: _(''),
166
				helpText: '',
165
				widgets: [{
167
				widgets: [{
166
					type: Text,
168
					type: Text,
167
					name: 'firstText',
169
					name: 'firstText',
 Lines 181-187    Link Here 
181
			}, {
183
			}, {
182
				name: 'uploaded',
184
				name: 'uploaded',
183
				headerText: _('Transfered successfully'),
185
				headerText: _('Transfered successfully'),
184
				helpText: _(''),
186
				helpText: '',
185
				widgets: [{
187
				widgets: [{
186
					type: Text,
188
					type: Text,
187
					name: 'firstText',
189
					name: 'firstText',
 Lines 191-197    Link Here 
191
			}, {
193
			}, {
192
				name: 'mail',
194
				name: 'mail',
193
				headerText: _('Transfer via mail'),
195
				headerText: _('Transfer via mail'),
194
				helpText: _(''),
196
				helpText: '',
195
				widgets: [{
197
				widgets: [{
196
					type: Text,
198
					type: Text,
197
					name: 'firstText',
199
					name: 'firstText',
 Lines 208-213    Link Here 
208
				layout: [['firstText'],
210
				layout: [['firstText'],
209
					 	 ['download'],
211
					 	 ['download'],
210
					 	 ['mail']]
212
					 	 ['mail']]
213
			}, {
214
				name: 'uploaded_failed',
215
				headerText: _('Error during transfer'),
216
				helpText: '',
217
				widgets: [{
218
					type: Text,
219
					name: 'firstText',
220
					content: '<p>' + _('The automatic upload of the archive failed. Please go back and send the archive via e-mail. We apologize for the inconvenience.') + '</p>'
221
				}],
222
				layout: [['firstText']]
211
			}];
223
			}];
212
		},
224
		},
213
225
 Lines 232-238    Link Here 
232
		},
244
		},
233
245
234
		hasNext: function(pageName) {
246
		hasNext: function(pageName) {
235
			if (pageName == 'uploaded') {
247
			if (pageName == 'uploaded' || pageName == 'mail') {
236
				return false;
248
				return false;
237
			} else {
249
			} else {
238
				return this.inherited(arguments);
250
				return this.inherited(arguments);
 Lines 266-275    Link Here 
266
				if (this.getWidget('transfer', 'method') == 'mail') {
278
				if (this.getWidget('transfer', 'method') == 'mail') {
267
					nextPage = 'mail';
279
					nextPage = 'mail';
268
				} else {
280
				} else {
281
					nextPage = new Deferred();
269
					this.standby(true);
282
					this.standby(true);
270
					this.uploadArchive().then(
283
					this.uploadArchive().then(
271
						lang.hitch(this, function() {
284
						lang.hitch(this, function() {
272
							this.standby(false);
285
							this.standby(false);
286
							nextPage.resolve('upload');
287
						}),
288
						lang.hitch(this, function() {
289
							this.standby(false);
290
							nextPage.resolve('uploaded_failed');
291
							dialog.alert(_('The automatic upload of the archive failed. Please go back and send the archive via e-mail. We apologize for the inconvenience.'));
273
						})
292
						})
274
					);
293
					);
275
				}
294
				}
 Lines 305-310    Link Here 
305
					return 'transfer';
324
					return 'transfer';
306
				}
325
				}
307
			}
326
			}
327
			if (previousPage == 'mail') {
328
				return 'transfer';
329
			}
308
			return previousPage;
330
			return previousPage;
309
		},
331
		},
310
332
(-)umc/python/sysinfo/__init__.py (-6 / +10 lines)
 Lines 35-57    Link Here 
35
import re
35
import re
36
import subprocess
36
import subprocess
37
37
38
import univention.info_tools as uit
39
import univention.management.console as umc
38
import univention.management.console as umc
40
import univention.management.console.modules as umcm
39
import univention.management.console.modules as umcm
41
from univention.management.console.log import MODULE
40
from univention.management.console.log import MODULE
42
from univention.management.console.protocol.definitions import *
41
from univention.management.console.protocol.definitions import MODULE_ERR, SUCCESS
43
42
44
from urllib import quote, urlencode
43
from urllib import urlencode
45
from urlparse import urlunparse
44
from urlparse import urlunparse
46
45
47
# locale module that overrides functions in urllib2
46
# local module that overrides functions in urllib2
48
import upload
47
from upload import override_urllib_handlers
49
import urllib2
48
import urllib2
50
49
51
import univention.config_registry as ucr
50
import univention.config_registry as ucr
52
51
53
_ = umc.Translation('univention-management-console-module-sysinfo').translate
52
_ = umc.Translation('univention-management-console-module-sysinfo').translate
54
53
54
override_urllib_handlers(urllib2)
55
55
class Instance(umcm.Base):
56
class Instance(umcm.Base):
56
	def __init__(self):
57
	def __init__(self):
57
		umcm.Base.__init__(self)
58
		umcm.Base.__init__(self)
 Lines 155-169    Link Here 
155
		fd = open(os.path.join(SYSINFO_PATH, request.options['archive']), 'r')
156
		fd = open(os.path.join(SYSINFO_PATH, request.options['archive']), 'r')
156
		data = {'filename': fd, }
157
		data = {'filename': fd, }
157
		req = urllib2.Request(url, data, {})
158
		req = urllib2.Request(url, data, {})
159
		answer = None
158
		try:
160
		try:
159
			u = urllib2.urlopen(req)
161
			u = urllib2.urlopen(req)
160
			answer = u.read()
162
			answer = u.read()
161
			success = True
163
			success = True
162
		except:
164
		except Exception as e:
165
			answer = e
163
			success = False
166
			success = False
164
167
165
		if not success or answer.startswith('ERROR:'):
168
		if not success or answer.startswith('ERROR:'):
166
			request.status = MODULE_ERR
169
			request.status = MODULE_ERR
170
			MODULE.error('Upload failed: %s' % answer)
167
		else:
171
		else:
168
			request.status = SUCCESS
172
			request.status = SUCCESS
169
173
(-)umc/python/sysinfo/upload.py (-5 / +6 lines)
 Lines 183-193    Link Here 
183
        else:
183
        else:
184
            return self.parent.error('http', req, fp, code, msg, hdrs)
184
            return self.parent.error('http', req, fp, code, msg, hdrs)
185
185
186
urllib2._old_HTTPHandler = urllib2.HTTPHandler
187
urllib2.HTTPHandler = newHTTPHandler
188
189
class newHTTPSHandler(newHTTPHandler):
186
class newHTTPSHandler(newHTTPHandler):
190
    def https_open(self, req):
187
    def https_open(self, req):
191
        return self.do_open(httplib.HTTPS, req)
188
        return self.do_open(httplib.HTTPS, req)
192
    
189
193
urllib2.HTTPSHandler = newHTTPSHandler
190
def override_urllib_handlers(urllib2_module):
191
	urllib2_module._old_HTTPHandler = urllib2_module.HTTPHandler
192
	urllib2_module.HTTPHandler = newHTTPHandler
193
	urllib2_module.HTTPSHandler = newHTTPSHandler
194

Return to bug 31199