?? createforum.jsp
字號:
<%
/**
* $RCSfile: createForum.jsp,v $
* $Revision: 1.1.1.1 $
* $Date: 2002/09/09 13:50:25 $
*/
%>
<%@ page import="java.util.*,
com.jivesoftware.forum.*,
com.jivesoftware.forum.util.*" %>
<%@ include file="include/global.jsp" %>
<%! // Global variables, methods, etc
// Permission presets
static final int USE_GLOBAL_PERMS = 1;
static final int ALL_ACCESS = 2;
static final int USERS_ONLY = 3;
static final int USERS_AND_ANON_READ = 4;
static final int DEFAULT_PERM_PRESET = USE_GLOBAL_PERMS;
static final int[] PERM_PRESETS = {
USE_GLOBAL_PERMS,
USERS_ONLY,
USERS_AND_ANON_READ,
ALL_ACCESS
};
static final String[][] PERM_PRESET_INFO = {
{"Use Global Permissions","Let the global permission settings dictate the permissions for this forum."},
{"Registered Users Only","Only registered users can read and post messages."},
{"Registered Users with Guest Read","Registered users can read and post messages while guests can only read messages."},
{"All Access","Everyone can read and post new messages and threads."}
};
%>
<% // Get parameters
String submitButton = ParamUtils.getParameter(request,"submitButton");
boolean doCreate = ParamUtils.getBooleanParameter(request,"doCreate");
String name = ParamUtils.getParameter(request,"name");
String description = ParamUtils.getParameter(request,"description");
int permPreset = ParamUtils.getIntParameter(request,"permPreset",DEFAULT_PERM_PRESET);
// Remove the forum in the session (if we come to this page, the sidebar
// shouldn't show the specific forum options).
session.removeAttribute("admin.sidebar.forums.currentForum");
// Cancel, if requested
if ("Cancel".equals(submitButton)) {
response.sendRedirect("forums.jsp");
return;
}
// Check for errors
boolean errors = false;
if (doCreate) {
if (name == null) {
errors = true;
}
}
// Create a forum if requested
if (doCreate && !errors) {
Forum forum = forumFactory.createForum(name, description);
// Get a permissions manager so we can set permissions below
PermissionsManager permManager = forum.getPermissionsManager();
// set permissions
switch (permPreset) {
case USE_GLOBAL_PERMS:
// do nothing -- global permission are used by default
break;
case USERS_ONLY:
permManager.addRegisteredUserPermission(ForumPermissions.READ);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_THREAD);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_MESSAGE);
break;
case USERS_AND_ANON_READ:
permManager.addRegisteredUserPermission(ForumPermissions.READ);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_THREAD);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_MESSAGE);
permManager.addAnonymousUserPermission(ForumPermissions.READ);
break;
case ALL_ACCESS:
permManager.addRegisteredUserPermission(ForumPermissions.READ);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_THREAD);
permManager.addRegisteredUserPermission(ForumPermissions.CREATE_MESSAGE);
permManager.addAnonymousUserPermission(ForumPermissions.READ);
permManager.addAnonymousUserPermission(ForumPermissions.CREATE_THREAD);
permManager.addAnonymousUserPermission(ForumPermissions.CREATE_MESSAGE);
break;
default:
}
// redirect back to the forums page
response.sendRedirect("forums.jsp");
return;
}
%>
<% // special onload command to load the sidebar
onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\"";
%>
<%@ include file="include/header.jsp" %>
<p>
<% // Title of this page and breadcrumbs
String title = "Create a New Forum";
String[][] breadcrumbs = {
{"Main", "main.jsp"},
{"Forums", "forums.jsp"},
{"Create Forum", "createForum.jsp"}
};
%>
<%@ include file="include/title.jsp" %>
<font size="-1">
Note: This creates a forum with no permissions. After you create this forum,
you will be taken to the forum permissions screen.
</font>
<p>
<% // error messages
if(errors) {
%>
<font color="<%= errorColor %>" size="-1">
Error creating forum. Please make sure you've entered a forum name.
</font>
<p>
<% } %>
<form action="createForum.jsp" method="post" name="createForm">
<input type="hidden" name="doCreate" value="true">
<font size="-1"><b>Forum Name</b></font>
<ul>
<input type="text" name="name" size="40" maxlength="100" value="<%= (name!=null)?name:"" %>">
</ul>
<font size="-1"><b>Forum Description</b> (optional)</font>
<ul>
<textarea name="description" cols="40" rows="5" wrap="virtual"><%= (description!=null)?description:"" %></textarea>
</ul>
<font size="-1"><b>Forum Permission Presets</b></font>
<ul>
<font size="-1">
For finer-grain permission control (including group settings), please view
the permissions pages.
<p>
</font>
<table cellpadding="3" cellspacing="0" border="0">
<% for (int i=0; i<PERM_PRESETS.length; i++) {
String checked = "";
if (PERM_PRESETS[i] == permPreset) {
checked = " checked";
}
%>
<tr>
<td valign="top"><input type="radio" name="permPreset" value="<%= PERM_PRESETS[i] %>" id="rb<%= i %>"<%= checked %>></td>
<td><font size="-1"><label for="rb<%= i %>">
<b><%= PERM_PRESET_INFO[i][0] %></b>
--
<%= PERM_PRESET_INFO[i][1] %>
</label></font>
</td>
</tr>
<% } %>
</table>
</ul>
<input type="submit" name="submitButton" value="Create Forum">
<input type="submit" name="submitButton" value="Cancel">
</form>
<script language="JavaScript" type="text/javascript">
<!--
document.createForm.name.focus();
//-->
</script>
<jsp:include page="include/footer.jsp" flush="true"/>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -