[ANN] Prototype Window Class v0.85


#1

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/

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


#2

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…


#3

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


#4

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


#5

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


#6

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


#7

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…