Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

301 lines (244 sloc) 11.734 kb
<?php
#to do
# conditional show personal petition
# url encode everything emails and add share url to the end
# thermometer
# cc add to paste buffer
# update share counts on the server
require_once('dia/api.php');
require_once('settings.php');
$DIA = new DemocracyInAction_API( $node, $user, $password);
#get action key from slug
#$campign_slug = '' ran.org/act/slug/ $_SERVER['REQUEST_URI']
if ($_REQUEST['a']) {
$action_KEY = $_REQUEST['a'];
} else {
$action_KEY='5917';
}
#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'];
} elseif ($_REQUEST['u']) {
#$supporter_action_KEY ='8979243';
# look up in supporter_action where supporter_KEY = $U and personal_petition =1
$options = array('condition' => array('action_KEY='.$action_KEY, 'supporter_KEY='.$_REQUEST['u']));
$pet = $DIA->get( 'supporter_action', $options);
$supporter_action_KEY =$pet[0]['supporter_action_KEY'];
}
# 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];
}
?>
<head>
<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="http://ran.org/sites/default/files/RAN_Logo_small.gif"/>
<?php } ?>
<meta property="og:url" content="http://ran.org/act/<?php echo $a['campign_slug'] ;?>/?t=f" />
<meta property="fb:admins" content="511719841,1654947176,500387223,547808206" />
<link rel='prev' title='Take Action Online' href='http://ran.org/take-action-online/' />
<link rel='canonical' href='http://ran.org/act/<?php echo $a['campaign_slug'] ;?>/' />
<link rel="stylesheet" type="text/css" href="http://online.ran.org/api/salsa_action/share.css" />
<link rel="stylesheet" type="text/css" href="http://online.ran.org/api/salsa_action/topnav.css" />
<!-- local overrides, remove on live
<link rel="stylesheet" type="text/css" href="share.css" />
<link rel="stylesheet" type="text/css" href="topnav.css" />
-->
<?php if ($a['personal_petition'] == 'true'){?>
<style>
.social-share{clear:left;}
.personal_pet_container{float: right; margin: 0 25px 0 0px;}
.petition_taf .email-friends, .petition_taf .facebook-post {
min-height:inherit;
}
</style>
<?php }?>
<title><? echo $a['Title'] ; ?></title>
</head>
<body class="petition_taf page_width930" >
<div id="header">
<div id="ran-banner">
<div class="menu">
<div class="topMenu">
<div class="logoMenu">
<a href="/"><img border="0" src="http://online.ran.org/api/salsa_action/img/ran_logo.png" alt="Rainforest Action Network"></a>
</div>
<!-- <div class="joinUsMenu">
<a href="http://www.facebook.com/rainforestactionnetwork"><img border="0" class="socialNetworkIcon" alt="Facebook" src="img/facebook.png"></a>
<a href="http://twitter.com/#!/ran"><img border="0" class="socialNetworkIcon" alt="Twitter" src="img/twitter.png"></a>
<a href="http://www.youtube.com/user/ranvideo"><img border="0" class="socialNetworkIcon" alt="YouTube" src="img/youtube.png"></a>
<a href="http://www.flickr.com/photos/rainforestactionnetwork"><img border="0" class="socialNetworkIcon" alt="Flickr" src="img/flickr.png"></a>
</div>-->
<!-- <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>
</div>
</div>
</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>
<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>
</div>
<?php } # end thromo?>
</div> <!-- .what-else -->
</div> <!-- .holder -->
<?php if ($a['personal_petition'] == 'false'){
echo '<h1>Tell Your Friends</h1>';
} ?>
<?php if ($a['personal_petition'] == 'true'){ ?>
<div class=" personal_pet_container box" >
<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="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://online.ran.org/api/salsa_action/js/vendor/jquery.ui.widget.js"></script>
<script src="http://online.ran.org/api/salsa_action/js/jquery.iframe-transport.js"></script>
<script src="http://online.ran.org/api/salsa_action/js/jquery.fileupload.js"></script>
<script>
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
var filepath = "http://online.ran.org/api/salsa_action/uploads/files/" + data.files[0].name;
$('#img-preview').html('<img src="' + filepath + '" width="150px">');
$('input#image').val(filepath);
}
});
});
</script>
Supported file types: gif, jpg, png, Max size 2 Mb.
<form action="http://online.ran.org/api/salsa_action/personal_petition.php" method="post">
<input type="hidden" name="image" id="image" 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="http://ran.org/act/<?php echo $a['campaign_slug'] ;?>/p/<?php echo $supporter_KEY; ?>/">
<p>Personal Message:</p>
<textarea name="personal_message"></textarea>
<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>
</select>
<p></p>
<h2>Customize your personalized petition</h2>
<h3>Email Message</h3>
<textarea name="email_message"><?php echo $taf['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="<?php echo $a['personal_petition_emal_trigger_KEYS'] ;?>">
<input type="hidden" name="Email" value="<?php echo $s['Email'] ;?>">
<p></p>
<input type="submit" value="Sign Up" class="submit">
</form>
</div></div>
<div style="clear:both;"></div>
</div>
<?php } ;?>
<div class="social-share box">
<?php if ($a['personal_petition'] == 'true'){
echo '<h1>Tell Your Friends</h1><div id="or">- or -</div>';
} ?>
<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>
<p class="description">
<?php if ($a['share_text']) { echo $a['share_text'];} else { ?> Post a link to Facebook: <?php } ?>
</p>
<!-- <p><?php echo $a['facebook_shares'];?> shares</p> -->
<div style="clear:both;"></div>
<p class="trigger">
<a href="http://www.facebook.com/share.php?u=http://ran.org/act/<?php echo $a['campaign_slug'] ;?>/?t=f&r=<?php echo $supporter_KEY;?>" target="_blank">Post to your wall</a>
</p>
</div></div><!-- .facebook-post -->
<div class="tweet-this box"><div class="box-padder">
<h2>Tweet</h2>
<?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="http://twitter.com/share?url=xxx&text=<?php echo urlencode($a['tweet']); ?>" target="_blank">Tweet this</a></p>
</div></div> <!-- .tweet-this -->
<br />
<div style="clear:both;"></div>
</div>
<div class="share box">
<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%0Ahttp://ran.org/act/<?php echo $a['campaign_slug']; ?>/?t=a&r=<?php echo $supporter_KEY; ?>" >Email your friends</a>
</p>
<p>
Or, copy and paste the text below into an email message:
</p>
<div class="copy-paste" style="height:180px;">
<p><?php echo $taf['Letter_Subject']; ?></p>
<?php echo $taf['Letter_Body']; ?>
<br><br> http://ran.org/act/<?php echo $a['campaign_slug']; ?>/?t=a&r=<?php echo $supporter_KEY; ?>
<br>
</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="http://ran.org/act/<?php echo $a['campaign_slug'] ;?>/?t=v&r=<?php echo $supporter_KEY;?>">
<?php #TO DO add paste buffer button ?>
</div></div> <!-- /copy-link -->
<br />
</div>
<div style="clear:both;"></div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.