Mailing List Archive

SVN: [40612] trunk/extensions
Revision: 40612
Author: adammck
Date: 2008-09-08 20:23:18 +0000 (Mon, 08 Sep 2008)

Log Message:
-----------
Initial import of Uniwiki extensions

Added Paths:
-----------
trunk/extensions/uniwiki/
trunk/extensions/uniwiki/.uniwiki.settings
trunk/extensions/uniwiki/Authors/
trunk/extensions/uniwiki/Authors/Authors.i18n.php
trunk/extensions/uniwiki/Authors/Authors.php
trunk/extensions/uniwiki/AutoCreateCategoryPages/
trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.i18n.php
trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.php
trunk/extensions/uniwiki/CatBoxAtTop/
trunk/extensions/uniwiki/CatBoxAtTop/CatBoxAtTop.php
trunk/extensions/uniwiki/CatBoxAtTop/style.css
trunk/extensions/uniwiki/CreatePage/
trunk/extensions/uniwiki/CreatePage/CreatePage.i18n.php
trunk/extensions/uniwiki/CreatePage/CreatePage.php
trunk/extensions/uniwiki/CreatePage/style.css
trunk/extensions/uniwiki/CssHooks/
trunk/extensions/uniwiki/CssHooks/CssHooks.php
trunk/extensions/uniwiki/CustomToolbar/
trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.i18n.php
trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.js
trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php
trunk/extensions/uniwiki/CustomToolbar/Element.Forms.js
trunk/extensions/uniwiki/CustomToolbar/images/
trunk/extensions/uniwiki/CustomToolbar/images/16/
trunk/extensions/uniwiki/CustomToolbar/images/16/attachment.png
trunk/extensions/uniwiki/CustomToolbar/images/16/audio.png
trunk/extensions/uniwiki/CustomToolbar/images/16/bold.png
trunk/extensions/uniwiki/CustomToolbar/images/16/default.png
trunk/extensions/uniwiki/CustomToolbar/images/16/external.png
trunk/extensions/uniwiki/CustomToolbar/images/16/horizontal-line.png
trunk/extensions/uniwiki/CustomToolbar/images/16/image.png
trunk/extensions/uniwiki/CustomToolbar/images/16/internal.png
trunk/extensions/uniwiki/CustomToolbar/images/16/italic.png
trunk/extensions/uniwiki/CustomToolbar/images/16/math.png
trunk/extensions/uniwiki/CustomToolbar/images/16/nowiki.png
trunk/extensions/uniwiki/CustomToolbar/images/16/user.png
trunk/extensions/uniwiki/CustomToolbar/images/16/video.png
trunk/extensions/uniwiki/CustomToolbar/images/22/
trunk/extensions/uniwiki/CustomToolbar/images/22/attachment.png
trunk/extensions/uniwiki/CustomToolbar/images/22/audio.png
trunk/extensions/uniwiki/CustomToolbar/images/22/bold.png
trunk/extensions/uniwiki/CustomToolbar/images/22/default.png
trunk/extensions/uniwiki/CustomToolbar/images/22/external.png
trunk/extensions/uniwiki/CustomToolbar/images/22/horizontal-line.png
trunk/extensions/uniwiki/CustomToolbar/images/22/image.png
trunk/extensions/uniwiki/CustomToolbar/images/22/internal.png
trunk/extensions/uniwiki/CustomToolbar/images/22/italic.png
trunk/extensions/uniwiki/CustomToolbar/images/22/math.png
trunk/extensions/uniwiki/CustomToolbar/images/22/nowiki.png
trunk/extensions/uniwiki/CustomToolbar/images/22/user.png
trunk/extensions/uniwiki/CustomToolbar/images/22/video.png
trunk/extensions/uniwiki/CustomToolbar/images/numbers/
trunk/extensions/uniwiki/CustomToolbar/images/numbers/1.png
trunk/extensions/uniwiki/CustomToolbar/images/numbers/2.png
trunk/extensions/uniwiki/CustomToolbar/images/numbers/3.png
trunk/extensions/uniwiki/CustomToolbar/images/numbers/4.png
trunk/extensions/uniwiki/CustomToolbar/images/numbers/5.png
trunk/extensions/uniwiki/CustomToolbar/style.css
trunk/extensions/uniwiki/FormatChanges/
trunk/extensions/uniwiki/FormatChanges/FormatChanges.i18n.php
trunk/extensions/uniwiki/FormatChanges/FormatChanges.php
trunk/extensions/uniwiki/FormatSearch/
trunk/extensions/uniwiki/FormatSearch/FormatSearch.php
trunk/extensions/uniwiki/FormatSearch/style.css
trunk/extensions/uniwiki/GenericEditPage/
trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.i18n.php
trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.js
trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php
trunk/extensions/uniwiki/GenericEditPage/global.css
trunk/extensions/uniwiki/GenericEditPage/style.css
trunk/extensions/uniwiki/Javascript/
trunk/extensions/uniwiki/Javascript/Javascript.php
trunk/extensions/uniwiki/Javascript/uniwiki.js
trunk/extensions/uniwiki/Layouts/
trunk/extensions/uniwiki/Layouts/Layouts.i18n.php
trunk/extensions/uniwiki/Layouts/Layouts.php
trunk/extensions/uniwiki/Layouts/style.css
trunk/extensions/uniwiki/MooTools12core/
trunk/extensions/uniwiki/MooTools12core/MooTools12core.php
trunk/extensions/uniwiki/MooTools12core/mootools-1.2-core-yc.js
trunk/extensions/uniwiki/uniwiki.png

