001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/common/ThreadIconLegend.java,v 1.14 2007/10/09 11:09:16 lexuanttkhtn Exp $
003: * $Author: lexuanttkhtn $
004: * $Revision: 1.14 $
005: * $Date: 2007/10/09 11:09:16 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Dung Bui
039: */
040: package com.mvnforum.common;
041:
042: import com.mvnforum.MVNForumConfig;
043:
044: public class ThreadIconLegend {
045:
046: public static final String THREAD_ICON_TYPE_STICKY = "sticky.gif";
047: public static final String THREAD_ICON_TYPE_FORUM_ANNOUNCEMENT = "announce.gif";
048: public static final String THREAD_ICON_TYPE_GLOBAL_ANNOUNCEMENT = "global_announce.gif";
049:
050: public static final String THREAD_ICON_COLD_READ_ACTIVE = "t_cold_read_active.gif";
051: public static final String THREAD_ICON_COLD_READ_CLOSED = "t_cold_read_closed.gif";
052: public static final String THREAD_ICON_COLD_READ_LOCKED = "t_cold_read_locked.gif";
053: public static final String THREAD_ICON_COLD_UNREAD_ACTIVE = "t_cold_unread_active.gif";
054: public static final String THREAD_ICON_COLD_UNREAD_CLOSED = "t_cold_unread_closed.gif";
055: public static final String THREAD_ICON_COLD_UNREAD_LOCKED = "t_cold_unread_locked.gif";
056: public static final String THREAD_ICON_HOT_READ_ACTIVE = "t_hot_read_active.gif";
057: public static final String THREAD_ICON_HOT_READ_CLOSED = "t_hot_read_closed.gif";
058: public static final String THREAD_ICON_HOT_READ_LOCKED = "t_hot_read_locked.gif";
059: public static final String THREAD_ICON_HOT_UNREAD_ACTIVE = "t_hot_unread_active.gif";
060: public static final String THREAD_ICON_HOT_UNREAD_CLOSED = "t_hot_unread_closed.gif";
061: public static final String THREAD_ICON_HOT_UNREAD_LOCKED = "t_hot_unread_locked.gif";
062:
063: public static final String THREAD_ICON_PRIORITY_LOW = "icon_low.gif";
064: public static final String THREAD_ICON_PRIORITY_NORMAL = "icon_normal.gif";
065: public static final String THREAD_ICON_PRIORITY_HIGH = "icon_high.gif";
066:
067: private boolean hasColdReadActive = false;
068: private boolean hasColdReadClosed = false;
069: private boolean hasColdReadLocked = false;
070: private boolean hasColdUnreadActive = false;
071: private boolean hasColdUnreadClosed = false;
072: private boolean hasColdUnreadLocked = false;
073: private boolean hasHotReadActive = false;
074: private boolean hasHotReadClosed = false;
075: private boolean hasHotReadLocked = false;
076: private boolean hasHotUnreadActive = false;
077: private boolean hasHotUnreadClosed = false;
078: private boolean hasHotUnreadLocked = false;
079: private boolean hasPriorityLow = false;
080: private boolean hasPriorityNormal = false;
081: private boolean hasPriorityHigh = false;
082: private boolean hasSticky = false;
083: private boolean hasAnnouncement = false;
084: private boolean hasGlobalAnnouncement = false;
085:
086: //check should show info.
087: //fix problem with xhtml validator in listforums page
088: public boolean isHasThreadIconLegend() {
089: return (hasColdReadActive || hasColdReadClosed
090: || hasColdReadLocked || hasColdUnreadActive
091: || hasColdUnreadClosed || hasColdUnreadLocked
092: || hasHotReadActive || hasHotReadClosed
093: || hasHotReadLocked || hasHotUnreadActive
094: || hasHotUnreadClosed || hasHotUnreadLocked
095: || hasPriorityLow || hasPriorityNormal
096: || hasPriorityHigh || hasSticky || hasAnnouncement || hasGlobalAnnouncement);
097: }
098:
099: public void updateIconLegend(String threadIcon) {
100: if (threadIcon == null) {
101: return;
102: }
103: if (threadIcon.equals(THREAD_ICON_COLD_READ_ACTIVE)) {
104: hasColdReadActive = true;
105: } else if (threadIcon.equals(THREAD_ICON_COLD_READ_CLOSED)) {
106: hasColdReadClosed = true;
107: } else if (threadIcon.equals(THREAD_ICON_COLD_READ_LOCKED)) {
108: hasColdReadLocked = true;
109: } else if (threadIcon.equals(THREAD_ICON_COLD_UNREAD_ACTIVE)) {
110: hasColdUnreadActive = true;
111: } else if (threadIcon.equals(THREAD_ICON_COLD_UNREAD_CLOSED)) {
112: hasColdUnreadClosed = true;
113: } else if (threadIcon.equals(THREAD_ICON_COLD_UNREAD_LOCKED)) {
114: hasColdUnreadLocked = true;
115: } else if (threadIcon.equals(THREAD_ICON_HOT_READ_ACTIVE)) {
116: hasHotReadActive = true;
117: } else if (threadIcon.equals(THREAD_ICON_HOT_READ_CLOSED)) {
118: hasHotReadClosed = true;
119: } else if (threadIcon.equals(THREAD_ICON_HOT_READ_LOCKED)) {
120: hasHotReadLocked = true;
121: } else if (threadIcon.equals(THREAD_ICON_HOT_UNREAD_ACTIVE)) {
122: hasHotUnreadActive = true;
123: } else if (threadIcon.equals(THREAD_ICON_HOT_UNREAD_CLOSED)) {
124: hasHotUnreadClosed = true;
125: } else if (threadIcon.equals(THREAD_ICON_HOT_UNREAD_LOCKED)) {
126: hasHotUnreadLocked = true;
127:
128: } else if ((threadIcon.equals(THREAD_ICON_PRIORITY_LOW))
129: && MVNForumConfig.getEnableLowPriorityIcon()) {
130: hasPriorityLow = true;
131: } else if ((threadIcon.equals(THREAD_ICON_PRIORITY_NORMAL))
132: && MVNForumConfig.getEnableNormalPriorityIcon()) {
133: hasPriorityNormal = true;
134: } else if ((threadIcon.equals(THREAD_ICON_PRIORITY_HIGH))
135: && MVNForumConfig.getEnableHighPriorityIcon()) {
136: hasPriorityHigh = true;
137:
138: } else if (threadIcon.equals(THREAD_ICON_TYPE_STICKY)) {
139: hasSticky = true;
140: } else if (threadIcon
141: .equals(THREAD_ICON_TYPE_FORUM_ANNOUNCEMENT)) {
142: hasAnnouncement = true;
143: } else if (threadIcon
144: .equals(THREAD_ICON_TYPE_GLOBAL_ANNOUNCEMENT)) {
145: hasGlobalAnnouncement = true;
146: }
147: }
148:
149: public boolean isHasColdReadClosed() {
150: return hasColdReadClosed;
151: }
152:
153: public boolean isHasColdReadLocked() {
154: return hasColdReadLocked;
155: }
156:
157: public boolean isHasColdReadActive() {
158: return hasColdReadActive;
159: }
160:
161: public boolean isHasColdUnreadClosed() {
162: return hasColdUnreadClosed;
163: }
164:
165: public boolean isHasColdUnreadLocked() {
166: return hasColdUnreadLocked;
167: }
168:
169: public boolean isHasColdUnreadActive() {
170: return hasColdUnreadActive;
171: }
172:
173: public boolean isHasHotReadClosed() {
174: return hasHotReadClosed;
175: }
176:
177: public boolean isHasHotReadLocked() {
178: return hasHotReadLocked;
179: }
180:
181: public boolean isHasHotReadActive() {
182: return hasHotReadActive;
183: }
184:
185: public boolean isHasHotUnreadClosed() {
186: return hasHotUnreadClosed;
187: }
188:
189: public boolean isHasHotUnreadLocked() {
190: return hasHotUnreadLocked;
191: }
192:
193: public boolean isHasHotUnreadActive() {
194: return hasHotUnreadActive;
195: }
196:
197: public boolean isHasPriorityLow() {
198: return hasPriorityLow;
199: }
200:
201: public boolean isHasPriorityNormal() {
202: return hasPriorityNormal;
203: }
204:
205: public boolean isHasPriorityHigh() {
206: return hasPriorityHigh;
207: }
208:
209: public boolean isHasSticky() {
210: return hasSticky;
211: }
212:
213: public boolean isHasAnnouncement() {
214: return hasAnnouncement;
215: }
216:
217: public boolean isHasGlobalAnnouncement() {
218: return hasGlobalAnnouncement;
219: }
220:
221: }
|