Replaced absolute URLs with variables (ticket #41)
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 2 Jan 2009 15:45:02 +0000 (15:45 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 2 Jan 2009 15:45:02 +0000 (15:45 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/extensions/wrreport@368 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrreport.body.php
wrreport.php

index 204ed31652f8ac7d38f02b4c8741508397cf74c6..b9f7bf7d94f53f00616c8ade5cb7f1096f54fbfa 100644 (file)
@@ -6,6 +6,7 @@
 
 function wrReportParserInit() {
        global $wgParser;
+       wfLoadExtensionMessages('WrReport');
        $wgParser->setHook('bahnberichtformular', 'bahnberichtformularParserHook');
        $wgParser->setHook('bahnberichte', 'bahnberichteParserHook');
        $wgParser->setHook('bahnbewertung', 'bahnbewertungParserHook');
@@ -117,10 +118,13 @@ function wrReportFormRender($hide_save_button = TRUE, $page_title = NULL, $date_
        if ($hide_save_button) $buttons .= ' &amp; Speichern'; 
        $buttons .= '" /> ';
        if (!$hide_save_button) $buttons .= '<input name="store" type="submit" value="Speichern"/>';
+       
+       $specialPageName = wfMsg('wrreport'); // 'Bahnberichte'
+       $title = Title::newFromText($specialPageName, NS_SPECIAL);
+       $specialPageUrl = $title->getLocalURL(); // e.g. '/wiki/Spezial:Bahnberichte'
 
-       // TODO: Get rid of absolute URL
        $form = <<<EOT
-<form action="/wiki/Spezial:Bahnberichte" method="post">
+<form action="$specialPageUrl" method="post">
 <table class="wrreportform" summary="Formular zum Eintragen eines Rodelbahnberichtes">
        <tr class="oddrow"><th>Rodelbahn</th><td>$page_title<input type="hidden" name="page_title" value="$page_title"/></td></tr>
        <tr class="evenrow"><th>Datum des Rodelns</th>
@@ -157,9 +161,12 @@ function wrDeleteReportFormRender($reportid, $delete_person_name, $delete_reason
        $delete_reason_public_html = htmlspecialchars($delete_reason_public);
        $delete_person_name_html = htmlspecialchars($delete_person_name);
 
-       // TODO: Get rid of absolute URL
+       $specialPageName = wfMsg('wrreport'); // 'Bahnberichte'
+       $title = Title::newFromText($specialPageName, NS_SPECIAL);
+       $specialPageUrl = $title->getLocalURL(); // e.g. '/wiki/Spezial:Bahnberichte'
+
        $form = <<<EOT
-<form action="/wiki/Spezial:Bahnberichte" method="post">
+<form action="$specialPageUrl" method="post">
 <table class="wrreportform" summary="$summary">
        <tr class="evenrow"><th>$reason</th><td><textarea name="delete_reason_public" cols="50" rows="7">$delete_reason_public_html</textarea></td></tr>
        <tr class="oddrow"><th>Name</th><td><input name="delete_person_name" maxlength="30" size="30" value="$delete_person_name" /></td></tr>
@@ -242,7 +249,12 @@ function wrReportTableRowRender2($row, $format, $showActions) {
        // wiki/Spezial:Bahnberichte?action=deletepreview&reportid=42
        if ($showActions) {
                $out .= '<td>';
-               if (!isset($row['delete_date'])) $out .= '<a href="/wiki/Spezial:Bahnberichte?action=deletepreview&amp;reportid=' . $row['id'] . '">' . utf8_encode('Löschen...') . '</a>'; // TODO: Get rid of absolute URL
+               if (!isset($row['delete_date'])) {
+                       $specialPageName = wfMsg('wrreport'); // 'Bahnberichte'
+                       $title = Title::newFromText($specialPageName, NS_SPECIAL);
+                       $specialPageUrl = $title->getLocalURL(); // e.g. '/wiki/Spezial:Bahnberichte'
+                       $out .= "<a href=\"$specialPageUrl?action=deletepreview&amp;reportid=" . $row['id'] . '">' . utf8_encode('Löschen...') . '</a>';
+               }
                $out .= '</td>';
        }
        return $out . "</tr>\n";
index 6aee14fb646a283c74ceb2375bbc75a241953fa6..bc9e579cc00bc5744a6f86b97ee90aec753f5038 100644 (file)
@@ -22,8 +22,9 @@ function wrReportLocalizedPageName(&$specialPageArray, $code) {
        $text = wfMsg('wrreport');
 
        # Convert from title in text form to DBKey and put it into the alias array:
-       $title = Title::newFromText($text);
-       $specialPageArray['WrReport'][] = $title->getDBKey();
+       $title = Title::newFromText($text); // 'Bahnberichte'
+       $specialPageArray['WrReport'][] = $title->getDBKey(); // 'Bahnberichte'
+
        return true;
 }
 
@@ -31,7 +32,7 @@ function wrReportLocalizedPageName(&$specialPageArray, $code) {
 
 $wgExtensionCredits['parserhook'][] = array(
        'name' => 'Winterrodeln Report',
-       'version' => '1.1.0',
+       'version' => '1.2.0',
        'author' =>'Philipp Spitzer', 
        'url' => 'http://www.winterrodeln.org', 
        'description' => 'This extension interprets the <report/> tag in sledding pages and creates report summaries'