Difference between revisions of "Pcwiki"

From ProgClub
Jump to: navigation, search
(Reverting spam.)
 
Line 46: Line 46:
 
* Mod to support "Auto:*" includes, and implement Auto:Motto extension
 
* Mod to support "Auto:*" includes, and implement Auto:Motto extension
 
* Modify the 'create account' feature to create a fully-fledged member account, with an LDAP entry, subscription to mailing lists, svn user, etc.
 
* Modify the 'create account' feature to create a fully-fledged member account, with an LDAP entry, subscription to mailing lists, svn user, etc.
 
[[Category:TODO]]
 
  
 
== Done ==
 
== Done ==

Latest revision as of 16:17, 11 December 2017

Pcwiki is the ProgClub wiki software. That's the software that drives the web-site you're looking at. It's a fork of MediaWiki 1.17.0, with a custom skin called OldSkool, and the NoTitle extension. Pcwiki has also been updated to include a link to the W3C HTML validation service at the bottom of every page, boasting HTML5 support. See the MediaWiki version page for details about our MediaWiki configuration. For other projects see Projects.

Project status

Released! There have been a few releases of the pcwiki software. The latest release is fairly stable, there are only a few niggling issues to address.

Contributors

Members who have contributed to this project. Newest on top.

All contributors have agreed to the terms of the Contributor License Agreement. This excludes any upstream contributors who tend to have different administrative frameworks.

Upstream contributors:

Copyright

Copyright 2011, Contributors. Licensed under the GPLv2 license.

Source code

The repository can be browsed online:

http://www.progclub.org/pcrepo/pcwiki

The code for pcwiki is publicly available from svn:

http://www.progclub.org/svnro/pcrepo/pcwiki/tags/latest

Or privately available for read-write access:

https://www.progclub.org/svn/pcrepo/pcwiki/trunk

Links

TODO

  • Fix the icon graphics for OldSkool, the colours are slightly off.
  • Mod to support "Auto:*" includes, and implement Auto:Motto extension
  • Modify the 'create account' feature to create a fully-fledged member account, with an LDAP entry, subscription to mailing lists, svn user, etc.

Done

Stuff that's done. Latest stuff on top.

  • JE 2011-08-10: Added Notes for implementers
  • JE 2011-08-10: Modified to include section 'link' links next to edit links. These link to the section on the canonical URL.
  • JE 2011-08-01: Modified to include #top links next to edit links
  • JE 2011-07-28: Modified to include link to the W3C HTML validation service
  • JE 2011-07-28: Modified to be valid HTML5
  • JE 2011-07-28: Included NoTitle extension
  • JE 2011-07-28: Fiddled with the Vector skin's graphics to make them #c90 (organge) #000 (black) compatible for OldSkool
  • JE 2011-07-28: Created OldSkool skin
  • JE 2011-07-28: Created svn project: pcwiki
  • JE 2011-07-28: Started with MediaWiki 1.17.0

Notes for implementers

If you are interested in incorporating the ProgClub mods to MediaWiki into your project, here's what you need to know.

OldSkool skin

You like the OldSkool skin? Thanks! I'm flattered. I'd be quite happy for you to use it in your own project, with one condition if you don't mind: that you change the colours. I didn't invent fixed-width fonts, but I did invent #000, #c90 and #37a101. Those colours constitute my brand, and I think it would be rather lame of you to impose on my trade mark by copying my look-and-feel. So, what you need to do if you want to use the OldSkool skin, is open the skins/oldskool/screen.css file for the skin, and find and replace "#000" with your background colour (or keep it as black), find and replace "#c90" with your highlight colour (this replaces the orange), and find and replace "#37a101" with your font colour (this replaces the green). You will then need to create a set of graphics for your chosen colour scheme. You can do this by downloading the free GIMP program and using its 'colorize' feature on each of the files in the skin's skins/oldskool/images directory. Then you'll have your very own brand, and it'll look almost as cool as mine! :)

NoTitle extension

We blatantly copied the NoTitle extension. We used the version for MediaWiki 1.16.

W3C validation icon

Note: this modification explicitly disables features that are reported as being non-standards-compliant, and it requires the addition of an icon file as noted below.

In includes/OutputPage.php commented out the alternate edit link:

/* JE: 2011-07-28: Removed so validator.w3.org doesn't complain
  // Alternate edit link
  $this->addLink( array(
    'rel' => 'edit',
    'title' => $msg,
    'href' => $this->getTitle()->getLocalURL( 'action=edit' )
  ) );
*/

In includes/Skin.php commented out the edit uri:

/* JE: 2011-07-28: Removed so validator.w3.org doesn't complain
  # Real Simple Discovery link, provides auto-discovery information
  # for the MediaWiki API (and potentially additional custom API
  # support such as WordPress or Twitter-compatible APIs for a
  # blogging extension, etc)
  $out->addLink( array(
    'rel' => 'EditURI',
    'type' => 'application/rsd+xml',
    'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ),
  ) );
*/

In includes/DefaultSettings.php added the link to the validation service (note that this required the addition of the validation icon skins/common/images/valid-html5.png):

$pwThisScheme = "http";

if ( isset( $_SERVER[ "HTTPS" ] ) and $_SERVER[ "HTTPS" ] === "on" ) {

  $pwThisScheme = "https";

}

$pwThisUrl = $pwThisScheme . "://" . $_SERVER[ "HTTP_HOST" ] . $_SERVER[ "REQUEST_URI" ];

$pwValidationUrl = "http://validator.w3.org/check?uri=" . urlencode( $pwThisUrl );

