一个关于商业的网站

源代码在线查看: index.jsp

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

相关代码

				
								/**
				 *	$RCSfile: index.jsp,v $
				 *	$Revision: 1.4 $
				 *	$Date: 2000/12/18 02:06:21 $
				 */
				%>
				
									import="java.io.*,
				            java.util.*,
				            com.coolservlets.forum.*,
				            com.coolservlets.forum.util.*,
					        com.coolservlets.forum.util.tree.*,
					        com.coolservlets.forum.util.admin.*" %>
					
								 class="com.coolservlets.forum.util.admin.AdminBean"/>
						
									// Jive installation check
					
					// Check for the existence of the property "setup" in the 
					// jive.properties file. This is managed by the PropertyManager class.
					// This property tells us if the admin tool is being run for the first time.
					
					boolean setupError = false;
					String installed = null;
					try {
						installed = PropertyManager.getProperty("setup");
						if( installed == null || !installed.equals("true") ) {
							// the "installed" property doesn't exist or isn't set
							response.sendRedirect("setup/setup.jsp");
							return;
						}
						//else if( !installed.equals("true") ) {
						//	setupError = true;
						//}
					}
					catch( Exception e ) {
						// signal an error. the file jive.properties might not exist.
						setupError = true;
					}
					
					// print out a setup error:
					if( setupError ) { %>
						
						
						Jive Administration - Beta
						
						
						
						Setup Error! Make sure your jive.properties file is in
						your app server's classpath.
						
						
										// display the above html w/o flushing the stream
						out.flush();
						return;
					}
				%>
				
				
									// Jive authorization check
					
					// check the bean for the existence of an authorization token.
					// Its existence proves the user is valid. If it's not found, redirect
					// to the login page
					Authorization authToken = adminBean.getAuthToken();
					if( authToken == null ) {
						response.sendRedirect( "login.jsp" );
						return;
					}
				%>
				
									// get parameters
					boolean logout = ParamUtils.getBooleanParameter(request,"logout");
				%>
				
									// logout if requested:
					if( logout ) {
						try {
							session.invalidate();
							adminBean.resetAuthToken();
						}
						catch( IllegalStateException ignored ) { // if session is already invalid
						}
						finally {
							response.sendRedirect( "index.jsp" );
							return;
						}
					}
				%>
				
				
									// Get the permissions for this user:
					boolean isSystemAdmin = ((Boolean)session.getValue("jiveAdmin.systemAdmin")).booleanValue();
					boolean isForumAdmin  = ((Boolean)session.getValue("jiveAdmin.forumAdmin")).booleanValue();
					boolean isGroupAdmin  = ((Boolean)session.getValue("jiveAdmin.groupAdmin")).booleanValue();
				%>
				
									// set the menu trees in the bean based on the user's permissions
					
					// system tree
					if( isSystemAdmin || isGroupAdmin ) {
						com.coolservlets.forum.util.tree.Tree systemTree 
							= new com.coolservlets.forum.util.tree.Tree("system");
						int nodeID = 0;
						TreeNode node = null;
						
						if( isSystemAdmin ) {
							node = new TreeNode( nodeID++, "System Settings" );
							node.addChild( new TreeLeaf("Cache", "cache.jsp") );
							node.addChild( new TreeLeaf("Database Info", "dbInfo.jsp") );
							node.addChild( new TreeLeaf("Search Settings", "searchSettings.jsp") );
							node.addChild( new TreeLeaf("Property Manager", "propManager.jsp") );
							node.setVisible(true);
							systemTree.addChild(node);
						}
						
						if( isSystemAdmin ) {
							node = new TreeNode( nodeID++, "Users" );
							node.addChild( new TreeLeaf("User Summary", "users.jsp") );
							//node.addChild( new TreeLeaf("System Admins", "systemAdmins.jsp") );
							node.addChild( new TreeLeaf("Passwords", "password.jsp") );
							node.addChild( new TreeLeaf("Create User", "createUser.jsp") );
							//node.addChild( new TreeLeaf("Edit User",   "editUser.jsp") );
							node.addChild( new TreeLeaf("Remove User", "removeUser.jsp") );
							node.setVisible(true);
							systemTree.addChild(node);
						}
						
						if( isSystemAdmin || isGroupAdmin ) {
							node = new TreeNode( nodeID++, "Groups" );
							node.addChild( new TreeLeaf("Group Summary", "groups.jsp") );
							if( isSystemAdmin ) {
								node.addChild( new TreeLeaf("Create Group", "createGroup.jsp") );
							}
							node.addChild( new TreeLeaf("Edit Group",   "editGroup.jsp") );
							node.addChild( new TreeLeaf("Remove Group", "removeGroup.jsp") );
							node.setVisible(true);
							systemTree.addChild(node);
						}
						
						if( systemTree.size() > 0 ) {
							adminBean.addTree( "systemTree", systemTree );
						}
					}
					
					// forum tree
					if( isSystemAdmin ) {
						com.coolservlets.forum.util.tree.Tree forumTree 
							= new com.coolservlets.forum.util.tree.Tree("forum");
						int nodeID = 0;
						TreeNode node = null;
						
						node = new TreeNode( nodeID++, "Forums" );
						node.addChild( new TreeLeaf("Summary",     "forums.jsp") );
						node.addChild( new TreeLeaf("Create",      "createForum.jsp") );
						node.addChild( new TreeLeaf("Edit Properties", "editForum.jsp") );
						node.addChild( new TreeLeaf("Remove",      "removeForum.jsp") );
						node.addChild( new TreeLeaf("Filters",     "forumFilters.jsp") );
						node.addChild( new TreeLeaf("Content",     "forumContent.jsp") );
						node.setVisible(true);
						forumTree.addChild(node);
						
						adminBean.addTree( "forumTree", forumTree );
					}
				%>
				
				
				
				Jive Administration
				
				
				
					
					
					
							   
						
								   
							
						
						
					
					
				
				
				
				
				
							

相关资源