r19814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19813‎ | r19814 | r19815 >
Date:11:33, 7 February 2007
Author:proes
Status:old
Tags:
Comment:
Now, one can configure the position of the authoritative contribution filter panel by two globals: $wgShowAuthoritativeContributionPanelAtBottom and $wgShowAuthoritativeContributionPanelAtTop. The panel can be placed at the top of a page, at the bottom of a page or at both.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php
@@ -11,6 +11,8 @@
1212
1313 parent::view();
1414
 15+ $this->outputViewHeader();
 16+
1517 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
1618
1719 $wgOut->addHTML(
@@ -26,8 +28,7 @@
2729 )
2830 );
2931
30 - $wgOut->addHTML(DefaultEditor::getExpansionCss());
31 - $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>");
 32+ $this->outputViewFooter();
3233 }
3334
3435 public function edit() {
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -152,5 +152,12 @@
153153
154154 $wgDefinedMeaningPageTitlePrefix = "";
155155 $wgExpressionPageTitlePrefix = "Multiple meanings";
 156+
 157+global
 158+ $wgShowAuthoritativeContributionPanelAtBottom,
 159+ $wgShowAuthoritativeContributionPanelAtTop;
156160
 161+$wgShowAuthoritativeContributionPanelAtBottom = false;
 162+$wgShowAuthoritativeContributionPanelAtTop = true;
 163+
157164 ?>
\ No newline at end of file
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -17,6 +17,8 @@
1818 protected $queryTransactionInformation;
1919 protected $viewQueryTransactionInformation;
2020 protected $shouldShowAuthorities;
 21+ protected $showCommunityContribution;
 22+ protected $authoritiesToShow;
2123
2224 // The following member variables control some application specific preferences
2325 protected $availableAuthorities = array(); // A map containing (userId => displayName) combination for authoritative contribution view
@@ -68,53 +70,78 @@
6971 return wfMsg('wz_uilang',"<b>$userlang</b>"). " &mdash; " . $skin->makeLink("Special:Preferences", wfMsg('wz_uilang_set'));
7072 }
7173
 74+ protected function outputAuthoritativeContributionPanel() {
 75+ global
 76+ $wgOut;
 77+
 78+ if (count($this->availableAuthorities) > 0) {
 79+ $authorityOptions = array(
 80+ "Show contribution by the community" => getCheckBox('authority-community', $this->showCommunityContribution)
 81+ );
 82+
 83+ foreach ($this->availableAuthorities as $authorityId => $authorityName)
 84+ $authorityOptions["Show contribution by " . $authorityName] =
 85+ getCheckBox(
 86+ 'authority-' . $authorityId,
 87+ in_array($authorityId, $this->authoritiesToShow)
 88+ );
 89+
 90+ $wgOut->addHTML(getOptionPanel($authorityOptions));
 91+ }
 92+ }
 93+
 94+ protected function outputViewHeader() {
 95+ global
 96+ $wgOut, $wgShowAuthoritativeContributionPanelAtTop;
 97+
 98+ if ($this->showLanguageSelector)
 99+ $wgOut->addHTML($this->getLanguageSelector());
 100+
 101+ if ($wgShowAuthoritativeContributionPanelAtTop)
 102+ $this->outputAuthoritativeContributionPanel();
 103+ }
 104+
 105+ protected function outputViewFooter() {
 106+ global
 107+ $wgOut, $wgShowAuthoritativeContributionPanelAtBottom;
 108+
 109+ if ($wgShowAuthoritativeContributionPanelAtBottom)
 110+ $this->outputAuthoritativeContributionPanel();
 111+
 112+ $wgOut->addHTML(DefaultEditor::getExpansionCss());
 113+ $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>");
 114+ }
 115+
