r94790 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94789‎ | r94790 | r94791 >
Date:18:51, 17 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
some style cleanup and localisation
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -127,10 +127,23 @@
128128 protected function getAskEmbedBox() {
129129 $result = '';
130130 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+ );
135148 }
136149 return $result;
137150 }
@@ -206,46 +219,47 @@
207220 $this->enableJQueryUI();
208221 $javascriptAutocompleteText = <<<END
209222 <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' );
221225 }
222 -}
223226
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();
234229 }
235 - jQuery( "<li></li>" )
236 - .data( "item.autocomplete", item )
237 - .append( " <a>" + t + "</a>" )
238 - .appendTo( ul );
239 -};
240230
 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+
241255 ///* 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+ } );
250264 </script>
251265 END;
252266
@@ -273,8 +287,9 @@
274288 global $smwgQMaxInlineLimit, $wgLang;
275289 // Prepare navigation bar.
276290 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+ );
279294 $navigation = Html::element(
280295 'a',
281296 array(
@@ -296,8 +311,9 @@
297312 '</b>&#160;&#160;&#160;&#160;';
298313
299314 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+ );
302318 $navigation .= Html::element(
303319 'a',
304320 array(
@@ -354,10 +370,10 @@
355371 protected function getQueryFormBox() {
356372 global $wgOut, $smwgScriptPath;
357373 $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>';
362378 $this->enableJQuery();
363379 $wgOut->addScriptFile( "$smwgScriptPath/skins/elastic/jquery.elastic.source.js" );
364380
@@ -366,18 +382,16 @@
367383 * be removed when jQuery 1.4 or above is supported.
368384 */
369385 $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+ } );
378394 EOT;
379395 $wgOut->addInlineScript( $javascript );
380 -
381 - // TODO:enable/disable on checking for errors; perhaps show error messages right below the box
382396 return $result;
383397 }
384398
@@ -423,7 +437,9 @@
424438 $categoryYesValues = $wgRequest->getArray( 'cat_yes' );
425439 $categoryNoValues = $wgRequest->getArray( 'cat_no' );
426440 $mainColumnLabels = $wgRequest->getArray( 'maincol_label' );
 441+
427442 $po = array();
 443+
428444 $mainLabel = $wgRequest->getVal( 'pmainlabel', '' );
429445 $params['mainlabel'] = $mainLabel;
430446
@@ -445,12 +461,14 @@
446462 $po[$key] = "?$categoryNamespace" ;
447463 } else {
448464 $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+ {
455473 $po[$key] .= "#$categoryYesValues[$key],$categoryNoValues[$key]";
456474 }
457475 }
@@ -469,7 +487,11 @@
470488 $params['sort'] = '';
471489 $params['order'] = '';
472490 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+ {
474496 $params['sort'] .= ( $params['sort'] != '' ? ',':'' ) . $propertyValues[$key];
475497 $params['order'] .= ( $params['order'] != '' ? ',':'' ) . $orderValues[$key];
476498 }
@@ -484,20 +506,23 @@
485507 if ( is_array( $displayValues ) ) {
486508 foreach ( $displayValues as $key => $value ) {
487509 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+ {
492515 $propertyValues[$key] .= '#' . $propertyFormatValues[$key];
493516 }
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+ {
497521 $propertyValues[$key] .= ' = ' . $propertyLabelValues[$key];
498522 }
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+ {
502527 // / @bug limit, when specified causes incorrect ordering of printouts
503528 $po[] = $propertyValues[$key];
504529 $po[] = '+limit=' . $propertyLimitValues[$key];
@@ -513,7 +538,6 @@
514539 $po = array_merge( $params, $po );
515540 }
516541 return $po;
517 -
518542 }
519543
520544 /**
@@ -552,18 +576,26 @@
553577 $mainLabelText = $mainLabel;
554578 $formDisplay = 'block';
555579 }
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>';
568600 $urlArgs = array();
569601 $urlArgs['pmainlabel'] = $mainLabel;
570602
@@ -627,9 +659,15 @@
628660 $searchKey--;
629661 }
630662 $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+
632667 $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+
634672 $orderValues[$counter] = $orderVal[0];
635673 $displayValues[$counter] = '1';
636674 $counter++;
@@ -637,9 +675,15 @@
638676 array_shift( $sortVal );
639677 } else {
640678 $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+
642683 $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+
644688 $displayValues[$counter] = '1';
645689 $counter++;
646690 }
@@ -674,18 +718,21 @@
675719
676720 $keys = array_keys( $propertyValues );
677721 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
679724 }
680725
681726
682727 $keys = array_keys( $categoryValues );
683728 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
685731 }
686732
687733 $keys = array_keys( $mainColumnLabels );
688734 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
690737 }
691738
692739 ksort( $additionalPOs );
@@ -694,13 +741,32 @@
695742 /*
696743 * Make an element for additional properties
697744 */
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>';
700757 $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+
702765 $urlArgs["property[$i]"] = $propertyValues[$key];
703766 if ( $smwgQSortingSupport ) {
704 - $result .= Html::openElement( 'select', array( 'name' => "order[$i]" ) );
 767+ $result .= Html::openElement(
 768+ 'select',
 769+ array( 'name' => "order[$i]" )
 770+ );
705771 if ( array_key_exists( $key, $orderValues ) ) {
706772 $urlArgs["order[$i]"] = $orderValues[$key];
707773 }
@@ -717,48 +783,111 @@
718784
719785 $if4 = ( array_key_exists( $key, $displayValues ) );
720786 $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+ }
722790 }
723791 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+ );
725797 $urlArgs["prop_label[$i]"] = $propertyLabelValues[$key];
726798 } 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+ );
728803 }
729804 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+ );
731809 $urlArgs["prop_format[$i]"] = $propertyFormatValues[$key];
732810 } 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+ );
734815 }
735816 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+ );
737821 $urlArgs["prop_limit[$i]"] = $propertyLimitValues[$key];
738822 } 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+ );
740827 }
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+ );
742835
743836 $result .= Xml::closeElement( 'div' );
744837 $i++;
745838 }
746839 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+ }
750849 /*
751850 * Make an element for additional categories
752851 */
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+
763892 $urlArgs["cat_label[$i]"] = $categoryLabelValues[$key];
764893 $urlArgs["cat_yes[$i]"] = $categoryYesValues[$key];
765894 $urlArgs["cat_no[$i]"] = $categoryNoValues[$key];
@@ -768,12 +897,27 @@
769898 /*
770899 * Make an element for main column
771900 */
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];
778922 $i++;
779923 }
780924 }
@@ -782,69 +926,135 @@
783927 // END: create form elements already submitted earlier via form
784928
785929 // 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' ) . " " ;
790944 if ( $smwgQSortingSupport ) {
791945 $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 );
797951 }
798952 $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' );
803956 $hiddenProperty = json_encode( $hiddenProperty );
804957
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' );
813975 $hiddenCategory = json_encode( $hiddenCategory );
814976
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' );
820991 $hiddenMainColumn = json_encode( $hiddenMainColumn );
821992
822993 // 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' );
8351026
8361027 // 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' );
8491059
8501060 $result .= '<div id="sorting_main"></div>' . "\n";
8511061 $result .= '[<a href="javascript:smw_addPropertyInstance(\'property_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addnprop' ) . '</a>]' .
@@ -862,175 +1072,135 @@
8631073 $cancelMsg = wfMsg( 'smw_qui_cancel' );
8641074 $javascriptText = <<<EOT
8651075 <script type="text/javascript">
866 -var num_elements = {$numSortValues};
 1076+ var num_elements = {$numSortValues};
