New ILX functions - can I hide them?

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (80 of them)

To tell the truth, this site is way harder than it should be to style, because even the standard elements of it are couched inside of older, crappier elements... like the the list on any new answers page, which works as a <ul> kind of list, but only if you pay careful attention to the like four other nested <span>s inside of each of those... it's pretty crazy.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 10:24 (fourteen years ago) link

The site is filled with <span> element tags, and really there should be little reason to use that tag at all.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 10:25 (fourteen years ago) link

Well as I say, don't know much about CSS and so on. I presume you mean that instead of using SPANs that you just style whatever it is (e.g. a link). I think some of the SPANs are used where there is no other thing, but the real reason is just that HTML/CSS was never anything I knew much about.

Keith, Thursday, 6 August 2009 10:28 (fourteen years ago) link

To take the New Answers page as an example, each thread title should be the <li> part of the list, with of course an <a> element to link it, and all the meta data could be part of a single <span> element, and most of the elements currently inside of the <span> that is there now could be dropped, because from looking at the output now, there's wayyy too much happening inside there. There are a lot of tags that aren't referring to anything.

I don't have any idea what the php looks like, mind you.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 10:38 (fourteen years ago) link

Actually, looking at it again, the biggest thing that bugs me is that each <li> is wrapped in a <div class="thread">, which should never happen.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 10:44 (fourteen years ago) link

There's no PHP - it's all written in Java.

What should happen? Do you mean the <li> should have class with the styling applied to it?


package com.conversationboard.view;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.joda.time.DateTimeZone;
import org.joda.time.MutableDateTime;

import com.conversationboard.cache.newanswers.NewAnswersThread;
import com.conversationboard.config.Configuration;
import com.conversationboard.formatter.DateFormatter;
import com.conversationboard.model.Board;
import com.conversationboard.model.Boards;
import com.conversationboard.model.Role;
import com.conversationboard.model.User;
import com.conversationboard.model.preferences.SiteNewPostsViewInfo;

