r40534 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40533‎ | r40534 | r40535 >
Date:14:13, 6 September 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Hide Factbox by default. Instead, show a (more subtle) link to view properties in the toolbox. Both features
remain configurable.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -216,7 +216,7 @@
217217 */
218218 function smwfSetupExtension() {
219219 wfProfileIn('smwfSetupExtension (SMW)');
220 - global $smwgIP, $smwgStoreActive, $wgHooks, $wgParser, $wgExtensionCredits, $smwgEnableTemplateSupport, $smwgMasterStore, $smwgIQRunningNumber, $wgLanguageCode;
 220+ global $smwgIP, $smwgStoreActive, $wgHooks, $wgParser, $wgExtensionCredits, $smwgEnableTemplateSupport, $smwgMasterStore, $smwgIQRunningNumber, $wgLanguageCode, $wgVersion, $smwgToolboxBrowseLink;
221221
222222 /**
223223 * Setting this to false prevents any new data from being stored in
@@ -264,6 +264,13 @@
265265 }
266266 smwfRegisterParserFunctions( $wgParser );
267267 }
 268+ if ($smwgToolboxBrowseLink) {
 269+ if (version_compare($wgVersion,'1.12','>')) {
 270+ $wgHooks['SkinTemplateToolboxEnd'][] = 'smwfShowBrowseLink'; // introduced only in 1.13
 271+ } else {
 272+ $wgHooks['MonoBookTemplateToolboxEnd'][] = 'smwfShowBrowseLink';
 273+ }
 274+ }
268275
269276 ///// credits (see "Special:Version") /////
270277 $wgExtensionCredits['parserhook'][]= array('name'=>'Semantic MediaWiki', 'version'=>SMW_VERSION, 'author'=>"Klaus Lassleben, [http://korrekt.org Markus Krötzsch], [http://simia.net Denny Vrandecic], S Page, and others. Maintained by [http://www.aifb.uni-karlsruhe.de/Forschungsgruppen/WBS/english AIFB Karlsruhe].", 'url'=>'http://semantic-mediawiki.org', 'description' => 'Making your wiki more accessible – for machines \'\'and\'\' humans. [http://semantic-mediawiki.org/wiki/Help:User_manual View online documentation.]');
@@ -386,6 +393,21 @@
387394 return smwfEncodeMessages(array($content), 'info');
388395 }
389396
 397+/**
 398+ * Add a link to the toobox to view the properties of the current page in Special:Browse.
 399+ * The links has the CSS id "t-smwbrowselink" so that it can be skinned or hidden with all
 400+ * standard mechanisms (also by individual users with custom CSS).
 401+ */
 402+function smwfShowBrowseLink($skintemplate) {
 403+ if($skintemplate->data['isarticle']) {
 404+ wfLoadExtensionMessages('SemanticMediaWiki');
 405+ $browselink = SMWInfolink::newBrowsingLink(wfMsg('smw_browselink'),
 406+ $skintemplate->data['titleprefixeddbkey'],false);
 407+ echo "<li id=\"t-smwbrowselink\">" . $browselink->getHTML() . "</li>";
 408+ }
 409+ return true;
 410+}
 411+
390412 /**********************************************/
391413 /***** Header modifications *****/
392414 /**********************************************/
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php
@@ -66,14 +66,13 @@
6767
6868 ###
6969 # This setting allows you to select in which cases you want to have a factbox
70 -# appear below an article. The default setting is "SMW_FACTBOX_NONEMPTY" which
71 -# shows only those factboxes that have some content. Note that the Magic Words
72 -# __SHOWFACTBOX__ and __HIDEFACTBOX__ can be used to control Factbox display
73 -# for individual pages. Other options for this setting include:
 70+# appear below an article. Note that the Magic Words __SHOWFACTBOX__ and
 71+# __HIDEFACTBOX__ can be used to control Factbox display for individual pages.
 72+# Other options for this setting include:
7473 ##
75 -$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;
 74+//$smwgShowFactbox = SMW_FACTBOX_NONEMPTY; # show only those factboxes that have some content
7675 //$smwgShowFactbox = SMW_FACTBOX_SPECIAL # show only if special properties were set
77 -//$smwgShowFactbox = SMW_FACTBOX_HIDDEN; # hide always
 76+$smwgShowFactbox = SMW_FACTBOX_HIDDEN; # hide always
7877 //$smwgShowFactbox = SMW_FACTBOX_SHOWN; # show always, buggy and not recommended
7978 ##
8079
@@ -84,6 +83,14 @@
8584 ##
8685
8786 ###
 87+# Should the toolbox of each content page show a link to browse the properties
 88+# of that page using Special:Browse? This is a useful way to access properties
 89+# and it is somewhat more subtle than showing a Factbox on every page.
 90+##
 91+$smwgToolboxBrowseLink = true;
 92+##
 93+
 94+###
8895 # Should warnings be displayed in wikitexts right after the problematic input?
8996 # This affects only semantic annotations, not warnings that are displayed by
9097 # inline queries or other features.
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php
@@ -227,6 +227,7 @@
228228
229229 // Messages for the browsing special
230230 'browse' => 'Browse wiki',
 231+ 'smw_browselink' => 'Browse properties',
231232 'smw_browse_article' => 'Enter the name of the page to start browsing from.',
232233 'smw_browse_go' => 'Go',
233234 'smw_browse_more' => '…',
@@ -895,6 +896,7 @@
896897 'smw_sbv_value' => 'Wert',
897898 'smw_sbv_submit' => 'Finde Ergebnisse',
898899 'browse' => 'Wiki browsen',
 900+ 'smw_browselink' => 'Attribute anzeigen',
899901 'smw_browse_article' => 'Bitte gib den Titel einer Seite ein.',
900902 'smw_browse_go' => 'Los',
901903 'smw_browse_show_incoming' => 'zeige Attribute die hierhin verlinken',

Status & tagging log