Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php |
— | — | @@ -7,13 +7,13 @@ |
8 | 8 | |
9 | 9 | if (!defined('MEDIAWIKI')) die(); |
10 | 10 | |
11 | | -class SFRunQuery extends SpecialPage { |
| 11 | +class SFRunQuery extends IncludableSpecialPage { |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Constructor |
15 | 15 | */ |
16 | 16 | function SFRunQuery() { |
17 | | - SpecialPage::SpecialPage('RunQuery'); |
| 17 | + parent::__construct('RunQuery'); |
18 | 18 | wfLoadExtensionMessages('SemanticForms'); |
19 | 19 | } |
20 | 20 | |
— | — | @@ -27,10 +27,10 @@ |
28 | 28 | $form_name = $query; |
29 | 29 | } |
30 | 30 | |
31 | | - self::printQueryForm($form_name); |
| 31 | + self::printQueryForm($form_name, $this->including()); |
32 | 32 | } |
33 | 33 | |
34 | | - static function printQueryForm($form_name) { |
| 34 | + static function printQueryForm($form_name, $embedded = false) { |
35 | 35 | global $wgOut, $wgRequest, $wgScriptPath, $sfgScriptPath, $sfgFormPrinter, $sfgYUIBase; |
36 | 36 | |
37 | 37 | wfLoadExtensionMessages('SemanticForms'); |
— | — | @@ -67,36 +67,32 @@ |
68 | 68 | } |
69 | 69 | list ($form_text, $javascript_text, $data_text, $form_page_title) = |
70 | 70 | $sfgFormPrinter->formHTML($form_definition, $form_submitted, $is_text_source, $edit_content, null, null, true); |
| 71 | + $text = ""; |
| 72 | + // override the default title for this page if |
| 73 | + // a title was specified in the form |
| 74 | + if ($form_page_title != NULL) { |
| 75 | + $wgOut->setPageTitle($form_page_title); |
| 76 | + } |
71 | 77 | if ($form_submitted) { |
72 | | - $wgOut->setArticleBodyOnly( true ); |
73 | | - global $wgTitle; |
74 | | - $new_url = $wgTitle->getLocalURL() . "/$form_name"; |
75 | | - $text = SFUtils::printRedirectForm($new_url, $data_text, $wgRequest->getVal('wpSummary'), false, false, false, $wgRequest->getCheck('wpMinoredit'), $wgRequest->getCheck('wpWatchthis'), $wgRequest->getVal('wpStarttime'), $wgRequest->getVal('wpEdittime')); |
76 | | - } else { |
77 | | - $text = ""; |
78 | | - // override the default title for this page if |
79 | | - // a title was specified in the form |
80 | | - if ($form_page_title != NULL) { |
81 | | - $wgOut->setPageTitle($form_page_title); |
82 | | - } |
83 | | - if ($wgRequest->getCheck('wpTextbox1')) { |
84 | | - global $wgParser, $wgUser, $wgTitle; |
85 | | - $wgParser->mOptions = new ParserOptions(); |
86 | | - $wgParser->mOptions->initialiseFromUser($wgUser); |
87 | | - $text = $wgParser->parse($content, $wgTitle, $wgParser->mOptions)->getText(); |
88 | | - $additional_query = wfMsg('sf_runquery_additionalquery'); |
89 | | - $text .= "\n<h2>$additional_query</h2>\n"; |
90 | | - } |
91 | | - $text .=<<<END |
92 | | - <form name="createbox" onsubmit="return validate_all()" action="" method="post" class="createbox"> |
| 78 | + global $wgParser, $wgUser, $wgTitle; |
| 79 | + $wgParser->mOptions = new ParserOptions(); |
| 80 | + $wgParser->mOptions->initialiseFromUser($wgUser); |
| 81 | + $text = $wgParser->parse($data_text, $wgTitle, $wgParser->mOptions)->getText(); |
| 82 | + $additional_query = wfMsg('sf_runquery_additionalquery'); |
| 83 | + $text .= "\n<h2>$additional_query</h2>\n"; |
| 84 | + } |
| 85 | + $action = htmlspecialchars(SpecialPage::getTitleFor("RunQuery", $form_name)->getLocalURL()); |
| 86 | + $text .=<<<END |
| 87 | + <form name="createbox" onsubmit="return validate_all()" action="$action" method="post" class="createbox"> |
93 | 88 | <input type="hidden" name="query" value="true" /> |
94 | 89 | |
95 | 90 | END; |
96 | | - $text .= $form_text; |
97 | | - } |
| 91 | + $text .= $form_text; |
98 | 92 | } |
99 | 93 | SFUtils::addJavascriptAndCSS(); |
100 | 94 | $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n"); |
| 95 | + if ( $embedded ) |
| 96 | + $text = "<div class='runQueryEmbedded'>$text</div>"; |
101 | 97 | $wgOut->addHTML($text); |
102 | 98 | } |
103 | 99 | } |
Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc |
— | — | @@ -99,8 +99,7 @@ |
100 | 100 | $cur_value = htmlspecialchars($cur_value); |
101 | 101 | |
102 | 102 | $text =<<<END |
103 | | - <input id="$input_id" tabindex="$sfgTabIndex" class="$className" name="$input_name" type="text" |
104 | | - value="$cur_value" size="$size" |
| 103 | + <input id="$input_id" tabindex="$sfgTabIndex" class="$className" name="$input_name" type="text" value="$cur_value" size="$size" |
105 | 104 | END; |
106 | 105 | if ($is_disabled) |
107 | 106 | $text .= " disabled"; |