Added: trunk/extensions/uniwiki/.uniwiki.settings
===================================================================
--- trunk/extensions/uniwiki/.uniwiki.settings (rev 0)
+++ trunk/extensions/uniwiki/.uniwiki.settings 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,16 @@
+
+# uniwiki
+# =======
+\$wgLogo = \"\$wgScriptPath/extensions/uniwiki/uniwiki.png\";
+\$uw = \"\$IP/extensions/uniwiki\";
+require_once(\"\$uw/CssHooks/CssHooks.php\");
+require_once(\"\$uw/Javascript/Javascript.php\");
+require_once(\"\$uw/MooTools12core/MooTools12core.php\");
+require_once(\"\$uw/AutoCreateCategoryPages/AutoCreateCategoryPages.php\");
+require_once(\"\$uw/GenericEditPage/GenericEditPage.php\");
+require_once(\"\$uw/CatBoxAtTop/CatBoxAtTop.php\");
+require_once(\"\$uw/Layouts/Layouts.php\");
+require_once(\"\$uw/Authors/Authors.php\");
+require_once(\"\$uw/CustomToolbar/CustomToolbar.php\");
+require_once(\"\$uw/CreatePage/CreatePage.php\");
+

Added: trunk/extensions/uniwiki/Authors/Authors.i18n.php
===================================================================
--- trunk/extensions/uniwiki/Authors/Authors.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/Authors/Authors.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,13 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+$wgAuthorsMessages = array();
+
+$wgAuthorsMessages['en'] = array(
+ 'authors_authors' => "Authors",
+ 'authors_anonymous' => "Anonymous"
+);

Added: trunk/extensions/uniwiki/Authors/Authors.php
===================================================================
--- trunk/extensions/uniwiki/Authors/Authors.php (rev 0)
+++ trunk/extensions/uniwiki/Authors/Authors.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,109 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Authors
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Authors",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Appends a list of contributors to articles"
+);
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once ("Authors.i18n.php");
+$wgExtensionFunctions[] = "UW_Authors_i18n";
+
+function UW_Authors_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgAuthorsMessages;
+ foreach ($wgAuthorsMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+/* ---- CONFIGURABLE OPTIONS ---- */
+
+$wgShowAuthorsNamespaces = array (NS_MAIN);
+$wgShowAuthors = true;
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['OutputPageBeforeHTML'][] = "UW_Authors_List";
+function UW_Authors_List (&$out, &$text) {
+ global $wgTitle, $wgRequest, $wgShowAuthorsNamespaces, $wgShowAuthors;
+
+ /* do nothing if the option is disabled
+ * (but why would the extension be enabled?) */
+ if (!wgShowAuthors)
+ return true;
+
+ // only build authors on namespaces in $wgShowAuthorsNamespaces
+ if (!in_array ($wgTitle->getNamespace(), $wgShowAuthorsNamespaces))
+ return true;
+
+ /* get the contribs from the database (don't use the default
+ * MediaWiki one since it ignores the current user) */
+ $article = new Article ($wgTitle);
+ $contribs = array();
+ $db = wfGetDB (DB_MASTER);
+ $rev_table = $db->tableName ("revision");
+ $user_table = $db->tableName ("user");
+
+ $sql = "SELECT rev_user, rev_user_text, user_real_name, MAX(rev_timestamp) as timestamp
+ FROM $rev_table LEFT JOIN $user_table ON rev_user = user_id
+ WHERE rev_page = {$article->getID()}
+ GROUP BY rev_user, rev_user_text, user_real_name
+ ORDER BY timestamp DESC";
+
+ $results = $db->query ($sql, __METHOD__);
+ while ($line = $db->fetchObject ($results)) {
+ $contribs[] = array(
+ $line->rev_user,
+ $line->rev_user_text,
+ $line->user_real_name
+ );
+ }
+
+ $db->freeResult ($results);
+
+
+ // return if there are no authors
+ if (sizeof ($results) <= 0)
+ return true;
+
+ // now build a sensible authors display in HTML
+ require_once ("includes/Credits.php");
+ $authors = "\n<div class='authors'>".
+ "<h4>" . wfMsg('authors_authors') . "</h4>".
+ "<ul>";
+ $anons = 0;
+ foreach ($contribs as $author) {
+ $id = $author[0];
+ $username = $author[1];
+ $realname = $author[2];
+
+ if ($id != "0") { // user with an id
+ $author_link = $realname
+ ? creditLink($username, $realname)
+ : creditLink($username);
+ $authors .= "<li>$author_link</li>";
+ } else { // anonymous
+ $anons++;
+ }
+ }
+ // add the anonymous entries
+ if ($anons > 0)
+ $authors .= "<li>" . wfMsg('authors_anonymous') . "</li>";
+ $authors .= "</ul></div>";
+
+ $text .= $authors;
+ return true;
+}
+

Added: trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.i18n.php
===================================================================
--- trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,30 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Auto_Create_Category_Pages
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+$wgAutoCreateCategoryPagesMessages = array();
+$wgAutoCreateCategoryPagesMessages['en'] = array(
+ 'accp_stub' => "This is a category page. It lists all of the pages in category \"$1\" as well as all subcategories of category \"$1\" if any exist.",
+ 'accp_createdby' => "Created automatically by the AutoCreateCategoryPage extension."
+);
+
+$wgAutoCreateCategoryPagesMessages['es'] = array(
+ 'accp_stub' => "Esta es una página de categorías. Aquí se enumeran todas las páginas en la categoría \"$1\" así como todas las subcategorías en la categoría \"$1\" si las hubiere.",
+ 'accp_createdby' => "Creado automáticamente por la extensión AutoCreateCategoryPe."
+);
+
+$wgAutoCreateCategoryPagesMessages['de'] = array(
+ 'accp_stub' => "Dies ist eine Kategorie Ãœbersicht. Es listet alle Seiten in der Kategorie \"$1\" sowie alle Unterkategorien der Kategorie \"$1\" wenn sie existiert.",
+ 'accp_createdby' => "Erstellt automatisch von der AutoCreateCategoryPage Erweiterung"
+);
+
+$wgAutoCreateCategoryPagesMessages['pt-br'] = array(
+ 'accp_stub' => "Esta é uma página de categoria. Ela lista todas as páginas da categoria \"$1\", bem como todas as subcategorias da categoria \"$1\", se existirem.",
+ 'accp_createdby' => "Gerada automaticamente pela extensão AutoCreateCategoryPag."
+);
+

Added: trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.php
===================================================================
--- trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.php (rev 0)
+++ trunk/extensions/uniwiki/AutoCreateCategoryPages/AutoCreateCategoryPages.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,85 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Auto_Create_Category_Pages
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "AutoCreateCategoryPages",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Create stub Category pages automatically"
+);
+
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once ("AutoCreateCategoryPages.i18n.php");
+$wgExtensionFunctions[] = "AutoCreateCategoryPages_i18n";
+
+function AutoCreateCategoryPages_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgAutoCreateCategoryPagesMessages;
+ foreach ($wgAutoCreateCategoryPagesMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['ArticleSaveComplete'][] = "UW_AutoCreateCategoryPages_Save";
+function UW_AutoCreateCategoryPages_Save (&$article, &$user, &$text, &$summary, &$minoredit,
+ &$watchthis, &$sectionanchor, &$flags, $revision) {
+ global $wgDBprefix;
+
+ /* after the page is saved, get all the categories
+ * and see if they exists as "proper" pages; if not
+ * then create a simple page for them automatically */
+
+ // extract the categories on this page
+ $regex = "/\[\[category:(.+?)(?:\|.*)?\]\]/i";
+ preg_match_all ($regex, $text, $matches);
+
+ // array of the categories on the page (in db form)
+ $on_page = array();
+ foreach ($matches[1] as $cat)
+ $on_page[] = Title::newFromText ($cat)->getDBkey();
+
+ // array of the categories in the db
+ $db = wfGetDB (DB_MASTER);
+ $results = $db->resultObject ($db->query(
+ "select distinct page_title from {$wgDBprefix}page " .
+ "where page_namespace = '".NS_CATEGORY."'"));
+
+ $in_db = array();
+ while ($r = $results->next())
+ $in_db[] = $r->page_title;
+
+ /* loop through the categories in the page and
+ * see if they already exist as a category page */
+ foreach ($on_page as $db_key) {
+ if (!in_array( $db_key, $in_db)) {
+
+ // if it doesn't exist, then create it here
+ $page_title = Title::newFromDBkey ($db_key)->getText();
+ $stub = wfMsg ("accp_stub", $page_title);
+ $summary = wfMsg ("accp_createdby");
+ $article = new Article (Title::newFromDBkey("Category:$db_key"));
+
+ try {
+ $article->doEdit ($stub, $summary, EDIT_NEW & EDIT_SUPPRESS_RC);
+
+ } catch (MWException $e) {
+ /* fail silently...
+ * todo: what can go wrong here? */
+ }
+ }
+ }
+
+ return true;
+}
+

Added: trunk/extensions/uniwiki/CatBoxAtTop/CatBoxAtTop.php
===================================================================
--- trunk/extensions/uniwiki/CatBoxAtTop/CatBoxAtTop.php (rev 0)
+++ trunk/extensions/uniwiki/CatBoxAtTop/CatBoxAtTop.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,54 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Category_Box_at_Top
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Uniwiki Category Box at Top",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Adds a category box to the top right of articles"
+);
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['BeforePageDisplay'][] = "UW_CatBoxAtTop_CSS";
+function UW_CatBoxAtTop_CSS (&$out) {
+ global $wgScriptPath;
+ $href = "$wgScriptPath/extensions/uniwiki/CatBoxAtTop/style.css";
+ $out->addScript ("<link rel='stylesheet' href='$href' />");
+ return true;
+}
+
+$wgHooks['OutputPageBeforeHTML'][] = "UW_CatBoxAtTop_Rejig";
+function UW_CatBoxAtTop_Rejig (&$out, &$text) {
+ global $wgVersion;
+
+ // no categories = no box
+ if (!$out->mCategoryLinks)
+ return true;
+
+ /* add a category box to the top of the output,
+ * to be dropped into the top right via CSS */
+ $catbox = "<div id=\"catbox\"><div>\n";
+ $catbox .= "<h5>Categories</h5><ul>\n";
+ $catlinks = array();
+ if ($wgVersion == '1.13.0') {
+ $catlinks = $out->mCategoryLinks['normal'];
+ } else {
+ $catlinks = $out->mCategoryLinks;
+ }
+ foreach ($catlinks as $cat)
+ $catbox .= "<li>$cat</li>\n";
+ $catbox .= "</ul></div></div>\n";
+
+ $text = $catbox.$text;
+ return true;
+}
+

Added: trunk/extensions/uniwiki/CatBoxAtTop/style.css
===================================================================
--- trunk/extensions/uniwiki/CatBoxAtTop/style.css (rev 0)
+++ trunk/extensions/uniwiki/CatBoxAtTop/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,52 @@
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Category_Box_at_Top
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+
+/* hide the table of contents
+ * THIS IS A TEMPORARY HACK! */
+#bodyContent #toc {
+ display: none; }
+
+/* move the catbox to the right, and
+ * float, to wrap surrounding content */
+#catbox {
+ float: right;
+ width: 10em;
+ padding-bottom: 1em;
+
+ /*margin-left: 1em;*/
+ border-left: 1em solid #fff;
+}
+
+ #catbox div {
+ border: 1px solid #aaa;
+ background: #fff;
+ }
+
+ #catbox h5 {
+ text-align: center;
+ padding: 0.25em 1em;
+ border-bottom: 1px solid #aaa;
+ background: #eee;
+ margin-bottom: 0;
+ }
+
+ #catbox ul {
+ margin: 0;
+ padding: 0.25em 0.5em;
+ }
+
+ #catbox li {
+ margin: 0;
+ display: block;
+ line-height: 1.8;
+ list-style-image: none;
+ }
+
+ /*#catbox li a {
+ display: block;
+ padding: 0.25em 0.5em;
+ border-bottom: 1px solid #eee;
+ }*/
+

Added: trunk/extensions/uniwiki/CreatePage/CreatePage.i18n.php
===================================================================
--- trunk/extensions/uniwiki/CreatePage/CreatePage.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/CreatePage/CreatePage.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,50 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+$wgCreatePageMessages = array();
+$wgCreatePageMessages['en'] = array(
+ 'createpage' => "Create a page",
+ 'createpage_submitbutton' => "Submit",
+ 'createpage_instructions' => "Enter the title of the page you wish to create:",
+ 'createpage_entertitle' => "Please enter a title for your page.",
+ 'createpage_titleexists' => "A page with this title, [[$1]], already exists. Would you like to edit the existing page?",
+ 'createpage_tryagain' => "No - I want to create a new page with a distinct title.",
+ 'createpage_editexisting' => "Yes - I want to contribute to the existing page."
+);
+
+$wgCreatePageMessages['es'] = array(
+ 'createpage' => "Crear una página",
+ 'createpage_submitbutton' => "Enviar",
+ 'createpage_instructions' => "Ingresa el título de la página que deseas crear:",
+ 'createpage_entertitle' => "Ingresa un título para tu página.",
+ 'createpage_titleexists' => "Ya existe una página con el título [[$1]]. ¿Quieres editar la página que ya existe?",
+ 'createpage_tryagain' => "No – quiero crear una página nueva con un título diferente.",
+ 'createpage_editexisting' => "Sí – quiero contribuir a la página que ya existe."
+);
+
+$wgCreatePageMessages['de'] = array(
+ 'createpage' => "Neue Seite erstellen",
+ 'createpage_submitbutton' => "Senden",
+ 'createpage_instructions' => "Gib den Namen der neu zu erstellenden Seite ein:",
+ 'createpage_entertitle' => "Titel für deine Seite.",
+ 'createpage_titleexists' => "Eine Seite mit diesem Namen [[$1]] existiert bereits. Möchtest Du die existierende Seite bearbeiten?",
+ 'createpage_tryagain' => "Nein - Ich möchte eine neue Seite mit einem anderen Titel anlegen.",
+ 'createpage_editexisting' => "Ja - Ich möchte die existierende Seite bearbeiten."
+);
+
+$wgCreatePageMessages['pt-br'] = array(
+ 'createpage' => "Criar uma página",
+ 'createpage_submitbutton' => "Criar",
+ 'createpage_instructions' => "Digite o título da página que você gostaria de criar:",
+ 'createpage_entertitle' => "Digite um título para sua página.",
+ 'createpage_titleexists' => "Uma página com o título, [[$1]], já existe. Você gostaria de editar a página existente?",
+ 'createpage_tryagain' => "Não - Eu quero criar uma nova página com outro título.",
+ 'createpage_editexisting' => "Sim - Eu quero editar a página existente."
+);
+

Added: trunk/extensions/uniwiki/CreatePage/CreatePage.php
===================================================================
--- trunk/extensions/uniwiki/CreatePage/CreatePage.php (rev 0)
+++ trunk/extensions/uniwiki/CreatePage/CreatePage.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,118 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+/* This code was adapted from CreatePage.php from:
+ * Travis Derouin <travis@wikihow.com>
+ *
+ * originally licensed as:
+ * GNU GPL v2.0 or later */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "CreatePage",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Adds a Special Page for creating new pages"
+);
+
+$wgHooks['BeforePageDisplay'][] = 'UW_CreatePage_CSS';
+function UW_CreatePage_CSS($out) {
+ global $wgScriptPath;
+ $out->addScript ("<link rel='stylesheet' href='$wgScriptPath/extensions/uniwiki/CreatePage/style.css' />");
+ return true;
+}
+
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once( 'CreatePage.i18n.php' );
+$wgExtensionFunctions[] = 'UW_CreatePage_i18n';
+
+function UW_CreatePage_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgCreatePageMessages;
+ foreach ($wgCreatePageMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+
+/* ---- SPECIAL PAGE ---- */
+
+require_once("SpecialPage.php");
+
+$wgExtensionFunctions[] = "wfCreatePage";
+function wfCreatePage() {
+ SpecialPage::AddPage (new SpecialPage ("CreatePage")); }
+
+
+function wfSpecialCreatePage ($parser) {
+ global $wgOut, $wgRequest, $wgUser;
+ $skin = $wgUser->getSkin();
+ $thisPage = Title::newFromText ("CreatePage", NS_SPECIAL);
+ $target = $wgRequest->getVal ("target", null);
+
+ // check to see if we are trying to create a page
+ if ($target != null) {
+ $title = Title::newFromText ($target);
+
+ if ($title->getArticleID() > 0) {
+
+ // if the title exists then let the user know and give other options
+ $wgOut->addWikiText (wfMsg ("createpage_titleexists", $title->getFullText())."<br/>");
+ $wgOut->addHTML ("<a href='".$title->getEditURL()."'>".wfMsg ("createpage_editexisting")."</a><br/>"
+ .$skin->makeLinkObj ($thisPage, wfMsg ("createpage_tryagain"))
+ );
+ } else {
+ /* TODO - may want to search for closely named pages and give
+ * other options here... */
+
+ // otherwise, redirect them to the edit page for their title
+ $wgOut->redirect ($title->getEditURL());
+ }
+
+ return;
+ }
+
+ // if this is just a normal GET, then output the form
+
+ // prefill the input with the title, if it was passed along
+ $newTitle = $wgRequest->getVal("newtitle", null);
+ if ($newTitle != null) $newTitle = str_replace("_", " ", $newTitle);
+
+ // add some instructions
+ $wgOut->addHTML(wfMsg('createpage_instructions'));
+
+ // js for checking the form
+ $wgOut->addHTML("
+ <script type='text/javascript' >
+ function checkForm(){
+ // check the title
+ if (document.createpageform.target && document.createpageform.target.value == \"\") {
+ alert('".wfMsg('createpage_entertitle')."');
+ document.createpageform.target.focus();
+ return false;
+ }
+ // everything is OK, return true
+ return true;
+ }
+ </script>
+ ");
+
+ // output the form
+ $wgOut->addHTML("
+ <form method=POST onsubmit='return checkForm()' name='createpageform'>
+ <input type=text name=target size=50 value='$newTitle'><br/><br/>
+ ");
+
+ $wgOut->addHTML("
+ <input type=submit value='".wfMsg('createpage_submitbutton')."'>
+ </form>
+ ");
+}
+

Added: trunk/extensions/uniwiki/CreatePage/style.css
===================================================================
--- trunk/extensions/uniwiki/CreatePage/style.css (rev 0)
+++ trunk/extensions/uniwiki/CreatePage/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,31 @@
+/* create a page BUTTON */
+#p-create h5 { display: none; }
+
+#p-create ul {
+ margin: 0;
+ border: 0;
+ padding: 0;
+}
+
+#p-create li {
+ list-style: none;
+ margin-bottom: 1em;
+ list-style-image: none;
+}
+
+#p-create .pBody {
+ padding-bottom: 0;
+ border: 0;
+}
+
+ #p-create .pBody a {
+ display: block;
+ font-size: 18px;
+ font-weight: bold;
+ line-height: 1;
+ text-align: center;
+ border: 2px solid #c7c7c7;
+ border-top-width: 4px;
+ padding: 1em 0;
+ color: #0099ff;
+ }

Added: trunk/extensions/uniwiki/CssHooks/CssHooks.php
===================================================================
--- trunk/extensions/uniwiki/CssHooks/CssHooks.php (rev 0)
+++ trunk/extensions/uniwiki/CssHooks/CssHooks.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,63 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_CSS_Hooks
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Uniwiki CSS Hooks",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Add some CSS hooks to the HTML output of articles, for better styling"
+);
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['OutputPageBeforeHTML'][] = 'UW_CssHooks_AddHooks';
+function UW_CssHooks_AddHooks (&$out, &$text) {
+ global $wgRequest;
+
+ // break the page into sections via their <h2>s
+ $sections = preg_split ("/(<a name=\".+?\"><\/a><h2>.+?<\/h2>)/",
+ $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ // remove the first empty section
+ if ($sections[0] == "")
+ array_shift ($sections);
+
+ $index = 0;
+ $output = '';
+ $div_open = false;
+ for ($i=0; $i<count ($sections); $i++) {
+
+ /* is this block of text a header? (check for mw-headline
+ * to only include actual section headers, and dodge toc) */
+ if (substr ($sections[$i], 0, 7) == "<a name") {
+ if (strstr ($sections[$i], "<span class=\"mw-headline\">") !== false) {
+ $index++;
+
+ /* close current section div, if one exists,
+ * and always open a new one with hooks */
+ if ($div_open) $output .= "</div>";
+ $output .= "<div class=\"uw-section sect-$index\">";
+ $div_open = true;
+ }
+ }
+
+ // re-add the original text
+ $output .= $sections[$i];
+
+ // close the last section, if one is open
+ if (($i==count ($sections)-1) && $div_open)
+ $output .= "</div>";
+ }
+
+ $text = $output;
+ return true;
+}
+

Added: trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.i18n.php
===================================================================
--- trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,216 @@
+<?php
+/* Internationalisation file for CustomToolbar extension.
+ */
+
+$wgCustomToolbarMessages = array();
+
+$wgCustomToolbarMessages['en'] = array(
+ 'ct_bold_sample' => "Bold text",
+ 'ct_bold_tip_ins' => "Insert bold text",
+ 'ct_bold_tip_wrap' => "Make this text bold",
+ 'ct_bold_caption' => "Bold",
+
+ 'ct_italic_sample' => "Italic text",
+ 'ct_italic_tip_ins' => "Insert italic text",
+ 'ct_italic_tip_wrap' => "Make this text italic",
+ 'ct_italic_caption' => "Italic",
+
+ 'ct_internal_sample' => "PageName",
+ 'ct_internal_tip_ins' => "Insert an internal link",
+ 'ct_internal_tip_wrap' => "Make this text an internal link",
+ 'ct_internal_caption' => "Internal Link",
+
+ 'ct_external_sample' => "http://example.com",
+ 'ct_external_tip_ins' => "Insert an external link",
+ 'ct_external_tip_wrap' => "Make this text an external link",
+ 'ct_external_caption' => "External Link",
+
+ 'ct_image_tip' => "Insert an image",
+ 'ct_image_caption' => "Add Image",
+
+ 'ct_attachment_tip' => "Insert an attachment",
+ 'ct_attachment_caption' => "Add Attachment",
+
+ 'ct_math_sample' => "Insert LaTeX formula here",
+ 'ct_math_tip_ins' => "Insert mathematical formula (LaTeX)",
+ 'ct_math_tip_wrap' => "Make this text a mathematical formula (LaTeX)",
+ 'ct_math_caption' => "Formula",
+
+ 'ct_nowiki_sample' => "Insert non-formatted text here",
+ 'ct_nowiki_tip_ins' => "Ignore wiki formatting",
+ 'ct_nowiki_tip_wrap' => "Ignore wiki formattting for this text",
+ 'ct_nowiki_caption' => "No Wiki",
+
+ 'ct_horizontal_tip' => "Insert a horizontal line (use sparingly)",
+ 'ct_horizontal_caption' => "Horizontal Line",
+
+ 'ct_upload' => "Upload $1",
+ 'ct_select' => "Select $1 to upload",
+ 'ct_caption' => "Add caption (optional)",
+ 'ct_link' => "Add link name (optional)",
+ 'ct_submit' => "Go!",
+ 'ct_close' => "Close window",
+ 'ct_success' => "File upload successful!",
+ 'ct_popupblocked' => "The upload popup was prevented from opening. Please check your popup blocker.",
+
+ 'ct_user_user' => "User",
+ 'ct_user_tip' => "Insert a link to a user page",
+ 'ct_user_caption' => "User Link",
+ 'ct_user_sample' => "Username"
+);
+
+$wgCustomToolbarMessages['es'] = array(
+ 'ct_bold_sample' => "Texto en negrita",
+ 'ct_bold_tip_ins' => "Insertar texto en negrita",
+ 'ct_bold_tip_wrap' => "Convertir este texto en negrita ",
+ 'ct_bold_caption' => "Negrita",
+
+ 'ct_italic_sample' => "Texto en cursiva",
+ 'ct_italic_tip_ins' => "Insertar texto en cursiva",
+ 'ct_italic_tip_wrap' => "Convertir este texto en cursiva ",
+ 'ct_italic_caption' => "Cursiva",
+
+ 'ct_internal_sample' => "Título del enlace",
+ 'ct_internal_tip_ins' => "Insertar un enlace interno",
+ 'ct_internal_tip_wrap' => "Convertir este texto en un enlace interno",
+ 'ct_internal_caption' => "Enlace interno",
+
+ 'ct_external_sample' => "http://ejemplo.com",
+ 'ct_external_tip_ins' => "Insertar un enlace externo",
+ 'ct_external_tip_wrap' => "Convertir este texto en un enlace externo",
+ 'ct_external_caption' => "Enlace externo",
+
+ 'ct_image_tip' => "Insertar una imagen",
+ 'ct_image_caption' => "Agregar imagen",
+
+ 'ct_attachment_tip' => "Insertar un archivo adjunto",
+ 'ct_attachment_caption' => "Agregar archivo adjunto",
+
+ 'ct_math_sample' => "Insertar la fórmula LaTeX aquí",
+ 'ct_math_tip_ins' => "Insertar la fórmula matemática (LaTeX)",
+ 'ct_math_tip_wrap' => "Convertir este texto en una fórmula matemática (LaTeX)",
+ 'ct_math_caption' => "Fórmula",
+
+ 'ct_nowiki_sample' => "Insertar aquí el texto no formateado",
+ 'ct_nowiki_tip_ins' => "Ignorar el formato wiki",
+ 'ct_nowiki_tip_wrap' => "Ignorar el formato wiki para este texto",
+ 'ct_nowiki_caption' => "Sin Wiki",
+
+ 'ct_horizontal_tip' => "Insertar una línea horizontal (utilizar con moderación)",
+ 'ct_horizontal_caption' => "Línea Horizontal",
+
+ 'ct_upload' => "Subir $1",
+ 'ct_select' => "Seleccionar $1 para subirlo",
+ 'ct_caption' => "Agregar un subtítulo (opcional)",
+ 'ct_link' => "Agregar el nombre del enlace (opcional)",
+ 'ct_submit' => "¡Ir!",
+ 'ct_close' => "Cerrar la ventana ",
+ 'ct_success' => "¡El archivo se subió con éxito!",
+ 'ct_popupblocked' => "No se pudo abrir la ventana para subir el archivo. Revise su bloqueador de ventanas emergentes."
+);
+
+$wgCustomToolbarMessages['de'] = array(
+ 'ct_bold_sample' => "Fetter Text",
+ 'ct_bold_tip_ins' => "Fetten Text einfügen",
+ 'ct_bold_tip_wrap' => "Diesen Text fett markieren",
+ 'ct_bold_caption' => "Fett",
+
+ 'ct_italic_sample' => "Kursiver Text",
+ 'ct_italic_tip_ins' => "Kursiven Text einfügen",
+ 'ct_italic_tip_wrap' => "Diesen Text kursiv markieren",
+ 'ct_italic_caption' => "Kursiv",
+
+ 'ct_internal_sample' => "Seitenname",
+ 'ct_internal_tip_ins' => "Einen internen Link einfügen",
+ 'ct_internal_tip_wrap' => "Diesen Text in einen internen Link umwandeln",
+ 'ct_internal_caption' => "Interner Link",
+
+ 'ct_external_sample' => "http://beispiel.de",
+ 'ct_external_tip_ins' => "Einen externen Link einfügen",
+ 'ct_external_tip_wrap' => "Diesen Text in einen externen Link umwandeln",
+ 'ct_external_caption' => "Externer Link",
+
+ 'ct_image_tip' => "Ein Bild einfügen",
+ 'ct_image_caption' => "Bild einfügen",
+
+ 'ct_attachment_tip' => "Eine Anlage einfuegen",
+ 'ct_attachment_caption' => "Eine Anlage anfuegen",
+
+ 'ct_math_sample' => "Hier LaTeX Formel einfügen",
+ 'ct_math_tip_ins' => "Hier mathematische Formel einfügen (LaTeX)",
+ 'ct_math_tip_wrap' => "Diesen Text in eine mathematische Formel umwandeln (LaTeX)",
+ 'ct_math_caption' => "Formel",
+
+ 'ct_nowiki_sample' => "Hier unformatierten Text eingeben",
+ 'ct_nowiki_tip_ins' => "Ignoriere wiki Formatierung",
+ 'ct_nowiki_tip_wrap' => "Ignoriere wiki Formatierung für diesen Text",
+ 'ct_nowiki_caption' => "Keine Wiki",
+
+ 'ct_horizontal_tip' => "Eine waagrechte Linie einfügen (nicht alzu oft verwenden)",
+ 'ct_horizontal_caption' => "Waagrechte Linie",
+
+ 'ct_upload' => "Hochladen $1",
+ 'ct_select' => "Wähle $1 zum hochladen.",
+ 'ct_caption' => "Beschriftung einfügen (optional)",
+ 'ct_link' => "Link benennen (optional)",
+ 'ct_submit' => "Go!",
+ 'ct_close' => "Fenster schliessen",
+ 'ct_success' => "Datei erfolgreich hochgeladen!",
+ 'ct_popupblocked' => "Das Hochladen-Popup wurde am Öffnen gehindert. Bitte überprüfe Deinen Popup-Blocker.",
+
+ 'ct_user_user' => "Benutzer",
+ 'ct_user_tip' => "Einen Link zu der Seite eines Freundes einfügen",
+ 'ct_user_caption' => "Einen Link zu einem Freund einfügen",
+ 'ct_user_sample' => "Benutzername"
+);
+
+$wgCustomToolbarMessages['pt-br'] = array(
+ 'ct_bold_sample' => "Texto em negrito",
+ 'ct_bold_tip_ins' => "Digitar texto em negrito",
+ 'ct_bold_tip_wrap' => "Colocar este texto em negrito",
+ 'ct_bold_caption' => "Negrito",
+
+ 'ct_italic_sample' => "Texto em itálico",
+ 'ct_italic_tip_ins' => "Digitar texto em itálico",
+ 'ct_italic_tip_wrap' => "Colocar este texto em itálico",
+ 'ct_italic_caption' => "Itálico",
+
+ 'ct_internal_sample' => "Título do link",
+ 'ct_internal_tip_ins' => "Inserir um link interno",
+ 'ct_internal_tip_wrap' => "Transformar este texto em link interno",
+ 'ct_internal_caption' => "Link Interno",
+
+ 'ct_external_sample' => "http://exemplo.com",
+ 'ct_external_tip_ins' => "Incluir um link externo",
+ 'ct_external_tip_wrap' => "Transformar este texto em link externo",
+ 'ct_external_caption' => "Link Externo",
+
+ 'ct_image_tip' => "Carregar uma imagem",
+ 'ct_image_caption' => "Adicionar uma Imagem",
+
+ 'ct_attachment_tip' => "Incluir um anexo",
+ 'ct_attachment_caption' => "Adicionar um Anexo",
+
+ 'ct_math_sample' => "Incluir fórmula LaTeX aqui",
+ 'ct_math_tip_ins' => "Incluir fórmula matemática (LaTeX)",
+ 'ct_math_tip_wrap' => "Transformar este texto em fórmula matemática (LaTeX)",
+ 'ct_math_caption' => "Fórmula",
+
+ 'ct_nowiki_sample' => "Inserir aqui o texto não formatado",
+ 'ct_nowiki_tip_ins' => "Ignorar a formatação wiki",
+ 'ct_nowiki_tip_wrap' => "Ignorar a formatação wiki neste texto",
+ 'ct_nowiki_caption' => "Sem wiki",
+
+ 'ct_horizontal_tip' => "Incluir uma linha horizontal (use com moderação)",
+ 'ct_horizontal_caption' => "Linha Horizontal",
+
+ 'ct_upload' => "Carregar $1",
+ 'ct_select' => "Selecionar $1 para carregar o arquivo",
+ 'ct_caption' => "Incluir uma explicação (opcional)",
+ 'ct_link' => "Incluir um nome para o link (opcional)",
+ 'ct_submit' => "Salvar",
+ 'ct_close' => "Fechar a janela",
+ 'ct_success' => "O arquivo foi carregado com sucesso!",
+ 'ct_popupblocked' => "O pop-up para carregar o arquivo foi bloqueado. Verifique o seu bloqueador de pop-ups."
+);
+

Added: trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.js
===================================================================
--- trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.js (rev 0)
+++ trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.js 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,271 @@
+Uniwiki.CustomToolbar = {
+
+ /* other plugins may add more buttons here,
+ * which will automatically be included */
+ Buttons: {
+ 'bold': {
+ 'key': "b",
+ 'open': "'''",
+ 'close': "'''",
+ 'sample': wfMsg('ct_bold_sample'),
+ 'tip': [wfMsg('ct_bold_tip_ins'), wfMsg('ct_bold_tip_wrap')],
+ 'caption': wfMsg('ct_bold_caption')
+ },
+ 'italic': {
+ 'key': "i",
+ 'open': "''",
+ 'close': "''",
+ 'sample': wfMsg('ct_italic_sample'),
+ 'tip': [wfMsg('ct_italic_tip_ins'), wfMsg('ct_italic_tip_wrap')],
+ 'caption': wfMsg('ct_italic_caption')
+ },
+ 'internal': {
+ 'key': "l",
+ 'open': "[[",
+ 'close': "]]",
+ 'sample': wfMsg('ct_internal_sample'),
+ 'tip': [wfMsg('ct_internal_tip_ins'), wfMsg('ct_internal_tip_wrap')],
+ 'caption': wfMsg('ct_internal_caption')
+ },
+ 'external': {
+ 'key': "e",
+ 'open': "[",
+ 'close': "]",
+ 'sample': wfMsg('ct_external_sample'),
+ 'tip': [wfMsg('ct_external_tip_ins'), wfMsg('ct_external_tip_wrap')],
+ 'caption': wfMsg('ct_external_caption')
+ },
+ 'image': {
+ 'key': "u",
+ 'caption': wfMsg('ct_image_caption'),
+ 'tip': wfMsg('ct_image_tip'),
+ 'func': function(textarea) {
+
+ /* Unless we are in the classic-mode textbox,
+ * pass the section id number so that we know
+ * where to add the image back into the page
+ * (the name of the textarea will always match
+ * the id of the section) */
+ if (textarea.name == "wpTextbox1") var section = textarea.name;
+ else var section = textarea.name.replace(/\D/g, '');
+
+ /* open the upload form in a popup window
+ * (this shold be moved to an iframe) */
+ popup = open(
+ wgServer + wgScript + "/Special:CustomToolbarUpload?type=image&section=" + section,
+ null, "scrollbars=yes, status=no, width=600, height=400"
+ );
+
+ /* check if the popup window wasn't blocked; if
+ * it was, then display a notice to let the user
+ * know that we didn't set them up the bomb */
+ if (popup != null && popup.opener != null) popup.opener = self;
+ else alert (wfMsg('ct_popupblocked'));
+ }
+ },
+ 'attachment': {
+ 'key': "a",
+ 'caption': wfMsg('ct_attachment_caption'),
+ 'tip': wfMsg('ct_attachment_tip'),
+ 'func': function(textarea) {
+
+ /* Unless we are in the classic-mode textbox,
+ * pass the section id number so that we know
+ * where to add the image back into the page
+ * (the name of the textarea will always match
+ * the id of the section) */
+ if (textarea.name == "wpTextbox1") var section = textarea.name;
+ else var section = textarea.name.replace(/\D/g, '');
+
+ /* open the upload form in a popup window
+ * (this shold be moved to an iframe) */
+ popup = open(
+ wgServer + wgScript + "/Special:CustomToolbarUpload?type=attachment&section=" + section,
+ null, "scrollbars=no, status=no, width=600, height=400"
+ );
+
+ /* check if the popup window wasn't blocked; if
+ * it was, then display a notice to let the user
+ * know that we didn't set them up the bomb */
+ if (popup != null && popup.opener != null) popup.opener = self;
+ else alert (wfMsg('ct_popupblocked'));
+ }
+ },
+ 'user': {
+ 'key': "u",
+ 'open': "[[" + wfMsg('ct_user_user') + ":",
+ 'close': "]]",
+ 'sample': wfMsg('ct_user_sample'),
+ 'tip': wfMsg('ct_user_tip'),
+ 'caption': wfMsg('ct_user_caption'),
+ },
+ 'math': {
+ 'key': "m",
+ 'open': "<math>",
+ 'close': "</math>",
+ 'sample': wfMsg('ct_math_sample'),
+ 'tip': [wfMsg('ct_math_tip_ins'), wfMsg('ct_math_tip_wrap')],
+ 'caption': wfMsg('ct_math_caption'),
+ 'advanced': true
+ },
+ 'nowiki': {
+ 'key': "n",
+ 'open': "<nowiki>",
+ 'close': "</nowiki>",
+ 'sample': wfMsg('ct_nowiki_sample'),
+ 'tip': [wfMsg('ct_nowiki_tip_ins'), wfMsg('ct_nowiki_tip_wrap')],
+ 'caption': wfMsg('ct_nowiki_caption'),
+ 'advanced': true
+ },
+ 'horizontal-line': {
+ 'key': "-",
+ 'open': "\n----\n",
+ 'close': "",
+ 'sample': "",
+ 'tip': wfMsg('ct_horizontal_tip'),
+ 'caption': wfMsg('ct_horizontal_caption'),
+ 'advanced': true
+ }
+ },
+
+ attach: function(elements, advanced) {
+ var buttons = $H(Uniwiki.CustomToolbar.Buttons);
+
+ /* accept either an array of elements,
+ * or a single element (which we will
+ * just bundle into a temp array */
+ if ($type(elements) != "array")
+ elements = [elements];
+
+ // iterate elements, to add a toolbar to each
+ elements.each (function (txta) {
+ var wrapper = new Element ("div", { 'class': "editor-wrap" });
+ var toolbar = new Element ("div", { 'class': "toolbar" });
+
+ // create and append the buttons
+ buttons.each (function (button,name) {
+
+ /* only add this button if this button is NOT
+ * advanced-only, or this txta is advanced */
+ if (advanced || !button.advanced) {
+ var div = new Element("div", {
+ 'class': "button but-" + name,
+ 'html': (button.caption || name)
+ }).inject(toolbar);
+ var func = null;
+
+ /* if this button has its own click handler,
+ * then attach it, and pass it a reference to
+ * the textarea which it will insert stuff into */
+ if (button.func) {
+ func = function() { button.func(txta); }
+
+ /* otherwise, the button will just be wrapping
+ * selected text in wiki markup, which is the
+ * same function every time */
+ } else {
+ func = function() {
+ /* either wrap up the current selection
+ * in the wiki tags, or insert the wrapped
+ * sample, using the wonderful CNET forms
+ * extension to MooTools */
+ txta.insertAroundCursor({
+ 'before': button.open,
+ 'after': button.close,
+ 'defaultMiddle': button.sample
+ }, true);
+ }
+ }
+ div.addEvent ("click", func);
+
+ // if this button has a hotkey, we will append it to the tooltip
+ var suffix = button.key ? (" [ctrl-" + button.key + "]") : "";
+
+ /* add the static tooltip to the button, or if a dual-
+ * tool-tip were provided ([0] = no selection, [1] =
+ * text is selected), add the event to facilitate */
+ if ($type(button.tip) == "array") {
+ div.addEvent ("mouseover", function() {
+ if (txta.getSelectedText().length) div.title = button.tip[1] + suffix;
+ else div.title = button.tip[0] + suffix;
+ });
+ } else if(button.tip)
+ div.title = button.tip + suffix;
+
+ /* if this button has a hotkey, then store it in the div,
+ * so we can iterate them later on, in txta.keypress */
+ if (button.key) div.store('key', button.key);
+ }
+ });
+
+ wrapper.inject(txta, "before");
+ toolbar.inject(wrapper);
+ txta.inject(wrapper);
+
+ /* when a key is pressed, check the hotkeys of
+ * each button, and trigger one if relevent
+ * (eg, ctrl+b = bold) */
+ txta.addEvent('keypress', function(e) {
+ if (!e.control) return true;
+
+ // find all of the buttons relevant to this txta
+ var my_buttons = e.target.getParent().getElements(".button");
+
+ var found = false;
+ my_buttons.each (function(button) {
+ if(button.retrieve("key") == e.key) {
+ button.fireEvent("click");
+ found = true;
+
+ /* switch the button to it's hover
+ * state for a very short time, to
+ * show the user what just happened */
+ button.addClass("hover");
+ (function() { button.removeClass("hover"); }).delay(250);
+ }
+ });
+
+ /* if we did something, then prevent the event from
+ * bubbling, to cancel browser behaviours (ctrl+b
+ * opens the bookmarks sidebar in mozilla, etc) */
+ if (found) e.stop();
+ });
+ });
+ },
+ insertIntoSection: function(index, text){
+ var txta = $$("#section-"+ index + " textarea")[0];
+ txta.insertAtCursor(text, true);
+ },
+ insertIntoClassic: function(text){
+ var txta = $$("#wpTextbox1")[0];
+ txta.insertAtCursor(text, true);
+ },
+ /* function poached from skins/common/upload.js
+ * and modified to take the path and values
+ * rather than getElementById-ing them */
+ fillDestFilename: function(path, destFile) {
+ // Find trailing part
+ var slash = path.lastIndexOf('/');
+ var backslash = path.lastIndexOf('\\\\');
+ var fname;
+ if (slash == -1 && backslash == -1) {
+ fname = path;
+ } else if (slash > backslash) {
+ fname = path.substring(slash+1, 10000);
+ } else {
+ fname = path.substring(backslash+1, 10000);
+ }
+ // Capitalise first letter and replace spaces by underscores
+ fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_');
+ // Output result
+ destFile.value = fname;
+ }
+};
+
+/* add the toolbar to all textareas (including the
+ * advanced editor, in advanced mode) ASAP */
+window.addEvent('domready', function() {
+ Uniwiki.CustomToolbar.attach($$(".generic-editor textarea.editor"));
+ Uniwiki.CustomToolbar.attach($$("#wpTextbox1"), true);
+});
+

Added: trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php
===================================================================
--- trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php (rev 0)
+++ trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,316 @@
+<?php
+# Copyright (C) 2008 Mark Johnston and Adam Mckaig
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# http://www.gnu.org/licenses/gpl-3.0.html
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => 'CustomToolbar',
+ 'author' => 'Mark Johnston, Adam Mckaig, Evan Wheeler',
+ 'version' => '0.1',
+ 'description' => 'Extension to build an extensible toolbar for MediaWiki.'
+);
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once( 'CustomToolbar.i18n.php' );
+
+// add the internationalization function to the list
+global $wgExtensionFunctions;
+$wgExtensionFunctions[] = 'CustomToolbar_i18n';
+
+//add file extensions for acceptable images and attachments
+global $wgFileExtensions;
+$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ogg', 'mp3', 'wav', 'doc', 'xls', 'csv', 'bmp', 'ppt', 'pdf', 'txt', 'rm', 'mov', 'avi' );
+
+//these will get thumbnails and image links
+$ct_uploadable_images = array('png', 'gif', 'jpg', 'jpeg' );
+//these will get media links
+$ct_uploadable_attachments = array('ogg', 'mp3', 'wav', 'doc', 'xls', 'csv', 'bmp', 'ppt', 'pdf', 'txt', 'rm', 'mov', 'avi' );
+
+
+
+function CustomToolbar_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgCustomToolbarMessages;
+ foreach( $wgCustomToolbarMessages as $lang => $messages )
+ $wgMessageCache->addMessages($messages, $lang);
+}
+
+
+$wgHooks['EditPage::showEditForm:initial'][] = "CustomToolbar_turnOffToolbar";
+function CustomToolbar_turnOffToolbar() {
+ global $wgUser, $wgHooks;
+
+ /* if the user has the edit toolbar turned on, then turn
+ * it off (to hide the ugly toolbar), and add the BeforePageDisplay
+ * hook, too attach our replacement */
+ if($wgUser->getOption('showtoolbar')) {
+ $wgUser->setOption('showtoolbar', false);
+ $wgHooks['BeforePageDisplay'][] = 'CustomToolbar_addAssets';
+ }
+
+ return true;
+}
+
+function CustomToolbar_addAssets(&$out) {
+ global $wgScriptPath, $wgCustomToolbarMessages, $wgLanguageCode;
+
+ /* add all messages for the current lang by iterating the
+ * global array, and converting it into a javascript hash */
+ $js = "Uniwiki.i18n.add({\n";
+ foreach ($wgCustomToolbarMessages[$wgLanguageCode] as $key => $str) {
+ $js .= "\t'".$key."': \"".$str."\",\n";
+ }
+
+ // chop off last comma + newline, for IE
+ $js = substr($js,0,strlen($js)-2)."})";
+ $out->addInlineScript($js);
+
+ $path = "$wgScriptPath/extensions/uniwiki/CustomToolbar";
+ $out->addScript("<script type='text/javascript' src='$path/Element.Forms.js'></script>\n");
+ $out->addScript("<script type='text/javascript' src='$path/CustomToolbar.js'></script>\n");
+ $out->addScript("<style type='text/css'>@import '$path/style.css';</style>\n");
+ return true;
+
+}
+
+$wgExtensionFunctions[] = 'wfCustomToolbarUploadForm';
+function wfCustomToolbarUploadForm() {
+ $file = "extensions/uniwiki/CustomToolbar/CustomToolbar.php";
+ SpecialPage::AddPage(
+ new UnlistedSpecialPage('CustomToolbarUpload', '', false, $file)
+ );
+}
+
+function wfSpecialCustomToolbarUpload() {
+ global $wgRequest;
+ $form = new CustomToolbarUploadForm($wgRequest);
+ $form->execute();
+}
+
+$wgHooks['UploadComplete'][] = array('CustomToolbarUploadForm::showSuccess');
+//XX TODO investigate FileUpload hook for attachment purposes
+//$wgHooks['FileUpload'][] = array('CustomToolbarUploadForm::showSuccess', 'attachment');
+if ($wgVersion == '1.13.0') {
+ require_once('includes/specials/SpecialUpload.php');
+} else {
+ require_once('includes/SpecialUpload.php');
+}
+class CustomToolbarUploadForm extends UploadForm {
+ /* Some code poached from Travis Derouin's <travis@wikihow.com>
+ * UploadPopup extension
+ */
+ var $mType, $mSection, $mCaption;
+
+ function CustomToolbarUploadForm(&$request) {
+ $this->mType = $request->getVal('type');
+ $this->mCaption = $request->getText('wpCaption');
+ $this->mSection = $request->getVal('section');
+ UploadForm::UploadForm(&$request);
+ }
+
+ function execute() {
+ // override MW's UploadForm with only the bits we want
+ global $wgOut, $wgStylePath;
+ $wgOut->setArticleBodyOnly(true);
+ $wgOut->addHTML("
+ <html>
+ <head>
+ <title>". wfMsg('ct_upload', $this->mType) . " </title>
+ </head>
+ <body>");
+ $wgOut->addHTML("<h2>". wfMsg('ct_upload', $this->mType) . " </h2>");
+ UploadForm::execute();
+ $wgOut->addHTML("
+ </body>
+ </html>");
+ }
+
+ function mainUploadForm( $msg = '') {
+ global $wgOut, $wgScriptPath, $wgStylePath;
+ if ( '' != $msg ) {
+ $sub = wfMsgHtml( 'uploaderror' );
+ $wgOut->addHTML( "<h2>{$sub}</h2>\n" .
+ "<span class='error'>{$msg}</span>\n" );
+ }
+
+ $source_filename = wfMsg('ct_select', $this->mType);
+ $destination_filename = wfMsgHtml( 'destfilename' );
+ $caption = $this->mType == 'image' ? wfMsg('ct_caption') : wfMsg('ct_link');
+ $linkname = wfMsg('ct_link');
+ $submit = wfMsg('ct_submit');
+
+ $upload_button = wfMsgHtml( 'uploadbtn' );
+ $cancel_button = wfMsg('cancel');
+
+ $titleObj = Title::makeTitle( NS_SPECIAL, 'CustomToolbarUpload' );
+ $action = $titleObj->escapeLocalURL();
+
+ $encDestFile = htmlspecialchars( $this->mDestFile );
+
+ $icon_path = "{$wgScriptPath}/extensions/uniwiki/CustomToolbar/images/numbers/";
+ /* The following form contains a strange hack for passing the section index id
+ * through the upload function so we know where to insert the file tag.
+ * This info is passed as wpDestFileWarningAck and retrieved from the returned,
+ * uploaded object as $image->mDestWarningAck (see includes/SpecialUpload.php)
+ * This parameter doesn't seem to be used for anything other than raising warnings,
+ * all of which we are ignoring ... for better or for worse
+ */
+ $wgOut->addHTML( "
+ <form id='upload' name='uploadform' method='post' enctype='multipart/form-data' action=\"$action\" '>
+ <table border='0'>
+ <tr>
+ <td align='left'><img src='{$icon_path}1.png' alt='1.' />
+ <label for='wpUploadFile'>{$source_filename}:</label></td>
+ <td align='left'>
+ <input type='file' name='wpUploadFile' id='wpUploadFile' "
+ . ($this->mDestFile?"":"onchange=\"opener.Uniwiki.CustomToolbar.fillDestFilename(document.getElementById('wpUploadFile').value, document.getElementById('wpDestFile') )\" ") . "size='40' />
+ </td>
+ </tr>
+ <tr>
+ <td align='left'><img src='{$icon_path}2.png' alt='2.' />
+ <label for='wpCaption'>{$caption}:</label></td>
+ <td align='left'>
+ <input type='text' name=\"wpCaption\" size='40'\"/>
+ </td>
+ </tr>
+ <td align='left'><img src='{$icon_path}3.png' alt='3.' />
+ <label for='wpUpload'>{$submit}</label></td>
+ <td align='left'><input type='submit' name='wpUpload' value=\"{$upload_button}\" />
+ <input type='button' name='wpCancel' onclick='window.close()' value=\"{$cancel_button}\"/></td>
+ <tr>
+ <td></td>
+ <td>
+ <input type='hidden' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' checked/>
+ <input type='hidden' name='wpDestFileWarningAck' id='wpDestFileWarningAck' value='{$this->mSection}'/>
+ <input type='hidden' name='wpDestFile' id='wpDestFile' />
+ </td>
+ </tr>
+ </table>
+ </form>
+ ");
+ }
+
+ function showSuccess(&$file) {
+ global $wgOut, $ct_uploadable_images, $ct_uploadable_attachments;
+
+ //styles copied from monobook/main.css
+ //modified to not float the whole preview to the right
+ $wgOut->addHTML("
+ <style>
+ /* thumbnails */
+ div.thumb {
+ margin-bottom: .5em;
+ border-style: solid;
+ border-color: white;
+ width: auto;
+ }
+ div.thumbinner {
+ border: 1px solid #ccc;
+ padding: 3px !important;
+ background-color: #f9f9f9;
+ font-size: 94%;
+ text-align: center;
+ overflow: hidden;
+ }
+ html .thumbimage {
+ border: 1px solid #ccc;
+ }
+ html .thumbcaption {
+ border: none;
+ text-align: left;
+ line-height: 1.4em;
+ padding: 3px !important;
+ font-size: 94%;
+ }
+ div.magnify {
+ float: right;
+ border: none !important;
+ background: none !important;
+ }
+ div.magnify a, div.magnify img {
+ display: block;
+ border: none !important;
+ background: none !important;
+ }
+ div.tright {
+ border-width: .5em 0 .8em 1.4em;
+ }
+ div.tleft {
+ margin-right: .5em;
+ border-width: .5em 1.4em .8em 0;
+ }
+ img.thumbborder {
+ border: 1px solid #dddddd;
+ }
+ .hiddenStructure {
+ display: none;
+ }
+ </style>
+ ");
+ $wgOut->redirect('');
+ $wgOut->addHTML("<h2>" . wfMsg('ct_success') . "</h2>");
+
+ //make wiki markup for the file
+ $ext = explode('.', $file->mDestName );
+ $extension = $ext[count( $ext ) - 1];
+ if (in_array($extension, $ct_uploadable_images )){
+ $file_link = '[.[.' . 'Image:' . $file->mDestName . '|thumb|' . $file->mCaption . ']]';
+ }
+ elseif (in_array($extension, $ct_uploadable_attachments )){
+ $file_link = '[.[.' . 'Media:' . $file->mDestName . '|' . $file->mCaption . ']]';
+ }
+
+ $titleObj = Title::makeTitle( NS_SPECIAL, 'CustomToolbarUpload' );
+ //insert the wiki markup in the appropriate section
+ //or the classic-mode textarea if we are in classic-mode
+ if($file->mDestWarningAck != 'wpTextbox1'){
+ $insertion = 'opener.Uniwiki.CustomToolbar.insertIntoSection(section, file_link)';
+ }else{
+ $insertion = 'opener.Uniwiki.CustomToolbar.insertIntoClassic(file_link)';
+ }
+ $wgOut->addHTML( "
+ <script type='text/javascript'>
+ var file_link = \"{$file_link}\";
+ var caption = \"{$file->mCaption}\";
+ var section =\"{$file->mDestWarningAck}\";
+ {$insertion};
+ </script>
+ ");
+
+ //show a thumbnail of the image as it will appear on the page
+ $wgOut->addWikiText($file_link);
+ $wgOut->addHTML("
+ <a href='#' onclick='window.close()'>" . wfMsg('ct_close') . "</a>
+ </div>
+ ");
+ /* The UploadComplete hook is placed before the usual MW redirection
+ * that follows a successful upload, so in order to show our success
+ * page and insert the markup, we dump this output and kill the process
+ * to avoid redirection to the file's page.
+ */
+ print($wgOut->output());
+ exit;
+ }
+
+ //XX TODO make a prettier error page
+ //function showError() {
+ //}
+}

Added: trunk/extensions/uniwiki/CustomToolbar/Element.Forms.js
===================================================================
--- trunk/extensions/uniwiki/CustomToolbar/Element.Forms.js (rev 0)
+++ trunk/extensions/uniwiki/CustomToolbar/Element.Forms.js 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,157 @@
+/*
+Script: Element.Forms.js
+ Extends the Element native object to include methods useful in managing inputs.
+
+License:
+ http://clientside.cnet.com/wiki/cnet-libraries#license
+*/
+Element.implement({
+ tidy: function(){
+ try {
+ this.set('value', this.get('value').tidy());
+ }catch(e){dbug.log('element.tidy error: %o', e);}
+ },
+ getTextInRange: function(start, end) {
+ return this.get('value').substring(start, end);
+ },
+ getSelectedText: function() {
+ if(Browser.Engine.trident) return document.selection.createRange().text;
+ return this.get('value').substring(this.getSelectionStart(), this.getSelectionEnd());
+ },
+ getBookmarkOffset: function() {
+ if(Browser.Engine.trident) {
+ var tmp_range = this.createTextRange();
+ tmp_range.move("character", 0);
+ return tmp_range.getBookmark().charCodeAt(2);
+ } else return null;
+ },
+ getSelectionStart: function() {
+ if(Browser.Engine.trident) {
+ this.focus();
+ var range = document.selection.createRange();
+ if (range.compareEndPoints("StartToEnd", range) != 0) range.collapse(true);
+ return range.getBookmark().charCodeAt(2) - this.getBookmarkOffset();
+ }
+ return this.selectionStart;
+ },
+ getSelectionEnd: function() {
+ if(Browser.Engine.trident) {
+ var range = document.selection.createRange();
+ if (range.compareEndPoints("StartToEnd", range) != 0) range.collapse(false);
+ return range.getBookmark().charCodeAt(2) - this.getBookmarkOffset();
+ }
+ return this.selectionEnd;
+ },
+ getSelectedRange: function() {
+ return {
+ start: this.getSelectionStart(),
+ end: this.getSelectionEnd()
+ }
+ },
+ setCaretPosition: function(pos) {
+ if(pos == 'end') pos = this.get('value').length;
+ this.selectRange(pos, pos);
+ return this;
+ },
+ getCaretPosition: function() {
+ return this.getSelectedRange().start;
+ },
+ selectRange: function(start, end) {
+ this.focus();
+ if(Browser.Engine.trident) {
+ var range = this.createTextRange();
+ range.collapse(true);
+ range.moveStart('character', start);
+ range.moveEnd('character', end - start);
+ range.select();
+ return this;
+ }
+ this.setSelectionRange(start, end);
+ return this;
+ },
+ insertAtCursor: function(value, select) {
+ var start = this.getSelectionStart();
+ var end = this.getSelectionEnd();
+ this.set('value', this.get('value').substring(0, start) + value + this.get('value').substring(end, this.get('value').length));
+ if($pick(select, true)) this.selectRange(start, start + value.length);
+ else this.setCaretPosition(start + value.length);
+ return this;
+ },
+ insertAroundCursor: function(options, select) {
+ options = $merge({
+ before: '',
+ defaultMiddle: 'SOMETHING HERE',
+ after: ''
+ }, options);
+ value = this.getSelectedText() || options.defaultMiddle;
+ var start = this.getSelectionStart();
+ var end = this.getSelectionEnd();
+ if(start == end) {
+ var text = this.get('value');
+ this.set('value', text.substring(0, start) + options.before + value + options.after + text.substring(end, text.length));
+ this.selectRange(start + options.before.length, end + options.before.length + value.length);
+ text = null;
+ } else {
+ text = this.get('value').substring(start, end);
+ this.set('value', this.get('value').substring(0, start) + options.before + text + options.after + this.get('value').substring(end, this.get('value').length));
+ var selStart = start + options.before.length;
+ if($pick(select, true)) this.selectRange(selStart, selStart + text.length);
+ else this.setCaretPosition(selStart + text.length);
+ }
+ return this;
+ }
+});
+
+
+Element.Properties.inputValue = {
+
+ get: function(){
+ switch(this.get('tag')) {
+ case 'select':
+ vals = this.getSelected().map(function(op){ return $pick(op.get('value'),op.get('text')) });
+ return this.get('multiple')?vals:vals[0];
+ case 'input':
+ if(['radio','checkbox'].contains(this.get('type')))
+ return this.get('checked')?this.get('name'):false;
+ default:
+ return this.get('value');
+ }
+ },
+
+ set: function(value){
+ switch(this.get('tag')){
+ case 'select':
+ this.getElements('option').each(function(op){
+ op.set('selected', $splat(value).contains($pick(op.get('value'), op.get('text'))));
+ });
+ break;
+ case 'input':
+ if (['radio','checkbox'].contains(this.get('type'))) {
+ this.set('checked', $type(value)=="boolean"?value:$splat(value).contains(this.get('name')));
+ break;
+ }
+ default:
+ this.set('value', value);
+ }
+ return this;
+ },
+
+ erase: function() {
+ switch(this.get('tag')) {
+ case 'select':
+ this.getElements('option').each(function(op) {
+ op.set('selected', false);
+ });
+ break;
+ case 'input':
+ if (['radio','checkbox'].contains(this.get('type'))) {
+ this.set('checked', false);
+ break;
+ }
+ default:
+ this.set('value', '');
+ }
+ return this;
+ }
+
+};

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/attachment.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/attachment.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/audio.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/audio.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/bold.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/bold.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/default.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/default.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/external.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/external.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/horizontal-line.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/horizontal-line.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/image.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/internal.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/internal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/italic.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/italic.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/math.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/math.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/nowiki.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/nowiki.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/user.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/user.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/16/video.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/16/video.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/attachment.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/attachment.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/audio.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/audio.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/bold.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/bold.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/default.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/default.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/external.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/external.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/horizontal-line.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/horizontal-line.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/image.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/internal.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/internal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/italic.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/italic.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/math.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/math.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/nowiki.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/nowiki.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/user.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/user.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/22/video.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/22/video.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/numbers/1.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/numbers/1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/numbers/2.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/numbers/2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/numbers/3.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/numbers/3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/numbers/4.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/numbers/4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/images/numbers/5.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/CustomToolbar/images/numbers/5.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

Added: trunk/extensions/uniwiki/CustomToolbar/style.css
===================================================================
--- trunk/extensions/uniwiki/CustomToolbar/style.css (rev 0)
+++ trunk/extensions/uniwiki/CustomToolbar/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,56 @@
+.editor-wrap {
+ /* make the editor wrapper look like a regular
+ * text area, to make the toolbar look as if
+ * if is nested within it */
+ border: 2px inset buttonface;
+ zoom: 1;
+}
+
+ .editor-wrap .toolbar {
+ background: #F4F4F4;
+ color: #888;
+ padding: 1px;
+ overflow: auto;
+ display: inline-block;
+ margin-bottom: 0.5em;
+ border-bottom: 1px solid #CCC;
+ width: 100%;
+ }
+
+ .editor-wrap .toolbar .button {
+ cursor: pointer;
+ float: left;
+ line-height: 16px;
+ padding: 4px 6px 2px 24px;
+ font-size: 8pt;
+ border: 1px solid #f4f4f4;
+ background: url("images/16/default.png") no-repeat 4px 50%;
+ }
+
+ .editor-wrap .toolbar .button:hover,
+ .editor-wrap .toolbar .button.hover {
+ background-color: white;
+ border: 1px solid #aaa;
+ color: #000;
+ }
+
+ .editor-wrap .toolbar .but-bold { background-image: url("images/16/bold.png"); }
+ .editor-wrap .toolbar .but-italic { background-image: url("images/16/italic.png"); }
+ .editor-wrap .toolbar .but-internal { background-image: url("images/16/internal.png"); }
+ .editor-wrap .toolbar .but-external { background-image: url("images/16/external.png"); }
+ .editor-wrap .toolbar .but-image { background-image: url("images/16/image.png"); }
+ .editor-wrap .toolbar .but-attachment { background-image: url("images/16/attachment.png"); }
+ .editor-wrap .toolbar .but-horizontal-line { background-image: url("images/16/horizontal-line.png"); }
+ .editor-wrap .toolbar .but-nowiki { background-image: url("images/16/nowiki.png"); }
+ .editor-wrap .toolbar .but-math { background-image: url("images/16/math.png"); }
+ .editor-wrap .toolbar .but-user { background-image: url("images/16/user.png"); }
+
+ .editor-wrap textarea {
+ padding: 0;
+ width: 100%;
+ border: 0;
+ }
+
+.edit-generic .editor-wrap { display: none; }
+.edit-generic .generic-editor .editor-wrap { display: block; }
+

Added: trunk/extensions/uniwiki/FormatChanges/FormatChanges.i18n.php
===================================================================
--- trunk/extensions/uniwiki/FormatChanges/FormatChanges.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/FormatChanges/FormatChanges.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,14 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+$wgFormatChangesMessages = array();
+
+$wgFormatChangesMessages['en'] = array(
+ 'fc_anonymous' => "Anonymous",
+ 'fc_createdby' => "created by",
+ 'fc_editedby' => "edited by"
+);

Added: trunk/extensions/uniwiki/FormatChanges/FormatChanges.php
===================================================================
--- trunk/extensions/uniwiki/FormatChanges/FormatChanges.php (rev 0)
+++ trunk/extensions/uniwiki/FormatChanges/FormatChanges.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,88 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Authors",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Reformats the recent changes in a human-readable fashion."
+);
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once ("FormatChanges.i18n.php");
+$wgExtensionFunctions[] = "UW_FormatChanges_i18n";
+
+function UW_FormatChanges_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgFormatChangesMessages;
+ foreach ($wgFormatChangesMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+/* ---- HOOKS ---- */
+
+$wgHooks['FetchChangesList'][] = "UW_FormatChanges";
+function UW_FormatChanges($user, $skin, $list) {
+ $list = new UniwikiChangesList($skin);
+ return false;
+}
+
+class UniwikiChangesList extends ChangesList {
+
+ public function recentChangesLine(&$rc, $watched=false) {
+ global $wgLang;
+
+ // set local vars (this apparently does that)
+ extract($rc->mAttribs);
+
+ $this->insertDateHeader($line, $rc_timestamp);
+
+ /* NOTE: the following logic is reproduced from
+ * the old version of the recent changes
+ * page in case we want to produce a
+ * similar result (though much is not
+ * implemented yet)...
+ */
+
+ // moved pages
+ if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
+ // handle these?
+ }
+ // log entries(old) and special pages
+ else if ($rc_namespace == NS_SPECIAL) {
+ // handle these?
+ }
+ // new unpatrolled pages
+ else if ($rc->unpatrolled && $rc_type == RC_NEW) {
+ // handle these?
+ }
+ // log entries
+ else if ($rc_type == RC_LOG) {
+ // handle these?
+ }
+ // edits and new pages
+ else {
+ $line .= "<li>";
+ $page_link = $this->skin->makeKnownLinkObj($rc->getTitle(), '');
+ if ($this->isDeleted($rc, Revision::DELETED_USER)) {
+ $user_link = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
+ } else {
+ $user_link = ($rc_user > 0) ? $this->skin->userLink($rc_user, $rc_user_text) : wfMsg('fc_anonymous');
+ }
+ $timestamp = $wgLang->time($rc->mAttribs['rc_timestamp'], true, true);
+ $action = ($rc_type == RC_NEW) ? wfMsg('fc_createdby') : wfMsg('fc_editedby');
+ $line .= $page_link . " - " . $action . " " . $user_link . " (" . $timestamp . ")";
+ $line .= "</li>";
+ }
+
+ return $line;
+ }
+
+}

Added: trunk/extensions/uniwiki/FormatSearch/FormatSearch.php
===================================================================
--- trunk/extensions/uniwiki/FormatSearch/FormatSearch.php (rev 0)
+++ trunk/extensions/uniwiki/FormatSearch/FormatSearch.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,26 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Uniwiki Format Search",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Minor changes to clean up the search results page"
+);
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['BeforePageDisplay'][] = "UW_FormatSearch_CSS";
+function UW_FormatSearch_CSS (&$out) {
+ global $wgScriptPath;
+ $href = "$wgScriptPath/extensions/uniwiki/FormatSearch/style.css";
+ $out->addScript ("<link rel='stylesheet' href='$href' />");
+ return true;
+}

Added: trunk/extensions/uniwiki/FormatSearch/style.css
===================================================================
--- trunk/extensions/uniwiki/FormatSearch/style.css (rev 0)
+++ trunk/extensions/uniwiki/FormatSearch/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,17 @@
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+/* hide the extra search result data */
+.mw-search-result-data {
+ display: none;
+}
+
+/* hide the advanced search form */
+#powersearch {
+ display: none;
+}
+
+/* hide the search at the top */
+#search {
+ display: none;
+}

Added: trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.i18n.php
===================================================================
--- trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,90 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+$wgGenericEditPageMessages = array();
+$wgGenericEditPageMessages['en'] = array(
+ 'gep_emailsubject' => "[$1] Category suggestion: $2",
+ 'gep_emailbody' => "User '$1' suggested category '$2' for site '$3'.\n",
+ 'gep_emailfailure' => "Sorry, your suggestion could not be processed.",
+ 'gep_emailsuccess' => "Thanks for suggesting the category: $1.",
+ 'gep_categories' => "Categories",
+ 'gep_addcategory' => "Add a Category",
+ 'gep_addcategorybutton' => "Add",
+ 'gep_suggestcategory' => "Suggest a Category",
+ 'gep_suggestcategorybutton' => "Submit",
+ 'gep_sections' => "Sections",
+ 'gep_sectionnotdisabled' => "This section cannot be disabled",
+ 'gep_addsection' => "Add a Section",
+ 'gep_addsectionbutton' => "Add",
+ 'gep_classicmode' => "Classic Mode",
+ 'gep_genericmode' => "Generic Mode",
+ 'gep_nosectioninstructions' => "There are no sections on this page. Add some using the tools on the right.",
+ 'gep_nocategories' => "Please select at least one category before saving"
+);
+
+$wgGenericEditPageMessages['es'] = array(
+ 'gep_emailsubject' => "Sugerencia de categoría de [$1]: $2",
+ 'gep_emailbody' => "El usuario '$1' sugirió la categoría '$2' para el sitio '$3'.\n",
+ 'gep_emailfailure' => "No fue posible procesar su sugerencia.",
+ 'gep_emailsuccess' => "Gracias por sugerir la categoría: $1.",
+ 'gep_categories' => "Categorías",
+ 'gep_addcategory' => "Agregar una Categoría",
+ 'gep_addcategorybutton' => "Agregar",
+ 'gep_suggestcategory' => "Sugerir una Categoría",
+ 'gep_suggestcategorybutton' => "Enviar",
+ 'gep_sections' => "Secciones",
+ 'gep_sectionnotdisabled' => "Esta sección no se puede desactivar",
+ 'gep_addsection' => "Agregar una Sección",
+ 'gep_addsectionbutton' => "Agregar",
+ 'gep_classicmode' => "Modo Clásico",
+ 'gep_genericmode' => "Modo Genérico",
+ 'gep_nosectioninstructions' => "No hay secciones en esta página. Agrega algunas secciones utilizando las herramientas a la derecha.",
+ 'gep_nocategories' => "Selecciona por lo menos una categoría antes de guardar"
+);
+
+$wgGenericEditPageMessages['de'] = array(
+ 'gep_emailsubject' => "[$1] Vorschlag Kategorie: $2",
+ 'gep_emailbody' => "User '$1' hat die Kategorie '$2' für die Seite '$3'. ausgewählt\n",
+ 'gep_emailfailure' => "Leider, konnte Deine Änderung nicht verarbeitet werden.",
+ 'gep_emailsuccess' => "Danke für den Vorschlag der Kategorie: $1.",
+ 'gep_categories' => "Kategorien",
+ 'gep_addcategory' => "Eine Kategorie einfügen",
+ 'gep_addcategorybutton' => "Einfügen",
+ 'gep_suggestcategory' => "Eine Kategorie vorschlagen",
+ 'gep_suggestcategorybutton' => "Senden",
+ 'gep_sections' => "Abschnitte",
+ 'gep_sectionnotdisabled' => "Dieser Abschnitt kann nicht aufgehoben werden",
+ 'gep_addsection' => "Einen Abschnitt einfügen",
+ 'gep_addsectionbutton' => "Einfügen",
+ 'gep_classicmode' => "Normaler Modus",
+ 'gep_genericmode' => "Genereller Modus",
+ 'gep_nosectioninstructions' => "Diese Seite hat keine Abschnitte. Gib ein paar ein mit den Werkzeugen an der rechten Seite.",
+ 'gep_nocategories' => "Bitte vor Abspeichern, mindestens eine Kategorie aussuchen"
+);
+
+$wgGenericEditPageMessages['pt-br'] = array(
+ 'gep_emailsubject' => "Sugestão de categoria de [$1] : $2",
+ 'gep_emailbody' => "O usuário '$1' sugeriu a categoria '$2' para o site '$3'.\n",
+ 'gep_emailfailure' => "Não foi possível processar a sua sugestão.",
+ 'gep_emailsuccess' => "Obrigado por sugerir essa categoria: $1.",
+ 'gep_categories' => "Categorias",
+ 'gep_addcategory' => "Adicionar uma Categoria",
+ 'gep_addcategorybutton' => "Adicionar",
+ 'gep_suggestcategory' => "Sugerir uma Categoria",
+ 'gep_suggestcategorybutton' => "Encaminhar",
+ 'gep_sections' => "Seções",
+ 'gep_sectionnotdisabled' => "Esta seção não pode ser desativada",
+ 'gep_addsection' => "Adicionar uma Seção",
+ 'gep_addsectionbutton' => "Acrescentar",
+ 'gep_classicmode' => "Modo Clássico",
+ 'gep_genericmode' => "Modo Genérico",
+ 'gep_nosectioninstructions' => "Não há seções nesta página. Use as ferramentas à direita para incluir algumas seções.",
+ 'gep_nocategories' => "Selecione, no mínimo, uma categoria antes de salvar"
+);
+

Added: trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.js
===================================================================
--- trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.js (rev 0)
+++ trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.js 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,502 @@
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+
+Uniwiki.GenericEditPage = {
+
+ /* store the instance of the Mootools sortable
+ * class statically, so we can easily attach
+ * and detach things to it */
+ sections_sortable: null,
+
+ /* section sorting is enabled as default, but
+ * can temporarily suspended while things are
+ * sliding around */
+ sections_sorting: true,
+
+
+ /* to switch between modes (generic and classic),
+ * we must (effectively) click preview (to re-
+ * combine the wiki markup server-side), and
+ * reload the page in the opposite mode) */
+ toggle_mode: function() {
+ /* picked up by the combineBeforeSave hook
+ * in GenericEditor.php to set the new mode */
+ $("switch-mode").value = 1;
+
+ /* simulate a click on "preview" by setting
+ * a faux input field with the same name */
+ $("wpFakePreview").name = "wpPreview";
+ $("wpFakePreview").value = "Show preview";
+ $("editform").submit();
+ },
+
+
+ /* return the DOM node which contains
+ * all of the generic editor stuff */
+ editor: function () {
+ return $$(".generic-editor")[0];
+ },
+
+ /* util function to trigger a click event
+ * upon receiving an [ENTER] key press (for
+ * the add [cat | section] boxes, initially */
+ bind_enter_to_click: function(src,dest) {
+ src.addEvent ("keypress", function(e) {
+ if (e.key == "enter") {
+ dest.fireEvent("click");
+ e.stop();
+ }
+ });
+ },
+
+ /* update the visibility status of the instructions
+ * box (says "there are no sections, add some, etc");
+ * show it only if there are no sections visible */
+ update_instructions_box: function() {
+
+ /* count the number of sections which are now in
+ * use. if it is NONE, show the instructions box */
+ var ed = Uniwiki.GenericEditPage.editor();
+ var in_use = ed.getElements(".in-use").length;
+ if (in_use) { ed.removeClass("show-instructions"); }
+ else { ed.addClass( "show-instructions"); }
+ },
+
+ /* lock the height of the editor while sliding,
+ * to prevent the window scrollbar from moving
+ * around. it grabs the user's attention */
+ lock_editor_height: function() {
+ var size = Uniwiki.GenericEditPage.editor().getSize();
+ Uniwiki.GenericEditPage.editor().setStyle('height', size.y + "px");
+ },
+
+ /* allow the editor to size naturally */
+ unlock_editor_height: function() {
+ Uniwiki.GenericEditPage.editor().setStyle('height', "");
+ },
+
+
+ Events: {
+
+ // == SYNCHRONISE SIDEBAR WITH EDITABLE TITLES ==
+ section_title_change: function() {
+ $$(".generic-editor input.section-title").
+ addEvent ("keyup", function(e) {
+ var title = e.target.value;
+ var index = e.target.name.replace(/\D/g, "");
+ $$("#sect-" + index + " label").set("text", title);
+ });
+ },
+
+ // == "ADD CATEGORY" BOX ==
+ add_category: function() {
+ /* add category [field | button] */
+ var acat_fld = $("fm-add-cat");
+ var acat_btn = $("fm-add-cat-button");
+
+ /* when the add button is clicked, create a new category
+ * checkbox + label, and insert it into the list. we don't
+ * have to do insert any wiki markup, because the combine-
+ * BeforeSave function in GenericEditPage.php will do it */
+ acat_btn.addEvent( "click", function(e) {
+
+ // abort if no category name was entered
+ var cat_name = acat_fld.value.trim();
+ if (cat_name == "") return true;
+
+ /* iterate all category checkboxes, looking
+ * for one by the name entered (to recycle) */
+ var already_exists = false;
+ $$("#category-box input[type=checkbox]").each (function(obj) {
+ if (obj.name == "category-" + cat_name) {
+
+ /* ensure that the category is checked,
+ * and highlight it to notify the user */
+ already_exists = true;
+ acat_fld.value = "";
+ obj.checked = "checked";
+ obj.getParent().highlight();
+ }
+ });
+
+ // abort if the new cat name already exists
+ if (already_exists) return true;
+
+ /* if no category by this name already exists,
+ * then we will add a new checkbox (to be found
+ * by the server-side combineBeforeSave function) */
+ var f_id = "category-" + cat_name;
+ var div = new Element ("div").appendText(" ");
+
+ // create the new checkbox
+ var input = new Element ("input", {
+ 'id': f_id,
+ 'name': f_id,
+ 'type': "checkbox",
+ 'checked': "checked"
+ }).inject(div);
+
+ // create the label
+ var label = new Element ("label", { 'for': f_id })
+ .appendText (cat_name).inject (div);
+
+ /* insert the new category before the add
+ * form and flash it, to notify the user */
+ div.inject (acat_btn.getParent(), "before");
+ div.highlight();
+
+ /* clear the new category name field */
+ acat_fld.value = "";
+ });
+
+ /* catch the ENTER key in the category name box,
+ * to prevent the entire edit form from submitting
+ * (redirect it to the click event, above) */
+ Uniwiki.GenericEditPage.bind_enter_to_click (acat_fld, acat_btn);
+ },
+
+ // == "ADD SECTIONS" BOX ==
+ add_section: function() {
+ /* add section [field | button] */
+ var asect_fld = $("fm-add-sect");
+ var asect_btn = $("fm-add-sect-button");
+
+ asect_btn.addEvent( "click", function(e) {
+ var sect_name = asect_fld.value.trim();
+ if (sect_name == "") return true;
+
+ /* find the next available section index
+ * (will be incremented in iterator, below) */
+ var sect_index = 1;
+
+ var already_exists = false;
+ $$("#section-box input[type=checkbox]").each (function(obj) {
+
+ /* fetch the NAME of this checkbox, via its label
+ * (section checkboxes are only identified by index) */
+ var labels = obj.getParent().getElements('label');
+ if (labels) obj_name = labels[0].get('text');
+
+ if (obj.name == sect_name) {
+ already_exists = true;
+ asect_fld.value = "";
+ obj.checked = "checked";
+ obj.getParent().highlight();
+ }
+
+ /* keep track of the highest section index,
+ * in case we need to add a new section */
+ var obj_index = obj.name.replace (/\D/g, '');
+ if (obj_index > sect_index) sect_index = obj_index;
+ });
+
+ // abort if the new section name already exists
+ if (already_exists) return true;
+
+ /* we're creating a new section; index
+ * it one higher than the current maximum */
+ sect_index++;
+
+ var div = new Element ("div", {
+ 'id': "sect-" + sect_index,
+ 'class': "section-box"
+ });
+
+ // create the checkbox
+ var f_name = "enable-" + sect_index;
+ var f_id = "fm-" + f_name;
+ var input = new Element ("input", {
+ 'id': f_id,
+ 'name': f_name,
+ 'type': "checkbox",
+ 'checked': "checked"
+ }).inject(div);
+
+ /* add a single space between the checkbox
+ * and label, to match existing sections */
+ div.appendText(" ");
+
+ // create the label
+ var label = new Element ("label", { 'for': f_id })
+ .appendText (sect_name).inject (div);
+
+ /* insert the new section div (in sidebar) into the
+ * sortables container, and hook up the event handlers
+ * to make it play nice with the other sections */
+ div.inject (asect_btn.getParent().getPrevious());
+ var sortables = Uniwiki.GenericEditPage.sections_sortables;
+ if (sortables) sortables.addItems (div);
+ div.highlight();
+
+ // create and inject the real section into the editor
+ var klass = "section sect-" + (sect_index+1) + " in-use";
+ var div = new Element ("div", { 'id': "section-" + sect_index, 'class': klass });
+ var t_div = new Element ("div", { 'class': "sect-title" }).inject(div);
+ new Element ("input", { 'type': "text", 'value': sect_name, 'class': "section-title", 'name': "title-" + sect_index }).inject(t_div);
+ new Element ("input", { 'type': "hidden", 'value': 2, 'name': "level-" + sect_index }).inject(div);
+ var txta = new Element ("textarea", { 'name': "section-" + sect_index, 'class': "editor" }).inject(div);
+ div.inject (Uniwiki.GenericEditPage.editor());
+
+ /* if we are also running the custom toolbars
+ * uniwiki extension, add a nice toolbar to
+ * this section */
+ if (Uniwiki.CustomToolbar)
+ Uniwiki.CustomToolbar.attach (txta);
+
+ /* hide the instructions box, now that we
+ * have at least one section in the editor */
+ Uniwiki.GenericEditPage.update_instructions_box();
+
+ // clear the "new section name" field
+ asect_fld.value = "";
+ });
+
+ Uniwiki.GenericEditPage.bind_enter_to_click (asect_fld, asect_btn);
+ },
+
+ toggle_sections: function() {
+ // check that this document has a sortable sections box
+ var sortables = $$("#section-box .sortables")[0];
+ if (!sortables) return true;
+
+ // == HANDLE SECTION-IN-USE CHECKBOXES ==
+ var evt_type = Browser.Engine.trident ? 'click' : 'change';
+ sortables.addEvent(evt_type, function(e) {
+
+ // don't mess with things that aren't checkboxes
+ if ($(e.target).get('tag') != 'input') return true;
+
+ // find the target section id and section
+ var sect_index = parseInt(e.target.name.replace(/\D/g, ''));
+ var target = $('section-' + sect_index);
+
+ // show or hide the real section in the editor
+ if (e.target.checked) { target.removeClass('not-in-use').addClass('in-use'); }
+ else { target.addClass('not-in-use').removeClass('in-use'); }
+
+ Uniwiki.GenericEditPage.update_instructions_box();
+ });
+
+ },
+
+ reorder_sections: function() {
+ // TEMPORARILY DISABLED
+ // HERE BE DRAGONS
+ return false;
+
+ // we will need this all over the place
+ var editor = Uniwiki.GenericEditPage.editor();
+
+ // check that this document has a sortable sections box
+ var sortables = $$("#section-box .sortables")[0];
+ if (!sortables) return true;
+
+ // == HIGHLIGHT SORTABLES UPON MOUSEDOWN ==
+ /* watch for mouse-down events on draggable elements (which will trigger
+ * the mootools sortables events (below)), to highlight a div which is
+ * now draggable to sort. we must do this here (not in the onStart event),
+ * because mootools waits for mousedown THEN mousemove to trigger; which
+ * is quite confusing for end-users */
+ sortables.addEvent ("mousedown", function(e) {
+
+ // don't highlight anything if sorting is suspended
+ if (!Uniwiki.GenericEditPage.sections_sorting)
+ return false;
+
+ var t = $(e.target);
+ var tag = t.get("tag");
+
+ /* do nothing for input (checkbox), as not to interfere
+ * with their normal behaviour. otherwise, highlight
+ * the section box (entire row) */
+ if (tag == "input") return true;
+ else if (tag == "label") dragger = t.getParent();
+ else if (tag == "div" && t.hasClass ("section-box")) dragger = t;
+
+ // we have no idea what's going on
+ else return true;
+
+ /* if this element is currently tweening,
+ * then stop it, to re-highlight it */
+ if (dragger.retrieve ("tween")) {
+ dragger.retrieve ("tween").cancel();
+ dragger.store ("tween", null);
+ }
+
+ // set css hooks to make dragging visible
+ dragger.setStyle ("background-color", "#ff8");
+ dragger.getParent().addClass ("dragging");
+ dragger.addClass ("dragging");
+
+ /* watch the whole document for mouseup, because the
+ * cursor may no longer be in the sortables box */
+ var evt = function() {
+
+ // only fire this event once
+ $(document).removeEvent ("mouseup", evt);
+
+ /* fade from the highlight color, back
+ * to white, then remove the background */
+ var tween = new Fx.Tween (dragger, {
+ onComplete: function() {
+ dragger.setStyle ("background-color", "");
+ dragger.store ("tween", null);
+ }
+ }).start ("background-color", "#fff");
+
+ /* keep note of the tween object in the element,
+ * in case the mousedown event is re-fired before
+ * it is completed - so we can cancel it */
+ dragger.store ("tween", tween);
+
+ // also remove css hooks from DOM
+ dragger.getParent().removeClass ("dragging");
+ dragger.removeClass ("dragging");
+ };
+
+ document.addEvent ("mouseup", evt);
+ });
+
+ // == MAKE THEM SORTABLE! ==
+ Uniwiki.GenericEditPage.sections_sortables =
+ new Sortables(sortables, {
+ onComplete: function(obj) {
+
+ // fetch the section we are moving
+ var sect_id = obj.id.replace(/\D/g, "");
+ var section = $("section-" + sect_id);
+
+ /* find the current (old) and target (new) indexes
+ * (oldIndex - 2, to count around #instructions, and
+ * the mostly-invisible first "introduction" section) */
+ var newIndex = obj.getParent().getChildren().indexOf(obj);
+ var oldIndex = editor.getChildren().indexOf(section) - 2;
+
+ // skip this whole thing is the position has not changed
+ if (!section || (newIndex == oldIndex))
+ return true;
+
+ /* disable sorting and sizing until all of the
+ * re-ordering and sliding around is done */
+ Uniwiki.GenericEditPage.sections_sortables.detach();
+ Uniwiki.GenericEditPage.sections_sorting = false;
+ Uniwiki.GenericEditPage.lock_editor_height();
+
+ var stage = 1;
+ var slider = new Fx.Slide (section, {
+ onComplete: function() {
+
+ // 1 = SLIDE OUT EVENT
+ if (stage==1) {
+ stage = 2;
+ var anchor = null;
+ var rel = null;
+
+ /* the div that is actually moving is
+ * intermediate (inserted by MooTools) */
+ var moving = section.getParent();
+
+ /* newIndex offset is always +2, to skip the first (anonymous)
+ * introduction section and the instruction box. both are inside
+ * the generic editor (even if they shouldn't be) */
+ var target = $(editor.getChildren()[newIndex + 2]);
+
+ if (newIndex < oldIndex) {
+ /* we're moving UP - don't need to
+ * check for failure, because there
+ * will always be the first anonymous
+ * section to anchor from */
+ anchor = target.getPrevious();
+ rel = "after";
+
+ } else {
+ // moving DOWN
+ anchor = target.getNext();
+ rel = "before";
+
+ /* if getNext failed, it's because there
+ * are no more siblings - we're moving to
+ * the bottom of the list! */
+ if (!anchor) {
+ anchor = target.getParent();
+ rel = "bottom";
+ }
+ }
+
+ /* inject the intermediate slider at the right position in
+ * the DOM, and slide back in. delay it to avoid weird race
+ * condition in IE6, which i don't have time to debug */
+ moving.inject(anchor, rel);
+ (function () { slider.slideIn(); }).delay(100);
+
+ // 2 = SLIDE IN EVENT
+ } else if (stage==2) {
+
+ /* get rid of intermediate element,
+ * and don't re-call this event. this
+ * breaks encapsulation, and is a hack :( */
+ section.replaces (section.getParent());
+ section.store ("wrapper", null);
+ slider.removeEvents ("onComplete");
+
+ /* remove all section and sect (checkbox) ids
+ * (nodes can't share ids, even temporarily) */
+ var sections = $$(".generic-editor > div.section");
+ var sects = $$("#section-box .sortables > div");
+ var func_rem = function (el) { el.id = '' };
+ sections.each (func_rem);
+ sects.each (func_rem);
+
+ /* now re-name every field in each section, to
+ * reflect their new position in the DOM */
+ sections.each (function (el,index) {
+ el.id = "section-" + index;
+
+ /* also update the indexes within each form field
+ * of the section (so they're put back together
+ * in the right order when we save changes */
+ el.getElements ("input,textarea").each (function (field) {
+ field.name = field.name.replace (/\d+$/, index);
+ });
+ });
+
+ /* as above, for sect /checkboxes,
+ * which start at index 1 (no checkbox
+ * for the anonymous first section */
+ sects.each(function(el,index) {
+ el.id = "sect-" + (index+1);
+ el.getElements ("input").each(function(field) {
+ field.name = field.name.replace(/\d+$/, (index+1));
+ });
+ });
+
+ // turn back on reordering and natural sizing
+ Uniwiki.GenericEditPage.sections_sortables.attach();
+ Uniwiki.GenericEditPage.sections_sorting = true;
+ Uniwiki.GenericEditPage.unlock_editor_height();
+
+ /* in case i cocked-up this function,
+ * and it ends up being called again */
+ stage = null;
+ }
+ }
+
+ /* slide out first, then do some logic
+ * (above, stage 1), then slide back in */
+ }).slideOut();
+ }
+ });
+
+ // == PREVENT DRAGGING BY CHECKBOXES! ==
+ /* cancel mousedown events in checkboxes within the sections box, to
+ * prevent the sortables behaviour from firing. this prevents people
+ * dragging checkboxes around, and toggling them at the same time */
+ sortables.getElements("input[type=checkbox]").addEvent("mousedown", function(e) {
+ e.stop();
+ });
+ }
+ } // Events
+};
+

Added: trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php
===================================================================
--- trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php (rev 0)
+++ trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,772 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Uniwiki Generic Edit Page",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Suppliments the edit page with something more usable"
+);
+
+
+/* ---- CONFIGURABLE OPTIONS ---- */
+
+$wgSectionBox = true;
+$wgCategoryBox = true;
+$wgAddSection = true;
+$wgAddCategory = true;
+$wgSuggestCategory = false;
+$wgSuggestCategoryRecipient = $wgEmergencyContact;
+$wgUseCategoryPage = false;
+$wgCategoryPage = "MediaWiki:Editpagetags";
+$wgRequireCategory = false;
+$wgGenericEditPageWhiteList = array(NS_MAIN);
+
+/* not configurable. in fact,
+ * it's a big ugly hack */
+$wgSwitchMode = false;
+
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once ("GenericEditPage.i18n.php");
+$wgExtensionFunctions[] = "UW_GenericEditPage_i18n";
+
+function UW_GenericEditPage_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgGenericEditPageMessages;
+ foreach ($wgGenericEditPageMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['BeforePageDisplay'][] = "UW_GenericEditPage_addJS";
+function UW_GenericEditPage_addJS($out) {
+ global $wgScriptPath;
+ $src = "$wgScriptPath/extensions/uniwiki/GenericEditPage/GenericEditPage.js";
+ $out->addScript ("<script type='text/javascript' src='$src'></script>");
+ $href = "$wgScriptPath/extensions/uniwiki/GenericEditPage/global.css";
+ $out->addScript ("<link rel='stylesheet' href='$href' />");
+ return true;
+}
+
+$wgAjaxExportList[] = "UW_GenericEditPage_emailSuggestion";
+function UW_GenericEditPage_emailSuggestion ($category) {
+ global $wgSuggestCategoryRecipient, $wgEmergencyContact, $wgSitename, $wgUser;
+ require_once ("UserMailer.php");
+
+ $from = new MailAddress ($wgEmergencyContact);
+ $to = new MailAddress ($wgSuggestCategoryRecipient);
+ $subj = wfMsg ("gep_emailsubject", $wgSitename, $category);
+ $body = wfMsg ("gep_emailbody", $wgUser->getName(), $category, $wgSitename);
+
+ // attempt to send the notification
+ $result = userMailer ($to, $from, $subj, $body);
+
+ /* send a message back to the client, to let them
+ * know if the suggestion was successfully sent (or not) */
+ return WikiError::isError ($result)
+ ? wfMsg ('gep_emailfailure')
+ : wfMsg ('gep_emailsuccess', $category);
+}
+
+function UW_GenericEditPage_extractLayout (&$text) {
+ /* match all layout tags (in case, some how, multiple
+ * tags have ended up in the wiki markup). only the
+ * first tag will be used, but all will be removed */
+ $re = "/\n*<layout\s+name=\"(.+)\"\s+\/>/";
+ preg_match_all ($re, $text, $matches);
+ $text = preg_replace ($re, "", $text);
+
+ /* if no layout tag was found, this
+ * function does nothing useful */
+ if (!$matches[1][0]) return array();
+
+ /* get the wiki markup (containing the
+ * directives) from this page's layout */
+ $layout = array();
+ $layout_title = Title::newFromDBkey ("Layout:".$matches[1][0]);
+ $layout_article = new Article ($layout_title);
+ $layout_text = $layout_article->getContent();
+
+ // add the first element as page meta-data
+ // and the second for the untitled first section
+ $layout[] = array ("name" => $matches[1][0]);
+ $layout[] = array();
+
+ // ignore (delete) the categories on the layout
+ $layout_text = preg_replace ("/\[\[category:(.+?)\]\]/i", "", $layout_text);
+
+ // break it up into sections (same regex as in displayEditPage)
+ $nodes = preg_split ('/^(==?[^=].*)$/mi', $layout_text, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ // build an array with the layout section attributes
+ for ($i= 0; $i < count ($nodes); $i++) {
+ $value = trim ($nodes[$i]);
+
+ /* is this block of text a header?
+ * update the 'current section' flag ($title), so
+ * all following directives are dropped in to it */
+ if (preg_match ('/^(==?)\s*(.+?)\s*\\1$/i', $value, $matches)) {
+ $layout[] = array(
+ "title" => htmlspecialchars($matches[2]),
+ "level" => strlen($matches[1])
+ );
+
+ // not header -> plain text
+ } else {
+ /* find and iterate all directives in this section,
+ * and add them to the last-seen title array */
+ $re = "/^@(.+)$/m";
+ $section_num = count ($layout)-1;
+ preg_match_all ($re, $value, $matches);
+ foreach ($matches[1] as $attribute)
+ $layout[$section_num][$attribute] = true;
+
+ // add the remaining stuff as text
+ $value = preg_replace ($re, "", $value);
+ $layout[$section_num]['text'] = trim($value);
+ }
+ }
+
+ return $layout;
+}
+
+function UW_GenericEditPage_extractCategoriesIntoBox(&$text) {
+ global $wgDBprefix, $wgAddCategory, $wgSuggestCategory, $wgRequest,
+ $wgEmergencyContact, $wgUseCategoryPage, $wgCategoryPage;
+ $out = "";
+
+ /* build an array of the categories, either from a page
+ * or from all available categories in the wiki */
+ $categories = array();
+ if ($wgUseCategoryPage) {
+
+ // from the specified page
+ $revision = Revision::newFromTitle (Title::newFromDBKey ($wgCategoryPage));
+ $results = $revision ? split ("\n", $revision->getText()) : array();
+ foreach ($results as $result) {
+ if (trim($result) != '')
+ $categories[] = Title::newFromText (trim ($result))->getDBkey();
+ }
+ } else {
+
+ // all the categories
+ $db = wfGetDB (DB_MASTER);
+ $results = $db->resultObject ($db->query(
+ "select distinct cl_to from {$wgDBprefix}categorylinks order by cl_to"));
+
+ while ($result = $results->next())
+ $categories[] = $result->cl_to;
+ }
+
+ // extract the categories on this page
+ $regex = "/\[\[category:(.+?)(?:\|.*)?\]\]/i";
+ preg_match_all ($regex, strtolower($text), $matches);
+ $text = preg_replace ($regex, "", $text);
+
+ // an array of the categories on the page (in db form)
+ $on_page = array();
+ foreach ($matches[1] as $cat)
+ $on_page[] = strtolower (Title::newFromText ($cat)->getDBkey());
+
+ /* add any categories that may have been passed with the
+ * GET request as if they started out on the page */
+ $data = $wgRequest->data;
+ foreach ($data as $key => $value) {
+ if ($key == 'category') {
+ $category = substr ($value, 9); // value = category-categoryname
+ $on_page[] = strtolower ($category);
+ if (!in_array ($category, $categories))
+ $categories[] = $category;
+ }
+ }
+
+ /* add checkboxes for the categories,
+ * with ones from the page already checked */
+ $out .= "<div id='category-box'><h3>".wfMsg ('gep_categories')."</h3>";
+ foreach ($categories as $category) {
+ $fm_id = "category-$category";
+ $caption = Title::newFromDBkey ($category)->getText();
+ $checked = in_array (strtolower ($category), $on_page)
+ ? "checked='checked'" : '';
+
+ $out .= "
+ <div>
+ <input type='checkbox' name='$fm_id' id='$fm_id' $checked/>
+ <label for='$fm_id'>$caption</label>
+ </div>
+ ";
+ }
+
+ // add a text field to add new categories
+ if ($wgAddCategory) {
+ $out .= "
+ <div class='add'>
+ <label for='fm-add-cat'>".wfMsg ('gep_addcategory')."</label>
+ <input type='text' id='fm-add-cat' autocomplete='off' />
+ <input type='button' value='".wfMsg ('gep_addcategorybutton')."' id='fm-add-cat-button' />
+ </div>
+ <script type='text/javascript'>
+ // hook up the 'add category' box events
+ Uniwiki.GenericEditPage.Events.add_category();
+ </script>
+ ";
+ }
+
+ /* add a text field to suggest a category
+ * as email to $wgEmergencyContact */
+ if ($wgSuggestCategory) {
+ $out .= "
+ <div class='suggest'>
+ <label for='fm-suggest-cat'>".wfMsg ('gep_suggestcategory')."</label>
+ <input type='text' id='fm-suggest-cat' autocomplete='off' />
+ <input type='button' value='".wfMsg ('gep_suggestcategorybutton')."' id='fm-suggest-cat-button' />
+ </div>
+ <script type='text/javascript'>
+ $('fm-suggest-cat-button').addEvent ('click', function() {
+ var field = this.getPrevious();
+ var that = this;
+
+ // only if a category name was entered...
+ var cat_name = field.value.trim();
+ if (cat_name != '') {
+ sajax_do_call ('emailSuggestion', [cat_name], function (msg) {
+
+ /* got response from the server, append it after the
+ * suggest form (so subsequent suggestions are injected
+ * ABOVE existing suggetions before they're removed) */
+ var n = new Element ('div')
+ .injectAfter ('fm-suggest-cat-button', 'after')
+ .appendText (msg.responseText)
+ .highlight();
+
+ /* fade out and destroy the notification within
+ * a timely manner, to keep the DOM tidy */
+ (function() { n.fade() }).delay(6000);
+ (function() { n.destroy() }).delay(8000);
+ });
+
+ // clear the suggestion
+ field.value = '';
+ }
+ });
+
+ // catch the ENTER key in the suggestion box,
+ // to prevent the entire edit form from submitting
+ $('fm-suggest-cat').addEvent ('keypress', function (e) {
+ if (e.key == 'enter') {
+ this.getNext().fireEvent ('click');
+ e.stop();
+ }
+ });
+ </script>
+ ";
+ }
+
+ // end of category box
+ $out .= "</div>";
+ return $out;
+}
+
+function UW_GenericEditPage_renderSectionBox ($sections) {
+ global $wgAddSection;
+ $out = "
+ <div id='section-box'>
+ <h3>".wfMsg ('gep_sections')."</h3>
+ <div class='sortables'>
+ ";
+
+ for ($i=1; $i<count ($sections); $i++) {
+ if ($sections[$i]['required']) {
+
+ /* required sections are checked and disabled, but...
+ * this doesn't pass a value back to the server! so
+ * we must include a hidden field to fill in */
+ $out .= "
+ <div id='sect-$i' class='section-box disabled'>
+ <input type='hidden' name='enable-$i' value='on' />
+ <input type='checkbox' checked='checked' disabled='disabled' />
+ <label title='".wfMsg ('gep_sectionnotdisabled')."'>{$sections[$i]['title']}</label>
+ </div>
+ ";
+ } else {
+ // sections that are currently in us are pre-checked
+ $checked = $sections[$i]['in-use'] ? " checked='checked'" : "";
+ $out .= "
+ <div id='sect-$i' class='section-box'>
+ <input type='checkbox' name='enable-$i' $checked />
+ <label>{$sections[$i]['title']}</label>
+ </div>
+ ";
+ }
+ }
+
+ $out .= "
+ </div>
+ ";
+
+ if ($wgAddSection) {
+ $out .= "
+ <div class='add'>
+ <label for='fm-add-sect'>".wfMsg ('gep_addsection')."</label>
+ <input type='text' id='fm-add-sect' autocomplete='off' />
+ <input type='button' value='".wfMsg ('gep_addsectionbutton')."' id='fm-add-sect-button' />
+ </div>
+ <script type='text/javascript'>
+ // hook up the 'add section' box events
+ Uniwiki.GenericEditPage.Events.add_section();
+ </script>
+ ";
+ }
+
+ $out .= "
+ </div>
+ <script type='text/javascript'>
+ Uniwiki.GenericEditPage.Events.toggle_sections();
+ Uniwiki.GenericEditPage.Events.reorder_sections();
+ </script>
+ ";
+
+ return $out;
+}
+
+$wgHooks['EditPage::showEditForm:fields'][] = 'UW_GenericEditPage_displayEditPage';
+function UW_GenericEditPage_displayEditPage ($editor, $out) {
+ global $wgHooks, $wgParser, $wgTitle, $wgRequest, $wgUser, $wgCategoryBox, $wgSectionBox, $wgRequireCategory;
+ global $wgGenericEditPageClass, $wgSwitchMode, $wgGenericEditPageWhiteList;
+
+ // disable this whole thing on conflict and comment pages
+ if ($editor->section == "new" || $editor->isConflict)
+ return true;
+
+ // get the article text (as wiki markup)
+ $text = trim ($editor->safeUnicodeOutput ($editor->textbox1));
+
+ // see if we have a link to a layout
+ $layout = UW_GenericEditPage_extractLayout ($text);
+
+ /* remove the categories, to be added as
+ * checkboxes later (after the edit form) */
+ if ($wgCategoryBox) {
+ $catbox = UW_GenericEditPage_extractCategoriesIntoBox ($text);
+ $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UW_GenericEditPage_addCssHookSidebar';
+ }
+
+ /* break the page up into sections by splitting
+ * at header level =one= or ==two== */
+ $nodes = preg_split('/^(==?[^=].*)$/mi', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ // add css hooks only to the edit page
+ $wgHooks['SkinTemplateSetupPageCss'][] = 'UW_GenericEditPage_editPageCss';
+ $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'UW_GenericEditPage_addCssHookGenEd';
+
+
+ /* the current contents of the page we are
+ * editing will be broken up into $page(and
+ * combined with $layout, later on) */
+ $page = array();
+ $title = "";
+
+ /* always create a space for the first un-named
+ * section, even if it is not used */
+ $page[] = array();
+
+ for ($i = 0; $i < count ($nodes); $i++) {
+ $value = trim ($nodes[$i]);
+ $this_section = count ($page) - 1;
+
+ // is this block of text a header?
+ $node_is_title = preg_match ('/^(==?)\s*(.+?)\s*\\1$/i', $value, $matches);
+
+ /* for titles, create a new element in the
+ * page array, to store the title and text */
+ if ($node_is_title) {
+
+ // extract header level and title
+ $level = strlen ($matches[1]);
+ $title = htmlspecialchars ($matches[2]);
+
+ // add this section and mark it as in use
+ $page[] = array(
+ 'title' => $title,
+ 'level' => $level,
+ 'in-use' => true
+ );
+
+ /* not header -> plain text (store in
+ / * the previous section, with title) */
+ } else {
+ $page[$this_section]['text'] = $value;
+ }
+
+ /* fetch the meta-data for new sections, or
+ * the un-named first section. this is done
+ * here (not when merging) because meta-data
+ * can ONLY come from the layout (not the page) */
+ if ($node_is_title or $i==0) {
+
+ /* now check if any meta-data exists for this
+ * section in the layout for this page
+ * (ignore the first two sections)
+ * j = 0: page meta-data
+ * j = 1: special first section */
+ for ($j = 1; $j < count ($layout); $j++) {
+ if ($layout[$j]['title'] == $title) {
+ // we found a corresponding section in the layout
+ // so we copy all the associated meta-data
+ foreach ($layout[$j] as $k => $v) {
+
+ // don't overwrite the page text!
+ if ($k != "text") $page[count ($page)-1][$k] = $v;
+ }
+ }
+ }
+ }
+ }
+
+ /* the results of the
+ * layout + page merge */
+ $result = array();
+
+ /* special case: if the first (un-named) section has text in the layout,
+ * but not in the page, copy it. otherwise, use the page text (even if empty) */
+ $result[] = ($layout[0]['text'] && !$page[0]['text']) ? $layout[0] : $page[0];
+
+ /* only show the un-named section if it is being used. as
+ * default, do not encourage people to use it by showing it */
+ $result[0]['in-use'] = ($result[0]['text'] != "");
+
+ // get sections that are in the layout
+ for ($i = 2; $i < count ($layout); $i++) {
+ $found_at = null;
+ for ($j = 0; $j < count ($page); $j++) {
+ if ($layout[$i]['title'] == $page[$j]['title']) {
+ $found_at = $j;
+ break;
+ }
+ }
+ if (!$found_at) { // take the section from the layout
+ $result[] = $layout[$i];
+ } else {
+ $result[] = $page[$found_at];
+ }
+ }
+
+ // now put in the stuff that is not in the layout, but IS in the page
+ for ($i = 1; $i < count ($page); $i++) {
+
+ // if this section is already in the result,
+ // then skip to the next page section
+ for ($j=0; $j<count ($result); $j++) {
+ if ($page[$i]['title'] == $result[$j]['title'])
+ continue 2;
+ }
+
+ /* this page section has not been added yet!
+ * re-iterate the results, to find the index
+ * of the section BEFORE this section, which
+ * we will insert after */
+ $insert_at = null;
+
+ for ($j=0; $j<count ($result); $j++) {
+ if ($result[$j]['title'] == $page[$i-1]['title']) {
+ $insert_at = $j+1;
+ break;
+ }
+ }
+
+ if ($insert_at===null) $result[] = $page[$i];
+ else array_splice ($result, $insert_at, 0, array($page[$i]));
+ }
+
+ /* check to see if there were any sections in use
+ * if there are not, we will display instructions */
+ $any_in_use = false;
+ for ($i=0; $i<count( $result); $i++) {
+ if ($result[$i]['in-use']) {
+ $any_in_use = true;
+ break;
+ }
+ }
+
+ // use the default (untitled) section if there is nothing else
+ if (!$any_in_use) {
+ $result[0]['in-use'] = true;
+ $any_in_use = true;
+ }
+
+ // this line is sort of outdated... may want to remove?
+ $gen_editor_class = $any_in_use ? "" : " show-instructions";
+
+ /* add the buttons to switch between editing modes
+ * (only one is visible at a time, via css/js) and
+ * start the generic editor div */
+ $out->addHTML("
+ <script type='text/javascript' language='javascript'>
+ $(window).addEvent ('domready', function() {
+ /* add CLASSIC button
+ * (visibility via css) */
+ new Element ('input', {
+ type: 'button',
+ 'class': 'switch sw-classic',
+ events: { click: Uniwiki.GenericEditPage.toggle_mode },
+ value: '".wfMsg ('gep_classicmode')."'
+ }).inject ($('content'));
+
+ /* add GENERIC button
+ * (visibility via css) */
+ new Element ('input', {
+ type: 'button',
+ 'class': 'switch sw-generic',
+ events: { click: Uniwiki.GenericEditPage.toggle_mode },
+ value: '".wfMsg ('gep_genericmode')."'
+ }).inject($('content'));
+ ");
+
+ /* only enforce the categorization of pages in the
+ * main namespace, using the generic edit page */
+ if ($wgRequireCategory && ($wgTitle->getNamespace() == NS_MAIN)) {
+ $out->addHTML("
+ /* when the form is submitted, check that one or
+ * more categories were selected, or alert */
+ $('editform').addEvent ('submit', function (e) {
+
+ // only enforce when in generic mode
+ if (!document.body.hasClass ('edit-generic'))
+ return true;
+
+ /* iterate the category checkboxes, and count
+ * how many of them are 'ticked' */
+ var checked = 0;
+ $$('#category-box input[type=checkbox]').each (function (el) {
+ if (el.checked) checked++;
+ });
+
+ if (checked==0) {
+ alert('".wfMsg ('gep_nocategories')."');
+ e.stop();
+ }
+ });
+ ");
+ }
+
+ $out->addHTML("
+ /* if the sidebar is taller than the editor,
+ * make the editor the same height */
+ var sbs = $('sidebar').getSize();
+ var eds = Uniwiki.GenericEditPage.editor().getSize();
+ if (sbs.y > eds.y) Uniwiki.GenericEditPage.editor().setStyle
+ ((Browser.Engine.trident ? 'height' : 'min-height'), sbs.y+'px');
+ });
+ </script>
+ <!-- will be assigned the name of 'wpPreview' when the
+ switch-mode button is pressed, because mediawiki
+ only checks for its presence, not value (?!) -->
+ <input type='hidden' id='wpFakePreview' name='' value='' />
+ <input type='hidden' id='switch-mode' name='switch-mode' value='' />
+ <div class='generic-editor $gen_editor_class'>
+ <div class='instructions'>".wfMsg ('gep_nosectioninstructions')."</div>
+ ");
+
+ // now build the results into a real HTML page
+ for ($i=0; $i<count ($result); $i++) {
+ $in_use = $result[$i]['in-use'] ? "in-use" : "not-in-use";
+ $out->addHTML("<div id='section-$i' class='section sect-".($i+1)." $in_use'>");
+
+
+ // if this section has a title, show it
+ if ($result[$i]['title']) {
+ $title = $result[$i]['title'];
+ if ($result[$i]['lock-header']) {
+ $out->addHTML ("<h2>$title</h2>");
+ $out->addHTML ("<input type='hidden' name='title-$i' value='$title' />");
+ } else {
+ // wrap the editable section header in a div, for css hackery
+ $out->addHTML ("<div class='sect-title'><input type='text' name='title-$i' class='section-title' value='$title' /></div>");
+ }
+
+ // always include the level of titles
+ $out->addHTML ("<input type='hidden' name='level-$i' value='{$result[$i]['level']}' />");
+ }
+
+ /* always add a textarea, whether or
+ * not it is currently in use. titles
+ * without text are kind of useless */
+ if ($result[$i]['lock-text']) {
+
+ /* render the wiki markup into HTML, the old-school
+ * way which actually works, unlike recursiveTagParse() */
+ $text = $wgParser->parse ($result[$i]['text'], $wgTitle, new ParserOptions)->getText();
+ $out->addHTML ("<input type='hidden' name='section-$i' value='".htmlspecialchars ($result[$i]['text'], ENT_QUOTES)."' />");
+ $out->addHTML ("<div class='locked-text' id='locked-text-$i'>".$text."</div>");
+ } else {
+ // add the editable text for this section
+ $text = htmlspecialchars ($result[$i]['text'], ENT_QUOTES);
+ $out->addHTML ("<textarea name='section-$i' class='editor'>$text</textarea>");
+ }
+
+ $out->addHTML("</div>");
+ }
+
+
+ /* end of .generic-editor
+ * (and some javascript!) */
+ $out->addHTML("
+ </div>
+ <script type='text/javascript'>
+ /* when any section title is changed (in the generic
+ * editor), update the sections on the right, too */
+ window.addEvent ('domready', function() {
+ Uniwiki.GenericEditPage.Events.section_title_change()
+ });
+ </script>
+ ");
+
+
+ /* if the article we're editing is in the whitelist, then
+ * default to the generic editor; otherwise, default to
+ * classic mode (but allow switching) */
+ $default = in_array ($wgTitle->getNamespace(), $wgGenericEditPageWhiteList)
+ ? "generic" : "classic";
+
+ /* use the mode from the last request; default to generic (the first time)
+ * if we are switching modes, then use the OPPOSITE mode */
+ $klass = $wgRequest->getVal ("edit-mode", $default);
+ if ($wgSwitchMode) $klass = ($klass=="classic") ? "generic" : "classic";
+ $out->addHTML ("<input type='hidden' name='edit-mode' id='edit-mode' value='$klass' />");
+ $wgGenericEditPageClass = $klass;
+
+
+ // pass the layout name back, to be re-appended
+ $out->addHTML ("<input type='hidden' name='layout-name' value='{$layout[0]['name']}' />");
+
+
+ // build the sidebar (cats, sections) in its entirety
+ if ($wgCategoryBox || $wgSectionBox) {
+ $out->addHTML ("<div id='sidebar'>");
+ if ($wgSectionBox) $out->addHTML (UW_GenericEditPage_renderSectionBox($result));
+ if ($wgCategoryBox) $out->addHTML ($catbox);
+ $out->addHTML ("</div>");
+ }
+
+ return true;
+}
+
+/* OH, HOW I WISH FOR CLOSURES IN PHP, SO
+ * THESE DIDN'T HAVE TO BE GLOBAL FUNCTIONS */
+
+ /* when this hook is called (only on the generic edit page), add a
+ * special class to the <body> tag, to make targetting our css easier
+ * (also add a hook if we just switched modes, to hide the preview) */
+ function UW_GenericEditPage_addCssHookGenEd (&$sktemplate, &$tpl) {
+ global $wgGenericEditPageClass, $wgSwitchMode;
+ $tpl->data['pageclass'] .= " edit-$wgGenericEditPageClass";
+ if ($wgSwitchMode) $tpl->data['pageclass'] .= " switching-mode";
+ return true;
+ }
+ function UW_GenericEditPage_addCssHookSidebar (&$sktemplate, &$tpl) {
+ global $wgGenericEditPageClass;
+ $tpl->data['pageclass'] .= " with-sidebar";
+ return true;
+ }
+
+
+ // also attach our generic editor stylesheet
+ function UW_GenericEditPage_editPageCss (&$out) {
+ global $wgScriptPath;
+ $out .= "@import '$wgScriptPath/extensions/uniwiki/GenericEditPage/style.css';\n";
+ return true;
+ }
+
+
+$wgHooks['EditPage::attemptSave'][] = 'UW_GenericEditPage_combineBeforeSave';
+$wgHooks['EditPage::showEditForm:initial'][] = 'UW_GenericEditPage_combineBeforeSave';
+function UW_GenericEditPage_combineBeforeSave (&$editpage_Obj) {
+ global $wgRequest, $wgSwitchMode;
+ $data = $wgRequest->data;
+
+ /* if this request was triggered by the user
+ * pressing the "switch mode" button, then
+ * set a global to do some jiggery-pokery
+ * in the displayEditPage function, later */
+ if ($data['switch-mode'])
+ $wgSwitchMode = true;
+
+ /* if we are editing in classic mode,
+ * then this function does nothing! */
+ if ($data['edit-mode'] != "generic")
+ return true;
+
+ /* otherwise, clear the textbox and rebuild it
+ * from the generic input POST data */
+ $editpage_Obj->textbox1 = '';
+ $nodes = array();
+ $categories = array();
+ $directives = array();
+ foreach ($data as $key => $value) {
+ if (trim ($value) != '') {
+
+ if (substr($key, 0, 6) == 'title-') {
+ $index = intval (substr($key, 6));
+
+ /* only add this section if it is enabled,
+ * by checking the associated checkbox */
+ if (isset ($data["enable-$index"])) {
+
+ /* got a title -> add it back as a header,
+ * by fetching the level from field "level-N" */
+ $level = isset ($data["level-$index"]) ? $data["level-$index"] : 2;
+ $delim = str_repeat ( "=", $level );
+ $nodes[$index]['title'] = "$delim " . trim ($value) . " $delim\n";
+ }
+
+ /* got a section -> check that associated checkbox is
+ * ticked (or this is the first magic section, which
+ * does not have a checkbox), and add it into the output */
+ } else if (substr ($key, 0, 8) == 'section-') {
+ $index = intval (substr($key, 8));
+ if (isset ($data["enable-$index"]) || ($index==0)) {
+ $nodes[$index]['text'] = trim($value) . "\n\n";
+ }
+
+ /* got a category -> add it to the list of categories and put
+ * it into the page as human-friendly text (i.e. not a DB key) */
+ } else if (substr ($key, 0, 9) == 'category-') {
+ $categories[] = Title::newFromDBkey (substr ($key, 9))->getText();
+ }
+ }
+ }
+
+ /* put the section titles and text
+ * back into the default textbox */
+ foreach (array_keys ($nodes) as $k) {
+ if ($nodes[$k]['title']) $editpage_Obj->textbox1 .= $nodes[$k]['title'];
+ if ($nodes[$k]['text']) $editpage_Obj->textbox1 .= $nodes[$k]['text'];
+ }
+
+ // then add back the categories
+ if (count ($categories) != 0) {
+ sort ($categories);
+ foreach ($categories as $category) {
+ $editpage_Obj->textbox1 .= "[[Category:" . $category . "]]\n";
+ }
+ }
+
+ // finally, re-add the layout name
+ if ($data['layout-name']) {
+ $editpage_Obj->textbox1 .= "<layout name=\"{$data['layout-name']}\" />";
+ }
+
+ return true;
+}
+

Added: trunk/extensions/uniwiki/GenericEditPage/global.css
===================================================================
--- trunk/extensions/uniwiki/GenericEditPage/global.css (rev 0)
+++ trunk/extensions/uniwiki/GenericEditPage/global.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,7 @@
+/* vim: noet ts=4 sw=4
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+/* hide the [edit] section links */
+.editsection {
+ display: none;
+}

Added: trunk/extensions/uniwiki/GenericEditPage/style.css
===================================================================
--- trunk/extensions/uniwiki/GenericEditPage/style.css (rev 0)
+++ trunk/extensions/uniwiki/GenericEditPage/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,193 @@
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Generic_Edit_Page
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+
+#editform {
+ position: relative;
+
+ /* mootools sortables requires relative elements to
+ * have "layout", to correctly calculate dimensions
+ * see: http://dev.mootools.net/changeset/1499 */
+ zoom: 1;
+}
+
+ .generic-editor .instructions {
+ border: 1px solid #ccc;
+ background: #eee;
+ line-height: 6em;
+ font-size: 200%;
+ text-align: center;
+ display: none;
+ }
+
+ .generic-editor.show-instructions .instructions {
+ display: block; }
+
+ .generic-editor input,
+ .generic-editor h2 {
+ font-size: 160%;
+ width: 40%;
+ }
+
+ .generic-editor .in-use {
+ padding-bottom: 2em;
+ }
+
+ #bodyContent .generic-editor h2 {
+ margin-bottom: 3px;
+ padding-top: 0;
+ width: auto;
+ }
+
+ .generic-editor .not-in-use {
+ display: none;
+ }
+
+ .generic-editor textarea {
+ height: 12em;
+ }
+
+ .generic-editor .locked-text {
+ }
+
+/* hide a lot of mediawiki junk at the
+ * top of the edit form when it generic mode */
+body.edit-generic #mw-anon-edit-warning,
+body.edit-generic .mw-newarticletext,
+body.edit-generic .mw-newarticletextanon,
+body.edit-generic #editpage-copywarn,
+body.edit-generic .templatesUsed,
+
+/* summary is really hard to hide, because the
+ * mediawiki markup is a steaming heap of... */
+body.edit-generic #wpSummary,
+body.edit-generic .editOptions br,
+body.edit-generic #wpSummaryLabel {
+ display: none;
+}
+
+/* make the "you are recreating a deleted
+ * page!" warning nicer in generic mode */
+body.edit-generic div#mw-upload-deleted-warn,
+body.edit-generic div#mw-recreate-deleted-warn {
+ margin: 1em;
+ padding: 1em;
+ background: #fee;
+ border-color: #800;
+ padding-top: 0.6em;
+ margin-bottom: 2em;
+}
+
+/* to make space for the sidebar
+ * when it's being used */
+body.edit-generic.with-sidebar #editform {
+ padding-right: 17em; }
+
+ /* hide the sidebar as default */
+ #sidebar {
+ position: absolute;
+ display: none;
+ right: 0;
+ top: 0;
+ width: 15em;
+ background: #fff;
+ }
+
+ /* only make it visible in generic mode */
+ body.edit-generic #sidebar {
+ display: block; }
+
+ #section-box .sortables div,
+ #category-box div {
+ margin-bottom: 1px;
+ padding: 1px;
+ }
+
+ /* hack to hide the crazy mootools temporary div (spawned
+ * when dragging starts), to prevent the scrollbar jumping */
+ #section-box .sortables div { display: none; }
+ #section-box .sortables div.section-box { display: block; }
+
+ /* disabled/required sections */
+ #section-box .disabled {
+ color: #888;
+ }
+
+ /* something is draggable, use the hand */
+ #section-box .sortables div,
+ #section-box .sortables label {
+ cursor: pointer;
+ }
+
+ /* something is currently being dragged,
+ * so use the 'grabbing hand' cursor
+ * (the whole box, to avoid flickering) */
+ #section-box .sortables.dragging,
+ #section-box .sortables.dragging div,
+ #section-box .sortables.dragging label {
+ cursor: move !important;
+ }
+
+ /* sidebar contains both category-box
+ * and section-box */
+ #section-box .add,
+ #category-box,
+ #category-box .add,
+ #category-box .suggest {
+ border-top: 1px dotted #ccc;
+ margin: 1em 0 0 0;
+ padding: 1em 0 0 0;
+ }
+ #category-box .add #fm-add-cat,
+ #category-box .suggest #fm-suggest-cat { clear: both; }
+ #fm-add-cat, #fm-add-sect { width: 10em; }
+ #fm-suggest-cat { width: 8em; }
+
+ #category-box .add #fm-add-cat-button,
+ #category-box .suggest #fm-suggest-cat-button {
+ margin-top: 0.5em; }
+
+ /* the ajax response box */
+ #category-box .suggest div {
+ margin-top: 1em; }
+
+ #sidebar h3,
+ #section-box .add label,
+ #category-box .add label,
+ #category-box .suggest label {
+ padding: 0;
+ margin: 0;
+ font-size: 100%;
+ font-weight: bold;
+ padding-bottom: 0.5em;
+ }
+
+.edit-classic .generic-editor,
+.edit-generic #toolbar,
+.edit-generic #wpTextbox1 {
+ /* can't use display:none here, because wikibits.js (line 378)
+ * relies on the textarea.selectionStart property, which doesn't
+ * seem to work when the textarea is not displayed */
+ position: absolute;
+ top: -9999px;
+}
+
+.edit-classic .sw-classic,
+.edit-generic .sw-generic { display: none; }
+
+/* move button to top-right (above
+ * <h1>Editing Page Name</h1> underline) */
+input.switch {
+ position: absolute;
+ right: 1em;
+ top: 5px;
+}
+
+/* don't show the preview or categories list
+ * (why is it even there?) when switching modes */
+body.switching-mode #wikiPreview,
+body.switching-mode #catlinks {
+ display: none;
+}
+

