-
Notifications
You must be signed in to change notification settings - Fork 0
TopicPages
Example Topic pageRelease 7.3 saw the introduction of a prototype for Research Data Australia's "Topic Pages". These pages offer a semi-dynamic way for content to be displayed in a discipline/portal-specific way.
Topic pages are reached in RDA through the tab in the header bar of RDA. This executes /rda/.../controllers/topic.php
which will either display the topic listing (if no specific is specified) or load the topic model.
The /rda/.../model/topics.php
currently defines a static array of topics. In a future evolution of this feature, the topics will be managed through some form of CMS linked to a database backend and this model would provide an interface to that.
The current structure of the array is:
/* Topics array in models/topics.php */
$topics = array (
// url_name is a url-friendly (i.e. lowercase, alpha-only) identifier to be used in the URL
"url_name" => array (
"name" => the name to be displayed on breadcrumb (string),
"html" => an html string which will be displayed as static content on the left of the page (string),
"auto_boxes" => array of auto boxes (see below for format),
"manual_boxes" => array of manual boxes (see below for format),
)
);
/* auto_boxes specify search queries that are executed using jswidget */
$autobox = array (
"id" => a unique name for this autobox to use as div ID (string),
"query" => a valid SOLR query to be executed (string),
"heading" => the name to put at the top of the box (string),
"record_limit" => number of records to display (int),
[optional] "query_facet" => a valid SOLR field to facet by (string),
);
/* manual_boxes specify a static list of links to display in a box on the right-hand column */
$manualbox = array (
"heading" => the name to put at the top of the box (string),
"items" => array (
array (
"url" => target URL for the link (string),
"title" => text to display on the link (string),
),
...
)
);
The general structure of topic pages is static content on the left-hand side of the page and dynamically-generated content in the blocks on the right of the page. The array can easily be extended to support new topics.
In the current configuration, the "html"
attribute of the topic is (for brevity) not defined in the topics model array. Instead, the content for this field is fetched from views/topics/<topicname>.php
where topicname is the same as the url_name of the topic. This content is loaded as a CodeIgniter view, so any valid CI code can be included here.
Although not required, it is recommended that images be placed in /rda/assets/topics/<topicname>/
(where topicname is the same as the url_name of the topic).
Example JSWidget output JSWidget is a proof of concept for dynamically generating RDA-styled HTML using very simple Javascript declaration (similar to how Google does its analytics/ads). Instead of users having to implement a complicated Javascript class to query SOLR, parse and format results, this work is handed off to an external Javascript which modifies its behaviours based on the variables defined in the caller's global environment.
This is best understood by example:
// On the Calling Page (i.e. the topics view)
<script type="text/javascript"><!--
ands_search_id = "collections";
ands_search_query = "fulltext%3Atropics%20class%3A%28%22collection%22%29";
ands_search_heading = "Collections";
ands_search_record_limit = "3";
ands_search_service_point = "http://services.ands.org.au/home/orca/rda/api"
ands_search_portal_url = "http://services.ands.org.au/home/orca/rda/"
//--></script>
<script type="text/javascript" src="http://services.ands.org.au/home/orca/rda/js/jswidget.js"></script>
This fairly simple block of code will create the output which is displayed in the example (right).
Notes:
- As this is a proof of concept, the widget is currently only useful in the topics page context. This will be extended to a fully-featured widget in future releases. Nonetheless, refer to
rda/js/jswidget.js
for a list of variables which may be modified. - Facetted searches can be supported by passing ands_search_query_mode="facet" and ands_search_query_facet="<field(s) to facet by>"
- Clicking on the "More" link currently takes you to the search results for that query (set ands_search_portal_url to your own URL if defining for your own instance of RDA)
- The appearance of the box may be able to be styled using your own CSS classes (perhaps look at
div.ands_widget_wrapper
anddiv.ands_search_widget_results
) - This class uses JSONP so should be able to support cross-domain usage (so you can drop the widget into yoursite.com.au and point to the jswidget class on the ANDS website)
Feel free to contribute to the jswidget class. Please contact us at [email protected] for further information.