Kipcool has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/62240


Change subject: code cleaning * getting read of some wgTitle * removed some 
unused functions
......................................................................

code cleaning
* getting read of some wgTitle
* removed some unused functions

Change-Id: Ia64240784006e9d1ba309f4f104aad3455cddd6c
---
M OmegaWiki/OmegaWiki.php
M OmegaWiki/Wikidata.php
2 files changed, 25 insertions(+), 48 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiLexicalData 
refs/changes/40/62240/1

diff --git a/OmegaWiki/OmegaWiki.php b/OmegaWiki/OmegaWiki.php
index 7752bb9..b1317a1 100644
--- a/OmegaWiki/OmegaWiki.php
+++ b/OmegaWiki/OmegaWiki.php
@@ -20,29 +20,28 @@
  */
 class OmegaWiki extends DefaultWikidataApplication {
        public function view() {
-               global $wgOut, $wgTitle;
+               global $wgOut;
 
+               // some initializations, including viewInformation
                parent::view();
+
+               // adds dataset panel, if activated
                $this->outputViewHeader();
 
-               $spelling = $wgTitle->getText();
+               $spelling = $this->getTitle()->getText();
                if ( existSpelling ( $spelling ) ) {
                        $recordset = getExpressionsRecordSet( $spelling, 
$this->viewInformation );
-                       $wgOut->addHTML(
-                               getExpressionsEditor( $spelling, 
$this->viewInformation )->view(
-                                       $this->getIdStack(),
-                                       $recordset
-                               )
-                       );
+                       $editor = getExpressionsEditor( $spelling, 
$this->viewInformation );
+                       $wgOut->addHTML( $editor->view( $this->getIdStack(), 
$recordset ) );
                }
        }
 
        public function history() {
-               global $wgOut, $wgTitle;
+               global $wgOut;
 
                parent::history();
 
-               $spelling = $wgTitle->getText();
+               $spelling = $this->getTitle()->getText();
 
                $wgOut->addHTML(
                        getExpressionsEditor( $spelling, $this->viewInformation 
)->view(
@@ -53,11 +52,10 @@
        }
 
        protected function save( $referenceQueryTransactionInformation ) {
-               global $wgTitle;
 
                parent::save( $referenceQueryTransactionInformation );
 
-               $spelling = $wgTitle->getText();
+               $spelling = $this->getTitle()->getText();
                
                getExpressionsEditor( $spelling, $this->viewInformation )->save(
                        $this->getIdStack(),
@@ -66,14 +64,14 @@
        }
 
        public function edit() {
-               global $wgOut, $wgTitle, $wgUser;
+               global $wgOut, $wgUser;
 
                if ( !parent::edit() ) {
                        return false;
                }
                $this->outputEditHeader();
 
-               $spelling = $wgTitle->getText();
+               $spelling = $this->getTitle()->getText();
 
                $wgOut->addHTML(
                        getExpressionsEditor( $spelling, $this->viewInformation 
)->edit(
@@ -83,17 +81,6 @@
                );
 
                $this->outputEditFooter();
-       }
-       
-       public function getTitle() {
-               global $wgTitle, $wgUseExpressionPageTitlePrefix;
-       
-               if ( $wgUseExpressionPageTitlePrefix ) {
-                       $title = wfMsg( 'ow_Multiple_meanings', 
$wgTitle->getText() );
-               } else {
-                       $title  = $wgTitle->getText();
-               }
-               return $title;
        }
 
        protected function getIdStack() {
diff --git a/OmegaWiki/Wikidata.php b/OmegaWiki/Wikidata.php
index e859525..28612ec 100644
--- a/OmegaWiki/Wikidata.php
+++ b/OmegaWiki/Wikidata.php
@@ -28,11 +28,12 @@
 
                $this->title = $title;
 
-               if ( isset( $wgShowClassicPageTitles ) )
+               if ( isset( $wgShowClassicPageTitles ) ) {
                        $this->showClassicPageTitles = $wgShowClassicPageTitles;
-                       
-               if ( isset( $wgPropertyToColumnFilters ) )
+               }
+               if ( isset( $wgPropertyToColumnFilters ) ) {
                        $this->propertyToColumnFilters = 
$wgPropertyToColumnFilters;
+               }
        }
 
        public function getTitle() {
@@ -43,22 +44,23 @@
                global
                        $wgOut;
                
-               if ( $this->showDataSetPanel )
+               if ( $this->showDataSetPanel ) {
                        $wgOut->addHTML( $this->getDataSetPanel() );
+               }
        }
 
        public function view() {
                global $wgOut, $wgUser;
 
-               $wgOut->enableClientCache( false );
+               $wgOut->enableClientCache( true );
 
-               $title = $this->title->getPrefixedText();
+               $myTitle = $this->title->getPrefixedText();
 
                if ( !$this->showClassicPageTitles ) {
-                       $title = $this->title;
+                       $myTitle = $this->title;
                }
 
-               $wgOut->setPageTitle( $title );
+               $wgOut->setPageTitle( $myTitle );
 
                $this->queryTransactionInformation = new 
QueryLatestTransactionInformation();
                
@@ -69,8 +71,9 @@
                
                $this->viewInformation = $viewInformation;
 
-               initializeOmegaWikiAttributes( $viewInformation );
-               initializeObjectAttributeEditors( $viewInformation );
+               // Not clear why this is here. Works well without.
+               // initializeOmegaWikiAttributes( $viewInformation );
+               // initializeObjectAttributeEditors( $viewInformation );
        }
        
        protected function getDataSetPanel() {
@@ -122,19 +125,6 @@
                $this->title->invalidateCache();
 
                // Add change to RC log
-/*
-
-               if ( $wgTitle->getNamespace() == NS_DEFINEDMEANING ) {
-                       // for definedmeaning, append a corresponding 
expression to look nicer in RC
-                       $definedMeaningId = (int)$wgTitle->getText();
-
-                       $expression = 
-               } else {
-                       RecentChange::notifyEdit( $now, $wgTitle, false, 
$wgUser, $summary, 0, $now, false, '', 0, 0, 0 );
-               }
-
-$title = $this->getTitle();
-*/
                $now = wfTimestampNow();
                RecentChange::notifyEdit( $now, $this->title, false, $wgUser, 
$summary, 0, $now, false );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/62240
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia64240784006e9d1ba309f4f104aad3455cddd6c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Kipcool <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to