Added: trunk/extensions/uniwiki/Javascript/Javascript.php
===================================================================
--- trunk/extensions/uniwiki/Javascript/Javascript.php (rev 0)
+++ trunk/extensions/uniwiki/Javascript/Javascript.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,24 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Javascript
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Uniwiki Javascript",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Adds uniwiki.js to each page (which currently just provides lightweight i18n support in Javascript), and serves as a placeholder for future Javascript code shared between Uniwiki extensions"
+);
+
+
+$wgHooks['BeforePageDisplay'][] = "UW_Javascript_addJS";
+function UW_Javascript_addJS($out) {
+ global $wgScriptPath;
+ $src = "$wgScriptPath/extensions/uniwiki/Javascript/uniwiki.js";
+ $out->addScript ("<script type='text/javascript' src='$src'></script>");
+ return true;
+}
+

Added: trunk/extensions/uniwiki/Javascript/uniwiki.js
===================================================================
--- trunk/extensions/uniwiki/Javascript/uniwiki.js (rev 0)
+++ trunk/extensions/uniwiki/Javascript/uniwiki.js 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,25 @@
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Javascript
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+
+// global uniwiki stuff
+var Uniwiki = {
+ i18n: {
+
+ /* other extensions should use this function
+ * to make their i18n strings accessible to JS */
+ add: function(obj) {
+ for (i in obj) {
+ Uniwiki.i18n[i] = obj[i];
+ }
+ }
+ }
+};
+
+/* global function to make internationalization rather
+ * easier, by looking up strings in the i18n hash */
+function wfMsg (key) {
+ return Uniwiki.i18n[key];
+}
+

Added: trunk/extensions/uniwiki/Layouts/Layouts.i18n.php
===================================================================
--- trunk/extensions/uniwiki/Layouts/Layouts.i18n.php (rev 0)
+++ trunk/extensions/uniwiki/Layouts/Layouts.i18n.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,50 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Layouts
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined("MEDIAWIKI"))
+ die();
+
+
+$wgLayoutsMessages = array();
+$wgLayoutsMessages['en'] = array(
+ 'layouts_title' => "Create a page",
+ 'layouts_chooselayout' => "Choose a Layout for $1:",
+ 'layouts_nolayout' => "No layout",
+ 'layouts_continue' => "Continue",
+ 'layouts_choosecategory' => "Choose a Category for $1:",
+ 'layouts_unknown' => "UNKNOWN",
+ 'layouts_tagline' => "This page was generated by the <strong>$1</strong> layout."
+);
+
+$wgLayoutsMessages['es'] = array(
+ 'layouts_title' => "Crear una página",
+ 'layouts_chooselayout' => "Selecciona un Diseño para $1:",
+ 'layouts_nolayout' => "Sin diseño",
+ 'layouts_continue' => "Continuar",
+ 'layouts_choosecategory' => "Elige una Categoría para $1:",
+ 'layouts_unknown' => "DESCONOCIDO",
+ 'layouts_tagline' => "Esta página se generó con el diseño <strong>$1</strong>."
+);
+
+$wgLayoutsMessages['de'] = array(
+ 'layouts_title' => "Neue Seite erstellen",
+ 'layouts_chooselayout' => "Suche ein Format aus für $1:",
+ 'layouts_nolayout' => "Kein Format",
+ 'layouts_continue' => "Weiter",
+ 'layouts_choosecategory' => "Suche ein Club aus für $1:",
+ 'layouts_unknown' => "UNBEKANNT",
+ 'layouts_tagline' => "Diese Seite wurde mit dem <strong>$1</strong> Layout erstellt."
+);
+
+$wgLayoutsMessages['pt-br'] = array(
+ 'layouts_title' => "Criar uma página",
+ 'layouts_chooselayout' => "Escolher um Layout para o $1:",
+ 'layouts_nolayout' => "Sem layout",
+ 'layouts_continue' => "Continuar",
+ 'layouts_choosecategory' => "Escolher uma Categoria para o $1:",
+ 'layouts_unknown' => "DESCONHECIDO",
+ 'layouts_tagline' => "Esta página foi gerada pelo layout <strong>$1</strong>."
+);
+

