From: Jens Frank Date: Thu, 19 Aug 2004 11:26:44 +0000 (+0000) Subject: Show list of templates used by this page at the end of the EditPage. Bugzilla#143 X-Git-Tag: 1.5.0alpha1~2297 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/supprimer.php?a=commitdiff_plain;h=4fc9a17db0d2c5ea2be19c891bdd3ee98aba59ae;p=lhc%2Fweb%2Fwiklou.git Show list of templates used by this page at the end of the EditPage. Bugzilla#143 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index b694b565fe..bd391efcb6 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -311,7 +311,7 @@ class EditPage { $prev = wfMsg( "showpreview" ); $cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedText(), - wfMsg( "cancel" ) ); + wfMsg( "cancel" ) ); $edithelpurl = $sk->makeUrl( wfMsg( 'edithelppage' )); $edithelp = ''. htmlspecialchars( wfMsg( 'edithelp' ) ).' '. @@ -324,7 +324,7 @@ class EditPage { $wgRightsText ) . "\n"; if( $wgUser->getOption("showtoolbar") and !$isCssJsSubpage ) { - # prepare toolbar for edit buttons +# prepare toolbar for edit buttons $toolbar = $sk->getEditToolbar(); } else { $toolbar = ""; @@ -345,35 +345,35 @@ class EditPage { if ( 0 != $wgUser->getID() || $wgAllowAnonymousMinor ) { $minoredithtml = - "minoredit?" checked='checked'":""). - " accesskey='".wfMsg('accesskey-minoredit')."' id='wpMinoredit' />". - ""; + "minoredit?" checked='checked'":""). + " accesskey='".wfMsg('accesskey-minoredit')."' id='wpMinoredit' />". + ""; } $watchhtml = ""; if ( 0 != $wgUser->getID() ) { $watchhtml = "watchthis?" checked='checked'":""). - " accesskey='".wfMsg('accesskey-watch')."' id='wpWatchthis' />". - ""; + " accesskey='".wfMsg('accesskey-watch')."' id='wpWatchthis' />". + ""; } $checkboxhtml = $minoredithtml . $watchhtml . "
"; if ( "preview" == $formtype) { $previewhead="

" . wfMsg( "preview" ) . "

\n

" . - wfMsg( "note" ) . wfMsg( "previewnote" ) . "

\n"; + wfMsg( "note" ) . wfMsg( "previewnote" ) . "

\n"; if ( $isConflict ) { $previewhead.="

" . wfMsg( "previewconflict" ) . - "

\n"; + "\n"; } $parserOptions = ParserOptions::newFromUser( $wgUser ); $parserOptions->setUseCategoryMagic( false ); $parserOptions->setEditSection( false ); $parserOptions->setEditSectionOnRightClick( false ); - # don't parse user css/js, show message about preview - # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here +# don't parse user css/js, show message about preview +# XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here if ( $isCssJsSubpage ) { if(preg_match("/\\.css$/", $wgTitle->getText() ) ) { $previewtext = wfMsg('usercsspreview'); @@ -384,7 +384,7 @@ class EditPage { $wgOut->addHTML( $parserOutput->mText ); } else { $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $this->textbox1 ) ."\n\n", - $wgTitle, $parserOptions ); + $wgTitle, $parserOptions ); $previewHTML = $parserOutput->mText; if($wgUser->getOption("previewontop")) { @@ -397,21 +397,39 @@ class EditPage { } } - # if this is a comment, show a subject line at the top, which is also the edit summary. - # Otherwise, show a summary field at the bottom +# if this is a comment, show a subject line at the top, which is also the edit summary. +# Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars( $wgLang->recodeForEdit( $this->summary ) ); # FIXME - if( $this->section == "new" ) { - $commentsubject="{$subject}:
"; - $editsummary = ""; - } else { - $commentsubject = ""; - $editsummary="{$summary}:
"; - } + if( $this->section == "new" ) { + $commentsubject="{$subject}:
"; + $editsummary = ""; + } else { + $commentsubject = ""; + $editsummary="{$summary}:
"; + } if( !$this->preview ) { - # Don't select the edit box on preview; this interferes with seeing what's going on. + # Don't select the edit box on preview; this interferes with seeing what's going on. $wgOut->setOnloadHandler( "document.editform.wpTextbox1.focus()" ); } + # Prepare a list of templates used by this page + $db =& wfGetDB( DB_SLAVE ); + $cur = $db->tableName( 'cur' ); + $links = $db->tableName( 'links' ); + $id = $this->mTitle->getArticleID(); + $sql = "SELECT cur_namespace,cur_title,cur_id ". + "FROM $cur,$links WHERE l_to=cur_id AND l_from={$id} and cur_namespace=".NS_TEMPLATE; + $res = $db->query( $sql, "EditPage::editform" ); + + if ( $db->numRows( $res ) ) { + $templates = '
'. wfMsg( 'templatesused' ) . ''; + } $wgOut->addHTML( " {$toolbar}
recodeForEdit( $this->textbox1 ) ) . " title=\"".wfMsg('tooltip-save')."\"/> -{$cancel} | {$edithelp}" ); +{$cancel} | {$edithelp}{$templates}" ); $wgOut->addWikiText( $copywarn ); $wgOut->addHTML( " section ) . "\" name=\"wpSection\" />