Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -147,7 +147,6 @@ |
148 | 148 | $po = array(); |
149 | 149 | $category_namespace = $wgContLang->getNsText( NS_CATEGORY ); |
150 | 150 | if ( is_array( $main_column_labels ) ) { |
151 | | - $po['mainlabel'] = '-'; // disables mainlabel parameter so that the UI can control it from here |
152 | 151 | foreach ( $main_column_labels as $key => $label ) { |
153 | 152 | if ( $label == '' ) { |
154 | 153 | $po[$key] = "?"; |
— | — | @@ -156,8 +155,6 @@ |
157 | 156 | } |
158 | 157 | |
159 | 158 | } |
160 | | - } else { |
161 | | - $po['mainlabel'] = ''; // enables mainlabel parameter |
162 | 159 | } |
163 | 160 | if ( is_array( $category_values ) ) { |
164 | 161 | foreach ( $category_values as $key => $value ) { |
— | — | @@ -300,7 +297,10 @@ |
301 | 298 | $i = 0; |
302 | 299 | $additional_POs = array(); |
303 | 300 | if ( is_array( $property_values ) ) { |
304 | | - $additional_POs = array_merge( $additional_POs, $property_values ); |
| 301 | + $keys = array_keys( $property_values ); |
| 302 | + foreach ( $keys as $value ) { |
| 303 | + $additional_POs[$value] = $property_values[$value]; // array_merge won't work because numeric keys need to be preserved |
| 304 | + } |
305 | 305 | } |
306 | 306 | if ( is_array( $category_values ) ) {// same as testing $category_label_values |
307 | 307 | $keys = array_keys( $category_values ); |
— | — | @@ -339,7 +339,7 @@ |
340 | 340 | |
341 | 341 | $if4 = ( is_array( $display_values ) and array_key_exists( $key, $display_values ) ); |
342 | 342 | $result .= Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display[$i]", "display$i", $if4 ); |
343 | | - $result .= ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> options </a> '; // TODO: i18n |
| 343 | + $result .= ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> '; |
344 | 344 | |
345 | 345 | $result .= Xml::closeElement( 'div' ); |
346 | 346 | $i++; |
— | — | @@ -350,11 +350,11 @@ |
351 | 351 | */ |
352 | 352 | $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i", 'class' => 'smwsort' ) ); |
353 | 353 | $result .= '<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>' . |
354 | | - 'Category (optional)' . // todo: i18n |
| 354 | + wfMsg( 'smw_qui_category' ) . |
355 | 355 | Xml::input( "category[$i]", '20', $category_values[$key], array( 'id' => "category$i" ) ) . " " . |
356 | | - 'Label' . // todo: i18n |
| 356 | + wfMsg( 'smw_qui_label' ) . |
357 | 357 | Xml::input( "cat_label[$i]", '20', array_key_exists( $key, $category_label_values ) ? $category_label_values[$key]:false, array( 'id' => "cat_label$i" ) ) . " " . |
358 | | - ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makeCatDialog(\'' . $i . '\')"> options </a> ' . // TODO: i18n |
| 358 | + ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makeCatDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> ' . |
359 | 359 | Xml::closeElement( 'div' ); |
360 | 360 | $i++; |
361 | 361 | } |
— | — | @@ -389,9 +389,9 @@ |
390 | 390 | |
391 | 391 | $hidden_category = Html::openElement( 'div', array( 'id' => 'category_starter', 'class' => 'smwsort', 'style' => 'display:none' ) ) . |
392 | 392 | '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
393 | | - 'Category (optional)' . // todo: i18n |
| 393 | + wfMsg( 'smw_qui_category' ) . |
394 | 394 | Xml::input( "category_num", '20' ) . " " . |
395 | | - 'Label' . // todo: i18n |
| 395 | + wfMsg( 'smw_qui_label' ) . |
396 | 396 | Xml::input( "cat_label_num", '20' ) . " " . |
397 | 397 | Xml::closeElement( 'div' ); |
398 | 398 | $hidden_category = json_encode( $hidden_category ); |
— | — | @@ -403,7 +403,7 @@ |
404 | 404 | Xml::closeElement( 'div' ); |
405 | 405 | $hidden_main_column = json_encode( $hidden_main_column ); |
406 | 406 | |
407 | | - $property_dialog_box = Xml::openElement( 'div', array( 'id' => 'prop-dialog', 'title' => 'Property Options', 'class' => 'smwpropdialog' ) ) . // todo i18n |
| 407 | + $property_dialog_box = Xml::openElement( 'div', array( 'id' => 'prop-dialog', 'title' => wfMsg( 'smw_prp_options' ), 'class' => 'smwpropdialog' ) ) . |
408 | 408 | Xml::inputLabel( 'Property:', '', 'd-property', 'd-property' ) . '<br/>' . // todo i18n |
409 | 409 | Xml::inputLabel( 'Label:', '', 'd-property-label', 'd-property-label' ) . '<br/>' . // todo i18n |
410 | 410 | '<label for="d-format">Format:</label> ' . Html::openElement( 'select', array( 'name' => 'd-format', 'id' => 'd-format' ) ) . // todo i18n |
— | — | @@ -415,23 +415,27 @@ |
416 | 416 | '<input type="hidden" name="d-property-code" id="d-property-code">' . |
417 | 417 | Xml::closeElement( 'div' ); |
418 | 418 | $category_dialog_box = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => 'Category Options', 'class' => 'smwcatdialog' ) ) . // todo i18n |
419 | | - Xml::inputLabel( 'Category:', '', 'd-category', 'd-category' ) . '<br/>' . // todo i18n |
420 | 419 | Xml::inputLabel( 'Label:', '', 'd-category-label', 'd-category-label' ) . '<br/>' . // todo i18n |
421 | | - Xml::inputLabel( 'Yes:', '', 'd-category-yes', 'd-category-yes' ) . '<br/>' . // todo i18n |
422 | | - Xml::inputLabel( 'No:', '', 'd-category-no', 'd-category-no' ) . '<br/>' . // todo i18n |
423 | | - 'Code :<input type="text" name="d-category-code" id="d-category-code">' . // todo hide |
| 420 | + Xml::inputLabel( 'Category:', '', 'd-category', 'd-category' ) . '<br/><br/>' . // todo i18n |
| 421 | + Xml::inputLabel( 'Show text when category is present:', '', 'd-category-yes', 'd-category-yes' ) . '<br/><br/>' . // todo i18n |
| 422 | + Xml::inputLabel( 'Show text when category is absent:', '', 'd-category-no', 'd-category-no' ) . '<br/><br/>' . // todo i18n |
| 423 | + '<input type="hidden" name="d-category-code" id="d-category-code">' . |
424 | 424 | Xml::closeElement( 'div' ); |
425 | 425 | |
426 | 426 | $result .= '<div id="sorting_main"></div>' . "\n"; |
427 | 427 | $result .= '[<a href="javascript:smw_addPropertyInstance(\'property_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addnprop' ) . '</a>]' . |
428 | | - '[<a href="javascript:smw_addCategoryInstance(\'category_starter\', \'sorting_main\')">' . 'Add additional category' . '</a>]' . // todo i18n |
429 | | - '[<a href="javascript:smw_addMainColInstance(\'maincol_starter\', \'sorting_main\')">' . 'Add main column' . '</a>]' . // todo i18n |
| 428 | + '[<a href="javascript:smw_addCategoryInstance(\'category_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addcategory' ) . '</a>]' . |
| 429 | + '[<a href="javascript:smw_addMainColInstance(\'maincol_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addrescol' ) . '</a>]' . |
430 | 430 | "\n"; |
431 | 431 | |
432 | 432 | // Javascript code for handling adding and removing the "sort" inputs |
433 | 433 | if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
434 | 434 | $this->addAutocompletionJavascriptAndCSS(); |
435 | 435 | } |
| 436 | + // localisation messages for javascript |
| 437 | + $optionsMsg = wfMsg( 'smw_qui_options' ); |
| 438 | + $okMsg = wfMsg( 'smw_qui_ok' ); |
| 439 | + $cancelMsg = wfMsg( 'smw_qui_cancel' ); |
436 | 440 | $javascript_text = <<<EOT |
437 | 441 | <script type="text/javascript"> |
438 | 442 | var num_elements = {$num_sort_values}; |
— | — | @@ -498,16 +502,41 @@ |
499 | 503 | } |
500 | 504 | |
501 | 505 | function smw_cat_code_update(){ |
| 506 | + cat = jQuery('#d-category').attr('value'); |
| 507 | + label =code= jQuery('#d-category-label').attr('value'); |
| 508 | + yes = jQuery('#d-category-yes').attr('value'); |
| 509 | + no = jQuery('#d-category-no').attr('value'); |
| 510 | + if (cat.trim()!='' && yes.trim()!=''){ |
| 511 | + code=cat+'#'+yes; |
| 512 | + if(no.trim()!=''){ |
| 513 | + code=code+','+no; |
| 514 | + } |
| 515 | + } |
| 516 | + jQuery('#d-category-code').attr('value', code); |
502 | 517 | |
503 | 518 | } |
504 | 519 | |
505 | 520 | function smw_makeCatDialog(cat_id){ |
506 | 521 | jQuery('#prop-cat input').attr('value',''); |
507 | 522 | cat=jQuery('#category'+cat_id)[0].value; |
508 | | - jQuery('#d-category').attr('value',cat); |
509 | 523 | label=jQuery('#cat_label'+cat_id)[0].value; |
| 524 | + cats=cat.split('#'); |
| 525 | + cat= cats[0]; |
| 526 | + if(cats[1]){ |
| 527 | + yes_no = cats[1].split(','); |
| 528 | + if(yes_no[1]){ |
| 529 | + no=yes_no[1]; |
| 530 | + } else { |
| 531 | + no = ''; |
| 532 | + } |
| 533 | + yes=yes_no[0]; |
| 534 | + jQuery('#d-category-yes').attr('value',yes); |
| 535 | + jQuery('#d-category-no').attr('value',no); |
| 536 | + } |
510 | 537 | jQuery('#d-category-label').attr('value',label); |
511 | | - //jQuery('#cat-dialog').dialog('open'); |
| 538 | + jQuery('#d-category').attr('value',cat); |
| 539 | + jQuery('#cat-dialog').dialog.id=cat_id; |
| 540 | + jQuery('#cat-dialog').dialog('open'); |
512 | 541 | } |
513 | 542 | |
514 | 543 | function smw_makePropDialog(prop_id){ |
— | — | @@ -558,7 +587,7 @@ |
559 | 588 | |
560 | 589 | //Create 'more' link |
561 | 590 | var more_button =document.createElement('span'); |
562 | | - more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makePropDialog(\'' + num_elements + '\')">options</a> '; //TODO: i18n |
| 591 | + more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makePropDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
563 | 592 | more_button.id = 'more'+num_elements; |
564 | 593 | new_div.appendChild(more_button); |
565 | 594 | |
— | — | @@ -594,7 +623,7 @@ |
595 | 624 | |
596 | 625 | //Create 'more' link |
597 | 626 | var more_button =document.createElement('span'); |
598 | | - more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeCatDialog(\'' + num_elements + '\')">options</a> '; //TODO: i18n |
| 627 | + more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeCatDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
599 | 628 | more_button.id = 'more'+num_elements; |
600 | 629 | new_div.appendChild(more_button); |
601 | 630 | |
— | — | @@ -657,18 +686,20 @@ |
658 | 687 | minHeight: 200, |
659 | 688 | minWidth: 400, |
660 | 689 | buttons: { |
661 | | - "Ok": function(){ //todo i18 |
| 690 | + "{$okMsg}": function(){ |
662 | 691 | smw_cat_code_update(); |
663 | | - // todo: move modal window data to main window form controls; |
| 692 | + label = jQuery('#d-category-label').attr('value'); |
| 693 | + code = jQuery('#d-category-code').attr('value'); |
| 694 | + jQuery('#category'+jQuery(this).dialog.id).attr('value',code); |
| 695 | + jQuery('#cat_label'+jQuery(this).dialog.id).attr('value',label); |
664 | 696 | jQuery(this).dialog("close"); |
665 | 697 | }, |
666 | | - "Cancel": function(){ //todo:i18n |
| 698 | + "{$cancelMsg}": function(){ |
667 | 699 | jQuery('#cat-dialog input').attr('value',''); |
668 | 700 | jQuery(this).dialog("close"); |
669 | 701 | } |
670 | 702 | } |
671 | 703 | }); |
672 | | - //todo: run smw_cat_code_update() when input values in category modal windows changes |
673 | 704 | |
674 | 705 | jQuery('#prop-dialog').dialog({ |
675 | 706 | autoOpen: false, |
— | — | @@ -677,19 +708,18 @@ |
678 | 709 | minHeight: 200, |
679 | 710 | minWidth: 400, |
680 | 711 | buttons: { |
681 | | - "Ok": function(){ //todo: i18n |
| 712 | + "{$okMsg}": function(){ |
682 | 713 | smw_prop_code_update(); |
683 | | - jQuery('#property'+jQuery('#prop-dialog').dialog.id)[0].value=jQuery('#d-property-code')[0].value; |
| 714 | + jQuery('#property'+jQuery(this).dialog.id)[0].value=jQuery('#d-property-code')[0].value; |
684 | 715 | jQuery(this).dialog("close"); |
685 | 716 | }, |
686 | | - "Cancel": function(){ //todo: i18n |
| 717 | + "{$cancelMsg}": function(){ |
687 | 718 | jQuery('#prop-dialog input').attr('value',''); |
688 | 719 | jQuery(this).dialog("close"); |
689 | 720 | } |
690 | 721 | } |
691 | 722 | }); |
692 | 723 | jQuery('#sort-more').click(function(){jQuery('#prop-dialog').dialog("open");}); |
693 | | - jQuery('#prop-dialog input').bind('keyup click', smw_prop_code_update ); |
694 | 724 | |
695 | 725 | jQuery('#d-format').bind('change', function(event){ |
696 | 726 | jQuery('#d-property-format-custom').attr('value', jQuery('#d-format').attr('value')); |
— | — | @@ -706,24 +736,5 @@ |
707 | 737 | $wgOut->addScript( $javascript_text ); |
708 | 738 | return $result; |
709 | 739 | } |
710 | | - |
711 | | - |
712 | | - /** |
713 | | - * Compatibility method to get the skin; MW 1.18 introduces a getSkin method |
714 | | - * in SpecialPage. |
715 | | - * |
716 | | - * @since 1.6 |
717 | | - * |
718 | | - * @return Skin |
719 | | - */ |
720 | | - public function getSkin() { |
721 | | - if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
722 | | - return parent::getSkin(); |
723 | | - } else { |
724 | | - global $wgUser; |
725 | | - return $wgUser->getSkin(); |
726 | | - } |
727 | | - } |
728 | | - |
729 | 740 | } |
730 | 741 | |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -254,7 +254,15 @@ |
255 | 255 | 'smw_qui_descorder' => 'Descending', |
256 | 256 | 'smw_qui_addnprop' => 'Add additional properties', |
257 | 257 | 'smw_qui_delete' => 'Remove', |
258 | | - 'smw_qui_rescol' => 'Result column label', |
| 258 | + 'smw_qui_rescol' => 'Column label', |
| 259 | + 'smw_qui_options' => 'options', |
| 260 | + 'smw_qui_addcategory' => 'Add additional category', |
| 261 | + 'smw_qui_addrescol' => 'Add result column', |
| 262 | + 'smw_qui_ok' => 'Ok', |
| 263 | + 'smw_qui_cancel' => 'Cancel', |
| 264 | + 'smw_qui_category' => 'Category (optional)', |
| 265 | + 'smw_qui_label' => 'Label', |
| 266 | + 'smw_prp_options' => 'Property Options', |
259 | 267 | |
260 | 268 | // Messages for the search by property special |
261 | 269 | 'searchbyproperty' => 'Search by property', |
— | — | @@ -415,6 +423,10 @@ |
416 | 424 | 'smw_qui_nosort' => 'Option in a drop-down menu indicating that user does not want any sorting to be done', |
417 | 425 | 'smw_qui_addnprop' => 'Clicking on this message creates a new form to add more properties', |
418 | 426 | 'smw_qui_delete' => 'Removes/deletes a form option', |
| 427 | + 'smw_qui_rescol' => 'Label for the main result column. See http://semantic-mediawiki.org/wiki/Help:Displaying_information#The_main_result_column/ for further information. The text appears as a label next to an text-box', |
| 428 | + 'smw_qui_ok' => 'Ok button', |
| 429 | + 'smw_qui_cancel' => 'Cancel button', |
| 430 | + 'smw_prp_options' => 'Advanced options for property (title for a new modal window)', |
419 | 431 | 'smw_sbv_property' => '{{Identical|Property}}', |
420 | 432 | 'smw_sbv_value' => '{{Identical|Value}}', |
421 | 433 | 'smw_sbv_submit' => '{{Identical|Find results}}', |