public class ThreadListDisplay {

public static String display(Board board, List<NewAnswersThread> threads, String userId, OrderedBy orderedBy) throws SQLException {

StringBuilder buffer = new StringBuilder();
boolean isSiteNewPosts = (board == null);
Date today = new Date();

User user = User.get(userId);
Role role = user.getRole();
boolean admin = false;

Map<Integer, SiteNewPostsViewInfo> viewInfo = null;

if (isSiteNewPosts && user.isLoggedIn()) {
viewInfo = user.getPreferences().getSiteNewPostsViewInfo();
}

if ((role == Role.SiteAdmin) || ((!isSiteNewPosts) && user.isBoardAdmin(board.getBoardId()))) {
admin = true;
}

buffer.append("<ul>");

MutableDateTime date = new MutableDateTime(new Date());

for (NewAnswersThread thread : threads) {

Board threadBoard = Boards.getBoard(thread.getBoardId());

if (threadBoard.isPrivateBoard() && (!user.isMemberOfBoard(threadBoard.getBoardId()))) {
continue;
}

MutableDateTime threadDate;

if ((orderedBy == OrderedBy.LAST_UPDATED) || (orderedBy == OrderedBy.ALPHABETICAL)) {
threadDate = new MutableDateTime(thread.getLastUpdated());
} else {
threadDate = new MutableDateTime(thread.getTimestamp());
}

threadDate.setZone(DateTimeZone.forTimeZone(user.getPreferences().getTimeZone()));

int day = threadDate.getDayOfMonth();

/* Don't display the date change notifier if they're alphabetically ordered as it won't make sense */

if ((date.getDayOfMonth() != day) && (orderedBy != OrderedBy.ALPHABETICAL)) {
buffer.append("<h3>Last on " + DateFormatter.prettyPrint(threadDate.toDate(), user) + "</h3>");
}

date = threadDate;

if (thread.isDeleted() && (!admin)) {
continue;
}

if (user.getPreferences().isHidePolls() && thread.isPoll()) {
continue;
}

/* Display Site New Answers in colours, and potentially skip this thread, if you've decided that way in preferences */

String colourOverrideStyle = "";

if (isSiteNewPosts && user.isLoggedIn()) {
if (viewInfo != null) {
SiteNewPostsViewInfo info = viewInfo.get(thread.getBoardId());

if (info != null) {

if (info.isHide()) {
continue;
}

if (!info.getColour().equals("")) {
colourOverrideStyle = "style='color: " + info.getColour() + "'";
}

}
}
}

buffer.append("<div class='thread'>");

/* Display an empty bullet if the thread has posts since you last looked at it, or if you've never looked at it at all (latest message ID will be 0) */

if (user.isLoggedIn()) {

int latestMessageId = user.getMostRecentMessageId(thread.getBoardId(), thread.getThreadId());

if ((thread.getLatestMessageId() > latestMessageId) && (latestMessageId != 0)) {
buffer.append("<li class=\"updated\">");
} else {
buffer.append("<li>");
}

} else {
buffer.append("<li>");
}

if (thread.isUnanswered()) {
buffer.append("<span class='unansweredthread'>");
}

if (thread.isDeleted()) {
if (!admin) {
continue;
} else {
buffer.append("<span class='deletedthread'>");
}
}

if (thread.isLocked()) {
buffer.append("[LOCKED] ");
}

if (!thread.isWorksafe()) {
buffer.append("<span class='notworksafe'>[NOT WORKSAFE] ");
}

buffer.append("<a " + colourOverrideStyle + " href='" + Configuration.getInstance().getRoot() + "/ThreadSelectedControllerServlet?boardid=");
buffer.append(thread.getBoardId());
buffer.append("&threadid=");
buffer.append(thread.getThreadId());
buffer.append("#unread'>");
buffer.append(thread.getTitle());
buffer.append("</a>");

if (!user.getPreferences().isHideThreadInfo()) {

SimpleDateFormat formatter = new SimpleDateFormat("MMMMMMMM yyyy");
String year = formatter.format(thread.getTimestamp());

buffer.append(" <span class=\"threaddata\">[Started by ");
buffer.append(thread.getCreatorId());
buffer.append(" in " + year);
buffer.append(", last updated ");
buffer.append(DateFormatter.prettyPrintTime(thread.getLastUpdated(), user, false, true));

if (!user.getPreferences().isHideLastUpdatedBy()) {

if ((thread.getLastUpdatedByDisplayName() != null) && (!thread.getLastUpdatedByDisplayName().trim().equals(""))) {
buffer.append(" by <span class='threadlu'>");
buffer.append(thread.getLastUpdatedByDisplayName());
buffer.append("</span>");
}
}

if (isSiteNewPosts) {
buffer.append(" on <span class='threadlu'><a href='http://"; + Configuration.getInstance().getDomainName() + Configuration.getInstance().getRoot() + "/NewAnswersControllerServlet?boardid=" + threadBoard.getBoardId() + "'>" + threadBoard.getName() + "</a></span>");
}

buffer.append("]</span>");
}

int recentMessages = thread.getNumberOfRecentMessages();

if (recentMessages > 0) {
buffer.append(" <em><span class='threadlu'>");
buffer.append(recentMessages);

if (recentMessages == 1) {
buffer.append(" new answer");
} else {
buffer.append(" new answers");
}

}

buffer.append("</em></span>");

if (thread.isPoll()) {
SimpleDateFormat formatter = new SimpleDateFormat("MMMMMMMM dd");
if (!thread.getPollClosingDate().before(new Date())) {
buffer.append(" <span class='pollthread'>POLL closes: " + formatter.format(thread.getPollClosingDate()) + " (in " + DateFormatter.prettyPrintFutureTime(thread.getPollClosingDate(), today, user.getPreferences().getTimeZone()) + ")</span> ");
} else {
buffer.append(" <span class='pollthread'>POLL results</span> ");
}
}

if (thread.isDeleted()) {
buffer.append("</span>");
}

if (!thread.isWorksafe()) {
buffer.append("</span>");
}

if (thread.isUnanswered()) {
buffer.append("</span>");
}

/* If you're a site admin, or you administer this board, then display the admin links */

if (admin) {
buffer.append("<br />");
ThreadListAdminLinksDisplay.includeAdminLinks(buffer, thread.getBoardId(), thread.getThreadId(), user, "adminlinks", "adminlink");
}

buffer.append("</li></div>");
}

buffer.append("</ul>");

return buffer.toString();

}

}

Keith, Thursday, 6 August 2009 10:48 (fourteen years ago) link

i think the spans inside the links should be kept, separating out the various bits (thread starter name, last poster name, etc) could be useful.

ledge, Thursday, 6 August 2009 10:53 (fourteen years ago) link

the <li> should have class with the styling applied to it?

ideally, yes. you can have multiple classes, space separated, so <li class="thread updated"> would be ok.

ledge, Thursday, 6 August 2009 10:55 (fourteen years ago) link

Oh I didn't know that...

Keith, Thursday, 6 August 2009 10:56 (fourteen years ago) link

That <em> in there probably isn't the greatest either. Though most of this got written about four years ago.

Keith, Thursday, 6 August 2009 10:57 (fourteen years ago) link

sub menu, site new answers/home/boards pages:

Site New Questions My Recent Posts Customise View

I'd definitely be for moving these functions from the main menu, as I never use them. Are there many folks who do? I never use the "blog view" thing either, but apparently some people favour that? Anyway, if you have several bookmarked boards, the top menu can become quite cluttered, for me it's almost two full rows. So I think it would be nice if the main menu would only have the essential functions (board boomarks, New Question/Poll, Site New Answers, Search, Bookmarks, Logout, and Admin), and everything else would either be in a side menu, or they could be made invisible via preferences.

Tuomas, Thursday, 6 August 2009 11:06 (fourteen years ago) link

