Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -72,10 +72,11 @@ |
73 | 73 | * Creates the input form |
74 | 74 | * |
75 | 75 | * @global OutputPage $wgOut |
| 76 | + * @global string $smwgScriptPath |
76 | 77 | * @return string |
77 | 78 | */ |
78 | 79 | protected function makeResults() { |
79 | | - global $wgOut; |
| 80 | + global $wgOut, $smwgScriptPath; |
80 | 81 | $result = ""; |
81 | 82 | $spec_title = $this->getTitle(); |
82 | 83 | $format_box = $this->getFormatSelectBoxSep( 'broadtable' ); |
— | — | @@ -105,17 +106,36 @@ |
106 | 107 | "document.getElementById('show_additional_options').style.display='inline';" . '">' . |
107 | 108 | wfMsg( 'smw_qc_hide_addnal_opts' ) . '</a></span>'; |
108 | 109 | $result .= ' | <a href="' . htmlspecialchars( wfMsg( 'smw_ask_doculink' ) ) . '">' . wfMsg( 'smw_ask_help' ) . '</a>'; |
| 110 | + if ( $this->uiCore->getQueryString() != '' ) { // hide #ask if there isnt any query defined |
| 111 | + $result .= ' | <a name="show-embed-code" id="show-embed-code" href="#show-embed-code">' . wfMsg( 'smw_ask_show_embed' ) . '</a>'; |
| 112 | + $result .= '<div id="embed-code-dialog">' . |
| 113 | + $this->getAskEmbedBox() . |
| 114 | + '</div>'; |
| 115 | + $this->enableJQueryUI(); |
| 116 | + $wgOut->addScriptFile( "$smwgScriptPath/libs/jquery-ui/jquery-ui.dialog.min.js" ); |
| 117 | + $wgOut->addStyle( "$smwgScriptPath/skins/SMW_custom.css" ); |
| 118 | + $javascript_text = <<<EOT |
| 119 | +<script type="text/javascript"> |
| 120 | +jQuery(document).ready(function(){ |
| 121 | + jQuery('#embed-code-dialog').dialog({ |
| 122 | + autoOpen:false |
| 123 | + }); |
| 124 | + jQuery('#show-embed-code').bind('click', function(){ |
| 125 | + jQuery('#embed-code-dialog').dialog("open"); |
| 126 | + }); |
| 127 | +}); |
| 128 | +</script> |
| 129 | +EOT; |
| 130 | + $wgOut->addScript( $javascript_text ); |
| 131 | + } |
109 | 132 | // additional options |
110 | 133 | $result .= '<div id="additional_options" style="display:none">'; |
111 | 134 | |
112 | 135 | $result .= $format_box[1]; // display the format options |
113 | 136 | |
114 | | - if ( $this->uiCore->getQueryString() != '' ) // hide #ask if there isnt any query defined |
115 | | - $result .= $this->getAskEmbedBox(); |
116 | | - |
117 | 137 | $result .= '</div>'; // end of hidden additional options |
118 | | - $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>' . |
119 | | - '<input type="hidden" name="eq" value="no"/>' . |
| 138 | + $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>'; |
| 139 | + $result .= '<input type="hidden" name="eq" value="no"/>' . |
120 | 140 | "\n</form><br/>"; |
121 | 141 | |
122 | 142 | return $result; |