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

(-)a/management/univention-management-console-module-udm/conffiles/etc/apache2/sites-available/univention-directory-manager.conf (+2 lines)
 Lines 3-5    Link Here 
3
<Directory /var/www/univention-directory-reports>
3
<Directory /var/www/univention-directory-reports>
4
        Options -Indexes
4
        Options -Indexes
5
</Directory>
5
</Directory>
6
7
RewriteRule /univention/management/command/udm/(users/users)/(.*)/image /univention/management/command/udm/image?flavor=$1&dn=$2
(-)a/management/univention-management-console-module-udm/umc/js/udm.js (-1 / +1 lines)
 Lines 741-747   define([ Link Here 
741
741
742
			var additionalGridViews = {};
742
			var additionalGridViews = {};
743
			if (this.moduleFlavor === 'users/user') {
743
			if (this.moduleFlavor === 'users/user') {
744
				additionalGridViews = {tile: new TileView()};
744
				additionalGridViews = {tile: new TileView({moduleFlavor: this.moduleFlavor})};
745
			}
745
			}
746
746
747
			// generate the data grid
747
			// generate the data grid
(-)a/management/univention-management-console-module-udm/umc/js/udm/TileView.js (-26 / +6 lines)
 Lines 26-40    Link Here 
26
 * /usr/share/common-licenses/AGPL-3; if not, see
26
 * /usr/share/common-licenses/AGPL-3; if not, see
27
 * <http://www.gnu.org/licenses/>.
27
 * <http://www.gnu.org/licenses/>.
28
 */
28
 */
29
/*global define, window*/
29
/*global define*/
30
30
31
define([
31
define([
32
	"dojo/_base/declare",
32
	"dojo/_base/declare",
33
	"dojo/_base/array",
33
	"dojo/_base/array",
34
	"dojo/_base/lang",
34
	"dojo/_base/lang",
35
	"dojo/io-query",
35
	"dojo/on",
36
	"dojo/on",
36
	"put-selector/put",
37
	"put-selector/put",
37
], function(declare, array, lang, on, put) {
38
], function(declare, array, lang, ioQuery, on, put) {
38
39
39
	return declare("umc.module.udm.TileView", [], {
40
	return declare("umc.module.udm.TileView", [], {
40
41
 Lines 43-48   define([ Link Here 
43
		necessaryUdmValues: ["displayName", "mailPrimaryAddress", "firstname", "lastname"], 
44
		necessaryUdmValues: ["displayName", "mailPrimaryAddress", "firstname", "lastname"], 
44
45
45
		_queryTimer: null,
46
		_queryTimer: null,
47
		moduleFlavor: null,
46
48
47
		_queryCache: null,
49
		_queryCache: null,
48
50
 Lines 50-77   define([ Link Here 
50
52
51
		grid: null,
53
		grid: null,
52
54
53
		setPicture: function(item) {
54
			if (this._queryTimer) {
55
				this.grid.moduleStore.get(item.$dn$);
56
			} else {
57
				this._queryCache = this.grid.moduleStore.transaction();
58
				this._queryTimer = window.setTimeout(lang.hitch(this, "_setPictures"), 100);
59
				this.grid.moduleStore.get(item.$dn$);
60
			}
61
		},
62
63
		_setPictures: function() {
64
			this._queryTimer = null;
65
			this._queryCache.commit().then(lang.hitch(this, function(data) {
66
				array.forEach(data, function(item){
67
					if (item.jpegPhoto) {
68
						//put(this._userImageNodes[item.$dn$], "+img.umcGridTileIcon[src=data:image/jpeg;base64," + item.jpegPhoto + "]");
69
						put(this._userImageNodes[item.$dn$], "+div.umcGridTileIcon[style=background-image: url(data:image/jpeg;base64," + item.jpegPhoto + ")]");
70
					}
71
				}, this);
72
			}));
73
		},
74
75
		_getInitials: function(item) {
55
		_getInitials: function(item) {
76
			var initials = "";
56
			var initials = "";
77
			// FIXME: item.firstname[0] is not unicode save!
57
			// FIXME: item.firstname[0] is not unicode save!
 Lines 115-124   define([ Link Here 
115
			}
95
			}
116
			this._userImageNodes[item.$dn$] = put(div, "div.umcGridTileIcon", this._getInitials(item));
96
			this._userImageNodes[item.$dn$] = put(div, "div.umcGridTileIcon", this._getInitials(item));
117
			var nameNode = put(div, 'div.umcGridTileName', item.name);
97
			var nameNode = put(div, 'div.umcGridTileName', item.name);
118
			this.setPicture(item);
98
			var idProperty = this.grid.moduleStore.idProperty;
99
			put(put(div, '+div.umcGridTileIcon'), 'img[src=/univention/management/command/udm/' + encodeURIComponent(this.moduleFlavor) + '/' + encodeURIComponent(idProperty) + '/image');
119
			put(div, this._getDescription(item));
100
			put(div, this._getDescription(item));
120
			var defaultAction = this.grid._getDefaultActionForItem(item);
101
			var defaultAction = this.grid._getDefaultActionForItem(item);
121
			var idProperty = this.grid.moduleStore.idProperty;
122
			on(nameNode, 'click', lang.hitch(this, function() {
102
			on(nameNode, 'click', lang.hitch(this, function() {
123
				defaultAction.callback([item[idProperty]], [item]);
103
				defaultAction.callback([item[idProperty]], [item]);
124
			}));
104
			}));
(-)a/management/univention-management-console-module-udm/umc/python/udm/__init__.py (-1 / +18 lines)
 Lines 48-54    Link Here 
48
from univention.lib.i18n import Translation
48
from univention.lib.i18n import Translation
49
from univention.management.console.config import ucr
49
from univention.management.console.config import ucr
50
from univention.management.console.modules import Base, UMC_OptionTypeError, UMC_OptionMissing, UMC_CommandError, UMC_Error
50
from univention.management.console.modules import Base, UMC_OptionTypeError, UMC_OptionMissing, UMC_CommandError, UMC_Error
51
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response, prevent_xsrf_check
51
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response, prevent_xsrf_check, allow_get_request
52
from univention.management.console.modules.sanitizers import (
52
from univention.management.console.modules.sanitizers import (
53
	Sanitizer, LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer,
53
	Sanitizer, LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer,
54
	ListSanitizer, StringSanitizer, DictSanitizer, BooleanSanitizer
54
	ListSanitizer, StringSanitizer, DictSanitizer, BooleanSanitizer
 Lines 495-500   def _thread(request): Link Here 
495
		thread = notifier.threads.Simple('Get', notifier.Callback(_thread, request), notifier.Callback(self.thread_finished_callback, request))
495
		thread = notifier.threads.Simple('Get', notifier.Callback(_thread, request), notifier.Callback(self.thread_finished_callback, request))
496
		thread.run()
496
		thread.run()
497
497
498
	@allow_get_request
499
	@sanitize(dn=StringSanitizer(required=True))
500
	def image(self, request):
501
		def _thread(request):
502
			ldap_dn = request.options['dn']
503
			if request.flavor == 'users/self':
504
				ldap_dn = self._user_dn
505
			module = get_module(request.flavor, ldap_dn)
506
			if module is None:
507
				raise ObjectDoesNotExist(ldap_dn)
508
			obj = module.get(ldap_dn)
509
			if not obj:
510
				raise UMC_Error()
511
			self.finished(request.id, obj.info.get('jpegPhoto'), mimetype='image/jpeg', headers={'Cache-Control': '', 'Expires': 'Tue, 15 Nov 3020 12:45:26 GMT'})
512
		thread = notifier.threads.Simple('Get', notifier.Callback(_thread, request), notifier.Callback(self.thread_finished_callback, request))
513
		thread.run()
514
498
	@sanitize(
515
	@sanitize(
499
		objectPropertyValue=LDAPSearchSanitizer(
516
		objectPropertyValue=LDAPSearchSanitizer(
500
			add_asterisks=ADD_ASTERISKS,
517
			add_asterisks=ADD_ASTERISKS,
(-)a/management/univention-management-console-module-udm/umc/udm.xml (+1 lines)
 Lines 116-121    Link Here 
116
		<command name="udm/add" function="add" />
116
		<command name="udm/add" function="add" />
117
		<command name="udm/remove" function="remove" />
117
		<command name="udm/remove" function="remove" />
118
		<command name="udm/get" function="get" />
118
		<command name="udm/get" function="get" />
119
		<command name="udm/image" function="image" />
119
		<command name="udm/move" function="move" />
120
		<command name="udm/move" function="move" />
120
		<command name="udm/progress" function="progress" />
121
		<command name="udm/progress" function="progress" />
121
		<command name="udm/validate" function="validate" />
122
		<command name="udm/validate" function="validate" />

Return to bug 42229