Univention Bugzilla – Attachment 6825 Details for
Bug 32888
Allow distribution of whole (sub-)directories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for univention-management-console-frontend and webserver
univention-management-console-frontend_und_webserver.patch (text/plain), 16.91 KB, created by
Drees Dormann
on 2015-04-15 15:07:57 CEST
(
hide
)
Description:
Patch for univention-management-console-frontend and webserver
Filename:
MIME Type:
Creator:
Drees Dormann
Created:
2015-04-15 15:07:57 CEST
Size:
16.91 KB
patch
obsolete
>Index: univention-management-console-web-server >=================================================================== >--- univention-management-console-web-server (Revision 59808) >+++ univention-management-console-web-server (Arbeitskopie) >@@ -633,33 +633,45 @@ > > options = [] > body = {} >- for iid, ifield in args.iteritems(): >- if isinstance(ifield, cherrypy._cpreqbody.Part): >- # field is a FieldStorage object >- store = ifield >- tmpfile = _upload_manager.add(req.id, store) > >- # check if filesize is allowed >- st = os.stat(tmpfile) >- max_size = int(configRegistry.get('umc/server/upload/max', 64)) * 1024 >- if st.st_size > max_size: >- self._log('warn', 'file of size %d could not be uploaded' % (st.st_size)) >- raise cherrypy.HTTPError(httplib.BAD_REQUEST, 'The size of the uploaded file is too large') >+ def _check_field_storage(iid, ifield): >+ # field is a FieldStorage object >+ store = ifield >+ tmpfile = _upload_manager.add(req.id, store) > >- # check if enough free space is available >- min_size = int(configRegistry.get('umc/server/upload/min_free_space', 51200)) # kilobyte >- s = os.statvfs(tmpfile) >- free_disk_space = s.f_bavail * s.f_frsize / 1024 # kilobyte >- if free_disk_space < min_size: >- self._log('error', 'there is not enough free space to upload files') >- raise cherrypy.HTTPError(httplib.BAD_REQUEST, 'There is not enough free space on disk') >+ # check if filesize is allowed >+ st = os.stat(tmpfile) >+ max_size = int(configRegistry.get('umc/server/upload/max', 64)) * 1024 >+ if st.st_size > max_size: >+ self._log('warn', 'file of size %d could not be uploaded' % (st.st_size)) >+ raise cherrypy.HTTPError(httplib.BAD_REQUEST, 'The size of the uploaded file is too large') > >- filename = store.filename >- # some security >- for c in ('<>/'): >- filename = filename.replace(c, '_') >+ # check if enough free space is available >+ min_size = int(configRegistry.get('umc/server/upload/min_free_space', 51200)) # kilobyte >+ s = os.statvfs(tmpfile) >+ free_disk_space = s.f_bavail * s.f_frsize / 1024 # kilobyte >+ if free_disk_space < min_size: >+ self._log('error', 'there is not enough free space to upload files') >+ raise cherrypy.HTTPError(httplib.BAD_REQUEST, 'There is not enough free space on disk') > >- options.append({'filename': filename, 'name': store.name, 'tmpfile': tmpfile}) >+ filename = store.filename >+ # some security >+ for c in ('<>/'): >+ filename = filename.replace(c, '_') >+ >+ options.append({'filename': filename, 'name': store.name, 'tmpfile': tmpfile}) >+ >+ >+ for iid, ifield in args.iteritems(): >+ if isinstance(ifield, cherrypy._cpreqbody.Part): >+ _check_field_storage(iid, ifield) >+ elif isinstance(ifield, list): >+ for jfield in ifield: >+ if isinstance(jfield, cherrypy._cpreqbody.Part): >+ _check_field_storage(iid, jfield) >+ else: >+ # we cannot handle any other type >+ CORE.warn('Unknown type of multipart/form entry: %s=%s' % (iid, ifield)) > elif isinstance(ifield, basestring): > # field is a string :) > body[iid] = ifield >Index: umc/de.po >=================================================================== >--- umc/de.po (Revision 59808) >+++ umc/de.po (Arbeitskopie) >@@ -7,7 +7,7 @@ > msgstr "" > "Project-Id-Version: univention-management-console-frontend\n" > "Report-Msgid-Bugs-To: packages@univention.de\n" >-"POT-Creation-Date: 2015-03-31 17:55+0200\n" >+"POT-Creation-Date: 2015-04-15 14:34+0200\n" > "PO-Revision-Date: 2013-09-12 11:31+0200\n" > "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" > "Language-Team: LANGUAGE <LL@li.org>\n" >@@ -17,7 +17,6 @@ > "Content-Transfer-Encoding: 8bit\n" > > #: umc/tools.js:1577 >-#, python-brace-format > msgid "\"${moduleName}\" module" > msgstr "Modul \"${moduleName}\"" > >@@ -26,7 +25,7 @@ > msgid "%(label)s (retype)" > msgstr "%(label)s (Wiederholung)" > >-#: umc/widgets/Grid.js:786 >+#: umc/widgets/Grid.js:812 > #, python-format > msgid "%d entries of %d selected" > msgstr "%d Einträge von %d ausgewählt" >@@ -45,7 +44,7 @@ > msgid "%s: %s" > msgstr "%s: %s" > >-#: umc/widgets/Grid.js:791 >+#: umc/widgets/Grid.js:817 > #, python-format > msgid "1 entry of %d selected" > msgstr "1 Eintrag von %d ausgewählt" >@@ -143,8 +142,8 @@ > "installation on this system.</p>" > msgstr "" > "<p>Die Lizenz wurde erfolgreich aktualisiert.</p><p>Sie können nun mit dem " >-"Einsatz von UMC fortfahren, alle Anwendungen des Univention App Centers stehen " >-"dem System nun zur Installation zur Verfügung.</p>" >+"Einsatz von UMC fortfahren, alle Anwendungen des Univention App Centers " >+"stehen dem System nun zur Installation zur Verfügung.</p>" > > #: umc/app/FinishedPage.js:44 > msgid "" >@@ -164,8 +163,7 @@ > msgstr "" > "<p>Sie können nun eine gültige E-Mail-Adresse angeben, um das UCS-System für " > "die Verwendung des App Centers freizuschalten. Im nächsten Schritt können " >-"Sie die Lizenzdatei hochladen, die an Ihre E-Mail-Adresse gesendet wird.</" >-"p>" >+"Sie die Lizenzdatei hochladen, die an Ihre E-Mail-Adresse gesendet wird.</p>" > > #: umc/app/HelpPage.js:48 > msgid "" >@@ -195,12 +193,12 @@ > msgid "About UMC" > msgstr "Ãber UMC" > >+#: umc/widgets/UnixAccessRights.js:96 > #: umc/widgets/UnixAccessRightsExtended.js:96 >-#: umc/widgets/UnixAccessRights.js:96 > msgid "Access" > msgstr "Zugriff" > >-#: umc/app/ActivationPage.js:40 umc/app/ActivationDialog.js:55 >+#: umc/app/ActivationDialog.js:55 umc/app/ActivationPage.js:40 > msgid "Activation of Univention Corporate Server" > msgstr "Aktivierung von Univention Corporate Server" > >@@ -264,12 +262,12 @@ > msgid "Back to overview" > msgstr "Zurück zur Ãbersicht" > >-#: umc/tools.js:231 umc/app.js:1710 umc/widgets/MultiObjectSelect.js:137 >-#: umc/widgets/Wizard.js:163 umc/dialog.js:352 >+#: umc/tools.js:231 umc/app.js:1710 umc/dialog.js:352 >+#: umc/widgets/MultiObjectSelect.js:137 umc/widgets/Wizard.js:163 > msgid "Cancel" > msgstr "Abbrechen" > >-#: umc/widgets/Uploader.js:110 >+#: umc/widgets/Uploader.js:113 > msgid "Clear data" > msgstr "Daten leeren" > >@@ -338,13 +336,6 @@ > msgid "Fetching information from the server failed!" > msgstr "Das Holen von Informationen vom Server schlug fehl!" > >-#: umc/widgets/Uploader.js:158 >-#, python-format >-msgid "File cannot be uploaded, its maximum size may be %.1f MB." >-msgstr "" >-"Die Datei kann nicht hochgeladen werden, ihre MaximalgröÃe darf %.1f MB " >-"nicht überschreiten." >- > #: umc/widgets/Wizard.js:159 > msgid "Finish" > msgstr "Fertigstellen" >@@ -353,8 +344,8 @@ > msgid "Further Information" > msgstr "Weiterführende Informationen" > >+#: umc/widgets/UnixAccessRights.js:76 > #: umc/widgets/UnixAccessRightsExtended.js:76 >-#: umc/widgets/UnixAccessRights.js:76 > msgid "Group" > msgstr "Gruppe" > >@@ -485,7 +476,7 @@ > msgid "Next" > msgstr "Weiter" > >-#: umc/widgets/Grid.js:788 >+#: umc/widgets/Grid.js:814 > msgid "No entries could be found" > msgstr "Es konnten keine Einträge gefunden werden" > >@@ -493,11 +484,11 @@ > msgid "No message" > msgstr "Keine Nachricht" > >-#: umc/widgets/Grid.js:765 >+#: umc/widgets/Grid.js:791 > msgid "No object selected" > msgstr "Kein Objekt ausgewählt" > >-#: umc/widgets/MultiUploader.js:203 >+#: umc/widgets/MultiUploader.js:206 > msgid "No upload in progress" > msgstr "Keine laufende Dateiübertragung" > >@@ -505,9 +496,9 @@ > msgid "No valid e-mail address." > msgstr "Keine gültige E-Mail-Adresse." > >+#: umc/dialog.js:164 umc/dialog.js:193 umc/dialog.js:217 > #: umc/dialog/NotificationContainer.js:54 >-#: umc/dialog/NotificationContainer.js:204 umc/dialog.js:164 umc/dialog.js:193 >-#: umc/dialog.js:217 >+#: umc/dialog/NotificationContainer.js:204 > msgid "Notification" > msgstr "Benachrichtigung" > >@@ -519,13 +510,13 @@ > msgid "Open module" > msgstr "Modul öffnen" > >+#: umc/widgets/UnixAccessRights.js:77 > #: umc/widgets/UnixAccessRightsExtended.js:77 >-#: umc/widgets/UnixAccessRights.js:77 > msgid "Others" > msgstr "Andere" > >+#: umc/widgets/UnixAccessRights.js:75 > #: umc/widgets/UnixAccessRightsExtended.js:75 >-#: umc/widgets/UnixAccessRights.js:75 > msgid "Owner" > msgstr "Besitzer" > >@@ -539,8 +530,8 @@ > "Bitte nehmen Sie sich einen Augenblick Zeit, um die folgenden Informationen " > "bereitzustellen:" > >+#: umc/widgets/UnixAccessRights.js:88 > #: umc/widgets/UnixAccessRightsExtended.js:88 >-#: umc/widgets/UnixAccessRights.js:88 > msgid "Read" > msgstr "Lesen" > >@@ -548,7 +539,7 @@ > msgid "Reload" > msgstr "Neu laden" > >-#: umc/widgets/MultiUploader.js:123 umc/widgets/MultiObjectSelect.js:287 >+#: umc/widgets/MultiObjectSelect.js:287 umc/widgets/MultiUploader.js:126 > msgid "Remove" > msgstr "Entfernen" > >@@ -625,7 +616,6 @@ > "probiert." > > #: umc/tools.js:313 >-#, python-brace-format > msgid "" > "So far, the connection to the server could not be established after {time} " > "seconds. This can be a normal behavior. In any case, the process will " >@@ -670,6 +660,15 @@ > "Die Aktivierung des UCS-Systems schlug fehl. Bitte wiederholen Sie den " > "Aktivierungsvorgang über das Benutzermenü oben rechts." > >+#: umc/widgets/Uploader.js:169 >+#, python-format >+msgid "" >+"The following Files cannot be uploaded because they exceed the maximum file " >+"size: %s The maximum size of a file is %.1f MB." >+msgstr "" >+"Die folgenden Dateien können nicht hochgeladen werden, da sie die maximale " >+"DateigröÃe überschreiten: %s Die maximale GröÃe einer Datei ist %.1f MB." >+ > #: umc/app/StartupDialog.js:132 umc/app/ActivationDialog.js:147 > msgid "" > "The import of the license failed. Check the integrity of the original file " >@@ -686,7 +685,7 @@ > msgid "The password has expired and must be changed." > msgstr "Das Passwort ist abgelaufen und muss geändert werden." > >-#: umc/dialog/LoginDialog.js:226 umc/widgets/PasswordInputBox.js:122 >+#: umc/widgets/PasswordInputBox.js:122 umc/dialog/LoginDialog.js:226 > msgid "The passwords do not match, please retype again." > msgstr "Die Passwörter stimmen nicht überein. Bitte versuchen Sie es erneut." > >@@ -747,8 +746,8 @@ > msgid "Updating session data..." > msgstr "Aktualisieren der Sitzungsdaten..." > >-#: umc/widgets/InfoUploader.js:43 umc/widgets/MultiUploader.js:104 >-#: umc/widgets/Uploader.js:109 >+#: umc/widgets/Uploader.js:112 umc/widgets/InfoUploader.js:43 >+#: umc/widgets/MultiUploader.js:107 > msgid "Upload" > msgstr "Hochladen" > >@@ -760,16 +759,16 @@ > msgid "Upload new image" > msgstr "Neues Bild hochladen" > >-#: umc/widgets/Uploader.js:260 >+#: umc/widgets/Uploader.js:277 > msgid "Uploading..." > msgstr "Datenübertragung..." > >-#: umc/widgets/MultiUploader.js:223 >+#: umc/widgets/MultiUploader.js:226 > #, python-format > msgid "Uploading... %d of %d files remaining." > msgstr "Dateiübertragung... %d von %d Dateien verbleiben" > >-#: umc/widgets/MultiUploader.js:220 >+#: umc/widgets/MultiUploader.js:223 > msgid "Uploads finished" > msgstr "Dateiübertragung beendet" > >@@ -813,8 +812,8 @@ > msgid "Welcome to Univention Management Console" > msgstr "Willkommen bei Univention Management Console" > >+#: umc/widgets/UnixAccessRights.js:92 > #: umc/widgets/UnixAccessRightsExtended.js:92 >-#: umc/widgets/UnixAccessRights.js:92 > msgid "Write" > msgstr "Schreiben" > >@@ -862,7 +861,7 @@ > msgid "expected result" > msgstr "erwartetes Ergebnis" > >-#: umc/widgets/Grid.js:565 >+#: umc/widgets/Grid.js:591 > msgid "more" > msgstr "mehr" > >@@ -870,7 +869,7 @@ > msgid "steps to reproduce the failure" > msgstr "Schritte, um den Fehler zu reproduzieren" > >-#: umc/app/WelcomePage.js:78 umc/app.js:901 >+#: umc/app.js:901 umc/app/WelcomePage.js:78 > msgid "umcFeedbackUrl" > msgstr "https://www.univention.de/produkt-feedback/" > >@@ -879,7 +878,6 @@ > msgstr "http://www.univention.de" > > #: umc/widgets/ProgressBar.js:176 >-#, python-brace-format > msgid "{number} errors occurred: " > msgstr "{number} Fehler sind aufgetreten: " > >@@ -905,6 +903,11 @@ > #~ msgid "Favorites" > #~ msgstr "Favoriten" > >+#~ msgid "File cannot be uploaded, its maximum size may be %.1f MB." >+#~ msgstr "" >+#~ "Die Datei kann nicht hochgeladen werden, ihre MaximalgröÃe darf %.1f MB " >+#~ "nicht überschreiten." >+ > #~ msgid "Loaded module %s" > #~ msgstr "Modul %s wurde geladen" > >Index: umc/widgets/Uploader.js >=================================================================== >--- umc/widgets/Uploader.js (Revision 59808) >+++ umc/widgets/Uploader.js (Arbeitskopie) >@@ -87,6 +87,9 @@ > // A size limit for the uploaded file. > maxSize: 524288, > >+ //toggle mutliple files selectable >+ multiFile: false, >+ > // make sure that no sizeClass is being set > sizeClass: null, > >@@ -124,6 +127,8 @@ > this._uploader = new dojox.form.Uploader({ > url: '/umcp/upload' + (this.command ? '/' + this.command : ''), > label: this.buttonLabel, >+ multiple: this.multiFile, >+ uploadOnSelect: false, > getForm: function() { > // make sure that the Uploader does not find any of our encapsulating forms > return null; >@@ -150,39 +155,50 @@ > this.inherited(arguments); > > // as soon as the user has selected a file, start the upload >- this._uploader.on('change', lang.hitch(this, function(data) { >- var allOk = array.every(data, function(ifile) { >- return ifile.size <= this.maxSize; >+ >+ this._uploader.on('change', lang.hitch(this, function(_data) { >+ var _fileTooBig = []; >+ var allOk = true; >+ array.forEach(_data, function(ifile) { >+ if (! (ifile.size <= this.maxSize)){ >+ _fileTooBig.push(ifile.name); >+ allOk = false; >+ } > }, this); > if (!allOk) { >- dialog.alert(_('File cannot be uploaded, its maximum size may be %.1f MB.', this.maxSize / 1048576.0)); >+ dialog.alert(_('The following Files cannot be uploaded because they exceed the maximum file size: %s The maximum size of a file is %.1f MB.',('<ul><li>' + _fileTooBig.join('</li><li>') + '</li></ul>' ), this.maxSize / 1048576.0)); > this._uploader.reset(); >- } >- else { >- when(this.canUpload(data[0]), lang.hitch(this, function(doUpload) { >+ }else { >+ var data = _data; >+ if (data.length == 1){ >+ data = data[0]; >+ this.data = data; >+ } >+ when(this.canUpload(data), lang.hitch(this, function(doUpload) { > if (!doUpload) { >- // upload canceled >+ // upload canceled > this._uploader.reset(); > return; >- } >- >- // perform the upload >- var params = {}; >- if (this.dynamicOptions) { >- if (typeof this.dynamicOptions == "function") { >- lang.mixin(params, this.dynamicOptions(params)); >+ }else{ >+ // perform the upload >+ var params = {}; >+ if (this.dynamicOptions) { >+ if (typeof this.dynamicOptions == "function") { >+ lang.mixin(params, this.dynamicOptions(params)); >+ } >+ else if (typeof this.dynamicOptions == "object") { >+ lang.mixin(params, this.dynamicOptions); >+ } > } >- else if (typeof this.dynamicOptions == "object") { >- lang.mixin(params, this.dynamicOptions); >- } >+ // mixin the iframe information >+ lang.mixin(params, { >+ iframe: (this._uploader.uploadType === 'iframe') ? true : false >+ }); >+ >+ this._uploader.upload(params); >+ this._updateLabel(); >+ this.onUploadStarted(data); > } >- // mixin the iframe information >- lang.mixin(params, { >- iframe: (this._uploader.uploadType === 'iframe') ? true : false >- }); >- this._uploader.upload(params); >- this._updateLabel(); >- this.onUploadStarted(data[0]); > })); > } > })); >@@ -193,6 +209,7 @@ > // notification as soon as the file has been uploaded > this._uploader.on('complete', lang.hitch(this, function(data) { > if (data && data.result instanceof Array) { >+ console.debug('Upload Finished, Data:', data); > this.set('data', data.result[0]); > this.onUploaded(this.data); > } >Index: umc/widgets/MultiUploader.js >=================================================================== >--- umc/widgets/MultiUploader.js (Revision 59808) >+++ umc/widgets/MultiUploader.js (Arbeitskopie) >@@ -88,6 +88,9 @@ > // internal reference to the current Uploader widget > _uploader: null, > >+ // allow selecting of Multiple Files >+ multiFile: false, >+ > // internal reference to the progress bar > _progressBar: null, > >@@ -232,6 +235,7 @@ > command: this.command, > dynamicOptions: this.dynamicOptions, > maxSize: this.maxSize, >+ multiFile: this.multiFile, > canUpload: this.canUpload, > style: 'float: left;' > }); >@@ -286,12 +290,19 @@ > // add files to internal list of files > this._files.standby(false); > var vals = this.get('value'); >- array.forEach(this._uploadingFiles, function(ifile) { >- //console.log('### adding:', ifile.name); >+ >+ if (this.multiFile && ( this._uploadingFiles[0] instanceof Array ) ){ >+ array.forEach(this._uploadingFiles[0], function(ifile){ >+ if (file.success) { >+ vals.unshift(ifile.name); >+ } >+ }); >+ }else{ > if (file.success) { >- vals.unshift(ifile.name); >+ vals.unshift(this._uploadingFiles[0].name); > } >- }); >+ } >+ > this.set('value', vals); > > // clear the list of uploading files >@@ -310,6 +321,7 @@ > })); > }, > >+ > canUpload: function(fileInfo) { > // summary: > // Before uploading a file, this function is called to make sure
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 32888
:
6800
|
6801
|
6823
|
6824
| 6825