一个关于商业的网站

源代码在线查看: index.jsp

软件大小: 1416 K
上传用户: zwaheron
关键词: 网站
下载地址: 免注册下载 普通下载 VIP

相关代码

				
								/**
				 *	$RCSfile: index.jsp,v $
				 *	$Revision: 1.6 $
				 *	$Date: 2000/12/18 02:04:56 $
				 */
				%>
				
								                 com.coolservlets.forum.*,
				                 com.coolservlets.forum.util.*"
					errorPage="error.jsp"
				%>
				
									// customize the look of this page
					
					// Colors of the table that displays a list of forums
					final static String forumTableBgcolor = "#cccccc";
					final static String forumTableFgcolor = "#ffffff";
					final static String forumTableHeaderFgcolor = "#eeeeee";
				%>
				
									// Logout a user if requested
					
					// check for the parameter "logout=true"
					if( ParamUtils.getBooleanParameter(request,"logout") ) {
						// invalidate their authentication token
						SkinUtils.removeUserAuthorization(request,response);
						// redirect them to the page from where they came
						response.sendRedirect(request.getHeader("REFERER"));
						return;
					}
				%>
								 
									// Authorization check
					
					// check for the existence of an authorization token
					Authorization authToken = SkinUtils.getUserAuthorization(request,response);
					
					// if the token was null, they're not authorized. Since this skin will
					// allow guests to view forums, we'll set a "guest" authentication
					// token
					if( authToken == null ) {
						authToken = AuthorizationFactory.getAnonymousAuthorization();
					}
				%>
				
									// page forum variables
					
					// do not delete these
					ForumFactory forumFactory = ForumFactory.getInstance(authToken);
					User user = forumFactory.getProfileManager().getUser(authToken.getUserID());
					long userLastVisitedTime = SkinUtils.getLastVisited(request,response);
				%>
				
									// Header file include
					
					// The header file looks for the variable "title"
					String title = "Jive Forums: Example Skin";
				%>
				
				
				
									// Breadcrumb bar
					
					// The breadcrumb file looks for the variable "breadcrumbs" which
					// represents a navigational path, ie "Home > My Forum > Hello World"
					String[][] breadcrumbs = {
						{ "Home", "" }
					};
				%>
				
				
				
									// Toolbar
					
					// The toolbar file looks for the following variables. To make a particular
					// "button" not appear, set a variable to null.
					boolean showToolbar = true;
					String viewLink = null;
					String postLink = null;
					String replyLink = null;
					String searchLink = null;
					// we can show a link to a user account if the user is logged in (handled
					// in the toolbar jsp)
					String accountLink = "userAccount.jsp";
				%>
				
				
				
									// customize which forums are displayed on this page
					
					// There are two ways to decide which forums get diplayed to the user
					//
					//	1.	Display a list of all forums the current user has permission to
					//		view. For instance, if there are 4 forums in the system and
					//		a "guest" has authorization to view 2 of them, then just those
					//		two forums will be displayed. This works the same way for 
					//		registered users -- they'll only see the forums they have 
					//		access to.
					//		
					//	2.	Specify by name which forums to display. Again, if there are
					//		4 forums in the system and you specify all forums by name and
					//		the skin user has access to only 2 of them, then only 2 forums
					//		will be displayed
					
					// Set the following boolean variable to "false" to display a list
					// of forums in the system (case 1) or set it to "true" to specify
					// a list of forums by name (case 2)
					
					boolean loadForumsByName = false;
					
					// If you choose to load forums by name, specify the names by
					// adding them to the following list of forum names:
					
					ArrayList forumNames = new ArrayList(0);
					if( loadForumsByName ) {
						forumNames.add( "First Forum" );
						forumNames.add( "Another Forum" );
					}
				%>
				
				
				
				Forums
				
				
				
									// check for messages
					
					// we might come to this page from another page and that page might
					// pass us a message. If so, grab it and display it (also remove it from persistence)
					String message = SkinUtils.retrieve(request,response,"message",true);
					if( message != null ) {
				%>
					
					
				
				
									
					if( !user.isAnonymous() ) { %>
					
					Welcome back, ! 
					(If you're not , click here.)
					
				
				
				
				
				
				
				
				
					
						NewPosts
					
					
						Forum Name
					
					
						Topics/Messages
					
					
						Description
					
					
						Last Updated
					
				
				
				
									// Note:
					
					// the following java code should not be modified -- changing html is ok.
					
					// The iterator we use to loop through forums
					Iterator forumIterator;
					if( loadForumsByName ) {
						forumIterator = forumNames.iterator();
					}
					else {
						forumIterator = forumFactory.forums();
					}
				%>
				
									// loop through forums, display forum info:
					if( !forumIterator.hasNext() ) {
				%>
				   	
						
						
						
						Sorry, there are no forums in the Jive system. Please have your forum administrator create some.
						
						
						
					
									boolean forumLoaded = false;
					while( forumIterator.hasNext() ) {
						Forum forum;
						// since loading a forum could throw an unauthorized exception, we 
						// should catch it so we can skip this forum and try to load another
						// forum
						try {
							if( loadForumsByName ) {
								forum = forumFactory.getForum( (String)forumIterator.next() );
							}
							else {
								forum = (Forum)forumIterator.next();
							}
							forumLoaded = true;
							int forumID = forum.getID();
							String forumName = forum.getName();
							String forumDescription = forum.getDescription();
							int threadCount = forum.getThreadCount();
							int messageCount = forum.getMessageCount();
							Date creationDate = forum.getCreationDate();
							Date modifiedDate = forum.getModifiedDate();
							boolean wasModified = (userLastVisitedTime < modifiedDate.getTime());
				%>
					
						
						
						 / 
						
						
					
										}
					}
					
					// if no forums were successfully loaded, print out a "error, no 
					// permissions" message
					if( !forumLoaded ) {
				%>
				   	
						
						
						
						Sorry, you don't have permission to view any forums.
						
						
						
					
								%>
				
				
				
				
				
				
									// page footer 
				%>
				
				
							

相关资源