• Anonymous
  • Login
  • Register
BlogSphere - Response: Solution Proposed for the upload problem

Created on Aug 17, 2005
Created by Alexandre Leduc

Here are the modifications I proposed to fix this problem.
The idea is to save the image imported from the File Upload Control, create a URL for the image and send it back to the calling window. To do this :

* Add a SaveOptions field to the "FCKeditorConnector form". Set it to "0". This is to make sure that the form is not saved unless we want it to
* In the WebQuerySave event, add the following: @Command([ToolsRunMacro]; "(WQS.NewImage)")
* Create a new agent, "(WQS.NewImage)", run from Agent List, Target None
* In the Initalize event of the agent, add the following code :

Sub Initialize

Dim s As NotesSession
Dim doc As NotesDocument

Set s = New NotesSession
Set doc = s.DocumentContext

'check if the user has added a file attachment to the document
Dim FileName As Variant
FileName = Evaluate(|@Subset(@AttachmentNames; 1)|, doc)

If fileName(0) = "" Then
'the user has not selected a file, simply close the window set the focus on the "calling window"
'the document will not be saved
Print "<SCRIPT LANGUAGE=JavaScript>"
Print |window.top.opener.SetUrl('' ) ;|
Print "window.top.close();"
Print "window.top.opener.focus() ;"
Print "</SCRIPT>"
Else
'a file was added - it's ok to save the document
doc.saveOptions = "1"
'for display in the "(images)" view, we move the file name in the "ImageName" field
doc.ImageName = FileName(0)
'we could add code here to transfer the attachment to the ImageFile field
'but if the user has uploaded a big image, this could take a while and freeze the browser - this task could be run on a nightly basis instead
doc.form = "Image"
Print "<SCRIPT LANGUAGE=JavaScript>"
'build the url for the new image
Print | window.top.opener.SetUrl('/'+ location.pathname.slice( 1, location.pathname.toLowerCase().lastIndexOf('.nsf')+4) + '/' + '(Images)/| + doc.UniversalID + |/$File/| + doc.ImageName(0) +|' ) ;|
'we close the window and set the focus on the "calling window"
Print "window.top.close();"
Print "window.top.opener.focus() ;"
Print "</SCRIPT>"
End If

End Sub

Any suggestions or comments are welcomed!

Alexandre Leduc
www.alexetsandra.net/blog/alex








Documents
     
Creation Date
Author
Subject
Aug 10, 2005 Chad Schelfhout "Form Processed" when adding Image using web
Aug 15, 2005 Markus Koller     Response: FCKEditor
Aug 17, 2005 Alexandre Leduc     Response: Solution Proposed for the upload problem
Aug 19, 2005 Markus Koller         Response: ImageManager.css
Aug 23, 2005 Alexandre Leduc             Response: Missing Style Sheet
Sep 16, 2005 Christian Brandlehner         Response: Re: Solution Proposed for the upload problem
     
In this field you can enter the actual content.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.