# \[ANN\] Prototype Window Class v0.85

**URL:** <https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132>\
**Category:** Rails\
**Created:** [June 12, 2006, 4:16pm UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132 "2006-06-12T16:16:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [June 12, 2006, 4:16pm UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/1 "2006-06-12T16:16:28Z")

</div>

Hi

I just want to annouce a new release of my Prototype Window Class  
with a new website with full documentation and new samples (I hope  
it’s easier to understand now :)).

[http://prototype-window.xilinus.com/](http://prototype-window.xilinus.com/)

Thanks again to all of you guys for your help.  
Seb  
PS Dj T, have you finished your Rails plugin?

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 13, 2006, 8:49am UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/2 "2006-11-13T08:49:38Z")

</div>

i’ve been using prototype window class…i have a code on how to upload  
an image to database…and i want to close the window after uploading an  
image without clicking the close button…can you

help???

tanx…

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 13, 2006, 5:55pm UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/3 "2006-11-13T17:55:30Z")

</div>

If you use AJAX you can define a callback (something like onFinish) and  
just the window from there.

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 14, 2006, 1:22am UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/4 "2006-11-14T01:22:44Z")

</div>

Kitto wrote:

> If you use AJAX you can define a callback (something like onFinish) and  
> just the window from there.

do you have a sample code.???pls…tanx

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 14, 2006, 11:00am UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/5 "2006-11-14T11:00:03Z")

</div>

Can YOU post some of your code (how you upload the file)?

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 15, 2006, 1:24am UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/6 "2006-11-15T01:24:10Z")

</div>

Kitto wrote:

> Can YOU post some of your code (how you upload the file)?

def upload\_image\_save  
@params[“picture”][‘name’]=@params[“picture”][‘tmp’].original\_filename.gsub(/[^a-zA-Z0-9.]/,  
‘\_’)  
@params[“picture”][‘picture’] = @params[“picture”][‘tmp’].read  
@params[“picture”].delete(‘tmp’) # let’s remove the field from the  
hash, because there’s no such field in the DB anyway.  
@upload = StationImage.new(@params[“picture”])  
if @upload.save  
render :text =\> “sdf”  
end  
end

---

<div class="post-metadata">

**Author:** ![SSSSSbastien\_Gruhie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@SSSSSbastien\_Gruhie](https://www.ruby-forum.com/u/SSSSSbastien_Gruhie)\
**Post date:** [November 15, 2006, 1:33am UTC](https://www.ruby-forum.com/t/ann-prototype-window-class-v0-85/63132/7 "2006-11-15T01:33:31Z")

</div>

Kitto wrote:

> Can YOU post some of your code (how you upload the file)?

#code in my line\_controller.rb  
def upload\_image\_save  
@params[“picture”][‘name’]=@params[“picture”][‘tmp’].original\_filename.gsub(/[^a-zA-Z0-9.]/,  
‘\_’)  
@params[“picture”][‘picture’] = @params[“picture”][‘tmp’].read  
@params[“picture”].delete(‘tmp’)  
@upload = StationImage.new(@params[“picture”]  
if @upload.save  
render :text =\> “sdf” #i want this to automatically close the  
popup window  
which is the prototype window for  
uploading…  
end  
end

#code for line.rhtml

 \<%=link\_to\_prototype\_window(image\_tag('upload.gif'),'demo1', { :title =\> 'Demonstration Page', :minimizable =\> false, :maximizable =\> false, :resizable =\> false, :width =\> '320px', :height =\> '200px', :url =\> url\_for( :action =\> "dialog\_upload\_image") } ) %\>

#code for dialog\_upload\_image.rhtml

Upload tool images here:
 \<%= start\_form\_tag({ :action =\> 'upload\_image\_save' }, :multipart =\> true) %\> Picture:  
 \<%= file\_field "picture", "tmp" %\>  
  
 \<%= end\_form\_tag %\>

#application\_helper for prototype window

def link\_to\_prototype\_window( name, window\_id, options = {  
:windowParameters =\>  
{ :effectOptions =\> { :duration =\> 0 } } } , html\_options =  
{} )  
js\_code =“var win = new Window( ‘#{window\_id}’,  
#{params\_for\_javascript(options) } );  
win.showCenter();”;  
if (options[:content])  
js\_code += “win.getContent().innerHTML = ‘#{options[:content]}’;”;  
end  
js\_code += “win.setDestroyOnClose();”  
content\_tag( “a”, name, html\_options.merge({  
:href =\> html\_options[:href] || “#”,  
:onclick =\> (html\_options[:onclick] ?  
"#{html\_options[:onclick]}; " : “”) + js\_code }))  
end

pls…help.??tanx…
