From: Henry S. <kel...@ph...> - 2009-07-31 12:47:30
|
Author: Kellanved Date: Fri Jul 31 13:46:15 2009 New Revision: 9896 Log: Add box if users decided not to select a forum to copy permissions from on forum creation Added: branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html (with props) Modified: branches/phpBB-3_0_0/phpBB/includes/acp/acp_forums.php branches/phpBB-3_0_0/phpBB/language/en/acp/forums.php Added: branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html (added) --- branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html Fri Jul 31 13:46:15 2009 *************** *** 0 **** --- 1,21 ---- + <!-- INCLUDE overall_header.html --> + + <form id="confirm" method="post" action="{S_COPY_ACTION}"> + + <fieldset> + <h1>{L_COPY_PERMISSIONS}</h1> + <p>{L_COPY_PERMISSIONS_EXPLAIN}</p> + <p>{L_ACL_LINK}</p> + <dl> + <dt><label for="forum_perm_from">{L_COPY_PERMISSIONS}:</label><br /><span>{L_COPY_PERMISSIONS_EXPLAIN}</span></dt> + <dd><select id="forum_perm_from" name="forum_perm_from"><option value="0">{L_NO_PERMISSIONS}</option>{S_FORUM_OPTIONS}</select></dd> + </dl> + <div style="text-align: center;">{S_FORM_TOKEN}{S_HIDDEN_FIELDS} + <input type="submit" name="update" value="{L_CONTINUE}" class="button2" /> + </div> + + </fieldset> + + </form> + + <!-- INCLUDE overall_footer.html --> Propchange: branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html ------------------------------------------------------------------------------ svn:eol-style = LF Propchange: branches/phpBB-3_0_0/phpBB/adm/style/acp_forums_copy_perm.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: branches/phpBB-3_0_0/phpBB/includes/acp/acp_forums.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/acp/acp_forums.php (original) --- branches/phpBB-3_0_0/phpBB/includes/acp/acp_forums.php Fri Jul 31 13:46:15 2009 *************** *** 74,79 **** --- 74,86 ---- { trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } + + case 'copy_perm': + + if (!(($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) + { + trigger_error($user->lang['NO_PERMISSION_COPY'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } break; } *************** *** 190,195 **** --- 197,208 ---- copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); cache_moderators(); } + else if (($action != 'edit') && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->copy_permission_page($forum_data); + return; + } + $auth->acl_clear_prefetch(); $cache->destroy('sql', FORUMS_TABLE); *************** *** 687,692 **** --- 700,735 ---- return; break; + + case 'copy_perm': + $forum_perm_from = request_var('forum_perm_from', 0); + + // Copy permissions? + if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) + { + copy_forum_permissions($forum_perm_from, $forum_id, true); + cache_moderators(); + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_id; + + $message = $user->lang['FORUM_UPDATED']; + + // Redirect to permissions + if ($auth->acl_get('a_fauth')) + { + $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); + } + + // redirect directly to permission settings screen if authed + if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) + { + meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } } // Default management page *************** *** 1876,1881 **** --- 1919,1948 ---- adm_page_footer(); } + + function copy_permission_page($forum_data) + { + global $phpEx, $phpbb_admin_path, $template, $user; + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); + + + $l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>'); + + + + $this->tpl_name = 'acp_forums_copy_perm'; + + $template->assign_vars(array( + 'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url), + 'L_ACL_LINK' => $l_acl, + 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), + 'S_COPY_ACTION' => $action, + 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], false, false, false, false), + )); + } + } ?> \ No newline at end of file Modified: branches/phpBB-3_0_0/phpBB/language/en/acp/forums.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/language/en/acp/forums.php (original) --- branches/phpBB-3_0_0/phpBB/language/en/acp/forums.php Fri Jul 31 13:46:15 2009 *************** *** 44,52 **** --- 44,55 ---- 'AUTO_PRUNE_VIEWED' => 'Auto-prune post viewed age', 'AUTO_PRUNE_VIEWED_EXPLAIN' => 'Number of days since topic was viewed after which topic is removed.', + 'CONTINUE' => 'Continue', 'COPY_PERMISSIONS' => 'Copy permissions from', + 'COPY_PERMISSIONS_EXPLAIN' => 'To ease up the permission setup for your new forum, you can copy the permissions of an existing forum.', 'COPY_PERMISSIONS_ADD_EXPLAIN' => 'Once created, the forum will have the same permissions as the one you select here. If no forum is selected the newly created forum will not be visible until permissions had been set.', 'COPY_PERMISSIONS_EDIT_EXPLAIN' => 'If you select to copy permissions, the forum will have the same permissions as the one you select here. This will overwrite any permissions you have previously set for this forum with the permissions of the forum you select here. If no forum is selected the current permissions will be kept.', + 'COPY_TO_ACL' => 'Alternatively, you are also able to %sset up new permissions%s for this forum.', 'CREATE_FORUM' => 'Create new forum', 'DECIDE_MOVE_DELETE_CONTENT' => 'Delete content or move to forum', |