r94340 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94339‎ | r94340 | r94341 >
Date:11:58, 12 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
modal window for embed code
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -72,10 +72,11 @@
7373 * Creates the input form
7474 *
7575 * @global OutputPage $wgOut
 76+ * @global string $smwgScriptPath
7677 * @return string
7778 */
7879 protected function makeResults() {
79 - global $wgOut;
 80+ global $wgOut, $smwgScriptPath;
8081 $result = "";
8182 $spec_title = $this->getTitle();
8283 $format_box = $this->getFormatSelectBoxSep( 'broadtable' );
@@ -105,17 +106,36 @@
106107 "document.getElementById('show_additional_options').style.display='inline';" . '">' .
107108 wfMsg( 'smw_qc_hide_addnal_opts' ) . '</a></span>';
108109 $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+ }
109132 // additional options
110133 $result .= '<div id="additional_options" style="display:none">';
111134
112135 $result .= $format_box[1]; // display the format options
113136
114 - if ( $this->uiCore->getQueryString() != '' ) // hide #ask if there isnt any query defined
115 - $result .= $this->getAskEmbedBox();
116 -
117137 $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"/>' .
120140 "\n</form><br/>";
121141
122142 return $result;

Follow-up revisions

RevisionCommit summaryAuthorDate
r94342follow-up:r94340, r94116devayon12:41, 12 August 2011