📄 threadtag.java
字号:
return "" + ct.getForum().getID(); } /** * Date and time of Thread CreationDate (integer) property which can be * obtained by the JSP page using * <jsp:getProperty name=<i>"id"</i> property="creationDate"/> * * @return date and time of Thread CreationDate as an integer */ public final String getCreationDate() { return "" + ct.getCreationDate().getTime(); } /** * Date and time of Thread ModifiedDate (integer) property which can be * obtained by the JSP page using * <jsp:getProperty name=<i>"id"</i> property="modifiedDate"/> * * @return date and time of Thread ModifiedDate as an integer */ public final String getModifiedDate() { return "" + ct.getModifiedDate().getTime(); } /** * Next Thread ID property which can be obtained by the JSP page * using <jsp:getProperty name=<i>"id"</i> property="nextThreadid"/> * * @return String - next thread ID */ public final String getNextThreadid() { return "" + nextThreadID; } /** * Previous Thread ID property which can be obtained by the JSP page * using <jsp:getProperty name=<i>"id"</i> property="prevThreadid"/> * * @return String - previous thread ID */ public final String getPrevThreadid() { return "" + prevThreadID; } /** * Get the root message for this thread * * @return ForumMessage */ public final ForumMessage getMessage() { return ct.getRootMessage(); } /** * Move the thread to a different forum, used by move_thread tag. * * @return true if thread moved, false if thread move failed */ public final boolean moveThread() throws JspException { Forum cf = ct.getForum(); int threadid = ct.getID(); if( mf == null ) throw new JspException( "Jive thread tag, you must set a forum using change_forum tag before using move_thread tag"); try { cf.moveThread(ct,mf); return true; /* This should no longer be needed, it should be encapsulated in moveThread now try { ForumThread nt = mf.getThread(threadid); ct = nt; SearchIndexer si = jr.getForumFactory().getSearchIndexer(); si.updateThreadForum(ct); return true; } catch(ForumThreadNotFoundException e) {} */ } catch(UnauthorizedException ue) { jr.addError(TagPropertyManager.getTagProperty("jive.tag.post.authorize.failed")); } return false; } /** * Remove the thread and post its message as a reply to a parent message * for a different forum thread, used by move_message tag. * * @return true if message moved, false if message move failed */ public final boolean moveMessage() throws JspException { Forum cf = ct.getForum(); int threadid = ct.getID(); ForumMessage cm = null; ForumThread mt = null; cm = ct.getRootMessage(); if( cm == null ) throw new JspException( "Jive thread tag, could not find message to move using move_message tag"); if( ct.getMessageCount() != 1 ) throw new JspException( "Jive thread tag, you can not move a message thread that has replies using move_message tag"); if( mf == null ) throw new JspException( "Jive thread tag, you must set a forum using change_forum tag before using move_message tag"); if( mtid == 0 ) throw new JspException( "Jive thread tag, you must set a thread using set_thread tag before using move_message tag"); if( mmid == 0 ) throw new JspException( "Jive thread tag, you must set a parent message using set_parent_message tag before using move_message tag"); cm = ct.getRootMessage(); if( cm == null ) { throw new JspException( "Jive thread tag, could not find thread root message for move_message tag"); } try { mt = mf.getThread(mtid); } catch(ForumThreadNotFoundException e) { throw new JspException( "Jive thread tag, could not find thread to move message to"); } try { ForumMessage parentMessage = mt.getMessage( mmid ); ct.moveMessage(cm,mt,parentMessage); ct = mt; return true; /* old move message code cf.removeThread(ct); try { ForumMessage parentMessage = mt.getMessage( mmid ); mt.addMessage( parentMessage, cm ); ct = mt; SearchIndexer si = jr.getForumFactory().getSearchIndexer(); si.updateMessageForum(ct.getMessage(cm.getID())); return true; } catch(ForumMessageNotFoundException e) { throw new JspException( "Jive thread tag, could not find parent message for move_message tag"); } */ } catch(UnauthorizedException ue) { jr.addError(TagPropertyManager.getTagProperty("jive.tag.post.authorize.failed")); } catch(ForumMessageNotFoundException e) { throw new JspException( "Jive thread tag, could not find parent message for move_message tag"); } return false; } /** * Set an alternate forum where message is to be moved */ public final void changeForum(Forum apf) { mf = apf; } /** * Determine if thread has new messages since users last visit. * * @return boolean - true or false */ public final boolean newMessages() { if( js.getLastForumVisitDate(ct.getForum(),jr).getTime() < ct.getModifiedDate().getTime() ) return true; return false; } /** * Determine if there is a thread preceding this one * * @return boolean - true or false */ public final boolean prevThread() { if( prevThreadID > 0 ) return true; return false; } /** * Determine if there is a thread following this one * * @return boolean - true or false */ public final boolean nextThread() { if( nextThreadID > 0 ) return true; return false; } /** * Set the threadId for thread message is being moved to */ public final void setThread(int tid) { mtid = tid; } /** * Change to a different thread */ public final void changeThread(int at) throws JspException { // See if we are nested inside a forum tag ForumTag ft = null; try { ft = (ForumTag)this.findAncestorWithClass(this, Class.forName("com.coolservlets.forum.tags.ForumTag")); } catch(Exception e) { } if( ft == null ) { throw new JspException("Jive thread tag must be nested inside a forum tag"); } try { ForumThread nt = ft.getForum().getThread(at); ct = nt; } catch(ForumThreadNotFoundException e) { throw new JspException( "Jive thread tag, could not find thread to change_thread to"); } } /** * Set the parent message id for message being moved */ public final void setParentMessage(int mid) { mmid = mid; } /** * Remove the script variable after forum tag closed out */ public final void release() { if( id != null && id.length() > 0 ) pageContext.removeAttribute(id,PageContext.PAGE_SCOPE); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -