Remove odd/even markup

Issue #12070

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-12-07 10:13:03 +01:00
parent 2c00f5e8ac
commit f36f61314f
9 changed files with 31 additions and 88 deletions

View File

@ -123,7 +123,6 @@ foreach ($tables as $table) {
echo ' <th>MIME</th>' , "\n";
}
echo '</tr>';
$odd_row = true;
foreach ($columns as $row) {
if ($row['Null'] == '') {
@ -146,9 +145,7 @@ foreach ($tables as $table) {
}
$column_name = $row['Field'];
echo '<tr class="';
echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row;
echo '">';
echo '<tr>';
echo '<td class="nowrap">';
echo htmlspecialchars($column_name);

View File

@ -90,7 +90,6 @@ foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
}
}
$odd = true;
foreach ($tables as $each_table) {
if (isset($_GET['table_select']) && is_array($_GET['table_select'])) {
$is_checked = PMA_getCheckedClause(
@ -118,7 +117,7 @@ foreach ($tables as $each_table) {
$data_checked = $is_checked;
}
$table_html = htmlspecialchars($each_table['Name']);
$multi_values .= '<tr class="' . ($odd ? 'odd' : 'even') . ' marked">';
$multi_values .= '<tr class="marked">';
$multi_values .= '<td><input type="checkbox" name="table_select[]"'
. ' value="' . $table_html . '"' . $is_checked . ' class="checkall"/></td>';
$multi_values .= '<td class="export_table_name">'
@ -130,7 +129,6 @@ foreach ($tables as $each_table) {
. '<input type="checkbox" name="table_data[]"'
. ' value="' . $table_html . '"' . $data_checked . ' /></td>';
$multi_values .= '</tr>';
$odd = ! $odd;
} // end for
$multi_values .= "\n";

View File

@ -49,7 +49,7 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname)
)
. '>' . __('Change password') . '</legend>'
. '<table class="data noclick">'
. '<tr class="odd">'
. '<tr>'
. '<td colspan="2">'
. '<input type="radio" name="nopass" value="1" id="nopass_1" '
. 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; '
@ -57,7 +57,7 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname)
. '<label for="nopass_1">' . __('No Password') . '</label>'
. '</td>'
. '</tr>'
. '<tr class="even vmiddle">'
. '<tr class="vmiddle">'
. '<td>'
. '<input type="radio" name="nopass" value="0" id="nopass_0" '
. 'onclick="document.getElementById(\'text_pma_change_pw\').focus();" '

View File

@ -985,7 +985,6 @@ function PMA_getHtmlForAliasModalDialog($db = '', $table = '')
. $class . '" width="100%">';
$col_html .= '<thead><tr><th>' . __('Old column name') . '</th>'
. '<th>' . __('New column name') . '</th></tr></thead><tbody>';
$class = 'odd';
foreach ($columns as $column => $col_def) {
$val = '';
if (!empty($aliases[$db]['tables'][$table]['columns'][$column])) {
@ -997,14 +996,13 @@ function PMA_getHtmlForAliasModalDialog($db = '', $table = '')
$name_attr = 'aliases[' . $db . '][tables][' . $table
. '][columns][' . $column . ']';
$id_attr = substr(md5($name_attr), 0, 12);
$col_html .= '<tr class="' . $class . '">';
$col_html .= '<tr>';
$col_html .= '<th><label for="' . $id_attr . '">' . $column
. '</label></th>';
$col_html .= '<td><dummy_inp type="text" name="' . $name_attr . '" '
. 'id="' . $id_attr . '" placeholder="'
. $column . ' alias" value="' . $val . '"></dummy_inp></td>';
$col_html .= '</tr>';
$class = $class === 'odd' ? 'even' : 'odd';
}
$col_html .= '</tbody></table>';
}

View File

