SMWQueryUI Class Reference
[SMWSpecialPageSpecialPage]

A base class for Semantic Search UIs. More...

Inherited by SMWQueryCreatorPage.

List of all members.

Public Member Functions

 execute ($p)
 Initialises the page.
 isSyndicated ()
 To enable/disable syndicated feeds of results to appear in the UI header.
 getNavigationBar ($limit, $offset, $hasFurtherResults)
 Build the navigation bar for some given query result.
 getPOStrings ()
 Returns the additional printouts as a string.

Public Attributes

const ENABLE_AUTO_SUGGEST = true
const DISABLE_AUTO_SUGGEST = false

Protected Member Functions

 processParams ()
 This method should return an associative array of parameters extracted from the current (global) web request.
 makePage ($p)
 Create an HTML form that is to be displayed on the page and return the according HTML code.
 getAskEmbedBox ()
 Builds a read-only ask embed code of the given query.
 getErrorsHtml ()
 A function which formats the current errors in HTML.
 enableAutocompletion ()
 Enable auto completion scripts and styles.
 getQueryFormBox ()
 Generates the form element(s) for the Query-string.
 processQueryFormBox (WebRequest $wgRequest)
 Decodes form data sent through form-elements generated by its complement, getQueryFormBox.
 processPoSortFormBox (WebRequest $wgRequest)
 Decodes printouts and sorting - related form options generated by its complement, getPoSortFormBox().
 getPoSortFormBox ($enableAutocomplete=SMWQueryUI::ENABLE_AUTO_SUGGEST)
 Generates the forms elements(s) for choosing printouts and sorting options.
 getSortingFormBox ()
 Generates the forms elements(s) for adding sorting options.
 processSortingFormBox (WebRequest $wgRequest)
 Decodes form Sorting options sent through form-elements generated by its complement, getSortingFormBox().
 getPOFormBox ($enableAutocomplete=SMWQueryUI::ENABLE_AUTO_SUGGEST)
 Generates the form element(s) for PrintOuts.
 processPOFormBox (WebRequest $wgRequest)
 Decodes form data sent through form-elements generated by its complement, getPOFormBox().
 setUrlArgs (array $args)
 Given an array of urlparameter=>value pairs, this method adds them to its set of Url-arguments.
 getUrlArgs ()
 resetUrlArgs ()
 showFormatOptions ($format, array $paramValues, array $ignoredAttribs=array())
 Displays a form section showing the options for a given format, based on the getParameters() value for that format's query printer.
 showFormatOption (Parameter $parameter, $currentValue)
 Get the HTML for a single parameter input.
 getFormatSelectBoxSep ($defaultFormat= 'broadtable')
 Creates form elements for choosing the result-format and their associated format.
 processFormatSelectBox (WebRequest $wgRequest)
 A method which decodes form data sent through form-elements generated by its complement, getFormatSelectBox().
 processFormatOptions ($wgRequest)
 Generates form elements for a (web)requested format.
 usesNavigationBar ()
 Returns true if this page shows the navigationBar.

Protected Attributes

 $uiCore
 $urlArgs = array()


Detailed Description

A base class for Semantic Search UIs.

All Semantic Search UI's may subclass from this.

The commonly used and overloaded methods are the ones which create some default UI elements (the getxxxFormBox() methods) and corresponding methods that extract data from them (the processxxxFormBox() methods).

Author:
Markus Krötzsch

Yaron Koren

Sanyam Goyal

Jeroen De Dauw

Devayon Das

Definition at line 20 of file SMW_QueryUI.php.


Member Function Documentation

SMWQueryUI::execute ( p  ) 

Initialises the page.

Sets the property $uiCore to the appropriate helper object.

To create a custom UI, adding changes to makePage() is usually enough, but one might want to overload this method to get better handling of form parameters.

OutputPage $wgOut WebRequest $wgRequest boolean $smwgQEnabled

Parameters:
string $p the sub-page string

Definition at line 44 of file SMW_QueryUI.php.

References $smwgQEnabled, SMWOutputs::commitToOutputPage(), isSyndicated(), SMWQueryUIHelper::makeForInfoLink(), SMWQueryUIHelper::makeForUI(), makePage(), processFormatOptions(), processParams(), and processQueryFormBox().

SMWQueryUI::processParams (  )  [abstract, protected]

This method should return an associative array of parameters extracted from the current (global) web request.

Implementations can call the various processXXXBox() methods for reading parameters that belong to standard UI elements provided by this base class (by according getXXXBox() methods).

Returns:
array of parameters

Reimplemented in SMWQueryCreatorPage.

Referenced by execute().

SMWQueryUI::makePage ( p  )  [abstract, protected]

