-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1174 from SeasideSt/1043-Error-Improper-store-int…
…o-indexable-object Allow to select text encoding in web tool to upload files to a WAFileLibrary
- Loading branch information
Showing
4 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ory/Seaside-Tools-Web.package/WAFileLibraryEditor.class/instance/addFile.withEncoding..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
actions | ||
addFile: aFile withEncoding: aCodec | ||
aFile isNil ifTrue: [ | ||
"in case no file was selected for uploading" | ||
^ self ]. | ||
|
||
(aFile contentType isNil or: [ aFile contentType isBinary ]) | ||
ifFalse: [ | ||
(aCodec class == GRNullCodec) | ||
ifFalse: [ aFile contentType charset: aCodec name ] ]. | ||
|
||
self library addFile: aFile |
18 changes: 15 additions & 3 deletions
18
repository/Seaside-Tools-Web.package/WAFileLibraryEditor.class/instance/renderAddFileOn..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
rendering | ||
renderAddFileOn: html | ||
| theFile theCodec allCodecs | | ||
allCodecs := GRCodec allCodecs. | ||
html form multipart; with: [ | ||
html div: [ | ||
html text: 'Add file: '. | ||
html break. | ||
html fileUpload size: 40; on: #addFile of: self library. | ||
html fileUpload | ||
size: 40; | ||
callback:[ :file | theFile := file ]. | ||
html space. | ||
html submitButton: 'Add' ] ] | ||
html text: 'with encoding: '. | ||
html select | ||
list: (allCodecs sorted: [ :a :b | a name <= b name ]); | ||
labels: [ :codec | codec name ]; | ||
selected: (allCodecs detect: [ :codec | codec name = 'utf-8'] ifNone:[ nil ]); | ||
callback:[:codec | theCodec := codec ]. | ||
html break. | ||
html submitButton | ||
value: 'Add'; | ||
callback: [ self addFile: theFile withEncoding: theCodec ] ] ] |
This file was deleted.
Oops, something went wrong.