@ -205,7 +205,6 @@ class Navigation
$html .= (! $first ? '<br/>' : '')
. '<strong>' . $lable . '</strong>';
$html .= '<table width="100%"><tbody>';
$odd = true;
foreach ($hidden[$t] as $hiddenItem) {
$params = array(
'unhideNavItem' => true,
@ -214,14 +213,13 @@ class Navigation
'dbName' => $dbName
);
$html .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$html .= '<tr>';
$html .= '<td>' . htmlspecialchars($hiddenItem) . '</td>';
$html .= '<td style="width:80px"><a href="navigation.php'
. URL::getCommon($params) . '"'
. ' class="unhideNavItem ajax">'
. Util::getIcon('show.png', __('Show'))
. '</a></td>';
$odd = ! $odd;
}
$html .= '</tbody></table>';
$first = false;

View File

@ -120,9 +120,10 @@ function PMA_RTE_getList($type, $items)
$retval .= " <!-- TABLE DATA -->\n";
$count = 0;
foreach ($items as $item) {
$rowclass = ($count % 2 == 0) ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
$rowclass .= ' ajaxInsert hide';
$rowclass = 'ajaxInsert hide';
} else {
$rowclass = '';
}
// Get each row from the correct function
switch ($type) {
@ -174,7 +175,7 @@ function PMA_RTE_getList($type, $items)
* Creates the contents for a row in the list of routines
*
* @param array $routine An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
* @param string $rowclass Additional class
*
* @return string HTML code of a row for the list of routines
*/
@ -327,7 +328,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
* Creates the contents for a row in the list of triggers
*
* @param array $trigger An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
* @param string $rowclass Additional class
*
* @return string HTML code of a cell for the list of triggers
*/
@ -406,7 +407,7 @@ function PMA_TRI_getRowForList($trigger, $rowclass = '')
* Creates the contents for a row in the list of events
*
* @param array $event An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
* @param string $rowclass Additional class
*
* @return string HTML code of a cell for the list of events
*/

View File

@ -1423,11 +1423,8 @@ function PMA_RTN_handleExecute()
}
$output .= "</tr>";
$color_class = 'odd';
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$output .= "<tr>" . browseRow($row, $color_class) . "</tr>";
$color_class = ($color_class == 'odd') ? 'even' : 'odd';
$output .= "<tr>" . browseRow($row) . "</tr>";
}
$output .= "</table>";
@ -1554,7 +1551,7 @@ function PMA_RTN_handleExecute()
*
* @return string
*/
function browseRow($row, $color_class)
function browseRow($row)
{
$output = null;
foreach ($row as $value) {
@ -1626,8 +1623,7 @@ function PMA_RTN_getExecuteForm($routine)
) {
continue;
}
$rowclass = ($i % 2 == 0) ? 'even' : 'odd';
$retval .= "\n<tr class='$rowclass'>\n";
$retval .= "\n<tr>\n";
$retval .= "<td>{$routine['item_param_name'][$i]}</td>\n";
$retval .= "<td>{$routine['item_param_type'][$i]}</td>\n";
if ($cfg['ShowFunctionFields']) {

View File

@ -81,7 +81,6 @@ function PMA_getHtmlForUserGroupsTable()
$html_output .= '</tr></thead>';
$html_output .= '<tbody>';
$odd = true;
$userGroups = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$groupName = $row['usergroup'];
@ -91,7 +90,7 @@ function PMA_getHtmlForUserGroupsTable()
$userGroups[$groupName][$row['tab']] = $row['allowed'];
}
foreach ($userGroups as $groupName => $tabs) {
$html_output .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$html_output .= '<tr>';
$html_output .= '<td>' . htmlspecialchars($groupName) . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($tabs, 'server') . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($tabs, 'db') . '</td>';
@ -129,8 +128,6 @@ function PMA_getHtmlForUserGroupsTable()
$html_output .= '</td>';
$html_output .= '</tr>';
$odd = ! $odd;
}
$html_output .= '</tbody>';

View File

@ -290,7 +290,6 @@ function PMA_getHtmlForTableVersionDetails(
$html .= '</thead>';
$html .= '<tbody>';
$style = 'odd';
$GLOBALS['dbi']->dataSeek($sql_result, 0);
$delete = PMA\libraries\Util::getIcon('b_drop.png', __('Delete version'));
$report = PMA\libraries\Util::getIcon('b_report.png', __('Tracking report'));
@ -312,7 +311,7 @@ function PMA_getHtmlForTableVersionDetails(
. '&amp;submit_delete_version=true';
$checkbox_id = 'selected_versions_' . htmlspecialchars($version['version']);
$html .= '<tr class="' . $style . '">';
$html .= '<tr>';
$html .= '<td class="center">';
$html .= '<input type="checkbox" name="selected_versions[]"'
. ' class="checkall" id="' . $checkbox_id . '"'
@ -344,12 +343,6 @@ function PMA_getHtmlForTableVersionDetails(
$html .= '">' . $structure . '</a>';
$html .= '</td>';
$html .= '</tr>';
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
}
$html .= '</tbody>';
@ -708,7 +701,6 @@ function PMA_getHtmlForDataManipulationStatements($data, $filter_users,
* @param array $filter_users filter users
* @param int $filter_ts_from filter time stamp from
* @param int $filter_ts_to filter time stamp to
* @param string $style style
* @param int $line_number line number
* @param array $url_params url parameters
* @param int $offset line number offset
@ -718,7 +710,7 @@ function PMA_getHtmlForDataManipulationStatements($data, $filter_users,
* @return string
*/
function PMA_getHtmlForOneStatement($entry, $filter_users,
$filter_ts_from, $filter_ts_to, $style, $line_number, $url_params, $offset,
$filter_ts_from, $filter_ts_to, $line_number, $url_params, $offset,
$drop_image_or_text, $delete_param
) {
$statement = PMA\libraries\Util::formatSql($entry['statement'], true);
@ -730,7 +722,7 @@ function PMA_getHtmlForOneStatement($entry, $filter_users,
&& $timestamp <= $filter_ts_to
&& (in_array('*', $filter_users) || $filtered_user)
) {
$html = '<tr class="noclick ' . $style . '">';
$html = '<tr class="noclick">';
$html .= '<td class="right"><small>' . $line_number . '</small></td>';
$html .= '<td><small>'
. htmlspecialchars($entry['date']) . '</small></td>';
@ -811,18 +803,12 @@ function PMA_getHtmlForDataStatements($data, $filter_users,
$html .= '</thead>';
$html .= '<tbody>';
$style = 'odd';
foreach ($data[$which_log] as $entry) {
$html .= PMA_getHtmlForOneStatement(
$entry, $filter_users, $filter_ts_from, $filter_ts_to, $style,
$entry, $filter_users, $filter_ts_from, $filter_ts_to,
$line_number, $url_params, $offset, $drop_image_or_text,
'delete_' . $which_log
);
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
$line_number++;
}
$html .= '</tbody>';
@ -905,15 +891,9 @@ function PMA_getHtmlForColumns($columns)
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody>';
$style = 'odd';
$index = 1;
foreach ($columns as $field) {
$html .= PMA_getHtmlForField($index++, $field, $style);
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
$html .= PMA_getHtmlForField($index++, $field);
}
$html .= '</tbody>';
@ -927,13 +907,12 @@ function PMA_getHtmlForColumns($columns)
*
* @param int $index index
* @param array $field field
* @param string $style style
*
* @return string
*/
function PMA_getHtmlForField($index, $field, $style)
function PMA_getHtmlForField($index, $field)
{
$html = '<tr class="noclick ' . $style . '">';
$html = '<tr class="noclick">';
$html .= '<td>' . $index . '</td>';
$html .= '<td><b>' . htmlspecialchars($field['Field']);
if ($field['Key'] == 'PRI') {
@ -1001,14 +980,8 @@ function PMA_getHtmlForIndexes($indexes)
$html .= '</tr>';
$html .= '<tbody>';
$style = 'odd';
foreach ($indexes as $index) {
$html .= PMA_getHtmlForIndex($index, $style);
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
$html .= PMA_getHtmlForIndex($index);
}
$html .= '</tbody>';
$html .= '</table>';
@ -1019,11 +992,10 @@ function PMA_getHtmlForIndexes($indexes)
* Function to get html for an index in schema snapshot
*
* @param array $index index
* @param string $style style
*
* @return string
*/
function PMA_getHtmlForIndex($index, $style)
function PMA_getHtmlForIndex($index)
{
if ($index['Non_unique'] == 0) {
$str_unique = __('Yes');
@ -1036,7 +1008,7 @@ function PMA_getHtmlForIndex($index, $style)
$str_packed = __('No');
}
$html = '<tr class="noclick ' . $style . '">';
$html = '<tr class="noclick">';
$html .= '<td><b>' . htmlspecialchars($index['Key_name']) . '</b></td>';
$html .= '<td>' . htmlspecialchars($index['Index_type']) . '</td>';
$html .= '<td>' . $str_unique . '</td>';
@ -1486,9 +1458,8 @@ function PMA_displayUntrackedTables(
<?php
// Print out list of untracked tables
$style = 'odd';
foreach ($untracked_tables as $key => $tablename) {
$style = PMA_displayOneUntrackedTable($db, $tablename, $url_query, $style);
PMA_displayOneUntrackedTable($db, $tablename, $url_query);
}
?>
</tbody>
@ -1517,11 +1488,10 @@ function PMA_displayUntrackedTables(
* @param string $db current database
* @param string $tablename the table name for which to display a line
* @param string $url_query url query string
* @param string $style odd|even
*
* @return string $style changed style (even|odd)
* @return void
*/
function PMA_displayOneUntrackedTable($db, $tablename, $url_query, $style)
function PMA_displayOneUntrackedTable($db, $tablename, $url_query)
{
$checkbox_id = "selected_tbl_"
. htmlspecialchars($tablename);
@ -1531,7 +1501,7 @@ function PMA_displayOneUntrackedTable($db, $tablename, $url_query, $style)
$my_link .= PMA\libraries\Util::getIcon('eye.png', __('Track table'));
$my_link .= '</a>';
?>
<tr class="<?php echo $style;?>">
<tr>
<td class="center">
<input type="checkbox" name="selected_tbl[]"
class="checkall" id="<?php echo $checkbox_id;?>"
@ -1545,13 +1515,7 @@ function PMA_displayOneUntrackedTable($db, $tablename, $url_query, $style)
<td><?php echo $my_link;?></td>
</tr>
<?php
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
}
return $style;
}
/**
@ -1649,7 +1613,6 @@ function PMA_displayTrackedTables(
__('Structure snapshot')
);
$style = 'odd';
while ($one_result = $GLOBALS['dbi']->fetchArray($all_tables_result)) {
list($table_name, $version_number) = $one_result;
$table_query = ' SELECT * FROM ' .
@ -1672,7 +1635,7 @@ function PMA_displayTrackedTables(
$checkbox_id = "selected_tbl_"
. htmlspecialchars($version_data['table_name']);
?>
<tr class="<?php echo $style;?>">
<tr>
<td class="center">
<input type="checkbox" name="selected_tbl[]"
class="checkall" id="<?php echo $checkbox_id;?>"
@ -1707,11 +1670,6 @@ function PMA_displayTrackedTables(
, $version_data['version'] , '">' , $structure , '</a>'
, '</td>'
, '</tr>';
if ($style == 'even') {
$style = 'odd';
} else {
$style = 'even';
}
}
?>
</tbody>