Added: trunk/extensions/uniwiki/Layouts/Layouts.php
===================================================================
--- trunk/extensions/uniwiki/Layouts/Layouts.php (rev 0)
+++ trunk/extensions/uniwiki/Layouts/Layouts.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,287 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:Uniwiki_Layouts
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+/* ---- CREDITS ---- */
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "Layouts",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Populate newly-created pages with editable \"layouts\", to encourage a common structure to articles"
+);
+
+
+/* ---- CONFIGURABLE OPTIONS ---- */
+
+$wgAddLayoutLink = true;
+$wgLayoutWhiteList = array(NS_MAIN);
+$wgLayoutCategories = false;
+$wgLayoutUseCategoryPage = true;
+$wgLayoutCategoryPage = "MediaWiki:Editpagetags";
+$wgLayoutCategoryNSWhiteList = array(NS_MAIN);
+$wgNoLayoutOption = true;
+
+
+/* ---- INTERNATIONALIZATION ---- */
+
+require_once ("Layouts.i18n.php");
+$wgExtensionFunctions[] = "UW_Layouts_i18n";
+
+function UW_Layouts_i18n() {
+ // add this extension's messages to the message cache
+ global $wgMessageCache, $wgLayoutsMessages;
+ foreach ($wgLayoutsMessages as $lang => $messages)
+ $wgMessageCache->addMessages ($messages, $lang);
+}
+
+
+/* ---- NAMESPACES ---- */
+
+/* assign constants to number our namespaces if they
+ * haven't already been defined (in localsettings) */
+if (!defined ("NS_LAYOUT")) define ("NS_LAYOUT", 100); # even = content
+if (!defined ("NS_LAYOUT_TALK")) define ("NS_LAYOUT_TALK", 101); # odd = discussion
+
+// create the namespaces
+$wgExtraNamespaces[NS_LAYOUT] = "Layout";
+$wgExtraNamespaces[NS_LAYOUT_TALK] = "Layout_talk";
+
+# only sysops can edit the layouts
+$wgNamespaceProtection[NS_LAYOUT] = array ("editlayouts");
+$wgGroupPermissions['sysop']['editlayouts'] = true;
+
+
+/* ---- TAGS ---- */
+
+$wgExtensionFunctions[] = "UW_Layouts_EF";
+function UW_Layouts_EF() {
+ global $wgParser;
+ $wgParser->setHook ("layout", "UW_Layouts_EF_Render");
+}
+
+/* render a note to display the name of the
+ * layout that this page was created from */
+function UW_Layouts_EF_Render ($input, $args, $parser) {
+ //$name = isset($args['name']) ? Title::newFromURL("Layout:".$args['name'])->getText() : wfMsg('layouts_unknown');
+ //return "<div class='layout-name'><p>".wfMsg('layouts_tagline', $name)."</p></div>";
+ return "";
+}
+
+
+/* ---- HOOKS ---- */
+
+$wgHooks['CustomEditor'][] = "UW_Layouts_maybeRedirectToLayout";
+function UW_Layouts_maybeRedirectToLayout($article, $user) {
+ global $wgOut, $wgRequest, $wgLayoutWhiteList;
+
+ /* don't hijack the request if we are
+ * in the middle of switching modes */
+ if ($wgRequest->data['switch-mode'])
+ return true;
+
+ /* if this page is new,
+ * no layout variable is in the query string,
+ * and the page is in a namespace that is using the extension
+ * and we are not submitting the form (either saving OR preview) */
+ if ($article->fetchContent()===false
+ && ($wgRequest->getVal ("layout")===NULL)
+ && in_array ($article->mTitle->getNamespace(), $wgLayoutWhiteList)
+ && ($wgRequest->getVal("action") != "submit"))
+
+ // redirect to the "pick a layout" page!
+ $wgOut->redirect($article->mTitle->getInternalUrl ("action=layout"));
+
+ return true;
+}
+
+$wgHooks['UnknownAction'][] = "UW_Layouts_checkActionIsLayout";
+function UW_Layouts_checkActionIsLayout($action, $article) {
+ global $wgOut, $wgDBprefix, $wgLayoutCategories, $wgLayoutUseCategoryPage,
+ $wgNoLayoutOption, $wgLayoutCategoryPage, $wgContLang,
+ $wgLayoutCategoryNSWhiteList;
+
+ // not layout = do nothing
+ if ($action!="layout")
+ return true;
+
+ /* if this page already exists, or
+ * is a discussion page, redirect
+ * to the regular edit page */
+ if ($article->fetchContent()!==false
+ || ($article->mTitle->getNamespace() % 2)) {
+ $wgOut->redirect($article->mTitle->getInternalUrl ("action=edit"));
+ return false;
+ }
+
+ // pluck out the bits that we need from mTitle
+ $title = $article->mTitle->getPrefixedText();
+ $url = $article->mTitle->getInternalUrl();
+ $name = $article->mTitle->getPrefixedURL();
+ $namespace = $article->mTitle->getNamespace();
+
+ $wgOut->setPageTitle (wfMsg ("layouts_title"));
+
+ /* fetch all articles/pages in the NS_LAYOUT namespace
+ * by directly querying the database. mediawiki doesn't
+ * provide any OO way of doing this :( */
+ $db = wfGetDB(DB_MASTER);
+ $layouts = $db->resultObject ($db->query ("select * from {$wgDBprefix}page where page_namespace=".NS_LAYOUT." order by page_title"));
+
+ $wgOut->addHTML (wfMsg ("layouts_chooselayout", $title)."
+ <form action='$url' method='get'>
+ <input type='hidden' name='title' value='$name' />
+ <input type='hidden' name='action' value='edit' />
+ ");
+
+ /* iterate the pages we found in the Layouts
+ * namespace, and list each one as an option
+ * as long as it is not restricted to specific
+ * namespaces */
+ $default = true;
+ while ($result=$layouts->next()) {
+ // page info
+ $title = Title::newFromURL ($result->page_title)->getText();
+ $revision = Revision::loadFromPageId ($db, $result->page_id);
+ $text = $revision->getText();
+ $lines = explode ("\n", $text);
+ $namespaces = array();
+
+ // add this layout to the choices by default
+ $add = true;
+
+ /* go through the layout text and see if it has an @namespace
+ * restriction, if so only add the layout as a choice if we find
+ * the namespace of this page in the layout text */
+ foreach ($lines as $line) {
+ if (preg_match ("/^@namespace(.+?)$/m", $line, $matches)) {
+ $namespaces = explode (" ", trim($matches[1]));
+ $add = in_array ($wgContLang->getNsText ($namespace), $namespaces) ||
+ $namespace == NS_MAIN && in_array ("Main", $namespaces);
+ }
+ }
+ if ($add) {
+ $checked = $default ? "checked='checked'" : "";
+ $default = false;
+ $fm_id = "layout-".$result->page_id;
+ $wgOut->addHTML("
+ <div>
+ <input type='radio' name='layout' id='$fm_id' value='$title' $checked/>
+ <label for='$fm_id'>$title</label>
+ </div>
+ ");
+ }
+ }
+
+ /* include an option to create a page
+ * without any layout (before any are created,
+ * this will be the only option available) */
+ if ($wgNoLayoutOption) {
+ $wgOut->addHTML("
+ <div>
+ <input type='radio' name='layout' id='layout-0' value='none' />
+ <label for='layout-0'>".wfMsg('layouts_nolayout')."</label>
+ </div>
+ ");
+ }
+ $wgOut->addHTML("<br/>");
+
+ /* check to see if we are allowing categories on the layout page
+ * and if so then, either grab all the categories, or get them from
+ * the designated page (do this for pages in the whitelisted namespaces) */
+ if ($wgLayoutCategories && in_array($namespace, $wgLayoutCategoryNSWhiteList)) {
+ $categories = array();
+
+ /* get the categories from the page if desired,
+ * otherwise grab them from the db */
+ if ($wgLayoutUseCategoryPage) {
+ $revision = Revision::newFromTitle(Title::newFromDBKey($wgLayoutCategoryPage));
+ $results = $revision ? split("\n", $revision->getText()) : array();
+ foreach ($results as $result) {
+ if (trim ($result) != '')
+ $categories[] = Title::newFromText(trim($result))->getDBkey();
+ }
+ } else {
+ // todo: implement this later...
+ }
+
+ // add radio buttons for the categories
+ $default = true;
+ $title = $article->mTitle->getPrefixedText();
+ $wgOut->addHTML("<div id='category-box'>".wfMsg ("layouts_choosecategory", $title));
+ foreach ($categories as $category) {
+ $checked = $default ? "checked='checked'" : "";
+ $default = false;
+ $fm_id = "category-$category";
+ $caption = Title::newFromDBkey ($category)->getText();
+ $wgOut->addHTML("
+ <div>
+ <input type='radio' name='category' id='$fm_id' value='$fm_id' $checked/>
+ <label for='$fm_id'>$caption</label>
+ </div>
+ ");
+ }
+ $wgOut->addHTML ("</div><br/>");
+ }
+
+ $wgOut->addHTML ("<input type='submit' value='".wfMsg('layouts_continue')."' />");
+ $wgOut->addHTML ("</form>");
+
+ return false;
+}
+
+$wgHooks['SkinTemplateSetupPageCss'][] = "UW_Layouts_Css";
+function UW_Layouts_Css (&$out) {
+ global $wgScriptPath;
+ $out .= "@import '$wgScriptPath/extensions/uniwiki/Layouts/style.css';\n";
+ return true;
+}
+
+$wgHooks['EditFormPreloadText'][] = "UW_Layouts_preFillTextBox";
+function UW_Layouts_preFillTextBox (&$text, $title) {
+ global $wgRequest, $wgAddLayoutLink;
+
+ /* fetch the layout from the query string,
+ * or abort this hook if it is missing */
+ $layout_slug = $wgRequest->getVal ("layout");
+ if ($layout_slug === NULL)
+ return true;
+
+ // fetch the layout object
+ $layout_title = Title::newFromURL ("Layout:".$layout_slug);
+ $layout_article = new Article ($layout_title);
+
+ /* if the layout article exists, pre-fill the textarea with its
+ * wiki text. if it doesn't exist, do nothing (no error) */
+ if (($layout_text = $layout_article->fetchContent()) !== false) {
+
+ /* break the layout text into sections by splitting
+ * at header level =one= or ==two==, and iterate */
+ $nodes = preg_split ("/^(==?[^=].*)$/mi", $layout_text, -1, PREG_SPLIT_DELIM_CAPTURE);
+ for ($i=0; $i<count($nodes); $i++) {
+
+ /* if the next node is OPTIONAL, then skip over it
+ * (it will be included if using GenericEditor) */
+ if (preg_match ("/^@optional$/m", $nodes[$i+1])) {
+ $i++;
+
+ /* not an optional section, or
+ * text that hasn't been skipped */
+ } else {
+
+ // DO NOT copy over directives. remove them all!
+ $text .= preg_replace ("/^@.*/m", "", $nodes[$i]);
+ }
+ }
+ }
+
+ if ($wgAddLayoutLink && $layout_slug != 'none')
+ $text .= "\n\n<layout name=\"$layout_slug\" />";
+
+ return true;
+}
+

Added: trunk/extensions/uniwiki/Layouts/style.css
===================================================================
--- trunk/extensions/uniwiki/Layouts/style.css (rev 0)
+++ trunk/extensions/uniwiki/Layouts/style.css 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,32 @@
+div.layout-name {
+ position: absolute;
+ border: 1px solid #aaa;
+ background: #f0f0f0;
+ right: 1em;
+ padding: 5px 10px;
+ margin-top: 1em;
+ color: #888;
+}
+
+div.layout-name strong {
+ color: #444;
+}
+
+/* sidebar search form */
+#p-search .pBody {
+ padding: 0pt 0.8em 0.3em 0.5em;
+}
+
+ #p-search form {
+ padding: 5px;
+ }
+
+ #searchInput {
+ width: 10em;
+ margin-bottom: 4px;
+ }
+
+ /* hide the "GO" button, but leave
+ * it accessible by hitting ENTER */
+ #searchGoButton { display: none; }
+

Added: trunk/extensions/uniwiki/MooTools12core/MooTools12core.php
===================================================================
--- trunk/extensions/uniwiki/MooTools12core/MooTools12core.php (rev 0)
+++ trunk/extensions/uniwiki/MooTools12core/MooTools12core.php 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,24 @@
+<?php
+/* vim: noet ts=4 sw=4
+ * http://www.mediawiki.org/wiki/Extension:MooTools_1.2_Core
+ * http://www.gnu.org/licenses/gpl-3.0.txt */
+
+if (!defined('MEDIAWIKI'))
+ die();
+
+
+$wgExtensionCredits['other'][] = array(
+ 'name' => "MooTools12core",
+ 'author' => "Merrick Schaefer, Mark Johnston, Evan Wheeler and Adam Mckaig (at UNICEF)",
+ 'description' => "Adds mootools-1.2-core-yc.js to each page"
+);
+
+
+$wgHooks['BeforePageDisplay'][] = "UW_MooTools12core_addJS";
+function UW_MooTools12core_addJS($out) {
+ global $wgScriptPath;
+ $src = "$wgScriptPath/extensions/uniwiki/MooTools12core/mootools-1.2-core-yc.js";
+ $out->addScript("<script type='text/javascript' src='$src'></script>");
+ return true;
+}
+

Added: trunk/extensions/uniwiki/MooTools12core/mootools-1.2-core-yc.js
===================================================================
--- trunk/extensions/uniwiki/MooTools12core/mootools-1.2-core-yc.js (rev 0)
+++ trunk/extensions/uniwiki/MooTools12core/mootools-1.2-core-yc.js 2008-09-08 20:23:18 UTC (rev 40612)
@@ -0,0 +1,341 @@
+//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
+
+var MooTools={version:"1.2.0",build:""};var Native=function(J){J=J||{};var F=J.afterImplement||function(){};var G=J.generics;G=(G!==false);var H=J.legacy;
+var E=J.initialize;var B=J.protect;var A=J.name;var C=E||H;C.constructor=Native;C.$family={name:"native"};if(H&&E){C.prototype=H.prototype;}C.prototype.constructor=C;
+if(A){var D=A.toLowerCase();C.prototype.$family={name:D};Native.typize(C,D);}var I=function(M,K,N,L){if(!B||L||!M.prototype[K]){M.prototype[K]=N;}if(G){Native.genericize(M,K,B);
+}F.call(M,K,N);return M;};C.implement=function(L,K,N){if(typeof L=="string"){return I(this,L,K,N);}for(var M in L){I(this,M,L[M],K);}return this;};C.alias=function(M,K,N){if(typeof M=="string"){M=this.prototype[M];
+if(M){I(this,K,M,N);}}else{for(var L in M){this.alias(L,M[L],K);}}return this;};return C;};Native.implement=function(D,C){for(var B=0,A=D.length;B<A;B++){D[B].implement(C);
+}};Native.genericize=function(B,C,A){if((!A||!B[C])&&typeof B.prototype[C]=="function"){B[C]=function(){var D=Array.prototype.slice.call(arguments);return B.prototype[C].apply(D.shift(),D);
+};}};Native.typize=function(A,B){if(!A.type){A.type=function(C){return($type(C)===B);};}};Native.alias=function(E,B,A,F){for(var D=0,C=E.length;D<C;D++){E[D].alias(B,A,F);
+}};(function(B){for(var A in B){Native.typize(B[A],A);}})({"boolean":Boolean,"native":Native,object:Object});(function(B){for(var A in B){new Native({name:A,initialize:B[A],protect:true});
+}})({String:String,Function:Function,Number:Number,Array:Array,RegExp:RegExp,Date:Date});(function(B,A){for(var C=A.length;C--;C){Native.genericize(B,A[C],true);
+}return arguments.callee;})(Array,["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice","toString","valueOf","indexOf","lastIndexOf"])(String,["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]);
+function $chk(A){return !!(A||A===0);}function $clear(A){clearTimeout(A);clearInterval(A);return null;}function $defined(A){return(A!=undefined);}function $empty(){}function $arguments(A){return function(){return arguments[A];
+};}function $lambda(A){return(typeof A=="function")?A:function(){return A;};}function $extend(C,A){for(var B in (A||{})){C[B]=A[B];}return C;}function $unlink(C){var B;
+switch($type(C)){case"object":B={};for(var E in C){B[E]=$unlink(C[E]);}break;case"hash":B=$unlink(C.getClean());break;case"array":B=[];for(var D=0,A=C.length;
+D<A;D++){B[D]=$unlink(C[D]);}break;default:return C;}return B;}function $merge(){var E={};for(var D=0,A=arguments.length;D<A;D++){var B=arguments[D];if($type(B)!="object"){continue;
+}for(var C in B){var G=B[C],F=E[C];E[C]=(F&&$type(G)=="object"&&$type(F)=="object")?$merge(F,G):$unlink(G);}}return E;}function $pick(){for(var B=0,A=arguments.length;
+B<A;B++){if(arguments[B]!=undefined){return arguments[B];}}return null;}function $random(B,A){return Math.floor(Math.random()*(A-B+1)+B);}function $splat(B){var A=$type(B);
+return(A)?((A!="array"&&A!="arguments")?[B]:B):[];}var $time=Date.now||function(){return new Date().getTime();};function $try(){for(var B=0,A=arguments.length;
+B<A;B++){try{return arguments[B]();}catch(C){}}return null;}function $type(A){if(A==undefined){return false;}if(A.$family){return(A.$family.name=="number"&&!isFinite(A))?false:A.$family.name;
+}if(A.nodeName){switch(A.nodeType){case 1:return"element";case 3:return(/\S/).test(A.nodeValue)?"textnode":"whitespace";}}else{if(typeof A.length=="number"){if(A.callee){return"arguments";
+}else{if(A.item){return"collection";}}}}return typeof A;}var Hash=new Native({name:"Hash",initialize:function(A){if($type(A)=="hash"){A=$unlink(A.getClean());
+}for(var B in A){this[B]=A[B];}return this;}});Hash.implement({getLength:function(){var B=0;for(var A in this){if(this.hasOwnProperty(A)){B++;}}return B;
+},forEach:function(B,C){for(var A in this){if(this.hasOwnProperty(A)){B.call(C,this[A],A,this);}}},getClean:function(){var B={};for(var A in this){if(this.hasOwnProperty(A)){B[A]=this[A];
+}}return B;}});Hash.alias("forEach","each");function $H(A){return new Hash(A);}Array.implement({forEach:function(C,D){for(var B=0,A=this.length;B<A;B++){C.call(D,this[B],B,this);
+}}});Array.alias("forEach","each");function $A(C){if(C.item){var D=[];for(var B=0,A=C.length;B<A;B++){D[B]=C[B];}return D;}return Array.prototype.slice.call(C);
+}function $each(C,B,D){var A=$type(C);((A=="arguments"||A=="collection"||A=="array")?Array:Hash).each(C,B,D);}var Browser=new Hash({Engine:{name:"unknown",version:""},Platform:{name:(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime)},Plugins:{}});
+if(window.opera){Browser.Engine={name:"presto",version:(document.getElementsByClassName)?950:925};}else{if(window.ActiveXObject){Browser.Engine={name:"trident",version:(window.XMLHttpRequest)?5:4};
+}else{if(!navigator.taintEnabled){Browser.Engine={name:"webkit",version:(Browser.Features.xpath)?420:419};}else{if(document.getBoxObjectFor!=null){Browser.Engine={name:"gecko",version:(document.getElementsByClassName)?19:18};
+}}}}Browser.Engine[Browser.Engine.name]=Browser.Engine[Browser.Engine.name+Browser.Engine.version]=true;if(window.orientation!=undefined){Browser.Platform.name="ipod";
+}Browser.Platform[Browser.Platform.name]=true;Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP");
+});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var A=($try(function(){return navigator.plugins["Shockwave Flash"].description;
+},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(A[0]||0+"."+A[1]||0),build:parseInt(A[2]||0)};
+})();function $exec(B){if(!B){return B;}if(window.execScript){window.execScript(B);}else{var A=document.createElement("script");A.setAttribute("type","text/javascript");
+A.text=B;document.head.appendChild(A);document.head.removeChild(A);}return B;}Native.UID=1;var $uid=(Browser.Engine.trident)?function(A){return(A.uid||(A.uid=[Native.UID++]))[0];
+}:function(A){return A.uid||(A.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(A){$uid(A);
+if(!A.Element){A.Element=$empty;if(Browser.Engine.webkit){A.document.createElement("iframe");}A.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};
+}return $extend(A,Window.Prototype);},afterImplement:function(B,A){window[B]=Window.Prototype[B]=A;}});Window.Prototype={$family:{name:"window"}};new Window(window);
+var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(A){$uid(A);A.head=A.getElementsByTagName("head")[0];
+A.html=A.getElementsByTagName("html")[0];A.window=A.defaultView||A.parentWindow;if(Browser.Engine.trident4){$try(function(){A.execCommand("BackgroundImageCache",false,true);
+});}return $extend(A,Document.Prototype);},afterImplement:function(B,A){document[B]=Document.Prototype[B]=A;}});Document.Prototype={$family:{name:"document"}};
+new Document(document);Array.implement({every:function(C,D){for(var B=0,A=this.length;B<A;B++){if(!C.call(D,this[B],B,this)){return false;}}return true;
+},filter:function(D,E){var C=[];for(var B=0,A=this.length;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B]);}}return C;},clean:function(){return this.filter($defined);
+},indexOf:function(C,D){var A=this.length;for(var B=(D<0)?Math.max(0,A+D):D||0;B<A;B++){if(this[B]===C){return B;}}return -1;},map:function(D,E){var C=[];
+for(var B=0,A=this.length;B<A;B++){C[B]=D.call(E,this[B],B,this);}return C;},some:function(C,D){for(var B=0,A=this.length;B<A;B++){if(C.call(D,this[B],B,this)){return true;
+}}return false;},associate:function(C){var D={},B=Math.min(this.length,C.length);for(var A=0;A<B;A++){D[C[A]]=this[A];}return D;},link:function(C){var A={};
+for(var E=0,B=this.length;E<B;E++){for(var D in C){if(C[D](this[E])){A[D]=this[E];delete C[D];break;}}}return A;},contains:function(A,B){return this.indexOf(A,B)!=-1;
+},extend:function(C){for(var B=0,A=C.length;B<A;B++){this.push(C[B]);}return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;
+},include:function(A){if(!this.contains(A)){this.push(A);}return this;},combine:function(C){for(var B=0,A=C.length;B<A;B++){this.include(C[B]);}return this;
+},erase:function(B){for(var A=this.length;A--;A){if(this[A]===B){this.splice(A,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var D=[];
+for(var B=0,A=this.length;B<A;B++){var C=$type(this[B]);if(!C){continue;}D=D.concat((C=="array"||C=="collection"||C=="arguments")?Array.flatten(this[B]):this[B]);
+}return D;},hexToRgb:function(B){if(this.length!=3){return null;}var A=this.map(function(C){if(C.length==1){C+=C;}return C.toInt(16);});return(B)?A:"rgb("+A+")";
+},rgbToHex:function(D){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!D){return"transparent";}var B=[];for(var A=0;A<3;A++){var C=(this[A]-0).toString(16);
+B.push((C.length==1)?"0"+C:C);}return(D)?B:"#"+B.join("");}});Function.implement({extend:function(A){for(var B in A){this[B]=A[B];}return this;},create:function(B){var A=this;
+B=B||{};return function(D){var C=B.arguments;C=(C!=undefined)?$splat(C):Array.slice(arguments,(B.event)?1:0);if(B.event){C=[D||window.event].extend(C);
+}var E=function(){return A.apply(B.bind||null,C);};if(B.delay){return setTimeout(E,B.delay);}if(B.periodical){return setInterval(E,B.periodical);}if(B.attempt){return $try(E);
+}return E();};},pass:function(A,B){return this.create({arguments:A,bind:B});},attempt:function(A,B){return this.create({arguments:A,bind:B,attempt:true})();
+},bind:function(B,A){return this.create({bind:B,arguments:A});},bindWithEvent:function(B,A){return this.create({bind:B,event:true,arguments:A});},delay:function(B,C,A){return this.create({delay:B,bind:C,arguments:A})();
+},periodical:function(A,C,B){return this.create({periodical:A,bind:C,arguments:B})();},run:function(A,B){return this.apply(B,$splat(A));}});Number.implement({limit:function(B,A){return Math.min(A,Math.max(B,this));
+},round:function(A){A=Math.pow(10,A||0);return Math.round(this*A)/A;},times:function(B,C){for(var A=0;A<this;A++){B.call(C,A,this);}},toFloat:function(){return parseFloat(this);
+},toInt:function(A){return parseInt(this,A||10);}});Number.alias("times","each");(function(B){var A={};B.each(function(C){if(!Number[C]){A[C]=function(){return Math[C].apply(null,[this].concat($A(arguments)));
+};}});Number.implement(A);})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(A,B){return((typeof A=="string")?new RegExp(A,B):A).test(this);
+},contains:function(A,B){return(B)?(B+this+B).indexOf(B+A+B)>-1:this.indexOf(A)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim();
+},camelCase:function(){return this.replace(/-\D/g,function(A){return A.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(A){return("-"+A.charAt(0).toLowerCase());
+});},capitalize:function(){return this.replace(/\b[a-z]/g,function(A){return A.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");
+},toInt:function(A){return parseInt(this,A||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(B){var A=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
+return(A)?A.slice(1).hexToRgb(B):null;},rgbToHex:function(B){var A=this.match(/\d{1,3}/g);return(A)?A.rgbToHex(B):null;},stripScripts:function(B){var A="";
+var C=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){A+=arguments[1]+"\n";return"";});if(B===true){$exec(A);}else{if($type(B)=="function"){B(A,C);
+}}return C;},substitute:function(A,B){return this.replace(B||(/\\?\{([^}]+)\}/g),function(D,C){if(D.charAt(0)=="\\"){return D.slice(1);}return(A[C]!=undefined)?A[C]:"";
+});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(B){for(var A in this){if(this.hasOwnProperty(A)&&this[A]===B){return A;}}return null;
+},hasValue:function(A){return(Hash.keyOf(this,A)!==null);},extend:function(A){Hash.each(A,function(C,B){Hash.set(this,B,C);},this);return this;},combine:function(A){Hash.each(A,function(C,B){Hash.include(this,B,C);
+},this);return this;},erase:function(A){if(this.hasOwnProperty(A)){delete this[A];}return this;},get:function(A){return(this.hasOwnProperty(A))?this[A]:null;
+},set:function(A,B){if(!this[A]||this.hasOwnProperty(A)){this[A]=B;}return this;},empty:function(){Hash.each(this,function(B,A){delete this[A];},this);
+return this;},include:function(B,C){var A=this[B];if(A==undefined){this[B]=C;}return this;},map:function(B,C){var A=new Hash;Hash.each(this,function(E,D){A.set(D,B.call(C,E,D,this));
+},this);return A;},filter:function(B,C){var A=new Hash;Hash.each(this,function(E,D){if(B.call(C,E,D,this)){A.set(D,E);}},this);return A;},every:function(B,C){for(var A in this){if(this.hasOwnProperty(A)&&!B.call(C,this[A],A)){return false;
+}}return true;},some:function(B,C){for(var A in this){if(this.hasOwnProperty(A)&&B.call(C,this[A],A)){return true;}}return false;},getKeys:function(){var A=[];
+Hash.each(this,function(C,B){A.push(B);});return A;},getValues:function(){var A=[];Hash.each(this,function(B){A.push(B);});return A;},toQueryString:function(A){var B=[];
+Hash.each(this,function(F,E){if(A){E=A+"["+E+"]";}var D;switch($type(F)){case"object":D=Hash.toQueryString(F,E);break;case"array":var C={};F.each(function(H,G){C[G]=H;
+});D=Hash.toQueryString(C,E);break;default:D=E+"="+encodeURIComponent(F);}if(F!=undefined){B.push(D);}});return B.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"});
+var Event=new Native({name:"Event",initialize:function(A,F){F=F||window;var K=F.document;A=A||F.event;if(A.$extended){return A;}this.$extended=true;var J=A.type;
+var G=A.target||A.srcElement;while(G&&G.nodeType==3){G=G.parentNode;}if(J.test(/key/)){var B=A.which||A.keyCode;var M=Event.Keys.keyOf(B);if(J=="keydown"){var D=B-111;
+if(D>0&&D<13){M="f"+D;}}M=M||String.fromCharCode(B).toLowerCase();}else{if(J.match(/(click|mouse|menu)/i)){K=(!K.compatMode||K.compatMode=="CSS1Compat")?K.html:K.body;
+var I={x:A.pageX||A.clientX+K.scrollLeft,y:A.pageY||A.clientY+K.scrollTop};var C={x:(A.pageX)?A.pageX-F.pageXOffset:A.clientX,y:(A.pageY)?A.pageY-F.pageYOffset:A.clientY};
+if(J.match(/DOMMouseScroll|mousewheel/)){var H=(A.wheelDelta)?A.wheelDelta/120:-(A.detail||0)/3;}var E=(A.which==3)||(A.button==2);var L=null;if(J.match(/over|out/)){switch(J){case"mouseover":L=A.relatedTarget||A.fromElement;
+break;case"mouseout":L=A.relatedTarget||A.toElement;}if(!(function(){while(L&&L.nodeType==3){L=L.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){L=false;
+}}}}return $extend(this,{event:A,type:J,page:I,client:C,rightClick:E,wheel:H,relatedTarget:L,target:G,code:B,key:M,shift:A.shiftKey,control:A.ctrlKey,alt:A.altKey,meta:A.metaKey});
+}});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();
+},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault();
+}else{this.event.returnValue=false;}return this;}});var Class=new Native({name:"Class",initialize:function(B){B=B||{};var A=function(E){for(var D in this){this[D]=$unlink(this[D]);
+}for(var F in Class.Mutators){if(!this[F]){continue;}Class.Mutators[F](this,this[F]);delete this[F];}this.constructor=A;if(E===$empty){return this;}var C=(this.initialize)?this.initialize.apply(this,arguments):this;
+if(this.options&&this.options.initialize){this.options.initialize.call(this);}return C;};$extend(A,this);A.constructor=Class;A.prototype=B;return A;}});
+Class.implement({implement:function(){Class.Mutators.Implements(this.prototype,Array.slice(arguments));return this;}});Class.Mutators={Implements:function(A,B){$splat(B).each(function(C){$extend(A,($type(C)=="class")?new C($empty):C);
+});},Extends:function(self,klass){var instance=new klass($empty);delete instance.parent;delete instance.parentOf;for(var key in instance){var current=self[key],previous=instance[key];
+if(current==undefined){self[key]=previous;continue;}var ctype=$type(current),ptype=$type(previous);if(ctype!=ptype){continue;}switch(ctype){case"function":if(!arguments.callee.caller){self[key]=eval("("+String(current).replace(/\bthis\.parent\(\s*(\))?/g,function(full,close){return"arguments.callee._parent_.call(this"+(close||", ");
+})+")");}self[key]._parent_=previous;break;case"object":self[key]=$merge(previous,current);}}self.parent=function(){return arguments.callee.caller._parent_.apply(this,arguments);
+};self.parentOf=function(descendant){return descendant._parent_.apply(this,Array.slice(arguments,1));};}};var Chain=new Class({chain:function(){this.$chain=(this.$chain||[]).extend(arguments);
+return this;},callChain:function(){return(this.$chain&&this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){if(this.$chain){this.$chain.empty();
+}return this;}});var Events=new Class({addEvent:function(C,B,A){C=Events.removeOn(C);if(B!=$empty){this.$events=this.$events||{};this.$events[C]=this.$events[C]||[];
+this.$events[C].include(B);if(A){B.internal=true;}}return this;},addEvents:function(A){for(var B in A){this.addEvent(B,A[B]);}return this;},fireEvent:function(C,B,A){C=Events.removeOn(C);
+if(!this.$events||!this.$events[C]){return this;}this.$events[C].each(function(D){D.create({bind:this,delay:A,"arguments":B})();},this);return this;},removeEvent:function(B,A){B=Events.removeOn(B);
+if(!this.$events||!this.$events[B]){return this;}if(!A.internal){this.$events[B].erase(A);}return this;},removeEvents:function(C){for(var D in this.$events){if(C&&C!=D){continue;
+}var B=this.$events[D];for(var A=B.length;A--;A){this.removeEvent(D,B[A]);}}return this;}});Events.removeOn=function(A){return A.replace(/^on([A-Z])/,function(B,C){return C.toLowerCase();
+});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent){return this;}for(var A in this.options){if($type(this.options[A])!="function"||!(/^on[A-Z]/).test(A)){continue;
+}this.addEvent(A,this.options[A]);delete this.options[A];}return this;}});Document.implement({newElement:function(A,B){if(Browser.Engine.trident&&B){["name","type","checked"].each(function(C){if(!B[C]){return ;
+}A+=" "+C+'="'+B[C]+'"';if(C!="checked"){delete B[C];}});A="<"+A+">";}return $.element(this.createElement(A)).set(B);},newTextNode:function(A){return this.createTextNode(A);
+},getDocument:function(){return this;},getWindow:function(){return this.defaultView||this.parentWindow;},purge:function(){var C=this.getElementsByTagName("*");
+for(var B=0,A=C.length;B<A;B++){Browser.freeMem(C[B]);}}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(A,B){var C=Element.Constructors.get(A);
+if(C){return C(B);}if(typeof A=="string"){return document.newElement(A,B);}return $(A).set(B);},afterImplement:function(A,B){if(!Array[A]){Elements.implement(A,Elements.multi(A));
+}Element.Prototype[A]=B;}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var E=Array.link(arguments,{properties:Object.type,iframe:$defined});
+var C=E.properties||{};var B=$(E.iframe)||false;var D=C.onload||$empty;delete C.onload;C.id=C.name=$pick(C.id,C.name,B.id,B.name,"IFrame_"+$time());B=new Element(B||"iframe",C);
+var A=function(){var F=$try(function(){return B.contentWindow.location.host;});if(F&&F==window.location.host){var H=new Window(B.contentWindow);var G=new Document(B.contentWindow.document);
+$extend(H.Element.prototype,Element.Prototype);}D.call(B.contentWindow,B.contentWindow.document);};(!window.frames[C.id])?B.addListener("load",A):A();return B;
+}});var Elements=new Native({initialize:function(F,B){B=$extend({ddup:true,cash:true},B);F=F||[];if(B.ddup||B.cash){var G={},E=[];for(var C=0,A=F.length;
+C<A;C++){var D=$.element(F[C],!B.cash);if(B.ddup){if(G[D.uid]){continue;}G[D.uid]=true;}E.push(D);}F=E;}return(B.cash)?$extend(F,this):F;}});Elements.implement({filter:function(A,B){if(!A){return this;
+}return new Elements(Array.filter(this,(typeof A=="string")?function(C){return C.match(A);}:A,B));}});Elements.multi=function(A){return function(){var B=[];
+var F=true;for(var D=0,C=this.length;D<C;D++){var E=this[D][A].apply(this[D],arguments);B.push(E);if(F){F=($type(E)=="element");}}return(F)?new Elements(B):B;
+};};Window.implement({$:function(B,C){if(B&&B.$family&&B.uid){return B;}var A=$type(B);return($[A])?$[A](B,C,this.document):null;},$$:function(A){if(arguments.length==1&&typeof A=="string"){return this.document.getElements(A);
+}var F=[];var C=Array.flatten(arguments);for(var D=0,B=C.length;D<B;D++){var E=C[D];switch($type(E)){case"element":E=[E];break;case"string":E=this.document.getElements(E,true);
+break;default:E=false;}if(E){F.extend(E);}}return new Elements(F);},getDocument:function(){return this.document;},getWindow:function(){return this;}});
+$.string=function(C,B,A){C=A.getElementById(C);return(C)?$.element(C,B):null;};$.element=function(A,D){$uid(A);if(!D&&!A.$family&&!(/^object|embed$/i).test(A.tagName)){var B=Element.Prototype;
+for(var C in B){A[C]=B[C];}}return A;};$.object=function(B,C,A){if(B.toElement){return $.element(B.toElement(A),C);}return null;};$.textnode=$.whitespace=$.window=$.document=$arguments(0);
+Native.implement([Element,Document],{getElement:function(A,B){return $(this.getElements(A,true)[0]||null,B);},getElements:function(A,D){A=A.split(",");
+var C=[];var B=(A.length>1);A.each(function(E){var F=this.getElementsByTagName(E.trim());(B)?C.extend(F):C=F;},this);return new Elements(C,{ddup:B,cash:!D});
+}});Element.Storage={get:function(A){return(this[A]||(this[A]={}));}};Element.Inserters=new Hash({before:function(B,A){if(A.parentNode){A.parentNode.insertBefore(B,A);
+}},after:function(B,A){if(!A.parentNode){return ;}var C=A.nextSibling;(C)?A.parentNode.insertBefore(B,C):A.parentNode.appendChild(B);},bottom:function(B,A){A.appendChild(B);
+},top:function(B,A){var C=A.firstChild;(C)?A.insertBefore(B,C):A.appendChild(B);}});Element.Inserters.inside=Element.Inserters.bottom;Element.Inserters.each(function(C,B){var A=B.capitalize();
+Element.implement("inject"+A,function(D){C(this,$(D,true));return this;});Element.implement("grab"+A,function(D){C($(D,true),this);return this;});});Element.implement({getDocument:function(){return this.ownerDocument;
+},getWindow:function(){return this.ownerDocument.getWindow();},getElementById:function(D,C){var B=this.ownerDocument.getElementById(D);if(!B){return null;
+}for(var A=B.parentNode;A!=this;A=A.parentNode){if(!A){return null;}}return $.element(B,C);},set:function(D,B){switch($type(D)){case"object":for(var C in D){this.set(C,D[C]);
+}break;case"string":var A=Element.Properties.get(D);(A&&A.set)?A.set.apply(this,Array.slice(arguments,1)):this.setProperty(D,B);}return this;},get:function(B){var A=Element.Properties.get(B);
+return(A&&A.get)?A.get.apply(this,Array.slice(arguments,1)):this.getProperty(B);},erase:function(B){var A=Element.Properties.get(B);(A&&A.erase)?A.erase.apply(this,Array.slice(arguments,1)):this.removeProperty(B);
+return this;},match:function(A){return(!A||Element.get(this,"tag")==A);},inject:function(B,A){Element.Inserters.get(A||"bottom")(this,$(B,true));return this;
+},wraps:function(B,A){B=$(B,true);return this.replaces(B).grab(B,A);},grab:function(B,A){Element.Inserters.get(A||"bottom")($(B,true),this);return this;
+},appendText:function(B,A){return this.grab(this.getDocument().newTextNode(B),A);},adopt:function(){Array.flatten(arguments).each(function(A){A=$(A,true);
+if(A){this.appendChild(A);}},this);return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},clone:function(D,C){switch($type(this)){case"element":var H={};
+for(var G=0,E=this.attributes.length;G<E;G++){var B=this.attributes[G],L=B.nodeName.toLowerCase();if(Browser.Engine.trident&&(/input/i).test(this.tagName)&&(/width|height/).test(L)){continue;
+}var K=(L=="style"&&this.style)?this.style.cssText:B.nodeValue;if(!$chk(K)||L=="uid"||(L=="id"&&!C)){continue;}if(K!="inherit"&&["string","number"].contains($type(K))){H[L]=K;
+}}var J=new Element(this.nodeName.toLowerCase(),H);if(D!==false){for(var I=0,F=this.childNodes.length;I<F;I++){var A=Element.clone(this.childNodes[I],true,C);
+if(A){J.grab(A);}}}return J;case"textnode":return document.newTextNode(this.nodeValue);}return null;},replaces:function(A){A=$(A,true);A.parentNode.replaceChild(this,A);
+return this;},hasClass:function(A){return this.className.contains(A," ");},addClass:function(A){if(!this.hasClass(A)){this.className=(this.className+" "+A).clean();
+}return this;},removeClass:function(A){this.className=this.className.replace(new RegExp("(^|\\s)"+A+"(?:\\s|$)"),"$1").clean();return this;},toggleClass:function(A){return this.hasClass(A)?this.removeClass(A):this.addClass(A);
+},getComputedStyle:function(B){if(this.currentStyle){return this.currentStyle[B.camelCase()];}var A=this.getWindow().getComputedStyle(this,null);return(A)?A.getPropertyValue([B.hyphenate()]):null;
+},empty:function(){$A(this.childNodes).each(function(A){Browser.freeMem(A);Element.empty(A);Element.dispose(A);},this);return this;},destroy:function(){Browser.freeMem(this.empty().dispose());
+return null;},getSelected:function(){return new Elements($A(this.options).filter(function(A){return A.selected;}));},toQueryString:function(){var A=[];
+this.getElements("input, select, textarea").each(function(B){if(!B.name||B.disabled){return ;}var C=(B.tagName.toLowerCase()=="select")?Element.getSelected(B).map(function(D){return D.value;
+}):((B.type=="radio"||B.type=="checkbox")&&!B.checked)?null:B.value;$splat(C).each(function(D){if(D){A.push(B.name+"="+encodeURIComponent(D));}});});return A.join("&");
+},getProperty:function(C){var B=Element.Attributes,A=B.Props[C];var D=(A)?this[A]:this.getAttribute(C,2);return(B.Bools[C])?!!D:(A)?D:D||null;},getProperties:function(){var A=$A(arguments);
+return A.map(function(B){return this.getProperty(B);},this).associate(A);},setProperty:function(D,E){var C=Element.Attributes,B=C.Props[D],A=$defined(E);
+if(B&&C.Bools[D]){E=(E||!A)?true:false;}else{if(!A){return this.removeProperty(D);}}(B)?this[B]=E:this.setAttribute(D,E);return this;},setProperties:function(A){for(var B in A){this.setProperty(B,A[B]);
+}return this;},removeProperty:function(D){var C=Element.Attributes,B=C.Props[D],A=(B&&C.Bools[D]);(B)?this[B]=(A)?false:"":this.removeAttribute(D);return this;
+},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;}});(function(){var A=function(D,B,I,C,F,H){var E=D[I||B];var G=[];
+while(E){if(E.nodeType==1&&(!C||Element.match(E,C))){G.push(E);if(!F){break;}}E=E[B];}return(F)?new Elements(G,{ddup:false,cash:!H}):$(G[0],H);};Element.implement({getPrevious:function(B,C){return A(this,"previousSibling",null,B,false,C);
+},getAllPrevious:function(B,C){return A(this,"previousSibling",null,B,true,C);},getNext:function(B,C){return A(this,"nextSibling",null,B,false,C);},getAllNext:function(B,C){return A(this,"nextSibling",null,B,true,C);
+},getFirst:function(B,C){return A(this,"nextSibling","firstChild",B,false,C);},getLast:function(B,C){return A(this,"previousSibling","lastChild",B,false,C);
+},getParent:function(B,C){return A(this,"parentNode",null,B,false,C);},getParents:function(B,C){return A(this,"parentNode",null,B,true,C);},getChildren:function(B,C){return A(this,"nextSibling","firstChild",B,true,C);
+},hasChild:function(B){B=$(B,true);return(!!B&&$A(this.getElementsByTagName(B.tagName)).contains(B));}});})();Element.Properties=new Hash;Element.Properties.style={set:function(A){this.style.cssText=A;
+},get:function(){return this.style.cssText;},erase:function(){this.style.cssText="";}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();
+}};Element.Properties.href={get:function(){return(!this.href)?null:this.href.replace(new RegExp("^"+document.location.protocol+"//"+document.location.host),"");
+}};Element.Properties.html={set:function(){return this.innerHTML=Array.flatten(arguments).join("");}};Native.implement([Element,Window,Document],{addListener:function(B,A){if(this.addEventListener){this.addEventListener(B,A,false);
+}else{this.attachEvent("on"+B,A);}return this;},removeListener:function(B,A){if(this.removeEventListener){this.removeEventListener(B,A,false);}else{this.detachEvent("on"+B,A);
+}return this;},retrieve:function(B,A){var D=Element.Storage.get(this.uid);var C=D[B];if($defined(A)&&!$defined(C)){C=D[B]=A;}return $pick(C);},store:function(B,A){var C=Element.Storage.get(this.uid);
+C[B]=A;return this;},eliminate:function(A){var B=Element.Storage.get(this.uid);delete B[A];return this;}});Element.Attributes=new Hash({Props:{html:"innerHTML","class":"className","for":"htmlFor",text:(Browser.Engine.trident)?"innerText":"textContent"},Bools:["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"],Camels:["value","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"]});
+Browser.freeMem=function(A){if(!A){return ;}if(Browser.Engine.trident&&(/object/i).test(A.tagName)){for(var B in A){if(typeof A[B]=="function"){A[B]=$empty;
+}}Element.dispose(A);}if(A.uid&&A.removeEvents){A.removeEvents();}};(function(B){var C=B.Bools,A=B.Camels;B.Bools=C=C.associate(C);Hash.extend(Hash.combine(B.Props,C),A.associate(A.map(function(D){return D.toLowerCase();
+})));B.erase("Camels");})(Element.Attributes);window.addListener("unload",function(){window.removeListener("unload",arguments.callee);document.purge();
+if(Browser.Engine.trident){CollectGarbage();}});Element.Properties.events={set:function(A){this.addEvents(A);}};Native.implement([Element,Window,Document],{addEvent:function(E,G){var H=this.retrieve("events",{});
+H[E]=H[E]||{keys:[],values:[]};if(H[E].keys.contains(G)){return this;}H[E].keys.push(G);var F=E,A=Element.Events.get(E),C=G,I=this;if(A){if(A.onAdd){A.onAdd.call(this,G);
+}if(A.condition){C=function(J){if(A.condition.call(this,J)){return G.call(this,J);}return false;};}F=A.base||F;}var D=function(){return G.call(I);};var B=Element.NativeEvents[F]||0;
+if(B){if(B==2){D=function(J){J=new Event(J,I.getWindow());if(C.call(I,J)===false){J.stop();}};}this.addListener(F,D);}H[E].values.push(D);return this;},removeEvent:function(D,C){var B=this.retrieve("events");
+if(!B||!B[D]){return this;}var G=B[D].keys.indexOf(C);if(G==-1){return this;}var A=B[D].keys.splice(G,1)[0];var F=B[D].values.splice(G,1)[0];var E=Element.Events.get(D);
+if(E){if(E.onRemove){E.onRemove.call(this,C);}D=E.base||D;}return(Element.NativeEvents[D])?this.removeListener(D,F):this;},addEvents:function(A){for(var B in A){this.addEvent(B,A[B]);
+}return this;},removeEvents:function(B){var A=this.retrieve("events");if(!A){return this;}if(!B){for(var C in A){this.removeEvents(C);}A=null;}else{if(A[B]){while(A[B].keys[0]){this.removeEvent(B,A[B].keys[0]);
+}A[B]=null;}}return this;},fireEvent:function(D,B,A){var C=this.retrieve("events");if(!C||!C[D]){return this;}C[D].keys.each(function(E){E.create({bind:this,delay:A,"arguments":B})();
+},this);return this;},cloneEvents:function(D,A){D=$(D);var C=D.retrieve("events");if(!C){return this;}if(!A){for(var B in C){this.cloneEvents(D,B);}}else{if(C[A]){C[A].keys.each(function(E){this.addEvent(A,E);
+},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};
+(function(){var A=function(B){var C=B.relatedTarget;if(C==undefined){return true;}if(C===false){return false;}return($type(this)!="document"&&C!=this&&C.prefix!="xul"&&!this.hasChild(C));
+};Element.Events=new Hash({mouseenter:{base:"mouseover",condition:A},mouseleave:{base:"mouseout",condition:A},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}});
+})();Element.Properties.styles={set:function(A){this.setStyles(A);}};Element.Properties.opacity={set:function(A,B){if(!B){if(A==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden";
+}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(Browser.Engine.trident){this.style.filter=(A==1)?"":"alpha(opacity="+A*100+")";
+}this.style.opacity=A;this.store("opacity",A);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(A){return this.set("opacity",A,true);
+},getOpacity:function(){return this.get("opacity");},setStyle:function(B,A){switch(B){case"opacity":return this.set("opacity",parseFloat(A));case"float":B=(Browser.Engine.trident)?"styleFloat":"cssFloat";
+}B=B.camelCase();if($type(A)!="string"){var C=(Element.Styles.get(B)||"@").split(" ");A=$splat(A).map(function(E,D){if(!C[D]){return"";}return($type(E)=="number")?C[D].replace("@",Math.round(E)):E;
+}).join(" ");}else{if(A==String(Number(A))){A=Math.round(A);}}this.style[B]=A;return this;},getStyle:function(G){switch(G){case"opacity":return this.get("opacity");
+case"float":G=(Browser.Engine.trident)?"styleFloat":"cssFloat";}G=G.camelCase();var A=this.style[G];if(!$chk(A)){A=[];for(var F in Element.ShortStyles){if(G!=F){continue;
+}for(var E in Element.ShortStyles[F]){A.push(this.getStyle(E));}return A.join(" ");}A=this.getComputedStyle(G);}if(A){A=String(A);var C=A.match(/rgba?\([\d\s,]+\)/);
+if(C){A=A.replace(C[0],C[0].rgbToHex());}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(A)))){if(G.test(/^(height|width)$/)){var B=(G=="width")?["left","right"]:["top","bottom"],D=0;
+B.each(function(H){D+=this.getStyle("border-"+H+"-width").toInt()+this.getStyle("padding-"+H).toInt();},this);return this["offset"+G.capitalize()]-D+"px";
+}if(Browser.Engine.presto&&String(A).test("px")){return A;}if(G.test(/(border(.+)Width|margin|padding)/)){return"0px";}}return A;},setStyles:function(B){for(var A in B){this.setStyle(A,B[A]);
+}return this;},getStyles:function(){var A={};Array.each(arguments,function(B){A[B]=this.getStyle(B);},this);return A;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"});
+Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(G){var F=Element.ShortStyles;
+var B=Element.Styles;["margin","padding"].each(function(H){var I=H+G;F[H][I]=B[I]="@px";});var E="border"+G;F.border[E]=B[E]="@px @ rgb(@, @, @)";var D=E+"Width",A=E+"Style",C=E+"Color";
+F[E]={};F.borderWidth[D]=F[E][D]=B[D]="@px";F.borderStyle[A]=F[E][A]=B[A]="@";F.borderColor[C]=F[E][C]=B[C]="rgb(@, @, @)";});(function(){Element.implement({scrollTo:function(H,I){if(B(this)){this.getWindow().scrollTo(H,I);
+}else{this.scrollLeft=H;this.scrollTop=I;}return this;},getSize:function(){if(B(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight};
+},getScrollSize:function(){if(B(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(B(this)){return this.getWindow().getScroll();
+}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var I=this,H={x:0,y:0};while(I&&!B(I)){H.x+=I.scrollLeft;H.y+=I.scrollTop;I=I.parentNode;
+}return H;},getOffsetParent:function(){var H=this;if(B(H)){return null;}if(!Browser.Engine.trident){return H.offsetParent;}while((H=H.parentNode)&&!B(H)){if(D(H,"position")!="static"){return H;
+}}return null;},getOffsets:function(){var I=this,H={x:0,y:0};if(B(this)){return H;}while(I&&!B(I)){H.x+=I.offsetLeft;H.y+=I.offsetTop;if(Browser.Engine.gecko){if(!F(I)){H.x+=C(I);
+H.y+=G(I);}var J=I.parentNode;if(J&&D(J,"overflow")!="visible"){H.x+=C(J);H.y+=G(J);}}else{if(I!=this&&(Browser.Engine.trident||Browser.Engine.webkit)){H.x+=C(I);
+H.y+=G(I);}}I=I.offsetParent;if(Browser.Engine.trident){while(I&&!I.currentStyle.hasLayout){I=I.offsetParent;}}}if(Browser.Engine.gecko&&!F(this)){H.x-=C(this);
+H.y-=G(this);}return H;},getPosition:function(K){if(B(this)){return{x:0,y:0};}var L=this.getOffsets(),I=this.getScrolls();var H={x:L.x-I.x,y:L.y-I.y};var J=(K&&(K=$(K)))?K.getPosition():{x:0,y:0};
+return{x:H.x-J.x,y:H.y-J.y};},getCoordinates:function(J){if(B(this)){return this.getWindow().getCoordinates();}var H=this.getPosition(J),I=this.getSize();
+var K={left:H.x,top:H.y,width:I.x,height:I.y};K.right=K.left+K.width;K.bottom=K.top+K.height;return K;},computePosition:function(H){return{left:H.x-E(this,"margin-left"),top:H.y-E(this,"margin-top")};
+},position:function(H){return this.setStyles(this.computePosition(H));}});Native.implement([Document,Window],{getSize:function(){var I=this.getWindow();
+if(Browser.Engine.presto||Browser.Engine.webkit){return{x:I.innerWidth,y:I.innerHeight};}var H=A(this);return{x:H.clientWidth,y:H.clientHeight};},getScroll:function(){var I=this.getWindow();
+var H=A(this);return{x:I.pageXOffset||H.scrollLeft,y:I.pageYOffset||H.scrollTop};},getScrollSize:function(){var I=A(this);var H=this.getSize();return{x:Math.max(I.scrollWidth,H.x),y:Math.max(I.scrollHeight,H.y)};
+},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var H=this.getSize();return{top:0,left:0,bottom:H.y,right:H.x,height:H.y,width:H.x};
+}});var D=Element.getComputedStyle;function E(H,I){return D(H,I).toInt()||0;}function F(H){return D(H,"-moz-box-sizing")=="border-box";}function G(H){return E(H,"border-top-width");
+}function C(H){return E(H,"border-left-width");}function B(H){return(/^(?:body|html)$/i).test(H.tagName);}function A(H){var I=H.getDocument();return(!I.compatMode||I.compatMode=="CSS1Compat")?I.html:I.body;
+}})();Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;
+},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;
+},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(H,G){H=H.split(",");
+var C,E={};for(var D=0,B=H.length;D<B;D++){var A=H[D],F=Selectors.Utils.search(this,A,E);if(D!=0&&F.item){F=$A(F);}C=(D==0)?F:(C.item)?$A(C).concat(F):C.concat(F);
+}return new Elements(C,{ddup:(H.length>1),cash:!G});}});Element.implement({match:function(B){if(!B){return true;}var D=Selectors.Utils.parseTagAndID(B);
+var A=D[0],E=D[1];if(!Selectors.Filters.byID(this,E)||!Selectors.Filters.byTag(this,A)){return false;}var C=Selectors.Utils.parseSelector(B);return(C)?Selectors.Utils.filter(this,C,{}):true;
+}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};
+Selectors.Utils={chk:function(B,C){if(!C){return true;}var A=$uid(B);if(!C[A]){return C[A]=true;}return false;},parseNthArgument:function(F){if(Selectors.Cache.nth[F]){return Selectors.Cache.nth[F];
+}var C=F.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!C){return false;}var E=parseInt(C[1]);var B=(E||E===0)?E:1;var D=C[2]||false;var A=parseInt(C[3])||0;
+if(B!=0){A--;while(A<1){A+=B;}while(A>=B){A-=B;}}else{B=A;D="index";}switch(D){case"n":C={a:B,b:A,special:"n"};break;case"odd":C={a:2,b:0,special:"n"};
+break;case"even":C={a:2,b:1,special:"n"};break;case"first":C={a:0,special:"index"};break;case"last":C={special:"last-child"};break;case"only":C={special:"only-child"};
+break;default:C={a:(B-1),special:"index"};}return Selectors.Cache.nth[F]=C;},parseSelector:function(E){if(Selectors.Cache.parsed[E]){return Selectors.Cache.parsed[E];
+}var D,H={classes:[],pseudos:[],attributes:[]};while((D=Selectors.RegExps.combined.exec(E))){var I=D[1],G=D[2],F=D[3],B=D[4],C=D[5],J=D[6];if(I){H.classes.push(I);
+}else{if(C){var A=Selectors.Pseudo.get(C);if(A){H.pseudos.push({parser:A,argument:J});}else{H.attributes.push({name:C,operator:"=",value:J});}}else{if(G){H.attributes.push({name:G,operator:F,value:B});
+}}}}if(!H.classes.length){delete H.classes;}if(!H.attributes.length){delete H.attributes;}if(!H.pseudos.length){delete H.pseudos;}if(!H.classes&&!H.attributes&&!H.pseudos){H=null;
+}return Selectors.Cache.parsed[E]=H;},parseTagAndID:function(B){var A=B.match(Selectors.RegExps.tag);var C=B.match(Selectors.RegExps.id);return[(A)?A[1]:"*",(C)?C[1]:false];
+},filter:function(F,C,E){var D;if(C.classes){for(D=C.classes.length;D--;D){var G=C.classes[D];if(!Selectors.Filters.byClass(F,G)){return false;}}}if(C.attributes){for(D=C.attributes.length;
+D--;D){var B=C.attributes[D];if(!Selectors.Filters.byAttribute(F,B.name,B.operator,B.value)){return false;}}}if(C.pseudos){for(D=C.pseudos.length;D--;D){var A=C.pseudos[D];
+if(!Selectors.Filters.byPseudo(F,A.parser,A.argument,E)){return false;}}}return true;},getByTagAndID:function(B,A,D){if(D){var C=(B.getElementById)?B.getElementById(D,true):Element.getElementById(B,D,true);
+return(C&&Selectors.Filters.byTag(C,A))?[C]:[];}else{return B.getElementsByTagName(A);}},search:function(J,I,O){var B=[];var C=I.trim().replace(Selectors.RegExps.splitter,function(Z,Y,X){B.push(Y);
+return":)"+X;}).split(":)");var K,F,E,V;for(var U=0,Q=C.length;U<Q;U++){var T=C[U];if(U==0&&Selectors.RegExps.quick.test(T)){K=J.getElementsByTagName(T);
+continue;}var A=B[U-1];var L=Selectors.Utils.parseTagAndID(T);var W=L[0],M=L[1];if(U==0){K=Selectors.Utils.getByTagAndID(J,W,M);}else{var D={},H=[];for(var S=0,R=K.length;
+S<R;S++){H=Selectors.Getters[A](H,K[S],W,M,D);}K=H;}var G=Selectors.Utils.parseSelector(T);if(G){E=[];for(var P=0,N=K.length;P<N;P++){V=K[P];if(Selectors.Utils.filter(V,G,O)){E.push(V);
+}}K=E;}}return K;}};Selectors.Getters={" ":function(H,G,I,A,E){var D=Selectors.Utils.getByTagAndID(G,I,A);for(var C=0,B=D.length;C<B;C++){var F=D[C];if(Selectors.Utils.chk(F,E)){H.push(F);
+}}return H;},">":function(H,G,I,A,F){var C=Selectors.Utils.getByTagAndID(G,I,A);for(var E=0,D=C.length;E<D;E++){var B=C[E];if(B.parentNode==G&&Selectors.Utils.chk(B,F)){H.push(B);
+}}return H;},"+":function(C,B,A,E,D){while((B=B.nextSibling)){if(B.nodeType==1){if(Selectors.Utils.chk(B,D)&&Selectors.Filters.byTag(B,A)&&Selectors.Filters.byID(B,E)){C.push(B);
+}break;}}return C;},"~":function(C,B,A,E,D){while((B=B.nextSibling)){if(B.nodeType==1){if(!Selectors.Utils.chk(B,D)){break;}if(Selectors.Filters.byTag(B,A)&&Selectors.Filters.byID(B,E)){C.push(B);
+}}}return C;}};Selectors.Filters={byTag:function(B,A){return(A=="*"||(B.tagName&&B.tagName.toLowerCase()==A));},byID:function(A,B){return(!B||(A.id&&A.id==B));
+},byClass:function(B,A){return(B.className&&B.className.contains(A," "));},byPseudo:function(A,D,C,B){return D.call(A,C,B);},byAttribute:function(C,D,B,E){var A=Element.prototype.getProperty.call(C,D);
+if(!A){return false;}if(!B||E==undefined){return true;}switch(B){case"=":return(A==E);case"*=":return(A.contains(E));case"^=":return(A.substr(0,E.length)==E);
+case"$=":return(A.substr(A.length-E.length)==E);case"!=":return(A!=E);case"~=":return A.contains(E," ");case"|=":return A.contains(E,"-");}return false;
+}};Selectors.Pseudo=new Hash({empty:function(){return !(this.innerText||this.textContent||"").length;},not:function(A){return !Element.match(this,A);},contains:function(A){return(this.innerText||this.textContent||"").contains(A);
+},"first-child":function(){return Selectors.Pseudo.index.call(this,0);},"last-child":function(){var A=this;while((A=A.nextSibling)){if(A.nodeType==1){return false;
+}}return true;},"only-child":function(){var B=this;while((B=B.previousSibling)){if(B.nodeType==1){return false;}}var A=this;while((A=A.nextSibling)){if(A.nodeType==1){return false;
+}}return true;},"nth-child":function(G,E){G=(G==undefined)?"n":G;var C=Selectors.Utils.parseNthArgument(G);if(C.special!="n"){return Selectors.Pseudo[C.special].call(this,C.a,E);
+}var F=0;E.positions=E.positions||{};var D=$uid(this);if(!E.positions[D]){var B=this;while((B=B.previousSibling)){if(B.nodeType!=1){continue;}F++;var A=E.positions[$uid(B)];
+if(A!=undefined){F=A+F;break;}}E.positions[D]=F;}return(E.positions[D]%C.a==C.b);},index:function(A){var B=this,C=0;while((B=B.previousSibling)){if(B.nodeType==1&&++C>A){return false;
+}}return(C==A);},even:function(B,A){return Selectors.Pseudo["nth-child"].call(this,"2n+1",A);},odd:function(B,A){return Selectors.Pseudo["nth-child"].call(this,"2n",A);
+}});Element.Events.domready={onAdd:function(A){if(Browser.loaded){A.call(this);}}};(function(){var B=function(){if(Browser.loaded){return ;}Browser.loaded=true;
+window.fireEvent("domready");document.fireEvent("domready");};switch(Browser.Engine.name){case"webkit":(function(){(["loaded","complete"].contains(document.readyState))?B():arguments.callee.delay(50);
+})();break;case"trident":var A=document.createElement("div");(function(){($try(function(){A.doScroll("left");return $(A).inject(document.body).set("html","temp").dispose();
+}))?B():arguments.callee.delay(50);})();break;default:window.addEvent("load",B);document.addEvent("DOMContentLoaded",B);}})();var JSON=new Hash({encode:function(B){switch($type(B)){case"string":return'"'+B.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';
+case"array":return"["+String(B.map(JSON.encode).filter($defined))+"]";case"object":case"hash":var A=[];Hash.each(B,function(E,D){var C=JSON.encode(E);if(C){A.push(JSON.encode(D)+":"+C);
+}});return"{"+A+"}";case"number":case"boolean":return String(B);case false:return"null";}return null;},$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(A){return JSON.$specialChars[A]||"\\u00"+Math.floor(A.charCodeAt()/16).toString(16)+(A.charCodeAt()%16).toString(16);
+},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null;
+}return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(B,A){this.key=B;
+this.setOptions(A);},write:function(B){B=encodeURIComponent(B);if(this.options.domain){B+="; domain="+this.options.domain;}if(this.options.path){B+="; path="+this.options.path;
+}if(this.options.duration){var A=new Date();A.setTime(A.getTime()+this.options.duration*24*60*60*1000);B+="; expires="+A.toGMTString();}if(this.options.secure){B+="; secure";
+}this.options.document.cookie=this.key+"="+B;return this;},read:function(){var A=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)");
+return(A)?decodeURIComponent(A[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");return this;}});Cookie.write=function(B,C,A){return new Cookie(B,A).write(C);
+};Cookie.read=function(A){return new Cookie(A).read();};Cookie.dispose=function(B,A){return new Cookie(B,A).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:"high",allowScriptAccess:"always",wMode:"transparent",swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;
+},initialize:function(L,M){this.instance="Swiff_"+$time();this.setOptions(M);M=this.options;var B=this.id=M.id||this.instance;var A=$(M.container);Swiff.CallBacks[this.instance]={};
+var E=M.params,G=M.vars,F=M.callBacks;var H=$extend({height:M.height,width:M.width},M.properties);var K=this;for(var D in F){Swiff.CallBacks[this.instance][D]=(function(N){return function(){return N.apply(K.object,arguments);
+};})(F[D]);G[D]="Swiff.CallBacks."+this.instance+"."+D;}E.flashVars=Hash.toQueryString(G);if(Browser.Engine.trident){H.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
+E.movie=L;}else{H.type="application/x-shockwave-flash";H.data=L;}var J='<object id="'+B+'"';for(var I in H){J+=" "+I+'="'+H[I]+'"';}J+=">";for(var C in E){if(E[C]){J+='<param name="'+C+'" value="'+E[C]+'" />';
+}}J+="</object>";this.object=((A)?A.empty():new Element("div")).set("html",J).firstChild;},replaces:function(A){A=$(A,true);A.parentNode.replaceChild(this.toElement(),A);
+return this;},inject:function(A){$(A,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));
+}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");
+return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore",transition:function(A){return -(Math.cos(Math.PI*A)-1)/2;
+}},initialize:function(A){this.subject=this.subject||this;this.setOptions(A);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();
+var B=this.options.wait;if(B===false){this.options.link="cancel";}},step:function(){var A=$time();if(A<this.time+this.options.duration){var B=this.options.transition((A-this.time)/this.options.duration);
+this.set(this.compute(this.from,this.to,B));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(A){return A;},compute:function(C,B,A){return Fx.compute(C,B,A);
+},check:function(A){if(!this.timer){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(A.bind(this,Array.slice(arguments,1)));
+return false;}return false;},start:function(B,A){if(!this.check(arguments.callee,B,A)){return this;}this.from=B;this.to=A;this.time=0;this.startTimer();
+this.onStart();return this;},complete:function(){if(this.stopTimer()){this.onComplete();}return this;},cancel:function(){if(this.stopTimer()){this.onCancel();
+}return this;},onStart:function(){this.fireEvent("start",this.subject);},onComplete:function(){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject);
+}},onCancel:function(){this.fireEvent("cancel",this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();
+return this;},stopTimer:function(){if(!this.timer){return false;}this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer){return false;
+}this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(C,B,A){return(B-C)*A+C;
+};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(D,E,B){B=$splat(B);var C=B[1];if(!$chk(C)){B[1]=B[0];
+B[0]=D.getStyle(E);}var A=B.map(this.parse);return{from:A[0],to:A[1]};},parse:function(A){A=$lambda(A)();A=(typeof A=="string")?A.split(" "):$splat(A);
+return A.map(function(C){C=String(C);var B=false;Fx.CSS.Parsers.each(function(F,E){if(B){return ;}var D=F.parse(C);if($chk(D)){B={value:D,parser:F};}});
+B=B||{value:C,parser:Fx.CSS.Parsers.String};return B;});},compute:function(D,C,B){var A=[];(Math.min(D.length,C.length)).times(function(E){A.push({value:D[E].parser.compute(D[E].value,C[E].value,B),parser:D[E].parser});
+});A.$family={name:"fx:css:value"};return A;},serve:function(C,B){if($type(C)!="fx:css:value"){C=this.parse(C);}var A=[];C.each(function(D){A=A.concat(D.parser.serve(D.value,B));
+});return A;},render:function(A,D,C,B){A.setStyle(D,this.serve(C,B));},search:function(A){if(Fx.CSS.Cache[A]){return Fx.CSS.Cache[A];}var B={};Array.each(document.styleSheets,function(E,D){var C=E.href;
+if(C&&C.contains("://")&&!C.contains(document.domain)){return ;}var F=E.rules||E.cssRules;Array.each(F,function(I,G){if(!I.style){return ;}var H=(I.selectorText)?I.selectorText.replace(/^\w+/,function(J){return J.toLowerCase();
+}):null;if(!H||!H.test("^"+A+"$")){return ;}Element.Styles.each(function(K,J){if(!I.style[J]||Element.ShortStyles[J]){return ;}K=String(I.style[J]);B[J]=(K.test(/^rgb/))?K.rgbToHex():K;
+});});});return Fx.CSS.Cache[A]=B;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(A){if(A.match(/^#[0-9a-f]{3,6}$/i)){return A.hexToRgb(true);
+}return((A=A.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[A[1],A[2],A[3]]:false;},compute:function(C,B,A){return C.map(function(E,D){return Math.round(Fx.compute(C[D],B[D],A));
+});},serve:function(A){return A.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(B,A){return(A)?B+A:B;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});
+Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(B,A){this.element=this.subject=$(B);this.parent(A);},set:function(B,A){if(arguments.length==1){A=B;
+B=this.property||this.options.property;}this.render(this.element,B,A,this.options.unit);return this;},start:function(C,E,D){if(!this.check(arguments.callee,C,E,D)){return this;
+}var B=Array.flatten(arguments);this.property=this.options.property||B.shift();var A=this.prepare(this.element,this.property,B);return this.parent(A.from,A.to);
+}});Element.Properties.tween={set:function(A){var B=this.retrieve("tween");if(B){B.cancel();}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},A));
+},get:function(A){if(A||!this.retrieve("tween")){if(A||!this.retrieve("tween:options")){this.set("tween",A);}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options")));
+}return this.retrieve("tween");}};Element.implement({tween:function(A,C,B){this.get("tween").start(arguments);return this;},fade:function(C){var E=this.get("tween"),D="opacity",A;
+C=$pick(C,"toggle");switch(C){case"in":E.start(D,1);break;case"out":E.start(D,0);break;case"show":E.set(D,1);break;case"hide":E.set(D,0);break;case"toggle":var B=this.retrieve("fade:flag",this.get("opacity")==1);
+E.start(D,(B)?0:1);this.store("fade:flag",!B);A=true;break;default:E.start(D,arguments);}if(!A){this.eliminate("fade:flag");}return this;},highlight:function(C,A){if(!A){A=this.retrieve("highlight:original",this.getStyle("background-color"));
+A=(A=="transparent")?"#fff":A;}var B=this.get("tween");B.start("background-color",C||"#ffff88",A).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original"));
+B.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(B,A){this.element=this.subject=$(B);this.parent(A);},set:function(A){if(typeof A=="string"){A=this.search(A);
+}for(var B in A){this.render(this.element,B,A[B],this.options.unit);}return this;},compute:function(E,D,C){var A={};for(var B in E){A[B]=this.parent(E[B],D[B],C);
+}return A;},start:function(B){if(!this.check(arguments.callee,B)){return this;}if(typeof B=="string"){B=this.search(B);}var E={},D={};for(var C in B){var A=this.prepare(this.element,C,B[C]);
+E[C]=A.from;D[C]=A.to;}return this.parent(E,D);}});Element.Properties.morph={set:function(A){var B=this.retrieve("morph");if(B){B.cancel();}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},A));
+},get:function(A){if(A||!this.retrieve("morph")){if(A||!this.retrieve("morph:options")){this.set("morph",A);}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")));
+}return this.retrieve("morph");}};Element.implement({morph:function(A){this.get("morph").start(A);return this;}});(function(){var A=Fx.prototype.initialize;
+Fx.prototype.initialize=function(B){A.call(this,B);var C=this.options.transition;if(typeof C=="string"&&(C=C.split(":"))){var D=Fx.Transitions;D=D[C[0]]||D[C[0].capitalize()];
+if(C[1]){D=D["ease"+C[1].capitalize()+(C[2]?C[2].capitalize():"")];}this.options.transition=D;}};})();Fx.Transition=function(B,A){A=$splat(A);return $extend(B,{easeIn:function(C){return B(C,A);
+},easeOut:function(C){return 1-B(1-C,A);},easeInOut:function(C){return(C<=0.5)?B(2*C,A)/2:(2-B(2*(1-C),A))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});
+Fx.Transitions.extend=function(A){for(var B in A){Fx.Transitions[B]=new Fx.Transition(A[B]);}};Fx.Transitions.extend({Pow:function(B,A){return Math.pow(B,A[0]||6);
+},Expo:function(A){return Math.pow(2,8*(A-1));},Circ:function(A){return 1-Math.sin(Math.acos(A));},Sine:function(A){return 1-Math.sin((1-A)*Math.PI/2);
+},Back:function(B,A){A=A[0]||1.618;return Math.pow(B,2)*((A+1)*B-A);},Bounce:function(D){var C;for(var B=0,A=1;1;B+=A,A/=2){if(D>=(7-4*B)/11){C=-Math.pow((11-6*B-11*D)/4,2)+A*A;
+break;}}return C;},Elastic:function(B,A){return Math.pow(2,10*--B)*Math.cos(20*B*Math.PI*(A[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(B,A){Fx.Transitions[B]=new Fx.Transition(function(C){return Math.pow(C,[A+2]);
+});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false},initialize:function(A){this.xhr=new Browser.Request();
+this.setOptions(A);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return ;
+}this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};
+this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));
+},processScripts:function(A){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(A);}return A.stripScripts(this.options.evalScripts);
+},success:function(B,A){this.onSuccess(this.processScripts(B),A);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain();
+},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},setHeader:function(A,B){this.headers.set(A,B);
+return this;},getHeader:function(A){return $try(function(){return this.xhr.getResponseHeader(A);}.bind(this));},check:function(A){if(!this.running){return true;
+}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(A.bind(this,Array.slice(arguments,1)));return false;}return false;
+},send:function(I){if(!this.check(arguments.callee,I)){return this;}this.running=true;var G=$type(I);if(G=="string"||G=="element"){I={data:I};}var D=this.options;
+I=$extend({data:D.data,url:D.url,method:D.method},I);var E=I.data,B=I.url,A=I.method;switch($type(E)){case"element":E=$(E).toQueryString();break;case"object":case"hash":E=Hash.toQueryString(E);
+}if(this.options.format){var H="format="+this.options.format;E=(E)?H+"&"+E:H;}if(this.options.emulation&&["put","delete"].contains(A)){var F="_method="+A;
+E=(E)?F+"&"+E:F;A="post";}if(this.options.urlEncoded&&A=="post"){var C=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers.set("Content-type","application/x-www-form-urlencoded"+C);
+}if(E&&A=="get"){B=B+(B.contains("?")?"&":"?")+E;E=null;}this.xhr.open(A.toUpperCase(),B,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);
+this.headers.each(function(K,J){if(!$try(function(){this.xhr.setRequestHeader(J,K);return true;}.bind(this))){this.fireEvent("exception",[J,K]);}},this);
+this.fireEvent("request");this.xhr.send(E);if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this;
+}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});(function(){var A={};
+["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(B){A[B]=function(){var C=Array.link(arguments,{url:String.type,data:$defined});
+return this.send($extend(C,{method:B.toLowerCase()}));};});Request.implement(A);})();Element.Properties.send={set:function(A){var B=this.retrieve("send");
+if(B){B.cancel();}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},A));
+},get:function(A){if(A||!this.retrieve("send")){if(A||!this.retrieve("send:options")){this.set("send",A);}this.store("send",new Request(this.retrieve("send:options")));
+}return this.retrieve("send");}};Element.implement({send:function(A){var B=this.get("send");B.send({data:this,url:A||B.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,evalScripts:true,filter:false},processHTML:function(C){var B=C.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
+C=(B)?B[1]:C;var A=new Element("div");return $try(function(){var D="<root>"+C+"</root>",G;if(Browser.Engine.trident){G=new ActiveXObject("Microsoft.XMLDOM");
+G.async=false;G.loadXML(D);}else{G=new DOMParser().parseFromString(D,"text/xml");}D=G.getElementsByTagName("root")[0];for(var F=0,E=D.childNodes.length;
+F<E;F++){var H=Element.clone(D.childNodes[F],true,true);if(H){A.grab(H);}}return A;})||A.set("html",C);},success:function(D){var C=this.options,B=this.response;
+B.html=D.stripScripts(function(E){B.javascript=E;});var A=this.processHTML(B.html);B.tree=A.childNodes;B.elements=A.getElements("*");if(C.filter){B.tree=B.elements.filter(C.filter);
+}if(C.update){$(C.update).empty().adopt(B.tree);}if(C.evalScripts){$exec(B.javascript);}this.onSuccess(B.tree,B.elements,B.html,B.javascript);}});Element.Properties.load={set:function(A){var B=this.retrieve("load");
+if(B){send.cancel();}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},A));},get:function(A){if(A||!this.retrieve("load")){if(A||!this.retrieve("load:options")){this.set("load",A);
+}this.store("load",new Request.HTML(this.retrieve("load:options")));}return this.retrieve("load");}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Object.type,url:String.type}));
+return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(A){this.parent(A);this.headers.extend({Accept:"application/json","X-Request":"JSON"});
+},success:function(A){this.response.json=JSON.decode(A,this.options.secure);this.onSuccess(this.response.json,A);}});

Added: trunk/extensions/uniwiki/uniwiki.png
===================================================================
(Binary files differ)


Property changes on: trunk/extensions/uniwiki/uniwiki.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream



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