r91868 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91867‎ | r91868 | r91869 >
Date:09:18, 11 July 2011
Author:devayon
Status:deferred
Tags:
Comment:
stylize
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -2,12 +2,12 @@
33
44 /**
55 * This special page for Semantic MediaWiki implements a customisable form for
6 - * executing queries outside of articles. Results and format options are generated by
7 - * SMW_SpecialAsk.php.
 6+ * executing queries outside of articles. Results and format options are generated by
 7+ * SMW_SpecialAsk.php.
88 *
99 * Currently adapted from current contents of SMW_SpecialAsk.php
10 - * This page is currently under development as part of the Google Summer of
11 - * Code 2011 Program.
 10+ * This page is currently under development as part of the Google Summer of
 11+ * Code 2011 Program.
1212 *
1313 * @file SMW_SpecialQueryCreator.php
1414 * @ingroup SMWSpecialPage
@@ -18,8 +18,8 @@
1919 * @author Sanyam Goyal
2020 * @author Jeroen De Dauw
2121 * @author Devayon Das
22 - *
2322 *
 23+ *
2424 */
2525 class SMWQueryCreatorPage extends SMWQueryUI {
2626
@@ -46,29 +46,29 @@
4747 if ( !$smwgQEnabled ) {
4848 $wgOut->addHTML( '<br />' . wfMsg( 'smw_iq_disabled' ) );
4949 } else {
50 - if(!($this->processFormatOptions($wgRequest))){
51 - $params=array_merge(
 50+ if ( !( $this->processFormatOptions( $wgRequest ) ) ) {
 51+ $params = array_merge(
5252 array(
5353 'format' => $wgRequest->getVal( 'format' ),
5454 'offset' => $wgRequest->getVal( 'offset', '0' ),
5555 'limit' => $wgRequest->getVal( 'limit', '20' )
56 - ),$this->processFormatSelectBox($wgRequest));
 56+ ), $this->processFormatSelectBox( $wgRequest ) );
5757 $this->m_ui_helper = SMWQueryUIHelper::makeFromUI(
58 - $this->processQueryFormBox($wgRequest),
 58+ $this->processQueryFormBox( $wgRequest ),
5959 $params,
60 - $this->processPOFormBox($wgRequest),
61 - false);
62 - if($this->m_ui_helper->getQueryString()!=""){
63 - $this->m_ui_helper->execute($p);
 60+ $this->processPOFormBox( $wgRequest ),
 61+ false );
 62+ if ( $this->m_ui_helper->getQueryString() != "" ) {
 63+ $this->m_ui_helper->execute( $p );
6464
6565 }
66 - $htmloutput=$this->makeResults($p);
67 - if($this->m_ui_helper->getQueryString()!=""){
 66+ $htmloutput = $this->makeResults( $p );
 67+ if ( $this->m_ui_helper->getQueryString() != "" ) {
6868 if ( $this->usesNavigationBar() ) {
6969 $htmloutput .= $this->getNavigationBar ( $this->m_ui_helper->getLimit(), $this->m_ui_helper->getOffset(), $this->m_ui_helper->hasFurtherResults() ); // ? can we preload offset and limit?
7070 }
7171
72 - $htmloutput .= "<br/>".$this->m_ui_helper->getHTMLResult()."<br>";
 72+ $htmloutput .= "<br/>" . $this->m_ui_helper->getHTMLResult() . "<br>";
7373
7474 if ( $this->usesNavigationBar() ) {
7575 $htmloutput .= $this->getNavigationBar ( $this->m_ui_helper->getLimit(), $this->m_ui_helper->getOffset(), $this->m_ui_helper->hasFurtherResults() ); // ? can we preload offset and limit?
@@ -82,40 +82,40 @@
8383 /**
8484 * Adds the input query form. Overloaded from SMWQueryUI
8585 */
86 - protected function makeResults($p){
 86+ protected function makeResults( $p ) {
8787 global $wgOut, $smwgQSortingSupport, $smwgResultFormats, $smwgAutocompleteInSpecialAsk;
88 - $result= "";
 88+ $result = "";
8989 $spectitle = $this->getTitle();
9090 $result .= '<form name="ask" action="' . $spectitle->escapeLocalURL() . '" method="get">' . "\n" .
9191 '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>';
92 -
93 - $result .= wfMsg('smw_qc_query_help');
 92+
 93+ $result .= wfMsg( 'smw_qc_query_help' );
9494 // Main query and printouts.
9595 $result .= '<p><strong>' . wfMsg( 'smw_ask_queryhead' ) . "</strong></p>\n";
96 - $result .= '<p>'.$this->getQueryFormBox($this->m_ui_helper->getQueryString()).'</p>';
97 - //show|hide additional options and querying help
98 - $result .= '<span id="show_additional_options" style="display:inline"><a href="#addtional" rel="nofollow" onclick="' .
99 - "document.getElementById('additional_options').style.display='block';" .
100 - "document.getElementById('show_additional_options').style.display='none';" .
 96+ $result .= '<p>' . $this->getQueryFormBox( $this->m_ui_helper->getQueryString() ) . '</p>';
 97+ // show|hide additional options and querying help
 98+ $result .= '<span id="show_additional_options" style="display:inline"><a href="#addtional" rel="nofollow" onclick="' .
 99+ "document.getElementById('additional_options').style.display='block';" .
 100+ "document.getElementById('show_additional_options').style.display='none';" .
101101 "document.getElementById('hide_additional_options').style.display='inline';" . '">' .
102102 wfMsg( 'smw_show_addnal_opts' ) . '</a></span>';
103 - $result .= '<span id="hide_additional_options" style="display:none"><a href="#" rel="nofollow" onclick="' .
104 - "document.getElementById('additional_options').style.display='none';" .
105 - "document.getElementById('hide_additional_options').style.display='none';" .
 103+ $result .= '<span id="hide_additional_options" style="display:none"><a href="#" rel="nofollow" onclick="' .
 104+ "document.getElementById('additional_options').style.display='none';" .
 105+ "document.getElementById('hide_additional_options').style.display='none';" .
106106 "document.getElementById('show_additional_options').style.display='inline';" . '">' .
107107 wfMsg( 'smw_hide_addnal_opts' ) . '</a></span>';
108 - $result .=' | <a href="' . htmlspecialchars( wfMsg( 'smw_ask_doculink' ) ) . '">' . wfMsg( 'smw_ask_help' ) . '</a>';
109 - //additional options
 108+ $result .= ' | <a href="' . htmlspecialchars( wfMsg( 'smw_ask_doculink' ) ) . '">' . wfMsg( 'smw_ask_help' ) . '</a>';
 109+ // additional options
110110 $result .= '<div id="additional_options" style="display:none">';
111111 $result .= '<p><strong>' . wfMsg( 'smw_ask_printhead' ) . "</strong></p>\n" .
112112 '<span style="font-weight: normal;">' . wfMsg( 'smw_ask_printdesc' ) . '</span>' . "\n" .
113 - '<p>'. $this->getPOFormBox($this->getPOStrings(),true).'</p>' . "\n";
114 -
 113+ '<p>' . $this->getPOFormBox( $this->getPOStrings(), true ) . '</p>' . "\n";
 114+
115115 // sorting inputs
116116 if ( $smwgQSortingSupport ) {
117 - $result .= $this->addSortingOptions($result);
 117+ $result .= $this->addSortingOptions( $result );
118118 }
119 - $result .= "<br><br>" . $this->getFormatSelectBox('broadtable');
 119+ $result .= "<br><br>" . $this->getFormatSelectBox( 'broadtable' );
120120 $result .= '</div>';
121121 $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>' .
122122 '<input type="hidden" name="eq" value="no"/>' .
@@ -131,11 +131,11 @@
132132 * @return string
133133 */
134134
135 - protected function addSortingOptions(){
 135+ protected function addSortingOptions() {
136136 global $wgRequest, $wgOut, $smwgJQueryIncluded;
137137
138138
139 - $result='';
 139+ $result = '';
140140 if ( ! array_key_exists( 'sort', $this->m_params ) || ! array_key_exists( 'order', $this->m_params ) ) {
141141 $orders = array(); // do not even show one sort input here
142142 } else {
@@ -163,10 +163,10 @@
164164 $result .= "</div>\n";
165165 $result .= '<div id="sorting_main"></div>' . "\n";
166166 $result .= '<a href="javascript:addInstance(\'sorting_starter\', \'sorting_main\')">' . wfMsg( 'smw_add_sortcondition' ) . '</a>' . "\n";
167 -
168 -
169167
170168
 169+
 170+
171171 $this->m_num_sort_values = 0;
172172
173173 if ( !array_key_exists( 'sort', $this->m_params ) ) {
@@ -179,7 +179,7 @@
180180 // Javascript code for handling adding and removing the "sort" inputs
181181 $delete_msg = wfMsg( 'delete' );
182182
183 -
 183+
184184 $javascript_text = <<<END
185185 <script type="text/javascript">
186186 // code for handling adding and removing the "sort" inputs