-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
laurent wrote:
Marco Rota wrote:
That's close, but not quite it. As I understand, this Inputbox extension
allows the reading of one textbox, and then applies its content to
either name a new page creation, add comments, or search. I love the
idea, and i'll probably implement this for searching and for comments
addition. Unfortunately, it only uses one box, so I can't put like 20 of
these with one "Submit" button that would mash it all up and create one
page with the 20 fields...
Thanks for the tip though.
Laurent
You can create "Template:Initial page" which includes the content of the
page when just created, and "Template:Initial page instructions" which
includes instructions above the editing area, then you can edit
Linker::makeBrokenLinkObj (includes/Linker.php) and replace both
"action=edit" with
"action=edit&preload=Template:Initial_page&editintro=Template:Initial_page_instructions".
It should work then in every broken link shown, even to talk pages, but
you can check "!$title->isTalkPage()", or even better
"$title->getNamespace() == NS_MAIN", then add these parts only if true.
For example, the original code is:
if ( '' == $query ) {
$q = 'action=edit';
} else {
$q = 'action=edit&'.$query;
}
$u = $nt->escapeLocalURL( $q );
You can replace it with:
$q2 = ($title->getNamespace() == "NS_MAIN") ?
'&preload=Template:Initial_page&editintro=Template:Initial_page_instructions'
: '';
if ( '' == $query ) {
$q = 'action=edit'.$q2;
} else {
$q = 'action=edit'.$q2.'&'.$query;
}
$u = $nt->escapeLocalURL( $q );
Please note that you have to re-insert the code in every time updating
the MediaWiki system. Alternatively, you can create a new hook,
something like:
wfRunHooks( 'BrokenLinkQuery', array( &$query, &$title ) );
if ( '' == $query ) {
$q = 'action=edit';
} else {
$q = 'action=edit&'.$query;
}
$u = $nt->escapeLocalURL( $q );
and add in LocalSettings.php something like:
$wgHooks['BrokenLinkQuery'][] = 'AddEditParameters';
function AddEditParameters ( $query, $title ) {
if ($title->getNamespace() == "NS_MAIN") {
$q =
'preload=Template:Initial_page&editintro=Template:Initial_page_instructions';
if ( '' == $query ) {
$query = $q;
} else {
$query = $q.'&'.$query;
}
}
}
Then you should re-add only the single line of the hook when upgrading
the code, instead of copying a whole piece of code.
I haven't checked all of these codes, so they may produce errors.
All of the example codes will add parameters to broken links, and should
the preloaded content and the edit instructions only when editing new
pages in the main namespace.
- --
#define Name RotemLiss
#define Mail mailSTRUDELrotemlissDOTcom
#define Site
www.rotemliss.com
#define KeyFingerPrint 4AFD 8579 A449 4267 BED9 38E5 6EF8 5B1F EBDE 7AC0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFEkAosbvhbH+veesARAomlAKCMk67dfpxWEW75kfgAhYbZIlokXwCg1OaO
IuPmCxh3R53jx9xU48jGdGA=
=pqqy
-----END PGP SIGNATURE-----