Mudanças entre as edições de "Integração do Pentaho com o Ckan"
(→Estrutura de Paginas do CKAN) |
|||
(2 edições intermediárias de um usuário não apresentadas) | |||
Linha 9: | Linha 9: | ||
== Estrutura de Paginas do CKAN == | == Estrutura de Paginas do CKAN == | ||
− | As paginas da raiz do CKAN estão no diretório "/ckan/lib/default/src/ckan/ckan/templates". As paginas HTML neste diretório ficam visíveis na raiz da URL do CKAN. | + | As paginas da raiz do CKAN estão no diretório "/ckan/lib/default/src/ckan/ckan/templates". As paginas HTML neste diretório ficam visíveis na raiz da URL do CKAN. |
+ | |||
+ | <pre> | ||
+ | ckan/lib/default/src/ckan/ckan/templates | ||
+ | |-- activity_streams | ||
+ | | |-- activity_stream_email_notifications.text | ||
+ | | `-- activity_stream_items.html | ||
+ | |-- admin | ||
+ | | |-- base.html | ||
+ | | |-- config.html | ||
+ | | |-- confirm_reset.html | ||
+ | | |-- index.html | ||
+ | | `-- trash.html | ||
+ | |-- ajax_snippets | ||
+ | | |-- api_info.html | ||
+ | | |-- custom_fields.html | ||
+ | | `-- follow_button.html | ||
+ | |-- base.html | ||
+ | |-- cedoc_footer.html | ||
+ | |-- pagina-personalizada.html | ||
+ | |-- css | ||
+ | | |-- common.css | ||
+ | | |-- demo.css | ||
+ | | |-- normalize.css | ||
+ | | `-- style.css | ||
+ | |-- dataviewer | ||
+ | | |-- base.html | ||
+ | | `-- snippets | ||
+ | | |-- data_preview.html | ||
+ | | `-- no_preview.html | ||
+ | |-- development | ||
+ | | |-- markup.html | ||
+ | | |-- primer.html | ||
+ | | `-- snippets | ||
+ | | |-- actions.html | ||
+ | | |-- breadcrumb.html | ||
+ | | |-- context.html | ||
+ | | |-- facet.html | ||
+ | | |-- form.html | ||
+ | | |-- form_stages.html | ||
+ | | |-- list.html | ||
+ | | |-- markup.html | ||
+ | | |-- media_grid.html | ||
+ | | |-- module.html | ||
+ | | |-- nav.html | ||
+ | | |-- page_header.html | ||
+ | | |-- pagination.html | ||
+ | | `-- simple-input.html | ||
+ | |-- error_document_template.html | ||
+ | |-- footer.html | ||
+ | |-- group | ||
+ | | |-- about.html | ||
+ | | |-- activity_stream.html | ||
+ | | |-- admins.html | ||
+ | | |-- base_form_page.html | ||
+ | | |-- confirm_delete.html | ||
+ | | |-- confirm_delete_member.html | ||
+ | | |-- edit.html | ||
+ | | |-- edit_base.html | ||
+ | | |-- followers.html | ||
+ | | |-- history.html | ||
+ | | |-- index.html | ||
+ | | |-- member_new.html | ||
+ | | |-- members.html | ||
+ | | |-- new.html | ||
+ | | |-- new_group_form.html | ||
+ | | |-- read.html | ||
+ | | |-- read_base.html | ||
+ | | `-- snippets | ||
+ | | |-- feeds.html | ||
+ | | |-- group_form.html | ||
+ | | |-- group_item.html | ||
+ | | |-- group_list.html | ||
+ | | |-- helper.html | ||
+ | | |-- history_revisions.html | ||
+ | | |-- info.html | ||
+ | | `-- revisions_table.html | ||
+ | |-- header.html | ||
+ | |-- home | ||
+ | | |-- about.html | ||
+ | | |-- index.html | ||
+ | | `-- snippets | ||
+ | | |-- about_text.html | ||
+ | | |-- featured_group.html | ||
+ | | |-- featured_organization.html | ||
+ | | |-- promoted.html | ||
+ | | |-- search.html | ||
+ | | `-- stats.html | ||
+ | |-- macros | ||
+ | | |-- autoform.html | ||
+ | | `-- form.html | ||
+ | |-- organization | ||
+ | | |-- about.html | ||
+ | | |-- activity_stream.html | ||
+ | | |-- admins.html | ||
+ | | |-- base_form_page.html | ||
+ | | |-- bulk_process.html | ||
+ | | |-- confirm_delete.html | ||
+ | | |-- confirm_delete_member.html | ||
+ | | |-- edit.html | ||
+ | | |-- edit_base.html | ||
+ | | |-- index.html | ||
+ | | |-- member_new.html | ||
+ | | |-- members.html | ||
+ | | |-- new.html | ||
+ | | |-- new_organization_form.html | ||
+ | | |-- read.html | ||
+ | | |-- read_base.html | ||
+ | | `-- snippets | ||
+ | | |-- feeds.html | ||
+ | | |-- help.html | ||
+ | | |-- helper.html | ||
+ | | |-- info.html | ||
+ | | |-- organization_form.html | ||
+ | | |-- organization_item.html | ||
+ | | `-- organization_list.html | ||
+ | |-- package | ||
+ | | |-- activity.html | ||
+ | | |-- base.html | ||
+ | | |-- base_form_page.html | ||
+ | | |-- confirm_delete.html | ||
+ | | |-- confirm_delete_resource.html | ||
+ | | |-- edit.html | ||
+ | | |-- edit_base.html | ||
+ | | |-- edit_view.html | ||
+ | | |-- followers.html | ||
+ | | |-- group_list.html | ||
+ | | |-- history.html | ||
+ | | |-- new.html | ||
+ | | |-- new_package_form.html | ||
+ | | |-- new_resource.html | ||
+ | | |-- new_resource_not_draft.html | ||
+ | | |-- new_view.html | ||
+ | | |-- read.html | ||
+ | | |-- read_base.html | ||
+ | | |-- related_list.html | ||
+ | | |-- resource_data.html | ||
+ | | |-- resource_edit.html | ||
+ | | |-- resource_edit_base.html | ||
+ | | |-- resource_read.html | ||
+ | | |-- resource_read.html.save | ||
+ | | |-- resource_views.html | ||
+ | | |-- resources.html | ||
+ | | |-- search.html | ||
+ | | |-- snippets | ||
+ | | | |-- additional_info.html | ||
+ | | | |-- data_api_button.html | ||
+ | | | |-- history_revisions.html | ||
+ | | | |-- info.html | ||
+ | | | |-- new_package_breadcrumb.html | ||
+ | | | |-- package_basic_fields.html | ||
+ | | | |-- package_context.html | ||
+ | | | |-- package_form.html | ||
+ | | | |-- package_metadata_fields.html | ||
+ | | | |-- resource_edit_form.html | ||
+ | | | |-- resource_form.html | ||
+ | | | |-- resource_help.html | ||
+ | | | |-- resource_info.html | ||
+ | | | |-- resource_item.html | ||
+ | | | |-- resource_view.html | ||
+ | | | |-- resource_view_embed.html | ||
+ | | | |-- resource_view_filters.html | ||
+ | | | |-- resource_views_list.html | ||
+ | | | |-- resource_views_list_item.html | ||
+ | | | |-- resources.html | ||
+ | | | |-- resources_list.html | ||
+ | | | |-- revisions_table.html | ||
+ | | | |-- stages.html | ||
+ | | | |-- tags.html | ||
+ | | | |-- view_form.html | ||
+ | | | |-- view_form_filters.html | ||
+ | | | `-- view_help.html | ||
+ | | `-- view_edit_base.html | ||
+ | |-- page.html | ||
+ | |-- revision | ||
+ | | |-- __init__.py | ||
+ | | |-- diff.html | ||
+ | | |-- list.html | ||
+ | | |-- read.html | ||
+ | | |-- read_base.html | ||
+ | | `-- snippets | ||
+ | | `-- revisions_list.html | ||
+ | |-- snippets | ||
+ | | |-- activity_item.html | ||
+ | | |-- additional_info.html | ||
+ | | |-- context | ||
+ | | | |-- dataset.html | ||
+ | | | |-- group.html | ||
+ | | | `-- user.html | ||
+ | | |-- context.html | ||
+ | | |-- custom_form_fields.html | ||
+ | | |-- datapreview_embed_dialog.html | ||
+ | | |-- datapusher_status.html | ||
+ | | |-- debug.html | ||
+ | | |-- disqus_trackback.html | ||
+ | | |-- facet_list.html | ||
+ | | |-- follow_button.html | ||
+ | | |-- group.html | ||
+ | | |-- group_item.html | ||
+ | | |-- home_breadcrumb_item.html | ||
+ | | |-- language_selector.html | ||
+ | | |-- license.html | ||
+ | | |-- local_friendly_datetime.html | ||
+ | | |-- organization.html | ||
+ | | |-- organization_item.html | ||
+ | | |-- package_grid.html | ||
+ | | |-- package_item.html | ||
+ | | |-- package_list.html | ||
+ | | |-- popular.html | ||
+ | | |-- private.html | ||
+ | | |-- related.html | ||
+ | | |-- search_form.html | ||
+ | | |-- search_result_text.html | ||
+ | | |-- simple_search.html | ||
+ | | |-- social.html | ||
+ | | |-- sort_by.html | ||
+ | | |-- subscribe.html | ||
+ | | `-- tag_list.html | ||
+ | |-- tag | ||
+ | | `-- index.html | ||
+ | |-- tests | ||
+ | | |-- mock_json_resource_preview_template.html | ||
+ | | `-- mock_resource_preview_template.html | ||
+ | `-- user | ||
+ | |-- activity_stream.html | ||
+ | |-- dashboard.html | ||
+ | |-- dashboard_datasets.html | ||
+ | |-- dashboard_groups.html | ||
+ | |-- dashboard_organizations.html | ||
+ | |-- edit.html | ||
+ | |-- edit_base.html | ||
+ | |-- edit_user_form.html | ||
+ | |-- followers.html | ||
+ | |-- list.html | ||
+ | |-- login.html | ||
+ | |-- logout.html | ||
+ | |-- logout_first.html | ||
+ | |-- new.html | ||
+ | |-- new_user_form.html | ||
+ | |-- perform_reset.html | ||
+ | |-- read.html | ||
+ | |-- read_base.html | ||
+ | |-- request_reset.html | ||
+ | `-- snippets | ||
+ | |-- followee_dropdown.html | ||
+ | |-- followers.html | ||
+ | |-- login_form.html | ||
+ | |-- recaptcha.html | ||
+ | `-- user_search.html | ||
+ | </pre> | ||
== Código de Exemplo de uma pagina personalizada no CKAN == | == Código de Exemplo de uma pagina personalizada no CKAN == |
Edição atual tal como às 09h04min de 13 de janeiro de 2017
Esta integração faz parte da interação e modificação de temas no CKAN.
Maiores detalhes podem ser encontrados na pagina: http://docs.ckan.org/en/latest/theming/index.html
Pré-requisitos
É necessário realizar a instalação do Pentaho anteriormente. A integração com o CKAN é feita através de "iframe" em paginas personalizadas no CKAN. Para isso é necessário entender a estrutura de paginas do CKAN. A próxima seção apresenta esta estrutura.
Estrutura de Paginas do CKAN
As paginas da raiz do CKAN estão no diretório "/ckan/lib/default/src/ckan/ckan/templates". As paginas HTML neste diretório ficam visíveis na raiz da URL do CKAN.
ckan/lib/default/src/ckan/ckan/templates |-- activity_streams | |-- activity_stream_email_notifications.text | `-- activity_stream_items.html |-- admin | |-- base.html | |-- config.html | |-- confirm_reset.html | |-- index.html | `-- trash.html |-- ajax_snippets | |-- api_info.html | |-- custom_fields.html | `-- follow_button.html |-- base.html |-- cedoc_footer.html |-- pagina-personalizada.html |-- css | |-- common.css | |-- demo.css | |-- normalize.css | `-- style.css |-- dataviewer | |-- base.html | `-- snippets | |-- data_preview.html | `-- no_preview.html |-- development | |-- markup.html | |-- primer.html | `-- snippets | |-- actions.html | |-- breadcrumb.html | |-- context.html | |-- facet.html | |-- form.html | |-- form_stages.html | |-- list.html | |-- markup.html | |-- media_grid.html | |-- module.html | |-- nav.html | |-- page_header.html | |-- pagination.html | `-- simple-input.html |-- error_document_template.html |-- footer.html |-- group | |-- about.html | |-- activity_stream.html | |-- admins.html | |-- base_form_page.html | |-- confirm_delete.html | |-- confirm_delete_member.html | |-- edit.html | |-- edit_base.html | |-- followers.html | |-- history.html | |-- index.html | |-- member_new.html | |-- members.html | |-- new.html | |-- new_group_form.html | |-- read.html | |-- read_base.html | `-- snippets | |-- feeds.html | |-- group_form.html | |-- group_item.html | |-- group_list.html | |-- helper.html | |-- history_revisions.html | |-- info.html | `-- revisions_table.html |-- header.html |-- home | |-- about.html | |-- index.html | `-- snippets | |-- about_text.html | |-- featured_group.html | |-- featured_organization.html | |-- promoted.html | |-- search.html | `-- stats.html |-- macros | |-- autoform.html | `-- form.html |-- organization | |-- about.html | |-- activity_stream.html | |-- admins.html | |-- base_form_page.html | |-- bulk_process.html | |-- confirm_delete.html | |-- confirm_delete_member.html | |-- edit.html | |-- edit_base.html | |-- index.html | |-- member_new.html | |-- members.html | |-- new.html | |-- new_organization_form.html | |-- read.html | |-- read_base.html | `-- snippets | |-- feeds.html | |-- help.html | |-- helper.html | |-- info.html | |-- organization_form.html | |-- organization_item.html | `-- organization_list.html |-- package | |-- activity.html | |-- base.html | |-- base_form_page.html | |-- confirm_delete.html | |-- confirm_delete_resource.html | |-- edit.html | |-- edit_base.html | |-- edit_view.html | |-- followers.html | |-- group_list.html | |-- history.html | |-- new.html | |-- new_package_form.html | |-- new_resource.html | |-- new_resource_not_draft.html | |-- new_view.html | |-- read.html | |-- read_base.html | |-- related_list.html | |-- resource_data.html | |-- resource_edit.html | |-- resource_edit_base.html | |-- resource_read.html | |-- resource_read.html.save | |-- resource_views.html | |-- resources.html | |-- search.html | |-- snippets | | |-- additional_info.html | | |-- data_api_button.html | | |-- history_revisions.html | | |-- info.html | | |-- new_package_breadcrumb.html | | |-- package_basic_fields.html | | |-- package_context.html | | |-- package_form.html | | |-- package_metadata_fields.html | | |-- resource_edit_form.html | | |-- resource_form.html | | |-- resource_help.html | | |-- resource_info.html | | |-- resource_item.html | | |-- resource_view.html | | |-- resource_view_embed.html | | |-- resource_view_filters.html | | |-- resource_views_list.html | | |-- resource_views_list_item.html | | |-- resources.html | | |-- resources_list.html | | |-- revisions_table.html | | |-- stages.html | | |-- tags.html | | |-- view_form.html | | |-- view_form_filters.html | | `-- view_help.html | `-- view_edit_base.html |-- page.html |-- revision | |-- __init__.py | |-- diff.html | |-- list.html | |-- read.html | |-- read_base.html | `-- snippets | `-- revisions_list.html |-- snippets | |-- activity_item.html | |-- additional_info.html | |-- context | | |-- dataset.html | | |-- group.html | | `-- user.html | |-- context.html | |-- custom_form_fields.html | |-- datapreview_embed_dialog.html | |-- datapusher_status.html | |-- debug.html | |-- disqus_trackback.html | |-- facet_list.html | |-- follow_button.html | |-- group.html | |-- group_item.html | |-- home_breadcrumb_item.html | |-- language_selector.html | |-- license.html | |-- local_friendly_datetime.html | |-- organization.html | |-- organization_item.html | |-- package_grid.html | |-- package_item.html | |-- package_list.html | |-- popular.html | |-- private.html | |-- related.html | |-- search_form.html | |-- search_result_text.html | |-- simple_search.html | |-- social.html | |-- sort_by.html | |-- subscribe.html | `-- tag_list.html |-- tag | `-- index.html |-- tests | |-- mock_json_resource_preview_template.html | `-- mock_resource_preview_template.html `-- user |-- activity_stream.html |-- dashboard.html |-- dashboard_datasets.html |-- dashboard_groups.html |-- dashboard_organizations.html |-- edit.html |-- edit_base.html |-- edit_user_form.html |-- followers.html |-- list.html |-- login.html |-- logout.html |-- logout_first.html |-- new.html |-- new_user_form.html |-- perform_reset.html |-- read.html |-- read_base.html |-- request_reset.html `-- snippets |-- followee_dropdown.html |-- followers.html |-- login_form.html |-- recaptcha.html `-- user_search.html
Código de Exemplo de uma pagina personalizada no CKAN
A seguir segue um exemplo de uma pagina personalizada com a utilização de um "iframe" para integrar outros sistemas nas paginas e no servidor do CKAN. Neste exemplo utilizamos o Pentaho instalado na mesma máquina (localhost).
- Nota
- É recomendado familiarizar-se com templates no modelo Jinja2, maiores detalhes podem ser encontrados em: http://jinja.pocoo.org/docs/2.9/templates/
{% extends "base.html" %} {% block subtitle %}{{ _('Pagina Personalizada') }}{% endblock %} {%- block page -%} {% block skip %} <div class="hide"><a href="#content">{{ _('Skip to content') }}</a></div> {% endblock %} {# Substitua o cabeçalho em uma página por página, estendendo esse bloco. Se estiver fazendo alterações no cabeçalho do site, é preferível substituir o arquivo header.html. #} {%- block header %} {% include "header.html" %} {% endblock -%} {# O bloco de conteúdo permite substituir o conteúdo da página, se necessário #} {%- block content %} {% block maintag %}<div role="main">{% endblock %} <div id="content" class="container" style="width: 1200px;"> {% block main_content %} {% block flash %} <div class="flash-messages"> {% block flash_inner %} {% for message in h.flash.pop_messages() | list %} <div class="alert fade in {{ message.category }}"> {{ h.literal(message) }} </div> {% endfor %} {% endblock %} </div> {% endblock %} {% block toolbar %} <div class="toolbar"> {% block breadcrumb %} {% if self.breadcrumb_content() | trim %} <ol class="breadcrumb"> {% snippet 'snippets/home_breadcrumb_item.html' %} {% block breadcrumb_content %} <li class="active"><a href="/pagina-personalizada">Pagina Personalizada</a></li> {% endblock %} </ol> {% endif %} {% endblock %} </div> {% endblock %} <div class="row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' %} no-nav{% endif %}"> {# O bloco pré-primário pode ser usado para adicionar conteúdo antes da renderização das colunas de conteúdo principal da página. #} {% block pre_primary %} {% endblock %} {% block primary %} <article class="module"> <div class="module-content"> <h1>Pagina Personalizada</h1> <p>Alguma paragrafo de informação (pode-se utilizar o HTML aqui)</p> {# Exemplo de iframe: #} <iframe src="http://localhost/pentaho/"></iframe> </article> {% endblock %} {% block secondary %}{% endblock %} </div> {% endblock %} </div> </div> {% endblock -%} </div> {# Substitua o rodapé em uma página por página, estendendo esse bloco. Se fizer alterações no cabeçalho do site, é preferível substituir o arquivo footer.html-u. #} {%- block footer %} {% include "footer.html" %} {% endblock -%} {%- endblock -%} {%- block scripts %} {% resource 'base/main' %} {% resource 'base/ckan' %} {% if g.tracking_enabled %} {% resource 'base/tracking.js' %} {% endif %} {{ super() }} {% endblock -%}
Assim você será capaz de criar paginas personalizadas utilizando o mesmo tema aplicado no CKAN.