Documentation:UBC Content Management System/Shortcodes/ubc-delicious-search

From UBC Wiki

UBC Delicious Search Plugin

This plugin allows you to search as well as filter from a publicly available accessible delicious account.

Description.

This plugin requires the use of multiple shortcode to achieve the funcitonality of being able to search and filter a delicious account links.

The required shortcode is:

  • [ubc_delicious_results]

The optinal shortcodes are:

  • [ubc_delicious_search]
  • [ubc_delicious_dropdown]
  • [ubc_delicious_checkbox]

Extra shortcodes:

  • [ubc_delicious_results_once]

Shortcodes

NOTE:

  • All shortcode attributes in the following section with * is a required field for that particular shortocde.
  • all default value are shown in the code sample.
[ubc_delicious_results]
[ubc_delicious_results limit=20 defaulttag='' defaultuser='' useor='false' view='list'  sort='rank' pagination=0]

This is a required shortcode, for if it is not on the page, how does the results know where to show up? It also sets a bunch of required fields that the other shortcode uses.

  • limit - (integer)number which determines the number of results returned, up to a max of 20 (sorry, don't understand pagination in the undocumented delicious search api)
  • defaulttag - (string)tag string which determines what is initially queried when page loads
  • defaultuser* - (string)determines which account gets queried, if left blank the query will fail
  • useor -
    • false - (default) all tags will be combined in a “and” query
    • true - all tags will be “or’d”
  • view -
    • list - (default)displays results in a unordered list (aliases include list_unordered)
    • list_ordered - displays results in an ordered list
    • links - displays anchors separated by br tag
  • sort - what kind of sorting to the returned results will be applied to
    • rank - (default)displays results sorted by top saved link in delicious
    • alpha - display results sorted alphabetically by link title
    • none - displays results ordered by whatever is sent to the plugin from delicious
  • showcomments - shows the comments of each resource pulled from delicious
    • true - (default)either the string true or anything but the string false will display the comments of each delicious resource
    • false - either the string false or empty string will produce a false result
  • pagination - sets up pagination where you specify how many to show per page. (# pages = limit / pagination)
[ubc_delicious_search]
[ubc_delicious_search placeholder="Search Words" submittext="Submit" resettext="Reset" searchtitle="Search" extraclasses="" buttonclasses="" userreset="true"]

This shortcode is used to create the search area, which can contain checkboxes/dropdowns (both optional off course!).

  • placeholder - (string)text to display in the placeholder attribute
  • submittext - (string)text to display on submit button
  • resettext - (string)text to display on reset button
  • searchtitle - (string)text to display above entire search area
  • extraclasses - (string)classes to be append to the div containing the search input area
  • butonclasses - (string) classes to be appended to the submit and reset buttons eg. “btn btn-primary”
  • usereset -
    • true - (default)the reset button will appear
    • false - there will be no reset button
[ubc_delicious_dropdown]
[ubc_delicious_dropdown useshowall="Show All" optionslist="" defaultoption="" optiontitle="" extraclasses=""]

This shortcode is used to create a dropdown of tags and allows the selection of only one tag at a time from a list of tags.

  • useshowall -
    • string - (default)will display the string passed to this attribute
    • false/empty string - will make it so that show all will not be an option
  • optionslist* - takes a comma separated list of values, where values can be in one of 3 forms (mixed value formats allowed)
    1. value - it will use this value as the value of the dropdown option as well as label
    2. value::label - it will use the value as value and label as label
    3. value::label::option - it will use the value as value, label as label, and option can be "disabled" to disable the option
  • defaultoption - (string)will set the initial select option whose value matches this attribute
  • optiontitle - (string)text to display the label of the dropdown
  • extraclasses - (string)classes to be append to the div containing the search input area
[ubc_delicious_checkbox]
[ubc_delicious_checkbox optionslist="" defaultoption="" optiontitle="" extraclasses=""]

This shortcode is used to create a list of checkboxes of tags to allow users to select multiple tags at once.

  • optionslist* - takes a comma separated list of values, where values can be in one of 3 forms (mixed value formats allowed)
    1. value - it will use this value as the value of the dropdown option as well as label
    2. value::label - it will use the value as value and label as label
    3. value::label::option - it will use the value as value, label as label, and option can be "disabled" to disable the option
  • defaultoption - (string)will set the initial select option whose value matches this attribute
  • optiontitle - (string)text to display the label of the dropdown
  • extraclasses - (string)classes to be append to the div containing the search input area
[ubc_delicious_results_once]
[ubc_delicious_results_once limit=20 defaulttag='' defaultuser='' useor='false' view='list'  sort='rank']

This is an extra shortcode to allow multiple instances of unfilterable and unsearchable results area on a single page.

  • limit - (integer)number which determines the number of results returned, up to a max of 200
  • defaulttag - (string)tag string which determines what is initially queried when page loads
  • defaultuser* - (string)determines which account gets queried, if left blank the query will fail
  • useor -
    • false - (default) all tags will be combined in a “and” query
    • true - all tags will be “or’d”
  • view -
    • list - (default)displays results in a unordered list (aliases include list_unordered)
    • list_ordered - displays results in an ordered list
    • links - displays anchors separated by br tag
  • sort - what kind of sorting to the returned results will be applied to
    • rank - (default)displays results sorted by top saved link in delicious
    • alpha - display results sorted alphabetically by link title
    • none - displays results ordered by whatever is sent to the plugin from delicious
  • showcomments - shows the comments of each resource pulled from delicious
    • true - (default)either the string true or anything but the string false will display the comments of each delicious resource
    • false - either the string false or empty string will produce a false result

NOTES

  • all pages that use search/checkbox/dropdown must have only one [ubc_delicious_results]
  • any filtering shortcodes (search/checkbox/dropdown) can be used by itself
  • if you want to combine search with filtering shortcodes (dropdown/checkbox), then put it inside the search shortcode
  • [ubc_delicious_results_once] can be used as many times as you want on a page

Examples

eg1

[ubc_delicious_search extraclasses="span4" buttonclasses="btn btn-primary" placeholder="Search Terms" searchtitle="Resource Search"]
[ubc_delicious_dropdown extraclasses="span4" optiontitle="Availability" optionslist="CWL::UBC Only, Public"]
[ubc_delicious_checkbox extraclasses="span4" optiontitle="Media Format" optionslist="Video, Journal Article, Worksheet, Lecture::Lexxy, eBook Chapter" defaultoption="Journal Article, Lecture"]
[/ubc_delicious_search]

[ubc_delicious_results defaultuser='eubc' defaulttag='Customer Search and Validation' limit=10 sort="rank"]

eg2

[ubc_delicious_checkbox extraclasses="span4" optiontitle="Media Format" optionslist="Video, Journal Article, Worksheet, Lecture::Lexxy, eBook Chapter" defaultoption="Journal Article, Lecture"]
[ubc_delicious_results defaultuser='eubc' defaulttag='Customer Search and Validation' limit=10 sort="rank"]

eg3

[ubc_delicious_results_once limit=20 defaultuser="eubc" defaulttag="eBook Chapter"]
[ubc_delicious_results_once limit=20 defaultuser="eubc" defaulttag="customer retention, get/keep/grow"]

Rules of Engagement:

The [ubc_delicious_results] shortcode is meant for only one use per page (Fun results will ensue if you try more than one!)