Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename from PickSome to Deliberation #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Extension:PickSome
# Extension: Deliberation

The PickSome extension all users to pick pages that show up in a global
PickSome list on the Special:PickSome page.
The Deliberation extension all users to pick pages that show up in a global
Deliberatiion list on the Special:Deliberation page.

## Installation

* Download and place the file(s) in a directory called PickSome in your extensions/ folder
* Download and place the file(s) in a directory called Deliberation in your extensions/ folder
* Add the following line to your LocalSettings.php
```
wfLoadExtension('PickSome');
wfLoadExtension('Deliberation');
```
* Run the update script `php <mediawiki-instance>/maintenance/update.php` to create the DB tables

## Usage

For logged in users, can enable PickSome by clicking "Start Picking" on the
sidebar menu. Then each valid page (see `$wgPickSomePage` below) will have
For logged in users, can enable Deliberation by clicking "Start Picking" on the
sidebar menu. Then each valid page (see `$wgDeliberationPage` below) will have
a special banner that allows the user to pick this page. They can pick up to
`<N>` proposals. All picked proposals will be viewable on the Special:PickSome page.
`<N>` proposals. All picked proposals will be viewable on the Special:Deliberation page.

## Parameters

* `$wgPickSomeNumberOfPicks` - The number of picks (defaulted to 2) each user can choose
* `$wgPickSomePage` - Determines if a page can be removed or added.
* `$wgDeliberationNumberOfPicks` - The number of picks (defaulted to 2) each user can choose
* `$wgDeliberationPage` - Determines if a page can be removed or added.
* If a string, matches as a regex for titles of pages that are pickable
* If a function, gets passed a Title and a permission (PickSome::ADD and PickSome::REMOVE) and needs to return a boolean
* `$wgPickSomeSortFunction` - A function that's handed two Title objects,
* If a function, gets passed a Title and a permission (Deliberation::ADD and Deliberation::REMOVE) and needs to return a boolean
* `$wgDeliberationSortFunction` - A function that's handed two Title objects,
and returns values that php's `usort` function would expect
(negative, zero, or positive for less than, equal to, or greater than).
This is used to sort the Special PickSome page that has the global list.
This is used to sort the Special Deliberation page that has the global list.

As an example of a `$wgPickSomePage` function, the following would allow someone to not remove picks, and add only if the page is a linked page in a marker page ("Eligible Picks"):
As an example of a `$wgDeliberationPage` function, the following would allow someone to not remove picks, and add only if the page is a linked page in a marker page ("Eligible Picks"):

