Development, bug fixes...
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 24 Oct 2008 20:32:06 +0000 (20:32 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 24 Oct 2008 20:32:06 +0000 (20:32 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/extensions/wrreport@278 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrreport.body.php

index 9bc63a56b25689e3397f7b0ff02a9fe26b7847ab..693ad9627d7e27c9f687f0b0082eaa596027800d 100644 (file)
@@ -1,9 +1,6 @@
 <?php
 
 
-$wrReportMarkerList = array();
-
-
 function wrReportParserInit() {
        global $wgParser;
        $wgParser->setHook('bahnberichtformular', 'wrReportFormRender');
@@ -12,7 +9,6 @@ function wrReportParserInit() {
 }
 
 
-/// \todo: Remove this function: The table function could output wikitext directly.
 function wrReportSandboxParse($wikiText) {
         global $wgTitle, $wgUser;
         $myParser = new Parser();
@@ -23,6 +19,18 @@ function wrReportSandboxParse($wikiText) {
 }
 
 
+$wrReportMarkerList = array();
+
+
+/// Returns a marker for a text and back-replaces the text in wrReportAfterTidy
+function replaceByMarker($text, $marker = 'marker') {
+       $marker = $marker . mt_rand(1e5, 1e7);
+       global $wrReportMarkerList;
+       $wrReportMarkerList[$marker] = $text;
+       return $marker;
+}
+
+
 /// \brief Returns a form to enter a report (string containing HTML).
 ///
 /// All parameters have to be UTF-8 encoded.
@@ -88,10 +96,7 @@ function wrRenderReportForm($hide_save_button = TRUE, $page_id = NULL, $page_tit
 </table>
 </form>
 EOT;
-       $marker = 'wrReportFormMarker' . mt_rand(1e5, 1e7);
-       global $wrReportMarkerList;
-       $wrReportMarkerList[$marker] = $form;
-       return $marker;
+       return $form;
 }
 
 
@@ -157,9 +162,9 @@ function wrRenderReportTable($page_title = NULL) {
 }
 
 
-/// Is called when the tag <bahnberichte/> is encounted.
+/// Is called when the tag <<bahnberichtformular /> is encounted.
 function wrReportFormRender($input, $args, $parser) {
-       return wrRenderReportForm(TRUE, $parser->getTitle()->getArticleID(), $parser->getTitle()->getText());
+       return replaceByMarker(wrRenderReportForm(TRUE, $parser->getTitle()->getArticleID(), $parser->getTitle()->getText()));
 }
 
 
@@ -225,10 +230,10 @@ class WrReport extends SpecialPage {
                        }
                        if ($action == 'preview') {
                                $wgOut->addHTML("<h3>Vorschau (noch nicht gespeichert)</h3>\n");
-                               $wgOut->addHTML("<table>\n");
+                               $wgOut->addHTML("<table class=\"wrreporttable\">\n");
                                $wgOut->addHTML(wrRenderReportTableTitle(FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE));
-                               $wgOut->addHTML(wrRenderReportTableRow($page_id, $page_title, $date_report, NULL, NULL, $condition, $description, $author_name));
-                               $wgOut->addHTML("</table>\n");
+                               $wgOut->addHTML(wrRenderReportTableRow(NULL, $page_title, $date_report, NULL, NULL, $condition, $description, $author_name));
+                               $wgOut->addHTML("</table>\n\n\n");
                                $wgOut->addHTML(utf8_encode("<h3>Speichern oder Ă„ndern</h3>\n"));
                                $wgOut->addHTML(wrRenderReportForm(FALSE, $page_id, $page_title, $date_report, $condition, $description, $author_name));
                        }