Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | array(), |
69 | 69 | false ); |
70 | 70 | if ( $this->uiCore->getQueryString() != "" ) { |
71 | | - $this->uiCore->execute( $p ); |
| 71 | + $this->uiCore->execute(); |
72 | 72 | } |
73 | 73 | } else { |
74 | 74 | // the user has entered this page from a wiki-page using an infolink, |
— | — | @@ -549,11 +549,12 @@ |
550 | 550 | * @global WebRequest $wgRequest |
551 | 551 | * @global OutputPage $wgOut |
552 | 552 | * @global string $smwgScriptPath |
| 553 | + * @global integer $smwgQPrintoutLimit |
553 | 554 | * @param mixed $enableAutocomplete |
554 | 555 | * @return string |
555 | 556 | */ |
556 | 557 | protected function getPoSortFormBox( $enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
557 | | - global $smwgQSortingSupport, $wgRequest, $wgOut, $smwgScriptPath; |
| 558 | + global $smwgQSortingSupport, $wgRequest, $wgOut, $smwgScriptPath, $smwgQPrintoutLimit; |
558 | 559 | |
559 | 560 | $this->enableJQueryUI(); |
560 | 561 | $wgOut->addScriptFile( "$smwgScriptPath/libs/jquery-ui/jquery-ui.dialog.min.js" ); |
— | — | @@ -928,7 +929,6 @@ |
929 | 930 | // create hidden form elements to be cloned later |
930 | 931 | $hiddenProperty = Html::openElement( 'div', |
931 | 932 | array( 'id' => 'property_starter', |
932 | | - 'class' => 'smwsort', |
933 | 933 | 'style' => 'display:none' ) |
934 | 934 | ) . |
935 | 935 | '<span class="smwquisortlabel">' . |
— | — | @@ -956,7 +956,6 @@ |
957 | 957 | |
958 | 958 | $hiddenCategory = Html::openElement( 'div', |
959 | 959 | array( 'id' => 'category_starter', |
960 | | - 'class' => 'smwsort', |
961 | 960 | 'style' => 'display:none' ) |
962 | 961 | ) . |
963 | 962 | '<span class="smwquisortlabel">' . |
— | — | @@ -975,7 +974,6 @@ |
976 | 975 | |
977 | 976 | $hiddenMainColumn = Html::openElement( 'div', |
978 | 977 | array( 'id' => 'maincol_starter', |
979 | | - 'class' => 'smwsort', |
980 | 978 | 'style' => 'display:none' ) |
981 | 979 | ) . |
982 | 980 | '<span class="smwquisortlabel">' . |
— | — | @@ -1073,6 +1071,7 @@ |
1074 | 1072 | $javascriptText = <<<EOT |
1075 | 1073 | <script type="text/javascript"> |
1076 | 1074 | var num_elements = {$numSortValues}; |
| 1075 | + var smwgQPrintoutLimit={$smwgQPrintoutLimit}; |
1077 | 1076 | EOT; |
1078 | 1077 | // add autocomplete |
1079 | 1078 | if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
— | — | @@ -1165,6 +1164,8 @@ |
1166 | 1165 | // code for handling adding and removing the "sort" inputs |
1167 | 1166 | |
1168 | 1167 | function smw_addPropertyInstance(starter_div_id, main_div_id) { |
| 1168 | + if( jQuery( '.smwsort' ).length > smwgQPrintoutLimit ) return; |
| 1169 | + |
1169 | 1170 | var starter_div = document.getElementById(starter_div_id); |
1170 | 1171 | var main_div = document.getElementById(main_div_id); |
1171 | 1172 | |
— | — | @@ -1174,6 +1175,7 @@ |
1175 | 1176 | new_div.id = div_id; |
1176 | 1177 | new_div.style.display = 'block'; |
1177 | 1178 | jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
| 1179 | + jQuery(new_div).addClass( 'smwsort' ); |
1178 | 1180 | var children = new_div.getElementsByTagName('*'); |
1179 | 1181 | var x; |
1180 | 1182 | for (x = 0; x < children.length; x++) { |
— | — | @@ -1184,7 +1186,7 @@ |
1185 | 1187 | } |
1186 | 1188 | } |
1187 | 1189 | |
1188 | | - //Create 'more' link |
| 1190 | + //Create 'options' link |
1189 | 1191 | var more_button =document.createElement('span'); |
1190 | 1192 | more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makePropDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
1191 | 1193 | more_button.id = 'more'+num_elements; |
— | — | @@ -1201,6 +1203,8 @@ |
1202 | 1204 | } |
1203 | 1205 | |
1204 | 1206 | function smw_addCategoryInstance(starter_div_id, main_div_id) { |
| 1207 | + if( jQuery( '.smwsort' ).length > smwgQPrintoutLimit ) return; |
| 1208 | + |
1205 | 1209 | var starter_div = document.getElementById(starter_div_id); |
1206 | 1210 | var main_div = document.getElementById(main_div_id); |
1207 | 1211 | |
— | — | @@ -1210,6 +1214,7 @@ |
1211 | 1215 | new_div.id = div_id; |
1212 | 1216 | new_div.style.display = 'block'; |
1213 | 1217 | jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
| 1218 | + jQuery(new_div).addClass( 'smwsort' ); |
1214 | 1219 | var children = new_div.getElementsByTagName('*'); |
1215 | 1220 | var x; |
1216 | 1221 | for (x = 0; x < children.length; x++) { |
— | — | @@ -1220,7 +1225,7 @@ |
1221 | 1226 | } |
1222 | 1227 | } |
1223 | 1228 | |
1224 | | - //Create 'more' link |
| 1229 | + //Create 'options' link |
1225 | 1230 | var more_button =document.createElement('span'); |
1226 | 1231 | more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeCatDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
1227 | 1232 | more_button.id = 'more'+num_elements; |
— | — | @@ -1237,12 +1242,15 @@ |
1238 | 1243 | } |
1239 | 1244 | var smw_mainLabelHidden=true; |
1240 | 1245 | function smw_addMainColInstance(starter_div_id, main_div_id) { |
1241 | | - if(smw_mainLabelHidden && jQuery('#smwposortbox').find('.smw-remove').length==1){ |
| 1246 | + if(smw_mainLabelHidden && jQuery('.smwsort').length==1){ |
1242 | 1247 | jQuery('#mainlabelhid').attr('value',''); |
1243 | 1248 | jQuery('#mainlabelvis').attr('value',''); |
1244 | 1249 | jQuery('#smwmainlabel').show(); |
1245 | 1250 | smw_mainLabelHidden=false; |
1246 | 1251 | } else { |
| 1252 | + if( jQuery( '.smwsort' ).length > smwgQPrintoutLimit ){ |
| 1253 | + return; |
| 1254 | + } |
1247 | 1255 | var starter_div = document.getElementById(starter_div_id); |
1248 | 1256 | var main_div = document.getElementById(main_div_id); |
1249 | 1257 | |
— | — | @@ -1252,6 +1260,7 @@ |
1253 | 1261 | new_div.id = div_id; |
1254 | 1262 | new_div.style.display = 'block'; |
1255 | 1263 | jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
| 1264 | + jQuery(new_div).addClass( 'smwsort' ); |
1256 | 1265 | var children = new_div.getElementsByTagName('*'); |
1257 | 1266 | var x; |
1258 | 1267 | for (x = 0; x < children.length; x++) { |
— | — | @@ -2279,6 +2288,28 @@ |
2280 | 2289 | } |
2281 | 2290 | } |
2282 | 2291 | // END: Try to be smart for rss/ical if no description/title is given and we have a concept query |
| 2292 | + |
| 2293 | + /* |
| 2294 | + * If parameters have been passed in the infolink-style and the |
| 2295 | + * mimie-type of format is defined, generate the export, instead of |
| 2296 | + * showing more html. |
| 2297 | + */ |
| 2298 | + $printer = SMWQueryProcessor::getResultPrinter( |
| 2299 | + $this->parameters['format'], |
| 2300 | + SMWQueryProcessor::SPECIAL_PAGE |
| 2301 | + ); |
| 2302 | + $resultMime = $printer->getMimeType( $res ); |
| 2303 | + if ( $this->context == self::WIKI_LINK && $resultMime != false ) { |
| 2304 | + global $wgOut; |
| 2305 | + $result = $printer->getResult( $res, $this->parameters, SMW_OUTPUT_FILE ); |
| 2306 | + $resultName = $printer->getFileName( $res ); |
| 2307 | + $wgOut->disable(); |
| 2308 | + header( "Content-type: $resultMime; charset=UTF-8" ); |
| 2309 | + if ( $resultName !== false ) { |
| 2310 | + header( "content-disposition: attachment; filename=$resultName" ); |
| 2311 | + } |
| 2312 | + echo $result; |
| 2313 | + } |
2283 | 2314 | } |
2284 | 2315 | } |
2285 | 2316 | |