} // END - if
// List all menu points and make them editable
-if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Edit menu entries
// @TODO Kill all constants in this file
$content['sub'] = $SUB;
$content['chk'] = countPostSelection();
- $cnt = '0'; $SW = 2;
+ $cnt = '0';
foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
$cnt++;
$data = array(
'action' => adminAddMenuSelectionBox('admin', 'action', 'sel_action[' . $sel . ']', $data['action']),
'what' => adminAddMenuSelectionBox('admin', 'what' , 'sel_what[' . $sel . ']', $data['what']),
- 'sw' => $SW,
'sel' => $sel,
'menu' => $data['title'],
'descr' => $data['descr'],
} else {
// Entry not found?
$data = array(
- 'sw' => $SW,
'sel' => $sel
);
// Free result and switch color
SQL_FREERESULT($result);
- $SW = 3 - $SW;
} // END - if
} // END - foreach
// Load template
loadTemplate('admin_amenu_edit_form', false, $content);
-} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+} elseif ((isFormSent('del')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Prepare misc content
$content['sub'] = $SUB;
$content['chk'] = countPostSelection();
// Del menu entries with or without confirmation
- $SW = 2; $cnt = '0'; $OUT = '';
+ $cnt = '0'; $OUT = '';
foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
$cnt++;
'menu' => $data['title'],
'cnt' => $cnt,
'sel' => $sel,
- 'sw' => $SW
);
$OUT .= loadTemplate('admin_amenu_delete_row', true, $data);
} else {
// Entry not found?
$data = array(
- 'sw' => $SW,
'sel' => $sel
);
$OUT .= loadTemplate('admin_menu_404_row', true, $data);
}
SQL_FREERESULT($result);
- $SW = 3 - $SW;
- }
- }
+ } // END - if
+ } // END - switch
$content['rows'] = $OUT;
$content['cnt'] = $cnt;
break;
}
} else {
- if ((isGetRequestParameterSet(('act'))) && (isGetRequestParameterSet(('tid'))) && (isGetRequestParameterSet(('fid')))) {
+ if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) {
// Get ids
- if (isGetRequestParameterSet(('w'))) {
+ if (isGetRequestParameterSet('w')) {
// Sub menus selected
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
array(getRequestParameter('act'), bigintval(getRequestParameter('tid'))), __FILE__, __LINE__);
array(bigintval(getRequestParameter('tid')), bigintval($fid)), __FILE__, __LINE__);
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__);
- }
- }
+ } // END - if
+ } // END - if
// By default list menus
if (!empty($SUB)) {
$content['sub'] = $SUB;
// Init variables
- $OUT = ''; $SW = 2; $cnt = '0';
+ $OUT = ''; $cnt = '0';
// Process all entries
while ($data = SQL_FETCHARRAY($result)) {
$data['navi'] = '<a href="{%url=modules.php?module=admin&what=adminedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']-1) . '&fid=' . $data['sort'] . '%}">{--HIGHER--}</a>/<a href="{%url=modules.php?module=admin&what=adminedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']+1) . '&fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
}
- // Fix empty elements for constant (fixes display bugs in Firefox)
- if (empty($data['action'])) $data['action'] = ' ';
- if (empty($data['what'])) $data['what'] = ' ';
- if (empty($data['title'])) $data['title'] = ' ';
-
// Add more data to $data
- $data['sw'] = $SW;
$data['mode'] = 'admin';
// Load row template and switch colors
$OUT .= loadTemplate('admin_menu_overview_row', true, $data);
- $SW = 3 - $SW;
} // END - switch
// Remember all rows