aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rwxr-xr-xapp/assets/javascripts/jquery.fancybox-1.3.4.pack.js46
-rwxr-xr-xapp/assets/stylesheets/jquery.fancybox-1.3.4.css359
-rw-r--r--app/controllers/admin_spam_addresses_controller.rb27
-rw-r--r--app/controllers/track_controller.rb19
-rwxr-xr-xapp/helpers/link_to_helper.rb12
-rw-r--r--app/helpers/track_helper.rb122
-rw-r--r--app/mailers/request_mailer.rb2
-rw-r--r--app/models/spam_address.rb11
-rw-r--r--app/models/track_thing.rb137
-rw-r--r--app/views/admin_request/_incoming_message_actions.html.erb7
-rw-r--r--app/views/admin_spam_addresses/index.html.erb51
-rw-r--r--app/views/general/_stylesheet_includes.html.erb2
-rw-r--r--app/views/layouts/admin.html.erb2
-rw-r--r--app/views/layouts/default.html.erb4
-rw-r--r--app/views/layouts/no_chrome.html.erb2
-rw-r--r--app/views/track/_track_set.erb6
-rw-r--r--app/views/user/show.html.erb2
17 files changed, 300 insertions, 511 deletions
diff --git a/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js b/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js
deleted file mode 100755
index 1373ed083..000000000
--- a/app/assets/javascripts/jquery.fancybox-1.3.4.pack.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * FancyBox - jQuery Plugin
- * Simple and fancy lightbox alternative
- *
- * Examples and documentation at: http://fancybox.net
- *
- * Copyright (c) 2008 - 2010 Janis Skarnelis
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
- *
- * Version: 1.3.4 (11/11/2010)
- * Requires: jQuery v1.3+
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
-F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
-c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
-false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
-function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
-'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
-"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
-";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
-opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
-d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
-y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
-i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
-f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
-37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
-s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
-f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
-j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
-"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
-10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
-b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
-0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
-1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
-true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
-b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
-d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
-D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
-b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
-b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
-easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); \ No newline at end of file
diff --git a/app/assets/stylesheets/jquery.fancybox-1.3.4.css b/app/assets/stylesheets/jquery.fancybox-1.3.4.css
deleted file mode 100755
index 6f53d8f4a..000000000
--- a/app/assets/stylesheets/jquery.fancybox-1.3.4.css
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * FancyBox - jQuery Plugin
- * Simple and fancy lightbox alternative
- *
- * Examples and documentation at: http://fancybox.net
- *
- * Copyright (c) 2008 - 2010 Janis Skarnelis
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
- *
- * Version: 1.3.4 (11/11/2010)
- * Requires: jQuery v1.3+
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-#fancybox-loading {
- position: fixed;
- top: 50%;
- left: 50%;
- width: 40px;
- height: 40px;
- margin-top: -20px;
- margin-left: -20px;
- cursor: pointer;
- overflow: hidden;
- z-index: 1104;
- display: none;
-}
-
-#fancybox-loading div {
- position: absolute;
- top: 0;
- left: 0;
- width: 40px;
- height: 480px;
- background-image: url('fancybox.png');
-}
-
-#fancybox-overlay {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 1100;
- display: none;
-}
-
-#fancybox-tmp {
- padding: 0;
- margin: 0;
- border: 0;
- overflow: auto;
- display: none;
-}
-
-#fancybox-wrap {
- position: absolute;
- top: 0;
- left: 0;
- padding: 20px;
- z-index: 1101;
- outline: none;
- display: none;
-}
-
-#fancybox-outer {
- position: relative;
- width: 100%;
- height: 100%;
- background: #fff;
-}
-
-#fancybox-content {
- width: 0;
- height: 0;
- padding: 0;
- outline: none;
- position: relative;
- overflow: hidden;
- z-index: 1102;
- border: 0px solid #fff;
-}
-
-#fancybox-hide-sel-frame {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: transparent;
- z-index: 1101;
-}
-
-#fancybox-close {
- position: absolute;
- top: -15px;
- right: -15px;
- width: 30px;
- height: 30px;
- background: transparent url('fancybox.png') -40px 0px;
- cursor: pointer;
- z-index: 1103;
- display: none;
-}
-
-#fancybox-error {
- color: #444;
- font: normal 12px/20px Arial;
- padding: 14px;
- margin: 0;
-}
-
-#fancybox-img {
- width: 100%;
- height: 100%;
- padding: 0;
- margin: 0;
- border: none;
- outline: none;
- line-height: 0;
- vertical-align: top;
-}
-
-#fancybox-frame {
- width: 100%;
- height: 100%;
- border: none;
- display: block;
-}
-
-#fancybox-left, #fancybox-right {
- position: absolute;
- bottom: 0px;
- height: 100%;
- width: 35%;
- cursor: pointer;
- outline: none;
- background: transparent url('blank.gif');
- z-index: 1102;
- display: none;
-}
-
-#fancybox-left {
- left: 0px;
-}
-
-#fancybox-right {
- right: 0px;
-}
-
-#fancybox-left-ico, #fancybox-right-ico {
- position: absolute;
- top: 50%;
- left: -9999px;
- width: 30px;
- height: 30px;
- margin-top: -15px;
- cursor: pointer;
- z-index: 1102;
- display: block;
-}
-
-#fancybox-left-ico {
- background-image: url('fancybox.png');
- background-position: -40px -30px;
-}
-
-#fancybox-right-ico {
- background-image: url('fancybox.png');
- background-position: -40px -60px;
-}
-
-#fancybox-left:hover, #fancybox-right:hover {
- visibility: visible; /* IE6 */
-}
-
-#fancybox-left:hover span {
- left: 20px;
-}
-
-#fancybox-right:hover span {
- left: auto;
- right: 20px;
-}
-
-.fancybox-bg {
- position: absolute;
- padding: 0;
- margin: 0;
- border: 0;
- width: 20px;
- height: 20px;
- z-index: 1001;
-}
-
-#fancybox-bg-n {
- top: -20px;
- left: 0;
- width: 100%;
- background-image: url('fancybox-x.png');
-}
-
-#fancybox-bg-ne {
- top: -20px;
- right: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -162px;
-}
-
-#fancybox-bg-e {
- top: 0;
- right: -20px;
- height: 100%;
- background-image: url('fancybox-y.png');
- background-position: -20px 0px;
-}
-
-#fancybox-bg-se {
- bottom: -20px;
- right: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -182px;
-}
-
-#fancybox-bg-s {
- bottom: -20px;
- left: 0;
- width: 100%;
- background-image: url('fancybox-x.png');
- background-position: 0px -20px;
-}
-
-#fancybox-bg-sw {
- bottom: -20px;
- left: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -142px;
-}
-
-#fancybox-bg-w {
- top: 0;
- left: -20px;
- height: 100%;
- background-image: url('fancybox-y.png');
-}
-
-#fancybox-bg-nw {
- top: -20px;
- left: -20px;
- background-image: url('fancybox.png');
- background-position: -40px -122px;
-}
-
-#fancybox-title {
- font-family: Helvetica;
- font-size: 12px;
- z-index: 1102;
-}
-
-.fancybox-title-inside {
- padding-bottom: 10px;
- text-align: center;
- color: #333;
- background: #fff;
- position: relative;
-}
-
-.fancybox-title-outside {
- padding-top: 10px;
- color: #fff;
-}
-
-.fancybox-title-over {
- position: absolute;
- bottom: 0;
- left: 0;
- color: #FFF;
- text-align: left;
-}
-
-#fancybox-title-over {
- padding: 10px;
- background-image: url('fancy_title_over.png');
- display: block;
-}
-
-.fancybox-title-float {
- position: absolute;
- left: 0;
- bottom: -20px;
- height: 32px;
-}
-
-#fancybox-title-float-wrap {
- border: none;
- border-collapse: collapse;
- width: auto;
-}
-
-#fancybox-title-float-wrap td {
- border: none;
- white-space: nowrap;
-}
-
-#fancybox-title-float-left {
- padding: 0 0 0 15px;
- background: url('fancybox.png') -40px -90px no-repeat;
-}
-
-#fancybox-title-float-main {
- color: #FFF;
- line-height: 29px;
- font-weight: bold;
- padding: 0 0 3px 0;
- background: url('fancybox-x.png') 0px -40px;
-}
-
-#fancybox-title-float-right {
- padding: 0 0 0 15px;
- background: url('fancybox.png') -55px -90px no-repeat;
-}
-
-/* IE6 */
-
-.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
-.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); }
-
-.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
- height: expression(this.parentNode.clientHeight + "px");
-}
-
-#fancybox-loading.fancybox-ie6 {
- position: absolute; margin-top: 0;
- top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
-}
-
-#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); }
-
-/* IE6, IE7, IE8 */
-
-.fancybox-ie .fancybox-bg { background: transparent !important; }
-
-.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } \ No newline at end of file
diff --git a/app/controllers/admin_spam_addresses_controller.rb b/app/controllers/admin_spam_addresses_controller.rb
new file mode 100644
index 000000000..f5c7e93da
--- /dev/null
+++ b/app/controllers/admin_spam_addresses_controller.rb
@@ -0,0 +1,27 @@
+class AdminSpamAddressesController < AdminController
+
+ def index
+ @spam_addresses = SpamAddress.all
+ @spam_address = SpamAddress.new
+ end
+
+ def create
+ @spam_address = SpamAddress.new(params[:spam_address])
+
+ if @spam_address.save
+ notice = "#{ @spam_address.email } has been added to the spam addresses list"
+ redirect_to spam_addresses_path, :notice => notice
+ else
+ @spam_addresses = SpamAddress.all
+ render :index
+ end
+ end
+
+ def destroy
+ @spam_address = SpamAddress.find(params[:id])
+ @spam_address.destroy
+ notice = "#{ @spam_address.email } has been removed from the spam addresses list"
+ redirect_to spam_addresses_path, :notice => notice
+ end
+
+end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 83e05ebbc..dccc52efc 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -118,7 +118,7 @@ class TrackController < ApplicationController
if @user
@existing_track = TrackThing.find_existing(@user, @track_thing)
if @existing_track
- flash[:notice] = _("You are already following updates about {{track_description}}", :track_description => @track_thing.params[:list_description])
+ flash[:notice] = view_context.already_subscribed_notice(@track_thing)
return true
end
end
@@ -130,11 +130,7 @@ class TrackController < ApplicationController
@track_thing.track_medium = 'email_daily'
@track_thing.tracking_user_id = @user.id
@track_thing.save!
- if @user.receive_email_alerts
- flash[:notice] = _('You will now be emailed updates about {{track_description}}. <a href="{{change_email_alerts_url}}">Prefer not to receive emails?</a>', :track_description => @track_thing.params[:list_description], :change_email_alerts_url => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name))
- else
- flash[:notice] = _('You are now <a href="{{wall_url_user}}">following</a> updates about {{track_description}}', :track_description => @track_thing.params[:list_description], :wall_url_user => url_for(:controller => "user", :action => "wall", :url_name => @user.url_name))
- end
+ flash[:notice] = render_to_string(:partial => 'track_set').html_safe
return true
end
@@ -183,16 +179,8 @@ class TrackController < ApplicationController
new_medium = params[:track_medium]
if new_medium == 'delete'
track_thing.destroy
- flash[:notice] = _("You are no longer following {{track_description}}.", :track_description => track_thing.params[:list_description])
+ flash[:notice] = view_context.unsubscribe_notice(track_thing)
redirect_to URI.parse(params[:r]).path
-
- # Reuse code like this if we let medium change again.
- #elsif new_medium == 'email_daily'
- # track_thing.track_medium = new_medium
- # track_thing.created_at = Time.now() # as created_at is used to limit the alerts to start with
- # track_thing.save!
- # flash[:notice] = "You are now tracking " + track_thing.params[:list_description] + " by email daily"
- # redirect_to user_url(track_thing.tracking_user)
else
raise "new medium not handled " + new_medium
end
@@ -217,7 +205,6 @@ class TrackController < ApplicationController
for track_thing in TrackThing.find(:all, :conditions => [ "track_type = ? and tracking_user_id = ?", track_type, user_id ])
track_thing.destroy
end
- flash[:notice] += "</ul>"
redirect_to params[:r]
end
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 594296e77..dd6ffa805 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -18,8 +18,8 @@ module LinkToHelper
request_url(info_request, {:only_path => true}.merge(options))
end
- def request_link(info_request, cls=nil )
- link_to h(info_request.title), request_path(info_request), :class => cls
+ def request_link(info_request, cls=nil)
+ link_to info_request.title, request_path(info_request), :class => cls
end
def request_details_path(info_request)
@@ -96,19 +96,19 @@ module LinkToHelper
end
def user_link(user, cls=nil)
- link_to h(user.name), user_path(user), :class => cls
+ link_to user.name, user_path(user), :class => cls
end
def user_link_for_request(request, cls=nil)
if request.is_external?
user_name = request.external_user_name || _("Anonymous user")
if !request.external_url.nil?
- link_to h(user_name), request.external_url
+ link_to user_name, request.external_url
else
user_name
end
else
- link_to h(request.user.name), user_path(request.user), :class => cls
+ link_to request.user.name, user_path(request.user), :class => cls
end
end
@@ -116,7 +116,7 @@ module LinkToHelper
if request.is_external?
external_text || (request.external_user_name || _("Anonymous user")) + " (external)"
else
- link_to(h(internal_text || request.user.name), admin_user_show_url(request.user))
+ link_to(internal_text || request.user.name, admin_user_show_url(request.user))
end
end
diff --git a/app/helpers/track_helper.rb b/app/helpers/track_helper.rb
new file mode 100644
index 000000000..7bd0fa55d
--- /dev/null
+++ b/app/helpers/track_helper.rb
@@ -0,0 +1,122 @@
+module TrackHelper
+
+ def already_subscribed_notice(track_thing)
+ case track_thing.track_type
+ when 'request_updates'
+ _("You are already subscribed to '{{link_to_request}}', a request",
+ :link_to_request => request_link(track_thing.info_request))
+ when 'all_new_requests'
+ _('You are already subscribed to any <a href="{{new_requests_url}}">new requests</a>',
+ :new_requests_url => request_list_path)
+ when 'all_successful_requests'
+ _('You are already subscribed to any <a href="{{successful_requests_url}}">successful requests</a>',
+ :successful_requests_url => request_list_successful_path )
+ when 'public_body_updates'
+ _("You are already subscribed to '{{link_to_authority}}', a public authority",
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _("You are already subscribed to '{{link_to_user}}', a person",
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ _('You are already subscribed to <a href="{{search_url}}">this search</a>',
+ :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
+
+ def subscribe_email_notice(track_thing)
+ case track_thing.track_type
+ when 'request_updates'
+ _("You will now be emailed updates about '{{link_to_request}}', a request",
+ :link_to_request => request_link(track_thing.info_request))
+ when 'all_new_requests'
+ _('You will now be emailed updates about any <a href="{{new_requests_url}}">new requests</a>',
+ :new_requests_url => request_list_path)
+ when 'all_successful_requests'
+ _('You will now be emailed updates about <a href="{{successful_requests_url}}">successful requests</a>',
+ :successful_requests_url => request_list_successful_path )
+ when 'public_body_updates'
+ _("You will now be emailed updates about '{{link_to_authority}}', a public authority",
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _("You will now be emailed updates about '{{link_to_user}}', a person",
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ _("You will now be emailed updates about <a href=\"{{search_url}}\">this search</a>",
+ :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
+
+ def subscribe_follow_notice(track_thing)
+ wall_url_user = show_user_wall_path(:url_name => track_thing.tracking_user.url_name)
+ case track_thing.track_type
+ when 'request_updates'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_request}}\', a request',
+ :link_to_request => request_link(track_thing.info_request),
+ :wall_url_user => wall_url_user)
+ when 'all_new_requests'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{new_requests_url}}">new requests</a>',
+ :new_requests_url => request_list_path,
+ :wall_url_user => wall_url_user)
+ when 'all_successful_requests'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{successful_requests_url}}">successful requests</a>',
+ :successful_requests_url => request_list_successful_path,
+ :wall_url_user => wall_url_user)
+ when 'public_body_updates'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_authority}}\', a public authority',
+ :wall_url_user => wall_url_user,
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_user}}\', a person',
+ :wall_url_user => wall_url_user,
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ _('You are now <a href="{{wall_url_user}}">following</a> updates about <a href="{{search_url}}">this search</a>',
+ :wall_url_user => wall_url_user,
+ :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
+
+ def unsubscribe_notice(track_thing)
+ case track_thing.track_type
+ when 'request_updates'
+ _("You are no longer following '{{link_to_request}}', a request",
+ :link_to_request => request_link(track_thing.info_request))
+ when 'all_new_requests'
+ _('You are no longer following <a href="{{new_requests_url}}">new requests</a>',
+ :new_requests_url => request_list_path)
+ when 'all_successful_requests'
+ _('You are no longer following <a href="{{successful_requests_url}}">successful requests</a>',
+ :successful_requests_url => request_list_successful_path )
+ when 'public_body_updates'
+ _("You are no longer following '{{link_to_authority}}', a public authority",
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _("You are no longer following '{{link_to_user}}', a person",
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ _('You are no longer following <a href="{{search_url}}">this search</a>',
+ :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
+
+ def track_description(track_thing)
+ case track_thing.track_type
+ when 'request_updates'
+ _("'{{link_to_request}}', a request",
+ :link_to_request => request_link(track_thing.info_request))
+ when 'all_new_requests'
+ link_to(_('new requests'), request_list_path)
+ when 'all_successful_requests'
+ link_to(_('successful requests'), request_list_successful_path)
+ when 'public_body_updates'
+ _("'{{link_to_authority}}', a public authority",
+ :link_to_authority => public_body_link(track_thing.public_body))
+ when 'user_updates'
+ _("'{{link_to_user}}', a person",
+ :link_to_user => user_link(track_thing.tracked_user))
+ when 'search_query'
+ link_to(track_thing.track_query_description,
+ search_path([track_thing.track_query, 'newest', 'advanced']))
+ end
+ end
+end
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index af1a75df9..1fd5b9ba7 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -250,7 +250,7 @@ class RequestMailer < ApplicationMailer
if reply_info_requests.size == 0
reason = _("Could not identify the request from the email address")
request = InfoRequest.holding_pen_request
- request.receive(email, raw_email, false, reason)
+ request.receive(email, raw_email, false, reason) unless SpamAddress.spam?(email.to)
return
end
diff --git a/app/models/spam_address.rb b/app/models/spam_address.rb
new file mode 100644
index 000000000..15c9d1ab8
--- /dev/null
+++ b/app/models/spam_address.rb
@@ -0,0 +1,11 @@
+class SpamAddress < ActiveRecord::Base
+ attr_accessible :email
+
+ validates_presence_of :email, :message => _('Please enter the email address to mark as spam')
+ validates_uniqueness_of :email, :message => _('This address is already marked as spam')
+
+ def self.spam?(email_address)
+ exists?(:email => email_address)
+ end
+
+end
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index d5dda7bb5..13b6f78dd 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -69,66 +69,30 @@ class TrackThing < ActiveRecord::Base
end
def track_query_description
- # XXX this is very brittle... we should probably ask users
- # simply to name their tracks when they make them?
- original_text = parsed_text = self.track_query.gsub(/([()]|OR)/, "")
- filters = parsed_text.scan /\b\S+:\S+\b/
- varieties = Set.new
- date = ""
- statuses = Set.new
- for filter in filters
- parsed_text = parsed_text.sub(filter, "")
- if filter =~ /variety:user/
- varieties << _("users")
- end
- if filter =~ /variety:comment/
- varieties << _("comments")
- end
- if filter =~ /variety:authority/
- varieties << _("authorities")
- end
- if filter =~ /(variety:(sent|followup_sent|response)|latest_status)/
- varieties << _("requests")
- end
- if filter =~ /[0-9\/]+\.\.[0-9\/]+/
- date = _("between two dates")
- end
- if filter =~ /(rejected|not_held)/
- statuses << _("unsuccessful")
- end
- if filter =~ /(:successful|:partially_successful)/
- statuses << _("successful")
- end
- if filter =~ /waiting/
- statuses << _("awaiting a response")
- end
- end
- if filters.empty?
- parsed_text = original_text
- end
- descriptions = []
- if varieties.include? _("requests")
- if statuses.empty?
- # HACK: Relies on the 'descriptions.sort' below to luckily put this first
- descriptions << _("all requests")
+ filter_description = query_filter_description('(variety:sent OR variety:followup_sent OR variety:response OR variety:comment)',
+ :no_query => N_("all requests or comments"),
+ :query => N_("all requests or comments matching text '{{query}}'"))
+ return filter_description if filter_description
+ filter_description = query_filter_description('(latest_status:successful OR latest_status:partially_successful)',
+ :no_query => N_("requests which are successful"),
+ :query => N_("requests which are successful matching text '{{query}}'"))
+ return filter_description if filter_description
+ return _("anything matching text '{{query}}'", :query => track_query)
+ end
+
+ # Return a readable query description for queries involving commonly used filter clauses
+ def query_filter_description(string, options)
+ parsed_query = track_query.gsub(string, '')
+ if parsed_query != track_query
+ parsed_query.strip!
+ if parsed_query.empty?
+ _(options[:no_query])
else
- descriptions << _("requests which are {{list_of_statuses}}", :list_of_statuses => Array(statuses).sort.join(_(' or ')))
+ _(options[:query], :query => parsed_query)
end
- varieties -= [_("requests")]
end
- if descriptions.empty? and varieties.empty?
- varieties << _("anything")
- end
- descriptions += Array(varieties)
- parsed_text = parsed_text.strip
- descriptions = descriptions.sort.join(_(" or "))
- if !parsed_text.empty?
- descriptions += _("{{list_of_things}} matching text '{{search_query}}'", :list_of_things => "", :search_query => parsed_text)
- end
- return descriptions
end
-
def TrackThing.create_track_for_request(info_request)
track_thing = TrackThing.new
track_thing.track_type = 'request_updates'
@@ -194,30 +158,32 @@ class TrackThing < ActiveRecord::Base
end
# Return hash of text parameters describing the request etc.
- include LinkToHelper
def params
if @params.nil?
if self.track_type == 'request_updates'
@params = {
# Website
- :list_description => _("'{{link_to_request}}', a request",
- :link_to_request => ("<a href=\"/request/" + CGI.escapeHTML(self.info_request.url_title) + "\">" + CGI.escapeHTML(self.info_request.title) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
+
:verb_on_page => _("Follow this request"),
:verb_on_page_already => _("You are already following this request"),
# Email
- :title_in_email => _("New updates for the request '{{request_title}}'", :request_title => self.info_request.title.html_safe),
- :title_in_rss => _("New updates for the request '{{request_title}}'", :request_title => self.info_request.title),
+ :title_in_email => _("New updates for the request '{{request_title}}'",
+ :request_title => self.info_request.title.html_safe),
+ :title_in_rss => _("New updates for the request '{{request_title}}'",
+ :request_title => self.info_request.title),
# Authentication
- :web => _("To follow the request '{{request_title}}'", :request_title => CGI.escapeHTML(self.info_request.title)),
- :email => _("Then you will be updated whenever the request '{{request_title}}' is updated.", :request_title => CGI.escapeHTML(self.info_request.title)),
- :email_subject => _("Confirm you want to follow the request '{{request_title}}'", :request_title => self.info_request.title),
+ :web => _("To follow the request '{{request_title}}'",
+ :request_title => self.info_request.title),
+ :email => _("Then you will be updated whenever the request '{{request_title}}' is updated.",
+ :request_title => self.info_request.title),
+ :email_subject => _("Confirm you want to follow the request '{{request_title}}'",
+ :request_title => self.info_request.title),
# RSS sorting
:feed_sortby => 'newest'
}
elsif self.track_type == 'all_new_requests'
@params = {
# Website
- :list_description => _("any <a href=\"/list\">new requests</a>"),
:verb_on_page => _("Follow all new requests"),
:verb_on_page_already => _("You are already following new requests"),
# Email
@@ -233,7 +199,6 @@ class TrackThing < ActiveRecord::Base
elsif self.track_type == 'all_successful_requests'
@params = {
# Website
- :list_description => _("any <a href=\"/list/successful\">successful requests</a>"),
:verb_on_page => _("Follow new successful responses"),
:verb_on_page_already => _("You are following all new successful responses"),
# Email
@@ -252,39 +217,51 @@ class TrackThing < ActiveRecord::Base
elsif self.track_type == 'public_body_updates'
@params = {
# Website
- :list_description => _("'{{link_to_authority}}', a public authority", :link_to_authority => ("<a href=\"/body/" + CGI.escapeHTML(self.public_body.url_name) + "\">" + CGI.escapeHTML(self.public_body.name) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
- :verb_on_page => _("Follow requests to {{public_body_name}}",:public_body_name=>CGI.escapeHTML(self.public_body.name)),
- :verb_on_page_already => _("You are already following requests to {{public_body_name}}", :public_body_name=>CGI.escapeHTML(self.public_body.name)),
+ :verb_on_page => _("Follow requests to {{public_body_name}}",
+ :public_body_name => self.public_body.name),
+ :verb_on_page_already => _("You are already following requests to {{public_body_name}}",
+ :public_body_name => self.public_body.name),
# Email
- :title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
- :title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'",
+ :title_in_email => _("{{foi_law}} requests to '{{public_body_name}}'",
+ :foi_law => self.public_body.law_only_short,
+ :public_body_name => self.public_body.name),
+ :title_in_rss => _("{{foi_law}} requests to '{{public_body_name}}'",
+ :foi_law => self.public_body.law_only_short,
+ :public_body_name => self.public_body.name),
# Authentication
- :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'", :site_name=>AlaveteliConfiguration::site_name, :public_body_name=>CGI.escapeHTML(self.public_body.name)),
- :email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.", :public_body_name=>CGI.escapeHTML(self.public_body.name)),
- :email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'", :public_body_name=>self.public_body.name),
+ :web => _("To follow requests made using {{site_name}} to the public authority '{{public_body_name}}'",
+ :site_name => AlaveteliConfiguration::site_name,
+ :public_body_name => self.public_body.name),
+ :email => _("Then you will be notified whenever someone requests something or gets a response from '{{public_body_name}}'.",
+ :public_body_name => self.public_body.name),
+ :email_subject => _("Confirm you want to follow requests to '{{public_body_name}}'",
+ :public_body_name => self.public_body.name),
# RSS sorting
:feed_sortby => 'newest'
}
elsif self.track_type == 'user_updates'
@params = {
# Website
- :list_description => _("'{{link_to_user}}', a person", :link_to_user => ("<a href=\"/user/" + CGI.escapeHTML(self.tracked_user.url_name) + "\">" + CGI.escapeHTML(self.tracked_user.name) + "</a>").html_safe), # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
:verb_on_page => _("Follow this person"),
:verb_on_page_already => _("You are already following this person"),
# Email
- :title_in_email => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name.html_safe),
- :title_in_rss => _("FOI requests by '{{user_name}}'", :user_name=>self.tracked_user.name),
+ :title_in_email => _("FOI requests by '{{user_name}}'",
+ :user_name => self.tracked_user.name.html_safe),
+ :title_in_rss => _("FOI requests by '{{user_name}}'",
+ :user_name => self.tracked_user.name),
# Authentication
- :web => _("To follow requests by '{{user_name}}'", :user_name=>CGI.escapeHTML(self.tracked_user.name)),
- :email => _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.", :user_name=>CGI.escapeHTML(self.tracked_user.name)),
- :email_subject => _("Confirm you want to follow requests by '{{user_name}}'", :user_name=>self.tracked_user.name),
+ :web => _("To follow requests by '{{user_name}}'",
+ :user_name=> self.tracked_user.name),
+ :email => _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.",
+ :user_name => self.tracked_user.name),
+ :email_subject => _("Confirm you want to follow requests by '{{user_name}}'",
+ :user_name => self.tracked_user.name),
# RSS sorting
:feed_sortby => 'newest'
}
elsif self.track_type == 'search_query'
@params = {
# Website
- :list_description => ("<a href=\"/search/" + CGI.escapeHTML(self.track_query) + "/newest/advanced\">" + CGI.escapeHTML(self.track_query_description) + "</a>").html_safe, # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
:verb_on_page => _("Follow things matching this search"),
:verb_on_page_already => _("You are already following things matching this search"),
# Email
diff --git a/app/views/admin_request/_incoming_message_actions.html.erb b/app/views/admin_request/_incoming_message_actions.html.erb
index 4cf099b53..dd50eb047 100644
--- a/app/views/admin_request/_incoming_message_actions.html.erb
+++ b/app/views/admin_request/_incoming_message_actions.html.erb
@@ -22,6 +22,13 @@
</div>
</div>
+ <div class="control-group">
+ <label class="control-label">Mark <code>To:</code> address as spam</label>
+ <div class="controls">
+ <%= link_to 'Spam Addresses', spam_addresses_path %>
+ </div>
+ </div>
+
<%= form_tag admin_incoming_destroy_path, :class => "form form-inline" do %>
<div class="control-group">
<label class="control-label" for="destroy_message_<%= incoming_message.id %>">Destroy message</label>
diff --git a/app/views/admin_spam_addresses/index.html.erb b/app/views/admin_spam_addresses/index.html.erb
new file mode 100644
index 000000000..9846bc017
--- /dev/null
+++ b/app/views/admin_spam_addresses/index.html.erb
@@ -0,0 +1,51 @@
+<% @title = 'Spam Addresses' %>
+
+<h1><%= @title %></h1>
+
+<div class="row">
+ <div class="span12">
+ <p>
+ Incoming mail that gets redirected to the holding pen will be
+ rejected if it is sent <code>To:</code> an address on this
+ list.
+ </p>
+ </div>
+</div>
+
+<hr />
+
+<div class="row">
+ <div class="span12">
+ <%= form_for(@spam_address, :html => { :class => 'form-inline' }) do |f| -%>
+ <%= error_messages_for @spam_address %>
+ <%= f.text_field :email, :class => 'input-xxlarge', :placeholder => 'Enter email' %>
+ <%= f.submit 'Add Spam Address', :class => 'btn btn-warning' %>
+ <% end -%>
+ </div>
+</div>
+
+<hr />
+
+<% if @spam_addresses.any? %>
+ <div class="row">
+ <table class="table table-hover span12">
+ <thead>
+ <tr>
+ <th>Email</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @spam_addresses.each do |spam| %>
+ <tr>
+ <td><%= spam.email %></td>
+ <td><%= link_to 'Remove', spam,
+ :method => :delete,
+ :confirm => 'This is permanent! Are you sure?',
+ :class => 'btn btn-mini btn-danger' %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+<% end %>
diff --git a/app/views/general/_stylesheet_includes.html.erb b/app/views/general/_stylesheet_includes.html.erb
index 7a1648efd..f76c146de 100644
--- a/app/views/general/_stylesheet_includes.html.erb
+++ b/app/views/general/_stylesheet_includes.html.erb
@@ -17,6 +17,6 @@
<%= stylesheet_link_tag 'ie7.css' %>
<![endif]-->
<% if AlaveteliConfiguration::force_registration_on_new_request %>
- <%= stylesheet_link_tag 'jquery.fancybox-1.3.4.css', :rel => "stylesheet" %>
+ <%= stylesheet_link_tag 'fancybox.css', :rel => "stylesheet" %>
<% end %>
<% end %>
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index c1f9335b1..2147f22e1 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -2,6 +2,8 @@
<html lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" >
+ <%= csrf_meta_tags %>
+
<title><%= site_name %> admin<%= @title ? ":" : "" %> <%=@title%></title>
<%= javascript_include_tag "admin" %>
diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb
index 52b718be8..93b3c3698 100644
--- a/app/views/layouts/default.html.erb
+++ b/app/views/layouts/default.html.erb
@@ -2,6 +2,8 @@
<html lang="<%= I18n.locale %>">
<head>
<meta charset="utf-8">
+ <%= csrf_meta_tags %>
+
<title>
<% if @title %>
<%=@title%> - <%= site_name %>
@@ -43,7 +45,7 @@
</head>
<body class="<%= 'front' if params[:action] == 'frontpage' %>">
<% if AlaveteliConfiguration::force_registration_on_new_request && !@user %>
- <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack.js' %>
+ <%= javascript_include_tag 'fancybox.js' %>
<script type="text/javascript">
$(document).ready(function() {
$("#make-request-link").fancybox({
diff --git a/app/views/layouts/no_chrome.html.erb b/app/views/layouts/no_chrome.html.erb
index e613b8ca2..a4278ab24 100644
--- a/app/views/layouts/no_chrome.html.erb
+++ b/app/views/layouts/no_chrome.html.erb
@@ -2,6 +2,8 @@
<html lang="<%= I18n.locale %>">
<head>
<meta charset="utf-8">
+ <%= csrf_meta_tags %>
+
<title>
<% if @title %>
<%=@title%> - <%= site_name %>
diff --git a/app/views/track/_track_set.erb b/app/views/track/_track_set.erb
new file mode 100644
index 000000000..c7665312d
--- /dev/null
+++ b/app/views/track/_track_set.erb
@@ -0,0 +1,6 @@
+<% if @user.receive_email_alerts %>
+ <%= subscribe_email_notice(@track_thing) %>
+ <%= link_to(_('Prefer not to receive emails?'), show_user_wall_path(:url_name => @user.url_name)) %>
+<% else %>
+ <%= subscribe_follow_notice(@track_thing) %>
+<% end %>
diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb
index 1ccb1d649..8dd8c6b88 100644
--- a/app/views/user/show.html.erb
+++ b/app/views/user/show.html.erb
@@ -224,7 +224,7 @@
<li>
<%= form_tag({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %>
<div>
- <%= track_thing.params[:list_description] %>
+ <%= track_description(track_thing) %>
<%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %>
<%= hidden_field_tag 'r', request.fullpath, { :id => 'r_' + track_thing.id.to_s } %>
<%= submit_tag _('unsubscribe') %>