Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [59373] trunk/extensions/SemanticForms

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


dantman at svn

Nov 23, 2009, 5:05 PM

Post #1 of 1 (54 views)
Permalink
SVN: [59373] trunk/extensions/SemanticForms

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/59373

Revision: 59373
Author: dantman
Date: 2009-11-24 01:05:08 +0000 (Tue, 24 Nov 2009)

Log Message:
-----------
Fixes for embedded forms. Don't preprocess, and replace the strip state.

Modified Paths:
--------------
trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
trunk/extensions/SemanticForms/specials/SF_RunQuery.php

Modified: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc 2009-11-24 00:00:42 UTC (rev 59372)
+++ trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc 2009-11-24 01:05:08 UTC (rev 59373)
@@ -125,7 +125,7 @@
}


- function formHTML($form_def, $form_submitted, $source_is_page, $existing_page_content = null, $page_title = null, $page_name_formula = null, $is_query = false) {
+ function formHTML($form_def, $form_submitted, $source_is_page, $existing_page_content = null, $page_title = null, $page_name_formula = null, $is_query = false, $embedded = false) {
global $wgRequest, $wgUser, $wgParser;
global $sfgTabIndex; // used to represent the current tab index in the form
global $sfgFieldNum; // used for setting various HTML IDs
@@ -214,10 +214,13 @@
// element, so that the wiki parser won't touch it - the parser will
// remove the '<nowiki>' tags, leaving us with what we need
$form_def = "__NOEDITSECTION__" . strtr($form_def, array('{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>'));
+ $old_strip_state = $wgParser->mStripState;
+ $wgParser->mStripState = new StripState();
$wgParser->mOptions = new ParserOptions();
$wgParser->mOptions->initialiseFromUser($wgUser);
$form_def = $wgParser->parse($form_def, $this->mPageTitle, $wgParser->mOptions)->getText();
-
+ $wgParser->mStripState = $old_strip_state;
+
// turn form definition file into an array of sections, one for each
// template definition (plus the first section)
$form_def_sections = array();
@@ -1295,7 +1298,10 @@
$data_text = $existing_page_content;
$javascript_text .= $fields_javascript_text;
global $wgParser;
- $new_text = $wgParser->preprocess(str_replace( "{{!}}", "|", $form_page_title ), $this->mPageTitle, new ParserOptions());
+ $new_text = "";
+ if ( !$embedded )
+ $wgParser->preprocess(str_replace( "{{!}}", "|", $form_page_title ), $this->mPageTitle, new ParserOptions());
+
return array($form_text, "/*<![CDATA[*/ $javascript_text /*]]>*/",
$data_text, $new_text, $generated_page_name);
}

Modified: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
===================================================================
--- trunk/extensions/SemanticForms/specials/SF_RunQuery.php 2009-11-24 00:00:42 UTC (rev 59372)
+++ trunk/extensions/SemanticForms/specials/SF_RunQuery.php 2009-11-24 01:05:08 UTC (rev 59373)
@@ -19,7 +19,8 @@

function execute($query) {
global $wgRequest;
- $this->setHeaders();
+ if ( !$this->including() )
+ $this->setHeaders();
$form_name = $this->including() ? $query : $wgRequest->getVal('form', $query);

self::printQueryForm($form_name, $this->including());
@@ -28,8 +29,6 @@
static function printQueryForm($form_name, $embedded = false) {
global $wgOut, $wgRequest, $wgScriptPath, $sfgScriptPath, $sfgFormPrinter, $sfgYUIBase;

- wfLoadExtensionMessages('SemanticForms');
-
// get contents of form definition file
$form_title = Title::makeTitleSafe(SF_NS_FORM, $form_name);

@@ -41,7 +40,8 @@
$text = '<p class="error">Error: No form page was found at ' . SFUtils::linkText(SF_NS_FORM, $form_name) . ".</p>\n";
} else {
$s = wfMsg('sf_runquery_title', $form_title->getText());
- $wgOut->setPageTitle($s);
+ if ( !$embedded )
+ $wgOut->setPageTitle($s);
$form_article = new Article($form_title);
$form_definition = $form_article->getContent();
$submit_url = $form_title->getLocalURL('action=submit');
@@ -70,11 +70,11 @@
$is_text_source = true;
}
list ($form_text, $javascript_text, $data_text, $form_page_title) =
- $sfgFormPrinter->formHTML($form_definition, $form_submitted, $is_text_source, $edit_content, null, null, true);
+ $sfgFormPrinter->formHTML($form_definition, $form_submitted, $is_text_source, $edit_content, null, null, true, $embedded);
$text = "";
// override the default title for this page if
// a title was specified in the form
- if ($form_page_title != NULL) {
+ if ($form_page_title != NULL && !$embedded) {
$wgOut->setPageTitle($form_page_title);
}
if ($form_submitted) {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.