Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
148 lines (136 sloc) 5.34 KB
@using ServiceStack.Auth
@{
var userSession = base.SessionAs<CustomSession>();
if (base.Request.Verb == "POST")
{
var email = base.Request.FormData["email"];
if (!string.IsNullOrEmpty(email) && Db.SingleById<EmailRegistration>(email) == null)
{
Db.Insert(new EmailRegistration { Email = email });
}
}
}
<!doctype html>
<html lang="en-us">
<head>
<title>Reusability Demo</title>
<style type="text/css">
body { font: 13px/18px Arial; margin: 0; padding: 0 1%; width:47%; }
h2 { color: green; }
input[type=text], textarea { width: 250px; }
textarea { height: 70px; font-family: arial; }
label { font-weight: bold; }
</style>
</head>
<body>
<iframe id="receipts" src="/receipts" style="position:absolute;width:48%;top:53%;left:1%;height:44%;"></iframe>
<iframe id="mqstats" src="/mqstats" style="position:absolute;width:48%;top:1%;right:1%;height:50%;"></iframe>
<iframe id="mqdump" src="/mqdump" style="position:absolute;width:48%;top:53%;right:1%;height:44%;"></iframe>
<div id="mqdump-links" style="position:absolute;bottom:5px;right:1%;">
<a href="/mqdump/EmailMessage" target="mqdump">/mqdump/EmailMessage</a>
| <a href="/mqdump/CallFacebook" target="mqdump">/mqdump/CallFacebook</a>
| <a href="/mqdump/PostStatusTwitter" target="mqdump">/mqdump/PostStatusTwitter</a>
</div>
<div style="float:right">
<h2><a href="/">Broadcast SMessage to the world!</a></h2>
<h4>/smessage</h4>
<form action="/smessage" method="GET" target="smessage">
<input type="hidden" name="format" value="json" />
<dl>
<dd><input name="Subject" type="text" placeholder="Subject" value="Sent with SMessage" /></dd>
<dd>
<textarea name="Body" placeholder="Message Body"></textarea>
</dd>
<dd>
<label for="defer">Defer</label>
<input type="checkbox" id="defer" name="Defer" value="True" checked="checked" />
</dd>
<dd>
<button type="submit">Send</button>
</dd>
</dl>
</form>
<h4>/email</h4>
<form action="/email" method="GET" target="smessage">
<dl>
<dd><input name="To" type="text" placeholder="To" value="demis.bellot+1@gmail.com" /></dd>
<dd><input name="Subject" type="text" placeholder="Subject" value="Email Message Only" /></dd>
<dd>
<textarea name="Body" placeholder="Message Body"></textarea>
</dd>
<dd>
<button type="submit">Send</button>
</dd>
</dl>
</form>
<h4>/mqstats</h4>
<form action="/mqstats" method="GET" target="mqstats">
<dl>
<dd>
<label for="stop">Stop</label>
<input type="checkbox" id="stop" name="Stop" value="True" />
<label for="start">Start</label>
<input type="checkbox" id="start" name="Start" value="True" />
</dd>
<dd>
<button type="submit">Redis MQ Server</button>
</dd>
</dl>
</form>
</div>
<h2>Posting to Twitter streams</h2>
<ul>
@foreach (var twAuth in Db.Select<UserAuthDetails>(q => q.Provider == "twitter"))
{
<li><a href="http://twitter.com/@twAuth.UserName">@@@twAuth.UserName</a></li>
}
</ul>
@if (!userSession.IsAuthorized("twitter"))
{
<h3>
Register new Twitter user</h3>
<div id="twitter-signin">
<a href="/auth/twitter">
<img src="/Content/img/sign-in-with-twitter-l.png" alt="Sign-in with Twitter" /></a>
</div>
}
<h2>Posting to Facebook walls</h2>
<ul>
@foreach (var fbAuth in Db.Select<UserAuthDetails>(q => q.Provider == "facebook"))
{
<li><a href="http://www.facebook.com/@fbAuth.UserName">@fbAuth.UserName</a></li>
}
</ul>
@if (!userSession.IsAuthorized("facebook"))
{
<h3>
Register new Facebook user</h3>
<div id="facebook-signin">
<a href="/auth/facebook">
<img src="/Content/img/sign-in-with-facebook.png" alt="Sign-in with Facebook" /></a>
</div>
}
<h2>Send to Emails</h2>
<ul>
@foreach (var registration in Db.Select<EmailRegistration>())
{
<li>@registration.Email</li>
}
</ul>
<h3>Register new Email</h3>
<form action="/" method="POST">
<div>
<input name="email" type="text" placeholder="Email" />
</div>
<div class="actions">
<button type="submit">Add Email</button>
</div>
</form>
<h2 style="margin:2% 0 1% 0;">FORM Results: /smessage</h2>
<script type="text/javascript">
var $id = function (id) { return document.getElementById(id); }
</script>
<iframe id="smessage" src="about:blank" style="width:60%;height:100px;"
onload="$id('receipts').src=$id('receipts').src;$id('mqstats').src=$id('mqstats').src;$id('mqdump').src=$id('mqdump').src"></iframe>
</body>
</html>
Something went wrong with that request. Please try again.