- # Don't select the edit box on preview; this interferes with seeing what's going on.
- $wgOut->setOnloadHandler( "document.editform.wpTextbox1.focus()" );
+ # 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 = '<br />'. wfMsg( 'templatesused' ) . '<ul>';
+ while ( $row = $db->fetchObject( $res ) ) {
+ if ( $titleObj = Title::makeTitle( $row->cur_namespace, $row->cur_title ) ) {
+ $templates .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ }
+ }
+ $templates .= '</ul>';
+ } else {
+ $templates = '';