Skip to content

Commit

Permalink
Fix post presentation; Fix chart rendering bug; Widen follower count …
Browse files Browse the repository at this point in the history
…chart and show more data points [ci skip]
  • Loading branch information
ginatrapani committed May 19, 2012
1 parent 3c4b737 commit 53e960b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
66 changes: 58 additions & 8 deletions webapp/_lib/view/dashboard.insights.tpl
Expand Up @@ -23,10 +23,60 @@

{if $i->related_data_type eq 'post'}
<br><br>
<div style="background-color:white">
<div class="post">
{if $i->related_data->post_text}
{if $scrub_reply_username}
{if $reply_count && $reply_count > $top_20_post_min}
<div class="reply_text" id="reply_text-{$smarty.foreach.foo.iteration}">
{/if}
{$i->related_data->post_text|filter_xss|regex_replace:"/^@[a-zA-Z0-9_]+/":""|link_usernames_to_twitter}
{if $reply_count && $reply_count > $top_20_post_min}</div>{/if}
{else}
{if $i->related_data->network == 'google+'}
{$i->related_data->post_text}
</div>
<br><br>
{else}
{$i->related_data->post_text|filter_xss|link_usernames_to_twitter}
{/if}
{/if}
{/if}
{if $i->related_data->link->expanded_url}
{if $i->related_data->post_text != ''}<br>{/if}
{if $i->related_data->link->image_src}
<div class="pic" style="float:left;margin-right:5px;margin-top:5px;"><a href="{$i->related_data->link->expanded_url}"><img src="{$i->related_data->link->image_src}" style="margin-bottom:5px;"/></a></div>
{/if}
<span class="small"><a href="{$i->related_data->link->url}" title="{$i->related_data->link->expanded_url}">{if $i->related_data->link->title}{$i->related_data->link->title}{else}{$i->related_data->link->url}{/if}</a>
{if $i->related_data->link->description}<br><small>{$i->related_data->link->description}</small>{/if}</span>
{/if}

{if !$post && $i->related_data->in_reply_to_post_id }
<a href="{$site_root_path}post/?t={$i->related_data->in_reply_to_post_id}&n={$i->related_data->network|urlencode}"><span class="ui-icon ui-icon-arrowthick-1-w" title="reply to..."></span></a>
{/if}

<span class="small gray">
<br clear="all">
<span class="metaroll">
<a href="{$site_root_path}post/?t={$i->related_data->post_id}&n={$i->related_data->network|urlencode}">{$i->related_data->adj_pub_date|relative_datetime} ago</a>
{if $i->related_data->is_geo_encoded < 2}
{if $show_distance}
{if $unit eq 'km'}
{$i->related_data->reply_retweet_distance|number_format} kms away
{else}
{$i->related_data->reply_retweet_distance|number_format} miles away in
{/if}
{/if}
from {$i->related_data->location|truncate:60:' ...'}
{/if}
{if $i->related_data->network == 'twitter'}
<a href="http://twitter.com/intent/tweet?in_reply_to={$i->related_data->post_id}"><span class="ui-icon ui-icon-arrowreturnthick-1-w" title="reply"></a>
<a href="http://twitter.com/intent/retweet?tweet_id={$i->related_data->post_id}"><span class="ui-icon ui-icon-arrowreturnthick-1-e" title="retweet"></a>
<a href="http://twitter.com/intent/favorite?tweet_id={$i->related_data->post_id}"><span class="ui-icon ui-icon-star" title="favorite"></a>
{/if}
</span><br>&nbsp;
</span>

</div>


{/if}

{if $i->related_data_type eq 'follower_count_history'}
Expand All @@ -35,15 +85,15 @@

<script type="text/javascript">
// Load the Visualization API and the standard charts
google.load('visualization', '1');
google.load('visualization', '1.0');
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart{$i->id});
{literal}
var formatter = new google.visualization.NumberFormat({fractionDigits: 0});
var formatter_date = new google.visualization.DateFormat({formatType: 'medium'});
function drawChart{/literal}{$i->id}() {literal}{
{/literal}
var formatter_date = new google.visualization.DateFormat({formatType: 'medium'});
var formatter = new google.visualization.NumberFormat({fractionDigits: 0});
{/literal}
var follower_count_history_data_{$i->id} = new google.visualization.DataTable(
{$i->related_data.vis_data});
formatter.format(follower_count_history_data_{$i->id}, 1);
Expand All @@ -56,7 +106,7 @@
chartType: 'LineChart',
dataTable: follower_count_history_data_{/literal}{$i->id}{literal},
options: {
width: 325,
width: 625,
height: 250,
legend: "none",
interpolateNulls: true,
Expand Down
8 changes: 4 additions & 4 deletions webapp/plugins/twitter/model/class.TwitterCrawler.php
Expand Up @@ -1880,7 +1880,7 @@ public function generateInsights() {
&& $post->all_retweets >= $high_retweet_count_30_days->value) {
$insight_dao->insertInsight('retweet_high_30_day_'.$post->id, $this->instance->id,
$simplified_post_date, "New 30-day high! ".$post->all_retweets." people retweeted your tweet.",
Insight::EMPHASIS_MED, serialize($post));
Insight::EMPHASIS_HIGH, serialize($post));

$insight_dao->deleteInsight('retweet_high_7_day_'.$post->id, $this->instance->id,
$simplified_post_date);
Expand All @@ -1892,7 +1892,7 @@ public function generateInsights() {
&& $post->all_retweets >= $high_retweet_count_7_days->value) {
$insight_dao->insertInsight('retweet_high_7_day_'.$post->id, $this->instance->id, $simplified_post_date,
"New 7-day high! ".$post->all_retweets." people retweeted your tweet.",
Insight::EMPHASIS_MED, serialize($post));
Insight::EMPHASIS_HIGH, serialize($post));

$insight_dao->deleteInsight('retweet_high_30_day_'.$post->id, $this->instance->id,
$simplified_post_date);
Expand Down Expand Up @@ -1965,7 +1965,7 @@ public function generateInsights() {
$follower_count_dao = DAOFactory::getDAO('FollowerCountDAO');
//by week
$follower_count_history_by_week = $follower_count_dao->getHistory($this->instance->network_user_id,
$this->instance->network, 'WEEK', 5);
$this->instance->network, 'WEEK', 15);
if ( isset($follower_count_history_by_week['milestone']) ) {
$insight_text = "Upcoming milestone: ";
$insight_text .= $follower_count_history_by_week['milestone']['will_take'].' week';
Expand All @@ -1988,7 +1988,7 @@ public function generateInsights() {
$follower_count_dao = DAOFactory::getDAO('FollowerCountDAO');
//by month
$follower_count_history_by_month = $follower_count_dao->getHistory($this->instance->network_user_id,
$this->instance->network, 'MONTH', 5);
$this->instance->network, 'MONTH', 15);
if ( isset($follower_count_history_by_month['milestone']) ) {
$insight_text = "Upcoming milestone: ";
$insight_text .= $follower_count_history_by_month['milestone']['will_take'].' month';
Expand Down

0 comments on commit 53e960b

Please sign in to comment.