The menu should be much cleaner, more like:

<div class="menubar">
<ul>
<li><a title="Display all etc" href="/ILX/SiteNewAnswersControllerServlet">Site New Answers</a></li>
<li><a href="/ILX/Pages/Search/search.jsp">Search</a></li>
<li><a href="/ILX/index.jsp">Boards</a></li>
<li><a href="/ILX/PrePreferencesControllerServlet">Preferences</a></li>
<li><a href="/ILX/BookmarksControllerServlet">Bookmarks</a></li>
</ul>
</div>

And etc. (This is shortened for practicality, not content.) The class "menubar" that is applied to each of these "a" tags currently doesn't refer to anything that's not already covered elsewhere, or couldn't be much more efficiently by simply applying that style to the element called ".menubar li a".

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 11:07 (fourteen years ago) link

buffer.append("<div class='thread'>");

Tell that buffer to stop appending that. It's adding zero.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 11:10 (fourteen years ago) link

Ledge is right, though, the spans that are separating and defining the various parts of the metadata... yeah. Those are useful, or might be useful at some point, especially for xhtml and rss purposes. Anyway that aren't hurting anything. The trouble is that some of them are carrying weight, which spans don't really do... oh it's so late.

Black bread and Victory gin AGAIN? (kenan), Thursday, 6 August 2009 11:17 (fourteen years ago) link

there s to b a couple of new functions on ilx.... just wanted to ask about it.

― estela, Thursday, August 6, 2009 2:47 AM (5 hours ago)

n/l

joeks, bruv will tear us apart (k3vin k.), Thursday, 6 August 2009 12:11 (fourteen years ago) link

I like the "my recent posts" feature -- it's likely that I'll post to a thread and then totally forget what it's called a couple weeks later when I wonder whether anything has happened on that thread.

Yeah, that's what I use it for, though hours not weeks. I like it a lot. "What have I posted on lately and has any of it made anyone call me a jerk?"

Is there any way - sorry if it actually already does this, or if the lookups would be a terrible resource-drain - it could mark which of the posts are on threads which have been replied to since you looked?

a passing spacecadet, Thursday, 6 August 2009 12:31 (fourteen years ago) link

I like the "my recent posts" feature -- it's likely that I'll post to a thread and then totally forget what it's called a couple weeks later when I wonder whether anything has happened on that thread.

Isn't this what bookmarks are for?

Tuomas, Thursday, 6 August 2009 12:38 (fourteen years ago) link

bookmarks are too too much. i don't want in-yer-face notifications every time every thread i post to gets updated.

ledge, Thursday, 6 August 2009 12:56 (fourteen years ago) link

too too - unintentional use of double intensifier

ledge, Thursday, 6 August 2009 12:57 (fourteen years ago) link

But the "My Recent Posts" thing doesn't tell you when a thread has been updated. It only shows your recent posts, not the posts that might've followed them.

Tuomas, Thursday, 6 August 2009 13:07 (fourteen years ago) link

Still think Keith should just refuse to implement some features (not even as a preference), but if not then perhaps these new features (and all the menu items in fact) should each have a unique class name (e.g.

menu-myrecentposts
,
menu-sortalpha
or whatever) to allow stylesheet writers to
display: none
them.

caek, Thursday, 6 August 2009 13:11 (fourteen years ago) link

(also code should perhaps apply the html code tag, not the pre one so things like that don't happen!)

caek, Thursday, 6 August 2009 13:12 (fourteen years ago) link

Yeah, that's what I use it for, though hours not weeks. I like it a lot. "What have I posted on lately and has any of it made anyone call me a jerk?"

I can see it being useful for "How drunk was I last night?" analysis.

stop me if you think that you've heard this (onimo), Thursday, 6 August 2009 20:31 (fourteen years ago) link

I like that the 'site new answer' is on the bottom of the page!

Le présent se dégrade, d'abord en histoire, puis en (Michael White), Thursday, 6 August 2009 20:34 (fourteen years ago) link

I find my recent posts nifty, fwiw. Its a nice simple reminder of threads you've been active on without having to recieve constant updates in any other form. Its controllable, y'kin?

And Kenan, <3 you darl but you shot yourself in the foot asking why the alph feature's right up top, when you missed site answers and the point thereof: if new features werent in peoples faces most people wouldn't know to use them maybe.

Hmm actually: what about a "new features!" link instead that bolds up when Keith's added new things? S'just a thought.

My boss say I can't not do this (Trayce), Monday, 10 August 2009 00:02 (fourteen years ago) link

Oh wow, "My Recent Posts" is gonna be totally awesome the next time I get so drunk I can't remember what I did the night before.

AND I KNOW THE NEIGHBORS HATE ME NOW (Noodle Vague), Monday, 10 August 2009 00:04 (fourteen years ago) link

Its funny because its true ;_; (for me)

My boss say I can't not do this (Trayce), Monday, 10 August 2009 00:05 (fourteen years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.