Univention Bugzilla – Attachment 9931 Details for
Bug 44009
Get jpegPhoto in a way that it is possible to cache it (in grid tile view)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
draft patch
44009.patch (text/plain), 3.98 KB, created by
Florian Best
on 2019-03-15 16:19:36 CET
(
hide
)
Description:
draft patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2019-03-15 16:19:36 CET
Size:
3.98 KB
patch
obsolete
>diff --git a/management/univention-management-console-module-udm/umc/js/udm/TileView.js b/management/univention-management-console-module-udm/umc/js/udm/TileView.js >index 1cb55b8970..909e3d2227 100644 >--- a/management/univention-management-console-module-udm/umc/js/udm/TileView.js >+++ b/management/univention-management-console-module-udm/umc/js/udm/TileView.js >@@ -26,7 +26,7 @@ > * /usr/share/common-licenses/AGPL-3; if not, see > * <http://www.gnu.org/licenses/>. > */ >-/*global define, window*/ >+/*global define*/ > > define([ > "dojo/_base/declare", >@@ -42,34 +42,13 @@ define([ > > necessaryUdmValues: ["displayName", "mailPrimaryAddress", "firstname", "lastname"], > >- _queryTimer: null, >- >- _queryCache: null, >- > _userImageNodes: {}, > > grid: null, > > setPicture: function(item) { >- if (this._queryTimer) { >- this.grid.moduleStore.get(item.$dn$); >- } else { >- this._queryCache = this.grid.moduleStore.transaction(); >- this._queryTimer = window.setTimeout(lang.hitch(this, "_setPictures"), 100); >- this.grid.moduleStore.get(item.$dn$); >- } >- }, >- >- _setPictures: function() { >- this._queryTimer = null; >- this._queryCache.commit().then(lang.hitch(this, function(data) { >- array.forEach(data, function(item){ >- if (item.jpegPhoto) { >- //put(this._userImageNodes[item.$dn$], "+img.umcGridTileIcon[src=data:image/jpeg;base64," + item.jpegPhoto + "]"); >- put(this._userImageNodes[item.$dn$], "+div.umcGridTileIcon[style=background-image: url(data:image/jpeg;base64," + item.jpegPhoto + ")]"); >- } >- }, this); >- })); >+ var url = lang.replace('/univention/command/udm/properties/users/user/jpegPhoto.jpg?dn={0}', [encodeURIComponent(item.$dn$)]); >+ put(this._userImageNodes[item.$dn$], {style: lang.replace('background-image: url("{0}")', [url])}); > }, > > _getInitials: function(item) { >diff --git a/management/univention-management-console-module-udm/umc/python/udm/__init__.py b/management/univention-management-console-module-udm/umc/python/udm/__init__.py >index 87bd11ab55..647c933128 100644 >--- a/management/univention-management-console-module-udm/umc/python/udm/__init__.py >+++ b/management/univention-management-console-module-udm/umc/python/udm/__init__.py >@@ -544,6 +544,31 @@ class Instance(Base, ProgressMixin): > MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn) > return result > >+ @allow_get_request >+ @sanitize(dn=DNSanitizer(required=True)) >+ def jpeg_photo(self, request): >+ thread = notifier.threads.Simple('GetJpeg', notifier.Callback(self._get_jpeg_photo, request), notifier.Callback(self.thread_finished_callback, request)) >+ thread.run() >+ >+ def _get_jpeg_photo(self, request): >+ dn = request.options['dn'] >+ module = get_module('users/user', dn) >+ if module is None: >+ self.finished(request.id, '', mimetype='image/jpeg') >+ return >+ obj = module.get(dn) >+ if obj is None: >+ self.finished(request.id, '', mimetype='image/jpeg') >+ return >+ data = obj.info.get('jpegPhoto', '').decode('base64') # TODO: scale down to 50x50px >+ headers = { >+ # 'Last-Modified': obj.info['modifyTimestamp'] # TODO: enable for users/user >+ # 'ETag': '' : TODO generate >+ 'Cache-Control': 'max-age=2592000', >+ #'Expires': '', >+ } >+ self.finished(request.id, data, mimetype='image/jpeg', headers=headers) >+ > @sanitize( > objectPropertyValue=PropertySearchSanitizer( > add_asterisks=ADD_ASTERISKS, >diff --git a/management/univention-management-console-module-udm/umc/udm.xml b/management/univention-management-console-module-udm/umc/udm.xml >index 4556fbc299..7a2bb45d5e 100644 >--- a/management/univention-management-console-module-udm/umc/udm.xml >+++ b/management/univention-management-console-module-udm/umc/udm.xml >@@ -317,5 +317,6 @@ > <command name="udm/reports/get" function="reports_get" /> > <command name="udm/request_new_license" function="request_new_license" /> > <command name="udm/meta_info" function="meta_info" /> >+ <command name="udm/properties/users/user/jpegPhoto.jpg" function="jpeg_photo" /> > </module> > </umc>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 44009
: 9931