Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -37,16 +37,20 @@ |
38 | 38 | if ( $this->uiCore->getQueryString() != "" ) { |
39 | 39 | if ( $this->usesNavigationBar() ) { |
40 | 40 | $htmlOutput .= Html::rawElement( 'div', array( 'class' => 'smwqcnavbar' ), |
41 | | - $this->getNavigationBar ( $this->uiCore->getLimit(), $this->uiCore->getOffset(), $this->uiCore->hasFurtherResults() ) |
42 | | - ); |
| 41 | + $this->getNavigationBar ( $this->uiCore->getLimit(), |
| 42 | + $this->uiCore->getOffset(), |
| 43 | + $this->uiCore->hasFurtherResults() ) |
| 44 | + ); |
43 | 45 | } |
44 | 46 | |
45 | 47 | $htmlOutput .= Html::rawElement( 'div', array( 'class' => 'smwqcresult' ), $this->uiCore->getHTMLResult() ); |
46 | 48 | |
47 | 49 | if ( $this->usesNavigationBar() ) { |
48 | 50 | $htmlOutput .= Html::rawElement( 'div', array( 'class' => 'smwqcnavbar' ), |
49 | | - $this->getNavigationBar ( $this->uiCore->getLimit(), $this->uiCore->getOffset(), $this->uiCore->hasFurtherResults() ) |
50 | | - ); |
| 51 | + $this->getNavigationBar ( $this->uiCore->getLimit(), |
| 52 | + $this->uiCore->getOffset(), |
| 53 | + $this->uiCore->hasFurtherResults() ) |
| 54 | + ); |
51 | 55 | } |
52 | 56 | } |
53 | 57 | $wgOut->addHTML( $htmlOutput ); |
— | — | @@ -63,13 +67,13 @@ |
64 | 68 | protected function processParams() { |
65 | 69 | global $wgRequest; |
66 | 70 | $params = array_merge( |
67 | | - array( |
68 | | - 'format' => $wgRequest->getVal( 'format' ), |
69 | | - 'offset' => $wgRequest->getVal( 'offset', '0' ), |
70 | | - 'limit' => $wgRequest->getVal( 'limit', '20' ) ), |
71 | | - $this->processPoSortFormBox( $wgRequest ), |
72 | | - $this->processFormatSelectBox( $wgRequest ) |
73 | | - ); |
| 71 | + array( |
| 72 | + 'format' => $wgRequest->getVal( 'format' ), |
| 73 | + 'offset' => $wgRequest->getVal( 'offset', '0' ), |
| 74 | + 'limit' => $wgRequest->getVal( 'limit', '20' ) ), |
| 75 | + $this->processPoSortFormBox( $wgRequest ), |
| 76 | + $this->processFormatSelectBox( $wgRequest ) |
| 77 | + ); |
74 | 78 | return $params; |
75 | 79 | } |
76 | 80 | |
— | — | @@ -88,7 +92,7 @@ |
89 | 93 | protected function showFormatOptions( $format, array $paramValues, array $ignoredAttribs = array() ) { |
90 | 94 | return parent::showFormatOptions( $format, $paramValues, array( |
91 | 95 | 'format', 'limit', 'offset', 'mainlabel', 'intro', 'outro', 'default' |
92 | | - ) ); |
| 96 | + ) ); |
93 | 97 | } |
94 | 98 | |
95 | 99 | /** |
— | — | @@ -112,8 +116,9 @@ |
113 | 117 | // sorting and prinouts |
114 | 118 | $result .= '<div class="smwqcsortbox">' . $this->getPoSortFormBox() . '</div>'; |
115 | 119 | // additional options |
| 120 | + |
116 | 121 | // START: show|hide additional options |
117 | | - $result .= '<div class="smwqcformatas"><strong>' . wfMsg( 'smw_ask_format_as' ) . '</strong>'; |
| 122 | + $result .= '<div class="smwqcformatas">' . Html::element( 'strong', array(), wfMsg( 'smw_ask_format_as' ) ); |
118 | 123 | $result .= $formatBox[0] . '<span id="show_additional_options" style="display:inline;">' . |
119 | 124 | '<a href="#addtional" rel="nofollow" onclick="' . |
120 | 125 | "jQuery('#additional_options').show('blind');" . |
— | — | @@ -127,86 +132,50 @@ |
128 | 133 | wfMsg( 'smw_qc_hide_addnal_opts' ) . '</a></span>'; |
129 | 134 | $result .= '</div>'; |
130 | 135 | // END: show|hide additional options |
| 136 | + |
131 | 137 | $result .= '<div id="additional_options" style="display:none">'; |
132 | | - $params = $this->uiCore->getParameters(); |
133 | | - if ( array_key_exists( 'limit', $params ) ) { |
134 | | - $limit = $params['limit']; |
135 | | - } else { |
136 | | - $limit = ''; |
137 | | - } |
138 | | - if ( array_key_exists( 'offset', $params ) ) { |
139 | | - $offset = $params['offset']; |
140 | | - } else { |
141 | | - $offset = ''; |
142 | | - } |
143 | | - if ( array_key_exists( 'intro', $params ) ) { |
144 | | - $intro = $params['intro']; |
145 | | - } else { |
146 | | - $intro = ''; |
147 | | - } |
148 | | - if ( array_key_exists( 'outro', $params ) ) { |
149 | | - $outro = $params['outro']; |
150 | | - } else { |
151 | | - $outro = ''; |
152 | | - } |
153 | | - if ( array_key_exists( 'default', $params ) ) { |
154 | | - $default = $params['default']; |
155 | | - } else { |
156 | | - $default = ''; |
157 | | - } |
158 | | - $result .= '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n" . |
159 | | - Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
160 | | - 'Intro: <input name="p[intro]" value="' . $intro . '"size="32"/> <br/>' . wfMsg( 'smw_paramdesc_intro' ) |
161 | | - ) . |
162 | | - Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
163 | | - 'Outro: <input name="p[outro]" value="' . $outro . '" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_outro' ) |
164 | | - ) . |
165 | | - Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
166 | | - 'Default: <input name="p[default]" value="' . $default . '" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_default' ) |
167 | | - ) . |
168 | | - Html::hidden( 'p[limit]', $limit ) . |
169 | | - Html::hidden( 'p[offset]', $offset ) . |
170 | | - '</fieldset>'; |
| 138 | + $result .= $this->getOtherParametersBox(); |
171 | 139 | $result .= '<fieldset><legend>' . wfMsg( 'smw_qc_formatopt' ) . "</legend>\n" . |
172 | 140 | $formatBox[1] . // display the format options |
173 | 141 | "</fieldset>\n"; |
174 | 142 | |
175 | 143 | $result .= '</div>'; // end of hidden additional options |
176 | | - $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/><br/>'; |
| 144 | + $result .= '<br/><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/><br/>'; |
| 145 | + $result .= '<a href="' . htmlspecialchars( wfMsg( 'smw_ask_doculink' ) ) . '">' . wfMsg( 'smw_ask_help' ) . '</a>'; |
177 | 146 | |
178 | | - $result .= '<a href="' . htmlspecialchars( wfMsg( 'smw_ask_doculink' ) ) . '">' . wfMsg( 'smw_ask_help' ) . '</a>'; |
179 | 147 | if ( $this->uiCore->getQueryString() != '' ) { // hide #ask if there isnt any query defined |
180 | | - $result .= ' | <a name="show-embed-code" id="show-embed-code" href="##" rel="nofollow">' . wfMsg( 'smw_ask_show_embed' ) . '</a>'; |
181 | | - $result .= '<div id="embed-code-dialog">' . |
182 | | - $this->getAskEmbedBox() . |
183 | | - '</div>'; |
184 | | - $this->enableJQueryUI(); |
185 | | - $wgOut->addScriptFile( "$smwgScriptPath/libs/jquery-ui/jquery-ui.dialog.min.js" ); |
186 | | - $wgOut->addStyle( "$smwgScriptPath/skins/SMW_custom.css" ); |
187 | | - $javascriptText = <<<EOT |
| 148 | + $result .= ' | <a name="show-embed-code" id="show-embed-code" href="##" rel="nofollow">' . |
| 149 | + wfMsg( 'smw_ask_show_embed' ) . |
| 150 | + '</a>'; |
| 151 | + $result .= '<div id="embed-code-dialog">' . $this->getAskEmbedBox() . '</div>'; |
| 152 | + $this->enableJQueryUI(); |
| 153 | + $wgOut->addScriptFile( "$smwgScriptPath/libs/jquery-ui/jquery-ui.dialog.min.js" ); |
| 154 | + $wgOut->addStyle( "$smwgScriptPath/skins/SMW_custom.css" ); |
| 155 | + |
| 156 | + $javascriptText = <<<EOT |
188 | 157 | <script type="text/javascript"> |
189 | | -jQuery(document).ready(function(){ |
190 | | - jQuery('#embed-code-dialog').dialog({ |
191 | | - autoOpen:false, |
192 | | - modal: true, |
193 | | - buttons:{ |
194 | | - Ok: function(){ |
195 | | - jQuery(this).dialog("close"); |
| 158 | + jQuery( document ).ready( function(){ |
| 159 | + jQuery( '#embed-code-dialog' ).dialog( { |
| 160 | + autoOpen:false, |
| 161 | + modal: true, |
| 162 | + buttons: { |
| 163 | + Ok: function(){ |
| 164 | + jQuery( this ).dialog( "close" ); |
| 165 | + } |
196 | 166 | } |
197 | | - } |
198 | | - }); |
199 | | - jQuery('#show-embed-code').bind('click', function(){ |
200 | | - jQuery('#embed-code-dialog').dialog("open"); |
201 | | - }); |
202 | | -}); |
| 167 | + } ); |
| 168 | + jQuery( '#show-embed-code' ).bind( 'click', function(){ |
| 169 | + jQuery( '#embed-code-dialog' ).dialog( "open" ); |
| 170 | + } ); |
| 171 | + } ); |
203 | 172 | </script> |
204 | 173 | EOT; |
205 | 174 | $wgOut->addScript( $javascriptText ); |
206 | 175 | } |
| 176 | + |
207 | 177 | $result .= '<input type="hidden" name="eq" value="no"/>' . |
208 | 178 | "\n</form><br/>"; |
209 | 179 | return $result; |
210 | | - |
211 | 180 | } |
212 | 181 | |
213 | 182 | /** |
— | — | @@ -225,5 +194,63 @@ |
226 | 195 | $this->setUrlArgs( $tmpArray ); |
227 | 196 | return $this->urlArgs; |
228 | 197 | } |
| 198 | + |
| 199 | + /** |
| 200 | + * Creates controls for limit, intro, outro, default and offset |
| 201 | + * |
| 202 | + * @return string |
| 203 | + */ |
| 204 | + protected function getOtherParametersBox() { |
| 205 | + $params = $this->uiCore->getParameters(); |
| 206 | + if ( array_key_exists( 'limit', $params ) ) { |
| 207 | + $limit = $params['limit']; |
| 208 | + } else { |
| 209 | + $limit = ''; |
| 210 | + } |
| 211 | + if ( array_key_exists( 'offset', $params ) ) { |
| 212 | + $offset = $params['offset']; |
| 213 | + } else { |
| 214 | + $offset = ''; |
| 215 | + } |
| 216 | + if ( array_key_exists( 'intro', $params ) ) { |
| 217 | + $intro = $params['intro']; |
| 218 | + } else { |
| 219 | + $intro = ''; |
| 220 | + } |
| 221 | + if ( array_key_exists( 'outro', $params ) ) { |
| 222 | + $outro = $params['outro']; |
| 223 | + } else { |
| 224 | + $outro = ''; |
| 225 | + } |
| 226 | + if ( array_key_exists( 'default', $params ) ) { |
| 227 | + $default = $params['default']; |
| 228 | + } else { |
| 229 | + $default = ''; |
| 230 | + } |
| 231 | + $result = '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n" . |
| 232 | + Html::rawElement( 'div', |
| 233 | + array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
| 234 | + wfMsg( 'smw_qc_intro' ) . |
| 235 | + '<input name="p[intro]" value="' . $intro . '"size="32"/> <br/>' . |
| 236 | + wfMsg( 'smw_paramdesc_intro' ) |
| 237 | + ) . |
| 238 | + Html::rawElement( 'div', |
| 239 | + array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
| 240 | + wfMsg( 'smw_qc_outro' ) . |
| 241 | + '<input name="p[outro]" value="' . $outro . '" size="32"/> <br/>' . |
| 242 | + wfMsg( 'smw_paramdesc_outro' ) |
| 243 | + ) . |
| 244 | + Html::rawElement( 'div', |
| 245 | + array( 'style' => 'width: 30%; padding: 5px; float: left;' ), |
| 246 | + wfMsg( 'smw_qc_default' ) . |
| 247 | + '<input name="p[default]" value="' . $default . '" size="32"/> <br/>' . |
| 248 | + wfMsg( 'smw_paramdesc_default' ) |
| 249 | + ) . |
| 250 | + Html::hidden( 'p[limit]', $limit ) . |
| 251 | + Html::hidden( 'p[offset]', $offset ) . |
| 252 | + '</fieldset>'; |
| 253 | + |
| 254 | + return $result; |
| 255 | + } |
229 | 256 | } |
230 | 257 | |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -240,6 +240,9 @@ |
241 | 241 | 'smw_qc_show_addnal_opts' => 'Show more options', |
242 | 242 | 'smw_qc_hide_addnal_opts' => 'Show less options', |
243 | 243 | 'smw_qc_otheropt' => 'Other options', |
| 244 | + 'smw_qc_intro' => 'Intro:', |
| 245 | + 'smw_qc_outro' => 'Outro:', |
| 246 | + 'smw_qc_default' => 'Default:', |
244 | 247 | 'smw_qc_formatopt' => 'Format options', |
245 | 248 | 'smw_qc_query_help' => 'Enter a query using the form below. Select wiki pages based on |
246 | 249 | Categories (<strong>[[{{ns:category}}:Actor]]</strong>), |