From f20fe4b1aa6bdd3de786f42aad887e52b5f37067 Mon Sep 17 00:00:00 2001 From: Git Date: Fri, 6 Jul 2012 08:00:11 +0000 Subject: [PATCH] Empty commit --- sections/ajax/forum/thread.php | 1 + sections/ajax/inbox/viewconv.php | 1 + sections/ajax/info.php | 32 ++++++++++++++++++++++++++++++-- sections/ajax/tcomments.php | 1 + static/functions/global.js | 21 +++++++++++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index 10ccbaa1..ccf4b279 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -221,6 +221,7 @@ $JsonPosts[] = array( 'postId' => (int) $PostID, 'addedTime' => $AddedTime, + 'bbBody' => $Body, 'body' => $Text->full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, diff --git a/sections/ajax/inbox/viewconv.php b/sections/ajax/inbox/viewconv.php index 67862840..7e5a4887 100644 --- a/sections/ajax/inbox/viewconv.php +++ b/sections/ajax/inbox/viewconv.php @@ -71,6 +71,7 @@ 'senderId' => (int) $SenderID, 'senderName' => $Users[(int)$SenderID]['Username'], 'sentDate' => $SentDate, + 'bbBody' => $Body, 'body' => $Text->full_format($Body) ); $JsonMessages[] = $JsonMessage; diff --git a/sections/ajax/info.php b/sections/ajax/info.php index 5c2a6e77..62328b7d 100644 --- a/sections/ajax/info.php +++ b/sections/ajax/info.php @@ -47,6 +47,32 @@ } } +// News +$MyNews = $LoggedUser['LastReadNews']; +$CurrentNews = $Cache->get_value('news_latest_id'); +if ($CurrentNews === false) { + $DB->query("SELECT ID FROM news ORDER BY Time DESC LIMIT 1"); + if ($DB->record_count() == 1) { + list($CurrentNews) = $DB->next_record(); + } else { + $CurrentNews = -1; + } + $Cache->cache_value('news_latest_id', $CurrentNews, 0); +} + +// Blog +$MyBlog = $LoggedUser['LastReadBlog']; +$CurrentBlog = $Cache->get_value('blog_latest_id'); +if ($CurrentBlog === false) { + $DB->query("SELECT ID FROM blog WHERE Important = 1 ORDER BY Time DESC LIMIT 1"); + if ($DB->record_count() == 1) { + list($CurrentBlog) = $DB->next_record(); + } else { + $CurrentBlog = -1; + } + $Cache->cache_value('blog_latest_id', $CurrentBlog, 0); +} + print json_encode( array( 'status' => 'success', @@ -57,7 +83,9 @@ 'passkey'=> $LoggedUser['torrent_pass'], 'notifications' => array( 'messages'=> (int) $NewMessages, - 'notifications' => (int) $NewNotifications + 'notifications' => (int) $NewNotifications, + 'newAnnouncement' => $MyNews < $CurrentNews, + 'newBlog' => $MyBlog < $CurrentBlog ), 'userstats' => array( 'uploaded' => (int) $LoggedUser['BytesUploaded'], @@ -65,7 +93,7 @@ 'ratio' => (float) $Ratio, 'requiredratio' => (float) $LoggedUser['RequiredRatio'], 'class' => $ClassLevels[$LoggedUser['Class']]['Name'] - ), + ) ) ) ); diff --git a/sections/ajax/tcomments.php b/sections/ajax/tcomments.php index f086dfb9..cdff9c73 100644 --- a/sections/ajax/tcomments.php +++ b/sections/ajax/tcomments.php @@ -62,6 +62,7 @@ $JsonComments[] = array( 'postId' => (int) $PostID, 'addedTime' => $AddedTime, + 'bbBody' => $Body, 'body' => $Text->full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, diff --git a/static/functions/global.js b/static/functions/global.js index 18f7bf9a..9f40d19f 100644 --- a/static/functions/global.js +++ b/static/functions/global.js @@ -8,11 +8,23 @@ function toggleChecks(formElem,masterElem) { } //Lightbox stuff + +/* + * If loading from a thumbnail the lightbox is shown first with a "loading" screen + * while the full size image loads, then the html of the lightbox is replaced with the image. + */ + var lightbox = { init: function (image, size) { if(typeof(image)=='string') { + $('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML = + '

Loading...

'; + $('#curtain').show().listen('click',lightbox.unbox); var src = image; image = new Image(); + image.onload = function() { + lightbox.box_async(image); + } image.src = src; } if (image.naturalWidth === undefined) { @@ -36,6 +48,15 @@ var lightbox = { $('#curtain').show().listen('click',lightbox.unbox); } }, + box_async: function (image) { + var hasA = false; + if(image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') { + hasA = true; + } + if(!hasA) { + $('#lightbox').raw().innerHTML = ''; + } + }, unbox: function (data) { $('#curtain').hide(); $('#lightbox').hide().raw().innerHTML = '';