- /**
- * an array of edit links by default used for the tabs
- */
- function buildContentActionUrls () {
- global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
- $action = $wgRequest->getText( 'action' );
- $section = $wgRequest->getText( 'section' );
- $oldid = $wgRequest->getVal( 'oldid' );
- $diff = $wgRequest->getVal( 'diff' );
- $content_actions = array();
-
- if( $this->iscontent ) {
-
- $nskey = $this->getNameSpaceKey();
- $is_active = !Namespace::isTalk( $wgTitle->getNamespace()) ;
- if ( $action == 'validate' ) $is_active = false ; # Show article tab deselected when validating
- $content_actions[$nskey] = array('class' => ($is_active) ? 'selected' : false,
- 'text' => wfMsg($nskey),
- 'href' => $this->makeArticleUrl($this->thispage));
-
- /* set up the classes for the talk link */
- $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : false);
- $talktitle = Title::newFromText( $this->titletxt );
- $talktitle = $talktitle->getTalkPage();
- $this->checkTitle($talktitle, $this->titletxt);
- if($talktitle->getArticleId() != 0) {
- $content_actions['talk'] = array(
- 'class' => $talk_class,
- 'text' => wfMsg('talk'),
- 'href' => $this->makeTalkUrl($this->titletxt)
- );
- } else {
- $content_actions['talk'] = array(
- 'class' => $talk_class?$talk_class.' new':'new',
- 'text' => wfMsg('talk'),
- 'href' => $this->makeTalkUrl($this->titletxt,'action=edit')
- );
- }
-
- if ( $wgTitle->userCanEdit() ) {
- $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.$oldid : false;
- $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
- $istalkclass = $istalk?' istalk':'';
- $content_actions['edit'] = array(
- 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
- 'text' => wfMsg('edit'),
- 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid)
- );
- if ( $istalk ) {
- $content_actions['addsection'] = array(
- 'class' => $section == 'new'?'selected':false,
- 'text' => wfMsg('addsection'),
- 'href' => $this->makeUrl($this->thispage, 'action=edit§ion=new')
- );
- }
- } else {
- $oid = ( $oldid && ! isset( $diff ) ) ? '&oldid='.$oldid : '';
- $content_actions['viewsource'] = array('class' => ($action == 'edit') ? 'selected' : false,
- 'text' => wfMsg('viewsource'),
- 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid));
- }
-
- if ( $wgTitle->getArticleId() ) {
-
- $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : false,
- 'text' => wfMsg('history_short'),
- 'href' => $this->makeUrl($this->thispage, 'action=history'));
-
- # XXX: is there a rollback action anywhere or is it planned?
- # Don't recall where i got this from...
- /*if( $wgUser->getNewtalk() ) {
- $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : false,
- 'text' => wfMsg('rollback_short'),
- 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
- 'ttip' => wfMsg('tooltip-rollback'),
- 'akey' => wfMsg('accesskey-rollback'));
- }*/
-
- if($wgUser->isSysop()){
- if(!$wgTitle->isProtected()){
- $content_actions['protect'] = array(
- 'class' => ($action == 'protect') ? 'selected' : false,
- 'text' => wfMsg('protect'),
- 'href' => $this->makeUrl($this->thispage, 'action=protect')
- );
-
- } else {
- $content_actions['unprotect'] = array(
- 'class' => ($action == 'unprotect') ? 'selected' : false,
- 'text' => wfMsg('unprotect'),
- 'href' => $this->makeUrl($this->thispage, 'action=unprotect')
- );
- }
- $content_actions['delete'] = array(
- 'class' => ($action == 'delete') ? 'selected' : false,
- 'text' => wfMsg('delete'),
- 'href' => $this->makeUrl($this->thispage, 'action=delete')
- );
- }
- if ( $wgUser->getID() != 0 ) {
- if ( $wgTitle->userCanEdit()) {
- $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : false,
- 'text' => wfMsg('move'),
- 'href' => $this->makeSpecialUrl('Movepage', 'target='. urlencode( $this->thispage ))
- );
- } else {
- $content_actions['move'] = array('class' => 'inactive',
- 'text' => wfMsg('move'),
- 'href' => false);
-
- }
- }
- } else {
- //article doesn't exist or is deleted
- if($wgUser->isSysop()){
- if( $n = $wgTitle->isDeleted() ) {
- $content_actions['delete'] = array(
- 'class' => false,
- 'text' => wfMsg( "undelete_short", $n ),
- 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage)
- );
- }
- }
- }
-
- if ( $wgUser->getID() != 0 and $action != 'submit' ) {
- if( !$wgTitle->userIsWatching()) {
- $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
- 'text' => wfMsg('watch'),
- 'href' => $this->makeUrl($this->thispage, 'action=watch'));
- } else {
- $content_actions['unwatch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false,
- 'text' => wfMsg('unwatch'),
- 'href' => $this->makeUrl($this->thispage, 'action=unwatch'));
- }
- }
-
- # Show validate tab
- if ( $wgUseValidation && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
- global $wgArticle ;
- $article_time = "×tamp=" . $wgArticle->mTimestamp ;
- $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false ,
- 'text' => wfMsg('val_tab'),
- 'href' => $this->makeUrl($this->thispage, 'action=validate'.$article_time));
- }
-
- } else {
- /* show special page tab */
-
- $content_actions['article'] = array('class' => 'selected',
- 'text' => wfMsg('specialpage'),
- 'href' => false);