Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -941,6 +941,7 @@ |
942 | 942 | // END: create form elements already submitted earlier via form |
943 | 943 | |
944 | 944 | // create hidden form elements to be cloned later |
| 945 | + //property |
945 | 946 | $hiddenProperty = Html::openElement( 'div', |
946 | 947 | array( 'id' => 'property_starter', |
947 | 948 | 'style' => 'display:none' ) |
— | — | @@ -967,7 +968,7 @@ |
968 | 969 | Html::hidden( 'prop_limit_num', '' ) . |
969 | 970 | Xml::closeElement( 'div' ); |
970 | 971 | $hiddenProperty = json_encode( $hiddenProperty ); |
971 | | - |
| 972 | + //category |
972 | 973 | $hiddenCategory = Html::openElement( 'div', |
973 | 974 | array( 'id' => 'category_starter', |
974 | 975 | 'style' => 'display:none' ) |
— | — | @@ -985,7 +986,7 @@ |
986 | 987 | '<input type="hidden" name="cat_no_num" />' . |
987 | 988 | Xml::closeElement( 'div' ); |
988 | 989 | $hiddenCategory = json_encode( $hiddenCategory ); |
989 | | - |
| 990 | + // For '?' printouts |
990 | 991 | $hiddenMainColumn = Html::openElement( 'div', |
991 | 992 | array( 'id' => 'maincol_starter', |
992 | 993 | 'style' => 'display:none' ) |
— | — | @@ -1001,6 +1002,7 @@ |
1002 | 1003 | Xml::closeElement( 'div' ); |
1003 | 1004 | $hiddenMainColumn = json_encode( $hiddenMainColumn ); |
1004 | 1005 | |
| 1006 | + //Create dialog-boxes |
1005 | 1007 | // create dialogbox for Property options |
1006 | 1008 | $propertyHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_prop' ), |
1007 | 1009 | '', |
— | — | @@ -1121,13 +1123,6 @@ |
1122 | 1124 | } ); |
1123 | 1125 | } |
1124 | 1126 | |
1125 | | - function smwRemoveMainLabel(){ |
1126 | | - jQuery( '#mainlabelhid' ).attr( 'value', '-' ); |
1127 | | - jQuery( '#mainlabelvis' ).attr( 'value', '' ); |
1128 | | - jQuery( '#smwmainlabel' ).hide(); |
1129 | | - smw_mainLabelHidden = true; |
1130 | | - } |
1131 | | - |
1132 | 1127 | function smw_category_autocomplete(){ |
1133 | 1128 | jQuery( '[name*="category"]' ).autocomplete( { |
1134 | 1129 | minLength: 2, |
— | — | @@ -1162,6 +1157,13 @@ |
1163 | 1158 | jQuery('#mainlabel-dialog').dialog("open"); |
1164 | 1159 | } |
1165 | 1160 | |
| 1161 | + function smwRemoveMainLabel(){ |
| 1162 | + jQuery( '#mainlabelhid' ).attr( 'value', '-' ); |
| 1163 | + jQuery( '#mainlabelvis' ).attr( 'value', '' ); |
| 1164 | + jQuery( '#smwmainlabel' ).hide(); |
| 1165 | + } |
| 1166 | + |
| 1167 | + |
1166 | 1168 | function smw_makeQueryMatchesDialog( qm_id ){ |
1167 | 1169 | qmLabel=jQuery('#maincol_label'+qm_id).attr('value'); |
1168 | 1170 | jQuery('#d-mainres-label').attr('value', qmLabel); |
— | — | @@ -1278,13 +1280,14 @@ |
1279 | 1281 | num_elements++; |
1280 | 1282 | smw_category_autocomplete(); |
1281 | 1283 | } |
1282 | | - var smw_mainLabelHidden=true; |
| 1284 | + |
1283 | 1285 | function smw_addMainColInstance(starter_div_id, main_div_id) { |
1284 | | - if(smw_mainLabelHidden && (jQuery('.smwsort').length==1)){ |
| 1286 | + if( (jQuery('#smwmainlabel').css('display')=='none') |
| 1287 | + && (jQuery('.smwsort').length==1) |
| 1288 | + ){ |
1285 | 1289 | jQuery('#mainlabelhid').attr('value',''); |
1286 | 1290 | jQuery('#mainlabelvis').attr('value',''); |
1287 | 1291 | jQuery('#smwmainlabel').show(); |
1288 | | - smw_mainLabelHidden=false; |
1289 | 1292 | } else { |
1290 | 1293 | if( jQuery( '.smwsort' ).length > smwgQPrintoutLimit ){ |
1291 | 1294 | return; |
— | — | @@ -1308,6 +1311,11 @@ |
1309 | 1312 | children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']'); |
1310 | 1313 | } |
1311 | 1314 | } |
| 1315 | + //Create 'options' link |
| 1316 | + var more_button =document.createElement('span'); |
| 1317 | + more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeQueryMatchesDialog(\'' + num_elements + '\')">{$optionsMsg}</a> '; |
| 1318 | + more_button.id = 'more'+num_elements; |
| 1319 | + new_div.appendChild(more_button); |
1312 | 1320 | |
1313 | 1321 | //Add the new instance |
1314 | 1322 | main_div.appendChild(new_div); |
— | — | @@ -1438,9 +1446,6 @@ |
1439 | 1447 | |
1440 | 1448 | jQuery(document).ready(smw_property_autocomplete); |
1441 | 1449 | jQuery(document).ready(smw_category_autocomplete); |
1442 | | - jQuery(document).ready(function(){ |
1443 | | - if(jQuery('#mainlabelhid')=='') smw_mainLabelHidden=true; |
1444 | | - }); |
1445 | 1450 | </script> |
1446 | 1451 | |
1447 | 1452 | EOT; |