[ticket/10411] Use template loops instead of defining the html in php files

PHPBB3-10411
This commit is contained in:
Joas Schilling 2013-02-25 20:24:11 +01:00
parent 12cc64e715
commit 9ea48dbd45
3 changed files with 30 additions and 14 deletions

View file

@ -39,7 +39,7 @@
<tbody> <tbody>
<!-- BEGIN legend --> <!-- BEGIN legend -->
<tr data-down="{legend.U_MOVE_DOWN}" data-up="{legend.U_MOVE_UP}"> <tr data-down="{legend.U_MOVE_DOWN}" data-up="{legend.U_MOVE_UP}">
<td><strong{legend.GROUP_COLOUR}>{legend.GROUP_NAME}</strong></td> <td><strong<!-- IF legend.GROUP_COLOUR --> style="color: {legend.GROUP_COLOUR}"<!-- ENDIF -->>{legend.GROUP_NAME}</strong></td>
<td style="text-align: center;">{legend.GROUP_TYPE}</td> <td style="text-align: center;">{legend.GROUP_TYPE}</td>
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;"> <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
<!-- IF legend.S_FIRST_ROW && not legend.S_LAST_ROW --> <!-- IF legend.S_FIRST_ROW && not legend.S_LAST_ROW -->
@ -68,7 +68,12 @@
<form id="legend_add_group" method="post" action="{U_ACTION_LEGEND}"> <form id="legend_add_group" method="post" action="{U_ACTION_LEGEND}">
<fieldset class="quick"> <fieldset class="quick">
<select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_LEGEND}</select> <select name="g">
<option value="0">{L_SELECT_GROUP}</option>
<!-- BEGIN add_legend -->
<option<!-- IF add_legend.GROUP_SPECIAL --> class="sep"<!-- ENDIF --> value="{add_legend.GROUP_ID}">{add_legend.GROUP_NAME}</option>
<!-- END add_legend -->
</select>
<input class="button2" type="submit" name="submit" value="{L_ADD}" /> <input class="button2" type="submit" name="submit" value="{L_ADD}" />
<input type="hidden" name="action" value="add" /> <input type="hidden" name="action" value="add" />
{S_FORM_TOKEN} {S_FORM_TOKEN}
@ -126,7 +131,7 @@
<!-- IF teampage.U_CATEGORY --> <!-- IF teampage.U_CATEGORY -->
<a href="{teampage.U_CATEGORY}">{teampage.GROUP_NAME}</a> <a href="{teampage.U_CATEGORY}">{teampage.GROUP_NAME}</a>
<!-- ELSE --> <!-- ELSE -->
<strong{teampage.GROUP_COLOUR}>{teampage.GROUP_NAME}</strong> <strong<!-- IF teampage.GROUP_COLOUR --> style="color: {teampage.GROUP_COLOUR}"<!-- ENDIF -->>{teampage.GROUP_NAME}</strong>
<!-- ENDIF --> <!-- ENDIF -->
</td> </td>
<td style="text-align: center;"><!-- IF teampage.GROUP_TYPE -->{teampage.GROUP_TYPE}<!-- ELSE -->-<!-- ENDIF --> <td style="text-align: center;"><!-- IF teampage.GROUP_TYPE -->{teampage.GROUP_TYPE}<!-- ELSE -->-<!-- ENDIF -->
@ -159,8 +164,8 @@
<!-- IF not S_TEAMPAGE_CATEGORY --> <!-- IF not S_TEAMPAGE_CATEGORY -->
<form id="teampage_add_category" method="post" action="{U_ACTION_TEAMPAGE}"> <form id="teampage_add_category" method="post" action="{U_ACTION_TEAMPAGE}">
<fieldset class="quick"> <fieldset class="quick">
<input class="inputbox autowidth" type="text" name="category_name" placeholder="{L_CATEGORY_NAME}" /> <input class="inputbox autowidth" type="text" name="category_name" placeholder="{L_GROUP_CATEGORY_NAME}" />
<input class="button2" type="submit" name="submit" value="{L_ADD_CATEGORY}" /> <input class="button2" type="submit" name="submit" value="{L_ADD_GROUP_CATEGORY}" />
<input type="hidden" name="action" value="add_category" /> <input type="hidden" name="action" value="add_category" />
{S_FORM_TOKEN} {S_FORM_TOKEN}
</fieldset> </fieldset>
@ -169,7 +174,12 @@
<form id="teampage_add_group" method="post" action="{U_ACTION_TEAMPAGE}"> <form id="teampage_add_group" method="post" action="{U_ACTION_TEAMPAGE}">
<fieldset class="quick"> <fieldset class="quick">
<select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_TEAMPAGE}</select> <select name="g">
<option value="0">{L_SELECT_GROUP}</option>
<!-- BEGIN add_teampage -->
<option<!-- IF add_teampage.GROUP_SPECIAL --> class="sep"<!-- ENDIF --> value="{add_teampage.GROUP_ID}">{add_teampage.GROUP_NAME}</option>
<!-- END add_teampage -->
</select>
<input class="button2" type="submit" name="submit" value="{L_ADD}" /> <input class="button2" type="submit" name="submit" value="{L_ADD}" />
<input type="hidden" name="action" value="add" /> <input type="hidden" name="action" value="add" />
{S_FORM_TOKEN} {S_FORM_TOKEN}

