r95818 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95817‎ | r95818 | r95819 >
Date:22:25, 30 August 2011
Author:krinkle
Status:resolved (Comments)
Tags:
Comment:
[ResourceLoader2]: Initial go at the GadgetManager.
* Front-end for overview is done
* Front-end for gadgetview is just a stub
* Removed code that was planned to be used with action=modify/action=delete. This is no longer going to be done from a Special-page. Prop-editor will be ajax-only.
* Cleaned up log-related stuff that is no longer going to be used in (i18n and Gadgets.php)
Modified paths:
  • /branches/RL2/extensions/Gadgets/Gadgets.i18n.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/Gadgets.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/SpecialGadgetManager.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.css (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/Gadgets.i18n.php
@@ -15,10 +15,10 @@
1616 * @author Daniel Kinzler, brightbyte.de
1717 */
1818 $messages['en'] = array(
19 - #for Special:Version
 19+ # For Special:Version
2020 'gadgets-desc' => 'Lets users select custom [[Special:Gadgets|CSS and JavaScript gadgets]] in their [[Special:Preferences|preferences]]',
2121
22 - #for Special:Preferences
 22+ # For Special:Preferences
2323 'prefs-gadgets' => 'Gadgets',
2424 'gadgets-prefstext' => 'Below is a list of special gadgets you can enable for your account.
2525 These gadgets are mostly based on JavaScript, so JavaScript has to be enabled in your browser for them to work.
@@ -27,7 +27,7 @@
2828 Also note that these special gadgets are not part of the MediaWiki software, and are usually developed and maintained by users on your local wiki.
2929 Local administrators can edit the [[MediaWiki:Gadgets-definition|definitions]] and [[Special:Gadgets|descriptions]] of available gadgets.',
3030
31 - #for Special:Gadgets
 31+ # For Special:Gadgets
3232 'gadgets' => 'Gadgets',
3333 'gadgets-title' => 'Gadgets',
3434 'gadgets-pagetext' => "Below is a list of special gadgets users can enable on their [[Special:Preferences|preferences page]], as defined by the [[MediaWiki:Gadgets-definition|definitions]].
@@ -44,38 +44,37 @@
4545 You must have appropriate permissions on destination wiki (including the right to edit system messages) and import from file uploads must be enabled.',
4646 'gadgets-export-download' => 'Download',
4747
48 - # for gadget management (Special:GadgetMananger and the API)
 48+ # For Special:GadgetManager
4949 'gadgetmanager' => 'Gadget manager',
5050 'gadgetmanager-title' => 'Gadget manager',
51 - 'gadgetmanager-pagetext' => 'TODO, should link to [[Special:Log/gadgetman]]',
52 - 'gadgetmanager-modify-link' => 'modify',
53 - 'gadgetmanager-delete-link' => 'delete',
 51+ 'gadgetmanager-pagetext' => 'Below is an overview of all gadgets defined on this wiki. Users can opt-in or opt-out of these through their [[Special:Preferences|preferences page]].',
 52+ 'gadgetmanager-nogadgets' => 'This wiki currently has no gadgets defined.',
 53+ 'gadgetmanager-uncategorized' => 'Uncategorized',
 54+ 'gadgetmanager-tablehead-title' => 'Gadget title',
 55+ 'gadgetmanager-tablehead-default' => 'Default',
 56+ 'gadgetmanager-tablehead-hidden' => 'Hidden',
 57+ 'gadgetmanager-tablehead-shared' => 'Shared',
 58+ 'gadgetmanager-propsgroup-settings' => 'Gadget settings',
 59+ 'gadgetmanager-propsgroup-module' => 'Module properties',
5460 'gadgetmanager-prop-scripts' => 'Scripts',
5561 'gadgetmanager-prop-styles' => 'Styles',
5662 'gadgetmanager-prop-dependencies' => 'Dependencies',
5763 'gadgetmanager-prop-messages' => 'Messages',
 64+ 'gadgetmanager-prop-category' => 'Category',
5865 'gadgetmanager-prop-rights' => 'Rights',
59 - 'gadgetmanager-prop-default' => 'Default',
60 - 'gadgetmanager-prop-hidden' => 'Hidden',
61 - 'gadgetmanager-prop-shared' => 'Shared',
62 - 'gadgetmanager-prop-yes' => 'Yes',
63 - 'gadgetmanager-prop-no' => 'No',
 66+ 'gadgetmanager-prop-default-yes' => 'This gadget is loaded by default.',
 67+ 'gadgetmanager-prop-hidden-yes' => 'This is a hidden gadget.',
 68+ 'gadgetmanager-prop-shared-yes' => 'This gadget is shared.',
 69+ 'gadgetmanager-modifylink' => 'modify',
 70+ 'gadgetmanager-modifylink-tooltip' => 'Modify this gadget',
 71+ 'gadgetmanager-deletelink' => 'delete',
 72+ 'gadgetmanager-deletelink-tooltip' => 'Delete ths gadget',
6473
65 - // TODO clean up inconsistencies between gadgetmanager- and gadgets-manager- etc
66 - 'gadgets-manager-create-exists' => 'This gadget cannot be created because there is an existing gadget with the name $1',
67 -
68 - # permission stuff
 74+ # Permissions
6975 'gadgets-cant-create' => 'You do not have the right to create new Gadgets.',
7076 'gadgets-cant-delete' => 'You do not have the right to delete Gadgets.',
71 -
72 - # logging stuff
73 - 'gadgets-gadgetmanlog-page' => 'Gadget manager log',
74 - 'gadgets-gadgetmanlog-text' => 'This is a log of changes made to gadgets using the [[Special:GadgetManager|gadget manager]].',
75 - 'gadgets-gadgetmanlog-createentry' => 'created gadget [[Special:GadgetManager/$1|$1]]', // may want to change depending on what $1 ends up being
76 - 'gadgets-gadgetmanlog-modifyentry' => 'modified gadget [[Special:GadgetManager/$1|$1]]: $2', // TODO fill out $2, add handler
77 - 'gadgets-gadgetmanlog-deleteentry' => 'deleted gadget $1',
7877
79 - #rights
 78+ # User rights
8079 'right-gadgets-edit' => 'Edit pages in the Gadget: namespace',
8180 'right-gadgets-definition-create' => 'Create new gadgets',
8281 'right-gadgets-definition-delete' => 'Delete gadgets',
@@ -290,7 +289,7 @@
291290 'gadgets-uses' => 'استفاده بیت',
292291 );
293292
294 -/** Belarusian (Taraškievica orthography) (‪Беларуская (тарашкевіца)‬)
 293+/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
295294 * @author Cesco
296295 * @author EugeneZelenko
297296 * @author Jim-by
@@ -609,7 +608,7 @@
610609 'gadgets-export-download' => 'Herunterladen',
611610 );
612611
613 -/** German (formal address) (‪Deutsch (Sie-Form)‬)
 612+/** German (formal address) (Deutsch (Sie-Form))
614613 * @author Kghbln
615614 */
616615 $messages['de-formal'] = array(
@@ -1328,7 +1327,7 @@
13291328 'gadgets-export-download' => 'ჩამოტვირთვა',
13301329 );
13311330
1332 -/** Kazakh (Arabic script) (‫قازاقشا (تٴوتە)‬) */
 1331+/** Kazakh (Arabic script) (قازاقشا (تٴوتە)) */
13331332 $messages['kk-arab'] = array(
13341333 'prefs-gadgets' => 'قاجەت قۇرالدار',
13351334 'gadgets-prefstext' => 'تومەندە ٴوز تىركەلگىڭىزدە قوسا الاتىن ارناۋلى قاجەت قۇرالدار ٴتىزىمى بەرىلەدى.
@@ -1787,7 +1786,7 @@
17881787 'gadgets-export-download' => 'Downloaden',
17891788 );
17901789
1791 -/** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
 1790+/** Norwegian Nynorsk (Norsk (nynorsk))
17921791 * @author Eirik
17931792 * @author Harald Khan
17941793 * @author Nghtwlkr
@@ -1807,7 +1806,7 @@
18081807 'gadgets-export-download' => 'Last ned',
18091808 );
18101809
1811 -/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
 1810+/** Norwegian (bokmål) (Norsk (bokmål))
18121811 * @author Jon Harald Søby
18131812 * @author Laaknor
18141813 * @author Nghtwlkr
@@ -2278,7 +2277,7 @@
22792278 'gadgets-export-download' => 'Shkarko',
22802279 );
22812280
2282 -/** Serbian Cyrillic ekavian (‪Српски (ћирилица)‬)
 2281+/** Serbian Cyrillic ekavian (Српски (ћирилица))
22832282 * @author Millosh
22842283 * @author Rancher
22852284 * @author Жељко Тодоровић
@@ -2307,7 +2306,7 @@
23082307 'gadgets-export-download' => 'Преузми',
23092308 );
23102309
2311 -/** Serbian Latin ekavian (‪Srpski (latinica)‬)
 2310+/** Serbian Latin ekavian (Srpski (latinica))
23122311 * @author Michaello
23132312 * @author Жељко Тодоровић
23142313 */
@@ -2676,7 +2675,7 @@
26772676 'gadgets-uses' => '用',
26782677 );
26792678
2680 -/** Simplified Chinese (‪中文(简体)‬)
 2679+/** Simplified Chinese (中文(简体))
26812680 * @author Gaoxuewei
26822681 * @author Hydra
26832682 * @author Shinjiman
@@ -2708,7 +2707,7 @@
27092708 'gadgets-export-download' => '下载',
27102709 );
27112710
2712 -/** Traditional Chinese (‪中文(繁體)‬)
 2711+/** Traditional Chinese (中文(繁體))
27132712 * @author Horacewai2
27142713 * @author Mark85296341
27152714 * @author Shinjiman
Index: branches/RL2/extensions/Gadgets/Gadgets.php
@@ -103,7 +103,7 @@
104104 $wgHooks['TitleIsCssOrJsPage'][] = 'GadgetHooks::titleIsCssOrJsPage';
105105 $wgHooks['TitleIsMovable'][] = 'GadgetHooks::titleIsMovable';
106106 $wgHooks['getUserPermissionsErrors'][] = 'GadgetHooks::getUserPermissionsErrors';
107 -//$wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList'; // FIXME: broken
 107+#$wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList'; // FIXME: broken
108108
109109 $dir = dirname(__FILE__) . '/';
110110 $wgExtensionMessagesFiles['Gadgets'] = $dir . 'Gadgets.i18n.php';
@@ -131,18 +131,6 @@
132132 $wgAPIListModules['gadgetcategories'] = 'ApiQueryGadgetCategories';
133133 $wgAPIListModules['gadgets'] = 'ApiQueryGadgets';
134134
135 -$wgLogTypes[] = 'gadgetman';
136 -$wgLogNames['gadgetman'] = 'gadgets-gadgetmanlog-page'; // TODO define
137 -$wgLogHeaders['gadgetman'] = 'gadgets-gadgetmanlog-text'; // TODO define
138 -$wgLogActions['gadgetman/create'] = 'gadgets-gadgetmanlog-createentry';
139 -$wgLogActions['gadgetman/modify'] = 'gadgets-gadgetmanlog-modifyentry';
140 -$wgLogActions['gadgetman/delete'] = 'gadgets-gadgetmanlog-deleteentry';
141 -// TODO add as needed
142 -// TODO: create and modify will not have a summary, figure out how well that fares. User creation also doesn't have one
143 -#$wgLogActionsHandlers['gadgetman/create'] = '...';
144 -#$wgLogActionsHandlers['gadgetman/modify'] = '...';
145 -#$wgLogActionsHandlers['gadgetman/delete'] = '...';
146 -
147135 $gadResourceTemplate = array(
148136 'localBasePath' => $dir . 'modules',
149137 'remoteExtPath' => 'Gadgets/modules'
@@ -150,5 +138,6 @@
151139 $wgResourceModules += array(
152140 'ext.gadgets.gadgetmanager' => $gadResourceTemplate + array(
153141 'styles' => 'ext.gadgets.gadgetmanager.css',
 142+ 'position' => 'top',
154143 )
155144 );
Index: branches/RL2/extensions/Gadgets/modules/ext.gadgets.gadgetmanager.css
@@ -1,50 +1,10 @@
2 -.mw-gadgetman-gadgets {
3 - background: #f9f9f9;
 2+.mw-gadgetmanager-gadgets {
 3+ width: 100%;
44 }
55
6 -.mw-gadgetman-gadget {
7 - background: #f2f2f2;
8 - margin: 10px 2px;
9 - padding: 5px 8px;
10 - border: #dfdfdf;
 6+.mw-gadgetmanager-gadgets-default,
 7+.mw-gadgetmanager-gadgets-hidden,
 8+.mw-gadgetmanager-gadgets-shared {
 9+ width: 4em;
 10+ text-align: center;
1111 }
12 -
13 -.mw-gadgetman-toollinks {
14 - float: right;
15 - background: white;
16 - padding: 2px 3px;
17 -}
18 -
19 -.mw-gadgetman-title {
20 -}
21 -
22 -.mw-gadgetman-descr {
23 -}
24 -
25 -.mw-gadgetman-props {
26 - background: #dfdfdf;
27 - overflow: hidden;
28 -}
29 -
30 -.mw-gadgetman-props-module,
31 -.mw-gadgetman-props-gadget {
32 - width: 49%;
33 - float: left;
34 -}
35 -
36 -.mw-gadgetman-props-gadget {
37 - float: right;
38 - border-left: 1px solid black;
39 -}
40 -
41 -.mw-gadgetman-props-listwrapper {
42 - margin: 3px 0;
43 - overflow: hidden;
44 -}
45 -
46 -.mw-gadgetman-props-listitem {
47 - background: cyan;
48 - border: 1px solid darkCyan;
49 - border-radius: 10px;
50 - padding: 1px 2px;
51 -}
Index: branches/RL2/extensions/Gadgets/SpecialGadgetManager.php
@@ -1,141 +1,146 @@
22 <?php
 3+/**
 4+ * SpecialPage for ArticleFeedback extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
310 class SpecialGadgetManager extends SpecialPage {
 11+
412 public function __construct() {
5 - parent::__construct( 'GadgetManager', 'gadgets-manager-view' );
 13+ parent::__construct( 'GadgetManager' );
614 }
7 -
 15+
 16+ /**
 17+ * @param $par String: Optionally the gadgetname to show info for.
 18+ */
