From 08858d55ae6541e1038448e66781c501f7c927f6 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 26 Feb 2024 13:33:45 +0000 Subject: [PATCH] Bug 36164: Proof of concept This PoC serves the purpose of DRYing the markup and logic present in cataloging-home to ensure consistency between module landing pages going forward. This abstraction would then also be done in circulation-home. And after that, in tools-home and/or other adopting modules in the future. --- .../prog/en/includes/html_helpers.inc | 73 ++++ .../en/modules/cataloguing/cataloging-home.tt | 327 ++++++++---------- 2 files changed, 224 insertions(+), 176 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 535cbca2c91..48b582f407a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -473,3 +473,76 @@ [% END %] [% END %] + +[%# Used to build a module landing page %] +[% BLOCK module_langing_page %] +
+
+ [%# FIXME: Confirm messages.inc is needed. Neither circulation-home and cataloging-home use output_and_exit from C4::Output#%] + [% INCLUDE 'messages.inc' %] + [% content | $raw %] +
+
+[% END %] + +[% BLOCK module_langing_page_item %] + [% IF ( item_permission ) %] +

[% title %]

+ + [% content | $raw %] + [% END %] +[% END %] + +[% BLOCK module_langing_page_column %] +
+ [% content | $raw %] +
+[% END %] + +[% BLOCK module_langing_page_content %] +

[% label %]

+
+ [% content | $raw %] +
+[% END %] + +[% BLOCK module_langing_page_toolbar %] + [% IF ( permission ) %] + [% #TODO: Abstract this %] +
+ [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] + Advanced editor + [% END %] +
+ + + +
+ [% IF servers.count > 0 %] +
+ + + +
+ [% END # /IF servers.count %] +
+ [% END %] +[% END %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt index 7cf87d2ee9a..1154d25fefe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/cataloging-home.tt @@ -26,208 +26,183 @@ [% END #/ WRAPPER sub-header.inc %]
-
-
- [% INCLUDE 'messages.inc' %] - [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] -
- [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] - Advanced editor + [% WRAPPER module_langing_page %] + [% WRAPPER module_langing_page_toolbar permission = CAN_user_editcatalogue_edit_catalogue %][% END %] + [% WRAPPER module_langing_page_content label = t("Cataloging") %] + [% WRAPPER module_langing_page_column %] + [% WRAPPER module_langing_page_item + title = t("Import") + item_permission = ( CAN_user_tools_stage_marc_import || CAN_user_tools_manage_staged_marc ) + sub_items = [ + { + 'label' => t("Stage records for import"), + 'icon_class' => 'fa fa-download', + 'link' => '/cgi-bin/koha/tools/stage-marc-import.pl', + 'permission' => CAN_user_tools_stage_marc_import, + }, + { + 'label' => t("Manage staged records"), + 'icon_class' => 'fa fa-tasks', + 'link' => '/cgi-bin/koha/tools/manage-marc-import.pl', + 'permission' => CAN_user_tools_manage_staged_marc, + } + ] + %] [% END %] -
- - - -
- [% IF servers.count > 0 %] -
- - - -
- [% END # /IF servers.count %] -
- [% END # /IF CAN_user_editcatalogue_edit_catalogue %] -

Cataloging

+ [% WRAPPER module_langing_page_item + title = t("Export") + item_permission = ( CAN_user_tools_export_catalog ) + sub_items = [ + { + 'label' => t("Export catalog data"), + 'icon_class' => 'fa fa-upload', + 'link' => '/cgi-bin/koha/tools/export.pl', + 'permission' => CAN_user_tools_export_catalog, + } + ] + %] + [% END %] -
+ [% WRAPPER module_langing_page_item + title = t("Reports") + item_permission = ( CAN_user_tools_inventory || ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) ) + sub_items = [ + { + 'label' => t("Inventory"), + 'icon_class' => 'fa-solid fa-clipboard-check', + 'link' => '/cgi-bin/koha/tools/inventory.pl', + 'permission' => CAN_user_tools_inventory, + }, + { + 'label' => t("Catalog concerns"), + 'icon_class' => 'fa fa-list-ul', + 'link' => '/cgi-bin/koha/cataloguing/concerns.pl', + 'permission' => ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ), + } + ] + %] + [% END %] -
- [% IF ( CAN_user_tools_stage_marc_import || CAN_user_tools_manage_staged_marc ) %] -

Import

-
    - [% IF ( CAN_user_tools_stage_marc_import ) %] -
  • - Stage records for import -
  • - [% END %] + [% WRAPPER module_langing_page_item + title = t("Fast cataloging") + item_permission = ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) + sub_items = [ + { + 'label' => t("Fast cataloging"), + 'icon_class' => 'fa fa-plus', + 'link' => '/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA', + 'permission' => CAN_user_editcatalogue_fast_cataloging, + } + ] + %] + [% END %] + [% END %] - [% IF ( CAN_user_tools_manage_staged_marc ) %] -
  • - Manage staged records -
  • - [% END %] -
- [% END %] +
- [% IF ( CAN_user_tools_export_catalog ) %] -

Export

- + [% IF ( CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_tools_records_batchmod || CAN_user_tools_records_batchdel || CAN_user_tools_marc_modification_templates ) %] +

Batch editing

+
    + [% IF ( CAN_user_tools_items_batchmod ) %] +
  • + Batch item modification +
  • [% END %] - - [% IF ( CAN_user_tools_inventory || ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) ) %] -

    Reports

    -
      - [% IF ( CAN_user_tools_inventory ) %] -
    • - Inventory -
    • - [% END %] - - [% IF ( ( Koha.Preference('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %] -
    • - Catalog concerns -
    • - [% END %] -
    + [% IF ( CAN_user_tools_items_batchdel ) %] +
  • + Batch item deletion +
  • [% END %] - [% IF ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) %] -

    Fast cataloging

    -
      - [% IF ( CAN_user_editcatalogue_fast_cataloging ) %] -
    • - Fast cataloging -
    • - [% END %] -
    + [% IF CAN_user_tools_records_batchmod %] +
  • + Batch record modification +
  • [% END %] - - -
- -
- - [% IF ( CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_tools_records_batchmod || CAN_user_tools_records_batchdel || CAN_user_tools_marc_modification_templates ) %] -

Batch editing

- + [% IF CAN_user_tools_records_batchdel %] +
  • + Batch record deletion +
  • [% END %] - [% IF ( CAN_user_tools_items_batchmod || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) ) %] -

    Automation

    -
      - [% IF ( CAN_user_tools_items_batchmod ) %] -
    • - Item modifications by age -
    • - [% END %] - [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %] -
    • - Stock rotation -
    • - [% END %] -
    + [% IF ( CAN_user_tools_marc_modification_templates ) %] +
  • + MARC modification templates +
  • [% END %] + + [% END %] -
    - -
    + [% IF ( CAN_user_tools_items_batchmod || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) ) %] +

    Automation

    +
      + [% IF ( CAN_user_tools_items_batchmod ) %] +
    • + Item modifications by age +
    • + [% END %] + [% IF ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) %] +
    • + Stock rotation +
    • + [% END %] +
    + [% END %] - [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images ) %] -

    Tools

    -
    -
  • - Barcode image generator -
  • +
    -
  • - Quick spine label creator -
  • - [% END %] + [% IF ( CAN_user_tools_label_creator || CAN_user_tools_upload_local_cover_images ) %] +

    Tools

    + +
  • + Quick spine label creator +
  • [% END %] - [% IF ( CAN_user_parameters ) %] -

    Administration

    - + [% IF ( CAN_user_tools_upload_local_cover_images ) %] +
  • + Upload local cover image +
  • [% END %] -
    -
    + + [% END %] + + [% IF ( CAN_user_parameters ) %] +

    Administration

    + + [% END %] - [%- SET StaffCataloguingHome = AdditionalContents.get( location => "StaffCataloguingHome", lang => lang, library => logged_in_user.branchcode ) -%] - [%- FOREACH block IN StaffCataloguingHome.content -%] -
    - [%- block.content | $raw -%]
    - [%- END -%] + [% END %] + [%- SET StaffCataloguingHome = AdditionalContents.get( location => "StaffCataloguingHome", lang => lang, library => logged_in_user.branchcode ) -%] + [%- FOREACH block IN StaffCataloguingHome.content -%] +
    + [%- block.content | $raw -%]
    -
    + [%- END -%] + [% END %] [% MACRO jsinclude BLOCK %]