diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d546973..99ef610 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,22 +1,20 @@ - - <%= h(yield(:title) || "Untitled") %> - <%= stylesheet_link_tag 'application' %> - <%= yield(:head) %> - - -
- <%- flash.each do |name, msg| -%> - <%= content_tag :div, msg, :id => "flash_#{name}" %> - <%- end -%> - - <%- if show_title? -%> -

<%=h yield(:title) %>

- <%- end -%> - - <%= yield %> -
- + + <%= h(yield(:title) || "Untitled") %> + <%= stylesheet_link_tag 'application' %> +<%= yield(:head) -%> + + +
+ <%- flash.each do |name, msg| -%> + <%= content_tag :div, msg, :id => "flash_#{name}" %> + <%- end -%> + <%- if show_title? -%> +

<%=h yield(:title) %>

+ <%- end -%> +<%= yield %> +
+ diff --git a/app/views/photos/new.html.erb b/app/views/photos/new.html.erb index 3fbdbe8..deb3e62 100644 --- a/app/views/photos/new.html.erb +++ b/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' %> + +<% end -%> +
+ + + + + + + + + + + + + + Get Adobe Flash player + + + + +

 

-

<%= link_to "Back to List", photos_path %>

+

<%= link_to "Back to List", photos_path %>

diff --git a/public/images/buttonbg.png b/public/images/buttonbg.png new file mode 100644 index 0000000..4b413be Binary files /dev/null and b/public/images/buttonbg.png differ diff --git a/public/javascripts/swfobject.js b/public/javascripts/swfobject.js new file mode 100644 index 0000000..8eafe9d --- /dev/null +++ b/public/javascripts/swfobject.js @@ -0,0 +1,4 @@ +/* SWFObject v2.2 + is released under the MIT License +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab + + + + 3629d3f13245 + + + 640 + 430 + 0 + 0 + 16 + + + yes + no + no + choose image + transparent + buttonbg.png + 000000 + transparent + + 323232 + + + 0 + server + yes + + + foo + bar + + diff --git a/tmp/restart.txt b/tmp/restart.txt new file mode 100644 index 0000000..e69de29 diff --git a/tmp/swf_session.rb b/tmp/swf_session.rb new file mode 100644 index 0000000..e06729b --- /dev/null +++ b/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