perms.jsp
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 662 行 · 第 1/2 页
JSP
662 行
// groups next for (int i=0; i<groupIDs.length; i++) { try { Group group = groupManager.getGroup(groupIDs[i]); for (int j=0; j<itemType.length; j++) { if (itemType[j] == MODERATOR) { permManager.removeGroupPermission(group,MODERATE_THREADS); permManager.removeGroupPermission(group,MODERATE_MESSAGES); } else { permManager.removeGroupPermission(group,itemType[j]); } } } catch (Exception ignored) {} } } // done removing, so redirect back to this page response.sendRedirect("perms.jsp?forum="+forumID+"&mode="+mode+"&cat=" +categoryID+"&permGroup="+permGroup); return; }%><% // special onload command to load the sidebar if (forum != null) { onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\""; } if (category != null) { onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\""; } String bookmark = ""; if (permGroup == ADMIN_GROUP) { bookmark = "admin_perm_group"; } else if (permGroup == CONTENT_GROUP) { bookmark = "content_perm_group"; }%><%@ include file="header.jsp" %><p><% // Title of this page and breadcrumbs String title = null; String[][] breadcrumbs = null; // Print out different breadcrumbs depending if we're editing forum or // category permissions or if we're editing any admin perms. if (permGroup == ADMIN_GROUP) { title = "Administrators & Moderators"; if (forum == null) { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Content", "forums.jsp"}, {"Admins & Moderators", "perms.jsp?permGroup="+permGroup+"&mode="+mode} }; } else { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Admins & Moderators", "perms.jsp?permGroup="+permGroup+"&mode="+mode} }; } } else if (permGroup == CONTENT_GROUP) { if (mode == CAT_MODE) { title = "Category Permissions"; breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Categories & Forums", "forums.jsp"}, {title, "perms.jsp?cat="+categoryID+"&mode="+mode+"&permGroup="+permGroup} }; } else if (mode == FORUM_MODE) { // Show different breadcrumbs for global or local forums: if (forum == null) { title = "Global Forum Permissions"; breadcrumbs = new String[][] { {"Main", "main.jsp"}, {title, "perms.jsp?forum="+forumID+"&mode="+mode+"&permGroup="+permGroup} }; } else { title = "Forum Permissions"; breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Categories & Forums", "forums.jsp"}, {"Edit Forum", "editForum.jsp?forum="+forumID}, {title, "perms.jsp?forum="+forumID+"&mode="+mode+"&permGroup="+permGroup} }; } } }%><%@ include file="title.jsp" %><font size="-1"><% if (permGroup == ADMIN_GROUP) { %> <% if (forum != null) { %> Grant forum administrator privileges to users or groups for this forum. <% } else { // global %> Grant global forum admin or system admin privileges to users or groups. Note, this sets permission for admins over all forums. To designate administrators for individual forums, click on the "Content" tab, choose a forum then choose "Admins/Moderators" from the left menu. <% } %> Permissions are always additive, such that the final permissions for a forum will be global permissions, plus forum specific permissions.<% } else if (permGroup == CONTENT_GROUP) { %> <% if (mode == CAT_MODE) { %> Modify the permissions for categories. <% } else if (mode == FORUM_MODE) { %> <% if (forum == null) { %> Edit global permissions to set the permissions policies that all of your forums will use. <% } else { %> Permissions are always additive, such that the final permissions for a forum will be global permissions, plus forum specific permissions. <% } %> <% } %><% } %></font><p><font size="-1"><b>Permission Summary</b></font><ul> <font size="-1"> Below is a summary of permissions associated with various users and groups. To remove a permission, select the user or group and click "Remove". <p> </font> <table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="90%"> <tr><td> <table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="1" border="0" width="100%"> <tr bgcolor="#eeeeee"> <% // Loop through the perm group, display the table headers: for (int i=0; i<permGroupDef.length; i++) { String header = ((String)permNames.get(new Integer(permGroupDef[i]))).toUpperCase(); %> <td align="center"><table cellpadding="3" cellspacing="0" border="0"><tr><td><font size="-2" face="verdana"><b><%= header %></b></font></td></tr></table></td> <% } %> </tr> <tr bgcolor="#ffffff"> <% // Loop through the perm group array again, this time print the box // showing the list of users/groups that have the certain perm: for (int i=0; i<permGroupDef.length; i++) { int perm = permGroupDef[i]; Iterator iter = null; %> <form action="perms.jsp"> <input type="hidden" name="mode" value="<%= mode %>"> <input type="hidden" name="cat" value="<%= categoryID %>"> <input type="hidden" name="forum" value="<%= forumID %>"> <input type="hidden" name="remove" value="true"> <input type="hidden" name="itemType" value="<%= perm %>"> <input type="hidden" name="permGroup" value="<%= permGroup %>"> <td align="center"> <table cellpadding="3" cellspacing="0" border="0"><tr><td> <select size="5" name="items" multiple onchange=""> <% if (permManager.anonymousUserHasPermission(perm)) { %> <option value="u-1">* Anybody <% } %> <% if (permManager.registeredUserHasPermission(perm)) { %> <option value="u0">* Registered Users <% } %> <% if (perm == MODERATOR) { iter = getUserModerators(permManager); } else { iter = permManager.usersWithPermission(perm); } while (iter.hasNext()) { User user = (User)iter.next(); %> <option value="u<%= user.getID() %>"><%= user.getUsername() %> <% } %> <% if (perm == MODERATOR) { iter = getGroupModerators(permManager); } else { iter = permManager.groupsWithPermission(perm); } while (iter.hasNext()) { Group group = (Group)iter.next(); %> <option value="g<%= group.getID() %>"><%= group.getName() %> <% } %> </select> </td></tr></table><img src="images/line_gray.gif" width="100%" height="5" border="0" ><table cellpadding="3" cellspacing="0" border="0"><tr><td ><font size="-1"><input type="submit" value="Remove"></font></td></tr></table> </td> </form> <% } // end for %> </tr> </table> </td></tr> </table></ul><form method="post" action="perms.jsp" name="addForm"><input type="hidden" name="mode" value="<%= mode %>"><input type="hidden" name="cat" value="<%= categoryID %>"><input type="hidden" name="add" value="true"><input type="hidden" name="forum" value="<%= forumID %>"><input type="hidden" name="permGroup" value="<%= permGroup %>"><font size="-1"><b>Grant Permissions</b></font><ul> <font size="-1">Use the form below to grant a permission to guests, all users, a specific user or a specific group.</font> <p> <table cellpadding="0" cellspacing="0" border="0"> <tr><td> <font size="-1"><b>Grant Permission To:</b></font> </td> <td> <a href="#" onclick="helpwin('perms','grant_to');return false;" title="Click for help" ><img src="images/help.gif" width="12" height="15" hspace="8" border="0"></a> </td> </tr> </table> <ul> <table cellpadding="2" cellspacing="0" border="0"> <tr> <td><input type="radio" name="givePermTo" value="<%= ANYBODY %>" id="e1"></td> <td colspan="2"><font size="-1"><label for="e1">Anybody (including guests)</label></font></td> </tr> <tr> <td><input type="radio" name="givePermTo" value="<%= REGISTERED %>" id="e2"></td> <td colspan="2"><font size="-1"><label for="e2">Registered Users</label></font></td> </tr> <tr> <td><input type="radio" name="givePermTo" value="<%= USER %>" id="e3"></td> <td><font size="-1"><label for="e3">User:</label></font></td> <td><input type="text" name="username" value="(enter username)" size="20" onclick="this.select();document.addForm.givePermTo[2].checked=true;"></td> </tr> <tr> <td><input type="radio" name="givePermTo" value="<%= GROUP %>" id="e4"></td> <td><font size="-1"><label for="e4">Group:</label></font></td> <td><input type="text" name="groupname" value="(enter group name)" size="20" onclick="this.select();document.addForm.givePermTo[3].checked=true;"></td> </tr> </table> </ul><p> <table cellpadding="0" cellspacing="0" border="0"> <tr><td> <font size="-1"><b>Permission:</b></font> </td> <td> <a href="#" onclick="helpwin('perms','<%= bookmark %>');return false;" title="Click for help" ><img src="images/help.gif" width="12" height="15" hspace="8" border="0"></a> </td> </tr> </table> <ul> <table cellpadding="2" cellspacing="0" border="0"> <% // Loop through the perm group array, print out the perms we can set for (int i=0; i<permGroupDef.length; i++) { int perm = permGroupDef[i]; String permName = (String)permNames.get(new Integer(perm)); %> <tr> <td><input type="checkbox" name="permission" value="<%= perm %>" id="<%= (i+1) %>"></td> <td><font size="-1"><label for="<%= (i+1) %>"><%= permName %></label></font></td> </tr> <% } // end for %> </table> </ul><p> <% if (permGroup == ADMIN_GROUP) { %> <% if (forum != null) { %> <input type="submit" value="Grant Admin Permission"> <% } else { // global %> <input type="submit" value="Grant Global Admin Permission"> <% } %> <% } else if (permGroup == CONTENT_GROUP) { %> <% if (mode == CAT_MODE) { %> <input type="submit" value="Grant Permission"> <% } else if (mode == FORUM_MODE) { %> <% if (forum != null) { %> <input type="submit" value="Grant Forum Permission"> <% } else { %> <input type="submit" value="Grant Global Forum Permission"> <% } %> <% } %> <% } %></ul></form><p><%@ include file="footer.jsp" %>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?