Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -396,9 +396,11 @@ |
397 | 397 | $propertyValues = $wgRequest->getArray( 'property' ); |
398 | 398 | $categoryValues = $wgRequest->getArray( 'category' ); |
399 | 399 | $categoryLabelValues = $wgRequest->getArray( 'cat_label' ); |
| 400 | + $categoryYesValues = $wgRequest->getArray( 'cat_yes' ); |
| 401 | + $categoryNoValues = $wgRequest->getArray( 'cat_no' ); |
400 | 402 | $mainColumnLabels = $wgRequest->getArray( 'maincol_label' ); |
401 | 403 | $po = array(); |
402 | | - $categoryNamespace = $wgContLang->getNsText( NS_CATEGORY ); |
| 404 | + |
403 | 405 | if ( is_array( $mainColumnLabels ) ) { |
404 | 406 | foreach ( $mainColumnLabels as $key => $label ) { |
405 | 407 | if ( $label == '' ) { |
— | — | @@ -409,12 +411,27 @@ |
410 | 412 | |
411 | 413 | } |
412 | 414 | } |
| 415 | + |
| 416 | + $categoryNamespace = $wgContLang->getNsText( NS_CATEGORY ); |
413 | 417 | if ( is_array( $categoryValues ) ) { |
414 | 418 | foreach ( $categoryValues as $key => $value ) { |
415 | 419 | if ( trim( $value ) == '' ) { |
416 | 420 | $po[$key] = "?$categoryNamespace" ; |
417 | 421 | } else { |
418 | 422 | $po[$key] = "?$categoryNamespace:$value"; |
| 423 | + if (is_array($categoryYesValues) && |
| 424 | + is_array($categoryNoValues) && |
| 425 | + array_key_exists($key, $categoryYesValues) && |
| 426 | + array_key_exists($key, $categoryNoValues)){ |
| 427 | + |
| 428 | + if($categoryYesValues[$key]!==''){ |
| 429 | + $po[$key] .="#$categoryYesValues[$key]"; |
| 430 | + if($categoryNoValues[$key]!==''){ |
| 431 | + $po[$key] .=",$categoryNoValues[$key]"; |
| 432 | + } |
| 433 | + } |
| 434 | + } |
| 435 | + |
419 | 436 | } |
420 | 437 | } |
421 | 438 | } |
— | — | @@ -489,6 +506,8 @@ |
490 | 507 | $displayValues = $wgRequest->getArray( 'display' ); |
491 | 508 | $categoryValues = $wgRequest->getArray( 'category' ); |
492 | 509 | $categoryLabelValues = $wgRequest->getArray( 'cat_label' ); |
| 510 | + $categoryYesValues = $wgRequest->getArray( 'cat_yes' ); |
| 511 | + $categoryNoValues = $wgRequest->getArray( 'cat_no' ); |
493 | 512 | $mainColumnLabels = $wgRequest->getArray( 'maincol_label' ); |
494 | 513 | |
495 | 514 | if ( is_array( $propertyValues ) || is_array( $categoryValues ) || is_array( $mainColumnLabels ) ) { |
— | — | @@ -595,7 +614,10 @@ |
596 | 615 | $result .= Xml::closeElement( 'div' ); |
597 | 616 | $i++; |
598 | 617 | } |
599 | | - if ( is_array( $categoryValues ) && array_key_exists( $key, $categoryValues ) ) { |
| 618 | + if ( is_array( $categoryValues ) && array_key_exists( $key, $categoryValues ) && |
| 619 | + is_array($categoryLabelValues) && array_key_exists( $key, $categoryLabelValues ) && |
| 620 | + is_array($categoryYesValues) && array_key_exists( $key, $categoryYesValues ) && |
| 621 | + is_array($categoryNoValues) && array_key_exists( $key, $categoryNoValues )) { |
600 | 622 | /* |
601 | 623 | * Make an element for additional categories |
602 | 624 | */ |
— | — | @@ -603,8 +625,9 @@ |
604 | 626 | $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>' . |
605 | 627 | wfMsg( 'smw_qui_category' ) . |
606 | 628 | Xml::input( "category[$i]", '25', $categoryValues[$key], array( 'id' => "category$i" ) ) . " " . |
607 | | - wfMsg( 'smw_qui_label' ) . |
608 | | - Xml::input( "cat_label[$i]", '20', array_key_exists( $key, $categoryLabelValues ) ? $categoryLabelValues[$key]:false, array( 'id' => "cat_label$i" ) ) . " " . |
| 629 | + Html::hidden("cat_label[$i]", $categoryLabelValues[$key], array('id'=>"cat_label$i")). |
| 630 | + Html::hidden("cat_yes[$i]", $categoryYesValues[$key], array('id'=>"cat_yes$i")). |
| 631 | + Html::hidden("cat_no[$i]", $categoryNoValues[$key], array('id'=>"cat_no$i")). |
609 | 632 | ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makeCatDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> ' . |
610 | 633 | Xml::closeElement( 'div' ); |
611 | 634 | $i++; |
— | — | @@ -642,8 +665,9 @@ |
643 | 666 | '<span class="smw-remove"><a><img src="' . $smwgScriptPath . '/skins/images/close-button.png" alt="' . wfMsg( 'smw_qui_delete' ) . '"></a></span>' . |
644 | 667 | wfMsg( 'smw_qui_category' ) . |
645 | 668 | Xml::input( "category_num", '25' ) . " " . |
646 | | - wfMsg( 'smw_qui_label' ) . |
647 | | - Xml::input( "cat_label_num", '20' ) . " " . |
| 669 | + '<input type="hidden" name="cat_label_num" />'. |
| 670 | + '<input type="hidden" name="cat_yes_num" />'. |
| 671 | + '<input type="hidden" name="cat_no_num" />'. |
648 | 672 | Xml::closeElement( 'div' ); |
649 | 673 | $hiddenCategory = json_encode( $hiddenCategory ); |
650 | 674 | |
— | — | @@ -662,12 +686,18 @@ |
663 | 687 | // Xml::inputLabel( 'Limit:', 'd-property-limit', 'd-property-limit' ) . '<br/>' . // todo i18n |
664 | 688 | '<input type="hidden" name="d-property-code" id="d-property-code">' . |
665 | 689 | Xml::closeElement( 'div' ); |
666 | | - $categoryDialogBox = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => 'Category Options', 'class' => 'smwcatdialog' ) ) . // todo i18n |
667 | | - Xml::inputLabel( 'Label:', '', 'd-category-label', 'd-category-label' ) . '<br/>' . // todo i18n |
668 | | - Xml::inputLabel( 'Category:', '', 'd-category', 'd-category' ) . '<br/><br/>' . // todo i18n |
669 | | - Xml::inputLabel( 'Show text when category is present:', '', 'd-category-yes', 'd-category-yes' ) . '<br/><br/>' . // todo i18n |
670 | | - Xml::inputLabel( 'Show text when category is absent:', '', 'd-category-no', 'd-category-no' ) . '<br/><br/>' . // todo i18n |
671 | | - '<input type="hidden" name="d-category-code" id="d-category-code">' . |
| 690 | + //create dialogbox for Category options |
| 691 | + $categoryHtml=Xml::inputLabelSep( wfMsg('smw_qui_dcategory'), '', 'd-category', 'd-category' ); |
| 692 | + $categoryLabelHtml=Xml::inputLabelSep( wfMsg('smw_qui_dlabel'), '', 'd-category-label', 'd-category-label' ); |
| 693 | + $categoryYesHtml=Xml::inputLabelSep( wfMsg('smw_qui_dcatyes'), '', 'd-category-yes', 'd-category-yes' ); |
| 694 | + $categoryNoHtml=Xml::inputLabelSep( wfMsg('smw_qui_dcatno'), '', 'd-category-no', 'd-category-no' ); |
| 695 | + $categoryDialogBox = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => wfMsg('smw_qui_catopts'), 'class' => 'smwcatdialog' ) ) . |
| 696 | + '<table>'. |
| 697 | + '<tr><td>'.$categoryHtml[0].'</td><td>'.$categoryHtml[1].'</td></tr>'. |
| 698 | + '<tr><td>'.$categoryYesHtml[0].'</td><td>'.$categoryYesHtml[1].'</td></tr>'. |
| 699 | + '<tr><td>'.$categoryNoHtml[0].'</td><td>'.$categoryNoHtml[1].'</td></tr>'. |
| 700 | + '<tr><td>'.$categoryLabelHtml[0].'</td><td>'.$categoryLabelHtml[1].'</td></tr>'. |
| 701 | + '</table>'. |
672 | 702 | Xml::closeElement( 'div' ); |
673 | 703 | |
674 | 704 | $result .= '<div id="sorting_main"></div>' . "\n"; |
— | — | @@ -749,40 +779,19 @@ |
750 | 780 | } |
751 | 781 | } |
752 | 782 | |
753 | | -function smw_cat_code_update(){ |
754 | | - cat = code = jQuery('#d-category').attr('value'); |
755 | | - label = jQuery('#d-category-label').attr('value'); |
756 | | - yes = jQuery('#d-category-yes').attr('value'); |
757 | | - no = jQuery('#d-category-no').attr('value'); |
758 | | - if (cat.trim()!='' && yes.trim()!=''){ |
759 | | - code=cat+'#'+yes; |
760 | | - if(no.trim()!=''){ |
761 | | - code=code+','+no; |
762 | | - } |
763 | | - } |
764 | | - jQuery('#d-category-code').attr('value', code); |
765 | | - |
766 | | -} |
767 | | - |
768 | 783 | function smw_makeCatDialog(cat_id){ |
769 | 784 | jQuery('#prop-cat input').attr('value',''); |
| 785 | + |
770 | 786 | cat=jQuery('#category'+cat_id)[0].value; |
771 | 787 | label=jQuery('#cat_label'+cat_id)[0].value; |
772 | | - cats=cat.split('#'); |
773 | | - cat= cats[0]; |
774 | | - if(cats[1]){ |
775 | | - yes_no = cats[1].split(','); |
776 | | - if(yes_no[1]){ |
777 | | - no=yes_no[1]; |
778 | | - } else { |
779 | | - no = ''; |
780 | | - } |
781 | | - yes=yes_no[0]; |
782 | | - jQuery('#d-category-yes').attr('value',yes); |
783 | | - jQuery('#d-category-no').attr('value',no); |
784 | | - } |
| 788 | + yes = jQuery('#cat_yes'+cat_id)[0].value; |
| 789 | + no = jQuery('#cat_no'+cat_id)[0].value; |
| 790 | + |
| 791 | + jQuery('#d-category-yes').attr('value',yes); |
| 792 | + jQuery('#d-category-no').attr('value',no); |
785 | 793 | jQuery('#d-category-label').attr('value',label); |
786 | 794 | jQuery('#d-category').attr('value',cat); |
| 795 | + |
787 | 796 | jQuery('#cat-dialog').dialog.id=cat_id; |
788 | 797 | jQuery('#cat-dialog').dialog('open'); |
789 | 798 | } |
— | — | @@ -935,11 +944,16 @@ |
936 | 945 | minWidth: 400, |
937 | 946 | buttons: { |
938 | 947 | "{$okMsg}": function(){ |
939 | | - smw_cat_code_update(); |
| 948 | + cat = jQuery('#d-category').attr('value'); |
940 | 949 | label = jQuery('#d-category-label').attr('value'); |
941 | | - code = jQuery('#d-category-code').attr('value'); |
942 | | - jQuery('#category'+jQuery(this).dialog.id).attr('value',code); |
943 | | - jQuery('#cat_label'+jQuery(this).dialog.id).attr('value',label); |
| 950 | + yes = jQuery('#d-category-yes').attr('value'); |
| 951 | + no = jQuery('#d-category-no').attr('value'); |
| 952 | + id=jQuery(this).dialog.id; |
| 953 | + |
| 954 | + jQuery('#category'+id).attr('value',cat); |
| 955 | + jQuery('#cat_label'+id).attr('value',label); |
| 956 | + jQuery('#cat_yes'+id).attr('value',yes); |
| 957 | + jQuery('#cat_no'+id).attr('value',no); |
944 | 958 | jQuery(this).dialog("close"); |
945 | 959 | }, |
946 | 960 | "{$cancelMsg}": function(){ |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -244,7 +244,7 @@ |
245 | 245 | Names(<strong>[[Germany]]</strong>) and Namespaces (<strong>[[{{ns:help}}:+]]</strong>)', |
246 | 246 | |
247 | 247 | //Generic messages for Query UI |
248 | | - 'smw_qui_property' => 'Property', |
| 248 | + 'smw_qui_property' => '<strong>Property</strong>', |
249 | 249 | 'smw_qui_shownresults' => 'show in results', |
250 | 250 | 'smw_qui_noquery' => 'No query has been specified', |
251 | 251 | 'smw_qui_invalidprop' => '"$1" may not be a valid property', |
— | — | @@ -252,17 +252,22 @@ |
253 | 253 | 'smw_qui_nosort' => 'No sorting', |
254 | 254 | 'smw_qui_ascorder' => 'Ascending', |
255 | 255 | 'smw_qui_descorder' => 'Descending', |
256 | | - 'smw_qui_addnprop' => 'Add additional properties', |
| 256 | + 'smw_qui_addnprop' => 'Add additional property', |
257 | 257 | 'smw_qui_delete' => 'Remove', |
258 | | - 'smw_qui_rescol' => 'Column label', |
| 258 | + 'smw_qui_rescol' => '<strong>Query Matches</strong> Label', |
259 | 259 | 'smw_qui_options' => 'options', |
260 | 260 | 'smw_qui_addcategory' => 'Add additional category', |
261 | 261 | 'smw_qui_addrescol' => 'Add main result column', |
262 | 262 | 'smw_qui_ok' => 'Ok', |
263 | 263 | 'smw_qui_cancel' => 'Cancel', |
264 | | - 'smw_qui_category' => 'Category (optional)', |
| 264 | + 'smw_qui_category' => '<strong>Category</strong>', |
265 | 265 | 'smw_qui_label' => 'Label', |
266 | 266 | 'smw_prp_options' => 'Property Options', |
| 267 | + 'smw_qui_catopts' => 'Category Options', |
| 268 | + 'smw_qui_dlabel' => 'Label:', |
| 269 | + 'smw_qui_dcategory' => 'Category:', |
| 270 | + 'smw_qui_dcatyes' => 'Show text when category is present:', |
| 271 | + 'smw_qui_dcatno' => 'Show text when category is absent:', |
267 | 272 | |
268 | 273 | // Messages for the search by property special |
269 | 274 | 'searchbyproperty' => 'Search by property', |