Page MenuHomePhabricator

Template for New Articles
Closed, ResolvedPublic

Description

Author: mribeiro

Description:
This patch enables support for the use of Templates for New
Articles.
It does check if it is a New Article (and not a preview) and
can be enabled/disabled in LocalSettings.php.

This is a diff from my local CVS wiki (original version) to
the installed one.

RCS file: /usr/cvs/wiki/includes/EditPage.php,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 EditPage.php
404a405,418

$articletemplate = '';
/* Checking if its a new article and it is not a

preview */

if(!$this->mTitle->getArticleID() && $formtype !

'preview'){ # new article

/*
 * Yes, it is a new article.
 * Checking if should get data from template and if

template file exists

*/
global $wgUseArticleTemplate;
global $wgArticleTemplateFile;
if($wgUseArticleTemplate && is_readable

($wgArticleTemplateFile)){

$articletemplate = implode('', file

($wgArticleTemplateFile));

  }
}

412c426
< htmlspecialchars( $wgLang->recodeForEdit( $this-

>textbox1 ) ) .

htmlspecialchars( $wgLang->recodeForEdit(

$articletemplate . $this->textbox1 ) ) .
424a439

unset($articletemplate);

RCS file: /usr/cvs/wiki/LocalSettings.php,v
retrieving revision 1.2
diff -r1.2 LocalSettings.php
102a103,105

$wgUseArticleTemplate = true;
$wgArticleTemplateFile = 'templates/templatetoedit.txt';

Above are the entries used in LocalSettings.php.
$wgUseArticleTemplate is a boolean (true/false) which
enables/disables the support for Article Templates usage.
$wgArticleTemplateFile is the file which will be automaticly
loaded in New Article's textarea edition space.

I hope this helps somebody. :)


Version: 1.3.x
Severity: enhancement
URL: http://meta.wikimedia.org/wiki/Help:Inputbox#par_preload

Details

Reference
bz1045
TitleReferenceAuthorSource BranchDest Branch
Refactor handling of version ranges by ReleaseDetailsCustomFieldrepos/phabricator/extensions!25dduvallreview/T304540wmf/stable
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:06 PM
bzimport set Reference to bz1045.
bzimport added a subscriber: Unknown Object (MLST).

zigger wrote:

*** Bug 1259 has been marked as a duplicate of this bug. ***

fabian.zeindl wrote:

Is there a way to include the template in the database?

rowan.collins wrote:

See also the slightly different solution at bug 2286

*** This bug has been marked as a duplicate of 2286 ***