Commit f12ad8bd authored by Chris Graham's avatar Chris Graham

Fixed MANTIS-3998 (Inconsistent catalogue category templating)

parent 3f478fac
......@@ -945,12 +945,30 @@ class Module_catalogues
}
ksort($cats);
$_display_type = C_DT_FIELDMAPS;
foreach ($cats as $letter => $entries) {
list($entry_buildup) = render_catalogue_category_entry_buildup(null, $catalogue_name, $catalogue, 'CATEGORY', $tpl_set, $max, $start, null, $root, null, true, $entries);
list($entry_buildup, , , , $_display_type) = render_catalogue_category_entry_buildup(null, $catalogue_name, $catalogue, 'CATEGORY', $tpl_set, $max, $start, null, $root, null, true, $entries);
$category_buildup->attach(do_template('CATALOGUE_CATEGORY_HEADING', array('_GUID' => '633d73ad882c9f28524ad27120b77b78', 'LETTER' => is_integer($letter) ? strval($letter) : $letter, 'ENTRIES' => escape_html($entry_buildup)), null, false, 'CATALOGUE_CATEGORY_HEADING'));
}
// Find display type
$display_type = '';
switch ($_display_type) {
case C_DT_FIELDMAPS:
$display_type = 'FIELDMAPS';
break;
case C_DT_TITLELIST:
$display_type = 'TITLELIST';
break;
case C_DT_TABULAR:
$display_type = 'TABULAR';
break;
case C_DT_GRID:
$display_type = 'GRID';
break;
}
// Management links
if (has_actual_page_access(null, 'cms_catalogues', null, (get_value('disable_cat_cat_perms') === '1') ? array('catalogues_catalogue', $catalogue_name) : array('catalogues_catalogue', $catalogue_name, 'catalogues_category', strval($id)), 'submit_midrange_content')) {
$add_link = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue_name, 'category_id' => $id), get_module_zone('cms_catalogues'));
......@@ -989,6 +1007,7 @@ class Module_catalogues
'SUBCATEGORIES' => '',
'DESCRIPTION' => '',
'ID' => '',
'DISPLAY_TYPE' => $display_type,
),
null,
false,
......
......@@ -291,7 +291,7 @@ function count_catalogue_category_children($category_id)
* @param ?ID_TEXT $order_by_high_level Orderer (null: read from environment)
* @param ID_TEXT $ordering_param Environment param used for ordering. You should pass in $order_by_high_level if it is set.
* @param ?MEMBER $viewing_member_id Viewing member ID (null: current user)
* @return array An array containing our built up entries (renderable Tempcode), our sorting interface, and our entries (entry records from database, with an additional 'map' field), and the max rows
* @return array An array containing our built up entries (renderable Tempcode), our sorting interface, and our entries (entry records from database, with an additional 'map' field), and the max rows, and the display type used
*/
function render_catalogue_category_entry_buildup($category_id, $catalogue_name, $catalogue, $view_type, $tpl_set, $max, $start, $select, $root, $display_type = null, $do_sorting = true, $entries = null, $filter = '', $order_by_high_level = null, $ordering_param = 'sort', $viewing_member_id = null)
{
......@@ -596,7 +596,7 @@ function render_catalogue_category_entry_buildup($category_id, $catalogue_name,
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
return array($entry_buildup, $sorting, $entries, $num_entries);
return array($entry_buildup, $sorting, $entries, $num_entries, $display_type);
}
/**
......
......@@ -323,7 +323,7 @@ class Hook_addon_registry_catalogues
'ENTRIES' => $entries,
'SUBCATEGORIES' => $subcategories,
'DESCRIPTION' => lorem_sentence(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'GRID',
)), null, '', true)
);
}
......@@ -410,7 +410,7 @@ class Hook_addon_registry_catalogues
'ENTRIES' => $entries,
'SUBCATEGORIES' => $subcategories,
'DESCRIPTION' => lorem_sentence(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'FIELDMAPS',
)), null, '', true)
);
}
......@@ -477,7 +477,7 @@ class Hook_addon_registry_catalogues
'ENTRIES' => $entries,
'SUBCATEGORIES' => '',
'DESCRIPTION' => lorem_sentence(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'TITLELIST',
)), null, '', true)
);
}
......@@ -568,7 +568,7 @@ class Hook_addon_registry_catalogues
'ENTRIES' => $entries,
'SUBCATEGORIES' => $subcategories,
'DESCRIPTION' => lorem_sentence(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'TABULAR',
)), null, '', true)
);
}
......@@ -656,7 +656,7 @@ class Hook_addon_registry_catalogues
'ENTRIES' => $entries,
'SUBCATEGORIES' => $subcategories,
'DESCRIPTION' => lorem_sentence(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'TABULAR',
)), null, '', true)
);
}
......
......@@ -754,8 +754,7 @@ class Hook_addon_registry_shopping
'ENTRIES' => $entries,
'SUBCATEGORIES' => '',
'DESCRIPTION' => lorem_sentence(),
'TREE' => lorem_phrase(),
'DISPLAY_TYPE' => '0',
'DISPLAY_TYPE' => 'GRID',
)), null, '', true)
);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment