r63496 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63495‎ | r63496 | r63497 >
Date:19:47, 9 March 2010
Author:yaron
Status:deferred (Comments)
Tags:
Comment:
Added backwards-compatibility for MW < 1.13; 'AddData' and 'EditData' changed to 'FormEdit'; 'cancel' link now just sends user back to previous page they were on, which should be the much better solution
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc
@@ -517,7 +517,8 @@
518518 * Helper function to display a simple button
519519 */
520520 static function buttonHTML($values) {
521 - $button_html = Xml::element('input', $values, '');
 521+ // for backwards-compatibility with pre-1.13 MW
 522+ $button_html = function_exists("Xml::element") ? Xml::element('input', $values, '') : wfElement('input', $values, '');
522523 return " $button_html\n";
523524 }
524525
@@ -589,18 +590,11 @@
590591 $label = wfMsgExt('cancel', array('parseinline'));
591592 if ($wgTitle == null)
592593 $cancel = '';
593 - // if this is the special 'AddData' or 'EditData' page, get
594 - // the form name, and link to 'AddPage' with that form name
595 - elseif (($wgTitle->getText() == 'AddData' || $wgTitle->getText() == 'EditData')
 594+ // if we're on the special 'FormEdit' page, just send the user
 595+ // back to the previous page they were on
 596+ elseif ($wgTitle->getText() == 'FormEdit'
596597 && $wgTitle->getNamespace() == NS_SPECIAL) {
597 - global $wgRequest;
598 - $title_components = split('/', $wgRequest->getVal('title'));
599 - if (count($title_components) >= 2) {
600 - $add_page_title = Title::makeTitleSafe(NS_SPECIAL, 'AddPage');
601 - $cancel = $sk->makeKnownLink($add_page_title->getPrefixedText() . '/' . $title_components[1], $label);
602 - } else {
603 - $cancel = '';
604 - }
 598+ $cancel = '<a href="javascript:history.go(-1);">' . $label . '</a>';
605599 } else
606600 $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(), $label);
607601 $text = " <span class='editHelp'>$cancel</span>\n";

Comments

#Comment by 😂 (talk | contribs)   20:03, 9 March 2010

Ugh, I don't know why you're using 1.13-compatible code in trunk, this is why we branch extensions with releases. I just removed this sort of back-compat code in r63346.

#Comment by Yaron K. (talk | contribs)   21:56, 9 March 2010

Alright, I hadn't realized that MW < 1.13 was no longer being supported. I reverted that change.

Status & tagging log