Browse Source

Updated views, addded flash uploader and clippy

master
jimi 15 years ago
committed by jimi
parent
commit
e6cfffe397
  1. 34
      app/views/layouts/application.html.erb
  2. 37
      app/views/photos/new.html.erb
  3. BIN
      public/images/buttonbg.png
  4. 4
      public/javascripts/swfobject.js
  5. BIN
      public/swfs/clippy.swf
  6. BIN
      public/swfs/uploader-free.swf
  7. BIN
      public/swfs/uploader.swf
  8. 35
      public/uploader.xml
  9. 0
      tmp/restart.txt
  10. 41
      tmp/swf_session.rb

34
app/views/layouts/application.html.erb

@ -1,22 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><%= h(yield(:title) || "Untitled") %></title>
<%= stylesheet_link_tag 'application' %>
<%= yield(:head) %>
</head>
<body>
<div id="container">
<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<%- end -%>
<%- if show_title? -%>
<h1><%=h yield(:title) %></h1>
<%- end -%>
<%= yield %>
</div>
</body>
<head>
<title><%= h(yield(:title) || "Untitled") %></title>
<%= stylesheet_link_tag 'application' %>
<%= yield(:head) -%>
</head>
<body>
<div id="container">
<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<%- end -%>
<%- if show_title? -%>
<h1><%=h yield(:title) %></h1>
<%- end -%>
<%= yield %>
</div>
</body>
</html>

37
app/views/photos/new.html.erb

@ -1,5 +1,36 @@
<% title "New Photo" %>
<%- title "Upload New Photo" -%>
<%- content_for :head do -%>
<%= javascript_include_tag 'swfobject' %>
<script type="text/javascript">
<!--
swfobject.registerObject("uploader", "10.0.0", false);
<%= render :partial => 'form' %>
function uploaderBusy() {
document.getElementById('status').innerHTML = 'Working...';
}
-->
</script>
<% end -%>
<div id="image" style="width:640px; height:427px; border:1px solid gray; background-color: #f6f6ff"></div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="120" height="40" id="uploader">
<param name="movie" value="/swfs/uploader-free.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="flashvars" value="configFile=/uploader.xml" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="/swfs/uploader-free.swf" width="120" height="40">
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="flashvars" value="configFile=/uploader.xml" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer"><img alt="Get Adobe Flash player"
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" /></a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<p id="status">&nbsp;</p>
<p><%= link_to "Back to List", photos_path %></p>
<p><%= link_to "Back to List", photos_path %></p>

BIN
public/images/buttonbg.png

After

Width: 100  |  Height: 24  |  Size: 621 B

4
public/javascripts/swfobject.js
File diff suppressed because it is too large
View File

BIN
public/swfs/clippy.swf

BIN
public/swfs/uploader-free.swf

BIN
public/swfs/uploader.swf

35
public/uploader.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Verification Codes -->
<verification>3629d3f13245</verification>
<!-- Image Settings -->
<maxwidth>640</maxwidth>
<maxheight>430</maxheight>
<minwidth>0</minwidth>
<minheight>0</minheight>
<compression>16</compression>
<!-- UI Settings -->
<dimensioncheck>yes</dimensioncheck> <!-- other: no -->
<thumbnail>no</thumbnail>
<filename>no</filename>
<choosetext>choose image</choosetext>
<bgcolor>transparent</bgcolor>
<bgimage>buttonbg.png</bgimage>
<filetextcolor>000000</filetextcolor>
<buttonbgcolor>transparent</buttonbgcolor>
<buttonbgimage></buttonbgimage>
<buttontextcolor>323232</buttontextcolor>
<!-- Upload settings -->
<maximages>0</maximages> <!-- 0 = infinite -->
<uploadmethod>server</uploadmethod> <!-- other: server, both -->
<reportstatus>yes</reportstatus> <!-- reports: busy, ready, maxreached -->
<scripturl></scripturl>
<redirect></redirect>
<idvariable>foo</idvariable>
<idvalue>bar</idvalue>
</configuration>

0
tmp/restart.txt

41
tmp/swf_session.rb

@ -0,0 +1,41 @@
# hacks for swfupload + cookie store to work
# see http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload
#
# also need to put
# session :cookie_only => false, :only => :create
# into the controller where the files are being uploaded (change method as appropriate)
#
# this goes in environment.rb
class CGI::Session
alias original_initialize initialize
def initialize(request, option = {})
session_key = option['session_key'] || '_session_id'
query_string = if (qs = request.env_table["QUERY_STRING"]) and qs != ""
qs
elsif (ru = request.env_table["REQUEST_URI"][0..-1]).include?("?")
ru[(ru.index("?") + 1)..-1]
end
if query_string and query_string.include?(session_key)
option['session_data'] = CGI.unescape(query_string.scan(/#{session_key}=(.*?)(&.*?)*$/).flatten.first)
end
original_initialize(request, option)
end
end
class CGI::Session::CookieStore
alias original_initialize initialize
def initialize(session, options = {})
@session_data = options['session_data']
original_initialize(session, options)
end
def read_cookie
cookie = @session_data || @session.cgi.cookies[@cookie_options['name']].first
return cookie if cookie
return unless @session.cgi.request_method == "POST" # && @session.cgi.user_agent =~ /Flash Player/ This condition is commented, because of Flash user-agent differs a lot
session_id = ActionController::CgiRequest.new(@session.cgi, ActionController::Base.session_options).request_parameters[@cookie_options['name']]
return unless session_id
@session.instance_variable_set('@session_id', session_id)
end
end