8671077 EOT;
8681078 // add autocomplete
8691079 if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) {
8701080 $javascriptText .= <<<EOT
8711081
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';
8771087
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+ }
8831098
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+ }
8871105
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';
8941111
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+ }
9101122 EOT;
9111123 } else {
9121124 $javascriptText .= <<<EOT
913 -function smw_property_autocomplete(){
914 -}
 1125+ function smw_property_autocomplete(){
 1126+ }
9151127
916 -function smw_category_autocomplete(){
917 -}
 1128+ function smw_category_autocomplete(){
 1129+ }
9181130
9191131 EOT;
9201132 }
9211133
9221134 $javascriptText .= <<<EOT
9231135
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','');
9261138
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;
9311143
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);
9361148
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+ }
9401152
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
9551167
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);
9591171
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+ }
9731186 }
974 - }
9751187
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);
9811193
982 - //Add the new instance
983 - main_div.appendChild(new_div);
 1194+ //Add the new instance
 1195+ main_div.appendChild(new_div);
9841196
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();
10101202 }
10111203
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) {
10351205 var starter_div = document.getElementById(starter_div_id);
10361206 var main_div = document.getElementById(main_div_id);
10371207
@@ -1050,6 +1220,12 @@
10511221 }
10521222 }
10531223
 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+
10541230 //Add the new instance
10551231 main_div.appendChild(new_div);
10561232
@@ -1057,99 +1233,135 @@
10581234 st='sort_div_'+num_elements;
10591235 jQuery('#'+new_div.id).find(".smw-remove a")[0].href="javascript:removePOInstance('"+st+"')";
10601236 num_elements++;
 1237+ smw_category_autocomplete();
10611238 }
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);
10631249
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+ }
10691265
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);
10891268
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++;
11001273 }
1101 - });
 1274+ }
11021275
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+ }
11161281
 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;
11171301
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+ }
11271312 }
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+ });
11291356 });
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;
11431365 });
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 -});
11541366 </script>
11551367
11561368 EOT;
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php
@@ -251,6 +251,10 @@
252252
253253 //Generic messages for Query UI
254254 '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:',
255259 'smw_qui_shownresults' => 'show in results',
256260 'smw_qui_noquery' => 'No query has been specified',
257261 'smw_qui_invalidprop' => '"$1" may not be a valid property',