View file

@ -916,7 +916,7 @@ class acp_groups
{ {
$template->assign_block_vars('legend', array( $template->assign_block_vars('legend', array(
'GROUP_NAME' => $group_name, 'GROUP_NAME' => $group_name,
'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '', 'GROUP_COLOUR' => ($row['group_colour']) ? '#' . $row['group_colour'] : '',
'GROUP_TYPE' => $user->lang[phpbb_groupposition_legend::group_type_language($row['group_type'])], 'GROUP_TYPE' => $user->lang[phpbb_groupposition_legend::group_type_language($row['group_type'])],
'U_MOVE_DOWN' => "{$this->u_action}&amp;field=legend&amp;action=move_down&amp;g=" . $row['group_id'], 'U_MOVE_DOWN' => "{$this->u_action}&amp;field=legend&amp;action=move_down&amp;g=" . $row['group_id'],
@ -926,7 +926,11 @@ class acp_groups
} }
else else
{ {
$s_group_select_legend .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . (int) $row['group_id'] . '">' . $group_name . '</option>'; $template->assign_block_vars('add_legend', array(
'GROUP_ID' => (int) $row['group_id'],
'GROUP_NAME' => $group_name,
'GROUP_SPECIAL' => ($row['group_type'] == GROUP_SPECIAL),
));
} }
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -966,7 +970,7 @@ class acp_groups
$template->assign_block_vars('teampage', array( $template->assign_block_vars('teampage', array(
'GROUP_NAME' => $group_name, 'GROUP_NAME' => $group_name,
'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '', 'GROUP_COLOUR' => ($row['group_colour']) ? '#' . $row['group_colour'] : '',
'GROUP_TYPE' => $group_type, 'GROUP_TYPE' => $group_type,
'U_CATEGORY' => (!$row['group_id']) ? "{$this->u_action}&amp;c=" . $row['teampage_id'] : '', 'U_CATEGORY' => (!$row['group_id']) ? "{$this->u_action}&amp;c=" . $row['teampage_id'] : '',
@ -989,7 +993,11 @@ class acp_groups
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
$s_group_select_teampage .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . (int) $row['group_id'] . '">' . $group_name . '</option>'; $template->assign_block_vars('add_teampage', array(
'GROUP_ID' => (int) $row['group_id'],
'GROUP_NAME' => $group_name,
'GROUP_SPECIAL' => ($row['group_type'] == GROUP_SPECIAL),
));
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -999,8 +1007,6 @@ class acp_groups
'U_ACTION_TEAMPAGE' => $this->u_action . '&amp;field=teampage' . $category_url_param, 'U_ACTION_TEAMPAGE' => $this->u_action . '&amp;field=teampage' . $category_url_param,
'U_ACTION_TEAMPAGE_CAT' => $this->u_action . '&amp;field=teampage_cat', 'U_ACTION_TEAMPAGE_CAT' => $this->u_action . '&amp;field=teampage_cat',
'S_GROUP_SELECT_LEGEND' => $s_group_select_legend,
'S_GROUP_SELECT_TEAMPAGE' => $s_group_select_teampage,
'S_TEAMPAGE_CATEGORY' => $category_id, 'S_TEAMPAGE_CATEGORY' => $category_id,
'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false, 'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false,
'DISPLAY_MEMBERSHIPS' => $config['teampage_memberships'], 'DISPLAY_MEMBERSHIPS' => $config['teampage_memberships'],

View file

@ -36,14 +36,13 @@ if (empty($lang) || !is_array($lang))
$lang = array_merge($lang, array( $lang = array_merge($lang, array(
'ACP_GROUPS_MANAGE_EXPLAIN' => 'From this panel you can administer all your usergroups. You can delete, create and edit existing groups. Furthermore, you may choose group leaders, toggle open/hidden/closed group status and set the group name and description.', 'ACP_GROUPS_MANAGE_EXPLAIN' => 'From this panel you can administer all your usergroups. You can delete, create and edit existing groups. Furthermore, you may choose group leaders, toggle open/hidden/closed group status and set the group name and description.',
'ADD_CATEGORY' => 'Add category', 'ADD_GROUP_CATEGORY' => 'Add category',
'ADD_USERS' => 'Add users', 'ADD_USERS' => 'Add users',
'ADD_USERS_EXPLAIN' => 'Here you can add new users to the group. You may select whether this group becomes the new default for the selected users. Additionally you can define them as group leaders. Please enter each username on a separate line.', 'ADD_USERS_EXPLAIN' => 'Here you can add new users to the group. You may select whether this group becomes the new default for the selected users. Additionally you can define them as group leaders. Please enter each username on a separate line.',
'COPY_PERMISSIONS' => 'Copy permissions from', 'COPY_PERMISSIONS' => 'Copy permissions from',
'COPY_PERMISSIONS_EXPLAIN' => 'Once created, the group will have the same permissions as the one you select here.', 'COPY_PERMISSIONS_EXPLAIN' => 'Once created, the group will have the same permissions as the one you select here.',
'CREATE_GROUP' => 'Create new group', 'CREATE_GROUP' => 'Create new group',
'CATEGORY_NAME' => 'Category name',
'GROUPS_NO_MEMBERS' => 'This group has no members', 'GROUPS_NO_MEMBERS' => 'This group has no members',
'GROUPS_NO_MODS' => 'No group leaders defined', 'GROUPS_NO_MODS' => 'No group leaders defined',
@ -52,6 +51,7 @@ $lang = array_merge($lang, array(
'GROUP_APPROVED' => 'Approved members', 'GROUP_APPROVED' => 'Approved members',
'GROUP_AVATAR' => 'Group avatar', 'GROUP_AVATAR' => 'Group avatar',
'GROUP_AVATAR_EXPLAIN' => 'This image will be displayed in the Group Control Panel.', 'GROUP_AVATAR_EXPLAIN' => 'This image will be displayed in the Group Control Panel.',
'GROUP_CATEGORY_NAME' => 'Category name',
'GROUP_CLOSED' => 'Closed', 'GROUP_CLOSED' => 'Closed',
'GROUP_COLOR' => 'Group colour', 'GROUP_COLOR' => 'Group colour',
'GROUP_COLOR_EXPLAIN' => 'Defines the colour members usernames will appear in, leave blank for user default.', 'GROUP_COLOR_EXPLAIN' => 'Defines the colour members usernames will appear in, leave blank for user default.',