implemented the "pics in posts" flag globally...it marks the first appearance
of "properties" storage and editing for conferences, communities, users, and the global system. In addition, the "global properties" editing screen got implemented, because it wasn't there yet.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.silverwrist.venice.servlets.format;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
@@ -56,13 +57,15 @@ public class TopicPosts implements JSPRender
|
||||
private String topic_qid;
|
||||
private String cache_locator = null;
|
||||
private HashSet bozo_uids = new HashSet();
|
||||
private Dimension photo_size = null;
|
||||
private HashMap uid_photos = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public TopicPosts(HttpServletRequest request, VeniceEngine engine, CommunityContext comm,
|
||||
public TopicPosts(HttpServletRequest request, VeniceEngine engine, UserContext user, CommunityContext comm,
|
||||
ConferenceContext conf, TopicContext topic, int first, int last, boolean read_new,
|
||||
boolean show_advanced, boolean no_bozos) throws DataException, AccessError
|
||||
{
|
||||
@@ -93,16 +96,38 @@ public class TopicPosts implements JSPRender
|
||||
|
||||
// build up the list of users IN THIS VIEW that are bozo-filtered
|
||||
HashSet saw_users = new HashSet();
|
||||
if (conf.displayPostPictures() && user.displayPostPictures())
|
||||
{ // build up the mapping of UIDs to photo URLs
|
||||
photo_size = engine.getUserPhotoSize();
|
||||
uid_photos = new HashMap();
|
||||
|
||||
} // end if
|
||||
|
||||
Iterator it = messages.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get the user IDs of all messages on this page
|
||||
TopicMessageContext msg = (TopicMessageContext)(it.next());
|
||||
Integer the_uid = new Integer(msg.getCreatorUID());
|
||||
boolean get_photo;
|
||||
if (!(saw_users.contains(the_uid)))
|
||||
{ // only check user IDs once per display operation
|
||||
saw_users.add(the_uid);
|
||||
get_photo = true;
|
||||
if (topic.isBozo(the_uid.intValue()))
|
||||
{ // shall we get the user photo?
|
||||
bozo_uids.add(the_uid);
|
||||
get_photo = no_bozos;
|
||||
|
||||
} // end if
|
||||
|
||||
if (conf.displayPostPictures() && user.displayPostPictures() && get_photo)
|
||||
{ // look up the user photo URL
|
||||
UserProfile prof = user.getProfile(the_uid.intValue());
|
||||
String url = prof.getPhotoURL();
|
||||
if (url!=null)
|
||||
uid_photos.put(the_uid,url);
|
||||
|
||||
} // end else if
|
||||
|
||||
} // end if
|
||||
|
||||
@@ -470,4 +495,24 @@ public class TopicPosts implements JSPRender
|
||||
|
||||
} // end showFilterButton
|
||||
|
||||
public String getUserPhotoTag(int uid, RenderData rdat)
|
||||
{
|
||||
if (photo_size==null)
|
||||
return ""; // user photos not enabled
|
||||
StringBuffer buf = new StringBuffer("<IMG SRC=\"");
|
||||
String url = (String)(uid_photos.get(new Integer(uid)));
|
||||
if (url==null)
|
||||
url = rdat.getFullImagePath("photo_not_avail.gif");
|
||||
buf.append(url).append("\" ALT=\"\" WIDTH=").append(photo_size.width).append(" HEIGHT=");
|
||||
buf.append(photo_size.height).append(" ALIGN=LEFT BORDER=0 HSPACE=2 VSPACE=2>");
|
||||
return buf.toString();
|
||||
|
||||
} // end getUserPhotoTag
|
||||
|
||||
public boolean displayPostPictures()
|
||||
{
|
||||
return (photo_size!=null);
|
||||
|
||||
} // end displayPostPictures
|
||||
|
||||
} // end class TopicPosts
|
||||
|
||||
Reference in New Issue
Block a user