diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php
index 5f429cbc9..a50589441 100644
--- a/e107_plugins/forum/forum_class.php
+++ b/e107_plugins/forum/forum_class.php
@@ -57,6 +57,10 @@ $(document).ready(function()
var alertType = 'info';
}
+ if(d.status == 'error')
+ {
+ alertType = 'danger';
+ }
// http://nijikokun.github.io/bootstrap-notify/
@@ -82,7 +86,16 @@ $(document).ready(function()
{
location.reload();
return;
- }
+ }
+
+ if(action == 'track')
+ {
+ if(d.html != false)
+ {
+ $('#'+ insert).html(d.html);
+ // alert(d.html);
+ }
+ }
if(action == 'quickreply' && d.status == 'ok' )
{
@@ -359,8 +372,63 @@ class e107forum
exit;
}
-
-
+
+
+ /**
+ * Process Tracking Enable/disable
+ */
+ public function ajaxTrack()
+ {
+ $ret = array();
+ $ret['status'] = 'error';
+
+ $threadID = intval($_POST['thread']);
+
+ if(!USER || empty($threadID))
+ {
+ exit;
+ }
+
+ $sql = e107::getDb();
+
+ if($sql->select('forum_track', '*', "track_userid=".USERID." AND track_thread=".$threadID))
+ {
+ if($this->track('del', USERID, $threadID))
+ {
+ $ret['html'] = IMAGE_untrack;
+ $ret['msg'] = "You are no longer tracking this thread."; //TODO LAN
+ $ret['status'] = 'ok';
+ }
+ else
+ {
+ $ret['msg'] = 'There was a problem disabling the tracking.'; //TODO LAN
+ $ret['status'] = 'error';
+ }
+
+ }
+ else
+ {
+ if($this->track('add', USERID, $threadID))
+ {
+ $ret['msg'] = "You are now tracking this thread. "; //TODO LAN
+ $ret['html'] = IMAGE_track;
+ $ret['status'] = 'ok';
+ }
+ else
+ {
+ $ret['html'] = IMAGE_untrack;
+ $ret['msg'] = "There was a problem."; //TODO LAN
+ $ret['status'] = 'error';
+ }
+
+
+ }
+
+ echo json_encode($ret);
+
+ exit;
+
+ }
public function ajaxModerate()
@@ -1536,7 +1604,6 @@ class e107forum
function track($which, $uid, $threadId, $force=false)
{
- $e107 = e107::getInstance();
$sql = e107::getDb();
if ($this->prefs->get('track') != 1 && !$force) { return false; }
diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php
index 849b41c6b..ed285087e 100644
--- a/e107_plugins/forum/forum_viewtopic.php
+++ b/e107_plugins/forum/forum_viewtopic.php
@@ -69,15 +69,25 @@ if(vartrue($_GET['id']) && isset($_GET['dl']))
exit;
}
-if(e_AJAX_REQUEST && varset($_POST['action']) == 'quickreply')
+if(e_AJAX_REQUEST)
{
- $forum->ajaxQuickReply();
-}
-
-if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
-{
- $forum->ajaxModerate();
+ if(varset($_POST['action']) == 'quickreply')
+ {
+ $forum->ajaxQuickReply();
+ }
+
+ if(varset($_POST['action']) == 'track')
+ {
+ $forum->ajaxTrack();
+ }
+
+ if(MODERATOR)
+ {
+ $forum->ajaxModerate();
+ }
+
}
+
if (isset($_GET['last']))
{
@@ -91,11 +101,15 @@ if(isset($_GET['f']) && $_GET['f'] == 'post')
$thread->init();
+
+/*
if(isset($_POST['track_toggle']))
{
$thread->toggle_track();
exit;
-}
+}*/
+
+
if(!empty($_GET['f']))
{
@@ -251,11 +265,15 @@ $tVars->NEXTPREV .= "threadInfo['track_userid'] ? IMAGE_track : IMAGE_untrack);
+
+/*
$url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call
- //FIXME
- /*$tVars->TRACK .= "
+
+ $url = e107::url('forum','index');
+
+ $tVars->TRACK .= "
- {$img}
+ {$img}
";*/
+ $tVars->TRACK = "".$img."
+";
+
}
@@ -754,7 +775,7 @@ class e107ForumThread
$this->noInc = false;
}
-
+/*
function toggle_track()
{
@@ -778,6 +799,7 @@ class e107ForumThread
exit();
}
}
+*/
/**
* @return bool|null|string|void
diff --git a/e107_plugins/forum/languages/English/English_front.php b/e107_plugins/forum/languages/English/English_front.php
index d0c52001e..c7f005ab2 100644
--- a/e107_plugins/forum/languages/English/English_front.php
+++ b/e107_plugins/forum/languages/English/English_front.php
@@ -214,7 +214,7 @@ define("LAN_FORUM_3026", "Post topic as"); // LAN_400 (p)
define("LAN_FORUM_3028", "Add Poll"); // new // poll - partly in e107_plugins/poll/poll_class.php
define("LAN_FORUM_3038", "Normal"); // LAN_1
define("LAN_FORUM_3039", "Deactivate emoticons for this post"); // LAN_FORUMPOST_EMOTES
-define("LAN_FORUM_3040", "Enable email tracking (email sent when reply is posted)"); // LAN_380
+define("LAN_FORUM_3040", "Enable/disable email tracking (email sent when reply is posted)"); // LAN_380
// missing 41-21
// forum_posted_template
diff --git a/e107_plugins/forum/templates/forum_icons_template.php b/e107_plugins/forum/templates/forum_icons_template.php
index d87017f3e..787c3c35e 100644
--- a/e107_plugins/forum/templates/forum_icons_template.php
+++ b/e107_plugins/forum/templates/forum_icons_template.php
@@ -32,6 +32,9 @@ define('IMAGE_announce', $tp->toGlyph('fa-bullhorn', 'size=2x'));
define('IMAGE_announce_small', $tp->toGlyph('fa-bullhorn'));
define('IMAGE_closed_small', $tp->toGlyph('fa-lock'));
define('IMAGE_closed', $tp->toGlyph('fa-lock', 'size=2x'));
+
+define('IMAGE_track', $tp->toGlyph('fa-bell'));
+define('IMAGE_untrack', $tp->toGlyph('fa-bell-o'));
} else {
@@ -54,6 +57,9 @@ define('IMAGE_announce_small', '');
define('IMAGE_closed', '
');
+define('IMAGE_track', '
');
+define('IMAGE_untrack', '
');
+
}
// User info
@@ -65,8 +71,7 @@ define('IMAGE_profile', '
');
define('IMAGE_edit', '
');
define('IMAGE_quote', '
');
-define('IMAGE_track', '
');
-define('IMAGE_untrack', '
');
+
define('IMAGE_admin_edit', '
');
define('IMAGE_admin_move', '
');
define('IMAGE_admin_split', '
');
diff --git a/e107_plugins/forum/templates/forum_viewtopic_template.php b/e107_plugins/forum/templates/forum_viewtopic_template.php
index dd06ebe74..9a5dc1018 100644
--- a/e107_plugins/forum/templates/forum_viewtopic_template.php
+++ b/e107_plugins/forum/templates/forum_viewtopic_template.php
@@ -317,7 +317,7 @@ $FORUM_VIEWTOPIC_TEMPLATE['start'] = "