This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

wpckan

Description

wpckan is a wordpress plugin that exposes a series of functionalities to bring content stored in CKAN to WordPress’ UI and also provide mechanisms for archiving content generated on WordPress into a CKAN instance.

Features

Feature 1: Add related CKAN datasets to posts.

Plugin presents a metabox while users are editing posts with an autocompletion input field that
allows the user to add related CKAN datasets. Suggestions for related datasets and its metadata (title, description, and resources) are shown to the user while typing in the input field. Users can add a certain number of datasets that will get stored along the post’s metadata.

In order to use this information, this plugin exposes the [wpckan_related_datasets] shortcode for embedding information about related datasets on the content of the post.
The shortcode has following parameters:

  • include_fields_dataset: (Optional) Comma-separated.
    Per default, this shortcode shows only title and notes of the CKAN dataset (See http://demo.ckan.org/api/3/action/package_search?q=spending). A list of attributes can be specified to present more information. Possible values: “title”, “notes”, “url”, “license”, “license_url” “metadata_created”, “metadata_modified”, “author” , “author_email”

  • include_fields_resources: (Optional) Comma-separated.
    Per default, this shortcode shows only name, description and format of the resources (See http://demo.ckan.org/api/3/action/package_search?q=spending). A list of attributes can be specified to present more information. Possible values: “name”, “description”, “revision_timestamp”, “format”, “created”

  • limit: (Optional) Number.
    Limits the amount of datasets shown by the shortcode.

Pagination

  • page: (Optional) Number.
    When used together with limit, returned datasets will get paginated. In case of possible pagination, this parameter specifies which page is returned. If there are not enough related datasets to paginate, this parameter will be ignored.
    Example: if there are 8 related datasets, limit = 2, page = 2, then datasets 2 and 3 will be returned. Mind that order begins on 1.

  • prev_page_link: (Optional) String.
    If provided, and as long limit and page are also given parameters, shows a link to this URL. The default text is “Previous”

  • prev_page_title: (Optional) String.
    Replaces “Previous” (Standard text) with the specified text.

  • next_page_link: (Optional) String.
    If provided, and as long limit and page are also given parameters, shows a link to this URL. The default text is “Next”

  • next_page_title: (Optional) String.
    Replaces “Next” (Standard text) with the specified text.

Examples:
php
[wpckan_related_datasets]
[wpckan_related_datasets limit="3"]
[wpckan_related_datasets limit="3" page="2"]
[wpckan_related_datasets limit="3" page="2" prev_page_link="http://test?prev_page" next_page_link="http://test?next_page"]
[wpckan_related_datasets include_fields_dataset="title,description,author"]
[wpckan_related_datasets include_fields_dataset="title,description,author" include_fields_resources="name,description,created"]

An example showing how the information returned by this shortcode will be structured:

`html
  • Title
    Notes
    License
    Author
    /*…. other fields ….*/

    • Name
      Description
      /*…. other fields ….*/

    • /*…. other resources ….*/

  • /*…. other dataset

  • ….*/

Previous
Next

`

Also, the plugin exposes the [wpckan_number_of_related_datasets] shortcode for returning the number of related datasets assigned to the post as a customizable link so a summary can be presented on the wordpress side.
The shortcode has following parameters:

  • group: (Optional)
    Specify the name (Not title) of a group available on the target CKAN instance in order to filter the related datasets to ONLY those assigned to it.

  • organization: (Optional)
    Specify the name (Not title) of an organization available on the target CKAN instance in order to filter the related datasets to ONLY those assigned to it.

Note: If both group and organization parameters are specified then the dataset has to be asssigned to both in order to be returned by the shortcode.

  • limit: (Optional) Number.
    Limits the amount of datasets shown by the shortcode.

  • link_url: (Optional)
    Specify the URL to link the produced output with some other resource (i.e: in the CKAN instance)

  • prefix: (Optional)
    Prepends a string before the number.

  • suffix: (Optional)
    Appends a string after the number.

Examples:
php
[wpckan_number_of_related_datasets]
[wpckan_number_of_related_datasets link_url="http://link_to_more"]
[wpckan_number_of_related_datasets group="news"]
[wpckan_number_of_related_datasets group="news" limit="1"]
[wpckan_number_of_related_datasets group="news" suffix=" datasets found in the news."]
[wpckan_number_of_related_datasets group="news" prefix="Number of datasets: (" suffix=")" link_url="http://link_to_more"]

An example (corresponding to the last example above) showing how the information returned by this shortcode will be structured:

`html

Number of datasets: (5)

`<h3>Feature 2: Query lists of CKAN datasets</h3>

Plugin exposes a function which returns a list of CKAN datasets resulting after querying
CKAN’s API. Resulting datasets can be filtered by organization, group and/or specifying a textual
search.

The results of this function can be shown anywhere on a WordPress instance (Posts,
Pages, etc..) by calling the [wpckan_query_datasets query=”QUERY”] shortcode. Per default, this shortcode shows only title and description of the dataset.
The shortcode has following parameters:

  • query: (Mandatory) Term to query the database.

  • organization: (Optional) Filter dataset results by showing only those belonging to a certain organization.

  • group: (Optional) Filter dataset results by showing only those belonging to a certain group.

  • include_fields_dataset: (Optional) Comma-separated.
    Per default, this shortcode shows only title (with link to the dataset’s URL) and notes of the CKAN dataset (See http://demo.ckan.org/api/3/action/package_search?q=spending). A list of attributes can be specified to present more information. Possible values: “title”, “notes”, “url”, “license”, “license_url” “metadata_created”, “metadata_modified”, “author” , “author_email”

  • include_fields_resources: (Optional) Comma-separated.
    Per default, this shortcode shows only name (with link to the resources’s URL), description and format of the resources (See http://demo.ckan.org/api/3/action/package_search?q=spending). A list of attributes can be specified to present more information. Possible values: “name”, “description”, “revision_timestamp”, “format”, “created”

  • limit: (Optional) Number.
    Limits the amount of datasets shown by the shortcode.

Pagination

  • page: (Optional) Number.
    When used together with limit, returned datasets will get paginated. In case of possible pagination, this parameter specifies which page is returned. If there are not enough related datasets to paginate, this parameter will be ignored.
    Example: if there are 8 related datasets, limit = 2, page = 2, then datasets 2 and 3 will be returned. Mind that order begins on 1.

  • prev_page_link: (Optional) String.
    If provided, and as long limit and page are also given parameters, shows a link to this URL. The default text is “Previous”

  • prev_page_title: (Optional) String.
    Replaces “Previous” (Standard text) with the specified text.

  • next_page_link: (Optional) String.
    If provided, and as long limit and page are also given parameters, shows a link to this URL. The default text is “Next”

  • next_page_title: (Optional) String.
    Replaces “Next” (Standard text) with the specified text.

Examples:
php
[wpckan_query_datasets query="coal"]
[wpckan_query_datasets query="corruption" limit="5"]
[wpckan_query_datasets query="corruption" limit="5" page="1"]
[wpckan_query_datasets query="politics" limit="3" page="2" prev_page_link="http://test?prev_page" next_page_link="http://test?next_page"]
[wpckan_query_datasets query="forestry" organization="odmcambodia" group="news"]
[wpckan_query_datasets query="elections" include_fields_dataset="title,notes,license" include_fields_resources="name,description,created"]

`html
  • Title
    Notes
    License
    Author
    /*…. other fields ….*/

    • Name
      Description
      /*…. other fields ….*/

    /*…. other resources ….*/

  • /*…. other dataset

  • ….*/

Previous
Next

`<h3>Feature 3: Archiving WP Posts in CKAN</h3>

The plugin presents a metabox while users are editing posts. It allows users to specify if the post should be archived as a CKAN dataset. The plugin polls the CKAN instance and retrieves the list of available organizations and groups in order for users to be able to determine to which organization or group the dataset will be assign to. Also, when that particular post will be archived (on save or on publish).

Arbitrary section

Installation

  1. Either download the files as zip or clone recursively (contains submodules) git clone https://github.com/OpenDevelopmentMekong/wpckan.git --recursive into the WordPress plugins folder.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

FAQ

Which version of the CKAN API does this plugin use?

API Version 3 (http://ckan.readthedocs.org/en/latest/api/index.html#action-api-reference)

Reviews

There are no reviews for this plugin.

Contributors & Developers

“wpckan” is open source software. The following people have contributed to this plugin.

Contributors

Translate “wpckan” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.9

  • First version