$wgFooterIcons = array(
  "copyright" => array(
    "copyright" => array(), // placeholder for the built in copyright icon
  ),
  "valid_html5" => array(
    "valid_html5" => array(
      //"src" => "$wgStylePath/common/images/valid-html5.png",
      "src" => null,
      "url" => $pwValidationUrl,
      "alt" => "This page is valid HTML5",
    )
  ),
  "poweredby" => array(
    "mediawiki" => array(
      "src" => null, // Defaults to "$wgStylePath/common/images/poweredby_mediawiki_88x31.png"
      "url" => "http://www.mediawiki.org/",
      "alt" => "Powered by MediaWiki",
    )
  ),
);

In includes/Setup.php added:

if( isset($wgFooterIcons["valid_html5"]) &&
  isset($wgFooterIcons["valid_html5"]["valid_html5"]) &&
  $wgFooterIcons["valid_html5"]["valid_html5"]["src"] === null ) {
  $wgFooterIcons["valid_html5"]["valid_html5"]["src"] = "$wgStylePath/common/images/valid-html5.png";
}

Extended edit links

This feature adds the canonical section 'link' and 'top' anchors to the section edit links section. These additional links can be disabled in themes by the inclusion of:

span.canonical_section_link { display: none; }
span.top_link { display: none; }

In includes/parser/Parser.php modified to pass $anchor to doEditSectionLink:

# give headline the correct <h#> tag
if ( $showEditLink && $sectionIndex !== false ) {
  // JE: 2011-08-09: passed $anchor variable in doEditSectionLink call
  if ( $isTemplate ) {
    # Put a T flag in the section identifier, to indicate to extractSections()
    # that sections inside <includeonly> should be counted.
    $editlink = $sk->doEditSectionLink( Title::newFromText( $titleText ), "T-$sectionIndex", null, $this->mOptions->getUserLang(), $anchor );
  }
  else {
    $editlink = $sk->doEditSectionLink( $this->mTitle, $sectionIndex, $headlineHint, $this->mOptions->getUserLang(), $anchor );
  }
}

In includes/DefaultSettings.php added:

// JE: 2011-08-10: added for canonical URL linking support
/**
 * Allows specification of the canonical URL components
 */
$wgCanonicalScheme = null;      /* e.g. 'http' or 'https' */
$wgCanonicalHost = null;        /* e.g. 'www.example.com' or 'example.com' */
$wgCanonicalSecureHost = null;  /* e.g. 'www.example.com' or 'secure.example.com' */

// JE: 2011-08-10: there would be a better place for these functions, but I'm not sure where that is
function pw_is_secure() {

  if ( isset( $_SERVER[ 'HTTPS' ] ) and $_SERVER[ 'HTTPS' ] === 'on' ) { return true; }

  return false;

}

function pw_get_canonical_scheme() {

  global $wgCanonicalScheme;

  if ( $wgCanonicalScheme !== null ) { return $wgCanonicalScheme; }

  if ( pw_is_secure() ) {

    return "https";

  }

  return "http";

}

function pw_get_canonical_host() {

  global $wgCanonicalHost;

  if ( $wgCanonicalHost !== null ) { return $wgCanonicalHost; }

  return $_SERVER[ "HTTP_HOST" ];

}

function pw_get_canonical_secure_host() {

  global $wgCanonicalSecureHost;

  if ( $wgCanonicalSecureHost !== null ) { return $wgCanonicalSecureHost; }

  return pw_get_canonical_host();

}

function pw_get_canonical_url_base() {

  global $wgCanonicalScheme, $wgCanonicalHost, $wgCanonicalSecureHost;

  // if no canonical features are used, make relative links
  if (
    $wgCanonicalSchem === null and
    $wgCanonicalHost === null and
    $wgCanonicalSecureHost === null ) { return ""; }

  $scheme = pw_get_canonical_scheme();
  $host = pw_get_canonical_host();

  if ( $scheme === 'https' ) { $host = pw_get_canonical_secure_host(); }

  return $scheme . '://' . $host;

}

In includes/Linker.php modified function doEditSectionLink to include:

// JE: 2011-08-09: Added section link.
$parts = explode( ":", $nt->mPrefixedText );
if ( count( $parts ) === 1 ) {
  $page = $nt->mUrlform;
}
else if ( count( $parts ) === 2 ) {
  $page = urlencode( $parts[ 0 ] ) . ":" . urlencode( str_replace( ' ', '_', $parts[ 1 ] ) );
}
else {
  $project = $parts[ 0 ];
  unset( $parts[ 0 ] );
  $page = implode( ":", $parts );
  $page = urlencode( $project ) . ":" . urlencode( str_replace( ' ', '_', $page ) );
}
global $wgArticlePath;
$section_link = pw_get_canonical_url_base() . str_replace( "$1", $page . "#" . $anchor, $wgArticlePath );
$extended_links = "<span class=\"canonical_section_link\">, <a href=\"$section_link\">link</a></span>" .
  "<span class=\"top_link\">, <a href=\"#top\">top</a></span>";

$result = null;
wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $attribs, $link, &$result, $lang ) );
if ( !is_null( $result ) ) {

  # For reverse compatibility, add the brackets *after* the hook is
  # run, and even add them to hook-provided text.  (This is the main
  # reason that the EditSectionLink hook is deprecated in favor of
  # DoEditSectionLink: it can't change the brackets or the span.)

  # JE: 2011-08-01: included extended links
  $result = "<span>$result$extended_links</span>";

  $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $result );
  return "<span class=\"editsection\">$result</span>";
}

# Add the brackets and the span, and *then* run the nice new hook, with
# clean and non-redundant arguments.

# JE: 2011-08-01: included extended links
$link = "<span>$link$extended_links</span>";