inReplyTo: '',
oldestId: null,
newestId: null,
+ instanceid: null,
/**
* Const'r
* opts.strings.defaultText
* opts.strings.justnow
* opts.getmore
+ * opts.instanceid
*/
initialize: function(opts) {
this.opts = Object.extend({
e.stop();
}.bind(this));
+ this.instanceid = opts.instanceid;
/* Get the first page */
this.getNewEntries();
},
* @param integer page The page number to retrieve.
*/
getOlderEntries: function() {
- var params = { actionID: 'getPage' };
+ var params = {
+ actionID: 'getPage',
+ i: this.instanceid
+ };
+
if (this.oldestId) {
params.max_id = this.oldestId;
}
* request.
*/
getNewEntries: function() {
- var params = { actionID: 'getPage' };
+ var params = {
+ actionID: 'getPage',
+ i: this.instanceid
+ };
+
if (this.newestId) {
params.since_id = this.newestId;
} else {
}
/* Get a unique ID in case we have multiple Twitter blocks. */
- $instance = md5(mt_rand());
+ $instance = (string)new Horde_Support_Randomid();
/* Latest status */
if (empty($this->_profile->status)) {
$script = <<<EOT
var Horde = window.Horde || {};
Horde.twitter{$instance} = new Horde_Twitter({
+ instanceid: '{$instance}',
getmore: 'getmore{$instance}',
input: '{$instance}_newStatus',
spinner: '{$instance}_loading',
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
+ * @author Michael J. Rubinsky <mrubinsk.horde.org>
+ * @package @horde
*/
require_once dirname(__FILE__) . '/../lib/Application.php';
} elseif ($since = Horde_Util::getPost('since_id')) {
$params['since_id'] = $since;
}
-
+ $instance = Horde_Util::getPost('i');
$stream = Horde_Serialize::unserialize($twitter->statuses->homeTimeline($params), Horde_Serialize::JSON);
} catch (Horde_Service_Twitter_Exception $e) {
echo sprintf(_("Unable to contact Twitter. Please try again later. Error returned: %s"), $e->getMessage());
$view->createdAt = $tweetObj->created_at;
$view->clientText = $filter->filter($tweet->source, 'xss');
$view->tweet = $tweet;
+ $view->instanceid = $instance;
$oldest = $tweet->id;
$html .= $view->render('twitter_tweet');
}
* ->createdAt
* ->clientName
* ->tweet
+ * ->instanceid
*
*/
?>
</div>
<?php endif; ?>
<div class="fbstreaminfo">
- <?php echo Horde::link('#', '', '', '', 'Horde.twitter.buildReply(\'' . $this->tweet->id . '\', \'' . $this->tweet->user->screen_name . '\', \'' . $this->tweet->user->name . '\')') . _("Reply") ?></a>
- | <?php echo Horde::link('#', '', '', '', 'Horde.twitter.retweet(\'' . $this->tweet->id . '\')') . _("Retweet") ?></a>
+ <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde.' . $this->instanceid . '.buildReply(\'' . $this->tweet->id . '\', \'' . $this->tweet->user->screen_name . '\', \'' . $this->tweet->user->name . '\'); return false;')) . _("Reply") ?></a>
+ | <?php echo Horde::selfUrl()->link(array('onclick' => 'Horde.twitter' . $this->instanceid . '.retweet(\'' . $this->tweet->id . '\'); return false;')) . _("Retweet") ?></a>
</div>
<div class="clear"> </div>
</div>