From d22aff2ba7ed5e5126edb2fd2bcbdfed61b8d8c5 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 17 Aug 2023 22:59:08 +0100 Subject: [PATCH] Fix for missing buttons in empty product-type Extras sub-pages (#5935) * Fix for empty Extras sub-menus Fixes #5923 Admin > Extras > Media Types was fixed in #5924, this PR fixes the remaining sub-menus --- admin/media_manager.php | 22 ++++++++++++---------- admin/music_genre.php | 19 ++++++++++--------- admin/record_artists.php | 19 ++++++++++--------- admin/record_company.php | 19 ++++++++++--------- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/admin/media_manager.php b/admin/media_manager.php index 446c1bf461..c23f9db2fa 100644 --- a/admin/media_manager.php +++ b/admin/media_manager.php @@ -34,7 +34,7 @@ break; case 'new_cat': $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : (int)$current_category_id); - zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=products¤t_category_id=' . $current_category_id . '&mID=' . $_GET['mID'] . '&page=' . $_GET['page'])); + zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=products¤t_category_id=' . $current_category_id . (isset($_GET['mID']) ? '&mID=' . $_GET['mID'] : '') . '&page=' . $_GET['page'])); break; case 'remove_clip': if (isset($_POST['mID']) && isset($_POST['clip_id'])) @@ -157,10 +157,12 @@ $media_query_raw = "SELECT * FROM " . TABLE_MEDIA_MANAGER . " ORDER BY media_name"; $media_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $media_query_raw, $media_query_numrows); $media = $db->Execute($media_query_raw); + $mManager_parameter = ''; while (!$media->EOF) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $media->fields['media_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) { $mInfo = new objectInfo($media->fields); + $mManager_parameter = '&mID=' . $mInfo->media_id; } if (isset($mInfo) && is_object($mInfo) && ($media->fields['media_id'] == $mInfo->media_id)) { @@ -189,10 +191,10 @@ - media_id . '&action=new') . '" class="btn btn-primary" role="button">' . IMAGE_INSERT . ''; ?> + ' . IMAGE_INSERT . ''; ?> TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_MEDIA_COLLECTION_NAME . '
' . zen_draw_input_field('media_name', '', zen_set_field_length(TABLE_MEDIA_MANAGER, 'media_name'))); - $contents[] = array('align' => 'center', 'text' => '
' . '' . ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => '
' . '' . ' ' . IMAGE_CANCEL . ''); break; case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_MEDIA_COLLECTION . ''); - $contents[] = array('text' => zen_draw_form('collections', FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'] . '&mID=' . $mInfo->media_id . '&action=save', 'post', 'enctype="multipart/form-data"')); + $contents[] = array('text' => zen_draw_form('collections', FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'] . $mManager_parameter . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => '
' . TEXT_MEDIA_COLLECTION_NAME . '
' . zen_draw_input_field('media_name', htmlspecialchars($mInfo->media_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_MEDIA_MANAGER, 'media_name'))); - $contents[] = array('align' => 'center', 'text' => '
' . '' . ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => '
' . '' . ' ' . IMAGE_CANCEL . ''); $contents[] = array('text' => zen_draw_separator('pixel_black.gif')); $contents[] = array('text' => TEXT_MEDIA_EDIT_INSTRUCTIONS); @@ -257,7 +259,7 @@ $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count)); } - $contents[] = array('align' => 'center', 'text' => '
' . ''. ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => '
' . ''. ' ' . IMAGE_CANCEL . ''); break; case 'products': $heading[] = array('text' => '' . TEXT_HEADING_ASSIGN_MEDIA_COLLECTION . ''); @@ -298,13 +300,13 @@ $contents[] = array('text'=>zen_draw_form('remove_product', FILENAME_MEDIA_MANAGER, 'action=remove_product&page=' . $_GET['page']) . '' . '' . ''. ' ' . $zc_products->products_name($products_linked->fields['product_id']) . '
' . ''); $products_linked->MoveNext(); } - $contents[] = array('align' => 'center', 'text' => '
' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => '
' . IMAGE_CANCEL . ''); break; default: if (isset($mInfo) && is_object($mInfo)) { $heading[] = array('text' => '' . $mInfo->media_name . ''); - $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ' ' . '' . IMAGE_PRODUCTS . ''); + $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ' ' . '' . IMAGE_PRODUCTS . ''); $contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($mInfo->date_added)); if (zen_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($mInfo->last_modified)); $products_linked_query = "SELECT product_id FROM " . TABLE_MEDIA_TO_PRODUCTS . " @@ -341,4 +343,4 @@
- + \ No newline at end of file diff --git a/admin/music_genre.php b/admin/music_genre.php index d30d2c5ae9..da2f160f2d 100644 --- a/admin/music_genre.php +++ b/admin/music_genre.php @@ -89,7 +89,7 @@ ORDER BY music_genre_name"; $music_genre_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $music_genre_query_raw, $music_genre_query_numrows); $music_genres = $db->Execute($music_genre_query_raw); - + $mGenre_parameter = ''; foreach ($music_genres as $music_genre) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $music_genre['music_genre_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) { $music_genre_products = $db->Execute("SELECT COUNT(*) AS products_count @@ -98,6 +98,7 @@ $aInfo_array = array_merge($music_genre, $music_genre_products->fields); $aInfo = new objectInfo($aInfo_array); + $mGenre_parameter = '&mID=' . $aInfo->music_genre_id; } if (isset($aInfo) && is_object($aInfo) && ($music_genre['music_genre_id'] == $aInfo->music_genre_id)) { @@ -132,14 +133,14 @@ $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'action=insert', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => zen_draw_label(TEXT_MUSIC_GENRE_NAME, 'music_genre_name', 'class="control-label"') . zen_draw_input_field('music_genre_name', '', zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name') . ' class="form-control"')); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'edit': $heading[] = array('text' => '

' . TEXT_HEADING_EDIT_MUSIC_GENRE . '

'); - $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=save', 'post', 'enctype="multipart/form-data"')); + $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . $mGenre_parameter . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => zen_draw_label(TEXT_MUSIC_GENRE_NAME, 'music_genre_name', 'class="control-label"') . zen_draw_input_field('music_genre_name', htmlspecialchars($aInfo->music_genre_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name') . ' class="form-control"')); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'delete': $heading[] = array('text' => '

' . TEXT_HEADING_DELETE_MUSIC_GENRE . '

'); @@ -153,13 +154,13 @@ $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count)); } - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; default: if (isset($aInfo) && is_object($aInfo)) { $heading[] = array('text' => '

' . $aInfo->music_genre_name . '

'); - $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); + $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); $contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added)); if (zen_not_null($aInfo->last_modified)) { $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified)); @@ -181,9 +182,9 @@ display_count($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MUSIC_GENRES); ?> display_links($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?> - + - + @@ -196,4 +197,4 @@ - + \ No newline at end of file diff --git a/admin/record_artists.php b/admin/record_artists.php index f6c076ceb8..c430cf6cba 100644 --- a/admin/record_artists.php +++ b/admin/record_artists.php @@ -148,7 +148,7 @@ ORDER BY artists_name"; $artists_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $artists_query_raw, $artists_query_numrows); $artists = $db->Execute($artists_query_raw); - + $rArtists_parameter = ''; foreach ($artists as $artist) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $artist['artists_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) { $artists_products = $db->Execute("SELECT COUNT(*) AS products_count @@ -157,6 +157,7 @@ $aInfo_array = array_merge($artist, $artists_products->fields); $aInfo = new objectInfo($aInfo_array); + $rArtists_parameter = '&mID=' . $aInfo->artists_id; } if (isset($aInfo) && is_object($aInfo) && ($artist['artists_id'] == $aInfo->artists_id)) { @@ -206,11 +207,11 @@ } $contents[] = array('text' => zen_draw_label(TEXT_RECORD_ARTIST_URL, 'artists_url', 'class="control-label"') . $manufacturer_inputs_string); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'edit': $heading[] = array('text' => '

' . TEXT_HEADING_EDIT_RECORD_ARTIST . '

'); - $contents = array('form' => zen_draw_form('artists', FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id . '&action=save', 'post', 'enctype="multipart/form-data"')); + $contents = array('form' => zen_draw_form('artists', FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . $rArtists_parameter . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => zen_draw_label(TEXT_RECORD_ARTIST_NAME, 'artists_name', 'class="control-label"') . zen_draw_input_field('artists_name', htmlspecialchars($aInfo->artists_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_RECORD_ARTISTS, 'artists_name') . ' class="form-control"')); $contents[] = array('text' => zen_draw_label(TEXT_RECORD_ARTIST_IMAGE, 'artists_image', 'class="control-label"') . zen_draw_file_field('artists_image', '', 'class="form-control"') . '
' . $aInfo->artists_image); @@ -228,7 +229,7 @@ } $contents[] = array('text' => zen_draw_label(TEXT_RECORD_ARTIST_URL, 'artists_url', 'class="control-label"') . $manufacturer_inputs_string); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'delete': $heading[] = array('text' => '

' . TEXT_HEADING_DELETE_RECORD_ARTIST . '

'); @@ -243,13 +244,13 @@ $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count)); } - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; default: if (isset($aInfo) && is_object($aInfo)) { $heading[] = array('text' => '

' . $aInfo->artists_name . '

'); - $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); + $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); $contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added)); if (zen_not_null($aInfo->last_modified)) { $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified)); @@ -272,9 +273,9 @@ display_count($artists_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ARTISTS); ?> display_links($artists_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?> - + - + @@ -287,4 +288,4 @@ - + \ No newline at end of file diff --git a/admin/record_company.php b/admin/record_company.php index 9a68c4faf4..da46ba8201 100644 --- a/admin/record_company.php +++ b/admin/record_company.php @@ -149,7 +149,7 @@ ORDER BY record_company_name"; $record_company_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $record_company_query_raw, $record_company_query_numrows); $record_companies = $db->Execute($record_company_query_raw); - + $rCompany_parameter = ''; foreach ($record_companies as $record_company) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $record_company['record_company_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) { $record_company_products = $db->Execute("SELECT COUNT(*) AS products_count @@ -158,6 +158,7 @@ $aInfo_array = array_merge($record_company, $record_company_products->fields); $aInfo = new objectInfo($aInfo_array); + $rCompany_parameter = '&mID=' . $aInfo->record_company_id; } if (isset($aInfo) && is_object($aInfo) && ($record_company['record_company_id'] == $aInfo->record_company_id)) { @@ -207,11 +208,11 @@ } $contents[] = array('text' => zen_draw_label(TEXT_RECORD_COMPANY_URL, 'record_company_url', 'class="control-label"') . $record_company_inputs_string); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'edit': $heading[] = array('text' => '

' . TEXT_HEADING_EDIT_RECORD_COMPANY . '

'); - $contents = array('form' => zen_draw_form('record_company', FILENAME_RECORD_COMPANY, 'page=' . $_GET['page'] . '&mID=' . $aInfo->record_company_id . '&action=save', 'post', 'enctype="multipart/form-data"')); + $contents = array('form' => zen_draw_form('record_company', FILENAME_RECORD_COMPANY, 'page=' . $_GET['page'] . $rCompany_parameter . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); $contents[] = array('text' => zen_draw_label(TEXT_RECORD_COMPANY_NAME, 'record_company_name', 'class="control-label"') . zen_draw_input_field('record_company_name', htmlspecialchars($aInfo->record_company_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_RECORD_COMPANY, 'record_company_name') . ' class="form-control"')); $contents[] = array('text' => zen_draw_label(TEXT_RECORD_COMPANY_IMAGE, 'record_company_image', 'class="control-label"') . zen_draw_file_field('record_company_image', '', 'class="form-control"') . '
' . $aInfo->record_company_image); @@ -229,7 +230,7 @@ } $contents[] = array('text' => zen_draw_label(TEXT_RECORD_COMPANY_URL, 'record_company_url', 'class="control-label"') . $record_company_inputs_string); - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; case 'delete': $heading[] = array('text' => '

' . TEXT_HEADING_DELETE_RECORD_COMPANY . '

'); @@ -244,13 +245,13 @@ $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count)); } - $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); + $contents[] = array('align' => 'center', 'text' => ' ' . IMAGE_CANCEL . ''); break; default: if (isset($aInfo) && is_object($aInfo)) { $heading[] = array('text' => '

' . $aInfo->record_company_name . '

'); - $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); + $contents[] = array('align' => 'center', 'text' => '' . IMAGE_EDIT . ' ' . IMAGE_DELETE . ''); $contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added)); if (zen_not_null($aInfo->last_modified)) { $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified)); @@ -273,9 +274,9 @@ display_count($record_company_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_RECORD_COMPANIES); ?> display_links($record_company_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?> - + - + @@ -288,4 +289,4 @@ - + \ No newline at end of file