Harej has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343786 )

Change subject: Create Special:CollaborationKitIcons
......................................................................

Create Special:CollaborationKitIcons

Bug: T160881
Change-Id: I43815d3d425636b9a191f3d71380cc1b93bd3587
---
M CollaborationKit.alias.php
M extension.json
M i18n/en.json
M i18n/qqq.json
A includes/SpecialCollaborationKitIcons.php
5 files changed, 69 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/86/343786/1

diff --git a/CollaborationKit.alias.php b/CollaborationKit.alias.php
index 51e9f23..b35840c 100644
--- a/CollaborationKit.alias.php
+++ b/CollaborationKit.alias.php
@@ -9,6 +9,7 @@
 
 /** English (English) */
 $specialPageAliases['en'] = [
+       'CollaborationKitIcons' => [ 'CollaborationKitIcons' ],
        'CreateCollaborationHub' => [ 'CreateCollaborationHub' ],
        'CreateHubFeature' => [ 'CreateHubFeature' ]
 ];
diff --git a/extension.json b/extension.json
index 92333f1..59b8d64 100644
--- a/extension.json
+++ b/extension.json
@@ -34,6 +34,7 @@
                "CollaborationListContentEditor": 
"includes/CollaborationListContentEditor.php",
                "SpecialCreateCollaborationHub": 
"includes/SpecialCreateCollaborationHub.php",
                "SpecialCreateHubFeature": 
"includes/SpecialCreateHubFeature.php",
+               "SpecialCollaborationKitIcons": 
"includes/SpecialCollaborationKitIcons.php",
                "ResourceLoaderListStyleModule": 
"includes/ResourceLoaderListStyleModule.php"
        },
        "ContentHandlers": {
@@ -53,6 +54,7 @@
                }
        },
        "SpecialPages": {
+               "CollaborationKitIcons": "SpecialCollaborationKitIcons",
                "CreateCollaborationHub": "SpecialCreateCollaborationHub",
                "CreateHubFeature": "SpecialCreateHubFeature"
        },
diff --git a/i18n/en.json b/i18n/en.json
index 47258de..3573027 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,6 +7,7 @@
                ]
        },
        "collaborationkit-desc": "Tools for building WikiProjects and on-wiki 
collaborative workspaces",
+       "collaborationkiticons": "CollaborationKit icon directory",
        "createcollaborationhub": "Create new Collaboration Hub",
        "createhubfeature": "Create a new Collaboration Hub feature",
        "collaborationkit-createhub-title": "Page title",
@@ -28,6 +29,9 @@
        "collaborationkit-createhubfeature-editsummary": "Creating new feature",
        "collaborationkit-createhubfeature-freetext": "Generic wiki page",
        "collaborationkit-createhubfeature-articlelist": "List of pages",
+       "collaborationkit-iconlist-intro": "These are the pre-packaged icons 
that can be used on Collaboration Hubs. Each icon name in the table corresponds 
to the keyword used in the Collaboration Hub editing interface to select the 
icon.",
+       "collaborationkit-iconlist-columnheader-icon": "Icon",
+       "collaborationkit-iconlist-columnheader-iconname": "Icon name",
        "collaborationkit-list-isempty": "This list has no columns or items.",
        "collaborationkit-list-emptycolumn": "This column has no items in it.",
        "collaborationkit-list-invalid": "This content does not meet the 
requirements of the CollaborationListContent schema. This may happen as a 
result of a software update. The content is reproduced below.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1fbaa1e..65bc54c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,6 +10,7 @@
                ]
        },
        "collaborationkit-desc": 
"{{desc|name=CollaborationKit|url=https://www.mediawiki.org/wiki/Extension:CollaborationKit}}";,
+       "collaborationkiticons": "Header for Special:CollaborationKitIcons",
        "createcollaborationhub": "Header for Special:CreateCollaborationHub",
        "createhubfeature": "Header for Special:CreateHubFeature. Hubs are the 
WikiProject pages as a whole, and \"features\" are the sections inside them.",
        "collaborationkit-createhub-title": "Label for target page title input 
on Special:CreateCollaborationHub\n{{Identical|Page title}}",
@@ -31,6 +32,9 @@
        "collaborationkit-createhubfeature-editsummary": "Edit summary used by 
Special:CreateHubFeature when creating a new feature",
        "collaborationkit-createhubfeature-freetext": "Label for selecting 
content type in the Create Hub Feature form corresponding to freeform text 
(i.e. wikitext)",
        "collaborationkit-createhubfeature-articlelist": "Label for selecting 
content type in the Create Hub Feature form corresponding to 
CollaborationListContent",
+       "collaborationkit-iconlist-intro": "Introductory text on 
Special:CollaborationKitIcons",
+       "collaborationkit-iconlist-columnheader-icon": "Column header in the 
table on Special:CollaborationKitIcons",
+       "collaborationkit-iconlist-columnheader-iconname": "Column header in 
the table on Special:CollaborationKitIcons",
        "collaborationkit-list-isempty": "Shown on lists that are empty 
immediately after the description",
        "collaborationkit-list-emptycolumn": "Shown on lists with empty columns 
in lieu of column content",
        "collaborationkit-list-invalid": "Message shown on lists that do not 
comply with the JSON Schema; shown before displaying the offending content",
diff --git a/includes/SpecialCollaborationKitIcons.php 
b/includes/SpecialCollaborationKitIcons.php
new file mode 100644
index 0000000..643579f
--- /dev/null
+++ b/includes/SpecialCollaborationKitIcons.php
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * Special page that generates a list of icons and corresponding icon names.
+ *
+ * @file
+ */
+
+class SpecialCollaborationKitIcons extends SpecialPage {
+
+       public function __construct() {
+               parent::__construct( 'CollaborationKitIcons' );
+               $this->mIncludable = true;
+       }
+
+       /**
+        * @param string $par
+        */
+       public function execute( $par ) {
+               $output = $this->getOutput();
+               $output->addModuleStyles( [
+                       'ext.CollaborationKit.hub.styles',
+                       'ext.CollaborationKit.icons',
+                       'ext.CollaborationKit.blots'
+               ] );
+               $this->setHeaders();
+
+               $icons = CollaborationKitImage::getCannedIcons();
+               
+               # Intro
+               $wikitext = $this->msg( 
'collaborationkit-iconlist-intro')->plain();
+               $wikitext .= "\n";
+
+               # Table header
+               $wikitext .= "{| class='wikitable'\n";
+               $wikitext .= "|-\n";
+               $wikitext .= '! style="height:50px;" | ' . $this->msg( 
'collaborationkit-iconlist-columnheader-icon' ) . "\n";
+               $wikitext .= '! ' . $this->msg( 
'collaborationkit-iconlist-columnheader-iconname' ) . "\n";
+               $wikitext .= "|-\n";
+
+               # Iterate through each icon and generate a row
+               for ( $i = 0; $i < count( $icons ); $i++ ) {
+                       $imageCode = CollaborationKitImage::makeImage(
+                               $icons[$i],
+                               60,
+                               [ 'renderAsWikitext' => true, 'link' => false ]
+                       );
+                       $wikitext .= '| ' . $imageCode . "\n";
+                       $wikitext .= '| ' . $icons[$i] . "\n";
+                       $wikitext .= "|-\n";
+               }
+
+               # End table
+               $wikitext .= '|}';
+
+               $output->addWikitext( $wikitext );
+       }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43815d3d425636b9a191f3d71380cc1b93bd3587
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Harej <jamesmh...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to