r106664 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106663‎ | r106664 | r106665 >
Date:17:46, 19 December 2011
Author:rmoen
Status:ok (Comments)
Tags:
Comment:
Create new extension base MarkAsHelpful.
Modified paths:
  • /trunk/extensions/MarkAsHelpful (added) (history)
  • /trunk/extensions/MarkAsHelpful/MarkAsHelpful.hooks.php (added) (history)
  • /trunk/extensions/MarkAsHelpful/MarkAsHelpful.i18n.php (added) (history)
  • /trunk/extensions/MarkAsHelpful/MarkAsHelpful.php (added) (history)

Diff [purge]

Index: trunk/extensions/MarkAsHelpful/MarkAsHelpful.i18n.php
@@ -0,0 +1,16 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for MarkAsHelpful extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Rob Moen
 14+ */
 15+$messages['en'] = array(
 16+ 'mark-as-helpful-desc' => 'Hooks in to specified objects and provides a user interface to mark them as helpful',
 17+);
\ No newline at end of file
Index: trunk/extensions/MarkAsHelpful/MarkAsHelpful.php
@@ -0,0 +1,44 @@
 2+<?php
 3+/**
 4+ * HelpfulMarker extension
 5+ * Allows specified users to mark certain objects as "Helpful"
 6+ */
 7+
 8+$wgExtensionCredits['other'][] = array(
 9+ 'author' => array( 'Rob Moen', 'Benny Situ' ),
 10+ 'descriptionmsg' => 'mark-as-helpful-desc',
 11+ 'name' => 'MarkAsHelpful',
 12+ 'url' => 'http://www.mediawiki.org/wiki/Mark_as_Helpful',
 13+ 'version' => '0.1',
 14+ 'path' => __FILE__,
 15+);
 16+
 17+
 18+// Object model
 19+
 20+
 21+// API
 22+
 23+
 24+// Hooks
 25+$wgAutoloadClasses['MarkAsHelpfulHooks'] = dirname(__FILE__).'/MarkAsHelpful.hooks.php';
 26+$wgHooks['BeforePageDisplay'][] = 'MarkAsHelpfulHooks::onPageDisplay';
 27+
 28+// Special pages
 29+
 30+
 31+// User rights
 32+$wgAvailableRights[] = 'markashelpful-view';
 33+$wgAvailableRights[] = 'markashelpful-admin';
 34+
 35+$wgGroupPermissions['sysop']['makrashelpful-admin'] = true;
 36+
 37+// Internationalisation
 38+$wgExtensionMessagesFiles['MarkAsHelpful'] = dirname(__FILE__).'/MarkAsHelpful.i18n.php';
 39+
 40+// Resources
 41+$mbResourceTemplate = array(
 42+ 'localBasePath' => dirname(__FILE__) . '/modules',
 43+ 'remoteExtPath' => 'MarkAsHelpful/modules'
 44+);
 45+
Index: trunk/extensions/MarkAsHelpful/MarkAsHelpful.hooks.php
@@ -0,0 +1,29 @@
 2+<?
 3+
 4+class MarkAsHelpfulHooks {
 5+ /**
 6+ * Adds MarkAsHelpful JS to the output if appropriate.
 7+ *
 8+ * @param $output OutputPage
 9+ * @param $skin Skin
 10+ */
 11+
 12+ public static function onPageDisplay( &$output, &$skin ) {
 13+ if ( self::addMarkAsHelpful( $output, $skin ) ) {
 14+ $output->addModules( array( 'ext.markAsHelpful' ) );
 15+ }
 16+
 17+ return true;
 18+ }
 19+
 20+ /**
 21+ * Determines whether or not we should add MarkAsHelpful to the current page.
 22+ *
 23+ * @param $output OutputPage
 24+ * @param $skin Skin
 25+ */
 26+ public static function addMarkAsHelpful ( &$output, &$skin ) {
 27+
 28+ return true;
 29+ }
 30+}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r106730adding core js methods and css for MarkAsHelpful, addition to r106664rmoen00:03, 20 December 2011
r106778r106664 : Consistency tweaks in preparation for adding extension to translate...raymond10:33, 20 December 2011
r106779r106664: Adding extension to translatewiki.netraymond10:34, 20 December 2011

Comments

#Comment by Hashar (talk | contribs)   10:35, 5 January 2012

You might want to create a homepage at https://www.mediawiki.org/wiki/Extension:MarkAsHelpful  :-)

Status & tagging log