Difference between revisions of "Pcwiki"

From ProgClub
Jump to: navigation, search
(anh chau Ta cung voi nhin di)
Line 1: Line 1:
Pcwiki is the ProgClub wiki software. That's the software that drives the web-site you're looking at. It's a fork of [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] 1.17.0, with a custom skin called OldSkool, and the [http://www.mediawiki.org/wiki/Extension:NoTitle NoTitle] extension. Pcwiki has also been updated to include a link to the [http://validator.w3.org/ W3C HTML validation service] at the bottom of every page, boasting HTML5 support. See the [[Special:Version|MediaWiki version]] page for details about our MediaWiki configuration. For other projects see [[Projects]].
+
New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here.
 
 
== 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 [[Pcwiki#TODO|issues to address]].
 
 
 
== Contributors ==
 
 
 
Members who have contributed to this project. Newest on top.
 
 
 
* [[User:John|John]]
 
 
 
All contributors have agreed to the terms of the [[ProgClub:Copyrights#ProgClub_projects|Contributor License Agreement]]. This excludes any upstream contributors who tend to have different administrative frameworks.
 
 
 
Upstream contributors:
 
 
 
* [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/CREDITS MediaWiki contributors]
 
 
 
== Copyright ==
 
 
 
Copyright 2011, [[Pcwiki#Contributors|Contributors]]. Licensed under the [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/COPYING 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 ==
 
 
 
* [http://www.mediawiki.org/wiki/MediaWiki MediaWiki web-site]
 
* [http://en.wikipedia.org/wiki/MediaWiki MediaWiki on Wikipedia]
 
* [http://www.mediawiki.org/wiki/Mailing_lists MediaWiki Mailing lists]
 
 
 
== 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.
 
 
 
[[Category:TODO]]
 
 
 
== Done ==
 
 
 
Stuff that's done. Latest stuff on top.
 
 
 
* [[User:John|JE]] 2011-08-10: Added [[Pcwiki#Notes_for_implementers|Notes for implementers]]
 
* [[User:John|JE]] 2011-08-10: Modified to include section 'link' links next to edit links. These link to the section on the canonical URL.
 
* [[User:John|JE]] 2011-08-01: Modified to include #top links next to edit links
 
* [[User:John|JE]] 2011-07-28: Modified to include link to the [http://validator.w3.org/ W3C HTML validation service]
 
* [[User:John|JE]] 2011-07-28: Modified to be valid HTML5
 
* [[User:John|JE]] 2011-07-28: Included [http://www.mediawiki.org/wiki/Extension:NoTitle NoTitle] extension
 
* [[User:John|JE]] 2011-07-28: Fiddled with the Vector skin's graphics to make them #c90 (organge) #000 (black) compatible for OldSkool
 
* [[User:John|JE]] 2011-07-28: Created OldSkool skin
 
* [[User:John|JE]] 2011-07-28: Created svn project: [http://www.progclub.org/svnro/pcrepo/pcwiki/ pcwiki]
 
* [[User:John|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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/skins/oldskool/screen.css 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 [http://www.gimp.org/ GIMP] program and using its 'colorize' feature on each of the files in the skin's [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/skins/oldskool/images/ 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 [http://www.mediawiki.org/wiki/Extension:NoTitle NoTitle] extension. We used the version for [http://www.mediawiki.org/wiki/Extension:NoTitle#MediaWiki_1.16 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/OutputPage.php 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/Skin.php 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/DefaultSettings.php includes/DefaultSettings.php] added the link to the validation service (note that this required the addition of the validation icon [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/skins/common/images/valid-html5.png 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/Setup.php 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/parser/Parser.php 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 &lt;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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/DefaultSettings.php 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 [http://www.progclub.org/svnro/pcrepo/pcwiki/trunk/includes/Linker.php 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 = "&lt;span class=\"canonical_section_link\">, &lt;a href=\"$section_link\">link&lt;/a>&lt;/span>" .
 
  "&lt;span class=\"top_link\">, &lt;a href=\"#top\">top&lt;/a>&lt;/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 = "&lt;span>$result$extended_links&lt;/span>";
 
 
  $result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language' => $lang ), $result );
 
  return "&lt;span class=\"editsection\">$result&lt;/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 = "&lt;span>$link$extended_links&lt;/span>";
 

Revision as of 16:15, 3 June 2012

New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here. New xrumer mod here.