```
$wgPickSomePage = function($title) {
if($permission == PickSome::REMOVE) {
$wgDeliberationPage = function($title) {
if($permission == Deliberation::REMOVE) {
return false;
}
$eligibleWildCardsTitle = Title::newFromText("Eligible Picks");
Expand All @@ -60,7 +60,7 @@ $wgPickSomePage = function($title) {

Example to sort the global page alphabetically:
```php
$wgPickSomeSortFunction = function($t1, $t2) {
$wgDeliberationSortFunction = function($t1, $t2) {
$text1 = $t1->getText();
$text2 = $t2->getText();

Expand All @@ -72,22 +72,22 @@ $wgPickSomeSortFunction = function($t1, $t2) {

## Special Page

This extension creates a new special page called "Special:PickSome". This is
This extension creates a new special page called "Special:Deliberation". This is
the place that most actions are taken through via actions, but also where
users can view the global PickSome list where all user selections are displayed.
This is also where `picksome-admin` users can delete other picks.
users can view the global Deliberation list where all user selections are displayed.
This is also where `deliberation-admin` users can delete other picks.

## Rights

* `'picksome'` - Accounts who have the rights to use PickSome can access the interface.:
* `'picksome-write'` - Accounts that can add/remove choices (after clearing $wgPickSomePage) above. Accounts that have `'picksome'` but not `'picksome-write`' will be able to view picks, but not make them
* `'picksome-admin'` - Accounts that can remove other user picks (from the global pick page)
* `'deliberation'` - Accounts who have the rights to use Deliberation can access the interface.:
* `'deliberation-write'` - Accounts that can add/remove choices (after clearing $wgDeliberationPage) above. Accounts that have `'deliberation'` but not `'deliberation-write`' will be able to view picks, but not make them
* `'deliberation-admin'` - Accounts that can remove other user picks (from the global pick page)

To enable for everyone, the following to lines should be added:

```
$wgGroupPermissions['*']['picksome'] = true;
$wgGroupPermissions['*']['picksome-write'] = true;
$wgGroupPermissions['*']['deliberation'] = true;
$wgGroupPermissions['*']['deliberation-write'] = true;
```

## Internationalization
Expand Down
44 changes: 22 additions & 22 deletions extension.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
{
"name": "PickSome",
"version": "0.0.1",
"name": "Deliberation",
"version": "0.1.0",
"author": [
"Open Tech Strategies"
],
"license-name": "GPL-2.0-or-later",
"url": "https://github.com/OpenTechStrategies/torque",
"descriptionmsg": "picksome-desc",
"descriptionmsg": "deliberation-desc",
"type": "specialpages",
"requires": {
"MediaWiki": ">= 1.31.0"
},
"LogHeaders": {
"picksome": "picksomelogpagetext"
"deliberation": "deliberationlogpagetext"
},
"LogNames": {
"picksome": "picksomelogpage"
"deliberation": "deliberationlogpage"
},
"LogActionsHandlers": {
"picksome/*": "LogFormatter"
"deliberation/*": "LogFormatter"
},
"LogTypes": [
"picksome"
"deliberation"
],
"SpecialPages": {
"PickSome": "PickSome"
"Deliberation": "Deliberation"
},
"MessagesDirs": {
"PickSome": [
"Deliberation": [
"i18n"
]
},
"AvailableRights": [
"picksome",
"picksome-write",
"picksome-admin"
"deliberation",
"deliberation-write",
"deliberation-admin"
],
"AutoloadClasses": {
"PickSome": "includes/specials/PickSome.php",
"PickSomeHooks": "includes/PickSomeHooks.php",
"PickSomeGlobalTemplate": "includes/templates/PickSomeGlobalTemplate.php",
"PickSomeSession": "includes/PickSomeSession.php"
"Deliberation": "includes/specials/Deliberation.php",
"DeliberationHooks": "includes/DeliberationHooks.php",
"DeliberationGlobalTemplate": "includes/templates/DeliberationGlobalTemplate.php",
"DeliberationSession": "includes/DeliberationSession.php"
},
"ResourceFileModulePaths": {
"localBasePath": ""
},
"Hooks": {
"LoadExtensionSchemaUpdates": "PickSomeHooks::onLoadExtensionSchemaUpdates",
"SiteNoticeAfter": "PickSomeHooks::siteNoticeAfter",
"SidebarBeforeOutput": "PickSomeHooks::onSidebarBeforeOutput"
"LoadExtensionSchemaUpdates": "DeliberationHooks::onLoadExtensionSchemaUpdates",
"SiteNoticeAfter": "DeliberationHooks::siteNoticeAfter",
"SidebarBeforeOutput": "DeliberationHooks::onSidebarBeforeOutput"
},
"config": {
"PickSomeNumberOfPicks": 2,
"PickSomePage": false,
"PickSomeSortFunction": false
"DeliberationNumberOfPicks": 2,
"DeliberationPage": false,
"DeliberationSortFunction": false
},
"manifest_version": 1
}
42 changes: 21 additions & 21 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"Open Tech Strategies"
]
},
"picksome": "PickSome",
"picksome-desc": "Specialized Extension to pick some pages for purposes of voting",
"picksome-title": "PickSome",
"picksome-all": "Everyone's Picks",
"action-picksome-all": "Everyone's Picks",
"picksome-choices": "PickSome Choices",
"picksome-my-picks": "My Picks",
"picksome-unpick": "Unpick",
"picksome-pick": "Pick this page",
"picksome-no-picks": "No Picks",
"picksome-current": "Current Page",
"picksome-view-all": "View Everyone's Picks",
"picksome-global-list": "PickSome Global List",
"picksome-remove-below": "To pick the current page, remove one below",
"picksome-stop": "Stop Picking",
"picksome-close-window": "Close Window",
"picksome-start": "Start Picking",
"picksomelogpage": "PickSome log",
"picksomelogpagetext": "This is a log of PickSome choices made by users",
"logentry-picksome-pick": "$1 Picked $3 in PickSome",
"logentry-picksome-remove": "$1 Removed $3 in PickSome"
"deliberation": "Deliberation",
"deliberation-desc": "Specialized Extension to choose pages for purposes of voting",
"deliberation-title": "Deliberation",
"deliberation-all": "Everyone's Choices",
"action-deliberation-all": "Everyone's Choices",
"deliberation-choices": "Deliberation Choices",
"deliberation-my-picks": "My Choices",
"deliberation-unpick": "Remove Choice",
"deliberation-pick": "Pick this page",
"deliberation-no-picks": "No Choices",
"deliberation-current": "Current Page",
"deliberation-view-all": "View Everyone's Picks",
"deliberation-global-list": "Deliberation Global List",
"deliberation-remove-below": "To choose the current page, remove one below",
"deliberation-stop": "Stop Deliberating",
"deliberation-close-window": "Close Window",
"deliberation-start": "Start Deliberating",
"deliberationlogpage": "Deliberation log",
"deliberationlogpagetext": "This is a log of Deliberation choices made by users",
"logentry-deliberation-pick": "$1 Picked $3 in Deliberation",
"logentry-deliberation-remove": "$1 Removed $3 in Deliberation"
}
Loading