// $wgWrReportBlackListAll = array(); // array of page names where reports disallowed for all users. Example: array('Birgitzer Alm (vom Adelshof)');
// $wgWrReportBlackListStrangers = array(); // array of page names where reports are disallowed for not logged in users
// $wgWrReportDeleteMode = 'loggedin'; // 'allow', 'loggedin', 'deny'
-// $wgWrReportFeedRoot = 'http://www.winterrodeln.org/feed'; // root URL of the Winterrodeln feed without trailing slash
+// $wgWrReportFeedRoot = 'https://www.winterrodeln.org/feed'; // root URL of the Winterrodeln feed without trailing slash
+// $wgWrReportEnableIntermaps = true; // show Intermaps sledrun information column
+// $wgWrReportIntermapsValidDays = 1; // number of days the last check of the Intermaps data may be in the past
//
//
// The following tags are supported:
/// Forces a regeneration of region overview pages ('Tirol', 'Vorarlberg', ...)
function wrRecacheRegions() {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
// SELECT cl_from FROM categorylinks where cl_to = 'Region'
$res = $dbr->select('categorylinks', 'cl_from', array('cl_to' => 'Region'));
$page_ids = array();
/// Returns the tuple ($report_id, $sledrun_condition, $date_report)
/// $date_report is NULL or a time as returned by strtotime
-/// Expects a database connection ($dbr = wfGetDB(DB_SLAVE);)
+/// Expects a database connection ($dbr = wfGetDB(DB_REPLICA);)
/// and a page_id describung the page where the condition should be returned.
/// If no condition is found, (NULL, NULL, NULL) is returned.
function wrGetSledrunCondition($dbr, $page_id) {
/// Updates the line of the wrreportcache table that corresponds to the $page_id parameter
function wrUpdateWrReportCacheTable($page_id) {
// Determine the new content for the row that should be updated
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
list($report_id, $condition, $date_report) = wrGetSledrunCondition($dbr, $page_id);
$rows = wrReportGetReports(array('id' => $report_id), 1);
// Delete the old content (if any)
$dbw = wfGetDB(DB_MASTER);
- $dbw->begin();
$dbw->delete('wrreportcache', array('page_id' => $page_id));
// Insert the updated row
'author_name' => $row['author_name'],
'author_username' => (is_null($row['author_userid']) ? NULL : $row['author_username'])));
}
- $dbw->commit();
}
$tr = $table->appendElement('tr');
$tr->appendElement('th')->appendText(wfMessage('wrreport-newreport-time')->text());
$td = $tr->appendElement('td');
- $td->appendElement('input', array('name' => 'time_report', 'maxlength' => '5', 'size' => '5', 'value' => $time_report));
+ $td->appendElement('input', array('name' => 'time_report', 'maxlength' => '5', 'size' => '5', 'class' => 'mw-ui-input mw-ui-input-inline', 'value' => $time_report));
$td->appendText(' ');
$td->appendText('Uhr');
$td->appendText(' ');
$select = $td->appendElement('select', array('name' => 'condition', 'required' => 'required'));
$option = $select->appendElement('option', array('value' => '0'));
$option->appendText(wfMessage('wrreport-condition-select')->text());
- foreach (WrReport::$wrConditions as $condition_num => $condition_text) {
+ foreach (WrReport::$wrConditions as $condition_num) {
$option = $select->appendElement('option', array('value' => (string) $condition_num));
if ($condition == $condition_num) $option->setAttribute('selected', 'selected');
- $option->appendText($condition_text);
+ $option->appendText(WrReport::getWrConditionText($condition_num));
}
$option = $select->appendElement('option', array('value' => '-1'));
if ($condition == -1) $option->setAttribute('selected', 'selected');
// description
$tr = $table->appendElement('tr');
$tr->appendElement('th')->appendText(wfMessage('wrreport-newreport-description')->text());
- $tr->appendElement('td')->appendElement('textarea', array('name' => 'description', 'class' => 'fullwidth', 'rows' => '7', 'required' => 'required'))->appendText($description);
+ $tr->appendElement('td')->appendElement('textarea', array('name' => 'description', 'class' => /* 'fullwidth' */ 'mw-ui-input', 'rows' => '7', 'required' => 'required'))->appendText($description);
// author
$tr = $table->appendElement('tr');
$tr->appendElement('th')->appendText(wfMessage('wrreport-newreport-author')->text());
- $tr->appendElement('td')->appendElement('input', array('name' => 'author_name', 'class' => 'fullwidth', 'maxlength' => '30', 'value' => $author_name));
+ $tr->appendElement('td')->appendElement('input', array('name' => 'author_name', 'class' => /* fullwidth */ 'mw-ui-input', 'maxlength' => '30', 'value' => $author_name));
// Buttons
// I would like to do it this way, but due to a bug of internet explorer, the <button> element is not useable.
$tr = $table->appendElement('tr');
$tr->appendElement('th')->appendText(wfMessage('wrreport-newreport-submit')->text());
$td = $tr->appendElement('td');
- $input = $td->appendElement('input', array('name' => 'preview', 'type' => 'submit'));
- if ($hide_save_button)
- $input->setAttribute('value', wfMessage('wrreport-newreport-next')->text());
- else {
- $input->setAttribute('value', wfMessage('wrreport-newreport-preview')->text());
-
- $td->appendElement('input', array('name' => 'store', 'type' => 'submit', 'value' => wfMessage('wrreport-newreport-save')->text()));
+ if ($hide_save_button) {
+ $input = $td->appendElement('input', array('name' => 'preview', 'type' => 'submit', 'class' => 'mw-ui-button mw-ui-progressive', 'value' => wfMessage('wrreport-newreport-next')->text()));
+ } else {
+ $input = $td->appendElement('input', array('name' => 'preview', 'type' => 'submit', 'class' => 'mw-ui-button', 'value' => wfMessage('wrreport-newreport-preview')->text()));
+ $td->appendElement('input', array('name' => 'store', 'type' => 'submit', 'class' => 'mw-ui-button mw-ui-constructive', 'value' => wfMessage('wrreport-newreport-save')->text()));
}
return $doc->saveHTML($form);
$tr = $table->appendElement('tr');
$tr->appendElement('th')->appendText(wfMessage('wrreport-reports-action')->text());
$td = $tr->appendElement('td');
- $td->appendElement('input', array('name' => 'deletepreview', 'type' => 'submit', 'value' => wfMessage('wrreport-newreport-preview')->text()));
- $td->appendElement('input', array('name' => 'delete', 'type' => 'submit', 'value' => wfMessage('wrreport-deletereport-delete')->text()));
+ $td->appendElement('input', array('name' => 'deletepreview', 'type' => 'submit', 'class' => 'mw-ui-button', 'value' => wfMessage('wrreport-newreport-preview')->text()));
+ $td->appendElement('input', array('name' => 'delete', 'type' => 'submit', 'class' => 'mw-ui-button mw-ui-destructive', 'value' => wfMessage('wrreport-deletereport-delete')->text()));
// hidden field
$input = $td->appendElement('input', array('name' => 'reportid', 'type' => 'hidden', 'value' => (string) $reportid));
// $row['condition']
$condition_text = '---';
- if (isset(WrReport::$wrConditions[$row['condition']])) $condition_text = WrReport::$wrConditions[$row['condition']];
+ if (in_array($row['condition'], WrReport::$wrConditions)) $condition_text = WrReport::getWrConditionText($row['condition']);
$td = $tr->appendElement('td');
if ($row['delete_date']) $td->appendElement('em')->appendText(wfMessage('wrreport-deletereport-deleted')->text());
else $td->appendText($condition_text);
/// $conditions = array('page_title' => 'Birgitzer Alm', 'date_invalid > now()');
/// $limit = 1; // or NULL for no limit
function wrReportGetReports($conditions, $limit=NULL) {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
$columns = wrReportGetColumnNames();
global $wgDBtype;
if ($wgDBtype == "mysql") // "condition" is a reserved word in mysql
///
/// If no condition is present, array(NULL, NULL) is returned
function wrReportConditionRender($page_title) {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
$cond = 'condition';
global $wgDBtype;
// select wrreport.id as report_id, `condition`, date_report from wrreport where page_title='Axamer Lizum' and `condition` is not null and date_invalid > now() and delete_date is null order by date_report desc, date_entry desc limit 1;
// -------------------
class WrReport {
- // Conditions: array(1 => 'Sehr gut', 2 => 'Gut', 3 => 'Mittelmäßig', 4 => 'Schlecht', 5 => 'Geht nicht');
- public static $wrConditions;
+ // Conditions: 1 => 'Sehr gut', 2 => 'Gut', 3 => 'Mittelmäßig', 4 => 'Schlecht', 5 => 'Geht nicht'
+ public static $wrConditions = array(1, 2, 3, 4, 5);
- public static function initWrConditions() {
- WrReport::$wrConditions = array();
- for ($i = 1; $i != 6; ++$i) WrReport::$wrConditions[$i] = wfMessage('wrreport-condition-' . $i)->text();
+ /// Returns the translated text of a specified numeric condition
+ public static function getWrConditionText(int $condition): string {
+ return wfMessage('wrreport-condition-' . $condition)->text();
}
/// Returns the number of sledrun reports issued by a user with the given id.
public static function getUserSeldrunReportCount($user_id) {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
// select count(*) from wrreport where author_userid = 1 and delete_date is null and `condition` is not null;
$res = $dbr->select('wrreport', 'count(*)', array('author_userid' => $user_id, 'delete_date' => null, '`condition` is not null'));
$row = $res->fetchRow();
// Parser Hook Functions
// ---------------------
- public static function ParserFirstCallInitHook(&$parser) {
+ public static function ParserFirstCallInitHook(Parser &$parser) {
$parser->setHook('bahnberichtformular', 'WrReport::bahnberichtformularParserHook');
$parser->setHook('bahnberichte', 'WrReport::bahnberichteParserHook');
$parser->setHook('bahnentabelle', 'WrReport::bahnentabelleParserHook');
/// \brief Is called when the tag <bahnberichtformular/> is encountered.
///
/// The current page name is taken.
- public static function bahnberichtformularParserHook($input, $args, $parser) {
+ public static function bahnberichtformularParserHook($input, array $args, Parser $parser, PPFrame $frame) {
// Username
- global $wgUser;
+ $wgUser = $parser->getUser();
$author_name = NULL;
if ($wgUser->isLoggedIn()) {
$author_name = $wgUser->getRealName();
/// \brief Is called when the tag <bahnberichte/> is encountered.
///
/// The current page name is taken.
- public static function bahnberichteParserHook($input, $args, $parser) {
+ public static function bahnberichteParserHook($input, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules('ext.wrreport'); // getOutput() returns class ParserOutput
$title = $parser->getTitle();
$page_id = $title->getArticleID();
/// conditions is an array that's given to the where clause
private static function getRegionDetails($conditions) {
// Example: SELECT name FROM wrregion WHERE page_id = 882;
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
$res = $dbr->select('wrregion', array('id', 'name', 'aswkb(border)'), $conditions);
if ($dbr->numRows($res) == 1) {
$row = $dbr->fetchRow($res);
/// Creates the HTML of the <bahnentabelle>, <bahnenregiontabelle> and <rodelbahntabelle> tags.
private static function createBahnentabelle($page_titles) {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
- // SELECT p.page_id,p.page_title, c.length, c.walkup_time, c.top_elevation, c.bottom_elevation, c.walkup_separate, c.lift, c.night_light, c.public_transport, c.sled_rental, c.information_phone FROM `page` p, wrsledruncache c WHERE (p.page_title in ('Birgitzer_Alm_(vom_Adelshof)', 'Kemater_Alm', 'Axamer_Lizum') and p.page_id=c.page_id) ORDER BY page_title
- $where_array = array('page.page_id = wrsledruncache.page_id');
+ // SELECT p.page_id, p.page_title, c.length, c.walkup_time, c.top_elevation, c.bottom_elevation, c.walkup_separate, c.lift, c.night_light, c.public_transport,
+ // c.sled_rental, c.information_phone, s.show_status, r.status, r.last_check, r.last_update
+ // FROM (`page` p JOIN wrsledruncache c ON p.page_id=c.page_id) LEFT OUTER JOIN (wrintermapssledrun s JOIN wrintermapsreport r ON s.intermaps_sledrun_id=r.intermaps_sledrun_id) ON p.page_id=s.wr_page_id
+ // WHERE p.page_title in ('Birgitzer_Alm_(vom_Adelshof)', 'Mutterer_Alm_-_Sportrodelbahn', 'Axamer_Lizum') ORDER BY page_title;
+ $where_array = array();
if (count($page_titles) > 0) {
$mysql_page_ids = array();
foreach ($page_titles as $page_title) $mysql_page_ids[] = $page_title->getArticleID();
- $where_array[] = 'page.page_id in (' . implode(', ', $mysql_page_ids) . ')';
+ $where_array[] = 'p.page_id in (' . implode(', ', $mysql_page_ids) . ')';
} else $where_array[] = 'false';
- $res = $dbr->select(array('page', 'wrsledruncache'), array('page.page_id', 'page.page_title', 'page_namespace', 'length', 'walkup_time', 'top_elevation', 'bottom_elevation', 'walkup_possible', 'walkup_separate', 'lift', 'night_light', 'public_transport', 'sled_rental', 'information_phone', 'information_web'), $where_array, 'bahnentabelleParserHook', array('ORDER BY' => 'page.page_title'));
+ $res = $dbr->select(['AA' => ['p' => 'page', 'c' => 'wrsledruncache'], 'BB' => ['r' => 'wrintermapsreport', 's' => 'wrintermapssledrun']],
+ ['p.page_id', 'p.page_title', 'p.page_namespace',
+ 'c.length', 'c.walkup_time', 'c.top_elevation', 'c.bottom_elevation', 'c.walkup_possible', 'c.walkup_separate',
+ 'c.lift', 'c.night_light', 'c.public_transport', 'c.sled_rental', 'c.information_phone', 'c.information_web',
+ 's.show_status', 'r.status', 'r.last_check', 'r.last_update'],
+ $where_array,
+ 'bahnentabelleParserHook',
+ ['ORDER BY' => 'p.page_title'],
+ ['c' => ['JOIN', 'p.page_id=c.page_id'], 's' => ['JOIN', 's.intermaps_sledrun_id=r.intermaps_sledrun_id'], 'BB' => ['LEFT OUTER JOIN', 'p.page_id=s.wr_page_id']]
+ );
global $wgUser;
global $wgWrReportMode; // e.g. 'summer'
global $wgWrReportBlackListAll;
global $wgWrReportBlackListStrangers;
- global $wgDBtype;
+ global $wgWrReportEnableIntermaps;
+ global $wgWrReportIntermapsValidDays;
// Determine, whether the user is allowed to make a new report
$userMayReport = ($wgWrReportMode == 'allow' || ($wgWrReportMode == 'loggedin' && $wgUser->isLoggedIn()));
$tr->appendElement('th')->appendElement('img', array('src' => '/vorlagen/s_lift.png', 'alt' => wfMessage('wrreport-icon-lift')->text(), 'title' => wfMessage('wrreport-icon-lift')->text()));
$tr->appendElement('th')->appendElement('img', array('src' => '/vorlagen/s_walk.png', 'alt' => wfMessage('wrreport-icon-walkupseparate')->text(), 'title' => wfMessage('wrreport-icon-walkupseparate')->text()));
$tr->appendElement('th')->appendElement('img', array('src' => '/vorlagen/s_bus.png', 'alt' => wfMessage('wrreport-icon-publictransport')->text(), 'title' => wfMessage('wrreport-icon-publictransport')->text()));
+ if ($wgWrReportMode != 'summer' && $wgWrReportEnableIntermaps) $tr->appendElement('th')->appendElement('img', array('src' => '/vorlagen/s_open.png', 'alt' => wfMessage('wrreport-icon-intermaps-status')->text(), 'title' => wfMessage('wrreport-icon-intermaps-status')->text()));
$tr->appendElement('th')->appendText(wfMessage('wrreport-sledrun')->text());
if ($wgWrReportMode != 'summer') $tr->appendElement('th')->appendText(wfMessage('wrreport-newreport-condition')->text());
$tr->appendElement('th')->appendText(wfMessage('wrreport-sledrun-information')->text());
$tr->appendElement('th')->appendText(wfMessage('wrreport-sledrun-length')->text());
// Rows
+ $now = new DateTime();
while ($row = $dbr->fetchObject($res)) {
$title = Title::newFromRow($row);
$tr = $table->appendElement('tr');
$td = $tr->appendElement('td');
if ($row->public_transport and $row->public_transport != 5) $td->appendElement('img', array('src' => '/vorlagen/s_bus.png', 'alt' => wfMessage('wrreport-icon-publictransport')->text(), 'title' => wfMessage('wrreport-icon-publictransport')->text()));
+ if ($wgWrReportMode != 'summer' && $wgWrReportEnableIntermaps) {
+ $td = $tr->appendElement('td');
+ if ($row->show_status) {
+ $date_last_check = new DateTime($row->last_check);
+ if ($date_last_check->diff($now)->days <= $wgWrReportIntermapsValidDays) {
+ if ($row->status == 'open') {
+ $msg = wfMessage('wrreport-icon-intermaps-open', $row->last_update)->text();
+ $td->appendElement('img', array('src' => '/vorlagen/s_open.png', 'alt' => $msg, 'title' => $msg));
+ } elseif ($row->status == 'closed') {
+ $msg = wfMessage('wrreport-icon-intermaps-closed', $row->last_update)->text();
+ $td->appendElement('img', array('src' => '/vorlagen/s_closed.png', 'alt' => $msg, 'title' => $msg));
+ }
+ }
+ }
+ }
+
$tr->appendElement('td')->appendElement('a', array('href' => $title->getLocalURL()))->appendText($title->getPrefixedText());
if ($wgWrReportMode != 'summer') {
else $date = strftime('%d.%m.', $date_report);
$td = $tr->appendElement('td');
- if (isset(WrReport::$wrConditions[$condition])) {
- $td->appendElement('a', array('href' => $title->getLocalURL() . '#' . Title::escapeFragmentForURL(wfMessage('wrreport-reports-sectionname')->text())))->appendText(WrReport::$wrConditions[$condition]);
+ if (in_array($condition, WrReport::$wrConditions)) {
+ $td->appendElement('a', array('href' => $title->getLocalURL() . '#' . Sanitizer::escapeIdForLink(wfMessage('wrreport-reports-sectionname'))))->appendText(WrReport::getWrConditionText($condition));
$td->appendText(' ');
$small = $td->appendElement('small');
$small->appendText($date);
if ($userMayReportThis) {
$small->appendText(' ');
- $small->appendElement('em')->appendElement('a', array('href' =>$title->getLocalURL() . '#' . Title::escapeFragmentForURL(wfMessage('wrreport-newreport-sectionname')->text())))->appendText(wfMessage('wrreport-newreport-new')->text());
+ $small->appendElement('em')->appendElement('a', array('href' =>$title->getLocalURL() . '#' . Sanitizer::escapeIdForLink(wfMessage('wrreport-newreport-sectionname'))))->appendText(wfMessage('wrreport-newreport-new')->text());
}
} else {
if ($userMayReportThis)
- $td->appendElement('small')->appendElement('em')->appendElement('a', array('href' =>$title->getLocalURL() . '#' . Title::escapeFragmentForURL(wfMessage('wrreport-newreport-sectionname')->text())))->appendText(wfMessage('wrreport-newreport-please')->text());
+ $td->appendElement('small')->appendElement('em')->appendElement('a', array('href' =>$title->getLocalURL() . '#' . Sanitizer::escapeIdForLink(wfMessage('wrreport-newreport-sectionname'))))->appendText(wfMessage('wrreport-newreport-please')->text());
else $td->appendText('--');
}
}
/// Kemater Alm
/// Axamer Lizum
/// </bahnentabelle>
- public static function bahnentabelleParserHook($input, $args, $parser) {
+ public static function bahnentabelleParserHook($input, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules('ext.wrreport');
// Add feed
/// <bahnenregiontabelle wiki="Innsbruck" /> (refers to region represented by the MediaWiki Title name)
/// <bahnenregiontabelle region_id="3" /> (refers to id in the wrregion table)
/// <bahnenregiontabelle region_name="Innsbruck" /> (refers to name in the wrregion table)
- public static function bahnenregiontabelleParserHook($input, $args, $parser) {
+ public static function bahnenregiontabelleParserHook($input, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules('ext.wrreport');
try {
// get titles that are in the region
$page_titles = array();
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
// the following line would work if MySQL 5.5 would implement a real geospatial version of CONTAINS.
// $res = $dbr->select('wrsledruncache', 'page_id', array('CONTAINS(GEOMFROMWKB(' . $dbr->addQuotes($region_border_wkb) . '), POINT(position_longitude, position_latitude))', 'NOT under_construction'), __METHOD__, 'page_title');
$res = $dbr->select(array('wrsledruncache', 'wrregioncache'), array('page_id' => 'wrregioncache.page_id'), array('wrregioncache.region_id' => $region_id, 'wrregioncache.page_id=wrsledruncache.page_id', 'NOT under_construction'), __METHOD__, 'page_title');
/// \brief Is called when the tag <rodelbahntabelle/> is encountered.
///
/// Description: See description of wrreport.php
- public static function rodelbahntabelleParserHook($input, $args, $parser) {
+ public static function rodelbahntabelleParserHook($input, array $args, Parser $parser, PPFrame $frame) {
$parser->getOutput()->addModules('ext.wrreport');
// Add feed
// Note: As (of MediaWiki 1.19), only one feed can be added and each feed added replaces the previous one, the following is possible without risk of having duplicated feed entries.
WrReport::addRegionFeedLink($parser->getTitle());
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
try {
libxml_use_internal_errors(true); // without that, we get PHP Warnings if the $input is not well-formed
try {
/// \brief Is called when the tag <avatar>username</avatar> is encountered.
- public static function avatarParserHook($input, $args, $parser, $frame) {
+ public static function avatarParserHook($input, array $args, Parser $parser, PPFrame $frame) {
$doc = new WrDOMDocument();
$sla = new WrServicesLibravatar();
}
+ public static function MobileMenuHook($name, \MediaWiki\Minerva\MenuBuilder &$menu) {
+ if ($name === 'discovery') {
+ // delete "Random page". As a removeEntry function is missing,
+ // a new menu is built here without the random page.
+ $new_menu = new \MediaWiki\Minerva\MenuBuilder();
+ foreach ($menu->getEntries() as $menuEntryRepresentation) {
+ $new_entry_name = $menuEntryRepresentation['name'];
+ if ($new_entry_name == 'random') continue;
+ $new_entry_components = $menuEntryRepresentation['components'];
+ $new_entry_isjsonly = isset($menuEntryRepresentation['class']) and $menuEntryRepresentation['class'] === 'jsonly';
+ $new_entry = $new_menu->insert($new_entry_name, $new_entry_isjsonly);
+ foreach ($new_entry_components as $new_entry_component) {
+ $label = $new_entry_component['text'];
+ $url = $new_entry_component['href'];
+ $className = $new_entry_component['class'];
+ $new_entry->addComponent($label, $url, $className, $new_entry_components);
+ }
+ }
+ $menu = $new_menu;
+
+ // add region menu entry
+ $icon = MobileUI::iconClass('random', 'before');
+ $title = Title::newFromText('Region', NS_CATEGORY);
+ $menu->insert('region')->addComponent('Regionen', $title->getLocalURL(), $icon, array('id' => 'regionButton', 'data-event-name' => 'region'));
+ }
+ }
}
-WrReport::initWrConditions();
}
- static function LanguageGetSpecialPageAliasesHook(&$specialPageArray, $languageCode) {
- $text = wfMessage('wrreport')->text(); // 'Bahnberichte'
- $title = Title::newFromText($text); // 'Bahnberichte'
- $specialPageArray['wrreport'][] = $title->getDBKey(); // 'Bahnberichte'
- return true;
- }
-
-
-
/// \param $par Possibilities:
/// - action == 'view' (default)
/// - action == 'preview': Preview new report
$output = $this->getOutput();
global $wgParser;
+ $output->addWikiText(''); // this is necessary because otherwise $wgParser is not properly initialized
$output->addModules('ext.wrreport');
$this->setHeaders();
$rows = wrReportGetReports($conditions);
if (count($rows) == 0) $output->addHTML(wfMessage('wrreport-reports-none')->text());
else {
- $output->addWikiText(''); // this is necessary because otherwise $wgParser is not properly initialized but $wgParser is needed in the next line
$output->addHTML(wrReportTableRender($rows, WRREPORT_DETAIL, wrReportUserMayDelete(), $wgParser));
}
}
$output->addWikiText(wfMessage('wrreport-deletereport-success', '[[' . $row['page_title'] . '#' . wfMessage('wrreport-reports-sectionname')->text() . '|' . $row['page_title'] . ']]')->text());
}
if ($action == 'deletepreview') {
- $output->addWikiText(wfMessage('wrreport-deletereport-preview-before')->text());
+ $output->addWikiMsg('wrreport-deletereport-preview-before');
$format = WRREPORT_COMPACT_PAGE;
$output->addHTML(wrReportTableRender(array($row), $format, FALSE, $wgParser));
- $output->addWikiText(wfMessage('wrreport-deletereport-preview-after')->text());
+ $output->addWikiMsg('wrreport-deletereport-preview-after');
$row['delete_date'] = date('c');
$row['delete_reason_public'] = $delete_reason_public;
$row['delete_person_name'] = $delete_person_name;
$row['delete_invisible'] = $delete_invisible;
$output->addHTML(wrReportTableRender(array($row), $format, FALSE, $wgParser));
- $output->addWikiText(wfMessage('wrreport-deletereport-preview-form')->text());
+ $output->addWikiMsg('wrreport-deletereport-preview-form');
$output->addHTML(wrDeleteReportFormRender($reportid, $delete_person_name, $delete_reason_public, $delete_invisible));
- $output->addWikiText(wfMessage('wrreport-deletereport-preview-bottom')->text());
+ $output->addWikiMsg('wrreport-deletereport-preview-bottom');
}
}
// Chech whether identical reports are present
if (!$errorMsg) {
- $dbr = wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_REPLICA);
$cond = 'condition';
global $wgDBtype;
if ($wgDBtype == "mysql") $cond = "`$cond`"; // "condition" is a reserved word in mysql
// $output->redirect($title->getFullURL() . '#' . wfMessage('wrreport-reports-sectionname')->text());
}
if ($action == 'preview') {
- $output->addWikiText(wfMessage('wrreport-newreport-preview-top')->text());
+ $output->addWikiMsg('wrreport-newreport-preview-top');
$format = WRREPORT_COMPACT_PAGE;
$row = array_fill_keys(wrReportGetColumnNames(), NULL);
$row['page_id'] = $page_id;
$row['author_username'] = $author_username;
$output->addHTML(wrReportTableRender(array($row), $format, FALSE, $wgParser));
- $output->addWikiText(wfMessage('wrreport-newreport-preview-middle')->text());
+ $output->addWikiMsg('wrreport-newreport-preview-middle');
$output->addHTML(wrReportFormRender(FALSE, $page_title, $date_report, $time_report, $condition, $description, $author_name));
- $output->addWikiText(wfMessage('wrreport-newreport-preview-bottom')->text());
+ $output->addWikiMsg('wrreport-newreport-preview-bottom');
if ($wgUser->isLoggedIn())
- $output->addWikiText(wfMessage('wrreport-newreport-preview-bottom-loggedin')->text());
+ $output->addWikiMsg('wrreport-newreport-preview-bottom-loggedin');
else
- $output->addWikiText(wfMessage('wrreport-newreport-preview-bottom-anonymous')->text());
+ $output->addWikiMsg('wrreport-newreport-preview-bottom-anonymous');
}
}