Create an HTML form that is to be displayed on the page and return the according HTML code.

Parameters:
string $p the sub-page string
Returns:
string HTML code for the page

Reimplemented in SMWQueryCreatorPage.

Referenced by execute().

SMWQueryUI::isSyndicated (  ) 

To enable/disable syndicated feeds of results to appear in the UI header.

Returns:
boolean

Definition at line 119 of file SMW_QueryUI.php.

Referenced by execute().

SMWQueryUI::getAskEmbedBox (  )  [protected]

Builds a read-only ask embed code of the given query.

The code is presented in html code.

Returns:
string

Definition at line 129 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::makeForm().

SMWQueryUI::getErrorsHtml (  )  [protected]

A function which formats the current errors in HTML.

Definition at line 156 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::makeForm().

SMWQueryUI::enableAutocompletion (  )  [protected]

Enable auto completion scripts and styles.

* extending jquery functions for custom autocomplete matching */

Definition at line 169 of file SMW_QueryUI.php.

References END, and SMWOutputs::requireResource().

SMWQueryUI::getNavigationBar ( limit,
offset,
hasFurtherResults 
)

Build the navigation bar for some given query result.

UI may overload this for a different layout. The navigation bar can be hidden by overloading usesNavigationBar(). To change the url format, one may overload getUrlTail();

int $smwgQMaxInlineLimit Language $wgLang

Parameters:
int $limit
int $offset
boolean $hasFurtherResults
Returns:
string

Definition at line 237 of file SMW_QueryUI.php.

References $smwgQMaxInlineLimit.

Referenced by SMWQueryCreatorPage::makePage().

SMWQueryUI::getQueryFormBox (  )  [protected]

Generates the form element(s) for the Query-string.

Use its complement processQueryFormBox() to decode data sent through these elements. UI's may overload both to change form parameters.

string $smwgScriptPath

Returns:
string

Definition at line 320 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::makeForm().

SMWQueryUI::processQueryFormBox ( WebRequest $  wgRequest  )  [protected]

Decodes form data sent through form-elements generated by its complement, getQueryFormBox.

UIs may overload both to change form parameters.

Parameters:
WebRequest $wgRequest
Returns:
mixed returns the querystring if possible, false if no querystring is set

Definition at line 339 of file SMW_QueryUI.php.

Referenced by execute().

SMWQueryUI::processPoSortFormBox ( WebRequest $  wgRequest  )  [protected]

Decodes printouts and sorting - related form options generated by its complement, getPoSortFormBox().

UIs may overload both to change form parameters.

boolean $smwgQSortingSupport Language $wgContLang

Parameters:
WebRequest $wgRequest
Returns:
string

Definition at line 358 of file SMW_QueryUI.php.

References $smwgQSortingSupport.

Referenced by SMWQueryCreatorPage::processParams().

SMWQueryUI::getPoSortFormBox ( enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST  )  [protected]

Generates the forms elements(s) for choosing printouts and sorting options.

Use its complement processPoSortFormBox() to decode data sent by these elements.

boolean $smwgQSortingSupport boolean $smwgQRandSortingSupport WebRequest $wgRequest string $smwgScriptPath integer $smwgQPrintoutLimit

Parameters:
mixed $enableAutocomplete
Returns:
string

Definition at line 493 of file SMW_QueryUI.php.

References $smwgQPrintoutLimit, $smwgQRandSortingSupport, $smwgQSortingSupport, $smwgScriptPath, ENABLE_AUTO_SUGGEST, SMWPrintRequest::PRINT_CATS, SMWPrintRequest::PRINT_CCAT, SMWPrintRequest::PRINT_PROP, SMWPrintRequest::PRINT_THIS, SMWOutputs::requireResource(), public::response(), and scraper::url.

Referenced by SMWQueryCreatorPage::makeForm().

SMWQueryUI::getSortingFormBox (  )  [protected]

Generates the forms elements(s) for adding sorting options.

Use its complement processSortingFormBox() to decode sorting data sent by these elements.

boolean $smwgQSortingSupport WebRequest $wgRequest

Returns:
string
Todo:
This code is not used anywhere in SMW.

Definition at line 1410 of file SMW_QueryUI.php.

SMWQueryUI::processSortingFormBox ( WebRequest $  wgRequest  )  [protected]

Decodes form Sorting options sent through form-elements generated by its complement, getSortingFormBox().

UIs may overload both to change form parameters.

boolean $smwgQSortingSupport

Parameters:
WebRequest $wgRequest
Returns:
string
Todo:
build in validation for sorting

Definition at line 1523 of file SMW_QueryUI.php.

SMWQueryUI::getPOFormBox ( enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST  )  [protected]