819 public function execute( $par ) {
9 - global $wgOut, $wgUser; // TODO does SpecialPage have an OutputPage member? RequestContext maybe?
10 -
11 - if ( !$this->userCanExecute( $wgUser ) ) {
12 - $this->displayRestrictionError();
13 - return;
 20+ $out = $this->getOutput();
 21+
 22+ $this->setHeaders();
 23+ $out->setPagetitle( wfMsg( 'gadgetmanager-title' ) );
 24+ $out->addModules( 'ext.gadgets.gadgetmanager' );
 25+
 26+ // Determine view
 27+ if ( is_string( $par ) && $par !== '' ) {
 28+ $html = $this->generateGadgetView( $par );
 29+ } else {
 30+ $html = $this->generateOverview();
1431 }
15 -
16 - $this->setHeaders();
17 - $wgOut->setPagetitle( wfMsg( 'gadgetmanager-title' ) );
18 - $wgOut->addWikiMsg( 'gadgetmanager-pagetext' );
19 - $wgOut->addModuleStyles( 'ext.gadgets.gadgetmanager' );
20 -
21 - // Sort gadgets by section
 32+
 33+ $out->addHtml( $html );
 34+ }
 35+
 36+ /**
 37+ * @return String: HTML
 38+ */
 39+ private function generateOverview() {
 40+ global $wgGadgetEnableSharing;
 41+
2242 $repo = new LocalGadgetRepo( array() );
23 - $gadgetsBySection = array(); // array( section => array( name => Gadget ) )
24 - foreach ( $repo->getGadgetNames() as $name ) {
25 - $gadget = $repo->getGadget( $name );
26 - $gadgetsBySection[$gadget->getSection()][$name] = $gadget;
 43+ $gadgetNames = $repo->getGadgetNames();
 44+
 45+ // If there there are no gadgets at all, exit early.
 46+ if ( !count( $gadgetNames ) ) {
 47+ $noGadgetsMsgHtml = Html::element( 'p',
 48+ array(
 49+ 'class' => 'mw-gadgetmanager-nogadgets'
 50+ ), wfMessage( 'gadgetmanager-nogadgets' )->plain()
 51+ );
 52+ $this->getOutput()->addHtml( $noGadgetsMsgHtml );
 53+ return;
2754 }
28 -
 55+ // There is atleast one gadget, let's get started.
 56+ $this->getOutput()->addWikiMsg( 'gadgetmanager-pagetext' );
2957 $html = '';
30 - foreach ( $gadgetsBySection as $section => $gadgets ) {
31 - $sectionName = wfMessage( "Gadgetsection-$section-title" )->plain();
32 - $html .= Html::element( 'h2', array( 'class' => 'mw-gadgetman-section' ), $sectionName );
33 - $html .= '<div class="mw-gadgetman-gadgets">';
34 -
35 - foreach ( $gadgets as $name => $gadget ) {
36 - // TODO trigger visibility of mod/delete by rights
37 - // Leave empty wrapper if user has neither right
38 - $modifyLink = Linker::link(
39 - $this->getTitle( $name ),
40 - wfMsg( 'gadgetmanager-modify-link' ),
41 - array( 'class' => 'mw-gadgetman-modifylink' ),
42 - array( 'action' => 'modify' )
43 - );
44 - $deleteLink = Linker::link(
45 - $this->getTitle( $name ),
46 - wfMsg( 'gadgetmanager-delete-link' ),
47 - array( 'class' => 'mw-gadgetman-deletelink '),
48 - array( 'action' => 'delete' )
49 - );
50 - $title = wfMessage( $gadget->getTitleMsg() )->plain();
51 - $desc = wfMessage( $gadget->getDescriptionMsg() )->parse();
52 -
53 - $html .= "<div class=\"mw-gadgetman-gadget\"><div class=\"mw-gadgetman-toollinks\">$modifyLink $deleteLink</div>";
54 - $html .= Html::element( 'h3', array( 'class' => 'mw-gadgetman-title' ), $title );
55 - $html .= Html::element( 'p', array( 'class' => 'mw-gadgetman-desc' ), $desc );
56 -
57 - $html .= '<div class="mw-gadgetman-props"><div class="mw-gadgetman-props-module">';
58 - $html .= $this->buildPropsArrayList(
59 - 'gadgetmanager-prop-scripts',
60 - $gadget->getScripts(),
61 - array_map( 'self::getLinkTitleForGadgetNS', $gadget->getScripts() )
62 - );
63 - $html .= $this->buildPropsArrayList(
64 - 'gadgetmanager-prop-styles',
65 - $gadget->getStyles(),
66 - array_map( 'self::getLinkTitleForGadgetNS', $gadget->getStyles() )
67 - );
68 -
69 - $module = $gadget->getModule();
70 - $html .= $this->buildPropsArrayList(
71 - 'gadgetmanager-prop-dependencies',
72 - $module->getDependencies()
73 - );
74 - $html .= $this->buildPropsArrayList(
75 - 'gadgetmanager-prop-messages',
76 - $module->getMessages(),
77 - array_map( 'self::getLinkTitleForMediaWikiNS', $module->getMessages() )
78 - );
79 - // TODO implement load position
80 - //$html .= Html::element( 'label', array(), wfMessage( 'gadgetmanager-prop-position' )->plain() );
81 - //$html .= Html::element( 'span', array( 'class' => 'mw-gadgetman-props-value' ), $gadget->getPosition() );
82 - //$html .= '<br />';
83 - $html .= '</div>'; // close mw-gadgetman-props-module
84 -
85 - $html .= '<div class="mw-gadgetman-props-gadget">';
86 - $html .= $this->buildPropsArrayList(
87 - 'gadgetmanager-prop-rights',
88 - $gadget->getRequiredRights()
89 - );
90 - $html .= $this->buildBooleanProp( 'gadgetmanager-prop-default', $gadget->isEnabledByDefault() );
91 - $html .= $this->buildBooleanProp( 'gadgetmanager-prop-hidden', $gadget->isHidden() );
92 - $html .= $this->buildBooleanProp( 'gadgetmanager-prop-shared', $gadget->isShared() );
93 - $html .= '</div></div></div>'; // close mw-gadgetman-props-gadget, mw-gadgetman-props and mw-gadgetman-gadget
94 - }
95 - $html .= '</div>'; // close mw-gadgetman-gadgets
 58+
 59+ // Sort gadgets by category
 60+ $gadgetsByCategory = array();
 61+ foreach ( $gadgetNames as $gadgetName ) {
 62+ $gadget = $repo->getGadget( $gadgetName );
 63+ $gadgetsByCategory[$gadget->getCategory()][$gadgetName] = $gadget;
9664 }
97 - $wgOut->addHTML( $html );
98 - }
99 -
100 - protected function buildPropsArrayList( $labelMsg, $arr, $linkTitles = false ) {
101 - $html = Html::element( 'label', array(), wfMessage( $labelMsg )->plain() );
102 - $html .= '<span class="mw-gadgetman-props-value mw-gadgetman-props-listwrapper">';
103 - foreach ( $arr as $i => $value ) {
104 - if ( $linkTitles ) {
105 - $value = Linker::link( $linkTitles[$i], $value );
 65+
 66+ // Sort categories alphabetically
 67+ // @todo Sort causes the key "''" to be at the top, it should be on the bottom.
 68+ ksort( $gadgetsByCategory );
 69+
 70+ foreach ( $gadgetsByCategory as $category => $gadgets ) {
 71+ // Avoid broken or empty headings. Fallback to a special message
 72+ // for uncategorized gadgets (e.g. gadgets with category '' ).
 73+ if ( $category != '' ) {
 74+ $categoryMsg = wfMessage( "gadgetcategory-$category" );
10675 } else {
107 - $value = htmlspecialchars( $value );
 76+ $categoryMsg = wfMessage( 'gadgetmanager-uncategorized' );
10877 }
109 - $html .= Html::rawElement( 'span', array( 'class' => 'mw-gadgetman-props-listitem' ), $value );
 78+
 79+ // Category header
 80+ $html .= Html::element( 'h2',
 81+ array( 'class' => 'mw-gadgetmanager-category' ),
 82+ $categoryMsg->exists() ? $categoryMsg->plain() : $this->getLang()->ucfirst( $category )
 83+ );
 84+
 85+ // Start per-category gadgets table
 86+ $html .= '<table class="mw-gadgetmanager-gadgets TablePager"><tr>';
 87+ $html .=
 88+ '<th>' . wfMessage( 'gadgetmanager-tablehead-title' )->escaped()
 89+ . '</th><th>' . wfMessage( 'gadgetmanager-tablehead-default' )->escaped()
 90+ . '</th><th>' . wfMessage( 'gadgetmanager-tablehead-hidden' )->escaped()
 91+ . '</th>';
 92+ if ( $wgGadgetEnableSharing ) {
 93+ $html .= '<th>' . wfMessage( 'gadgetmanager-tablehead-shared' )->escaped() . '</th>';
 94+ }
 95+ $html .= '</tr>';
 96+
 97+ // Populate table rows for the current category
 98+ foreach ( $gadgets as $gadgetName => $gadget ) {
 99+ $html .= '<tr>';
 100+
 101+ $tickedCheckboxHtml = Html::element( 'input', array(
 102+ 'type' => 'checkbox',
 103+ 'disabled' => 'disabled',
 104+ 'value' => 1,
 105+ 'checked' => 'checked',
 106+ ) );
 107+
 108+ // Title
 109+ $titleMsg = wfMessage( $gadget->getTitleMsg() );
 110+ $titleLink = Linker::link(
 111+ $this->getTitle( $gadget->getName() ),
 112+ // MediaWiki-message is optional. This is for backwards compatibility (since
 113+ // the previous version didn't have titles), and to a allow wikis that only
 114+ // care about one language to save from creating NS_MEDIAWIKI pages.
 115+ // @todo: Centralize this logic.
 116+ $titleMsg->exists() ? $titleMsg->plain() : $this->getLang()->ucfirst( $gadget->getName() )
 117+ );
 118+ $html .= "<td class=\"mw-gadgetmanager-gadgets-title\">$titleLink</td>";
 119+ // Default
 120+ $html .= '<td class="mw-gadgetmanager-gadgets-default">'
 121+ . ( $gadget->isEnabledByDefault() ? $tickedCheckboxHtml : '' ) . '</td>';
 122+ // Hidden
 123+ $html .= '<td class="mw-gadgetmanager-gadgets-hidden">'
 124+ . ( $gadget->isHidden() ? $tickedCheckboxHtml : '' ) . '</td>';
 125+ // Shared
 126+ if ( $wgGadgetEnableSharing ) {
 127+ $html .= '<td class="mw-gadgetmanager-gadgets-shared">'
 128+ . ( $gadget->isShared() ? $tickedCheckboxHtml : '' ) . '</td>';
 129+ }
 130+
 131+ $html .= '</tr>';
 132+ }
 133+
 134+ // End of per-category gadgets table
 135+ $html .= '</table>';
110136 }
111 - $html .= '</span><br />';
 137+
112138 return $html;
113139 }
114 -
115 - protected function buildBooleanProp( $labelMsg, $value ) {
116 - $html = Html::element( 'label', array(), wfMessage( $labelMsg )->plain() );
117 - $msg = wfMessage( $value ? 'gadgetmanager-prop-yes' : 'gadgetmanager-prop-no' )->plain();
118 - $html .= Html::element( 'span', array( 'class' => 'mw-gadgetman-props-value' ), $msg );
119 - $html .= '<br />';
120 - return $html;
121 - }
122 -
123 - protected static function getLinkTitleForGadgetNS( $str ) {
124 - return Title::makeTitle( NS_GADGET, $str );
125 - }
126 -
127 - protected static function getLinkTitleForMediaWikiNS( $str ) {
128 - return Title::makeTitle( NS_MEDIAWIKI, $str );
129 - }
130 -
 140+
131141 /**
132 - * Log a gadget manager action
133 - * @param $action string Action name (one of 'create', 'modify', 'delete')
134 - * @param $title Title object for the gadget, like Special:GadgetManager/foo
135 - * @param $reason string Log reason TODO figure out how to implement optional reasons; is empty string good enough?
136 - * @param $params array Log parameters TODO document
 142+ * @return String: HTML
137143 */
138 - protected function logAction( $action, $title, $reason = '', $params = array() ) {
139 - $log = new LogPage( 'gadgetman' );
140 - $log->addEntry( $action, $title, $reason, $params );
 144+ public function generateGadgetView( $gadgetName ) {
 145+ return "Stub page where there will be some info about the gadget ($gadgetName). This is also used for permalinks to a gadget's config page.";
141146 }
142147 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r95960Split up TablePager css class, introduce .mw-datatable...krinkle10:38, 1 September 2011
r95961* addModuleStyles instead of addModule, support noscript-env...krinkle10:50, 1 September 2011
r96309[ResourceLoader2] Gadget manager (start of ajax editor)...krinkle22:28, 5 September 2011

Comments

#Comment by Catrope (talk | contribs)   12:54, 31 August 2011
-		$wgOut->addModuleStyles( 'ext.gadgets.gadgetmanager' );
...
+		$out->addModules( 'ext.gadgets.gadgetmanager' );

I saw you added 'position' => 'top' so there's no FOUC here, but this still means the overview will be unstyled in noscript mode.

+			if ( $category != '' ) {

Use strict comparison.

+			$html .= '<table class="mw-gadgetmanager-gadgets TablePager"><tr>';

Why does this table have the TablePager CC class if it wasn't output by the TablePager PHP class?

OK otherwise.

#Comment by Krinkle (talk | contribs)   10:51, 1 September 2011

Ay.. yeah, using TablePage didn't feel "right", but the styling it has are very much suited for this. I went ahead and changed core in r95818 to split this general styling off in a separate css hook ".mw-datatable".

The three issues are fixed in r95961, setting status back to new.

Status & tagging log