added "sticky" topic facility to cause topics to always float at the top of
the topic list when it's set
This commit is contained in:
@@ -49,158 +49,158 @@ public interface ConferenceContext
|
||||
public static final int IMPORT_MATCH_NUM = 0;
|
||||
public static final int IMPORT_MATCH_NAME = 1;
|
||||
|
||||
public abstract int getConfID();
|
||||
public int getConfID();
|
||||
|
||||
public abstract String getName();
|
||||
public String getName();
|
||||
|
||||
public abstract String getDescription();
|
||||
public String getDescription();
|
||||
|
||||
public abstract Date getCreationDate();
|
||||
public Date getCreationDate();
|
||||
|
||||
public abstract Date getLastUpdateDate();
|
||||
public Date getLastUpdateDate();
|
||||
|
||||
public abstract List getAliases() throws DataException;
|
||||
public List getAliases() throws DataException;
|
||||
|
||||
public abstract List getHosts() throws DataException;
|
||||
public List getHosts() throws DataException;
|
||||
|
||||
public abstract boolean canReadConference();
|
||||
public boolean canReadConference();
|
||||
|
||||
public abstract boolean canPostToConference();
|
||||
public boolean canPostToConference();
|
||||
|
||||
public abstract boolean canCreateTopic();
|
||||
public boolean canCreateTopic();
|
||||
|
||||
public abstract boolean canChangeConference();
|
||||
public boolean canChangeConference();
|
||||
|
||||
public abstract int getReadLevel() throws DataException, AccessError;
|
||||
public int getReadLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getPostLevel() throws DataException, AccessError;
|
||||
public int getPostLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getCreateLevel() throws DataException, AccessError;
|
||||
public int getCreateLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getHideLevel() throws DataException, AccessError;
|
||||
public int getHideLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getNukeLevel() throws DataException, AccessError;
|
||||
public int getNukeLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getChangeLevel() throws DataException, AccessError;
|
||||
public int getChangeLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract int getDeleteLevel() throws DataException, AccessError;
|
||||
public int getDeleteLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract void setSecurityLevels(int read, int post, int create, int hide, int nuke,
|
||||
int change, int delete) throws DataException, AccessError;
|
||||
|
||||
public abstract void setName(String val) throws DataException, AccessError;
|
||||
|
||||
public abstract void setDescription(String val) throws DataException, AccessError;
|
||||
|
||||
public abstract void addAlias(String alias) throws DataException, AccessError;
|
||||
|
||||
public abstract void removeAlias(String alias) throws DataException, AccessError;
|
||||
|
||||
public abstract void setMembership(int uid, int grant_level) throws DataException, AccessError;
|
||||
|
||||
public abstract void addMember(int uid, boolean as_host) throws DataException, AccessError;
|
||||
|
||||
public abstract void removeMember(int uid) throws DataException, AccessError;
|
||||
|
||||
public abstract int getCommunityGrantedLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract void setCommunityGrantedLevel(int new_level) throws DataException, AccessError;
|
||||
|
||||
public abstract short getSequence() throws DataException, AccessError;
|
||||
|
||||
public abstract void setSequence(short seq) throws DataException, AccessError;
|
||||
|
||||
public abstract boolean getHideList() throws DataException, AccessError;
|
||||
|
||||
public abstract void setHideList(boolean flag) throws DataException, AccessError;
|
||||
|
||||
public abstract boolean canSetHideList();
|
||||
|
||||
public abstract String getDefaultPseud();
|
||||
|
||||
public abstract void setDefaultPseud(String val) throws DataException;
|
||||
|
||||
public abstract boolean anyUnread();
|
||||
|
||||
public abstract List getTopicList(int get_option, int sort_option) throws DataException, AccessError;
|
||||
|
||||
public abstract TopicContext getTopic(short number) throws DataException, AccessError;
|
||||
|
||||
public abstract TopicContext addTopic(String title, String zp_pseud, String zp_text)
|
||||
public void setSecurityLevels(int read, int post, int create, int hide, int nuke, int change, int delete)
|
||||
throws DataException, AccessError;
|
||||
|
||||
public abstract TopicMessageContext getMessageByPostID(long postid) throws DataException, AccessError;
|
||||
public void setName(String val) throws DataException, AccessError;
|
||||
|
||||
public abstract HTMLChecker getNewTopicPreviewChecker();
|
||||
public void setDescription(String val) throws DataException, AccessError;
|
||||
|
||||
public abstract void fixSeen() throws DataException, AccessError;
|
||||
public void addAlias(String alias) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters(int skip, int limit) throws DataException, AccessError;
|
||||
public void removeAlias(String alias) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters(int limit) throws DataException, AccessError;
|
||||
public void setMembership(int uid, int grant_level) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters() throws DataException, AccessError;
|
||||
public void addMember(int uid, boolean as_host) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders(int skip, int limit) throws DataException, AccessError;
|
||||
public void removeMember(int uid) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders(int limit) throws DataException, AccessError;
|
||||
public int getCommunityGrantedLevel() throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders() throws DataException, AccessError;
|
||||
public void setCommunityGrantedLevel(int new_level) throws DataException, AccessError;
|
||||
|
||||
public abstract List getMemberList() throws DataException, AccessError;
|
||||
public short getSequence() throws DataException, AccessError;
|
||||
|
||||
public abstract int getMemberLevel(int uid) throws DataException, AccessError;
|
||||
public void setSequence(short seq) throws DataException, AccessError;
|
||||
|
||||
public abstract void delete() throws DataException, AccessError;
|
||||
public boolean getHideList() throws DataException, AccessError;
|
||||
|
||||
public abstract void deleteConference() throws DataException, AccessError;
|
||||
public void setHideList(boolean flag) throws DataException, AccessError;
|
||||
|
||||
public abstract boolean canDeleteConference();
|
||||
public boolean canSetHideList();
|
||||
|
||||
public abstract boolean isInHotlist();
|
||||
public String getDefaultPseud();
|
||||
|
||||
public abstract void addToHotlist() throws DataException;
|
||||
public void setDefaultPseud(String val) throws DataException;
|
||||
|
||||
public abstract boolean canAddToHotlist();
|
||||
public boolean anyUnread();
|
||||
|
||||
public abstract CommunityContext getEnclosingCommunity();
|
||||
public List getTopicList(int get_option, int sort_option, boolean ignore_sticky) throws DataException, AccessError;
|
||||
|
||||
public abstract void removeFromHotlist() throws DataException;
|
||||
public List getTopicList(int get_option, int sort_option) throws DataException, AccessError;
|
||||
|
||||
public abstract void setHotlistSequence(int seq) throws DataException;
|
||||
public TopicContext getTopic(short number) throws DataException, AccessError;
|
||||
|
||||
public abstract boolean displayPostPictures();
|
||||
public TopicContext addTopic(String title, String zp_pseud, String zp_text) throws DataException, AccessError;
|
||||
|
||||
public abstract ConferenceProperties getProperties() throws DataException, AccessError;
|
||||
public TopicMessageContext getMessageByPostID(long postid) throws DataException, AccessError;
|
||||
|
||||
public abstract void setProperties(ConferenceProperties props) throws DataException, AccessError;
|
||||
public HTMLChecker getNewTopicPreviewChecker();
|
||||
|
||||
public abstract SecurityInfo getSecurityInfo();
|
||||
public void fixSeen() throws DataException, AccessError;
|
||||
|
||||
public abstract void sendInvitation(String address, String personal_message)
|
||||
public List getActivePosters(int skip, int limit) throws DataException, AccessError;
|
||||
|
||||
public List getActivePosters(int limit) throws DataException, AccessError;
|
||||
|
||||
public List getActivePosters() throws DataException, AccessError;
|
||||
|
||||
public List getActiveReaders(int skip, int limit) throws DataException, AccessError;
|
||||
|
||||
public List getActiveReaders(int limit) throws DataException, AccessError;
|
||||
|
||||
public List getActiveReaders() throws DataException, AccessError;
|
||||
|
||||
public List getMemberList() throws DataException, AccessError;
|
||||
|
||||
public int getMemberLevel(int uid) throws DataException, AccessError;
|
||||
|
||||
public void delete() throws DataException, AccessError;
|
||||
|
||||
public void deleteConference() throws DataException, AccessError;
|
||||
|
||||
public boolean canDeleteConference();
|
||||
|
||||
public boolean isInHotlist();
|
||||
|
||||
public void addToHotlist() throws DataException;
|
||||
|
||||
public boolean canAddToHotlist();
|
||||
|
||||
public CommunityContext getEnclosingCommunity();
|
||||
|
||||
public void removeFromHotlist() throws DataException;
|
||||
|
||||
public void setHotlistSequence(int seq) throws DataException;
|
||||
|
||||
public boolean displayPostPictures();
|
||||
|
||||
public ConferenceProperties getProperties() throws DataException, AccessError;
|
||||
|
||||
public void setProperties(ConferenceProperties props) throws DataException, AccessError;
|
||||
|
||||
public SecurityInfo getSecurityInfo();
|
||||
|
||||
public void sendInvitation(String address, String personal_message)
|
||||
throws AccessError, DataException, EmailException;
|
||||
|
||||
public abstract boolean canSendInvitation();
|
||||
public boolean canSendInvitation();
|
||||
|
||||
public abstract void sendMailToParticipants(boolean posters, int day_limit, String subject, String text)
|
||||
public void sendMailToParticipants(boolean posters, int day_limit, String subject, String text)
|
||||
throws AccessError, DataException;
|
||||
|
||||
public abstract String getCustomBlock(int selector) throws DataException;
|
||||
public String getCustomBlock(int selector) throws DataException;
|
||||
|
||||
public abstract void setCustomBlock(int selector, String data) throws AccessError, DataException;
|
||||
public void setCustomBlock(int selector, String data) throws AccessError, DataException;
|
||||
|
||||
public abstract void removeCustomBlocks() throws AccessError, DataException;
|
||||
public void removeCustomBlocks() throws AccessError, DataException;
|
||||
|
||||
public abstract List searchPosts(String search_terms, int offset, int count)
|
||||
throws AccessError, DataException;
|
||||
public List searchPosts(String search_terms, int offset, int count) throws AccessError, DataException;
|
||||
|
||||
public abstract int getSearchPostCount(String search_terms) throws AccessError, DataException;
|
||||
public int getSearchPostCount(String search_terms) throws AccessError, DataException;
|
||||
|
||||
public abstract String getPostLink() throws DataException;
|
||||
public String getPostLink() throws DataException;
|
||||
|
||||
public abstract String exportTopics(Set select_topics) throws AccessError, DataException, IOException;
|
||||
public String exportTopics(Set select_topics) throws AccessError, DataException, IOException;
|
||||
|
||||
public abstract List importMessages(InputStream xmlstream, int match_method, boolean create_new)
|
||||
public List importMessages(InputStream xmlstream, int match_method, boolean create_new)
|
||||
throws AccessError, DataException;
|
||||
|
||||
} // end interface ConferenceContext
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -30,105 +30,111 @@ public interface TopicContext
|
||||
public static final int POST_MODE_NORMAL = 0;
|
||||
public static final int POST_MODE_EMAIL = 1;
|
||||
|
||||
public abstract void refresh() throws DataException;
|
||||
public void refresh() throws DataException;
|
||||
|
||||
public abstract int getTopicID();
|
||||
public int getTopicID();
|
||||
|
||||
public abstract short getTopicNumber();
|
||||
public short getTopicNumber();
|
||||
|
||||
public abstract String getName();
|
||||
public String getName();
|
||||
|
||||
public abstract int getUnreadMessages();
|
||||
public int getUnreadMessages();
|
||||
|
||||
public abstract int getTotalMessages();
|
||||
public int getTotalMessages();
|
||||
|
||||
public abstract Date getLastUpdateDate();
|
||||
public Date getLastUpdateDate();
|
||||
|
||||
public abstract int getCreatorUID();
|
||||
public int getCreatorUID();
|
||||
|
||||
public abstract boolean isFrozen();
|
||||
public boolean isFrozen();
|
||||
|
||||
public abstract boolean isArchived();
|
||||
public boolean isArchived();
|
||||
|
||||
public abstract Date getCreatedDate();
|
||||
public boolean isSticky();
|
||||
|
||||
public abstract boolean isHidden();
|
||||
public Date getCreatedDate();
|
||||
|
||||
public abstract boolean isDeleted();
|
||||
public boolean isHidden();
|
||||
|
||||
public abstract boolean canFreeze();
|
||||
public boolean isDeleted();
|
||||
|
||||
public abstract boolean canArchive();
|
||||
public boolean canFreeze();
|
||||
|
||||
public abstract void setFrozen(boolean flag) throws DataException, AccessError;
|
||||
public boolean canArchive();
|
||||
|
||||
public abstract void setArchived(boolean flag) throws DataException, AccessError;
|
||||
public boolean canStick();
|
||||
|
||||
public abstract void setHidden(boolean flag) throws DataException;
|
||||
public void setFrozen(boolean flag) throws DataException, AccessError;
|
||||
|
||||
public abstract int getFirstUnreadMessage();
|
||||
public void setArchived(boolean flag) throws DataException, AccessError;
|
||||
|
||||
public abstract void setUnreadMessages(int count) throws DataException;
|
||||
public void setSticky(boolean flag) throws DataException, AccessError;
|
||||
|
||||
public abstract void fixSeen() throws DataException;
|
||||
public void setHidden(boolean flag) throws DataException;
|
||||
|
||||
public abstract List getMessages(int low, int high) throws DataException, AccessError;
|
||||
public int getFirstUnreadMessage();
|
||||
|
||||
public abstract TopicMessageContext getMessage(int number) throws DataException, AccessError;
|
||||
public void setUnreadMessages(int count) throws DataException;
|
||||
|
||||
public abstract TopicMessageContext postNewMessage(long parent, String pseud, String text, int mode)
|
||||
public void fixSeen() throws DataException;
|
||||
|
||||
public List getMessages(int low, int high) throws DataException, AccessError;
|
||||
|
||||
public TopicMessageContext getMessage(int number) throws DataException, AccessError;
|
||||
|
||||
public TopicMessageContext postNewMessage(long parent, String pseud, String text, int mode)
|
||||
throws DataException, AccessError;
|
||||
|
||||
public abstract TopicMessageContext postNewMessage(long parent, String pseud, String text)
|
||||
public TopicMessageContext postNewMessage(long parent, String pseud, String text)
|
||||
throws DataException, AccessError;
|
||||
|
||||
public abstract HTMLChecker getPreviewChecker();
|
||||
public HTMLChecker getPreviewChecker();
|
||||
|
||||
public abstract boolean canDelete();
|
||||
public boolean canDelete();
|
||||
|
||||
public abstract void delete() throws DataException, AccessError;
|
||||
public void delete() throws DataException, AccessError;
|
||||
|
||||
public abstract void deleteTopic() throws DataException, AccessError;
|
||||
public void deleteTopic() throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters(int skip, int limit) throws DataException, AccessError;
|
||||
public List getActivePosters(int skip, int limit) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters(int limit) throws DataException, AccessError;
|
||||
public List getActivePosters(int limit) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActivePosters() throws DataException, AccessError;
|
||||
public List getActivePosters() throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders(int skip, int limit) throws DataException, AccessError;
|
||||
public List getActiveReaders(int skip, int limit) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders(int limit) throws DataException, AccessError;
|
||||
public List getActiveReaders(int limit) throws DataException, AccessError;
|
||||
|
||||
public abstract List getActiveReaders() throws DataException, AccessError;
|
||||
public List getActiveReaders() throws DataException, AccessError;
|
||||
|
||||
public abstract boolean isBozo(int other_uid) throws DataException;
|
||||
public boolean isBozo(int other_uid) throws DataException;
|
||||
|
||||
public abstract void setBozo(int other_uid, boolean bozo) throws DataException;
|
||||
public void setBozo(int other_uid, boolean bozo) throws DataException;
|
||||
|
||||
public abstract boolean canSetBozo(int other_uid);
|
||||
public boolean canSetBozo(int other_uid);
|
||||
|
||||
public abstract List getBozos() throws DataException;
|
||||
public List getBozos() throws DataException;
|
||||
|
||||
public abstract boolean isSubscribed();
|
||||
public boolean isSubscribed();
|
||||
|
||||
public abstract void setSubscribed(boolean flag) throws DataException;
|
||||
public void setSubscribed(boolean flag) throws DataException;
|
||||
|
||||
public abstract void sendInvitation(String address, String personal_message)
|
||||
public void sendInvitation(String address, String personal_message)
|
||||
throws AccessError, DataException, EmailException;
|
||||
|
||||
public abstract boolean canSendInvitation();
|
||||
public boolean canSendInvitation();
|
||||
|
||||
public abstract void sendMailToParticipants(boolean posters, int day_limit, String subject, String text)
|
||||
public void sendMailToParticipants(boolean posters, int day_limit, String subject, String text)
|
||||
throws AccessError, DataException;
|
||||
|
||||
public abstract List searchPosts(String search_terms, int offset, int count)
|
||||
public List searchPosts(String search_terms, int offset, int count)
|
||||
throws AccessError, DataException;
|
||||
|
||||
public abstract int getSearchPostCount(String search_terms) throws AccessError, DataException;
|
||||
public int getSearchPostCount(String search_terms) throws AccessError, DataException;
|
||||
|
||||
public abstract ConferenceContext getEnclosingConference();
|
||||
public ConferenceContext getEnclosingConference();
|
||||
|
||||
public abstract String getPostLink() throws DataException;
|
||||
public String getPostLink() throws DataException;
|
||||
|
||||
} // end interface TopicContext
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -986,7 +986,9 @@ class ConferenceCoreData implements ConferenceData
|
||||
throw new DataException("This conference has been deleted.");
|
||||
|
||||
Connection conn = null; // database connection
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
Statement stmt2 = null;
|
||||
ResultSet rs = null;
|
||||
AuditRecord ar = null; // audit record
|
||||
short new_topic_num; // sequential number of the new topic
|
||||
int new_topic_id; // ID of the new topic
|
||||
@@ -995,63 +997,65 @@ class ConferenceCoreData implements ConferenceData
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
stmt2 = conn.createStatement();
|
||||
|
||||
// lock the tables we need to use so we can update them
|
||||
stmt.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, postdata WRITE;");
|
||||
stmt2.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, postdata WRITE;");
|
||||
|
||||
try
|
||||
{ // determine the data for the initial topic
|
||||
new_topic_num = (short)(top_topic + 1);
|
||||
|
||||
// add the topic row to the database
|
||||
StringBuffer sql = new StringBuffer("INSERT INTO topics (confid, num, creator_uid, createdate, "
|
||||
+ "lastupdate, name) VALUES (");
|
||||
sql.append(confid).append(", ").append(new_topic_num).append(", ").append(outer.getUserID());
|
||||
stmt = conn.prepareStatement("INSERT INTO topics (confid, num, creator_uid, createdate, lastupdate, name) "
|
||||
+ "VALUES (?, ?, ?, ?, ?, ?);");
|
||||
stmt.setInt(1,confid);
|
||||
stmt.setShort(2,new_topic_num);
|
||||
stmt.setInt(3,outer.getUserID());
|
||||
creation = new java.util.Date();
|
||||
String now_str = SQLUtil.encodeDate(creation);
|
||||
sql.append(", '").append(now_str).append("', '").append(now_str).append("', '").append(title);
|
||||
sql.append("');");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
SQLUtil.setFullDateTime(stmt,4,creation);
|
||||
SQLUtil.setFullDateTime(stmt,5,creation);
|
||||
stmt.setString(6,title);
|
||||
stmt.executeUpdate();
|
||||
|
||||
// get the topic ID we just inserted
|
||||
ResultSet rs = stmt.executeQuery("SELECT LAST_INSERT_ID();");
|
||||
rs = stmt2.executeQuery("SELECT LAST_INSERT_ID();");
|
||||
if (!(rs.next()))
|
||||
throw new InternalStateError("createNewTopic() could not get back inserted Topic ID");
|
||||
new_topic_id = rs.getInt(1);
|
||||
SQLUtil.shutdown(rs);
|
||||
|
||||
// insert the "header" for the "zero post" in the topic
|
||||
sql.setLength(0);
|
||||
sql.append("INSERT INTO posts (topicid, num, linecount, creator_uid, posted, pseud) VALUES (");
|
||||
sql.append(new_topic_id).append(", 0, ").append(body_lines).append(", ").append(outer.getUserID());
|
||||
sql.append(", '").append(now_str).append("', '").append(pseud).append("');");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
stmt.close();
|
||||
stmt = conn.prepareStatement("INSERT INTO posts (topicid, num, linecount, creator_uid, posted, pseud) "
|
||||
+ "VALUES (?, 0, ?, ?, ?, ?);");
|
||||
stmt.setInt(1,new_topic_id);
|
||||
stmt.setInt(2,body_lines);
|
||||
stmt.setInt(3,outer.getUserID());
|
||||
SQLUtil.setFullDateTime(stmt,4,creation);
|
||||
stmt.setString(5,pseud);
|
||||
stmt.executeUpdate();
|
||||
|
||||
// get the ID of the zero post
|
||||
rs = stmt.executeQuery("SELECT LAST_INSERT_ID();");
|
||||
rs.close();
|
||||
rs = stmt2.executeQuery("SELECT LAST_INSERT_ID();");
|
||||
if (!(rs.next()))
|
||||
throw new InternalStateError("createNewTopic() could not get back inserted zero post ID");
|
||||
long zero_post_id = rs.getLong(1);
|
||||
SQLUtil.shutdown(rs);
|
||||
|
||||
// insert the post data
|
||||
sql.setLength(0);
|
||||
sql.append("INSERT INTO postdata (postid, data) VALUES (").append(zero_post_id).append(", '");
|
||||
sql.append(body).append("');");
|
||||
stmt.executeUpdate(sql.toString());
|
||||
stmt.close();
|
||||
stmt = conn.prepareStatement("INSERT INTO postdata (postid, data) VALUES (?, ?);");
|
||||
stmt.setLong(1,zero_post_id);
|
||||
stmt.setString(2,body);
|
||||
stmt.executeUpdate();
|
||||
|
||||
// touch the "conference" entry to reflect the update
|
||||
sql.setLength(0);
|
||||
sql.append("UPDATE confs SET lastupdate = '").append(now_str).append("', top_topic = ");
|
||||
sql.append(new_topic_num).append(" WHERE confid = ").append(confid).append(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
stmt.close();
|
||||
stmt = conn.prepareStatement("UPDATE confs SET lastupdate = ?, top_topic = ? WHERE confid = ?;");
|
||||
SQLUtil.setFullDateTime(stmt,1,creation);
|
||||
stmt.setInt(2,new_topic_num);
|
||||
stmt.setInt(3,confid);
|
||||
stmt.executeUpdate();
|
||||
|
||||
// touch the local variables, too
|
||||
top_topic = new_topic_num;
|
||||
@@ -1077,7 +1081,9 @@ class ConferenceCoreData implements ConferenceData
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure the connection is released before we go
|
||||
SQLUtil.shutdown(rs);
|
||||
SQLUtil.shutdown(stmt);
|
||||
SQLUtil.shutdown(stmt2);
|
||||
AuditRecord.store(conn,ar);
|
||||
SQLUtil.shutdown(conn);
|
||||
|
||||
@@ -1109,14 +1115,14 @@ class ConferenceCoreData implements ConferenceData
|
||||
if (deleted)
|
||||
throw new DataException("This conference has been deleted.");
|
||||
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
try
|
||||
{ // update the last update date
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("UPDATE confs SET lastupdate = '");
|
||||
sql.append(SQLUtil.encodeDate(date)).append("' WHERE confid = ").append(confid).append(';');
|
||||
stmt.executeUpdate(sql.toString());
|
||||
stmt = conn.prepareStatement("UPDATE confs SET lastupdate = ? WHERE confid = ?;");
|
||||
SQLUtil.setFullDateTime(stmt,1,date);
|
||||
stmt.setInt(2,confid);
|
||||
stmt.executeUpdate();
|
||||
last_update = date;
|
||||
|
||||
} // end try
|
||||
@@ -1177,26 +1183,22 @@ class ConferenceCoreData implements ConferenceData
|
||||
|
||||
ArrayList rc = new ArrayList(); // return from this function
|
||||
Connection conn = null; // pooled database connection
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// create a new SQL statement
|
||||
StringBuffer sql = new StringBuffer("SELECT u.uid, u.username, u.description, c.given_name, "
|
||||
+ "c.family_name, c.locality, c.region, c.country, m.granted_lvl "
|
||||
+ "FROM users u, contacts c, confmember m WHERE "
|
||||
+ "u.contactid = c.contactid AND u.uid = m.uid AND m.confid = ");
|
||||
sql.append(confid).append(" AND u.is_anon = 0 ORDER BY u.username;");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt = conn.prepareStatement("SELECT u.uid, u.username, u.description, c.given_name, c.family_name, "
|
||||
+ "c.locality, c.region, c.country, m.granted_lvl FROM users u, contacts c, "
|
||||
+ "confmember m WHERE u.contactid = c.contactid AND u.uid = m.uid "
|
||||
+ "AND m.confid = ? AND u.is_anon = 0 ORDER BY u.username;");
|
||||
stmt.setInt(1,confid);
|
||||
|
||||
// launch the search!
|
||||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
|
||||
rs = stmt.executeQuery();
|
||||
while (rs.next())
|
||||
{ // add all the found users to the list
|
||||
UserFoundImpl ufi = new UserFoundImpl(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getString(4),
|
||||
@@ -1216,6 +1218,7 @@ class ConferenceCoreData implements ConferenceData
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure we release the connection before we go
|
||||
SQLUtil.shutdown(rs);
|
||||
SQLUtil.shutdown(stmt);
|
||||
SQLUtil.shutdown(conn);
|
||||
|
||||
@@ -1231,19 +1234,20 @@ class ConferenceCoreData implements ConferenceData
|
||||
throw new DataException("This conference has been deleted.");
|
||||
|
||||
Connection conn = null; // pooled database connection
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = globalsite.getConnection(null);
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// create the statement
|
||||
StringBuffer sql = new StringBuffer("SELECT granted_lvl FROM confmember WHERE confid = ");
|
||||
sql.append(confid).append(" AND uid = ").append(uid).append(';');
|
||||
stmt = conn.prepareStatement("SELECT granted_lvl FROM confmember WHERE confid = ? AND uid = ?;");
|
||||
stmt.setInt(1,confid);
|
||||
stmt.setInt(2,uid);
|
||||
|
||||
// execute the statement and return the retrieved value
|
||||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
rs = stmt.executeQuery();
|
||||
if (rs.next())
|
||||
return rs.getInt(1);
|
||||
|
||||
@@ -1256,6 +1260,7 @@ class ConferenceCoreData implements ConferenceData
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure we release the connection before we go
|
||||
SQLUtil.shutdown(rs);
|
||||
SQLUtil.shutdown(stmt);
|
||||
SQLUtil.shutdown(conn);
|
||||
|
||||
|
||||
@@ -866,7 +866,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||
|
||||
} // end anyUnread
|
||||
|
||||
public List getTopicList(int get_option, int sort_option) throws DataException, AccessError
|
||||
public List getTopicList(int get_option, int sort_option, boolean ignore_sticky) throws DataException, AccessError
|
||||
{
|
||||
if (!(getConferenceData().canReadConference(level)))
|
||||
{ // the luser can't even read the conference...
|
||||
@@ -876,7 +876,13 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||
} // end if
|
||||
|
||||
// palm it all off on the big static function
|
||||
return TopicUserContextImpl.getTopicList(env,get_option,sort_option);
|
||||
return TopicUserContextImpl.getTopicList(env,get_option,sort_option,ignore_sticky);
|
||||
|
||||
} // end getTopicList
|
||||
|
||||
public List getTopicList(int get_option, int sort_option) throws DataException, AccessError
|
||||
{
|
||||
return getTopicList(get_option,sort_option,false);
|
||||
|
||||
} // end getTopicList
|
||||
|
||||
@@ -943,20 +949,18 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||
|
||||
// now we need to reset our last post date
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
try
|
||||
{ // get a connection
|
||||
conn = env.getConnection();
|
||||
|
||||
// create a new record in topicsettings (we WERE the first to post in the topic after all!)
|
||||
stmt = conn.createStatement();
|
||||
StringBuffer sql = new StringBuffer("INSERT INTO topicsettings (topicid, uid, last_post) VALUES (");
|
||||
sql.append(new_topic_inf.getTopicID()).append(", ").append(env.getUserID()).append(", '");
|
||||
sql.append(SQLUtil.encodeDate(new_topic_inf.getCreateDate())).append("');");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
stmt = conn.prepareStatement("INSERT INTO topicsettings (topicid, uid, last_post) VALUES (?, ?, ?);");
|
||||
stmt.setInt(1,new_topic_inf.getTopicID());
|
||||
stmt.setInt(2,env.getUserID());
|
||||
SQLUtil.setFullDateTime(stmt,3,new_topic_inf.getCreateDate());
|
||||
stmt.executeUpdate();
|
||||
|
||||
// update the conference last-post information
|
||||
touchPost(conn,new_topic_inf.getCreateDate());
|
||||
|
||||
@@ -188,7 +188,7 @@ class ConferencingExporter
|
||||
m_wr = new PrintWriter(m_buffer);
|
||||
m_wr.write("<?xml version=\"1.0\"?>\n<vcif>\n");
|
||||
|
||||
List l = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER);
|
||||
List l = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER,true);
|
||||
for (Iterator it=l.iterator(); it.hasNext(); )
|
||||
visit((TopicUserContextImpl)(it.next()));
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -40,18 +40,19 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private EnvEngine env;
|
||||
private int cid;
|
||||
private int topicid;
|
||||
private short topicnum;
|
||||
private int creator_uid;
|
||||
private int total_msgs;
|
||||
private boolean frozen;
|
||||
private boolean archived;
|
||||
private java.util.Date createdate;
|
||||
private java.util.Date lastupdate;
|
||||
private String name;
|
||||
private String postlink;
|
||||
private EnvEngine m_env;
|
||||
private int m_cid;
|
||||
private int m_topicid;
|
||||
private short m_topicnum;
|
||||
private int m_creator_uid;
|
||||
private int m_total_msgs;
|
||||
private boolean m_frozen;
|
||||
private boolean m_archived;
|
||||
private boolean m_sticky;
|
||||
private java.util.Date m_createdate;
|
||||
private java.util.Date m_lastupdate;
|
||||
private String m_name;
|
||||
private String m_postlink;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
@@ -61,47 +62,55 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
PublishedMessageTopicImpl(EnvEngine env, int cid, int topicid) throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = env.getConnection();
|
||||
stmt = conn.createStatement();
|
||||
|
||||
// query the topics table for information
|
||||
StringBuffer sql =
|
||||
new StringBuffer("SELECT confid, num, creator_uid, top_message, frozen, archived, createdate, "
|
||||
+ "lastupdate, name FROM topics WHERE topicid = ");
|
||||
sql.append(topicid).append(";");
|
||||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
stmt = conn.prepareStatement("SELECT confid, num, creator_uid, top_message, frozen, archived, sticky, "
|
||||
+ "createdate, lastupdate, name FROM topics WHERE topicid = ?;");
|
||||
stmt.setInt(1,topicid);
|
||||
rs = stmt.executeQuery();
|
||||
if (!(rs.next()))
|
||||
throw new DataException("Topic with ID " + topicid + " not found");
|
||||
|
||||
// fill internal attributes with data
|
||||
this.env = env;
|
||||
this.cid = cid;
|
||||
this.topicid = topicid;
|
||||
m_env = env;
|
||||
m_cid = cid;
|
||||
m_topicid = topicid;
|
||||
int confid = rs.getInt(1);
|
||||
this.topicnum = rs.getShort(2);
|
||||
this.creator_uid = rs.getInt(3);
|
||||
this.total_msgs = rs.getInt(4) + 1;
|
||||
this.frozen = rs.getBoolean(5);
|
||||
this.archived = rs.getBoolean(6);
|
||||
this.createdate = SQLUtil.getFullDateTime(rs,7);
|
||||
this.lastupdate = SQLUtil.getFullDateTime(rs,8);
|
||||
this.name = rs.getString(9);
|
||||
m_topicnum = rs.getShort(2);
|
||||
m_creator_uid = rs.getInt(3);
|
||||
m_total_msgs = rs.getInt(4) + 1;
|
||||
m_frozen = rs.getBoolean(5);
|
||||
m_archived = rs.getBoolean(6);
|
||||
m_sticky = rs.getBoolean(7);
|
||||
m_createdate = SQLUtil.getFullDateTime(rs,8);
|
||||
m_lastupdate = SQLUtil.getFullDateTime(rs,9);
|
||||
m_name = rs.getString(10);
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
// retrieve the community alias
|
||||
rs = stmt.executeQuery("SELECT alias FROM sigs WHERE sigid = " + cid + ";");
|
||||
stmt = conn.prepareStatement("SELECT alias FROM sigs WHERE sigid = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
rs = stmt.executeQuery();
|
||||
if (!(rs.next()))
|
||||
throw new DataException("Community with ID " + cid + " not found");
|
||||
postlink = rs.getString(1) + "!";
|
||||
m_postlink = rs.getString(1) + "!";
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
||||
// retrieve a conference alias
|
||||
rs = stmt.executeQuery("SELECT alias FROM confalias WHERE confid = " + confid + " LIMIT 1;");
|
||||
stmt = conn.prepareStatement("SELECT alias FROM confalias WHERE confid = ? LIMIT 1;");
|
||||
stmt.setInt(1,confid);
|
||||
rs = stmt.executeQuery();
|
||||
if (!(rs.next()))
|
||||
throw new DataException("Conference with ID " + confid + " not found");
|
||||
postlink += (rs.getString(1) + "." + topicnum);
|
||||
m_postlink += (rs.getString(1) + "." + m_topicnum);
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
@@ -112,6 +121,7 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
} // end catch
|
||||
finally
|
||||
{ // release the connection
|
||||
SQLUtil.shutdown(rs);
|
||||
SQLUtil.shutdown(stmt);
|
||||
SQLUtil.shutdown(conn);
|
||||
|
||||
@@ -130,19 +140,19 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
|
||||
public int getTopicID()
|
||||
{
|
||||
return topicid;
|
||||
return m_topicid;
|
||||
|
||||
} // end getTopicID
|
||||
|
||||
public short getTopicNumber()
|
||||
{
|
||||
return topicnum;
|
||||
return m_topicnum;
|
||||
|
||||
} // end getTopicNumber
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
return m_name;
|
||||
|
||||
} // end getName
|
||||
|
||||
@@ -154,39 +164,45 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
|
||||
public int getTotalMessages()
|
||||
{
|
||||
return total_msgs;
|
||||
return m_total_msgs;
|
||||
|
||||
} // end getTotalMessages
|
||||
|
||||
public java.util.Date getLastUpdateDate()
|
||||
{
|
||||
return lastupdate;
|
||||
return m_lastupdate;
|
||||
|
||||
} // end getLastUpdateDate
|
||||
|
||||
public int getCreatorUID()
|
||||
{
|
||||
return creator_uid;
|
||||
return m_creator_uid;
|
||||
|
||||
} // end getCreatorUID
|
||||
|
||||
public boolean isFrozen()
|
||||
{
|
||||
return frozen;
|
||||
return m_frozen;
|
||||
|
||||
} // end isFrozen
|
||||
|
||||
public boolean isArchived()
|
||||
{
|
||||
return archived;
|
||||
return m_archived;
|
||||
|
||||
} // end isArchived
|
||||
|
||||
public boolean isSticky()
|
||||
{
|
||||
return m_sticky;
|
||||
|
||||
} // end isSticky
|
||||
|
||||
public java.util.Date getCreatedDate()
|
||||
{
|
||||
return createdate;
|
||||
return m_createdate;
|
||||
|
||||
} // end egtCreatedDate
|
||||
} // end getCreatedDate
|
||||
|
||||
public boolean isHidden()
|
||||
{
|
||||
@@ -212,6 +228,12 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
|
||||
} // end canArchive
|
||||
|
||||
public boolean canStick()
|
||||
{
|
||||
return false;
|
||||
|
||||
} // end canStick
|
||||
|
||||
public void setFrozen(boolean flag) throws AccessError
|
||||
{
|
||||
throw new AccessError("cannot perform this function from a read-only topic view");
|
||||
@@ -224,6 +246,12 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
|
||||
} // end setArchived
|
||||
|
||||
public void setSticky(boolean flag) throws AccessError
|
||||
{
|
||||
throw new AccessError("cannot perform this function from a read-only topic view");
|
||||
|
||||
} // end setSticky
|
||||
|
||||
public void setHidden(boolean flag)
|
||||
{ // do nothing
|
||||
} // end setHidden
|
||||
@@ -399,7 +427,7 @@ class PublishedMessageTopicImpl implements TopicContext
|
||||
|
||||
public String getPostLink()
|
||||
{
|
||||
return postlink;
|
||||
return m_postlink;
|
||||
|
||||
} // end getPostLink
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,5 +68,6 @@ public interface Audit
|
||||
public static final int UPLOAD_ATTACHMENT = 314;
|
||||
public static final int DELETE_CONF = 315;
|
||||
public static final int MOVE_MESSAGE = 316;
|
||||
public static final int TOPIC_STICKY = 317;
|
||||
|
||||
} // end interface Audit
|
||||
|
||||
Reference in New Issue
Block a user