Generates the form element(s) for PrintOuts.

Use its complement processPOFormBox() to decode data sent through these form elements. UIs may overload both to change the form parameter or the html elements.

Parameters:
boolean $enableAutocomplete If set to true, adds the relevant JS and CSS to the page
Returns:
string The HTML code

Definition at line 1559 of file SMW_QueryUI.php.

SMWQueryUI::processPOFormBox ( WebRequest $  wgRequest  )  [protected]

Decodes form data sent through form-elements generated by its complement, getPOFormBox().

UIs may overload both to change form parameters.

Parameters:
WebRequest $wgRequest
Returns:
array

Definition at line 1612 of file SMW_QueryUI.php.

SMWQueryUI::setUrlArgs ( array $  args  )  [protected]

Given an array of urlparameter=>value pairs, this method adds them to its set of Url-arguments.

If the urlparameter already exists, it is replaced by the supplied value

Parameters:
array $args

Definition at line 1646 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::getUrlArgs().

SMWQueryUI::getUrlArgs (  )  [protected]

Returns:
array of strings in the urlparamater=>value format

Reimplemented in SMWQueryCreatorPage.

Definition at line 1654 of file SMW_QueryUI.php.

SMWQueryUI::resetUrlArgs (  )  [protected]

Definition at line 1658 of file SMW_QueryUI.php.

SMWQueryUI::showFormatOptions ( format,
array $  paramValues,
array $  ignoredAttribs = array() 
) [protected]

Displays a form section showing the options for a given format, based on the getParameters() value for that format's query printer.

Parameters:
string $format
array $paramValues The current values for the parameters (name => value)
array $ignoredAttribs Attributes which should not be generated by this method.
Returns:
string

Reimplemented in SMWQueryCreatorPage.

Definition at line 1673 of file SMW_QueryUI.php.

SMWQueryUI::showFormatOption ( Parameter $  parameter,
currentValue 
) [protected]

Get the HTML for a single parameter input.

Parameters:
Parameter $parameter
mixed $currentValue
Returns:
string

Definition at line 1748 of file SMW_QueryUI.php.

SMWQueryUI::getFormatSelectBoxSep ( defaultFormat = 'broadtable'  )  [protected]

Creates form elements for choosing the result-format and their associated format.

The drop-down list and the format options are returned seperately as elements of an array.Use in conjunction with processFormatOptions() to supply formats options using ajax. Also, use its complement processFormatSelectBox() to decode form data sent by these elements. UI's may overload these methods to change behaviour or form parameters.

Parameters:
string $defaultFormat The default format which remains selected in the form
Returns:
array The first element contains the format selector, while the second contains the Format options

Definition at line 1773 of file SMW_QueryUI.php.

References $smwgResultFormats, SMWQueryProcessor::getResultPrinter(), SMWOutputs::requireResource(), SMWQueryProcessor::SPECIAL_PAGE, and simplejson::encoder::text.

Referenced by SMWQueryCreatorPage::makeForm().

SMWQueryUI::processFormatSelectBox ( WebRequest $  wgRequest  )  [protected]

A method which decodes form data sent through form-elements generated by its complement, getFormatSelectBox().

UIs may overload both to change form parameters.

Parameters:
WebRequest $wgRequest
Returns:
array

Definition at line 1841 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::processParams().

SMWQueryUI::processFormatOptions ( wgRequest  )  [protected]

Generates form elements for a (web)requested format.

Required by getFormatSelectBox() to recieve form elements from the Web. UIs may need to overload processFormatOptions(), processFormatSelectBox() and getFormatSelectBox() to change behavior.

Parameters:
WebRequest $wgRequest
Returns:
boolean true if format options were requested and returned, else false

Definition at line 1872 of file SMW_QueryUI.php.

Referenced by execute().

SMWQueryUI::getPOStrings (  ) 

Returns the additional printouts as a string.

UIs may overload this to change how this string should be displayed.

Returns:
string

Definition at line 1893 of file SMW_QueryUI.php.

SMWQueryUI::usesNavigationBar (  )  [protected]

Returns true if this page shows the navigationBar.

Overload to change behavior.

Returns:
boolean

Definition at line 1910 of file SMW_QueryUI.php.

Referenced by SMWQueryCreatorPage::makePage().


Member Data Documentation

SMWQueryUI::$uiCore [protected]

Definition at line 26 of file SMW_QueryUI.php.

Definition at line 28 of file SMW_QueryUI.php.

Referenced by getPoSortFormBox().

Definition at line 29 of file SMW_QueryUI.php.

SMWQueryUI::$urlArgs = array() [protected]

Definition at line 1638 of file SMW_QueryUI.php.


The documentation for this class was generated from the following file:

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6