Added .form_repeat notice option to received notices in Realtime plugin
This commit is contained in:
parent
22f02b35ad
commit
80b5a7fe60
|
@ -59,6 +59,7 @@ class RealtimePlugin extends Plugin
|
||||||
{
|
{
|
||||||
$this->replyurl = common_local_url('newnotice');
|
$this->replyurl = common_local_url('newnotice');
|
||||||
$this->favorurl = common_local_url('favor');
|
$this->favorurl = common_local_url('favor');
|
||||||
|
$this->repeaturl = common_local_url('repeat');
|
||||||
// FIXME: need to find a better way to pass this pattern in
|
// FIXME: need to find a better way to pass this pattern in
|
||||||
$this->deleteurl = common_local_url('deletenotice',
|
$this->deleteurl = common_local_url('deletenotice',
|
||||||
array('notice' => '0000000000'));
|
array('notice' => '0000000000'));
|
||||||
|
@ -297,7 +298,7 @@ class RealtimePlugin extends Plugin
|
||||||
|
|
||||||
function _updateInitialize($timeline, $user_id)
|
function _updateInitialize($timeline, $user_id)
|
||||||
{
|
{
|
||||||
return "RealtimeUpdate.init($user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->deleteurl\"); ";
|
return "RealtimeUpdate.init($user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->repeaturl\", \"$this->deleteurl\"); ";
|
||||||
}
|
}
|
||||||
|
|
||||||
function _connect()
|
function _connect()
|
||||||
|
|
|
@ -32,6 +32,7 @@ RealtimeUpdate = {
|
||||||
_userid: 0,
|
_userid: 0,
|
||||||
_replyurl: '',
|
_replyurl: '',
|
||||||
_favorurl: '',
|
_favorurl: '',
|
||||||
|
_repeaturl: '',
|
||||||
_deleteurl: '',
|
_deleteurl: '',
|
||||||
_updatecounter: 0,
|
_updatecounter: 0,
|
||||||
_maxnotices: 50,
|
_maxnotices: 50,
|
||||||
|
@ -40,11 +41,12 @@ RealtimeUpdate = {
|
||||||
_paused:false,
|
_paused:false,
|
||||||
_queuedNotices:[],
|
_queuedNotices:[],
|
||||||
|
|
||||||
init: function(userid, replyurl, favorurl, deleteurl)
|
init: function(userid, replyurl, favorurl, repeaturl, deleteurl)
|
||||||
{
|
{
|
||||||
RealtimeUpdate._userid = userid;
|
RealtimeUpdate._userid = userid;
|
||||||
RealtimeUpdate._replyurl = replyurl;
|
RealtimeUpdate._replyurl = replyurl;
|
||||||
RealtimeUpdate._favorurl = favorurl;
|
RealtimeUpdate._favorurl = favorurl;
|
||||||
|
RealtimeUpdate._repeaturl = repeaturl;
|
||||||
RealtimeUpdate._deleteurl = deleteurl;
|
RealtimeUpdate._deleteurl = deleteurl;
|
||||||
|
|
||||||
RealtimeUpdate._documenttitle = document.title;
|
RealtimeUpdate._documenttitle = document.title;
|
||||||
|
@ -95,6 +97,7 @@ RealtimeUpdate = {
|
||||||
|
|
||||||
SN.U.FormXHR($('#'+noticeItemID+' .form_favor'));
|
SN.U.FormXHR($('#'+noticeItemID+' .form_favor'));
|
||||||
SN.U.NoticeReplyTo($('#'+noticeItemID));
|
SN.U.NoticeReplyTo($('#'+noticeItemID));
|
||||||
|
SN.U.FormXHR($('#'+noticeItemID+' .form_repeat'));
|
||||||
SN.U.NoticeWithAttachment($('#'+noticeItemID));
|
SN.U.NoticeWithAttachment($('#'+noticeItemID));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -150,6 +153,9 @@ RealtimeUpdate = {
|
||||||
if (RealtimeUpdate._userid == data['user']['id']) {
|
if (RealtimeUpdate._userid == data['user']['id']) {
|
||||||
ni = ni+RealtimeUpdate.makeDeleteLink(data['id']);
|
ni = ni+RealtimeUpdate.makeDeleteLink(data['id']);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ni = ni+RealtimeUpdate.makeRepeatForm(data['id'], session_key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ni = ni+"</div>"+
|
ni = ni+"</div>"+
|
||||||
|
@ -179,6 +185,21 @@ RealtimeUpdate = {
|
||||||
return rl;
|
return rl;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
makeRepeatForm: function(id, session_key)
|
||||||
|
{
|
||||||
|
var rf;
|
||||||
|
rf = "<form id=\"repeat-"+id+"\" class=\"form_repeat\" method=\"post\" action=\""+RealtimeUpdate._repeaturl+"\">"+
|
||||||
|
"<fieldset>"+
|
||||||
|
"<legend>Favor this notice</legend>"+
|
||||||
|
"<input name=\"token-"+id+"\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
|
||||||
|
"<input name=\"notice\" type=\"hidden\" id=\"notice-n"+id+"\" value=\""+id+"\"/>"+
|
||||||
|
"<input type=\"submit\" id=\"repeat-submit-"+id+"\" name=\"repeat-submit-"+id+"\" class=\"submit\" value=\"Favor\" title=\"Repeat this notice\"/>"+
|
||||||
|
"</fieldset>"+
|
||||||
|
"</form>";
|
||||||
|
|
||||||
|
return rf;
|
||||||
|
},
|
||||||
|
|
||||||
makeDeleteLink: function(id)
|
makeDeleteLink: function(id)
|
||||||
{
|
{
|
||||||
var dl, delurl;
|
var dl, delurl;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user