Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -2,12 +2,12 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * 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. |
8 | 8 | * |
9 | 9 | * 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. |
12 | 12 | * |
13 | 13 | * @file SMW_SpecialQueryCreator.php |
14 | 14 | * @ingroup SMWSpecialPage |
— | — | @@ -18,8 +18,8 @@ |
19 | 19 | * @author Sanyam Goyal |
20 | 20 | * @author Jeroen De Dauw |
21 | 21 | * @author Devayon Das |
22 | | - * |
23 | 22 | * |
| 23 | + * |
24 | 24 | */ |
25 | 25 | class SMWQueryCreatorPage extends SMWQueryUI { |
26 | 26 | |
— | — | @@ -46,29 +46,29 @@ |
47 | 47 | if ( !$smwgQEnabled ) { |
48 | 48 | $wgOut->addHTML( '<br />' . wfMsg( 'smw_iq_disabled' ) ); |
49 | 49 | } else { |
50 | | - if(!($this->processFormatOptions($wgRequest))){ |
51 | | - $params=array_merge( |
| 50 | + if ( !( $this->processFormatOptions( $wgRequest ) ) ) { |
| 51 | + $params = array_merge( |
52 | 52 | array( |
53 | 53 | 'format' => $wgRequest->getVal( 'format' ), |
54 | 54 | 'offset' => $wgRequest->getVal( 'offset', '0' ), |
55 | 55 | 'limit' => $wgRequest->getVal( 'limit', '20' ) |
56 | | - ),$this->processFormatSelectBox($wgRequest)); |
| 56 | + ), $this->processFormatSelectBox( $wgRequest ) ); |
57 | 57 | $this->m_ui_helper = SMWQueryUIHelper::makeFromUI( |
58 | | - $this->processQueryFormBox($wgRequest), |
| 58 | + $this->processQueryFormBox( $wgRequest ), |
59 | 59 | $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 ); |
64 | 64 | |
65 | 65 | } |
66 | | - $htmloutput=$this->makeResults($p); |
67 | | - if($this->m_ui_helper->getQueryString()!=""){ |
| 66 | + $htmloutput = $this->makeResults( $p ); |
| 67 | + if ( $this->m_ui_helper->getQueryString() != "" ) { |
68 | 68 | if ( $this->usesNavigationBar() ) { |
69 | 69 | $htmloutput .= $this->getNavigationBar ( $this->m_ui_helper->getLimit(), $this->m_ui_helper->getOffset(), $this->m_ui_helper->hasFurtherResults() ); // ? can we preload offset and limit? |
70 | 70 | } |
71 | 71 | |
72 | | - $htmloutput .= "<br/>".$this->m_ui_helper->getHTMLResult()."<br>"; |
| 72 | + $htmloutput .= "<br/>" . $this->m_ui_helper->getHTMLResult() . "<br>"; |
73 | 73 | |
74 | 74 | if ( $this->usesNavigationBar() ) { |
75 | 75 | $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 @@ |
83 | 83 | /** |
84 | 84 | * Adds the input query form. Overloaded from SMWQueryUI |
85 | 85 | */ |
86 | | - protected function makeResults($p){ |
| 86 | + protected function makeResults( $p ) { |
87 | 87 | global $wgOut, $smwgQSortingSupport, $smwgResultFormats, $smwgAutocompleteInSpecialAsk; |
88 | | - $result= ""; |
| 88 | + $result = ""; |
89 | 89 | $spectitle = $this->getTitle(); |
90 | 90 | $result .= '<form name="ask" action="' . $spectitle->escapeLocalURL() . '" method="get">' . "\n" . |
91 | 91 | '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>'; |
92 | | - |
93 | | - $result .= wfMsg('smw_qc_query_help'); |
| 92 | + |
| 93 | + $result .= wfMsg( 'smw_qc_query_help' ); |
94 | 94 | // Main query and printouts. |
95 | 95 | $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';" . |
101 | 101 | "document.getElementById('hide_additional_options').style.display='inline';" . '">' . |
102 | 102 | 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';" . |
106 | 106 | "document.getElementById('show_additional_options').style.display='inline';" . '">' . |
107 | 107 | 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 |
110 | 110 | $result .= '<div id="additional_options" style="display:none">'; |
111 | 111 | $result .= '<p><strong>' . wfMsg( 'smw_ask_printhead' ) . "</strong></p>\n" . |
112 | 112 | '<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 | + |
115 | 115 | // sorting inputs |
116 | 116 | if ( $smwgQSortingSupport ) { |
117 | | - $result .= $this->addSortingOptions($result); |
| 117 | + $result .= $this->addSortingOptions( $result ); |
118 | 118 | } |
119 | | - $result .= "<br><br>" . $this->getFormatSelectBox('broadtable'); |
| 119 | + $result .= "<br><br>" . $this->getFormatSelectBox( 'broadtable' ); |
120 | 120 | $result .= '</div>'; |
121 | 121 | $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>' . |
122 | 122 | '<input type="hidden" name="eq" value="no"/>' . |
— | — | @@ -131,11 +131,11 @@ |
132 | 132 | * @return string |
133 | 133 | */ |
134 | 134 | |
135 | | - protected function addSortingOptions(){ |
| 135 | + protected function addSortingOptions() { |
136 | 136 | global $wgRequest, $wgOut, $smwgJQueryIncluded; |
137 | 137 | |
138 | 138 | |
139 | | - $result=''; |
| 139 | + $result = ''; |
140 | 140 | if ( ! array_key_exists( 'sort', $this->m_params ) || ! array_key_exists( 'order', $this->m_params ) ) { |
141 | 141 | $orders = array(); // do not even show one sort input here |
142 | 142 | } else { |
— | — | @@ -163,10 +163,10 @@ |
164 | 164 | $result .= "</div>\n"; |
165 | 165 | $result .= '<div id="sorting_main"></div>' . "\n"; |
166 | 166 | $result .= '<a href="javascript:addInstance(\'sorting_starter\', \'sorting_main\')">' . wfMsg( 'smw_add_sortcondition' ) . '</a>' . "\n"; |
167 | | - |
168 | | - |
169 | 167 | |
170 | 168 | |
| 169 | + |
| 170 | + |
171 | 171 | $this->m_num_sort_values = 0; |
172 | 172 | |
173 | 173 | if ( !array_key_exists( 'sort', $this->m_params ) ) { |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | // Javascript code for handling adding and removing the "sort" inputs |
181 | 181 | $delete_msg = wfMsg( 'delete' ); |
182 | 182 | |
183 | | - |
| 183 | + |
184 | 184 | $javascript_text = <<<END |
185 | 185 | <script type="text/javascript"> |
186 | 186 | // code for handling adding and removing the "sort" inputs |