Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -127,10 +127,23 @@ |
128 | 128 | protected function getAskEmbedBox() { |
129 | 129 | $result = ''; |
130 | 130 | if ( $this->uiCore->getQueryString() != "" ) { |
131 | | - $result = Html::rawElement( 'div', array( 'id' => 'inlinequeryembed' ), |
132 | | - Html::rawElement( 'div', array( 'id' => 'inlinequeryembedinstruct' ), wfMsg( 'smw_ask_embed_instr' ) ) . |
133 | | - Html::element( 'textarea', array( 'id' => 'inlinequeryembedarea', 'readonly' => 'yes', 'cols' => '20', 'rows' => '6', 'onclick' => 'this.select()' ), |
134 | | - $this->uiCore->getAsk() ) ); |
| 131 | + $result = Html::rawElement( |
| 132 | + 'div', |
| 133 | + array( 'id' => 'inlinequeryembed' ), |
| 134 | + Html::rawElement( |
| 135 | + 'div', |
| 136 | + array( 'id' => 'inlinequeryembedinstruct' ), |
| 137 | + wfMsg( 'smw_ask_embed_instr' ) |
| 138 | + ) . |
| 139 | + Html::element( 'textarea', |
| 140 | + array( 'id' => 'inlinequeryembedarea', |
| 141 | + 'readonly' => 'yes', |
| 142 | + 'cols' => '20', |
| 143 | + 'rows' => '6', |
| 144 | + 'onclick' => 'this.select()' |
| 145 | + ), |
| 146 | + $this->uiCore->getAsk() ) |
| 147 | + ); |
135 | 148 | } |
136 | 149 | return $result; |
137 | 150 | } |
— | — | @@ -206,46 +219,47 @@ |
207 | 220 | $this->enableJQueryUI(); |
208 | 221 | $javascriptAutocompleteText = <<<END |
209 | 222 | <script type="text/javascript"> |
210 | | -function smw_split(val) { |
211 | | - return val.split('\\n'); |
212 | | -} |
213 | | -function smw_extractLast(term) { |
214 | | - return smw_split(term).pop(); |
215 | | -} |
216 | | -function smw_escapeQuestion(term){ |
217 | | - if (term.substring(0, 1) == "?") { |
218 | | - return term.substring(1); |
219 | | - } else { |
220 | | - return term; |
| 223 | + function smw_split( val ) { |
| 224 | + return val.split( '\\n' ); |
221 | 225 | } |
222 | | -} |
223 | 226 | |
224 | | -jQuery.noConflict(); |
225 | | -/* extending jQuery functions for custom highligting */ |
226 | | -jQuery.ui.autocomplete.prototype._renderItem = function( ul, item) { |
227 | | - var term_without_q = smw_escapeQuestion(smw_extractLast(this.term)); |
228 | | - var re = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term_without_q.replace("/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi", "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"); |
229 | | - var loc = item.label.search(re); |
230 | | - if (loc >= 0) { |
231 | | - var t = item.label.substr(0, loc) + '<strong>' + item.label.substr(loc, term_without_q.length) + '</strong>' + item.label.substr(loc + term_without_q.length); |
232 | | - } else { |
233 | | - var t = item.label; |
| 227 | + function smw_extractLast( term ) { |
| 228 | + return smw_split( term ).pop(); |
234 | 229 | } |
235 | | - jQuery( "<li></li>" ) |
236 | | - .data( "item.autocomplete", item ) |
237 | | - .append( " <a>" + t + "</a>" ) |
238 | | - .appendTo( ul ); |
239 | | -}; |
240 | 230 | |
| 231 | + function smw_escapeQuestion( term ){ |
| 232 | + if ( term.substring( 0, 1 ) == "?" ) { |
| 233 | + return term.substring( 1 ); |
| 234 | + } else { |
| 235 | + return term; |
| 236 | + } |
| 237 | + } |
| 238 | + |
| 239 | +/* extending jQuery functions for custom highligting */ |
| 240 | + jQuery.ui.autocomplete.prototype._renderItem = function( ul, item ) { |
| 241 | + var term_without_q = smw_escapeQuestion( smw_extractLast( this.term ) ); |
| 242 | + var re = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term_without_q.replace("/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi", "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"); |
| 243 | + var loc = item.label.search( re ); |
| 244 | + if ( loc >= 0 ) { |
| 245 | + var t = item.label.substr( 0, loc ) + '<strong>' + item.label.substr( loc, term_without_q.length ) + '</strong>' + item.label.substr( loc + term_without_q.length ); |
| 246 | + } else { |
| 247 | + var t = item.label; |
| 248 | + } |
| 249 | + jQuery( "<li></li>" ) |
| 250 | + .data( "item.autocomplete", item ) |
| 251 | + .append( " <a>" + t + "</a>" ) |
| 252 | + .appendTo( ul ); |
| 253 | + }; |
| 254 | + |
241 | 255 | ///* extending jquery functions for custom autocomplete matching */ |
242 | | -jQuery.extend( jQuery.ui.autocomplete, { |
243 | | - filter: function(array, term) { |
244 | | - var matcher = new RegExp("\\\b" + jQuery.ui.autocomplete.escapeRegex(term), "i" ); |
245 | | - return jQuery.grep( array, function(value) { |
246 | | - return matcher.test( value.label || value.value || value ); |
247 | | - }); |
248 | | - } |
249 | | -}); |
| 256 | + jQuery.extend( jQuery.ui.autocomplete, { |
| 257 | + filter: function( array, term ) { |
| 258 | + var matcher = new RegExp( "\\\b" + jQuery.ui.autocomplete.escapeRegex( term ), "i" ); |
| 259 | + return jQuery.grep( array, function( value ) { |
| 260 | + return matcher.test( value.label || value.value || value ); |
| 261 | + } ); |
| 262 | + } |
| 263 | + } ); |
250 | 264 | </script> |
251 | 265 | END; |
252 | 266 | |
— | — | @@ -273,8 +287,9 @@ |
274 | 288 | global $smwgQMaxInlineLimit, $wgLang; |
275 | 289 | // Prepare navigation bar. |
276 | 290 | if ( $offset > 0 ) { |
277 | | - $this->setUrlArgs( array( 'offset' => max( 0, $offset - $limit ), |
278 | | - 'limit' => $limit ) ); |
| 291 | + $this->setUrlArgs( |
| 292 | + array( 'offset' => max( 0, $offset - $limit ), 'limit' => $limit ) |
| 293 | + ); |
279 | 294 | $navigation = Html::element( |
280 | 295 | 'a', |
281 | 296 | array( |
— | — | @@ -296,8 +311,9 @@ |
297 | 312 | '</b>    '; |
298 | 313 | |
299 | 314 | if ( $hasFurtherResults ) { |
300 | | - $this->setUrlArgs( array( 'offset' => max( 0, $offset + $limit ), |
301 | | - 'limit' => $limit ) ); |
| 315 | + $this->setUrlArgs( |
| 316 | + array( 'offset' => max( 0, $offset + $limit ), 'limit' => $limit ) |
| 317 | + ); |
302 | 318 | $navigation .= Html::element( |
303 | 319 | 'a', |
304 | 320 | array( |
— | — | @@ -354,10 +370,10 @@ |
355 | 371 | protected function getQueryFormBox() { |
356 | 372 | global $wgOut, $smwgScriptPath; |
357 | 373 | $this->setUrlArgs( array( 'q' => $this->uiCore->getQueryString() ) ); |
358 | | - $result = '<div>'; |
359 | | - $result .= Html::element( 'textarea', array( 'name' => 'q', 'id' => 'querybox' ), |
360 | | - $this->uiCore->getQueryString() ); |
361 | | - $result .= '</div>'; |
| 374 | + $result = '<div>' . |
| 375 | + Html::element( 'textarea', array( 'name' => 'q', 'id' => 'querybox' ), |
| 376 | + $this->uiCore->getQueryString() ) . |
| 377 | + '</div>'; |
362 | 378 | $this->enableJQuery(); |
363 | 379 | $wgOut->addScriptFile( "$smwgScriptPath/skins/elastic/jquery.elastic.source.js" ); |
364 | 380 | |
— | — | @@ -366,18 +382,16 @@ |
367 | 383 | * be removed when jQuery 1.4 or above is supported. |
368 | 384 | */ |
369 | 385 | $javascript = <<<EOT |
370 | | -jQuery(document).ready(function(){ |
371 | | - if(jQuery.browser.msie){ |
372 | | - jQuery('#querybox').attr('rows',5); |
373 | | - } else { |
374 | | - jQuery('#querybox').elastic(); |
375 | | - jQuery('#querybox').trigger('update'); |
376 | | - } |
377 | | -}); |
| 386 | + jQuery( document ).ready( function(){ |
| 387 | + if( jQuery.browser.msie ){ |
| 388 | + jQuery( '#querybox' ).attr( 'rows',5 ); |
| 389 | + } else { |
| 390 | + jQuery( '#querybox' ).elastic(); |
| 391 | + jQuery( '#querybox' ).trigger( 'update' ); |
| 392 | + } |
| 393 | + } ); |
378 | 394 | EOT; |
379 | 395 | $wgOut->addInlineScript( $javascript ); |
380 | | - |
381 | | - // TODO:enable/disable on checking for errors; perhaps show error messages right below the box |
382 | 396 | return $result; |
383 | 397 | } |
384 | 398 | |
— | — | @@ -423,7 +437,9 @@ |
424 | 438 | $categoryYesValues = $wgRequest->getArray( 'cat_yes' ); |
425 | 439 | $categoryNoValues = $wgRequest->getArray( 'cat_no' ); |
426 | 440 | $mainColumnLabels = $wgRequest->getArray( 'maincol_label' ); |
| 441 | + |
427 | 442 | $po = array(); |
| 443 | + |
428 | 444 | $mainLabel = $wgRequest->getVal( 'pmainlabel', '' ); |
429 | 445 | $params['mainlabel'] = $mainLabel; |
430 | 446 | |
— | — | @@ -445,12 +461,14 @@ |
446 | 462 | $po[$key] = "?$categoryNamespace" ; |
447 | 463 | } else { |
448 | 464 | $po[$key] = "?$categoryNamespace:$value"; |
449 | | - if ( is_array( $categoryYesValues ) && |
450 | | - is_array( $categoryNoValues ) && |
451 | | - array_key_exists( $key, $categoryYesValues ) && |
452 | | - array_key_exists( $key, $categoryNoValues ) ) { |
453 | | - |
454 | | - if ( $categoryYesValues[$key] !== '' && $categoryNoValues[$key] !== '' ) { |
| 465 | + if ( is_array( $categoryYesValues ) |
| 466 | + && is_array( $categoryNoValues ) |
| 467 | + && array_key_exists( $key, $categoryYesValues ) |
| 468 | + && array_key_exists( $key, $categoryNoValues ) ) |
| 469 | + { |
| 470 | + if ( $categoryYesValues[$key] !== '' |
| 471 | + && $categoryNoValues[$key] !== '' ) |
| 472 | + { |
455 | 473 | $po[$key] .= "#$categoryYesValues[$key],$categoryNoValues[$key]"; |
456 | 474 | } |
457 | 475 | } |
— | — | @@ -469,7 +487,11 @@ |
470 | 488 | $params['sort'] = ''; |
471 | 489 | $params['order'] = ''; |
472 | 490 | foreach ( $propertyValues as $key => $propertyValue ) { |
473 | | - if ( $smwgQSortingSupport && is_array( $orderValues ) && array_key_exists( $key, $orderValues ) && $orderValues[$key] != 'NONE' ) { |
| 491 | + if ( $smwgQSortingSupport |
| 492 | + && is_array( $orderValues ) |
| 493 | + && array_key_exists( $key, $orderValues ) |
| 494 | + && $orderValues[$key] != 'NONE' ) |
| 495 | + { |
474 | 496 | $params['sort'] .= ( $params['sort'] != '' ? ',':'' ) . $propertyValues[$key]; |
475 | 497 | $params['order'] .= ( $params['order'] != '' ? ',':'' ) . $orderValues[$key]; |
476 | 498 | } |
— | — | @@ -484,20 +506,23 @@ |
485 | 507 | if ( is_array( $displayValues ) ) { |
486 | 508 | foreach ( $displayValues as $key => $value ) { |
487 | 509 | if ( $value == '1' && array_key_exists( $key, $propertyValues ) ) { |
488 | | - $propertyValues[$key] = '?' . trim( $propertyValues[$key] ); // adding leading ? |
489 | | - if ( is_array( $propertyFormatValues ) && // adding PO format |
490 | | - array_key_exists( $key, $propertyFormatValues ) && |
491 | | - $propertyFormatValues[$key] != '' ) { |
| 510 | + $propertyValues[$key] = '?' . trim( $propertyValues[$key] ); // adding leading '?' |
| 511 | + if ( is_array( $propertyFormatValues ) // adding PO format |
| 512 | + && array_key_exists( $key, $propertyFormatValues ) |
| 513 | + && $propertyFormatValues[$key] != '' ) |
| 514 | + { |
492 | 515 | $propertyValues[$key] .= '#' . $propertyFormatValues[$key]; |
493 | 516 | } |
494 | | - if ( is_array( $propertyLabelValues ) && |
495 | | - array_key_exists( $key, $propertyLabelValues ) && |
496 | | - $propertyLabelValues[$key] != '' ) { // adding label |
| 517 | + if ( is_array( $propertyLabelValues ) // adding label |
| 518 | + && array_key_exists( $key, $propertyLabelValues ) |
| 519 | + && $propertyLabelValues[$key] != '' ) |
| 520 | + { |
497 | 521 | $propertyValues[$key] .= ' = ' . $propertyLabelValues[$key]; |
498 | 522 | } |
499 | | - if ( is_array( $propertyLimitValues ) && // adding limit |
500 | | - array_key_exists( $key, $propertyLimitValues ) && |
501 | | - $propertyLimitValues[$key] != '' ) { |
| 523 | + if ( is_array( $propertyLimitValues ) // adding limit |
| 524 | + && array_key_exists( $key, $propertyLimitValues ) |
| 525 | + && $propertyLimitValues[$key] != '' ) |
| 526 | + { |
502 | 527 | // / @bug limit, when specified causes incorrect ordering of printouts |
503 | 528 | $po[] = $propertyValues[$key]; |
504 | 529 | $po[] = '+limit=' . $propertyLimitValues[$key]; |
— | — | @@ -513,7 +538,6 @@ |
514 | 539 | $po = array_merge( $params, $po ); |
515 | 540 | } |
516 | 541 | return $po; |
517 | | - |
518 | 542 | } |
519 | 543 | |
520 | 544 | /** |
— | — | @@ -552,18 +576,26 @@ |
553 | 577 | $mainLabelText = $mainLabel; |
554 | 578 | $formDisplay = 'block'; |
555 | 579 | } |
556 | | - $result .= Html::openElement( 'div', array( 'id' => 'smwmainlabel', 'class' => 'smwsort', 'style' => "display:$formDisplay;" ) ) . |
557 | | - Html::openElement( 'span', array( 'class' => 'smwquisortlabel' ) ) . |
558 | | - Html::openElement( 'span', array( 'class' => 'smw-remove' ) ) . |
559 | | - Html::openElement( 'a', array( 'href' => 'javascript:smwRemoveMainLabel()' ) ) . |
560 | | - '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
561 | | - '</a>' . |
562 | | - '</span>' . |
563 | | - wfMsg( 'smw_qui_rescol' ) . |
564 | | - '</span>' . |
565 | | - '<input size="25" value="' . $mainLabelText . '" id="mainlabelvis" />' . |
566 | | - '<input type="hidden" name="pmainlabel" value="' . $mainLabel . '" id="mainlabelhid" />' . |
567 | | - '</div>'; |
| 580 | + $result .= Html::openElement( |
| 581 | + 'div', |
| 582 | + array( 'id' => 'smwmainlabel', |
| 583 | + 'class' => 'smwsort', |
| 584 | + 'style' => "display:$formDisplay;" ) |
| 585 | + ) . |
| 586 | + Html::openElement( 'span', |
| 587 | + array( 'class' => 'smwquisortlabel' ) ) . |
| 588 | + Html::openElement( 'span', |
| 589 | + array( 'class' => 'smw-remove' ) ) . |
| 590 | + Html::openElement( 'a', |
| 591 | + array( 'href' => 'javascript:smwRemoveMainLabel()' ) ) . |
| 592 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 593 | + '</a>' . |
| 594 | + '</span>' . |
| 595 | + wfMsg( 'smw_qui_rescol' ) . |
| 596 | + '</span>' . |
| 597 | + '<input size="25" value="' . $mainLabelText . '" id="mainlabelvis" />' . |
| 598 | + '<input type="hidden" name="pmainlabel" value="' . $mainLabel . '" id="mainlabelhid" />' . |
| 599 | + '</div>'; |
568 | 600 | $urlArgs = array(); |
569 | 601 | $urlArgs['pmainlabel'] = $mainLabel; |
570 | 602 | |
— | — | @@ -627,9 +659,15 @@ |
628 | 660 | $searchKey--; |
629 | 661 | } |
630 | 662 | $propertyValues[$counter] = $poValue->getData()->getText(); |
631 | | - $propertyLabelValues[$counter] = ( $poValue->getLabel() == $propertyValues[$counter] ) ? '':$poValue->getLabel(); |
| 663 | + |
| 664 | + $propertyLabelValues[$counter] = |
| 665 | + ( $poValue->getLabel() == $propertyValues[$counter] ) ? '':$poValue->getLabel(); |
| 666 | + |
632 | 667 | $propertyFormatValues[$counter] = $poValue->getOutputFormat(); |
633 | | - $propertyLimitValues[$counter] = $poValue->getParameter( 'limit' ) ? $poValue->getParameter( 'limit' ):''; |
| 668 | + |
| 669 | + $propertyLimitValues[$counter] = |
| 670 | + ( $poValue->getParameter( 'limit' ) ) ? $poValue->getParameter( 'limit' ):''; |
| 671 | + |
634 | 672 | $orderValues[$counter] = $orderVal[0]; |
635 | 673 | $displayValues[$counter] = '1'; |
636 | 674 | $counter++; |
— | — | @@ -637,9 +675,15 @@ |
638 | 676 | array_shift( $sortVal ); |
639 | 677 | } else { |
640 | 678 | $propertyValues[$counter] = $poValue->getData()->getText(); |
641 | | - $propertyLabelValues[$counter] = ( $poValue->getLabel() == $propertyValues[$counter] ) ? '':$poValue->getLabel(); |
| 679 | + |
| 680 | + $propertyLabelValues[$counter] = |
| 681 | + ( $poValue->getLabel() == $propertyValues[$counter] ) ? '':$poValue->getLabel(); |
| 682 | + |
642 | 683 | $propertyFormatValues[$counter] = $poValue->getOutputFormat(); |
643 | | - $propertyLimitValues[$counter] = $poValue->getParameter( 'limit' ) ? $poValue->getParameter( 'limit' ):''; |
| 684 | + |
| 685 | + $propertyLimitValues[$counter] = |
| 686 | + ( $poValue->getParameter( 'limit' ) ) ? $poValue->getParameter( 'limit' ):''; |
| 687 | + |
644 | 688 | $displayValues[$counter] = '1'; |
645 | 689 | $counter++; |
646 | 690 | } |
— | — | @@ -674,18 +718,21 @@ |
675 | 719 | |
676 | 720 | $keys = array_keys( $propertyValues ); |
677 | 721 | foreach ( $keys as $value ) { |
678 | | - $additionalPOs[$value] = $propertyValues[$value]; // array_merge won't work because numeric keys need to be preserved |
| 722 | + $additionalPOs[$value] = $propertyValues[$value]; |
| 723 | + // array_merge won't work because numeric keys need to be preserved |
679 | 724 | } |
680 | 725 | |
681 | 726 | |
682 | 727 | $keys = array_keys( $categoryValues ); |
683 | 728 | foreach ( $keys as $value ) { |
684 | | - $additionalPOs[$value] = $categoryValues[$value]; // array_merge won't work because numeric keys need to be preserved |
| 729 | + $additionalPOs[$value] = $categoryValues[$value]; |
| 730 | + // array_merge won't work because numeric keys need to be preserved |
685 | 731 | } |
686 | 732 | |
687 | 733 | $keys = array_keys( $mainColumnLabels ); |
688 | 734 | foreach ( $keys as $value ) { |
689 | | - $additionalPOs[$value] = $mainColumnLabels[$value]; // array_merge won't work because numeric keys need to be preserved |
| 735 | + $additionalPOs[$value] = $mainColumnLabels[$value]; |
| 736 | + // array_merge won't work because numeric keys need to be preserved |
690 | 737 | } |
691 | 738 | |
692 | 739 | ksort( $additionalPOs ); |
— | — | @@ -694,13 +741,32 @@ |
695 | 742 | /* |
696 | 743 | * Make an element for additional properties |
697 | 744 | */ |
698 | | - $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) ); |
699 | | - $result .= '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>'; |
| 745 | + $result .= Html::openElement( |
| 746 | + 'div', |
| 747 | + array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) |
| 748 | + ); |
| 749 | + |
| 750 | + $result .= '<span class="smwquisortlabel">' . |
| 751 | + '<span class="smw-remove">' . |
| 752 | + '<a href="javascript:removePOInstance(\'sort_div_' . $i . '\')">' . |
| 753 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png"' . |
| 754 | + 'alt="' . wfMsg( 'smw_qui_delete' ) . |
| 755 | + '">' . |
| 756 | + '</a></span>'; |
700 | 757 | $result .= wfMsg( 'smw_qui_property' ) . '</span>'; |
701 | | - $result .= Html::input( 'property[' . $i . ']', $propertyValues[$key], 'text', array( 'size' => '25', 'id' => "property$i" ) ) . "\n"; |
| 758 | + |
| 759 | + $result .= Html::input( 'property[' . $i . ']', |
| 760 | + $propertyValues[$key], |
| 761 | + 'text', |
| 762 | + array( 'size' => '25', 'id' => "property$i" ) ) . |
| 763 | + "\n"; |
| 764 | + |
702 | 765 | $urlArgs["property[$i]"] = $propertyValues[$key]; |
703 | 766 | if ( $smwgQSortingSupport ) { |
704 | | - $result .= Html::openElement( 'select', array( 'name' => "order[$i]" ) ); |
| 767 | + $result .= Html::openElement( |
| 768 | + 'select', |
| 769 | + array( 'name' => "order[$i]" ) |
| 770 | + ); |
705 | 771 | if ( array_key_exists( $key, $orderValues ) ) { |
706 | 772 | $urlArgs["order[$i]"] = $orderValues[$key]; |
707 | 773 | } |
— | — | @@ -717,48 +783,111 @@ |
718 | 784 | |
719 | 785 | $if4 = ( array_key_exists( $key, $displayValues ) ); |
720 | 786 | $result .= Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display[$i]", "display$i", $if4 ); |
721 | | - if ( $if4 ) $urlArgs["display[$i]"] = '1'; |
| 787 | + if ( $if4 ) { |
| 788 | + $urlArgs["display[$i]"] = '1'; |
| 789 | + } |
722 | 790 | } |
723 | 791 | if ( array_key_exists( $key, $propertyLabelValues ) ) { |
724 | | - $result .= Html::hidden( "prop_label[$i]", $propertyLabelValues[$key], array( 'id' => "prop_label$i" ) ); |
| 792 | + $result .= Html::hidden( |
| 793 | + "prop_label[$i]", |
| 794 | + $propertyLabelValues[$key], |
| 795 | + array( 'id' => "prop_label$i" ) |
| 796 | + ); |
725 | 797 | $urlArgs["prop_label[$i]"] = $propertyLabelValues[$key]; |
726 | 798 | } else { |
727 | | - $result .= Html::hidden( "prop_label[$i]", '', array( 'id' => "prop_label$i" ) ); |
| 799 | + $result .= Html::hidden( "prop_label[$i]", |
| 800 | + '', |
| 801 | + array( 'id' => "prop_label$i" ) |
| 802 | + ); |
728 | 803 | } |
729 | 804 | if ( array_key_exists( $key, $propertyFormatValues ) ) { |
730 | | - $result .= Html::hidden( "prop_format[$i]", $propertyFormatValues[$key], array( 'id' => "prop_format$i" ) ); |
| 805 | + $result .= Html::hidden( "prop_format[$i]", |
| 806 | + $propertyFormatValues[$key], |
| 807 | + array( 'id' => "prop_format$i" ) |
| 808 | + ); |
731 | 809 | $urlArgs["prop_format[$i]"] = $propertyFormatValues[$key]; |
732 | 810 | } else { |
733 | | - $result .= Html::hidden( "prop_format[$i]", '', array( 'id' => "prop_format$i" ) ); |
| 811 | + $result .= Html::hidden( "prop_format[$i]", |
| 812 | + '', |
| 813 | + array( 'id' => "prop_format$i" ) |
| 814 | + ); |
734 | 815 | } |
735 | 816 | if ( array_key_exists( $key, $propertyLimitValues ) ) { |
736 | | - $result .= Html::hidden( "prop_limit[$i]", $propertyLimitValues[$key], array( 'id' => "prop_limit$i" ) ); |
| 817 | + $result .= Html::hidden( "prop_limit[$i]", |
| 818 | + $propertyLimitValues[$key], |
| 819 | + array( 'id' => "prop_limit$i" ) |
| 820 | + ); |
737 | 821 | $urlArgs["prop_limit[$i]"] = $propertyLimitValues[$key]; |
738 | 822 | } else { |
739 | | - $result .= Html::hidden( "prop_limit[$i]", '', array( 'id' => "prop_limit$i" ) ); |
| 823 | + $result .= Html::hidden( "prop_limit[$i]", |
| 824 | + '', |
| 825 | + array( 'id' => "prop_limit$i" ) |
| 826 | + ); |
740 | 827 | } |
741 | | - $result .= ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> '; |
| 828 | + $result .= Html::element( 'a', |
| 829 | + array( 'id' => "more$i", |
| 830 | + 'class' => 'smwq-more', |
| 831 | + 'href' => "javascript:smw_makePropDialog('$i')" |
| 832 | + ), |
| 833 | + WfMsg( 'smw_qui_options' ) |
| 834 | + ); |
742 | 835 | |
743 | 836 | $result .= Xml::closeElement( 'div' ); |
744 | 837 | $i++; |
745 | 838 | } |
746 | 839 | if ( array_key_exists( $key, $categoryValues ) ) { |
747 | | - if ( !array_key_exists( $key, $categoryLabelValues ) ) $categoryLabelValues[$key] = ''; |
748 | | - if ( !array_key_exists( $key, $categoryYesValues ) ) $categoryYesValues[$key] = ''; |
749 | | - if ( !array_key_exists( $key, $categoryNoValues ) ) $categoryNoValues[$key] = ''; |
| 840 | + if ( !array_key_exists( $key, $categoryLabelValues ) ) { |
| 841 | + $categoryLabelValues[$key] = ''; |
| 842 | + } |
| 843 | + if ( !array_key_exists( $key, $categoryYesValues ) ) { |
| 844 | + $categoryYesValues[$key] = ''; |
| 845 | + } |
| 846 | + if ( !array_key_exists( $key, $categoryNoValues ) ) { |
| 847 | + $categoryNoValues[$key] = ''; |
| 848 | + } |
750 | 849 | /* |
751 | 850 | * Make an element for additional categories |
752 | 851 | */ |
753 | | - $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) ); |
754 | | - $result .= '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
755 | | - wfMsg( 'smw_qui_category' ) . '</span>' . |
756 | | - Xml::input( "category[$i]", '25', $categoryValues[$key], array( 'id' => "category$i" ) ) . " " . |
757 | | - Html::hidden( "cat_label[$i]", $categoryLabelValues[$key], array( 'id' => "cat_label$i" ) ) . |
758 | | - Html::hidden( "cat_yes[$i]", $categoryYesValues[$key], array( 'id' => "cat_yes$i" ) ) . |
759 | | - Html::hidden( "cat_no[$i]", $categoryNoValues[$key], array( 'id' => "cat_no$i" ) ) . |
760 | | - ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makeCatDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> ' . |
761 | | - Xml::closeElement( 'div' ); |
762 | | - $urlArgs["category[$i]"] = ( $categoryValues[$key] == '' ) ? ' ':$categoryValues[$key]; |
| 852 | + $result .= Html::openElement( 'div', |
| 853 | + array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) |
| 854 | + ); |
| 855 | + $result .= '<span class="smwquisortlabel">' . |
| 856 | + '<span class="smw-remove">' . |
| 857 | + Html::openElement( 'a', |
| 858 | + array( 'href' => "javascript:removePOInstance('sort_div_$i')" ) |
| 859 | + ) . |
| 860 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 861 | + '</a>' . |
| 862 | + '</span>' . |
| 863 | + wfMsg( 'smw_qui_category' ) . |
| 864 | + '</span>' . |
| 865 | + Xml::input( "category[$i]", |
| 866 | + '25', |
| 867 | + $categoryValues[$key], |
| 868 | + array( 'id' => "category$i" ) |
| 869 | + ) . " " . |
| 870 | + Html::hidden( "cat_label[$i]", |
| 871 | + $categoryLabelValues[$key], |
| 872 | + array( 'id' => "cat_label$i" ) |
| 873 | + ) . |
| 874 | + Html::hidden( "cat_yes[$i]", |
| 875 | + $categoryYesValues[$key], |
| 876 | + array( 'id' => "cat_yes$i" ) |
| 877 | + ) . |
| 878 | + Html::hidden( "cat_no[$i]", |
| 879 | + $categoryNoValues[$key], |
| 880 | + array( 'id' => "cat_no$i" ) |
| 881 | + ) . |
| 882 | + Html::element( 'a', |
| 883 | + array( 'id' => "more$i", |
| 884 | + 'class' => 'smwq-more', |
| 885 | + 'href' => "javascript:smw_makeCatDialog('$i')" ), |
| 886 | + WfMsg( 'smw_qui_options' ) |
| 887 | + ) . |
| 888 | + Xml::closeElement( 'div' ); |
| 889 | + $urlArgs["category[$i]"] = |
| 890 | + ( $categoryValues[$key] == '' ) ? ' ':$categoryValues[$key]; |
| 891 | + |
763 | 892 | $urlArgs["cat_label[$i]"] = $categoryLabelValues[$key]; |
764 | 893 | $urlArgs["cat_yes[$i]"] = $categoryYesValues[$key]; |
765 | 894 | $urlArgs["cat_no[$i]"] = $categoryNoValues[$key]; |
— | — | @@ -768,12 +897,27 @@ |
769 | 898 | /* |
770 | 899 | * Make an element for main column |
771 | 900 | */ |
772 | | - $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) ) . |
773 | | - '<span class="smwquisortlabel"><span class="smw-remove"><a href="javascript:removePOInstance(\'sort_div_' . $i . '\')"><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
774 | | - wfMsg( 'smw_qui_rescol' ) . '</span>' . |
775 | | - Xml::input( "maincol_label[$i]", '25', $mainColumnLabels[$key], array ( 'id' => "maincol_label$i" ) ) . " " . |
776 | | - Xml::closeElement( 'div' ); |
777 | | - $urlArgs["maincol_label[$i]"] = ( $mainColumnLabels[$key] == '' ) ? ' ':$mainColumnLabels[$key]; |
| 901 | + $result .= Html::openElement( 'div', |
| 902 | + array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) |
| 903 | + ) . |
| 904 | + '<span class="smwquisortlabel">' . |
| 905 | + '<span class="smw-remove">' . |
| 906 | + Html::openelement( 'a', |
| 907 | + array( 'href' => "javascript:removePOInstance('sort_div_$i')" ) |
| 908 | + ) . |
| 909 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 910 | + '</a>' . |
| 911 | + '</span>' . |
| 912 | + wfMsg( 'smw_qui_rescol' ) . |
| 913 | + '</span>' . |
| 914 | + Xml::input( "maincol_label[$i]", |
| 915 | + '25', |
| 916 | + $mainColumnLabels[$key], |
| 917 | + array ( 'id' => "maincol_label$i" ) |
| 918 | + ) . " " . |
| 919 | + '</div>'; |
| 920 | + $urlArgs["maincol_label[$i]"] = |
| 921 | + ( $mainColumnLabels[$key] == '' ) ? ' ':$mainColumnLabels[$key]; |
778 | 922 | $i++; |
779 | 923 | } |
780 | 924 | } |
— | — | @@ -782,69 +926,135 @@ |
783 | 927 | // END: create form elements already submitted earlier via form |
784 | 928 | |
785 | 929 | // create hidden form elements to be cloned later |
786 | | - $hiddenProperty = Html::openElement( 'div', array( 'id' => 'property_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) . |
787 | | - '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
788 | | - wfMsg( 'smw_qui_property' ) . '</span>' . |
789 | | - Xml::input( 'property_num', '25' ) . " " ; |
| 930 | + $hiddenProperty = Html::openElement( 'div', |
| 931 | + array( 'id' => 'property_starter', |
| 932 | + 'class' => 'smwsort', |
| 933 | + 'style' => 'display:none' ) |
| 934 | + ) . |
| 935 | + '<span class="smwquisortlabel">' . |
| 936 | + '<span class="smw-remove">' . |
| 937 | + '<a>' . |
| 938 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 939 | + '</a>' . |
| 940 | + '</span>' . |
| 941 | + wfMsg( 'smw_qui_property' ) . |
| 942 | + '</span>' . |
| 943 | + Xml::input( 'property_num', '25' ) . " " ; |
790 | 944 | if ( $smwgQSortingSupport ) { |
791 | 945 | $hiddenProperty .= Html::openElement( 'select', array( 'name' => 'order_num' ) ) . |
792 | | - Xml::option( wfMsg( 'smw_qui_nosort' ), 'NONE' ) . |
793 | | - Xml::option( wfMsg( 'smw_qui_ascorder' ), 'ASC' ) . |
794 | | - Xml::option( wfMsg( 'smw_qui_descorder' ), 'DESC' ) . |
795 | | - Xml::closeElement( 'select' ) . |
796 | | - Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display_num", '', true ); |
| 946 | + Xml::option( wfMsg( 'smw_qui_nosort' ), 'NONE' ) . |
| 947 | + Xml::option( wfMsg( 'smw_qui_ascorder' ), 'ASC' ) . |
| 948 | + Xml::option( wfMsg( 'smw_qui_descorder' ), 'DESC' ) . |
| 949 | + Xml::closeElement( 'select' ) . |
| 950 | + Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display_num", '', true ); |
797 | 951 | } |
798 | 952 | $hiddenProperty .= Html::hidden( 'prop_label_num', '' ) . |
799 | | - Html::hidden( 'prop_format_num', '' ) . |
800 | | - Html::hidden( 'prop_limit_num', '' ) . |
801 | | - |
802 | | - Xml::closeElement( 'div' ); |
| 953 | + Html::hidden( 'prop_format_num', '' ) . |
| 954 | + Html::hidden( 'prop_limit_num', '' ) . |
| 955 | + Xml::closeElement( 'div' ); |
803 | 956 | $hiddenProperty = json_encode( $hiddenProperty ); |
804 | 957 | |
805 | | - $hiddenCategory = Html::openElement( 'div', array( 'id' => 'category_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) . |
806 | | - '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
807 | | - wfMsg( 'smw_qui_category' ) . '</span>' . |
808 | | - Xml::input( "category_num", '25' ) . " " . |
809 | | - '<input type="hidden" name="cat_label_num" />' . |
810 | | - '<input type="hidden" name="cat_yes_num" />' . |
811 | | - '<input type="hidden" name="cat_no_num" />' . |
812 | | - Xml::closeElement( 'div' ); |
| 958 | + $hiddenCategory = Html::openElement( 'div', |
| 959 | + array( 'id' => 'category_starter', |
| 960 | + 'class' => 'smwsort', |
| 961 | + 'style' => 'display:none' ) |
| 962 | + ) . |
| 963 | + '<span class="smwquisortlabel">' . |
| 964 | + '<span class="smw-remove">' . |
| 965 | + '<a>' . |
| 966 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 967 | + '</a>' . |
| 968 | + '</span>' . |
| 969 | + wfMsg( 'smw_qui_category' ) . '</span>' . |
| 970 | + Xml::input( "category_num", '25' ) . " " . |
| 971 | + '<input type="hidden" name="cat_label_num" />' . |
| 972 | + '<input type="hidden" name="cat_yes_num" />' . |
| 973 | + '<input type="hidden" name="cat_no_num" />' . |
| 974 | + Xml::closeElement( 'div' ); |
813 | 975 | $hiddenCategory = json_encode( $hiddenCategory ); |
814 | 976 | |
815 | | - $hiddenMainColumn = Html::openElement( 'div', array( 'id' => 'maincol_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) . |
816 | | - '<span class="smwquisortlabel">' . '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
817 | | - wfMsg( 'smw_qui_rescol' ) . '</span>' . |
818 | | - Xml::input( "maincol_label_num", '25' ) . " " . |
819 | | - Xml::closeElement( 'div' ); |
| 977 | + $hiddenMainColumn = Html::openElement( 'div', |
| 978 | + array( 'id' => 'maincol_starter', |
| 979 | + 'class' => 'smwsort', |
| 980 | + 'style' => 'display:none' ) |
| 981 | + ) . |
| 982 | + '<span class="smwquisortlabel">' . |
| 983 | + '<span class="smw-remove">' . |
| 984 | + '<a>' . |
| 985 | + '<img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '">' . |
| 986 | + '</a>' . |
| 987 | + '</span>' . |
| 988 | + wfMsg( 'smw_qui_rescol' ) . '</span>' . |
| 989 | + Xml::input( "maincol_label_num", '25' ) . " " . |
| 990 | + Xml::closeElement( 'div' ); |
820 | 991 | $hiddenMainColumn = json_encode( $hiddenMainColumn ); |
821 | 992 | |
822 | 993 | // create dialogbox for Property options |
823 | | - $propertyHtml = Xml::inputLabelSep( 'Property:', '', 'd-property', 'd-property' ); // todo i18n |
824 | | - $propertyLabelHtml = Xml::inputLabelSep( 'Label:', '', 'd-prop-label', 'd-prop-label' );// todo i18n |
825 | | - $propertyFormatHtml = Xml::inputLabelSep( 'Format:', '', 'd-prop-format', 'd-prop-format' );// todo i18n |
826 | | - $propertyLimitHtml = Xml::inputLabelSep( 'Limit:', 'd-prop-limit', 'd-prop-limit' ); // todo i18n |
827 | | - $propertyDialogBox = Xml::openElement( 'div', array( 'id' => 'prop-dialog', 'title' => wfMsg( 'smw_prp_options' ), 'class' => 'smwpropdialog' ) ) . |
828 | | - '<table align="center">' . |
829 | | - '<tr><td>' . $propertyHtml[0] . '</td><td>' . $propertyHtml[1] . '</td></tr>' . |
830 | | - '<tr><td>' . $propertyLabelHtml[0] . '</td><td>' . $propertyLabelHtml[1] . '</td></tr>' . |
831 | | - '<tr><td>' . $propertyLimitHtml[0] . '</td><td>' . $propertyLimitHtml[1] . '</td></tr>' . |
832 | | - '<tr><td>' . $propertyFormatHtml[0] . '</td><td>' . $propertyFormatHtml[1] . '</td></tr>' . |
833 | | - '</table>' . |
834 | | - Xml::closeElement( 'div' ); |
| 994 | + $propertyHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_prop' ), |
| 995 | + '', |
| 996 | + 'd-property', |
| 997 | + 'd-property' |
| 998 | + ); |
| 999 | + $propertyLabelHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_labl' ), |
| 1000 | + '', |
| 1001 | + 'd-prop-label', |
| 1002 | + 'd-prop-label' |
| 1003 | + ); |
| 1004 | + $propertyFormatHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_formt' ), |
| 1005 | + '', |
| 1006 | + 'd-prop-format', |
| 1007 | + 'd-prop-format' |
| 1008 | + ); |
| 1009 | + $propertyLimitHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_limt' ), |
| 1010 | + 'd-prop-limit', |
| 1011 | + 'd-prop-limit' |
| 1012 | + ); |
| 1013 | + $propertyDialogBox = Xml::openElement( |
| 1014 | + 'div', |
| 1015 | + array( 'id' => 'prop-dialog', |
| 1016 | + 'title' => wfMsg( 'smw_prp_options' ), |
| 1017 | + 'class' => 'smwpropdialog' ) |
| 1018 | + ) . |
| 1019 | + '<table align="center">' . |
| 1020 | + '<tr><td>' . $propertyHtml[0] . '</td><td>' . $propertyHtml[1] . '</td></tr>' . |
| 1021 | + '<tr><td>' . $propertyLabelHtml[0] . '</td><td>' . $propertyLabelHtml[1] . '</td></tr>' . |
| 1022 | + '<tr><td>' . $propertyLimitHtml[0] . '</td><td>' . $propertyLimitHtml[1] . '</td></tr>' . |
| 1023 | + '<tr><td>' . $propertyFormatHtml[0] . '</td><td>' . $propertyFormatHtml[1] . '</td></tr>' . |
| 1024 | + '</table>' . |
| 1025 | + Xml::closeElement( 'div' ); |
835 | 1026 | |
836 | 1027 | // create dialogbox for Category options |
837 | | - $categoryHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcategory' ), '', 'd-category', 'd-category' ); |
838 | | - $categoryLabelHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dlabel' ), '', 'd-category-label', 'd-category-label' ); |
839 | | - $categoryYesHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatyes' ), '', 'd-category-yes', 'd-category-yes' ); |
840 | | - $categoryNoHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatno' ), '', 'd-category-no', 'd-category-no' ); |
841 | | - $categoryDialogBox = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => wfMsg( 'smw_qui_catopts' ), 'class' => 'smwcatdialog' ) ) . |
842 | | - '<table align="center">' . |
843 | | - '<tr><td>' . $categoryHtml[0] . '</td><td>' . $categoryHtml[1] . '</td></tr>' . |
844 | | - '<tr><td>' . $categoryLabelHtml[0] . '</td><td>' . $categoryLabelHtml[1] . '</td></tr>' . |
845 | | - '<tr><td>' . $categoryYesHtml[0] . '</td><td>' . $categoryYesHtml[1] . '</td></tr>' . |
846 | | - '<tr><td>' . $categoryNoHtml[0] . '</td><td>' . $categoryNoHtml[1] . '</td></tr>' . |
847 | | - '</table>' . |
848 | | - Xml::closeElement( 'div' ); |
| 1028 | + $categoryHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcategory' ), |
| 1029 | + '', |
| 1030 | + 'd-category', |
| 1031 | + 'd-category' |
| 1032 | + ); |
| 1033 | + $categoryLabelHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dlabel' ), |
| 1034 | + '', |
| 1035 | + 'd-category-label', |
| 1036 | + 'd-category-label' |
| 1037 | + ); |
| 1038 | + $categoryYesHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatyes' ), |
| 1039 | + '', |
| 1040 | + 'd-category-yes', |
| 1041 | + 'd-category-yes' |
| 1042 | + ); |
| 1043 | + $categoryNoHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatno' ), |
| 1044 | + '', |
| 1045 | + 'd-category-no', |
| 1046 | + 'd-category-no' ); |
| 1047 | + $categoryDialogBox = Xml::openElement( 'div', |
| 1048 | + array( 'id' => 'cat-dialog', |
| 1049 | + 'title' => wfMsg( 'smw_qui_catopts' ), |
| 1050 | + 'class' => 'smwcatdialog' ) |
| 1051 | + ) . |
| 1052 | + '<table align="center">' . |
| 1053 | + '<tr><td>' . $categoryHtml[0] . '</td><td>' . $categoryHtml[1] . '</td></tr>' . |
| 1054 | + '<tr><td>' . $categoryLabelHtml[0] . '</td><td>' . $categoryLabelHtml[1] . '</td></tr>' . |
| 1055 | + '<tr><td>' . $categoryYesHtml[0] . '</td><td>' . $categoryYesHtml[1] . '</td></tr>' . |
| 1056 | + '<tr><td>' . $categoryNoHtml[0] . '</td><td>' . $categoryNoHtml[1] . '</td></tr>' . |
| 1057 | + '</table>' . |
| 1058 | + Xml::closeElement( 'div' ); |
849 | 1059 | |
850 | 1060 | $result .= '<div id="sorting_main"></div>' . "\n"; |
851 | 1061 | $result .= '[<a href="javascript:smw_addPropertyInstance(\'property_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addnprop' ) . '</a>]' . |
— | — | @@ -862,175 +1072,135 @@ |
863 | 1073 | $cancelMsg = wfMsg( 'smw_qui_cancel' ); |
864 | 1074 | $javascriptText = <<<EOT |
865 | 1075 | <script type="text/javascript"> |
866 | | -var num_elements = {$numSortValues}; |
| 1076 | + var num_elements = {$numSortValues}; |
867 | 1077 | EOT; |
868 | 1078 | // add autocomplete |
869 | 1079 | if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
870 | 1080 | $javascriptText .= <<<EOT |
871 | 1081 | |
872 | | -function smw_property_autocomplete(){ |
873 | | - jQuery('[name*="property"]').autocomplete({ |
874 | | - minLength: 2, |
875 | | - source: function(request, response) { |
876 | | - url=wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['property']+'&format=jsonfm'; |
| 1082 | + function smw_property_autocomplete(){ |
| 1083 | + jQuery( '[name*="property"]' ).autocomplete( { |
| 1084 | + minLength: 2, |
| 1085 | + source: function( request, response ) { |
| 1086 | + url = wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['property']+'&format=jsonfm'; |
877 | 1087 | |
878 | | - jQuery.getJSON(url, 'search='+request.term, function(data){ |
879 | | - //remove the namespace prefix 'Property:' from returned data |
880 | | - for(i=0;i<data[1].length;i++) data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1); |
881 | | - response(data[1]); |
882 | | - }); |
| 1088 | + jQuery.getJSON( url, 'search='+request.term, function( data ) { |
| 1089 | + //remove the namespace prefix 'Property:' from returned data |
| 1090 | + for( i=0; i < data[1].length; i++ ){ |
| 1091 | + data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1); |
| 1092 | + } |
| 1093 | + response(data[1]); |
| 1094 | + }); |
| 1095 | + } |
| 1096 | + } ); |
| 1097 | + } |
883 | 1098 | |
884 | | - } |
885 | | - }); |
886 | | -} |
| 1099 | + function smwRemoveMainLabel(){ |
| 1100 | + jQuery( '#mainlabelhid' ).attr( 'value', '-' ); |
| 1101 | + jQuery( '#mainlabelvis' ).attr( 'value', '' ); |
| 1102 | + jQuery( '#smwmainlabel' ).hide(); |
| 1103 | + smw_mainLabelHidden = true; |
| 1104 | + } |
887 | 1105 | |
888 | | -function smwRemoveMainLabel(){ |
889 | | - jQuery('#mainlabelhid').attr('value','-'); |
890 | | - jQuery('#mainlabelvis').attr('value',''); |
891 | | - jQuery('#smwmainlabel').hide(); |
892 | | - smw_mainLabelHidden=true; |
893 | | -} |
| 1106 | + function smw_category_autocomplete(){ |
| 1107 | + jQuery( '[name*="category"]' ).autocomplete( { |
| 1108 | + minLength: 2, |
| 1109 | + source: function(request, response) { |
| 1110 | + url = wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['category']+'&format=jsonfm'; |
894 | 1111 | |
895 | | -function smw_category_autocomplete(){ |
896 | | - jQuery('[name*="category"]').autocomplete({ |
897 | | - minLength: 2, |
898 | | - source: function(request, response) { |
899 | | - url=wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['category']+'&format=jsonfm'; |
900 | | - |
901 | | - jQuery.getJSON(url, 'search='+request.term, function(data){ |
902 | | - //remove the namespace prefix 'Category:' from returned data |
903 | | - for(i=0;i<data[1].length;i++) data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1); |
904 | | - response(data[1]); |
905 | | - }); |
906 | | - |
907 | | - } |
908 | | - }); |
909 | | -} |
| 1112 | + jQuery.getJSON( url, 'search='+request.term, function( data ){ |
| 1113 | + //remove the namespace prefix 'Category:' from returned data |
| 1114 | + for( i=0; i<data[1].length; i++ ){ |
| 1115 | + data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1); |
| 1116 | + } |
| 1117 | + response(data[1]); |
| 1118 | + }); |
| 1119 | + } |
| 1120 | + }); |
| 1121 | + } |
910 | 1122 | EOT; |
911 | 1123 | } else { |
912 | 1124 | $javascriptText .= <<<EOT |
913 | | -function smw_property_autocomplete(){ |
914 | | -} |
| 1125 | + function smw_property_autocomplete(){ |
| 1126 | + } |
915 | 1127 | |
916 | | -function smw_category_autocomplete(){ |
917 | | -} |
| 1128 | + function smw_category_autocomplete(){ |
| 1129 | + } |
918 | 1130 | |
919 | 1131 | EOT; |
920 | 1132 | } |
921 | 1133 | |
922 | 1134 | $javascriptText .= <<<EOT |
923 | 1135 | |
924 | | -function smw_makeCatDialog(cat_id){ |
925 | | - jQuery('#prop-cat input').attr('value',''); |
| 1136 | + function smw_makeCatDialog( cat_id ){ |
| 1137 | + jQuery( '#prop-cat input' ).attr('value',''); |
926 | 1138 | |
927 | | - cat=jQuery('#category'+cat_id)[0].value; |
928 | | - label=jQuery('#cat_label'+cat_id)[0].value; |
929 | | - yes = jQuery('#cat_yes'+cat_id)[0].value; |
930 | | - no = jQuery('#cat_no'+cat_id)[0].value; |
| 1139 | + cat=jQuery('#category'+cat_id)[0].value; |
| 1140 | + label=jQuery('#cat_label'+cat_id)[0].value; |
| 1141 | + yes = jQuery('#cat_yes'+cat_id)[0].value; |
| 1142 | + no = jQuery('#cat_no'+cat_id)[0].value; |
931 | 1143 | |
932 | | - jQuery('#d-category-yes').attr('value',yes); |
933 | | - jQuery('#d-category-no').attr('value',no); |
934 | | - jQuery('#d-category-label').attr('value',label); |
935 | | - jQuery('#d-category').attr('value',cat); |
| 1144 | + jQuery('#d-category-yes').attr('value',yes); |
| 1145 | + jQuery('#d-category-no').attr('value',no); |
| 1146 | + jQuery('#d-category-label').attr('value',label); |
| 1147 | + jQuery('#d-category').attr('value',cat); |
936 | 1148 | |
937 | | - jQuery('#cat-dialog').dialog.id=cat_id; |
938 | | - jQuery('#cat-dialog').dialog('open'); |
939 | | -} |
| 1149 | + jQuery('#cat-dialog').dialog.id=cat_id; |
| 1150 | + jQuery('#cat-dialog').dialog('open'); |
| 1151 | + } |
940 | 1152 | |
941 | | -function smw_makePropDialog(prop_id){ |
942 | | - jQuery('#prop-dialog input').attr('value',''); |
943 | | - prop=jQuery('#property'+prop_id).attr('value'); |
944 | | - label=jQuery('#prop_label'+prop_id).attr('value'); |
945 | | - format=jQuery('#prop_format'+prop_id).attr('value'); |
946 | | - limit=jQuery('#prop_limit'+prop_id).attr('value'); |
947 | | - jQuery('#d-property').attr('value', prop); |
948 | | - jQuery('#d-prop-label').attr('value', label); |
949 | | - jQuery('#d-prop-limit').attr('value', limit); |
950 | | - jQuery('#d-prop-format').attr('value', format); |
951 | | - jQuery('#prop-dialog').dialog.id=prop_id; |
952 | | - jQuery('#prop-dialog').dialog('open'); |
953 | | -} |
954 | | -// code for handling adding and removing the "sort" inputs |
| 1153 | + function smw_makePropDialog(prop_id){ |
| 1154 | + jQuery('#prop-dialog input').attr('value',''); |
| 1155 | + prop=jQuery('#property'+prop_id).attr('value'); |
| 1156 | + label=jQuery('#prop_label'+prop_id).attr('value'); |
| 1157 | + format=jQuery('#prop_format'+prop_id).attr('value'); |
| 1158 | + limit=jQuery('#prop_limit'+prop_id).attr('value'); |
| 1159 | + jQuery('#d-property').attr('value', prop); |
| 1160 | + jQuery('#d-prop-label').attr('value', label); |
| 1161 | + jQuery('#d-prop-limit').attr('value', limit); |
| 1162 | + jQuery('#d-prop-format').attr('value', format); |
| 1163 | + jQuery('#prop-dialog').dialog.id=prop_id; |
| 1164 | + jQuery('#prop-dialog').dialog('open'); |
| 1165 | + } |
| 1166 | + // code for handling adding and removing the "sort" inputs |
955 | 1167 | |
956 | | -function smw_addPropertyInstance(starter_div_id, main_div_id) { |
957 | | - var starter_div = document.getElementById(starter_div_id); |
958 | | - var main_div = document.getElementById(main_div_id); |
| 1168 | + function smw_addPropertyInstance(starter_div_id, main_div_id) { |
| 1169 | + var starter_div = document.getElementById(starter_div_id); |
| 1170 | + var main_div = document.getElementById(main_div_id); |
959 | 1171 | |
960 | | - //Create the new instance |
961 | | - var new_div = starter_div.cloneNode(true); |
962 | | - var div_id = 'sort_div_' + num_elements; |
963 | | - new_div.id = div_id; |
964 | | - new_div.style.display = 'block'; |
965 | | - jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
966 | | - var children = new_div.getElementsByTagName('*'); |
967 | | - var x; |
968 | | - for (x = 0; x < children.length; x++) { |
969 | | - if (jQuery(children[x]).attr('for')) jQuery(children[x]).attr('for',"display"+num_elements); |
970 | | - if (children[x].name){ |
971 | | - children[x].id = children[x].name.replace(/_num/, ''+num_elements); |
972 | | - children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']'); |
| 1172 | + //Create the new instance |
| 1173 | + var new_div = starter_div.cloneNode(true); |
| 1174 | + var div_id = 'sort_div_' + num_elements; |
| 1175 | + new_div.id = div_id; |
| 1176 | + new_div.style.display = 'block'; |
| 1177 | + jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
| 1178 | + var children = new_div.getElementsByTagName('*'); |
| 1179 | + var x; |
| 1180 | + for (x = 0; x < children.length; x++) { |
| 1181 | + if (jQuery(children[x]).attr('for')) jQuery(children[x]).attr('for',"display"+num_elements); |
| 1182 | + if (children[x].name){ |
| 1183 | + children[x].id = children[x].name.replace(/_num/, ''+num_elements); |
| 1184 | + children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']'); |
| 1185 | + } |
973 | 1186 | } |
974 | | - } |
975 | 1187 | |
976 | | - //Create 'more' link |
977 | | - var more_button =document.createElement('span'); |
978 | | - more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makePropDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
979 | | - more_button.id = 'more'+num_elements; |
980 | | - new_div.appendChild(more_button); |
| 1188 | + //Create 'more' link |
| 1189 | + var more_button =document.createElement('span'); |
| 1190 | + more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makePropDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
| 1191 | + more_button.id = 'more'+num_elements; |
| 1192 | + new_div.appendChild(more_button); |
981 | 1193 | |
982 | | - //Add the new instance |
983 | | - main_div.appendChild(new_div); |
| 1194 | + //Add the new instance |
| 1195 | + main_div.appendChild(new_div); |
984 | 1196 | |
985 | | - // initialize delete button |
986 | | - st='sort_div_'+num_elements; |
987 | | - jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')"; |
988 | | - num_elements++; |
989 | | - smw_property_autocomplete(); |
990 | | -} |
991 | | - |
992 | | -function smw_addCategoryInstance(starter_div_id, main_div_id) { |
993 | | - var starter_div = document.getElementById(starter_div_id); |
994 | | - var main_div = document.getElementById(main_div_id); |
995 | | - |
996 | | - //Create the new instance |
997 | | - var new_div = starter_div.cloneNode(true); |
998 | | - var div_id = 'sort_div_' + num_elements; |
999 | | - new_div.id = div_id; |
1000 | | - new_div.style.display = 'block'; |
1001 | | - jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
1002 | | - var children = new_div.getElementsByTagName('*'); |
1003 | | - var x; |
1004 | | - for (x = 0; x < children.length; x++) { |
1005 | | - if (jQuery(children[x]).attr('for')) jQuery(children[x]).attr('for',"display"+num_elements); |
1006 | | - if (children[x].name){ |
1007 | | - children[x].id = children[x].name.replace(/_num/, ''+num_elements); |
1008 | | - children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']'); |
1009 | | - } |
| 1197 | + // initialize delete button |
| 1198 | + st='sort_div_'+num_elements; |
| 1199 | + jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')"; |
| 1200 | + num_elements++; |
| 1201 | + smw_property_autocomplete(); |
1010 | 1202 | } |
1011 | 1203 | |
1012 | | - //Create 'more' link |
1013 | | - var more_button =document.createElement('span'); |
1014 | | - more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeCatDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
1015 | | - more_button.id = 'more'+num_elements; |
1016 | | - new_div.appendChild(more_button); |
1017 | | - |
1018 | | - //Add the new instance |
1019 | | - main_div.appendChild(new_div); |
1020 | | - |
1021 | | - // initialize delete button |
1022 | | - st='sort_div_'+num_elements; |
1023 | | - jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')"; |
1024 | | - num_elements++; |
1025 | | - smw_category_autocomplete(); |
1026 | | -} |
1027 | | -var smw_mainLabelHidden=true; |
1028 | | -function smw_addMainColInstance(starter_div_id, main_div_id) { |
1029 | | - if(smw_mainLabelHidden && jQuery('#smwposortbox').find('.smw-remove').length==1){ |
1030 | | - jQuery('#mainlabelhid').attr('value',''); |
1031 | | - jQuery('#mainlabelvis').attr('value',''); |
1032 | | - jQuery('#smwmainlabel').show(); |
1033 | | - smw_mainLabelHidden=false; |
1034 | | - } else { |
| 1204 | + function smw_addCategoryInstance(starter_div_id, main_div_id) { |
1035 | 1205 | var starter_div = document.getElementById(starter_div_id); |
1036 | 1206 | var main_div = document.getElementById(main_div_id); |
1037 | 1207 | |
— | — | @@ -1050,6 +1220,12 @@ |
1051 | 1221 | } |
1052 | 1222 | } |
1053 | 1223 | |
| 1224 | + //Create 'more' link |
| 1225 | + var more_button =document.createElement('span'); |
| 1226 | + more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeCatDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
| 1227 | + more_button.id = 'more'+num_elements; |
| 1228 | + new_div.appendChild(more_button); |
| 1229 | + |
1054 | 1230 | //Add the new instance |
1055 | 1231 | main_div.appendChild(new_div); |
1056 | 1232 | |
— | — | @@ -1057,99 +1233,135 @@ |
1058 | 1234 | st='sort_div_'+num_elements; |
1059 | 1235 | jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')"; |
1060 | 1236 | num_elements++; |
| 1237 | + smw_category_autocomplete(); |
1061 | 1238 | } |
1062 | | -} |
| 1239 | + var smw_mainLabelHidden=true; |
| 1240 | + function smw_addMainColInstance(starter_div_id, main_div_id) { |
| 1241 | + if(smw_mainLabelHidden && jQuery('#smwposortbox').find('.smw-remove').length==1){ |
| 1242 | + jQuery('#mainlabelhid').attr('value',''); |
| 1243 | + jQuery('#mainlabelvis').attr('value',''); |
| 1244 | + jQuery('#smwmainlabel').show(); |
| 1245 | + smw_mainLabelHidden=false; |
| 1246 | + } else { |
| 1247 | + var starter_div = document.getElementById(starter_div_id); |
| 1248 | + var main_div = document.getElementById(main_div_id); |
1063 | 1249 | |
1064 | | -function removePOInstance(div_id) { |
1065 | | - var olddiv = document.getElementById(div_id); |
1066 | | - var parent = olddiv.parentNode; |
1067 | | - parent.removeChild(olddiv); |
1068 | | -} |
| 1250 | + //Create the new instance |
| 1251 | + var new_div = starter_div.cloneNode(true); |
| 1252 | + var div_id = 'sort_div_' + num_elements; |
| 1253 | + new_div.id = div_id; |
| 1254 | + new_div.style.display = 'block'; |
| 1255 | + jQuery(new_div.getElementsByTagName('label')).attr('for', 'display'+num_elements); |
| 1256 | + var children = new_div.getElementsByTagName('*'); |
| 1257 | + var x; |
| 1258 | + for (x = 0; x < children.length; x++) { |
| 1259 | + if (jQuery(children[x]).attr('for')) jQuery(children[x]).attr('for',"display"+num_elements); |
| 1260 | + if (children[x].name){ |
| 1261 | + children[x].id = children[x].name.replace(/_num/, ''+num_elements); |
| 1262 | + children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']'); |
| 1263 | + } |
| 1264 | + } |
1069 | 1265 | |
1070 | | -jQuery(function(){ |
1071 | | - jQuery('$hiddenProperty').appendTo(document.body); |
1072 | | - jQuery('$hiddenCategory').appendTo(document.body); |
1073 | | - jQuery('$hiddenMainColumn').appendTo(document.body); |
1074 | | - jQuery('$propertyDialogBox').appendTo(document.body); |
1075 | | - jQuery('$categoryDialogBox').appendTo(document.body); |
1076 | | - jQuery('#cat-dialog').dialog({ |
1077 | | - autoOpen: false, |
1078 | | - modal: true, |
1079 | | - resizable: true, |
1080 | | - minHeight: 200, |
1081 | | - minWidth: 400, |
1082 | | - buttons: { |
1083 | | - "{$okMsg}": function(){ |
1084 | | - cat = jQuery('#d-category').attr('value'); |
1085 | | - label = jQuery('#d-category-label').attr('value'); |
1086 | | - yes = jQuery('#d-category-yes').attr('value'); |
1087 | | - no = jQuery('#d-category-no').attr('value'); |
1088 | | - id=jQuery(this).dialog.id; |
| 1266 | + //Add the new instance |
| 1267 | + main_div.appendChild(new_div); |
1089 | 1268 | |
1090 | | - jQuery('#category'+id).attr('value',cat); |
1091 | | - jQuery('#cat_label'+id).attr('value',label); |
1092 | | - jQuery('#cat_yes'+id).attr('value',yes); |
1093 | | - jQuery('#cat_no'+id).attr('value',no); |
1094 | | - jQuery(this).dialog("close"); |
1095 | | - }, |
1096 | | - "{$cancelMsg}": function(){ |
1097 | | - jQuery('#cat-dialog input').attr('value',''); |
1098 | | - jQuery(this).dialog("close"); |
1099 | | - } |
| 1269 | + // initialize delete button |
| 1270 | + st='sort_div_'+num_elements; |
| 1271 | + jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')"; |
| 1272 | + num_elements++; |
1100 | 1273 | } |
1101 | | - }); |
| 1274 | + } |
1102 | 1275 | |
1103 | | - jQuery('#prop-dialog').dialog({ |
1104 | | - autoOpen: false, |
1105 | | - modal: true, |
1106 | | - resizable: true, |
1107 | | - minHeight: 200, |
1108 | | - minWidth: 400, |
1109 | | - buttons: { |
1110 | | - "{$okMsg}": function(){ |
1111 | | - id=jQuery(this).dialog.id; |
1112 | | - property=jQuery('#d-property').attr('value'); |
1113 | | - label=jQuery('#d-prop-label').attr('value'); |
1114 | | - limit=jQuery('#d-prop-limit').attr('value'); |
1115 | | - format=jQuery('#d-prop-format').attr('value'); |
| 1276 | + function removePOInstance(div_id) { |
| 1277 | + var olddiv = document.getElementById(div_id); |
| 1278 | + var parent = olddiv.parentNode; |
| 1279 | + parent.removeChild(olddiv); |
| 1280 | + } |
1116 | 1281 | |
| 1282 | + jQuery(function(){ |
| 1283 | + jQuery('$hiddenProperty').appendTo(document.body); |
| 1284 | + jQuery('$hiddenCategory').appendTo(document.body); |
| 1285 | + jQuery('$hiddenMainColumn').appendTo(document.body); |
| 1286 | + jQuery('$propertyDialogBox').appendTo(document.body); |
| 1287 | + jQuery('$categoryDialogBox').appendTo(document.body); |
| 1288 | + jQuery('#cat-dialog').dialog({ |
| 1289 | + autoOpen: false, |
| 1290 | + modal: true, |
| 1291 | + resizable: true, |
| 1292 | + minHeight: 200, |
| 1293 | + minWidth: 400, |
| 1294 | + buttons: { |
| 1295 | + "{$okMsg}": function(){ |
| 1296 | + cat = jQuery('#d-category').attr('value'); |
| 1297 | + label = jQuery('#d-category-label').attr('value'); |
| 1298 | + yes = jQuery('#d-category-yes').attr('value'); |
| 1299 | + no = jQuery('#d-category-no').attr('value'); |
| 1300 | + id=jQuery(this).dialog.id; |
1117 | 1301 | |
1118 | | - jQuery('#property'+id).attr('value',property); |
1119 | | - jQuery('#prop_label'+id).attr('value',label); |
1120 | | - jQuery('#prop_limit'+id).attr('value',limit); |
1121 | | - jQuery('#prop_format'+id).attr('value',format); |
1122 | | - jQuery(this).dialog("close"); |
1123 | | - }, |
1124 | | - "{$cancelMsg}": function(){ |
1125 | | - jQuery('#prop-dialog input').attr('value',''); |
1126 | | - jQuery(this).dialog("close"); |
| 1302 | + jQuery('#category'+id).attr('value',cat); |
| 1303 | + jQuery('#cat_label'+id).attr('value',label); |
| 1304 | + jQuery('#cat_yes'+id).attr('value',yes); |
| 1305 | + jQuery('#cat_no'+id).attr('value',no); |
| 1306 | + jQuery(this).dialog("close"); |
| 1307 | + }, |
| 1308 | + "{$cancelMsg}": function(){ |
| 1309 | + jQuery('#cat-dialog input').attr('value',''); |
| 1310 | + jQuery(this).dialog("close"); |
| 1311 | + } |
1127 | 1312 | } |
1128 | | - } |
| 1313 | + }); |
| 1314 | + |
| 1315 | + jQuery('#prop-dialog').dialog({ |
| 1316 | + autoOpen: false, |
| 1317 | + modal: true, |
| 1318 | + resizable: true, |
| 1319 | + minHeight: 200, |
| 1320 | + minWidth: 400, |
| 1321 | + buttons: { |
| 1322 | + "{$okMsg}": function(){ |
| 1323 | + id=jQuery(this).dialog.id; |
| 1324 | + property=jQuery('#d-property').attr('value'); |
| 1325 | + label=jQuery('#d-prop-label').attr('value'); |
| 1326 | + limit=jQuery('#d-prop-limit').attr('value'); |
| 1327 | + format=jQuery('#d-prop-format').attr('value'); |
| 1328 | + |
| 1329 | + |
| 1330 | + jQuery('#property'+id).attr('value',property); |
| 1331 | + jQuery('#prop_label'+id).attr('value',label); |
| 1332 | + jQuery('#prop_limit'+id).attr('value',limit); |
| 1333 | + jQuery('#prop_format'+id).attr('value',format); |
| 1334 | + jQuery(this).dialog("close"); |
| 1335 | + }, |
| 1336 | + "{$cancelMsg}": function(){ |
| 1337 | + jQuery('#prop-dialog input').attr('value',''); |
| 1338 | + jQuery(this).dialog("close"); |
| 1339 | + } |
| 1340 | + } |
| 1341 | + }); |
| 1342 | + jQuery('#sort-more').click(function(){jQuery('#prop-dialog').dialog("open");}); |
| 1343 | + jQuery('#d-category').bind('change keyup focus click',function(){ |
| 1344 | + if(jQuery(this).attr('value')==''){ |
| 1345 | + jQuery('#d-category-yes').css('visibility','hidden'); |
| 1346 | + jQuery('#d-category-no').css('visibility','hidden'); |
| 1347 | + jQuery('#cat-dialog [for="d-category-no"]').css('visibility','hidden'); |
| 1348 | + jQuery('#cat-dialog [for="d-category-yes"]').css('visibility','hidden'); |
| 1349 | + } else { |
| 1350 | + jQuery('#d-category-yes').css('visibility','visible'); |
| 1351 | + jQuery('#d-category-no').css('visibility','visible'); |
| 1352 | + jQuery('#cat-dialog [for="d-category-no"]').css('visibility','visible'); |
| 1353 | + jQuery('#cat-dialog [for="d-category-yes"]').css('visibility','visible'); |
| 1354 | + } |
| 1355 | + }); |
1129 | 1356 | }); |
1130 | | - jQuery('#sort-more').click(function(){jQuery('#prop-dialog').dialog("open");}); |
1131 | | - jQuery('#d-category').bind('change keyup focus click',function(){ |
1132 | | - if(jQuery(this).attr('value')==''){ |
1133 | | - jQuery('#d-category-yes').css('visibility','hidden'); |
1134 | | - jQuery('#d-category-no').css('visibility','hidden'); |
1135 | | - jQuery('#cat-dialog [for="d-category-no"]').css('visibility','hidden'); |
1136 | | - jQuery('#cat-dialog [for="d-category-yes"]').css('visibility','hidden'); |
1137 | | - } else { |
1138 | | - jQuery('#d-category-yes').css('visibility','visible'); |
1139 | | - jQuery('#d-category-no').css('visibility','visible'); |
1140 | | - jQuery('#cat-dialog [for="d-category-no"]').css('visibility','visible'); |
1141 | | - jQuery('#cat-dialog [for="d-category-yes"]').css('visibility','visible'); |
1142 | | - } |
| 1357 | + |
| 1358 | + jQuery(document).ready(smw_property_autocomplete); |
| 1359 | + jQuery(document).ready(smw_category_autocomplete); |
| 1360 | + jQuery(document).ready(function(){ |
| 1361 | + jQuery('#mainlabelvis').bind('change', function(){ |
| 1362 | + jQuery('#mainlabelhid').attr('value',jQuery('#mainlabelvis').attr('value')); |
| 1363 | + }); |
| 1364 | + if(jQuery('#mainlabelvis')!='') smw_mainLabelHidden=false; |
1143 | 1365 | }); |
1144 | | -}); |
1145 | | - |
1146 | | -jQuery(document).ready(smw_property_autocomplete); |
1147 | | -jQuery(document).ready(smw_category_autocomplete); |
1148 | | -jQuery(document).ready(function(){ |
1149 | | - jQuery('#mainlabelvis').bind('change', function(){ |
1150 | | - jQuery('#mainlabelhid').attr('value',jQuery('#mainlabelvis').attr('value')); |
1151 | | - }); |
1152 | | - if(jQuery('#mainlabelvis')!='') smw_mainLabelHidden=false; |
1153 | | -}); |
1154 | 1366 | </script> |
1155 | 1367 | |
1156 | 1368 | EOT; |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -251,6 +251,10 @@ |
252 | 252 | |
253 | 253 | //Generic messages for Query UI |
254 | 254 | 'smw_qui_property' => '<strong>Property</strong>', |
| 255 | + 'smw_qui_prop' => 'Property:', |
| 256 | + 'smw_qui_labl' => 'Label:', |
| 257 | + 'smw_qui_formt' => 'Format:', |
| 258 | + 'smw_qui_limt' => 'Limit:', |
255 | 259 | 'smw_qui_shownresults' => 'show in results', |
256 | 260 | 'smw_qui_noquery' => 'No query has been specified', |
257 | 261 | 'smw_qui_invalidprop' => '"$1" may not be a valid property', |