72116 public function view() {
73117 global
74118 $wgOut, $wgTitle;
75119
76120 $wgOut->enableClientCache(false);
77 -
 121+
78122 $title = $wgTitle->getPrefixedText();
79123
80 - if (!$this->showClassicPageTitles) {
81 - $title = $this->getTitle()->getText();
82 - }
 124+ if (!$this->showClassicPageTitles)
 125+ $title = $this->getTitle();
83126
84127 $wgOut->setPageTitle($title);
85128
86 - if ($this->showLanguageSelector)
87 - $wgOut->addHTML($this->getLanguageSelector());
88 -
89 - $this->shouldShowAuthorities = count($this->availableAuthorities) > 0;
90 -
91 - if ($this->shouldShowAuthorities) {
92 - $showCommunityContribution = isset($_GET['authority-community']);
 129+ if (count($this->availableAuthorities) > 0) {
 130+ $this->showCommunityContribution = isset($_GET['authority-community']);
 131+ $this->authoritiesToShow = array();
93132
94 - $authoritiesToShow = array();
95 - $authorityOptions = array(
96 - "Show contribution by the community" => getCheckBox('authority-community', $showCommunityContribution)
97 - );
98 -
99 - foreach($this->availableAuthorities as $authorityId => $authorityName) {
100 - $showAuthority = isset($_GET['authority-' . $authorityId]);
101 -
102 - if ($showAuthority)
103 - $authoritiesToShow[] = $authorityId;
104 -
105 - $authorityOptions["Show contribution by " . $authorityName] = getCheckBox('authority-' . $authorityId, $showAuthority);
106 - }
107 -
108 - $wgOut->addHTML(getOptionPanel($authorityOptions));
 133+ foreach ($this->availableAuthorities as $authorityId => $authorityName)
 134+ if (isset($_GET['authority-' . $authorityId]))
 135+ $this->authoritiesToShow[] = $authorityId;
109136 }
110137 else
111 - $showCommunityContribution = false;
 138+ $this->showCommunityContribution = false;
112139
113 - $this->shouldShowAuthorities = count($authoritiesToShow) > 0 || $showCommunityContribution;
 140+ $this->shouldShowAuthorities = count($this->authoritiesToShow) > 0 || $this->showCommunityContribution;
114141 initializeOmegaWikiAttributes($this->filterLanguageId != 0, $this->shouldShowAuthorities);
115142 initializeObjectAttributeEditors($this->filterLanguageId, false, $this->shouldShowAuthorities);
116143
117144 if ($this->shouldShowAuthorities)
118 - $this->viewQueryTransactionInformation = new QueryAuthoritativeContributorTransactionInformation($this->availableAuthorities, $authoritiesToShow, $showCommunityContribution);
 145+ $this->viewQueryTransactionInformation = new QueryAuthoritativeContributorTransactionInformation($this->availableAuthorities, $this->authoritiesToShow, $this->showCommunityContribution);
119146 else
120147 $this->viewQueryTransactionInformation = new QueryLatestTransactionInformation();
121148 }
@@ -159,9 +186,8 @@
160187
161188 $title = $wgTitle->getPrefixedText();
162189
163 - if (!$this->showClassicPageTitles) {
164 - $title = $this->getTitle()->getText();
165 - }
 190+ if (!$this->showClassicPageTitles)
 191+ $title = $this->getTitle();
166192
167193 $wgOut->setPageTitle(wfMsg('wz_history',$title));
168194
@@ -203,9 +229,8 @@
204230
205231 $title = $wgTitle->getPrefixedText();
206232
207 - if (!$this->showClassicPageTitles) {
208 - $title = $this->getTitle()->getText();
209 - }
 233+ if (!$this->showClassicPageTitles)
 234+ $title = $this->getTitle();
210235
211236 $wgOut->setPageTitle($title);
212237 $wgOut->setPageTitle(wfMsg('editing',$title));
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php
@@ -24,6 +24,8 @@
2525
2626 parent::view();
2727
 28+ $this->outputViewHeader();
 29+
2830 $spelling = $wgTitle->getText();
2931
3032 $wgOut->addHTML(
@@ -38,8 +40,7 @@
3941 )
4042 );
4143
42 - $wgOut->addHTML(DefaultEditor::getExpansionCss());
43 - $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>");
 44+ $this->outputViewFooter();
4445 }
4546
4647 public function history() {