Pier3 Attaching pictures not working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pier3 Attaching pictures not working

Dusty
This post was updated on .
Hi All

pier3 in two images, when i try upload an image, it says 'uploding...' and does nothing. The image is copied to uploadedFiles/etc/etc/file.ext but I cannot access it.
Any ideas?

Strangely, I just tried to create a screenshot, and found it works on / but not on anything under /.
Attached below is a screenshot. It sits like that forever...

Kind Regards

Reply | Threaded
Open this post in threaded view
|

Re: Pier3 Attaching pictures not working

Dusty
Ok, I've narrowed it down to PRFileUploadWysiwygEditor in Pier-FileUpload-Wysiwyg

storeUploadedFile: file
    | stream destinationFilepath destinationDirectory storedFile filename fileStructure |

	filename := self createValidName: file fileName.
	destinationFilepath := self createUploadedFilepath: filename.
	
	destinationDirectory := (FileDirectory forFileName: destinationFilepath).
    	stream := destinationDirectory forceNewFileNamed: filename.
	[  stream 
		binary; 
		nextPutAll: 
		file rawContents ] 
	ensure: [ stream close ].
	
	storedFile := (NAExternalFile filesize: file size filename: filename filepath: destinationFilepath  mimetype: file contentType).
	fileStructure := self createUploadedStructure: storedFile.
	storedFile url: fileStructure url.
	
	^ storedFile

a
self halt
 above
	[  stream 
		binary; 
		nextPutAll: 
		file rawContents ] 
	ensure: [ stream close ].
will halt, however a
self halt
 below is never reached.
Problem either creating the file (I doubt since the file is there and I can view it) or closing the file (I doubt because the file is there etc) or just moving on...?
Reply | Threaded
Open this post in threaded view
|

Re: Pier3 Attaching pictures not working

Dusty
In reply to this post by Dusty
Ok, I've found the problem and fixed it, messy but necessary for debugging.
In Pier-ModelStructure -> PRChildren -> isVaildChild

isValidChild: aStructure
	^ (PRPath isValidName: aStructure name)
		and: [ aStructure parent isNil
		and: [ (self includes: aStructure name) not
		and: [ (self decorated canBeParentOf: aStructure)
		and: [ (aStructure canBeChildOf: self decorated) ] ] ] ]

I changed to:
isValidChild: aStructure
|aBool|
aBool := true.
		(PRPath isValidName: aStructure name) 
			ifTrue: [Transcript crShow: 'PRPath is valid']
			ifFalse: [aBool := false. Transcript crShow: 'PRPath is invalid'].
		(aStructure parent isNil) 
			ifTrue: [Transcript crShow: 'Parent is nil']
			ifFalse: [aBool := false. Transcript crShow: 'Parent is not nil'].
		(self includes: aStructure name) 
			ifTrue: [aBool := false. Transcript crShow: 'self includes structure']
			ifFalse: [Transcript crShow: 'Does not include itself.'].
		(self decorated canBeParentOf: aStructure) 
			ifTrue: [aBool := false. Transcript crShow: 'can be parent']
			ifFalse: [Transcript crShow: 'can''t be parent'].
		(aStructure canBeChildOf: self decorated) 
			ifTrue: [Transcript crShow: 'can be child.']
			ifFalse: [aBool := false. Transcript crShow: 'can''t be child'].
		^aBool

Hopefully this will help figuring out why the problem occures.
As this code stands, it seems to allow me to add pictures etc.
Reply | Threaded
Open this post in threaded view
|

Re: Pier3 Attaching pictures not working

Dusty
This doesn't fix 'Add Book Figure' or even uploading to 'edit' an image.
IT only fixes adding new images within the wysiwyg editor.

(btw, my code now looks like this)

isValidChild: aStructure
|aBool|
aBool := true.
		(PRPath isValidName: aStructure name) 
			ifFalse: [aBool := false].
		(aStructure parent isNil) 
			ifFalse: [aBool := false].
		(self includes: aStructure name) 
			ifTrue: [aBool := false].
		(self decorated canBeParentOf: aStructure) 
			ifTrue: [aBool := false].
		(aStructure canBeChildOf: self decorated) 
			ifFalse: [aBool := false].
		^aBool