Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
306 lines (240 sloc) 11.1 KB
#to do
# conditional show personal petition
# url encode everything emails and add share url to the end
# thermometer
#image uploader
# cc add to paste buffer
# update share counts on the server
$DIA = new DemocracyInAction_API( $node, $user, $password);
#get action key from slug
#$campign_slug = '' $_SERVER['REQUEST_URI']
if ($_REQUEST['a']) {
$action_KEY = $_REQUEST['a'];
} else {
#get supporter key from url
$supporter_KEY = $_GET['$u'];
if ($_REQUEST['u']) {
$supporter_KEY = $_REQUEST['u'];
} else {
#$supporter_KEY ='42703842';
#get supporter action key from url
if ($_REQUEST['p']) {
$supporter_action_KEY = $_REQUEST['p'];
} else {
#$supporter_action_KEY ='8979243';
# get action data
#$options = array('condition' => array('campign_slug='.$campaign_slug));
$options = array('condition' => array('action_KEY='.$action_KEY));
$action = $DIA->get( 'action', $options);
$a = $action[0];
#$action_KEY = $a['action_KEY']
#get tell a firend data
$options = array('condition' => array('tell_a_friend_KEY='.$a['tell_a_friend_KEY']));
$tell = $DIA->get( 'tell_a_friend', $options);
$taf = $tell[0];
#get user data
if ($supporter_KEY){
$options = array('condition' => array('supporter_KEY='.$supporter_KEY));
$supr = $DIA->get( 'supporter', $options);
$s = $sup[0];
<title><?php echo $a['Title'] ;?> | Rainforest Actio Network</title>
<meta property="og:title" content="<?php echo $a['Title'] ;?>"/>
<meta name="description" content="<?php echo $a['share_text'] ;?>">
<meta property="og:description" content="<?php echo $a['share_text'] ;?>" />
<meta property="og:site_name" content="Rainforest Action Network"/>
<?php if ($a['image_facebook']) { ;?>
<meta property="og:image" content="<?php echo $a['image_facebook'] ;?>" />
<?php } else { ?>
<meta property="og:image" content=""/>
<?php } ?>
<meta property="og:url" content="<?php echo $a['campign_slug'] ;?>/?t=f" />
<meta property="fb:admins" content="511719841,1654947176,500387223,547808206" />
<link rel='prev' title='Take Action Online' href='' />
<link rel='canonical' href='<?php echo $a['campaign_slug'] ;?>/' />
<link rel="stylesheet" type="text/css" href="" />
<link rel="stylesheet" type="text/css" href="" />
<title><? echo $a['Title'] ; ?></title>
<body class="petition_taf page_width930 " >
<style type="text/css">
.petition_taf .email-friends, .petition_taf .facebook-post {
.petition_taf .copy-link, .petition_taf .tweet-this {
min-height: 160px;
.petition_taf #content .facebook-post p.thumbnail {
padding:8px 0 0 0px;
margin: 0 !important;
.petition_taf .facebook-post h2 {
margin: 0 0 20px;
.share, .personal_pet_container{
margin-top: 0 !important;
<div id="header">
<div id="ran-banner">
<div class="menu">
<div class="topMenu">
<div class="logoMenu">
<a href="/"><img border="0" src="" alt="Rainforest Action Network"></a>
<!-- <div class="joinUsMenu">
<a href=""><img border="0" class="socialNetworkIcon" alt="Facebook" src="img/facebook.png"></a>
<a href="!/ran"><img border="0" class="socialNetworkIcon" alt="Twitter" src="img/twitter.png"></a>
<a href=""><img border="0" class="socialNetworkIcon" alt="YouTube" src="img/youtube.png"></a>
<a href=""><img border="0" class="socialNetworkIcon" alt="Flickr" src="img/flickr.png"></a>
<!-- <div class="updatesMenu">
Get email updates
<input type="text" onClick="this.value='';" class="inputText" value="Email address" name="emailAddress">
<input type="text" onClick="this.value='';" class="inputText" value="zip code" name="zipCode">
<input type="submit" class="inputSubmit" value="Submit" name="emailSubmit">
</div> -->
<div id="content" class="box pagecontent">
<div class="holder">
<div class="badge">
<h1><?php echo $taf['Title'] ; ?></h1>
<p><?php echo $taf['HTML_Content'] ;?></p>
<div class="what-else">
<?php if ( $a['action_count'] > $a['Signature Minimum for Display']) { ?>
<div class="thermometer">
Thermo goes here
<p>We've reached <b><?php echo ( ($a['action_count'] /$a['Signature_Goal']) * 100 ) ;?>%</b> (<?php echo $a['action_count'] ; ?>) of our goal of <b><?php echo $a['Signature_Goal'] ;?> signers</b>! <br>
Help us get there by telling your friends: </p>
<?php } # end thromo?>
</div> <!-- .what-else -->
</div> <!-- .holder -->
<h1>Tell Your Friends</h1>
<div class="share box">
<!-- <div id="or">- or -</div> -->
<div class="email-friends box"><div class="box-padder">
<h2>Email your friends</h2>
<p class="trigger">
<?php # TO DO add tracking url to the letter body) ;?>
<a href="mailto:?subject=<?php echo $taf['Letter_Subject']; ?>&body=<?php echo $taf['Letter_Body']; ?>.%0D%0A%0D%0A<?php echo $a['campaign_slug']; ?>/?t=a&r=<?php echo $supporter_KEY; ?>" >Email your friends</a>
Or, copy and paste the text below into an email message:
<div class="copy-paste" style="height:180px;">
<p><?php echo $taf['Letter_Subject']; ?></p>
<?php echo $taf['Letter_Body']; ?>
<br><br><?php echo $a['campaign_slug']; ?>/?t=a&r=<?php echo $supporter_KEY; ?>
</div> <!-- .copy-paste -->
</div></div> <!-- .email-friends -->
<div class="copy-link box"><div class="box-padder">
<h2>Share this link</h2>
<p>Copy the link to this campaign to IM, Skype or post it:</p>
<input type="text" id="spread_copy_text" name="url" class="url" value="<?php echo $a['campaign_slug'] ;?>/?t=v&r=<?php echo $supporter_KEY;?>">
<?php #TO DO add paste buffer button ?>
</div></div> <!-- /copy-link -->
<div class=" personal_pet_container box">
<div class="facebook-post box"><div class="box-padder">
<h2>Share on Facebook</h2>
<p class="thumbnail">
<img src="<?php echo $a['image_facebook']; ?>" />
<p class="description">
<?php if ($a['share_text']) { echo $a['share_text'];} else { ?> Post a link to Facebook: <?php } ?>
<!-- <p><?php echo $a['facebook_shares'];?> shares</p> -->
<p class="trigger">
<a href="<?php echo $a['campaign_slug'] ;?>/?t=f&r=<?php echo $supporter_KEY;?>" target="_blank">Post to your wall</a>
</div></div><!-- .facebook-post -->
<div class="tweet-this box"><div class="box-padder">
<?php #TO DO: add tracking url to tweets ;?>
<textarea><?php echo $a['tweet']; ?></textarea>
<!-- <p><?php echo $a['twitter_shares'];?> shares</p> -->
<p class="trigger"><a href="<?php echo urlencode($a['tweet']); ?>" target="_blank">Tweet this</a></p>
</div></div> <!-- .tweet-this -->
<br />
<div style="clear:both;"></div>
</div> <!-- /personal_pet (right-col) -->
<div style="clear:both;"></div>
<br />
<?php if ($a['personal_petition']){ ?>
<div class=" personal_pet_container box" style="display:none;">
<h1>Create your own petition</h1>
<div class="personal-petition box"><div class="box-padder">
<input type="hidden" name="personal_petition" value="1">
<h2>Personal Profile</h2>
<div id='img-preview'></div>
<p>Select an image to be displayed on your customized action</p>
<input id="fileupload" type="file" name="files[]" data-url="/api/salsa_action/uploads/index.php" multiple>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
$(function () {
dataType: 'json',
done: function (e, data) {
var filepath = "" + data.files[0].name;
$('#img-preview').html('<img src="' + filepath + '" height="200px">');
Supported file types: gif, jpg, png, Max size 2 Mb.
<form action="" method="post">
<input type="hidden" name="profile-image-path" id="profile-image-path" value="">
<input type="hidden" name="organization_KEY" value="6022">
<input type="hidden" name="table" value="supporter_action">
<input type="hidden" name="key" value="<?php echo $supporter_action_KEY ;?>">
<input type="hidden" name="redirect" value="<?php echo $a['campaign_slug'] ;?>/p/<?php echo $supporter_KEY; ?>/">
<p>Personal Message:</p>
<textarea name="personal_message"></textarea>
<h2>Customize the share content on your customized action</h2>
<p>Personal Goal</p>
<select id="signature_goal" name='signature_goal' class="">
<option value="25">25 signatures</option>
<option value="50">50 signatures</option>
<option value="100">100 signatures</option>
<option value="250">250 signatures</option>
<option value="500">500 signatures</option>
<h3>Email Message</h3>
<textarea name="email_message"><?php echo $a['Letter_Body']; ?></textarea>
<h3>Facebook Message</h3>
<textarea name="facebook_message"><?php echo $a['share_text']; ?></textarea>
<h3>Twitter Message</h3>
<textarea name="twitter_message"><?php echo $a['tweet']; ?></textarea>
<input type="hidden" name="link" value="supporter">
<input type="hidden" name="linkKey" value="<?php echo $supporter_KEY ;?>">
<input type="hidden" name="email_trigger_KEYS" value="0,<?php echo $a['personal_petition_emal_trigger_KEYS'] ;?>">
<input type="submit" value="Sign Up" class="submit">
<div style="clear:both;"></div>
<?php } ;?>
<div style="clear:both;"></div>