diff options
-rw-r--r-- | phpBB/adm/style/acp_groups_position.html | 158 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_groups.php | 124 | ||||
-rw-r--r-- | phpBB/includes/acp/info/acp_groups.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 67 | ||||
-rw-r--r-- | phpBB/language/en/acp/common.php | 1 | ||||
-rw-r--r-- | phpBB/language/en/acp/groups.php | 17 |
6 files changed, 368 insertions, 0 deletions
diff --git a/phpBB/adm/style/acp_groups_position.html b/phpBB/adm/style/acp_groups_position.html new file mode 100644 index 0000000000..9b18701179 --- /dev/null +++ b/phpBB/adm/style/acp_groups_position.html @@ -0,0 +1,158 @@ +<!-- INCLUDE overall_header.html -->
+
+<a name="maincontent"></a>
+
+ <h1>{L_MANAGE_LEGEND}</h1>
+
+ <form id="legend_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
+
+ <fieldset>
+ <legend>{L_LEGEND_SETTINGS}</legend>
+ <dl>
+ <dt><label for="legend_sort_groupname">{L_LEGEND_SORT_GROUPNAME}:</label><br /><span>{L_LEGEND_SORT_GROUPNAME_EXPLAIN}</span></dt>
+ <dd>
+ <label><input type="radio" name="legend_sort_groupname" class="radio" value="1"<!-- IF LEGEND_SORT_GROUPNAME --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+ <label><input type="radio" name="legend_sort_groupname" class="radio" value="0"<!-- IF not LEGEND_SORT_GROUPNAME --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
+ </dd>
+ </dl>
+
+ <p class="submit-buttons">
+ <input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
+ <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
+ <input type="hidden" name="action" value="set_config_legend" />
+ {S_FORM_TOKEN}
+ </p>
+ </fieldset>
+ </form>
+
+ <p>{L_LEGEND_EXPLAIN}</p>
+
+ <table cellspacing="1">
+ <col class="col1" /><col class="col2" /><col class="col2" />
+ <thead>
+ <tr>
+ <th style="width: 50%">{L_GROUP}</th>
+ <th>{L_GROUP_TYPE}</th>
+ <th>{L_ACTION}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- BEGIN legend -->
+ <tr>
+ <td><strong{legend.GROUP_COLOUR}>{legend.GROUP_NAME}</strong></td>
+ <td style="text-align: center;">{legend.GROUP_TYPE}</td>
+ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
+ <!-- IF legend.S_FIRST_ROW && not legend.S_LAST_ROW -->
+ {ICON_MOVE_UP_DISABLED}
+ <a href="{legend.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ <!-- ELSEIF not legend.S_FIRST_ROW && not legend.S_LAST_ROW -->
+ <a href="{legend.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ <a href="{legend.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ <!-- ELSEIF legend.S_LAST_ROW && not legend.S_FIRST_ROW -->
+ <a href="{legend.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ {ICON_MOVE_DOWN_DISABLED}
+ <!-- ELSE -->
+ {ICON_MOVE_UP_DISABLED}
+ {ICON_MOVE_DOWN_DISABLED}
+ <!-- ENDIF -->
+ <a href="{legend.U_DELETE}">{ICON_DELETE}</a>
+ </td>
+ </tr>
+ <!-- BEGINELSE -->
+ <tr>
+ <td colspan="3" class="row3">{L_NO_GROUPS_ADDED}</td>
+ </tr>
+ <!-- END legend -->
+ </tbody>
+ </table>
+
+ <form id="acp_groups" method="post" action="{U_ACTION_LEGEND}">
+ <fieldset class="quick">
+ <select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_LEGEND}</select>
+ <input class="button2" type="submit" name="submit" value="{L_ADD}" />
+ <input type="hidden" name="action" value="add" />
+ {S_FORM_TOKEN}
+ </fieldset>
+ </form>
+
+ <h1>{L_MANAGE_TEAMPAGE}</h1>
+
+ <form id="teampage_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
+
+ <fieldset>
+ <legend>{L_TEAMPAGE_SETTINGS}</legend>
+ <dl>
+ <dt><label for="teampage_multiple">{L_TEAMPAGE_MULTIPLE}:</label><br /><span>{L_TEAMPAGE_MULTIPLE_EXPLAIN}</span></dt>
+ <dd>
+ <label><input type="radio" name="teampage_multiple" class="radio" value="1"<!-- IF DISPLAY_MULTIPLE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+ <label><input type="radio" name="teampage_multiple" class="radio" value="0"<!-- IF not DISPLAY_MULTIPLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
+ </dd>
+ </dl>
+ <dl>
+ <dt><label for="teampage_forums">{L_TEAMPAGE_FORUMS}:</label><br /><span>{L_TEAMPAGE_FORUMS_EXPLAIN}</span></dt>
+ <dd>
+ <label><input type="radio" name="teampage_forums" class="radio" value="1"<!-- IF DISPLAY_FORUMS --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+ <label><input type="radio" name="teampage_forums" class="radio" value="0"<!-- IF not DISPLAY_FORUMS --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
+ </dd>
+ </dl>
+
+ <p class="submit-buttons">
+ <input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />
+ <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
+ <input type="hidden" name="action" value="set_config_teampage" />
+ {S_FORM_TOKEN}
+ </p>
+ </fieldset>
+ </form>
+
+ <p>{L_TEAMPAGE_EXPLAIN}</p>
+
+ <table cellspacing="1">
+ <col class="col1" /><col class="col2" /><col class="col2" />
+ <thead>
+ <tr>
+ <th style="width: 50%">{L_GROUP}</th>
+ <th>{L_GROUP_TYPE}</th>
+ <th>{L_ACTION}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- BEGIN teampage -->
+ <tr>
+ <td><strong{teampage.GROUP_COLOUR}>{teampage.GROUP_NAME}</strong></td>
+ <td style="text-align: center;">{teampage.GROUP_TYPE}</td>
+ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
+ <!-- IF teampage.S_FIRST_ROW && not teampage.S_LAST_ROW -->
+ {ICON_MOVE_UP_DISABLED}
+ <a href="{teampage.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ <!-- ELSEIF not teampage.S_FIRST_ROW && not teampage.S_LAST_ROW -->
+ <a href="{teampage.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ <a href="{teampage.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
+ <!-- ELSEIF teampage.S_LAST_ROW && not teampage.S_FIRST_ROW -->
+ <a href="{teampage.U_MOVE_UP}">{ICON_MOVE_UP}</a>
+ {ICON_MOVE_DOWN_DISABLED}
+ <!-- ELSE -->
+ {ICON_MOVE_UP_DISABLED}
+ {ICON_MOVE_DOWN_DISABLED}
+ <!-- ENDIF -->
+ <a href="{teampage.U_DELETE}">{ICON_DELETE}</a>
+ </td>
+ </tr>
+ <!-- BEGINELSE -->
+ <tr>
+ <td colspan="3" class="row3">{L_NO_GROUPS_ADDED}</td>
+ </tr>
+ <!-- END teampage -->
+ </tbody>
+ </table>
+
+ <form id="acp_groups" method="post" action="{U_ACTION_TEAMPAGE}">
+ <fieldset class="quick">
+ <select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_TEAMPAGE}</select>
+ <input class="button2" type="submit" name="submit" value="{L_ADD}" />
+ <input type="hidden" name="action" value="add" />
+ {S_FORM_TOKEN}
+ </fieldset>
+ </form>
+
+<!-- INCLUDE overall_footer.html -->
\ No newline at end of file diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index d47c12eafd..5e6ebcaa7d 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -35,6 +35,12 @@ class acp_groups $form_key = 'acp_groups'; add_form_key($form_key); + if ($mode == 'position') + { + $this->manage_position(); + return; + } + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); // Check and set some common vars @@ -306,6 +312,7 @@ class acp_groups 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, + 'teampage' => isset($_REQUEST['group_teampage']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0), 'max_recipients' => request_var('group_max_recipients', 0), 'founder_manage' => 0, @@ -419,6 +426,7 @@ class acp_groups 'avatar_height' => 'int', 'receive_pm' => 'int', 'legend' => 'int', + 'teampage' => 'int', 'message_limit' => 'int', 'max_recipients'=> 'int', 'founder_manage'=> 'int', @@ -584,6 +592,7 @@ class acp_groups 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', 'GROUP_FOUNDER_MANAGE' => (isset($group_row['group_founder_manage']) && $group_row['group_founder_manage']) ? ' checked="checked"' : '', 'GROUP_LEGEND' => (isset($group_row['group_legend']) && $group_row['group_legend']) ? ' checked="checked"' : '', + 'GROUP_TEAMPAGE' => (isset($group_row['group_teampage']) && $group_row['group_teampage']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', @@ -793,4 +802,119 @@ class acp_groups } } } + + public function manage_position() + { + global $config, $db, $template, $user; + + $this->tpl_name = 'acp_groups_position'; + $this->page_title = 'ACP_GROUPS_POSITION'; + + $field = request_var('field', ''); + $action = request_var('action', ''); + $group_id = request_var('g', 0); + + if ($field && !in_array($field, array('legend', 'teampage'))) + { + // Invalid mode + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + switch ($action) + { + case 'set_config_legend': + set_config('legend_sort_groupname', request_var('legend_sort_groupname', 0)); + break; + + + case 'set_config_teampage': + set_config('teampage_forums', request_var('teampage_forums', 0)); + set_config('teampage_multiple', request_var('teampage_multiple', 0)); + break; + + case 'add': + phpbb_group_positions::add_group($field, $group_id); + break; + + case 'delete': + phpbb_group_positions::delete_group($field, $group_id); + break; + + case 'move_up': + phpbb_group_positions::move_up($field, $group_id); + break; + + case 'move_down': + phpbb_group_positions::move_down($field, $group_id); + break; + } + + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend + FROM ' . GROUPS_TABLE . ' + ORDER BY group_legend, group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_select_legend = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + if ($row['group_legend']) + { + $template->assign_block_vars('legend', array( + 'GROUP_NAME' => $group_name, + 'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '', + 'GROUP_TYPE' => $user->lang[phpbb_group_positions::group_type_language($row['group_type'])], + + 'U_MOVE_DOWN' => "{$this->u_action}&field=legend&action=move_down&g=" . $row['group_id'], + 'U_MOVE_UP' => "{$this->u_action}&field=legend&action=move_up&g=" . $row['group_id'], + 'U_DELETE' => "{$this->u_action}&field=legend&action=delete&g=" . $row['group_id'], + )); + } + else + { + $s_group_select_legend .= '<option value="' . (int) $row['group_id'] . '">' . $group_name . '</option>'; + } + } + $db->sql_freeresult($result); + + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_teampage + FROM ' . GROUPS_TABLE . ' + ORDER BY group_teampage, group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_select_teampage = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; + if ($row['group_teampage']) + { + $template->assign_block_vars('teampage', array( + 'GROUP_NAME' => $group_name, + 'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '', + 'GROUP_TYPE' => $user->lang[phpbb_group_positions::group_type_language($row['group_type'])], + + 'U_MOVE_DOWN' => "{$this->u_action}&field=teampage&action=move_down&g=" . $row['group_id'], + 'U_MOVE_UP' => "{$this->u_action}&field=teampage&action=move_up&g=" . $row['group_id'], + 'U_DELETE' => "{$this->u_action}&field=teampage&action=delete&g=" . $row['group_id'], + )); + } + else + { + $s_group_select_teampage .= '<option value="' . (int) $row['group_id'] . '">' . $group_name . '</option>'; + } + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'U_ACTION_LEGEND' => $this->u_action . '&field=legend', + 'U_ACTION_TEAMPAGE' => $this->u_action . '&field=teampage', + + 'S_GROUP_SELECT_LEGEND' => $s_group_select_legend, + 'S_GROUP_SELECT_TEAMPAGE' => $s_group_select_teampage, + 'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false, + 'DISPLAY_MULTIPLE' => ($config['teampage_multiple']) ? true : false, + 'LEGEND_SORT_GROUPNAME' => ($config['legend_sort_groupname']) ? true : false, + )); + } } diff --git a/phpBB/includes/acp/info/acp_groups.php b/phpBB/includes/acp/info/acp_groups.php index bbf92d670e..36e8793007 100644 --- a/phpBB/includes/acp/info/acp_groups.php +++ b/phpBB/includes/acp/info/acp_groups.php @@ -21,6 +21,7 @@ class acp_groups_info 'version' => '1.0.0', 'modes' => array( 'manage' => array('title' => 'ACP_GROUPS_MANAGE', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')), + 'position' => array('title' => 'ACP_GROUPS_POSITION', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')), ), ); } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 317578cd54..fba96f93e9 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2495,6 +2495,69 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!sizeof($error)) { + + $current_legend = phpbb_group_positions::GROUP_DISABLED; + $current_teampage = phpbb_group_positions::GROUP_DISABLED; + if ($group_id) + { + $current_legend = phpbb_group_positions::get_group_value('legend', $group_id); + $current_teampage = phpbb_group_positions::get_group_value('teampage', $group_id); + } + + if (isset($group_attributes['group_legend'])) + { + if (($group_id && ($current_legend == phpbb_group_positions::GROUP_DISABLED)) || !$group_id) + { + // Old group currently not in the legend or new group, add at the end. + $group_attributes['group_legend'] = 1 + phpbb_group_positions::get_group_count('legend'); + } + else + { + // Group stayes in the legend + $group_attributes['group_legend'] = $current_legend; + } + } + else if ($group_id && ($current_legend > phpbb_group_positions::GROUP_DISABLED)) + { + // Group is removed from the legend + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = group_teampage - 1 + WHERE group_teampage > ' . $current_legend; + $db->sql_query($sql); + $group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED; + } + else + { + $group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED; + } + + if (isset($group_attributes['group_teampage'])) + { + if (($group_id && ($current_teampage == phpbb_group_positions::GROUP_DISABLED)) || !$group_id) + { + // Old group currently not on the teampage or new group, add at the end. + $group_attributes['group_teampage'] = 1 + phpbb_group_positions::get_group_count('teampage'); + } + else + { + // Group stayes on the teampage + $group_attributes['group_teampage'] = $current_teampage; + } + } + else if ($group_id && ($current_teampage > phpbb_group_positions::GROUP_DISABLED)) + { + // Group is removed from the teampage + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = group_teampage - 1 + WHERE group_teampage > ' . $current_teampage; + $db->sql_query($sql); + $group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED; + } + else + { + $group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED; + } + $user_ary = array(); $sql_ary = array( 'group_name' => (string) $name, @@ -2719,6 +2782,10 @@ function group_delete($group_id, $group_name = false) } while ($start); + // Delete group from legend and teampage + phpbb_group_positions::delete_group('legend', $group_id); + phpbb_group_positions::delete_group('teampage', $group_id); + // Delete group $sql = 'DELETE FROM ' . GROUPS_TABLE . " WHERE group_id = $group_id"; diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 25a020d8a2..847e763ae8 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -100,6 +100,7 @@ $lang = array_merge($lang, array( 'ACP_GROUPS_MANAGE' => 'Manage groups', 'ACP_GROUPS_MANAGEMENT' => 'Group management', 'ACP_GROUPS_PERMISSIONS' => 'Groups’ permissions', + 'ACP_GROUPS_POSITION' => 'Manage group positions', 'ACP_ICONS' => 'Topic icons', 'ACP_ICONS_SMILIES' => 'Topic icons/smilies', diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index 3b3953ac36..9cc386f6fd 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -97,6 +97,8 @@ $lang = array_merge($lang, array( 'GROUP_SETTINGS_SAVE' => 'Group wide settings', 'GROUP_SKIP_AUTH' => 'Exempt group leader from permissions', 'GROUP_SKIP_AUTH_EXPLAIN' => 'If enabled group leader no longer inherit permissions from the group.', + 'GROUP_SPECIAL' => 'Pre-defined', + 'GROUP_TEAMPAGE' => 'Display group on teampage', 'GROUP_TYPE' => 'Group type', 'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.', 'GROUP_UPDATED' => 'Group preferences updated successfully.', @@ -105,19 +107,34 @@ $lang = array_merge($lang, array( 'GROUP_USERS_EXIST' => 'The selected users are already members.', 'GROUP_USERS_REMOVE' => 'Users removed from group and new defaults set successfully.', + 'LEGEND_EXPLAIN' => 'These are the groups, which are viewed on the group legend:', + 'LEGEND_SETTINGS' => 'Legend settings', + 'LEGEND_SORT_GROUPNAME' => 'Sort legend by group name', + 'LEGEND_SORT_GROUPNAME_EXPLAIN' => 'The order from bellow is ignored when this option is enabled.', + + 'MANAGE_LEGEND' => 'Manage group legend', + 'MANAGE_TEAMPAGE' => 'Manage teampage', 'MAKE_DEFAULT_FOR_ALL' => 'Make default group for every member', 'MEMBERS' => 'Members', 'NO_GROUP' => 'No group specified.', + 'NO_GROUPS_ADDED' => 'No groups added yet.', 'NO_GROUPS_CREATED' => 'No groups created yet.', 'NO_PERMISSIONS' => 'Do not copy permissions', 'NO_USERS' => 'You haven’t entered any users.', 'NO_USERS_ADDED' => 'No users were added to the group.', 'NO_VALID_USERS' => 'You haven’t entered any users eligible for that action.', + 'SELECT_GROUP' => 'Select a group', 'SPECIAL_GROUPS' => 'Pre-defined groups', 'SPECIAL_GROUPS_EXPLAIN' => 'Pre-defined groups are special groups, they cannot be deleted or directly modified. However you can still add users and alter basic settings.', + 'TEAMPAGE_EXPLAIN' => 'These are the groups, which are viewed on the teampage:', + 'TEAMPAGE_FORUMS' => 'Display moderator forums', + 'TEAMPAGE_FORUMS_EXPLAIN' => 'If set to yes, moderators will have a list with all of the forums, where they have moderator permissions, in their row. This can be very SQL intensive for big boards.', + 'TEAMPAGE_MULTIPLE' => 'Display users in all groups', + 'TEAMPAGE_MULTIPLE_EXPLAIN' => 'If set to no, the users will only be displayed in their first group.', + 'TEAMPAGE_SETTINGS' => 'Teampage settings', 'TOTAL_MEMBERS' => 'Members', 'USERS_APPROVED' => 'Users approved successfully.', |