r85568 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85567‎ | r85568 | r85569 >
Date:20:02, 6 April 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
fix (workaround) for save and continue function where wgPageName contains the PageName incl. subpage names
Modified paths:
  • /trunk/extensions/SemanticForms/libs/SF_submit.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/libs/SF_submit.js
@@ -121,9 +121,15 @@
122122 var stop = url.indexOf("?");
123123 if ( stop > 0 ) url = url.substring(0, stop);
124124
125 - var start = url.indexOf( wgPageName ) + String(wgPageName).length + 1;
126 - stop = url.indexOf("/", start);
 125+ var start = url.indexOf( wgPageName ); // find start of page name
 126+ start = url.indexOf("/", start) + 1; // find start of subpage
127127
 128+ if ( start >= 0 ) {
 129+ stop = url.indexOf("/", start); // find end of first subpage
 130+ } else {
 131+ stop = -1;
 132+ }
 133+
128134 if (stop >= 0) {
129135 params += "&form=" + encodeURIComponent( url.substring(start, stop) );
130136