r98699 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98698‎ | r98699 | r98700 >
Date:18:27, 2 October 2011
Author:ashley
Status:deferred (Comments)
Tags:
Comment:
add CreateAPage to SVN. Mostly compatible with 1.16, except that the upload form has *not* been rewritten to be comptible with 1.16's new upload system.
Modified paths:
  • /trunk/extensions/CreateAPage (added) (history)
  • /trunk/extensions/CreateAPage/CAP_TagCloud.php (added) (history)
  • /trunk/extensions/CreateAPage/CreateAPage.i18n.php (added) (history)
  • /trunk/extensions/CreateAPage/CreateMultiPage.php (added) (history)
  • /trunk/extensions/CreateAPage/CreatePage.css (added) (history)
  • /trunk/extensions/CreateAPage/CreatePage.php (added) (history)
  • /trunk/extensions/CreateAPage/CreatePageCreateplateForm.php (added) (history)
  • /trunk/extensions/CreateAPage/CreatePageEditor.php (added) (history)
  • /trunk/extensions/CreateAPage/CreatePageImageUploadForm.php (added) (history)
  • /trunk/extensions/CreateAPage/EasyTemplate.php (added) (history)
  • /trunk/extensions/CreateAPage/SpecialCreatePage.body.php (added) (history)
  • /trunk/extensions/CreateAPage/SpecialCreatePage_ajax.php (added) (history)
  • /trunk/extensions/CreateAPage/images (added) (history)
  • /trunk/extensions/CreateAPage/images/down.png (added) (history)
  • /trunk/extensions/CreateAPage/images/progress_bar.gif (added) (history)
  • /trunk/extensions/CreateAPage/images/up.png (added) (history)
  • /trunk/extensions/CreateAPage/templates (added) (history)
  • /trunk/extensions/CreateAPage/templates/bigarea.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/categorypage.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/editimage-section.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/editimage.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/editpage.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/infobox.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/templates-list.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/title-check.tmpl.php (added) (history)
  • /trunk/extensions/CreateAPage/templates/toggles.tmpl.php (added) (history)

Diff [purge]

Index: trunk/extensions/CreateAPage/CreateMultiPage.php
@@ -0,0 +1,589 @@
 2+<?php
 3+if( !defined( 'MEDIAWIKI' ) ) {
 4+ die( '...' );
 5+}
 6+/**
 7+ * @file
 8+ * @ingroup Extensions
 9+ * @version 1.0
 10+ * @author Piotr Molski <moli@wikia-inc.com>
 11+ * @author Bartek Łapiński <bartek@wikia-inc.com>
 12+ * @copyright Copyright © 2007 Piotr Molski, Wikia Inc.
 13+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 14+ */
 15+
 16+$wgAutoloadClasses['CAP_TagCloud'] = dirname( __FILE__ ) . '/CAP_TagCloud.php';
 17+
 18+define( 'SECTION_PARSE', '/\n==[^=]/s' );
 19+define( 'SPECIAL_TAG_FORMAT', '<!---%s--->' );
 20+define( 'ADDITIONAL_TAG_PARSE', '/\<!---(.*?)\s*=\s*(&quot;|\'|")*(.*?)(&quot;|\'|")*---\>/is' );
 21+define( 'SIMPLE_TAG_PARSE', '/\<!---(.*?)---\>/is' );
 22+define( 'CATEGORY_TAG_PARSE', '/\[\[Category:(.*?)\]\]/' );
 23+define( 'CATEGORY_TAG_SPECIFIC', '/\<!---categories---\>/is' );
 24+define( 'IMAGEUPLOAD_TAG_SPECIFIC', '/\<!---imageupload---\>/is' );
 25+define( 'INFOBOX_SEPARATOR', '/\<!---separator---\>/is' );
 26+define( 'ISBLANK_TAG_SPECIFIC', '<!---blanktemplate--->' );
 27+//define( 'TEMPLATE_INFOBOX_FORMAT', '/\{\{[^\{\}]*Infobox.*\}\}/is' ); // replaced by [[MediaWiki:Createpage-template-infobox-format]]
 28+define( 'TEMPLATE_OPENING', '/\{\{[^\{\}]*Infobox[^\|]*/i' );
 29+define( 'TEMPLATE_CLOSING', '/\}\}/' );
 30+
 31+global $wgMultiEditPageTags, $wgMultiEditPageSimpleTags;
 32+$wgMultiEditPageTags = array( 'title', 'descr', 'category' );
 33+$wgMultiEditPageSimpleTags = array( 'lbl', 'categories', 'pagetitle', 'imageupload', 'optional' );
 34+
 35+class CreateMultiPage {
 36+ function __construct() {
 37+ }
 38+
 39+ public static function unescapeBlankMarker( $text ) {
 40+ $text = str_replace( "\n<!---blanktemplate--->\n", '', $text );
 41+ $text = str_replace( '<!---imageupload--->', '', $text );
 42+ return $text;
 43+ }
 44+
 45+ public static function getToolArray() {
 46+ global $wgContLang;
 47+ $toolarray = array(
 48+ array(
 49+ 'image' => 'button_bold.png',
 50+ 'id' => 'mw-editbutton-bold',
 51+ 'open' => '\\\'\\\'\\\'',
 52+ 'close' => '\\\'\\\'\\\'',
 53+ 'sample'=> wfMsg( 'bold_sample' ),
 54+ 'tip' => wfMsg( 'bold_tip' ),
 55+ 'key' => 'B'
 56+ ),
 57+ array(
 58+ 'image' => 'button_italic.png',
 59+ 'id' => 'mw-editbutton-italic',
 60+ 'open' => '\\\'\\\'',
 61+ 'close' => '\\\'\\\'',
 62+ 'sample'=> wfMsg( 'italic_sample' ),
 63+ 'tip' => wfMsg( 'italic_tip' ),
 64+ 'key' => 'I'
 65+ ),
 66+ array(
 67+ 'image' => 'button_link.png',
 68+ 'id' => 'mw-editbutton-link',
 69+ 'open' => '[[',
 70+ 'close' => ']]',
 71+ 'sample'=> wfMsg( 'link_sample' ),
 72+ 'tip' => wfMsg( 'link_tip' ),
 73+ 'key' => 'L'
 74+ ),
 75+ array(
 76+ 'image' => 'button_extlink.png',
 77+ 'id' => 'mw-editbutton-extlink',
 78+ 'open' => '[',
 79+ 'close' => ']',
 80+ 'sample'=> wfMsg( 'extlink_sample' ),
 81+ 'tip' => wfMsg( 'extlink_tip' ),
 82+ 'key' => 'X'
 83+ ),
 84+ array(
 85+ 'image' => 'button_headline.png',
 86+ 'id' => 'mw-editbutton-headline',
 87+ 'open' => "\\n=== ",
 88+ 'close' => " ===\\n",
 89+ 'sample'=> wfMsg( 'headline_sample' ),
 90+ 'tip' => wfMsg( 'headline_tip_3' ),
 91+ 'key' => 'H'
 92+ ),
 93+ array(
 94+ 'image' => 'button_image.png',
 95+ 'id' => 'mw-editbutton-image',
 96+ 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
 97+ 'close' => ']]',
 98+ 'sample'=> wfMsg( 'image_sample' ),
 99+ 'tip' => wfMsg( 'image_tip' ),
 100+ 'key' => 'D'
 101+ ),
 102+ array(
 103+ 'image' => 'button_media.png',
 104+ 'id' => 'mw-editbutton-media',
 105+ 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
 106+ 'close' => ']]',
 107+ 'sample'=> wfMsg( 'media_sample' ),
 108+ 'tip' => wfMsg( 'media_tip' ),
 109+ 'key' => 'M'
 110+ ),
 111+ array(
 112+ 'image' => 'button_math.png',
 113+ 'id' => 'mw-editbutton-math',
 114+ 'open' => "<math>",
 115+ 'close' => "<\\/math>",
 116+ 'sample'=> wfMsg( 'math_sample' ),
 117+ 'tip' => wfMsg( 'math_tip' ),
 118+ 'key' => 'C'
 119+ ),
 120+ array(
 121+ 'image' => 'button_nowiki.png',
 122+ 'id' => 'mw-editbutton-nowiki',
 123+ 'open' => "<nowiki>",
 124+ 'close' => "<\\/nowiki>",
 125+ 'sample'=> wfMsg( 'nowiki_sample' ),
 126+ 'tip' => wfMsg( 'nowiki_tip' ),
 127+ 'key' => 'N'
 128+ ),
 129+ array(
 130+ 'image' => 'button_sig.png',
 131+ 'id' => 'mw-editbutton-signature',
 132+ 'open' => '--~~~~',
 133+ 'close' => '',
 134+ 'sample'=> '',
 135+ 'tip' => wfMsg( 'sig_tip' ),
 136+ 'key' => 'Y'
 137+ ),
 138+ array(
 139+ 'image' => 'button_hr.png',
 140+ 'id' => 'mw-editbutton-hr',
 141+ 'open' => "\\n----\\n",
 142+ 'close' => '',
 143+ 'sample'=> '',
 144+ 'tip' => wfMsg( 'hr_tip' ),
 145+ 'key' => 'R'
 146+ )
 147+ );
 148+
 149+ wfRunHooks( 'ToolbarGenerate', array( &$toolarray ) );
 150+ return $toolarray;
 151+ }
 152+
 153+ // modified a bit standard editToolbar function from EditPage class
 154+ public static function getMultiEditToolbar( $toolbar_id ) {
 155+ global $wgContLang, $wgJsMimeType;
 156+
 157+ $toolarray = CreateMultiPage::getToolArray();
 158+ // multiple toolbars...
 159+ $toolbar = "<div id='toolbar" . $toolbar_id . "' style='display: none'>\n";
 160+ $toolbar .= "<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";
 161+ $toolbar .= "YAHOO.Createpage.multiEditTextboxes[YAHOO.Createpage.multiEditTextboxes.length] = $toolbar_id;\n";
 162+ $toolbar .= "YAHOO.Createpage.multiEditButtons[$toolbar_id] = [];\n";
 163+ $toolbar .= "YAHOO.Createpage.multiEditCustomButtons[$toolbar_id] = [];\n";
 164+ $toolbar .= "YAHOO.util.Event.addListener('wpTextboxes' + $toolbar_id, 'focus', YAHOO.Createpage.showThisBox, {'toolbarId' : $toolbar_id }); \n";
 165+ $toolbar .= "/*]]>*/\n</script>";
 166+
 167+ $toolbar .= "\n</div>";
 168+ return $toolbar;
 169+ }
 170+
 171+ public static function multiEditParse( $rows, $cols, $ew, $sourceText, $optional_sections = null ) {
 172+ global $wgTitle, $wgScriptPath, $wgContLang;
 173+ global $wgMultiEditTag;
 174+ global $wgMultiEditPageSimpleTags, $wgMultiEditPageTags;
 175+
 176+ $me_content = '';
 177+ $found_categories = array();
 178+
 179+ $is_used_metag = false;
 180+ $is_used_category_cloud = false;
 181+ $wgMultiEditTag = ( empty( $wgMultiEditTag ) ) ? 'useMultiEdit' : $wgMultiEditTag;
 182+ $multiedit_tag = '<!---' . $wgMultiEditTag . '--->';
 183+
 184+ # is tag set?
 185+ if ( empty( $wgMultiEditTag ) || ( strpos( $sourceText, $multiedit_tag ) === false ) ) {
 186+ if ( strpos( $sourceText, ISBLANK_TAG_SPECIFIC ) !== true ) {
 187+ $sourceText = str_replace( ISBLANK_TAG_SPECIFIC . "\n", '', $sourceText );
 188+ $sourceText = str_replace( ISBLANK_TAG_SPECIFIC, '', $sourceText );
 189+
 190+ // fire off a special one textarea template
 191+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 192+ $toolbar_text = CreateMultiPage::getMultiEditToolbar( 0 );
 193+ $tmpl->set_vars(array(
 194+ 'box' => $sourceText,
 195+ 'toolbar' => $toolbar_text,
 196+ ));
 197+ $me_content .= $tmpl->render( 'bigarea' );
 198+
 199+ $cloud = new CAP_TagCloud();
 200+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 201+ $tmpl->set_vars(array(
 202+ 'num' => 0,
 203+ 'cloud' => $cloud,
 204+ 'cols' => $cols,
 205+ 'ew' => $ew,
 206+ 'text_category' => '' ,
 207+ 'array_category' => array()
 208+ ));
 209+ $me_content .= $tmpl->render( 'categorypage' );
 210+ return $me_content;
 211+ } else {
 212+ return false;
 213+ }
 214+ } else {
 215+ $sourceText = str_replace( $multiedit_tag, '', $sourceText );
 216+ $is_used_metag = true;
 217+ }
 218+
 219+ $category_tags = null;
 220+ preg_match_all( CATEGORY_TAG_SPECIFIC, $sourceText, $category_tags );
 221+ if ( is_array( $category_tags ) ) {
 222+ $is_used_category_cloud = true;
 223+ $sourceText = preg_replace( CATEGORY_TAG_SPECIFIC, '', $sourceText );
 224+ }
 225+
 226+ // get infoboxes out...
 227+ preg_match_all(
 228+ wfMsgForContent( 'createpage-template-infobox-format' ),
 229+ $sourceText, $infoboxes, PREG_OFFSET_CAPTURE
 230+ );
 231+
 232+ // new functions to exclude any additional '}}'s from match
 233+ if ( is_array( $infoboxes ) && is_array( $infoboxes[0] ) && !empty( $infoboxes[0][0] ) ) {
 234+ $to_parametrize = $infoboxes[0][0];
 235+ $infobox_start = $to_parametrize[1];
 236+ // take first "}}" here - this should be infoboxes' end
 237+ $infobox_end = strpos( $sourceText, '}}' );
 238+ $to_parametrize = substr( $sourceText, $infobox_start, $infobox_end - $infobox_start + 2 );
 239+ $sourceText = str_replace( $to_parametrize, '', $sourceText );
 240+
 241+ $to_parametrize = preg_replace( TEMPLATE_CLOSING, '', $to_parametrize );
 242+
 243+ // fix issues with |'s given inside the infobox parameters...
 244+ $pre_inf_pars = preg_split( "/\|/", $to_parametrize, -1 );
 245+
 246+ $fixed_par_array = array();
 247+ $fix_corrector = 0;
 248+
 249+ for ( $i = 0; $i < count( $pre_inf_pars ); $i++ ) {
 250+ // this was cut out from user supplying '|' inside the parameter...
 251+ if( ( strpos( $pre_inf_pars[$i], '=' ) === false ) && ( 0 != $i ) ) {
 252+ $fixed_par_array[$i - ( 1 + $fix_corrector )] .= '|' . $pre_inf_pars[$i];
 253+ $fix_corrector++;
 254+ } else {
 255+ $fixed_par_array[] = $pre_inf_pars[$i];
 256+ }
 257+ }
 258+
 259+ array_shift( $fixed_par_array );
 260+ array_walk( $fixed_par_array, 'wfCreatePageUnescapeKnownMarkupTags' );
 261+
 262+ $num = 0;
 263+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 264+ $tmpl->set_vars(array(
 265+ 'num' => $num,
 266+ 'infoboxes' => $to_parametrize,
 267+ 'inf_pars' => $fixed_par_array,
 268+ ));
 269+
 270+ $me_content .= $tmpl->render( 'infobox' );
 271+ }
 272+
 273+ # check sections exist
 274+ $sections = preg_split( SECTION_PARSE, $sourceText, -1, PREG_SPLIT_OFFSET_CAPTURE );
 275+ $is_section = ( count( $sections ) > 1 ? true : false );
 276+
 277+ $boxes = array();
 278+ $num = 0;
 279+ $loop = 0;
 280+ $optionals = array();
 281+
 282+ if ( $is_used_metag ) {
 283+ $boxes[] = array(
 284+ 'type' => 'text',
 285+ 'value' => addslashes( $multiedit_tag ),
 286+ 'display' => 0
 287+ );
 288+ $num = 1;
 289+ $loop++;
 290+ }
 291+
 292+ $all_image_num = 0;
 293+
 294+ /**
 295+ * Parse sections
 296+ */
 297+ foreach ( $sections as $section ) {
 298+ # empty section
 299+ $add = '';
 300+ if ( ( $section[1] == 0 ) && ( empty( $section[0] ) ) ) {
 301+ continue;
 302+ } elseif ( intval( $section[1] ) > 0 ) { // add last character truncated by preg_split()
 303+ $add = substr( $sourceText, $section[1] - 1, 1 );
 304+ }
 305+
 306+ # get section text
 307+ $text = ( ( $num && ( !empty( $add ) ) ) ? '==' : '' ) . $add . $section[0];
 308+
 309+ preg_match( '!==(.*?)==!s', $text, $name );
 310+ $section_name = $section_wout_tags = '';
 311+ # section name
 312+ if ( !empty( $name ) ) {
 313+ $section_name = $name[0];
 314+ $section_wout_tags = trim( $name[1] );
 315+ }
 316+ if ( !empty( $section_name ) ) {
 317+ $boxes[] = array(
 318+ 'type' => 'section_display',
 319+ 'value' => '<b>' . $section_wout_tags . '</b>',
 320+ 'display' => 1
 321+ );
 322+ $boxes[] = array(
 323+ 'type' => 'text',
 324+ 'value' => addslashes( $section_name ),
 325+ 'display' => 0
 326+ );
 327+ } else {
 328+ $boxes[] = array(
 329+ 'type' => 'section_display',
 330+ 'value' => '<b>' . wfMsg( 'createpage-top-of-page' ) . '</b>',
 331+ 'display' => 1
 332+ );
 333+ }
 334+
 335+ # text without section name
 336+ if ( strlen( $section_name ) > 0 ) {
 337+ $text = substr( $text, strlen( $section_name ) + 1 ); // strip section name
 338+ }
 339+ $text = trim( $text ); // strip unneeded newlines
 340+
 341+ /**
 342+ * <(descr|title|pagetitle)="..."> tag support
 343+ */
 344+ $main_tags = '';
 345+ $special_tags = array();
 346+ preg_match_all( ADDITIONAL_TAG_PARSE, $text, $me_tags );
 347+
 348+ if ( isset( $me_tags ) && ( !empty( $me_tags[1] ) ) ) {
 349+ foreach( $me_tags[1] as $id => $_tag ) {
 350+ $brt = $me_tags[2][$id];
 351+ $correct_brt = ( $brt == '&quot;' ) ? "\"" : $brt;
 352+ if ( in_array( $_tag, $wgMultiEditPageTags ) ) {
 353+ switch( $_tag ) {
 354+ case 'title':
 355+ case 'descr':
 356+ case 'category': {
 357+ if ( empty( $special_tags[$_tag] ) || ( $_tag == 'category' ) ) {
 358+ $special_tags[$_tag] = $me_tags[3][$id];
 359+ if ( $_tag != 'category' ) {
 360+ $format_tag_text = ( $_tag == 'title' ) ? '<b>%s</b>' : '<small>%s</small>';
 361+ } else {
 362+ $format_tag_text = '%s';
 363+ }
 364+ if ( $_tag != 'category' ) {
 365+ $type = '';
 366+ if ( $_tag == 'title' ) {
 367+ $type = 'title';
 368+ }
 369+ # remove special tags
 370+ $text = str_replace( "<!---{$_tag}={$brt}" . $special_tags[$_tag] . "{$brt}--->", '', $text );
 371+ $text = trim( $text ); // strip unneeded newlines
 372+ # add to display
 373+ $boxes[] = array(
 374+ 'type' => $type,
 375+ 'value' => sprintf( $format_tag_text, $special_tags[$_tag] ),
 376+ 'display' => 1
 377+ );
 378+ $main_tags .= "<!---{$_tag}={$correct_brt}" . $special_tags[$_tag] . "{$correct_brt}--->\n";
 379+ } else {
 380+ $text = str_replace(
 381+ "<!---{$_tag}={$brt}" . $special_tags[$_tag] . "{$brt}--->",
 382+ '[[' . $wgContLang->getNsText( NS_CATEGORY ) .
 383+ ':' . sprintf( $format_tag_text, $special_tags[$_tag] ) . ']]',
 384+ //'[[Category:' . sprintf( $format_tag_text, $special_tags[$_tag] ) . ']]',
 385+ $text
 386+ );
 387+ }
 388+ }
 389+ break;
 390+ }
 391+ }
 392+ }
 393+ }
 394+ }
 395+
 396+ // parse given categories into an array...
 397+ preg_match_all( CATEGORY_TAG_PARSE, $text, $categories, PREG_SET_ORDER );
 398+ // and dispose of them, since they will be in the cloud anyway
 399+ $text = preg_replace( CATEGORY_TAG_PARSE, '', $text );
 400+ if ( is_array( $categories ) ) {
 401+ $found_categories = $found_categories + $categories;
 402+ }
 403+
 404+ /**
 405+ * Display section name and additional tags as hidden text
 406+ */
 407+ if ( !empty( $main_tags ) ) {
 408+ $boxes[] = array(
 409+ 'type' => 'textarea',
 410+ 'value' => $main_tags,
 411+ 'toolbar' => '',
 412+ 'display' => 0
 413+ );
 414+ }
 415+
 416+ /**
 417+ * other tags - lbl, categories, language,
 418+ */
 419+ preg_match( SIMPLE_TAG_PARSE, $text, $other_tags );
 420+ $specialTag = ( isset( $other_tags ) && ( !empty( $other_tags[1] ) ) ) ? $other_tags[1] : 'generic';
 421+
 422+ if (
 423+ ( !empty( $specialTag ) ) &&
 424+ ( !empty( $wgMultiEditPageSimpleTags ) ) &&
 425+ ( in_array( $specialTag, $wgMultiEditPageSimpleTags ) )
 426+ ) {
 427+ $boxes[] = array(
 428+ 'type' => 'text',
 429+ 'value' => sprintf( SPECIAL_TAG_FORMAT, $specialTag ),
 430+ 'display' => 0
 431+ );
 432+ switch( $specialTag ) {
 433+ case 'lbl': { // <!---lbl---> tag support
 434+ $text_html = str_replace( $other_tags[0], '', $text ); // strip <!---lbl---> tag
 435+ $text_html = trim( $text_html ); // strip unneeded newlines
 436+ // this section type is non-editable, so we just rebuild its contents in JavaScript code
 437+ $boxes[] = array(
 438+ 'type' => 'textarea',
 439+ 'value' => $text_html,
 440+ 'toolbar' => '',
 441+ 'display' => 0
 442+ );
 443+ $boxes[] = array(
 444+ 'type' => '',
 445+ 'value' => $text_html,
 446+ 'display' => 1
 447+ );
 448+ break;
 449+ }
 450+ case 'pagetitle': { // <!---pagetitle---> tag support
 451+ $text_html = str_replace( $other_tags[0], '', $text ); // strip <!---lbl---> tag
 452+ $text_html = trim( $text_html ); // strip unneeded newlines
 453+ // this section type is non-editable, so we just rebuild its contents in JavaScript code
 454+ $boxes[] = array(
 455+ 'type' => 'text',
 456+ 'value' => "{$text_html}",
 457+ 'display' => 1
 458+ );
 459+ break;
 460+ }
 461+ case 'optional': { // <!---optional---> tag support
 462+ $text_html = str_replace( $other_tags[0], '', $text ); // strip the tag
 463+ $text_html = trim( $text_html );
 464+ $toolbarid = count( $boxes );
 465+ $toolbar_text = CreateMultiPage::getMultiEditToolbar( $toolbarid );
 466+ $boxes[] = array(
 467+ 'type' => 'optional_textarea',
 468+ 'value' => $text_html,
 469+ 'toolbar' => $toolbar_text,
 470+ 'display' => 1
 471+ );
 472+
 473+ $optionals[] = count( $boxes ) - 1;
 474+ break;
 475+ }
 476+ case 'imageupload': { //<!---imageupload---> tag support
 477+ // do a match here, and for each do the thing, yeah
 478+ preg_match_all( IMAGEUPLOAD_TAG_SPECIFIC, $text, $image_tags );
 479+
 480+ // one we had already
 481+ $cur_img_count = count( $image_tags ) - 1;
 482+ foreach ( $image_tags[0] as $image_tag ) {
 483+ if ( $cur_img_count > 0 ) {
 484+ $boxes[] = array(
 485+ 'type' => 'text',
 486+ 'value' => sprintf( SPECIAL_TAG_FORMAT, 'imageupload' ),
 487+ 'display' => 0
 488+ );
 489+ }
 490+ $cur_img_count++;
 491+ }
 492+
 493+ $text = str_replace( $other_tags[0], '', $text );
 494+
 495+ // get the toolbar
 496+ $toolbarid = count( $boxes );
 497+ $toolbar_text = CreateMultiPage::getMultiEditToolbar( $toolbarid );
 498+
 499+ $boxes[] = array(
 500+ 'type' => 'textarea',
 501+ 'value' => $text,
 502+ 'toolbar' => $toolbar_text,
 503+ 'display' => 1
 504+ );
 505+
 506+ $current = count( $boxes ) - count( $image_tags[0] ) - 1;
 507+ $add_img_num = 0;
 508+ foreach ( $image_tags[0] as $image_tag ) {
 509+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 510+ $tmpl->set_vars(array(
 511+ 'imagenum' => $all_image_num,
 512+ 'target_tag' => $current + $add_img_num
 513+ ));
 514+ $image_text = $tmpl->render( 'editimage-section' );
 515+ $boxes[] = array(
 516+ 'type' => 'image',
 517+ 'value' => $image_text,
 518+ 'display' => 1
 519+ );
 520+ $add_img_num++;
 521+ $all_image_num++;
 522+ }
 523+ }
 524+ }
 525+ } elseif( $specialTag == 'generic' ) { // generic textarea
 526+ // get the toolbar
 527+ $toolbarid = count( $boxes );
 528+ $toolbar_text = CreateMultiPage::getMultiEditToolbar( $toolbarid );
 529+
 530+ $boxes[] = array(
 531+ 'type' => 'textarea',
 532+ 'value' => $text,
 533+ 'toolbar' => $toolbar_text,
 534+ 'display' => 1
 535+ );
 536+ }
 537+
 538+ $boxes[] = array(
 539+ 'type' => '',
 540+ 'value' => '<br/><!--end of section-->',
 541+ 'display' => 1
 542+ );
 543+ $num++;
 544+ }
 545+
 546+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 547+ $tmpl->set_vars(array(
 548+ 'boxes' => $boxes,
 549+ 'cols' => $cols,
 550+ 'rows' => $rows,
 551+ 'ew' => $ew,
 552+ 'is_section' => $is_section,
 553+ 'title' => $wgTitle,
 554+ 'imgpath' => $wgScriptPath . '/extensions/CreateAPage/images/',
 555+ 'optional_sections' => $optional_sections
 556+ ));
 557+ $me_content .= $tmpl->render( 'editpage' );
 558+
 559+ if ( $is_used_category_cloud ) {
 560+ // categories are generated here... well, except for Blank
 561+ // init some class here to get categories form to display
 562+ $text_category = '';
 563+ $xnum = 0;
 564+ $array_category = array();
 565+
 566+ foreach ( $found_categories as $category ) {
 567+ $cat_text = trim( $category[1] );
 568+ $text_category .= ( $xnum ? ',' : '' ) . $cat_text;
 569+ $array_category[$cat_text] = 1;
 570+ $xnum++;
 571+ }
 572+
 573+ $cloud = new CAP_TagCloud();
 574+
 575+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 576+ $tmpl->set_vars(array(
 577+ 'num' => $num,
 578+ 'cloud' => $cloud,
 579+ 'cols' => $cols,
 580+ 'ew' => $ew,
 581+ 'text_category' => $text_category,
 582+ 'array_category' => $array_category
 583+ ));
 584+
 585+ $me_content .= $tmpl->render( 'categorypage' );
 586+ }
 587+
 588+ return $me_content;
 589+ }
 590+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreateMultiPage.php
___________________________________________________________________
Added: svn:eol-style
1591 + native
Index: trunk/extensions/CreateAPage/CreatePageImageUploadForm.php
@@ -0,0 +1,401 @@
 2+<?php
 3+
 4+class CreatePageImageUploadForm extends UploadForm {
 5+ var $mParameterExt, $mStoredDestName, $mLastTimestamp, $mReturnedTimestamp;
 6+
 7+ /**
 8+ * Constructor
 9+ */
 10+ public function __construct( &$request ) {
 11+ # overwrite action parameter
 12+ $_REQUEST['action'] = 'submit';
 13+
 14+ # and call parent
 15+ parent::__construct( $request );
 16+ }
 17+
 18+ /**
 19+ * Start doing stuff
 20+ */
 21+ public function execute() {
 22+ global $wgUser, $wgEnableUploads;
 23+
 24+ # Check uploading enabled
 25+ if( !$wgEnableUploads ) {
 26+ return array(
 27+ 'error' => 1,
 28+ 'msg' => wfMsg( 'uploaddisabledtext' ),
 29+ 'once' => true
 30+ );
 31+ }
 32+
 33+ # Check permissions
 34+ if( !$wgUser->isAllowed( 'upload' ) ) {
 35+ if( !$wgUser->isLoggedIn() ) {
 36+ return array(
 37+ 'error' => 1,
 38+ 'msg' => 'cp_no_login',
 39+ 'once' => true
 40+ );
 41+ } else {
 42+ return array(
 43+ 'error' => 1,
 44+ 'msg' => wfMsg( 'badaccess-group0' ),
 45+ 'once' => true
 46+ );
 47+ }
 48+ return;
 49+ }
 50+
 51+ # Check blocks
 52+ if( $wgUser->isBlocked() ) {
 53+ return array(
 54+ 'error' => 1,
 55+ 'msg' => wfMsg( 'blockedtext' ),
 56+ 'once' => true
 57+ );
 58+ }
 59+
 60+ if( wfReadOnly() ) {
 61+ return array(
 62+ 'error' => 1,
 63+ 'msg' => wfMsg( 'createpage-upload-directory-read-only' ),
 64+ 'once' => true
 65+ );
 66+ }
 67+
 68+ $response = $this->processUpload();
 69+ if ( is_string( $response ) ) {
 70+ return array(
 71+ 'error' => 1,
 72+ 'msg' => $response,
 73+ 'once' => false
 74+ );
 75+ }
 76+
 77+ $this->cleanupTempFile();
 78+ if ( $this->mSrcName != '' ) {
 79+ if ( $this->mDestName != '' ) {
 80+ return array(
 81+ 'error' => 0,
 82+ 'msg' => 'File:' . $this->mDestName,
 83+ 'timestamp' => $this->mDestName,
 84+ 'once' => false
 85+ );
 86+ } else {
 87+ return array(
 88+ 'error' => 0,
 89+ 'msg' => 'File:' . wfBaseName( $this->mSrcName ),
 90+ 'timestamp' => wfBaseName( $this->mSrcName ),
 91+ 'once' => false
 92+ );
 93+ }
 94+ } else {
 95+ return array(
 96+ 'error' => 1,
 97+ 'msg' => wfMsg( 'uploaderror' ),
 98+ 'once' => true
 99+ );
 100+ }
 101+ }
 102+
 103+ function processUpload() {
 104+ global $wgUser, $wgOut, $wgFileExtensions;
 105+ $details = null;
 106+ $value = null;
 107+ $value = $this->internalProcessUpload( $details );
 108+
 109+ switch( $value ) {
 110+ case self::SUCCESS:
 111+ // don't... do... REDIRECT
 112+ return;
 113+
 114+ case self::BEFORE_PROCESSING:
 115+ return false;
 116+
 117+ case self::LARGE_FILE_SERVER:
 118+ return wfMsg( 'largefileserver' );
 119+
 120+ case self::EMPTY_FILE:
 121+ return wfMsg( 'emptyfile' );
 122+
 123+ case self::MIN_LENGTH_PARTNAME:
 124+ return wfMsg( 'minlength1' );
 125+ return;
 126+
 127+ case self::ILLEGAL_FILENAME:
 128+ $filtered = $details['filtered'];
 129+ return wfMsg( 'illegalfilename', $filtered );
 130+
 131+ case self::PROTECTED_PAGE:
 132+ return wfMsg( 'protectedpage' );
 133+
 134+ case self::OVERWRITE_EXISTING_FILE:
 135+ $errorText = $details['overwrite'];
 136+ $overwrite = new WikiError( $wgOut->parse( $errorText ) );
 137+ return $overwrite->toString();
 138+
 139+ case self::FILETYPE_MISSING:
 140+ return wfMsg( 'filetype-missing' );
 141+
 142+ case self::FILETYPE_BADTYPE:
 143+ $finalExt = $details['finalExt'];
 144+ return wfMsg( 'filetype-badtype' );
 145+
 146+ case self::VERIFICATION_ERROR:
 147+ $veri = $details['veri'];
 148+ return $veri->toString();
 149+
 150+ case self::UPLOAD_VERIFICATION_ERROR:
 151+ $error = $details['error'];
 152+ return $error;
 153+
 154+ case self::UPLOAD_WARNING:
 155+ $warning = $details['warning'];
 156+ return $warning;
 157+ }
 158+ throw new MWException( __METHOD__ . ": Unknown value `{$value}`" );
 159+ }
 160+
 161+ function getQuickTimestamp( $img_name ) {
 162+ $dbr = wfGetDB( DB_SLAVE );
 163+ $resource = $dbr->select(
 164+ 'image',
 165+ array( 'img_timestamp' ),
 166+ array( 'img_name' => $img_name ),
 167+ __METHOD__
 168+ );
 169+ if ( 0 == $dbr->numRows( $resource ) ) {
 170+ $dbr->freeResult( $resource );
 171+ return false;
 172+ }
 173+
 174+ $res_obj = $dbr->fetchObject( $resource );
 175+ return ( $res_obj->img_timestamp );
 176+ }
 177+
 178+ /* since we wanted to mess up heavily here...
 179+ I'm copying this stuff too
 180+ */
 181+ function internalProcessUpload( &$resultDetails ) {
 182+ global $wgUser;
 183+
 184+ /* Check for PHP error if any, requires php 4.2 or newer */
 185+ if( $this->mCurlError == 1 /*UPLOAD_ERR_INI_SIZE*/ ) {
 186+ return self::LARGE_FILE_SERVER;
 187+ }
 188+
 189+ /**
 190+ * If there was no filename or a zero size given, give up quick.
 191+ */
 192+ if( trim( $this->mSrcName ) == '' || empty( $this->mFileSize ) ) {
 193+ return self::EMPTY_FILE;
 194+ }
 195+
 196+ # Chop off any directories in the given filename
 197+ if( $this->mDesiredDestName ) {
 198+ $basename = $this->mDesiredDestName . '.' . $this->mParameterExt;
 199+ $this->mStoredDestName = $this->mDesiredDestName;
 200+ } else {
 201+ $basename = $this->mSrcName;
 202+ }
 203+ $filtered = wfBaseName( $basename );
 204+
 205+ /**
 206+ * We'll want to blacklist against *any* 'extension', and use
 207+ * only the final one for the whitelist.
 208+ */
 209+ list( $partname, $ext ) = $this->splitExtensions( $filtered );
 210+
 211+ if( count( $ext ) ) {
 212+ $finalExt = $ext[count( $ext ) - 1];
 213+ } else {
 214+ $finalExt = '';
 215+ }
 216+
 217+ # If there was more than one "extension", reassemble the base
 218+ # filename to prevent bogus complaints about length
 219+ if( count( $ext ) > 1 ) {
 220+ for( $i = 0; $i < count( $ext ) - 1; $i++ ) {
 221+ $partname .= '.' . $ext[$i];
 222+ }
 223+ }
 224+
 225+ if( strlen( $partname ) < 1 ) {
 226+ return self::MIN_LENGTH_PARTNAME;
 227+ }
 228+
 229+ /**
 230+ * Filter out illegal characters, and try to make a legible name
 231+ * out of it. We'll strip some silently that Title would die on.
 232+ */
 233+ $filtered = preg_replace( "/[^" . Title::legalChars() . "]|:/", '-', $filtered );
 234+ $nt = Title::makeTitleSafe( NS_IMAGE, $filtered );
 235+
 236+ if( is_null( $nt ) ) {
 237+ $resultDetails = array( 'filtered' => $filtered );
 238+ return self::ILLEGAL_FILENAME;
 239+ }
 240+ $this->mLocalFile = wfLocalFile( $nt );
 241+ $this->mDestName = $this->mLocalFile->getName();
 242+
 243+ /**
 244+ * If the image is protected, non-sysop users won't be able
 245+ * to modify it by uploading a new revision.
 246+ */
 247+ if( !$nt->userCan( 'edit' ) ) {
 248+ return self::PROTECTED_PAGE;
 249+ }
 250+
 251+ /**
 252+ * In some cases we may forbid overwriting of existing files.
 253+ */
 254+ // here starts the interesting part...
 255+ // we overwrite mDestName and give it a new twist
 256+ $timestamp = '';
 257+ $img_found = wfFindFile( $this->mDestName );
 258+ if ( $img_found ) {
 259+ // ehhh...
 260+ // we'll do it hard way then...
 261+ $timestamp = $this->mDestName;
 262+ } else { // this timestamp should not repeat...
 263+ $timestamp = 'invalid';
 264+ }
 265+ $tempname = '';
 266+ $tmpcount = 0;
 267+
 268+ while( $img_found && ( $timestamp != $this->mLastTimestamp ) ) {
 269+ $tmpcount++ ;
 270+ $file_ext = explode( '.', $this->mDestName );
 271+ $file_ext = $file_ext[0];
 272+ $tmpdestname = $file_ext;
 273+ $tempname = $tmpdestname . $tmpcount . '.' . $this->mParameterExt;
 274+ $timestamp = $tempname;
 275+ $img_found = wfFindFile( $tempname );
 276+ }
 277+
 278+ if ( $tmpcount > 0 ) {
 279+ wfLocalFile( $title );
 280+ $tempname = preg_replace( "/[^" . Title::legalChars() . "]|:/", '-', $tempname );
 281+ $nt = Title::makeTitleSafe( NS_FILE, $tempname );
 282+ $this->mLocalFile = wfLocalFile( $nt );
 283+ $this->mDestName = $this->mLocalFile->getName();
 284+ $this->mDesiredDestName = $this->mStoredDestName . $tmpcount . '.' . $this->mParameterExt;
 285+ } else { // append the extension anyway
 286+ $this->mDesiredDestName = $this->mStoredDestName . '.' . $this->mParameterExt;
 287+ }
 288+
 289+ $overwrite = $this->checkOverwrite( $this->mDestName );
 290+ if( $overwrite !== true ) {
 291+ $resultDetails = array( 'overwrite' => $overwrite );
 292+ return self::OVERWRITE_EXISTING_FILE;
 293+ }
 294+
 295+ /* Don't allow users to override the blacklist (check file extension) */
 296+ global $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist;
 297+
 298+ if ( $finalExt == '' ) {
 299+ return self::FILETYPE_MISSING;
 300+ } elseif ( $this->checkFileExtensionList( $ext, $wgFileBlacklist ) ||
 301+ ( $wgStrictFileExtensions && !$this->checkFileExtension( $finalExt, $wgFileExtensions ) ) ) {
 302+ $resultDetails = array( 'finalExt' => $finalExt );
 303+ return self::FILETYPE_BADTYPE;
 304+ }
 305+
 306+ /**
 307+ * Look at the contents of the file; if we can recognize the
 308+ * type but it's corrupt or data of the wrong type, we should
 309+ * probably not accept it.
 310+ */
 311+ if( !$this->mStashed ) {
 312+ $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $finalExt );
 313+ $this->checkMacBinary();
 314+ $veri = $this->verify( $this->mTempPath, $finalExt );
 315+
 316+ if( $veri !== true ) { // it's a wiki error...
 317+ $resultDetails = array( 'veri' => $veri );
 318+ return self::VERIFICATION_ERROR;
 319+ }
 320+
 321+ /**
 322+ * Provide an opportunity for extensions to add further checks
 323+ */
 324+ $error = '';
 325+ }
 326+
 327+ /**
 328+ * Check for non-fatal conditions
 329+ */
 330+ if ( !$this->mIgnoreWarning ) {
 331+ $warning = '';
 332+
 333+ global $wgCapitalLinks;
 334+ if( $wgCapitalLinks ) {
 335+ $filtered = ucfirst( $filtered );
 336+ }
 337+
 338+ if( $basename != $filtered ) {
 339+ $warning .= '<li>' . wfMsgHtml( 'badfilename', htmlspecialchars( $this->mDestName ) ) . '</li>';
 340+ }
 341+
 342+ global $wgCheckFileExtensions;
 343+ if ( $wgCheckFileExtensions ) {
 344+ if ( !$this->checkFileExtension( $finalExt, $wgFileExtensions ) ) {
 345+ $warning .= '<li>' . wfMsgExt( 'filetype-badtype', array( 'parseinline' ),
 346+ htmlspecialchars( $finalExt ), implode( ', ', $wgFileExtensions ) ) . '</li>';
 347+ }
 348+ }
 349+
 350+ global $wgUploadSizeWarning;
 351+ if ( $wgUploadSizeWarning && ( $this->mFileSize > $wgUploadSizeWarning ) ) {
 352+ $skin = $wgUser->getSkin();
 353+ $wsize = $skin->formatSize( $wgUploadSizeWarning );
 354+ $asize = $skin->formatSize( $this->mFileSize );
 355+ $warning .= '<li>' . wfMsgHtml( 'large-file', $wsize, $asize ) . '</li>';
 356+ }
 357+
 358+ if ( $this->mFileSize == 0 ) {
 359+ $warning .= '<li>' . wfMsgHtml( 'emptyfile' ) . '</li>';
 360+ }
 361+
 362+ if ( !$this->mDestWarningAck ) {
 363+ $warning .= self::getExistsWarning( $this->mLocalFile );
 364+ }
 365+
 366+ if( $warning != '' ) {
 367+ /**
 368+ * Stash the file in a temporary location; the user can choose
 369+ * to let it through and we'll complete the upload then.
 370+ */
 371+ $resultDetails = array( 'warning' => $warning );
 372+ return self::UPLOAD_WARNING;
 373+ }
 374+ }
 375+
 376+ /**
 377+ * Try actually saving the thing...
 378+ * It will show an error form on failure.
 379+ */
 380+ $pageText = self::getInitialPageText( $this->mComment, $this->mLicense,
 381+ $this->mCopyrightStatus, $this->mCopyrightSource );
 382+
 383+ $status = $this->mLocalFile->upload( $this->mTempPath, $this->mComment, $pageText,
 384+ File::DELETE_SOURCE, $this->mFileProps );
 385+
 386+ if ( !$status->isGood() ) {
 387+ $this->showError( $status->getWikiText() );
 388+ } else {
 389+ if ( $this->mWatchthis ) {
 390+ global $wgUser;
 391+ $wgUser->addWatch( $this->mLocalFile->getTitle() );
 392+ }
 393+ // Success, redirect to description page
 394+ $this->mReturnedTimestamp = $this->getQuickTimestamp( $this->mDestName );
 395+ $img = null; // @todo: added to avoid passing a ref to null - should this be defined somewhere?
 396+ return self::SUCCESS;
 397+ }
 398+ }
 399+
 400+ function showSuccess() { }
 401+
 402+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreatePageImageUploadForm.php
___________________________________________________________________
Added: svn:eol-style
1403 + native
Index: trunk/extensions/CreateAPage/EasyTemplate.php
@@ -0,0 +1,112 @@
 2+<?php
 3+/**
 4+ * @file
 5+ * @author Krzysztof Krzyżaniak <eloy@wikia-inc.com>
 6+ * @version: $Id: EasyTemplate.php 9427 2008-02-15 11:31:05Z eloy $
 7+ *
 8+ * EasyTemplate class for easy mixing HTML/JavaScript/CSS/PHP code
 9+ * ideas taken from Template class by
 10+ * Copyright © 2003 Brian E. Lozier (brian@massassi.net)
 11+ *
 12+ * set_vars() method contributed by Ricardo Garcia (Thanks!)
 13+ *
 14+ * Permission is hereby granted, free of charge, to any person obtaining a copy
 15+ * of this software and associated documentation files (the "Software"), to
 16+ * deal in the Software without restriction, including without limitation the
 17+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18+ * sell copies of the Software, and to permit persons to whom the Software is
 19+ * furnished to do so, subject to the following conditions:
 20+ *
 21+ * The above copyright notice and this permission notice shall be included in
 22+ * all copies or substantial portions of the Software.
 23+ *
 24+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 25+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 26+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 27+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 28+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 29+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 30+ * IN THE SOFTWARE.
 31+ */
 32+
 33+class EasyTemplate {
 34+
 35+ public $mPath, $mVars;
 36+
 37+ /**
 38+ * Public constructor
 39+ * @example new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 40+ */
 41+ public function __construct( $path ) {
 42+ $this->mPath = rtrim( $path, '/' );
 43+ $this->mVars = array();
 44+ }
 45+
 46+ /**
 47+ * Set a bunch of variables at once using an associative array.
 48+ *
 49+ * @param $vars Array: array of variables to set
 50+ * @param $clear Boolean: whether to completely overwrite the existing vars
 51+ */
 52+ public function set_vars( $vars, $clear = false ) {
 53+ if( $clear ) {
 54+ $this->mVars = $vars;
 55+ } else {
 56+ $this->mVars = is_array( $vars )
 57+ ? array_merge( $this->mVars, $vars )
 58+ : array_merge( $this->mVars, array() );
 59+ }
 60+ }
 61+
 62+ /**
 63+ * Set a variable
 64+ *
 65+ * @param $name String: variable name
 66+ * @param $value Mixed: variable value
 67+ */
 68+ public function set( $name, $value ) {
 69+ $this->mVars[$name] = $value;
 70+ }
 71+
 72+ /**
 73+ * Open, parse, and return the template file.
 74+ *
 75+ * @param $file String: the template file name
 76+ * @return string
 77+ */
 78+ public function render( $file ) {
 79+ wfProfileIn( __METHOD__ );
 80+
 81+ if( !strstr( $file, '.tmpl.php' ) ) {
 82+ $file .= '.tmpl.php';
 83+ }
 84+
 85+ extract( $this->mVars );
 86+ ob_start();
 87+ include( $this->mPath . '/' . $file );
 88+ $contents = ob_get_clean();
 89+
 90+ wfProfileOut( __METHOD__ );
 91+ return $contents;
 92+ }
 93+
 94+ /**
 95+ * Check if template file exists
 96+ *
 97+ * @param $file String: path to file with template
 98+ * @return boolean
 99+ */
 100+ public function template_exists( $file ) {
 101+ if( !strstr( $file, '.tmpl.php' ) ) {
 102+ $file .= '.tmpl.php';
 103+ }
 104+ return file_exists( $this->mPath . '/' . $file );
 105+ }
 106+
 107+ /**
 108+ * Reset variables array
 109+ */
 110+ public function reset() {
 111+ $this->mVars = array();
 112+ }
 113+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/EasyTemplate.php
___________________________________________________________________
Added: svn:eol-style
1114 + native
Index: trunk/extensions/CreateAPage/SpecialCreatePage.body.php
@@ -0,0 +1,61 @@
 2+<?php
 3+
 4+class CreatePage extends SpecialPage {
 5+
 6+ /**
 7+ * Constructor -- set up the new special page
 8+ */
 9+ public function __construct() {
 10+ parent::__construct( 'CreatePage', 'createpage' );
 11+ }
 12+
 13+ /**
 14+ * Show the special page
 15+ *
 16+ * @param $par Mixed: parameter passed to the page or null
 17+ */
 18+ public function execute( $par ) {
 19+ global $wgOut, $wgUser, $wgRequest;
 20+
 21+ // If user is blocked, s/he doesn't need to access this page
 22+ if ( $wgUser->isBlocked() ) {
 23+ $wgOut->blockedPage();
 24+ return;
 25+ }
 26+
 27+ // Is the database locked?
 28+ if( wfReadOnly() ) {
 29+ $wgOut->readOnlyPage();
 30+ return;
 31+ }
 32+
 33+ // Do we have the required permissions?
 34+ if( !$wgUser->isAllowed( 'createpage' ) ) {
 35+ $wgOut->permissionRequired( 'createpage' );
 36+ return;
 37+ }
 38+
 39+ // Set the page title, robot policies, etc.
 40+ $this->setHeaders();
 41+
 42+ // Add YUI CSS & JS
 43+ $out->addScript( '<script language="javascript" src="http://yui.yahooapis.com/2.5.2/build/utilities/utilities.js"></script>' . "\n" );
 44+ $out->addScript( '<script language="javascript" src="http://yui.yahooapis.com/2.5.2/build/container/container-min.js"></script>' . "\n" );
 45+ // this MUST be included so that the overlay thingy on
 46+ // Special:CreatePage works properly
 47+ $out->addExtensionStyle( 'http://yui.yahooapis.com/2.5.2/build/container/assets/container.css' );
 48+
 49+ $mainForm = new CreatePageCreateplateForm( $par );
 50+
 51+ $action = $wgRequest->getVal( 'action' );
 52+ if ( $wgRequest->wasPosted() && $action == 'submit' ) {
 53+ $mainForm->submitForm();
 54+ } elseif( $action == 'check' ) {
 55+ $mainForm->checkArticleExists( $wgRequest->getVal( 'to_check' ), true );
 56+ } else {
 57+ $mainForm->showForm( '' );
 58+ $mainForm->showCreateplate( true );
 59+ }
 60+ }
 61+
 62+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/SpecialCreatePage.body.php
___________________________________________________________________
Added: svn:eol-style
163 + native
Index: trunk/extensions/CreateAPage/CreatePageCreateplateForm.php
@@ -0,0 +1,437 @@
 2+<?php
 3+
 4+// this class takes care for the createplate loader form
 5+class CreatePageCreateplateForm {
 6+ var $mCreateplatesLocation;
 7+ var $mTitle, $mNamespace, $mCreateplate;
 8+ var $mRedLinked;
 9+
 10+ // constructor
 11+ function __construct( $par = null ) {
 12+ global $wgRequest;
 13+
 14+ $this->mCreateplatesLocation = 'Createplate-list';
 15+
 16+ if ( $wgRequest->getVal( 'action' ) == 'submit' ) {
 17+ $this->mTitle = $wgRequest->getVal( 'Createtitle' );
 18+ $this->mCreateplate = $wgRequest->getVal( 'createplates' );
 19+ // for preview in red link mode
 20+ if ( $wgRequest->getCheck( 'Redlinkmode' ) ) {
 21+ $this->mRedLinked = true;
 22+ }
 23+ } else {
 24+ // title override
 25+ if ( $wgRequest->getVal( 'Createtitle' ) != '' ) {
 26+ $this->mTitle = $wgRequest->getVal( 'Createtitle' );
 27+ $this->mRedLinked = true;
 28+ } else {
 29+ $this->mTitle = '';
 30+ }
 31+ // URL override
 32+ $this->mCreateplate = $wgRequest->getVal( 'createplates' );
 33+ }
 34+ }
 35+
 36+ function makePrefix( $title ) {
 37+ $title = str_replace( '_', ' ', $title );
 38+ return $title;
 39+ }
 40+
 41+ // show form
 42+ function showForm( $err, $content_prev = false, $formCallback = null ) {
 43+ global $wgOut, $wgUser, $wgRequest;
 44+
 45+ if ( $wgRequest->getCheck( 'wpPreview' ) ) {
 46+ $wgOut->setPageTitle( wfMsg( 'preview' ) );
 47+ } else {
 48+ if ( $this->mRedLinked ) {
 49+ $wgOut->setPageTitle( wfMsg( 'editing', $this->makePrefix( $this->mTitle ) ) );
 50+ } else {
 51+ $wgOut->setPageTitle( wfMsg( 'createpage-title' ) );
 52+ }
 53+ }
 54+
 55+ if ( $wgUser->isLoggedIn() ) {
 56+ $token = htmlspecialchars( $wgUser->editToken() );
 57+ } else {
 58+ $token = EDIT_TOKEN_SUFFIX;
 59+ }
 60+ $titleObj = SpecialPage::getTitleFor( 'CreatePage' );
 61+ $action = $titleObj->escapeLocalURL( 'action=submit' );
 62+
 63+ if ( $wgRequest->getCheck( 'wpPreview' ) ) {
 64+ $wgOut->addHTML( '<div class="previewnote"><p>' . wfMsg( 'previewnote' ) . '</p></div>' );
 65+ } else {
 66+ $wgOut->addHTML( wfMsg( 'createpage-title-additional' ) );
 67+ }
 68+
 69+ if ( $err != '' ) {
 70+ $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
 71+ $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
 72+ }
 73+
 74+ // show stuff like on normal edit page, but just for red links
 75+ if ( $this->mRedLinked ) {
 76+ if( $wgUser->isLoggedIn() ) {
 77+ $wgOut->addWikiMsg( 'newarticletext' );
 78+ } else {
 79+ $wgOut->addWikiMsg( 'newarticletextanon' );
 80+ }
 81+ if( $wgUser->isAnon() && !$wgRequest->getCheck( 'wpPreview' ) ) {
 82+ $wgOut->addWikiMsg( 'anoneditwarning' );
 83+ }
 84+ }
 85+ global $wgScriptPath;
 86+
 87+ if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) {
 88+ $wgOut->addModuleStyles( 'ext.createAPage' );
 89+ } else {
 90+ $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/CreateAPage/CreatePage.css' );
 91+ }
 92+ /*if( $wgUser->getOption( 'disablelinksuggest' ) != true ) {
 93+ $wgOut->addHTML( '<div id="wpTextbox1_container" class="yui-ac-container"></div> ');
 94+ $wgOut->addScriptFile( $wgScriptPath . '/extensions/LinkSuggest/LinkSuggest.js' );
 95+ }*/
 96+
 97+ $alternateLink = '<a href="#" onclick="CreatePageNormalEdit(); return false;">' .
 98+ wfMsg( 'createpage-here' ) . '</a>';
 99+ $wgOut->addHTML(
 100+ '<div id="createpage_subtitle" style="display:none">' .
 101+ wfMsg( 'createpage-alternate-creation', $alternateLink ) .
 102+ '</div>'
 103+ );
 104+
 105+ if ( $wgRequest->getCheck( 'wpPreview' ) ) {
 106+ $this->showPreview( $content_prev, $wgRequest->getVal( 'Createtitle' ) );
 107+ }
 108+
 109+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 110+ $wgOut->addHTML( $tmpl->render( 'title-check' ) );
 111+
 112+ $html = "
 113+<form name=\"createpageform\" enctype=\"multipart/form-data\" method=\"post\" action=\"{$action}\" id=\"createpageform\">
 114+ <div id=\"createpage_messenger\" style=\"display:none; color:red\"></div>
 115+ <noscript>
 116+ <style type=\"text/css\">
 117+ #loading_mesg, #image_upload {
 118+ display: none;
 119+ }
 120+ </style>
 121+ </noscript>";
 122+
 123+ $html .= '
 124+ <input type="hidden" name="wpEditToken" value="' . $token . '" />
 125+ <input type="hidden" name="wpCreatePage" value="true" />';
 126+
 127+ $wgOut->addHTML( $html );
 128+ // adding this for CAPTCHAs and the like
 129+ if( is_callable( $formCallback ) ) {
 130+ call_user_func_array( $formCallback, array( &$wgOut ) );
 131+ }
 132+
 133+ $wgOut->addHTML( $tmpl->render( 'toggles' ) );
 134+ $parsedTemplates = $this->getCreateplates();
 135+ $show_field = '';
 136+ if ( !$parsedTemplates ) {
 137+ $show_field = ' style="display: none";';
 138+ }
 139+
 140+ if ( !$wgRequest->getCheck( 'wpPreview' ) ) {
 141+ $wgOut->addHTML(
 142+ '<fieldset id="cp-chooser-fieldset"' . $show_field . '>
 143+ <legend>' . wfMsg( 'createpage-choose-createplate' ) .
 144+ '<span style="font-size: small; font-weight: normal; margin-left: 5px">[<a id="cp-chooser-toggle" title="toggle" href="#">'
 145+ . wfMsg( 'createpage-hide' ) . '</a>]</span>
 146+ </legend>' . "\n"
 147+ );
 148+ $wgOut->addHTML( '<div id="cp-chooser" style="display: block;">' . "\n" );
 149+ }
 150+ $this->produceRadioList( $parsedTemplates );
 151+ }
 152+
 153+ /**
 154+ * Get the list of createplates from a MediaWiki namespace page,
 155+ * parse the content into an array and return it.
 156+ *
 157+ * @return Mixed: array on success, boolean false if the message is empty
 158+ */
 159+ function getCreateplates() {
 160+ $createplates_txt = wfMsgForContent( $this->mCreateplatesLocation );
 161+ if ( $createplates_txt != '' ) {
 162+ $lines = preg_split( "/[\n]+/", $createplates_txt );
 163+ }
 164+
 165+ $createplates = array();
 166+ if ( !empty( $lines ) ) {
 167+ // each createplate is listed in a new line, has two required and one optional
 168+ // parameter, all separated by pipes
 169+ foreach ( $lines as $line ) {
 170+ if ( preg_match( "/^[^\|]+\|[^\|]+\|[^\|]+$/", $line ) ) {
 171+ // three parameters
 172+ $line_pars = preg_split( "/\|/", $line );
 173+ $createplates[] = array(
 174+ 'page' => $line_pars[0],
 175+ 'label' => $line_pars[1],
 176+ 'preview' => $line_pars[2]
 177+ );
 178+ } elseif( preg_match( "/^[^\|]+\|[^\|]+$/", $line ) ) {
 179+ // two parameters
 180+ $line_pars = preg_split( "/\|/", $line );
 181+ $createplates[] = array(
 182+ 'page' => $line_pars[0],
 183+ 'label' => $line_pars[1]
 184+ );
 185+ }
 186+ }
 187+ }
 188+
 189+ if ( empty( $createplates ) ) {
 190+ return false;
 191+ } else {
 192+ return $createplates;
 193+ }
 194+ }
 195+
 196+ // return checked createplate
 197+ function getChecked( $createplate, $current, &$checked ) {
 198+ if ( !$createplate ) {
 199+ if ( !$checked ) {
 200+ $this->mCreateplate = $current;
 201+ $checked = true;
 202+ return 'checked';
 203+ }
 204+ return '';
 205+ } else {
 206+ if ( $createplate == $current ) {
 207+ $this->mCreateplate = $current;
 208+ return 'checked';
 209+ } else {
 210+ return '';
 211+ }
 212+ }
 213+ }
 214+
 215+ // produce a list of radio buttons from the given createplate array
 216+ function produceRadioList( $createplates ) {
 217+ global $wgOut, $wgRequest, $wgServer, $wgScript;
 218+
 219+ // this checks radio buttons when we have no JavaScript...
 220+ $selected = false;
 221+ if ( $this->mCreateplate != '' ) {
 222+ $selected = $this->mCreateplate;
 223+ }
 224+ $checked = false;
 225+ $check = array();
 226+ foreach ( $createplates as $createplate ) {
 227+ $check[$createplate['page']] = $this->getChecked(
 228+ $selected, $createplate['page'], $checked
 229+ );
 230+ }
 231+
 232+ if ( $this->mRedLinked ) {
 233+ global $wgParser, $wgUser;
 234+ $parserOptions = ParserOptions::newFromUser( $wgUser );
 235+ $parserOptions->setEditSection( false );
 236+ $rtitle = Title::newFromText( $this->mTitle );
 237+ $parsed_info = $wgParser->parse(
 238+ wfMsg( 'createpage-about-info' ), $rtitle, $parserOptions
 239+ );
 240+ $aboutinfo = str_replace( '</p>', '', $parsed_info->mText );
 241+ $aboutinfo .= wfMsg(
 242+ 'createpage-advanced-text',
 243+ '<a href="' . $wgServer . $wgScript . '" id="wpAdvancedEdit">' .
 244+ wfMsg( 'createpage-advanced-edit' ) . '</a>'
 245+ ) . '</p>';
 246+ } else {
 247+ $aboutinfo = '';
 248+ }
 249+
 250+ $tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
 251+ $tmpl->set_vars(array(
 252+ 'data' => $createplates,
 253+ 'selected' => $check,
 254+ 'createtitle' => $this->makePrefix( $this->mTitle ),
 255+ 'ispreview' => $wgRequest->getCheck( 'wpPreview' ),
 256+ 'isredlink' => $this->mRedLinked,
 257+ 'aboutinfo' => $aboutinfo,
 258+ ));
 259+
 260+ $wgOut->addHTML( $tmpl->render( 'templates-list' ) );
 261+ }
 262+
 263+ /**
 264+ * Check whether the given page exists.
 265+ *
 266+ * @param $given String: name of the page whose existence we're checking
 267+ * @param $ajax Boolean: are we in AJAX mode? Defaults to false.
 268+ * @return Mixed: string (error message) if the title is missing, the page
 269+ * exists and we're not in AJAX mode
 270+ */
 271+ function checkArticleExists( $given, $ajax = false ) {
 272+ global $wgOut, $wgUser;
 273+
 274+ if ( $ajax ) {
 275+ $wgOut->setArticleBodyOnly( true );
 276+ }
 277+
 278+ if ( empty( $given ) && !$ajax ) {
 279+ return wfMsg( 'createpage-give-title' );
 280+ }
 281+
 282+ $title = Title::newFromText( $given );
 283+ if ( is_object( $title ) ) {
 284+ $page = $title->getText();
 285+ $page = str_replace( ' ', '_', $page );
 286+ $dbr = wfGetDB( DB_SLAVE );
 287+ $exists = $dbr->selectField(
 288+ 'page',
 289+ 'page_title',
 290+ array(
 291+ 'page_title' => $page,
 292+ 'page_namespace' => $title->getNamespace()
 293+ ),
 294+ __METHOD__
 295+ );
 296+ if ( $exists != '' ) {
 297+ if ( $ajax ) {
 298+ $wgOut->addHTML( 'pagetitleexists' );
 299+ } else {
 300+ $sk = $wgUser->getSkin();
 301+ // Mimick the way AJAX version displays things and use the
 302+ // same two messages. 2 are needed for full i18n support.
 303+ return wfMsg( 'createpage-article-exists' ) . ' ' .
 304+ $sk->makeKnownLinkObj( $title, '', 'action=edit' ) .
 305+ wfMsg( 'createpage-article-exists2' );
 306+ }
 307+ }
 308+ if ( !$ajax ) {
 309+ return false;
 310+ }
 311+ } else {
 312+ if ( !$ajax ) {
 313+ return wfMsg( 'createpage-title-invalid' );
 314+ }
 315+ }
 316+ }
 317+
 318+ /**
 319+ * Try to submit the form.
 320+ *
 321+ * @return Mixed: boolean false on failure, nothing on success; if
 322+ * everything went well, the user is redirected to their new
 323+ * page
 324+ */
 325+ function submitForm() {
 326+ global $wgOut, $wgRequest, $wgServer, $wgScript, $wgScriptPath;
 327+
 328+ // check if we are editing in red link mode
 329+ if ( $wgRequest->getCheck( 'wpSubmitCreateplate' ) ) {
 330+ $mainform = new CreatePageCreateplateForm();
 331+ $mainform->showForm( '' );
 332+ $mainform->showCreateplate();
 333+ return false;
 334+ } else {
 335+ $valid = $this->checkArticleExists( $wgRequest->getVal( 'Createtitle' ) );
 336+ if ( $valid != '' ) {
 337+ // no title? this means overwriting Main Page...
 338+ $mainform = new CreatePageCreateplateForm();
 339+ $mainform->showForm( $valid );
 340+ $editor = new CreatePageMultiEditor( $this->mCreateplate );
 341+ $editor->GenerateForm( $editor->GlueArticle() );
 342+ return false;
 343+ }
 344+
 345+ if ( $wgRequest->getCheck( 'wpSave' ) ) {
 346+ $editor = new CreatePageMultiEditor( $this->mCreateplate );
 347+ $rtitle = Title::newFromText( $wgRequest->getVal( 'Createtitle' ) );
 348+ $rarticle = new Article( $rtitle, $rtitle->getArticleID() );
 349+ $editpage = new EditPage( $rarticle );
 350+ $editpage->mTitle = $rtitle;
 351+ $editpage->mArticle = $rarticle;
 352+ $editpage->textbox1 = CreateMultiPage::unescapeBlankMarker( $editor->GlueArticle() );
 353+
 354+ $editpage->minoredit = $wgRequest->getCheck( 'wpMinoredit' );
 355+ $editpage->watchthis = $wgRequest->getCheck( 'wpWatchthis' );
 356+ $editpage->summary = $wgRequest->getVal( 'wpSummary' );
 357+ $_SESSION['article_createplate'] = $this->mCreateplate;
 358+ // pipe tags to pipes
 359+ wfCreatePageUnescapeKnownMarkupTags( $editpage->textbox1 );
 360+ $editpage->attemptSave();
 361+ return false;
 362+ } elseif( $wgRequest->getCheck( 'wpPreview' ) ) {
 363+ $mainform = new CreatePageCreatePlateForm();
 364+ $editor = new CreatePageMultiEditor( $this->mCreateplate, true );
 365+ $content = $editor->GlueArticle( true, false );
 366+ $content_static = $editor->GlueArticle( true );
 367+ $mainform->showForm( '', $content_static );
 368+ $editor->GenerateForm( $content );
 369+ return false;
 370+ } elseif( $wgRequest->getCheck( 'wpAdvancedEdit' ) ) {
 371+ $editor = new CreatePageMultiEditor( $this->mCreateplate );
 372+ $content = CreateMultiPage::unescapeBlankMarker( $editor->GlueArticle() );
 373+ wfCreatePageUnescapeKnownMarkupTags( $content );
 374+ $_SESSION['article_content'] = $content;
 375+ $wgOut->redirect(
 376+ $wgServer . $wgScript . '?title=' .
 377+ $wgRequest->getVal( 'Createtitle' ) .
 378+ '&action=edit&createpage=true'
 379+ );
 380+ } elseif( $wgRequest->getCheck( 'wpImageUpload' ) ) {
 381+ $mainform = new CreatePageCreatePlateForm();
 382+ $mainform->showForm( '' );
 383+ $editor = new CreatePageMultiEditor( $this->mCreateplate );
 384+ $content = $editor->GlueArticle();
 385+ $editor->GenerateForm( $content );
 386+ } elseif( $wgRequest->getCheck( 'wpCancel' ) ) {
 387+ if ( $wgRequest->getVal( 'Createtitle' ) != '' ) {
 388+ $wgOut->redirect( $wgServer . $wgScript . '?title=' . $wgRequest->getVal( 'Createtitle' ) );
 389+ } else {
 390+ $wgOut->redirect( $wgServer . $wgScript );
 391+ }
 392+ }
 393+ }
 394+ }
 395+
 396+ // display the preview in another div
 397+ function showPreview( $content, $title ) {
 398+ global $wgOut, $wgUser, $wgParser;
 399+
 400+ $parserOptions = ParserOptions::newFromUser( $wgUser );
 401+ $parserOptions->setEditSection( false );
 402+ $rtitle = Title::newFromText( $title );
 403+
 404+ if ( is_object( $rtitle ) ) {
 405+ wfCreatePageUnescapeKnownMarkupTags( $content );
 406+ $pre_parsed = $wgParser->preSaveTransform(
 407+ $content, $rtitle, $wgUser, $parserOptions, true
 408+ );
 409+ $output = $wgParser->parse( $pre_parsed, $rtitle, $parserOptions );
 410+ $wgOut->addParserOutputNoText( $output );
 411+ $wgOut->addHTML(
 412+ "<div id=\"createpagepreview\">
 413+ $output->mText
 414+ <div id=\"createpage_preview_delimiter\" class=\"actionBar actionBarStrong\">" .
 415+ wfMsg( 'createpage-preview-end' ) .
 416+ '</div>
 417+ </div>'
 418+ );
 419+ }
 420+ }
 421+
 422+ function showCreateplate( $isInitial = false ) {
 423+ if ( $this->mCreateplate ) {
 424+ $editor = new CreatePageMultiEditor( $this->mCreateplate );
 425+ } else {
 426+ $editor = new CreatePageMultiEditor( 'Blank' );
 427+ }
 428+ $editor->mRedLinked = false;
 429+ if ( $this->mRedLinked ) {
 430+ $editor->mRedLinked = true;
 431+ }
 432+ $editor->mInitial = false;
 433+ if ( $isInitial ) {
 434+ $editor->mInitial = true;
 435+ }
 436+ $editor->GenerateForm();
 437+ }
 438+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreatePageCreateplateForm.php
___________________________________________________________________
Added: svn:eol-style
1439 + native
Index: trunk/extensions/CreateAPage/CreateAPage.i18n.php
@@ -0,0 +1,793 @@
 2+<?php
 3+/**
 4+ * Internationalization file for CreateAPage extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Bartek Łapiński
 14+ * @author Łukasz Garczewski
 15+ * @author Przemek Piotrowski
 16+ */
 17+$messages['en'] = array(
 18+ 'createpage-edit-normal' => 'Advanced Edit',
 19+ 'createpage-upload' => 'Upload image',
 20+ 'createpage-hide' => 'Hide',
 21+ 'createpage-show' => 'Show',
 22+ 'createpage' => 'Create a new article',
 23+ 'createpage-title' => 'Create a new article',
 24+ 'createpage-title-additional' => "You've followed a link to a page that doesn't exist yet. To create the page, start typing in the box below",
 25+ 'createpage-title-caption' => 'Article Title',
 26+ 'createpage-choose-createplate' => 'Choose a page type',
 27+ 'createpage-button-createplate-submit' => 'Load this template',
 28+ 'createpage-give-title' => 'Please specify a title',
 29+ 'createpage-title-invalid' => 'Please specify a valid title',
 30+ 'createpage-article-exists' => 'This article already exists. Edit',
 31+ 'createpage-article-exists2' => ' or specify another title.',
 32+ 'createpage-advanced-warning' => 'Switching editing modes may break page formatting, do you want to continue?',
 33+ 'createpage-login-warning' => 'By logging in now, you may lose all your unsaved text. Do you want to continue?',
 34+ 'createpage-infobox-legend' => 'Infobox',
 35+ 'createpage-yes' => 'Yes',
 36+ 'createpage-no' => 'No',
 37+ 'createpage-categories' => 'Categories',
 38+ 'createpage-addcategory' => 'Add category',
 39+ 'createpage-top-of-page' => 'Top of page',
 40+ 'createpage-uploaded-from' => 'Uploaded from Special:CreatePage',
 41+ 'createplate-list' => 'Blank|Blank',
 42+ 'createplate-Blank' => "<!---blanktemplate--->\n", # do not translate or duplicate this message into other languages!
 43+ 'createpage-title-check-header' => 'Title check forced',
 44+ 'createpage-title-check-text' => 'You cannot perform an action until title check has ended. Please click again on the action button to proceed.',
 45+ 'createpage-img-uploaded' => 'Image uploaded successfully',
 46+ 'createpage-preview-end' => 'End of preview. You can resume your editing below:',
 47+ 'createpage-insert-image' => 'Insert Image',
 48+ 'createpage-upload-aborted' => 'Image insert was cancelled',
 49+ 'createpage-initial-run' => 'Proceed to edit',
 50+ 'createpage-login-required' => 'You need to ',
 51+ 'createpage-login-href' => ' log in ',
 52+ 'createpage-login-required2' => 'to upload images',
 53+ 'createpage-please-wait' => 'Please wait...',
 54+ 'createpage-upload-directory-read-only' => 'The upload directory is not writable by the webserver',
 55+ 'headline-tip-3' => 'Level 3 headline',
 56+ 'createpage-about-info' => 'This is the simplified editor. To find out more go to [[s:Help:CreatePage|ShoutWiki Hub]].',
 57+ 'createpage-advanced-text' => 'You can also use the $1.',
 58+ 'createpage-advanced-edit' => 'advanced editor',
 59+ 'createpage-optionals-text' => 'Add optional sections:',
 60+ 'createpage-save' => 'Save',
 61+ 'tog-createpage-redlinks' => 'Use <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">CreatePage</a> when following broken links',
 62+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*Infobox.*\}\}/is', # regex used to find out whether our template is an infobox or not
 63+);
 64+
 65+/** Afrikaans (Afrikaans)
 66+ * @author Naudefj
 67+ */
 68+$messages['af'] = array(
 69+ 'createpage' => "Skep 'n nuwe artikel",
 70+ 'createpage-article-exists' => 'Hierdie bladsy bestaan reeds. Wysig',
 71+ 'createpage-article-exists2' => " of verskaf 'n ander bladsynaam.",
 72+ 'createpage-button-createplate-submit' => 'Laai hierdie sjabloon',
 73+ 'createpage-give-title' => "Verskaf 'n naam",
 74+ 'createpage-title' => "Skep 'n nuwe artikel",
 75+ 'createpage-title-caption' => 'Artikel se titel',
 76+ 'createpage-title-invalid' => "Verskaf 'n geldige bladsynaam",
 77+ 'createpage-yes' => 'Ja',
 78+ 'createpage-no' => 'Nee',
 79+ 'createpage-categories' => 'Kategorieë',
 80+ 'createpage-addcategory' => 'Voeg kategorie by',
 81+ 'createpage-login-required' => 'U moet ',
 82+ 'createpage-please-wait' => 'Wag asseblief...',
 83+ 'createpage-upload-aborted' => 'Invoeg van beeld was gekanselleer',
 84+ 'createpage-uploaded-from' => 'Opgelaai vanuit Special:CreatePage',
 85+);
 86+
 87+/** Assamese (অসমীয়া)
 88+ * @author Chaipau
 89+ */
 90+$messages['as'] = array(
 91+ 'createpage-show' => 'দেখুৱাওক',
 92+ 'createpage-yes' => 'অঁ',
 93+ 'createpage-no' => 'না',
 94+ 'createpage-login-href' => ' প্রবেশ ',
 95+);
 96+
 97+/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
 98+ * @author EugeneZelenko
 99+ */
 100+$messages['be-tarask'] = array(
 101+ 'createpage-categories' => 'Катэгорыі',
 102+);
 103+
 104+/** Bulgarian (Български) */
 105+$messages['bg'] = array(
 106+ 'createpage-categories' => 'Категории:',
 107+);
 108+
 109+/** Breton (Brezhoneg)
 110+ * @author Y-M D
 111+ */
 112+$messages['br'] = array(
 113+ 'createpage-hide' => 'Kuzhat',
 114+ 'createpage-show' => 'Diskouez',
 115+ 'createpage' => 'Krouiñ ur pennad nevez',
 116+ 'createpage-title' => 'Krouiñ ur pennad nevez',
 117+ 'createpage-choose-createplate' => 'Dibabit doare ar bajenn',
 118+ 'createpage-yes' => 'Ya',
 119+ 'createpage-no' => 'Nann',
 120+ 'createpage-login-required' => "Rankout a reoc'h",
 121+ 'createpage-login-href' => ' kevreañ ',
 122+ 'createpage-top-of-page' => 'Penn uhelañ ar bajenn',
 123+ 'createpage-advanced-text' => "Tu 'zo deoc'h implijout $1 ivez.",
 124+ 'createpage-please-wait' => 'Gortozit mar plij...',
 125+ 'headline-tip-3' => 'Titl a live 3',
 126+);
 127+
 128+/** German (Deutsch) */
 129+$messages['de'] = array(
 130+ 'createpage-edit-normal' => 'Erweiterter Editor',
 131+ 'createpage-hide' => 'Ausblenden',
 132+ 'createpage-show' => 'Einblenden',
 133+ 'createpage' => 'Neue Seite anlegen',
 134+ 'createpage-title' => 'Neue Seite anlegen',
 135+ 'createpage-title-additional' => 'Diese Seite existiert noch nicht. Um einen neuen Artikel zu erstellen, fülle das untenstehende Formular aus.',
 136+ 'createpage-title-caption' => 'Seitentitel:',
 137+ 'createpage-choose-createplate' => 'Wähle einen Seitentyp',
 138+ 'createpage-button-createplate-submit' => 'Diese Vorlage laden',
 139+ 'createpage-give-title' => 'Gib bitte einen Titel an',
 140+ 'createpage-title-invalid' => 'Gib bitte einen gültigen Titel an',
 141+ 'createpage-article-exists' => 'Diese Seite existiert bereits. Bearbeite',
 142+ 'createpage-article-exists2' => 'oder gib einen neuen Titel an.',
 143+ 'createpage-advanced-warning' => 'Der Wechsel des Editors kann die Formatierung der Seite stören - trotzdem fortfahren?',
 144+ 'createpage-login-warning' => 'Wenn du dich jetzt anmeldest, verlierst du möglicherweise deinen noch nicht gespeicherten Text. Trotzdem fortfahren?',
 145+ 'createpage-yes' => 'Ja',
 146+ 'createpage-no' => 'Nein',
 147+ 'createpage-categories' => 'Kategorien:',
 148+ 'createpage-addcategory' => 'Kategorie hinzufügen',
 149+ 'createpage-top-of-page' => 'Seitenanfang',
 150+ 'createpage-uploaded-from' => 'Upload via Special:CreatePage',
 151+ 'createplate-list' => 'Blank|Leer',
 152+ 'createplate-Blank' => '<!---blanktemplate--->
 153+
 154+Füge hier Text ein',
 155+ 'createpage-title-check-header' => 'Du musst warten, bis der Namen überprüft wurde. Klicke dann erneut auf den Knopf zum fortfahren.',
 156+ 'createpage-img-uploaded' => 'Bild erfolgreich hochgeladen',
 157+ 'createpage-preview-end' => 'Ende der Vorschau. Du kannst jetzt unten mit deine Bearbeitung fortsetzen:',
 158+ 'createpage-insert-image' => 'Bild einfügen',
 159+ 'createpage-upload-aborted' => 'Einfügung des Bildes abgebrochen',
 160+ 'createpage-initial-run' => 'Zur Bearbeitung',
 161+ 'createpage-login-required' => 'Du musst dich',
 162+ 'createpage-login-href' => 'anmelden',
 163+ 'createpage-login-required2' => 'um Bilder hochzuladen',
 164+ 'createpage-please-wait' => 'Bitte warten...',
 165+ 'createpage-upload-directory-read-only' => 'Das Upload-Verzeichnis konnte nicht vom Webserver beschrieben werden',
 166+ 'createpage-about-info' => 'Dies ist der vereinfachte Editor. Weitere Informationen darüber findest du im [[w:c:de:Hilfe:Createpage|hier]].',
 167+ 'createpage-advanced-text' => 'Dir steht auch ein $1 zur Verfügung.',
 168+ 'createpage-advanced-edit' => 'erweiterter Editor',
 169+ 'createpage-optionals-text' => 'Füge optionale Abschnitte hinzu',
 170+);
 171+
 172+/** Greek (Ελληνικά)
 173+ * @author Περίεργος
 174+ */
 175+$messages['el'] = array(
 176+ 'createpage-edit-normal' => 'Πρηγμένη Επεξεργασία',
 177+ 'createpage-upload' => 'Φόρτωση εικόνας',
 178+ 'createpage-hide' => 'Απόκρυψη',
 179+ 'createpage-show' => 'Εμφάνιση',
 180+ 'createpage' => 'Δημιουργήστε ένα καινούργιο άρθρο',
 181+ 'createpage-title' => 'Δημιουργήστε ένα καινούργιο άρθρο',
 182+ 'createpage-title-additional' => "Έχετε ακολουθήσει ένα σύνδεσμο σε μια σελίδα που δεν υπάρχει προς το παρών. Για να τη δημιουργήσετε, ξεκινήστε να πληκρολογείτε στο παρακάτω πλαίσιο",
 183+ 'createpage-title-caption' => 'Τίτλος Άρθρου',
 184+ 'createpage-choose-createplate' => 'Διαλέξτε έναν τύπο σελίδας',
 185+ 'createpage-button-createplate-submit' => 'Φόρτωση αυτού του προτύπου',
 186+ 'createpage-give-title' => 'Παρακαλώ προσδιορίστε έναν τίτλο',
 187+ 'createpage-title-invalid' => 'Παρακαλώ προσδιορίστε έναν έγκυρο τίτλο',
 188+ 'createpage-article-exists' => 'Αυτό το άρθρο υπάρχει ήδη. Επεξεργαστείτε το',
 189+ 'createpage-article-exists2' => ' ή προσδιορίστε άλλον τίτλο.',
 190+ 'createpage-advanced-warning' => 'Με την αλλαγή του τρόπου επεξεργασίας ίσως χαλάσει η μορφοποίηση της σελίδας, θέλετε να συνεχίσετε;',
 191+ 'createpage-login-warning' => 'Αν συνδεθείτε τώρα, ίσως χάσετε όσο κείμενο σας δεν έχει αποθηκευτεί. Θέλετε να συνεχίσετε;',
 192+ 'createpage-infobox-legend' => 'Κουτί πληροφοριών',
 193+ 'createpage-yes' => 'Ναι',
 194+ 'createpage-no' => 'Όχι',
 195+ 'createpage-categories' => 'Κατηγορίες',
 196+ 'createpage-addcategory' => 'Προσθήκη κατηγορίας',
 197+ 'createpage-top-of-page' => 'Πάνω μέρος της σελίδας',
 198+ 'createpage-title-check-header' => 'Υποχρεωτικός έλεγχος τίτλου',
 199+ 'createpage-img-uploaded' => 'Η εικόνα φορτωθηκε επιτυχώς',
 200+ 'createpage-preview-end' => 'Τέλος της προεπισκόπησης. Μπορείτε να επανέλθετε στην επεξεργασία σας παρακάτω:',
 201+ 'createpage-insert-image' => 'Εισαγωγή εικόνας',
 202+ 'createpage-upload-aborted' => 'Ακυρώθηκε η εισαγωγή της εικόνας',
 203+ 'createpage-initial-run' => 'Για επεξεργασία συνεχίστε',
 204+ 'createpage-login-required' => 'Χρειάζεται να ',
 205+ 'createpage-login-href' => ' συνδεθείτε ',
 206+ 'createpage-login-required2' => 'για να φορτώσετε εικόνες',
 207+ 'createpage-please-wait' => 'Παρακαλώ περιμένετε ...',
 208+ 'createpage-upload-directory-read-only' => 'Ο κατάλογος φορτώσεων δεν είναι εγγράψιμος από το διακομιστή',
 209+ 'headline-tip-3' => 'Επικεφαλίδα επιπέδου 3',
 210+ 'createpage-advanced-text' => 'Μπορείτε επίσης να χρησιμοποιήσετε το $ 1.',
 211+ 'createpage-advanced-edit' => 'προηγμένος συντάκτης',
 212+ 'createpage-optionals-text' => 'Βάλτε προαιρετικά τμήματα:',
 213+);
 214+
 215+/** Spanish (Español) */
 216+$messages['es'] = array(
 217+ 'createpage-edit-normal' => 'Edición avanzada',
 218+ 'createpage-upload' => 'Subir una imagen',
 219+ 'createpage-hide' => 'Ocultar',
 220+ 'createpage-show' => 'Mostrar',
 221+ 'createpage' => 'Crear un nuevo artículo',
 222+ 'createpage-title' => 'Crear un nuevo artículo',
 223+ 'createpage-title-additional' => 'Has seguido un vínculo a una página que no existe. Para crear la página, comienza a escribir en la caja de debajo',
 224+ 'createpage-title-caption' => 'Título:',
 225+ 'createpage-choose-createplate' => 'Escoge un tipo de página',
 226+ 'createpage-button-createplate-submit' => 'Carga esta plantilla',
 227+ 'createpage-give-title' => 'Por favor, especifica un título',
 228+ 'createpage-title-invalid' => 'Por favor especifica un título valido',
 229+ 'createpage-article-exists' => 'Este artículo ya existe. Edítalo',
 230+ 'createpage-article-exists2' => 'o especifica otro título.',
 231+ 'createpage-advanced-warning' => 'Cambiar el modo de edición puede romper el formato de la página, ¿quieres continuar?',
 232+ 'createpage-login-warning' => 'Identificándote ahora, podrías perder todo el texto que no haya sido guardado. ¿Quieres continuar?',
 233+ 'createpage-yes' => 'Sí',
 234+ 'createpage-categories' => 'Categorías:',
 235+ 'createpage-top-of-page' => 'Parte superior de la página',
 236+ 'createpage-uploaded-from' => 'Subida desde Special:CreatePage',
 237+ 'createplate-Blank' => '<!---blanktemplate--->
 238+
 239+Inserta texto aquí',
 240+ 'createpage-title-check-header' => 'Comprobación del título obligada',
 241+ 'createpage-title-check-text' => 'No puedes realizar ninguna acción hasta que la comprobación del título haya finalizado. Por favor haz click de nuevo en el botón de acción para continuar.',
 242+ 'createpage-img-uploaded' => 'Imagen cargada con éxito',
 243+ 'createpage-preview-end' => 'Final de la previsualización. Puedes resumir tu edición debajo.',
 244+ 'createpage-insert-image' => 'Insertar Imagen',
 245+ 'createpage-upload-aborted' => 'La inserción de la imagen fue cancelada',
 246+ 'createpage-initial-run' => 'Proceder a editar',
 247+ 'createpage-login-required' => 'Necesitas',
 248+ 'createpage-login-href' => 'estar identificado',
 249+ 'createpage-login-required2' => 'para subir imágenes',
 250+ 'createpage-please-wait' => 'Por favor, espere...',
 251+ 'createpage-upload-directory-read-only' => 'El directorio de subida no se puede escribir por el servidor de la web',
 252+ 'createpage-about-info' => 'Este es un editor simplificado. Para saber más ve a la [[s:Help:CreatePage|Hub de ShoutWiki]].',
 253+ 'createpage-advanced-text' => 'Puedes usar también el $1.',
 254+ 'createpage-advanced-edit' => 'editor avanzado',
 255+ 'tog-createpage-redlinks' => 'Usa <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">CreatePage</a> cuando sigas enlaces rotos',
 256+);
 257+
 258+/** Persian (فارسی) */
 259+$messages['fa'] = array(
 260+ 'createpage' => 'ایجاد مقالۀ جدید',
 261+ 'createpage-title' => 'ایجاد مقالۀ جدید',
 262+ 'createpage-title-caption' => 'نام',
 263+ 'createpage-categories' => 'رده‌ها:',
 264+);
 265+
 266+/** Finnish (Suomi)
 267+ * @author Jack Phoenix <jack@countervandalism.net>
 268+ */
 269+$messages['fi'] = array(
 270+ 'createpage-edit-normal' => 'Kehittynyt muokkaus',
 271+ 'createpage-upload' => 'Tallenna kuva',
 272+ 'createpage-hide' => 'Piilota',
 273+ 'createpage-show' => 'Näytä',
 274+ 'createpage' => 'Luo uusi artikkeli',
 275+ 'createpage-title' => 'Luo uusi artikkeli',
 276+ 'createpage-title-additional' => 'Olet seurannut linkkiä sivulle, jota ei ole vielä olemassa. Aloita kirjoittaminen allaolevaan laatikkoon luodaksesi sivun',
 277+ 'createpage-title-caption' => 'Artikkelin otsikko',
 278+ 'createpage-choose-createplate' => 'Valitse sivun tyyppi',
 279+ 'createpage-button-createplate-submit' => 'Lataa tämä malline',
 280+ 'createpage-give-title' => 'Anna otsikko',
 281+ 'createpage-title-invalid' => 'Anna kelvollinen otsikko',
 282+ 'createpage-article-exists' => 'Tämä artikkeli on jo olemassa. Muokkaa artikkelia',
 283+ 'createpage-article-exists2' => ' tai anna toinen otsikko.',
 284+ 'createpage-advanced-warning' => 'Muokkaustilojen vaihtaminen saattaa rikkoa sivun muotoilun, haluatko jatkaa?',
 285+ 'createpage-login-warning' => 'Kirjautumalla sisään nyt saatat menettää kaiken tallentamattoman tekstin. Haluatko jatkaa?',
 286+ 'createpage-infobox-legend' => 'Tietolaatikko',
 287+ 'createpage-yes' => 'Kyllä',
 288+ 'createpage-no' => 'Ei',
 289+ 'createpage-categories' => 'Luokat',
 290+ 'createpage-addcategory' => 'Lisää luokka',
 291+ 'createpage-top-of-page' => 'Sivun yläosa',
 292+ 'createpage-uploaded-from' => 'Tallennettu Special:CreatePage-toimintosivun kautta',
 293+ 'createplate-list' => 'Blank|Tyhjä',
 294+ 'createpage-title-check-header' => 'Otsikon tarkastus on pakollinen',
 295+ 'createpage-title-check-text' => 'Et voi tehdä mitään ennen kuin otsikon tarkastus on päättynyt. Napsauta painiketta jälleen jatkaaksesi.',
 296+ 'createpage-img-uploaded' => 'Kuva tallennettu onnistuneesti',
 297+ 'createpage-preview-end' => 'Esikatselun loppu. Voit jatkaa muokkaamistasi alempana:',
 298+ 'createpage-insert-image' => 'Lisää kuva',
 299+ 'createpage-upload-aborted' => 'Kuvan lisääminen peruuttiin',
 300+ 'createpage-initial-run' => 'Jatka muokkaamiseen',
 301+ 'createpage-login-required' => 'Sinun tulee ',
 302+ 'createpage-login-href' => ' kirjautua sisään ',
 303+ 'createpage-login-required2' => 'tallentaaksesi kuvia',
 304+ 'createpage-please-wait' => 'Odota...',
 305+ 'createpage-upload-directory-read-only' => 'Web-palvelin ei voi kirjoittaa tallennuskansioon',
 306+ 'headline-tip-3' => 'Kolmostason otsikko',
 307+ 'createpage-about-info' => 'Tämä on yksinkertaistettu editori. Katso [[s:w:fi:Ohje:CreatePage|ShoutWikin ohjeista]] saadaksesi lisätietoja.',
 308+ 'createpage-advanced-text' => 'Voit myös käyttää $1.',
 309+ 'createpage-advanced-edit' => 'kehittynyttä editoria',
 310+ 'createpage-optionals-text' => 'Lisää vapaaehtoisia osioita:',
 311+ 'createpage-save' => 'Tallenna',
 312+ 'tog-createpage-redlinks' => 'Käytä <a href="http://fi.shoutwiki.com/wiki/Ohje:CreatePage">CreatePagea</a> rikkinäisiä linkkejä seuratessa',
 313+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*tietolaatikko.*\}\}/is',
 314+);
 315+
 316+/** French (Français)
 317+ * @author Alexandre Emsenhuber
 318+ * @author Jack Phoenix <jack@countervandalism.net>
 319+ * @author Peter17
 320+ */
 321+$messages['fr'] = array(
 322+ 'createpage-edit-normal' => 'Modification avancée',
 323+ 'createpage-upload' => 'Importer une image',
 324+ 'createpage-hide' => 'Masquer',
 325+ 'createpage-show' => 'Afficher',
 326+ 'createpage' => 'Créer un nouvel article',
 327+ 'createpage-title' => 'Créer un nouvel article',
 328+ 'createpage-title-additional' => "Vous avez suivi un lien vers une page qui n'existe pas. Pour créer cette page, commencer à taper dans la boîte ci-dessous",
 329+ 'createpage-title-caption' => "Titre de l'article",
 330+ 'createpage-choose-createplate' => 'Choisissez un type de page',
 331+ 'createpage-button-createplate-submit' => 'Charger le modèle',
 332+ 'createpage-give-title' => 'Spécifiez un titre',
 333+ 'createpage-title-invalid' => 'Spécifiez un titre valide',
 334+ 'createpage-article-exists' => 'Cet article existe déjà. Modifier',
 335+ 'createpage-article-exists2' => ' ou spécifiez un autre titre.',
 336+ 'createpage-advanced-warning' => "Basculer entre les modes de modification peut casser l'affichage de la page, voulez-vous continuer ?",
 337+ 'createpage-login-warning' => 'En vous connectant maintenant, vous pouvez perdre votre texte non sauvegardé. Voulez-vous continuer ?',
 338+ 'createpage-infobox-legend' => 'Infobox',
 339+ 'createpage-yes' => 'Oui',
 340+ 'createpage-no' => 'Non',
 341+ 'createpage-categories' => 'Catégories :',
 342+ 'createpage-addcategory' => 'Ajouter une catégorie',
 343+ 'createpage-top-of-page' => 'Haut de la page',
 344+ 'createpage-uploaded-from' => 'Importé depuis Special:CreatePage',
 345+ 'createplate-list' => 'Blank|Vide',
 346+ 'createpage-title-check-header' => 'Vérification du titre forcée',
 347+ 'createpage-title-check-text' => "Vous ne pouvez rien faire tant que la vérification du titre n'est pas terminée. Pour ce faire, veuillez cliquer à nouveau sur le bouton d'action.",
 348+ 'createpage-img-uploaded' => 'Image importée avec succès',
 349+ 'createpage-preview-end' => 'Fin de la prévisualisation. Vous pouvez reprendre votre modification ci-dessous :',
 350+ 'createpage-insert-image' => 'Insérer un image',
 351+ 'createpage-upload-aborted' => "L'insertion de l'image a été annulée",
 352+ 'createpage-initial-run' => 'Procéder à la modification',
 353+ 'createpage-login-required' => 'Vous devez ',
 354+ 'createpage-login-href' => ' vous connecter ',
 355+ 'createpage-login-required2' => 'pour importer des images',
 356+ 'createpage-please-wait' => 'Veuillez patienter...',
 357+ 'createpage-upload-directory-read-only' => "Le dossier d'import n'est pas inscriptible par le serveur web",
 358+ 'headline-tip-3' => 'Titre de niveau 3',
 359+ 'createpage-about-info' => "Ceci est l'éditeur simplifié. Pour en savoir plus, allez sur [[s:Help:CreatePage|ShoutWiki Hub]].",
 360+ 'createpage-advanced-text' => "Vous pouvez également utiliser l'$1.",
 361+ 'createpage-advanced-edit' => 'éditeur avancé',
 362+ 'createpage-optionals-text' => 'Ajouter des sections optionnelles :',
 363+ 'createpage-save' => 'Sauvegarde',
 364+ 'tog-createpage-redlinks' => 'Utiliser <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">CreatePage</a> après avoir suivi des liens cassés',
 365+);
 366+
 367+/** Galician (Galego)
 368+ * @author Toliño
 369+ */
 370+$messages['gl'] = array(
 371+ 'createpage-edit-normal' => 'Edición avanzada',
 372+ 'createpage-upload' => 'Cargar unha imaxe',
 373+ 'createpage-hide' => 'Agochar',
 374+ 'createpage-show' => 'Mostrar',
 375+ 'createpage' => 'Crear un novo artigo',
 376+ 'createpage-title' => 'Crear un novo artigo',
 377+ 'createpage-title-additional' => 'Seguiu unha ligazón cara a unha páxina que aínda non existe. Para crear a páxina, comece escribindo na caixa de embaixo',
 378+ 'createpage-title-caption' => 'Título do artigo',
 379+ 'createpage-choose-createplate' => 'Escolla un tipo de páxina',
 380+ 'createpage-button-createplate-submit' => 'Cargar este modelo',
 381+ 'createpage-give-title' => 'Por favor, especifique un título',
 382+ 'createpage-title-invalid' => 'Por favor, especifique un título válido',
 383+ 'createpage-article-exists' => 'Este artigo xa existe. Edite',
 384+ 'createpage-article-exists2' => ' ou especifique outro título.',
 385+ 'createpage-advanced-warning' => 'A alternancia entre modos de edición pode estragar o formato da páxina, quere continuar?',
 386+ 'createpage-login-warning' => 'Se accede ao sistema nestes intres, pode perder todo o texto non gardado. Quere continuar?',
 387+ 'createpage-infobox-legend' => 'Caixa de información',
 388+ 'createpage-yes' => 'Si',
 389+ 'createpage-no' => 'Non',
 390+ 'createpage-categories' => 'Categorías',
 391+ 'createpage-addcategory' => 'Engadir unha categoría',
 392+ 'createpage-top-of-page' => 'Alto da páxina',
 393+ 'createpage-uploaded-from' => 'Cargado desde Special:CreatePage',
 394+ 'createpage-title-check-header' => 'Comprobación do título forzada',
 395+ 'createpage-img-uploaded' => 'A imaxe cargouse con éxito',
 396+ 'createpage-preview-end' => 'Fin da vista previa. Pode continuar coa súa edición a continuación:',
 397+ 'createpage-insert-image' => 'Inserir unha imaxe',
 398+ 'createpage-upload-aborted' => 'A inserción da imaxe foi cancelada',
 399+ 'createpage-initial-run' => 'Continuar a editar',
 400+ 'createpage-login-required' => 'Necesita ',
 401+ 'createpage-login-href' => ' acceder ao sistema ',
 402+ 'createpage-login-required2' => 'para cargar imaxes',
 403+ 'createpage-please-wait' => 'Por favor, agarde...',
 404+ 'createpage-upload-directory-read-only' => 'O servidor non pode escribir no directorio de cargas',
 405+ 'createpage-about-info' => 'Este é o editor simplificado. Para saber máis olla a [[s:Help:CreatePage|ShoutWiki Hub]].',
 406+ 'createpage-advanced-text' => 'Tamén pode usar o $1.',
 407+ 'createpage-advanced-edit' => 'editor avanzado',
 408+ 'createpage-optionals-text' => 'Engadir seccións opcionais:',
 409+);
 410+
 411+/** Hungarian (Magyar)
 412+ * @author Glanthor Reviol
 413+ */
 414+$messages['hu'] = array(
 415+ 'createpage-hide' => 'Elrejtés',
 416+ 'createpage-show' => 'Megjelenítés',
 417+ 'createpage-yes' => 'Igen',
 418+ 'createpage-no' => 'Nem',
 419+ 'createpage-categories' => 'Kategóriák',
 420+ 'createpage-addcategory' => 'Kategória hozzáadása',
 421+ 'createpage-login-href' => ' bejelentkezés ',
 422+);
 423+
 424+/** Japanese (日本語) */
 425+$messages['ja'] = array(
 426+ 'createpage-edit-normal' => '通常の編集',
 427+ 'createpage-hide' => '非表示',
 428+ 'createpage-show' => '表示',
 429+ 'createpage' => '新規記事を作成',
 430+ 'createpage-title' => '新規記事を作成',
 431+ 'createpage-title-additional' => '作成する記事のタイプを選択し、入力欄にタイトルを入力してください。',
 432+ 'createpage-title-caption' => 'タイトル:',
 433+ 'createpage-title-invalid' => '有効なタイトルを指定してください',
 434+ 'createpage-login-warning' => '今ログインすると保存されていないテキストは失われます。続けますか?',
 435+ 'createpage-yes' => 'はい',
 436+ 'createpage-no' => 'いいえ',
 437+ 'createpage-categories' => 'カテゴリ:',
 438+ 'createpage-top-of-page' => 'ページトップ',
 439+ 'createpage-uploaded-from' => '[[Special:CreatePage]]よりアップロード',
 440+ 'createplate-list' => 'Blank|白紙',
 441+ 'createplate-Blank' => '<!---blanktemplate--->
 442+
 443+ここにテキストを入力してください。',
 444+ 'createpage-title-check-text' => 'タイトルのチェックが完了しないと次へ進めません。続けるにはもう一度ボタンをクリックしてください。',
 445+ 'createpage-preview-end' => 'プレビューはここまでです。以下で編集を継続できます。',
 446+ 'createpage-insert-image' => '画像を挿入',
 447+ 'createpage-initial-run' => '編集を開始',
 448+ 'createpage-login-required' => '画像をアップロードするには',
 449+ 'createpage-login-href' => 'ログイン',
 450+ 'createpage-login-required2' => 'する必要があります',
 451+ 'createpage-please-wait' => 'お待ちください...',
 452+ 'createpage-about-info' => 'シンプルなエディタです。詳細は、ウィキアのヘルプをどうぞ。',
 453+);
 454+
 455+/** Macedonian (Македонски)
 456+ * @author Bjankuloski06
 457+ */
 458+$messages['mk'] = array(
 459+ 'createpage-edit-normal' => 'Напредно уредување',
 460+ 'createpage-upload' => 'Подигни слика',
 461+ 'createpage-hide' => 'Сокриј',
 462+ 'createpage-show' => 'Прикажи',
 463+ 'createpage' => 'Создај нова статија',
 464+ 'createpage-title' => 'Создај нова статија',
 465+ 'createpage-title-additional' => 'Проследивте врска до статија која сè уште не постои. За да ја создадете, почнете да пишувате во полето подолу',
 466+ 'createpage-title-caption' => 'Наслов на статијата',
 467+ 'createpage-choose-createplate' => 'Изберете тип на страница',
 468+ 'createpage-button-createplate-submit' => 'Вчитај го шаблонов',
 469+ 'createpage-give-title' => 'Назначете наслов',
 470+ 'createpage-title-invalid' => 'Назначете важечки наслов',
 471+ 'createpage-article-exists' => 'Оваа статија веќе постои. Уредете ја',
 472+ 'createpage-article-exists2' => ' или назначете друг наслов.',
 473+ 'createpage-advanced-warning' => 'Префрлањето од еден на друг режим на уредување може да го поремети форматирањето на страницата. Дали сакате да продолжите?',
 474+ 'createpage-login-warning' => 'Ако сега се најавите ќе го загубите сиот незачуван текст. Сакате да продолжите?',
 475+ 'createpage-infobox-legend' => 'Инфокутија',
 476+ 'createpage-yes' => 'Да',
 477+ 'createpage-no' => 'Не',
 478+ 'createpage-categories' => 'Категории',
 479+ 'createpage-addcategory' => 'Додај категорија',
 480+ 'createpage-top-of-page' => 'Врв на страницата',
 481+ 'createpage-uploaded-from' => 'Подигнато преку Special:CreatePage',
 482+ 'createpage-title-check-header' => 'Проверката на наслови е во сила',
 483+ 'createpage-title-check-text' => 'Не можете да извршите дејство сè додека не заврши проверката на насловот. Кликнете повторно на копчето за дејството за да продолжите.',
 484+ 'createpage-img-uploaded' => 'Сликата е успешно подигната',
 485+ 'createpage-preview-end' => 'Крај на прегледот. Можете да продолжите со уредувањето подолу:',
 486+ 'createpage-insert-image' => 'Вметни слика',
 487+ 'createpage-upload-aborted' => 'Вметнувањето на слика е откажано',
 488+ 'createpage-initial-run' => 'Продолжете кон уредувањето',
 489+ 'createpage-login-required' => 'Треба да ',
 490+ 'createpage-login-href' => ' се најавите ',
 491+ 'createpage-login-required2' => 'да подигнете слики',
 492+ 'createpage-please-wait' => 'Почекајте...',
 493+ 'createpage-upload-directory-read-only' => 'Директориумот за подигање не е достапен за записи од веб-серверот',
 494+ 'headline-tip-3' => 'Наслов - Ниво 3',
 495+ 'createpage-about-info' => 'Ова е упростен уредник. За да дознаете повеќе, одете на [[s:Help:CreatePage|Помош со ShoutWiki]].',
 496+ 'createpage-advanced-text' => 'Можете да користите и $1.',
 497+ 'createpage-advanced-edit' => 'напреден уредник',
 498+ 'createpage-optionals-text' => 'Додај дополнителни делови:',
 499+ 'tog-createpage-redlinks' => 'Користи <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">СоздајСтраница</a> кога следам прекинати врски',
 500+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*Инфокутија.*\}\}/is',
 501+);
 502+
 503+/** Dutch (Nederlands)
 504+ * @author Siebrand Mazeland
 505+ * @author Mitchel Corstjens
 506+ */
 507+$messages['nl'] = array(
 508+ 'createpage-edit-normal' => 'Uitgebreid bewerken',
 509+ 'createpage-upload' => 'Afbeelding uploaden',
 510+ 'createpage-hide' => 'Verbergen',
 511+ 'createpage-show' => 'Weergeven',
 512+ 'createpage' => 'Nieuwe pagina aanmaken',
 513+ 'createpage-title' => 'Nieuwe pagina aanmaken',
 514+ 'createpage-title-additional' => 'U hebt een verwijzing gevolgd naar een pagina die niet bestaat. Geef uw invoer in de velden hieronder om te pagina aan te maken.',
 515+ 'createpage-title-caption' => 'Paginanaam',
 516+ 'createpage-choose-createplate' => 'Kies een paginatype',
 517+ 'createpage-button-createplate-submit' => 'Dit sjabloon laden',
 518+ 'createpage-give-title' => 'Geef een naam op',
 519+ 'createpage-title-invalid' => 'Geef een geldige paginanaam op',
 520+ 'createpage-article-exists' => 'Deze pagina bestaat al. Bewerk',
 521+ 'createpage-article-exists2' => ' of geef een andere paginaam op.',
 522+ 'createpage-advanced-warning' => 'Door het wisselen van tekstverwerker kunt u de paginaopmaak stuk maken. Wilt u doorgaan?',
 523+ 'createpage-login-warning' => 'Door nu aan te melden kunt u alle wijzigingen die niet zijn opgeslagen kwijt raken. Wilt u doorgaan?',
 524+ 'createpage-infobox-legend' => 'Informatievenster',
 525+ 'createpage-yes' => 'Ja',
 526+ 'createpage-no' => 'Nee',
 527+ 'createpage-categories' => 'Categorieën',
 528+ 'createpage-addcategory' => 'Categorie toevoegen',
 529+ 'createpage-top-of-page' => 'Bovenaan pagina',
 530+ 'createpage-uploaded-from' => 'Geüpload vanuit Special:CreatePage',
 531+ 'createplate-list' => 'Blank|Leeg',
 532+ 'createpage-title-check-header' => 'Paginanaamcontrole wordt uitgevoerd',
 533+ 'createpage-title-check-text' => 'U kunt geen handelingen verrichten tot dat naamcontrole is uitgevoerd. Klik nogmaals op de knop voor de handeling om door te gaan.',
 534+ 'createpage-img-uploaded' => 'De afbeelding is geüpload',
 535+ 'createpage-preview-end' => 'Einde van de voorvertoning. U kunt hieronder doorgaan met bewerken:',
 536+ 'createpage-insert-image' => 'Afbeelding invoegen',
 537+ 'createpage-upload-aborted' => 'Het invoegen van de afbeelding is afgebroken',
 538+ 'createpage-initial-run' => 'Doorgaan naar bewerken',
 539+ 'createpage-login-required' => 'U moet ',
 540+ 'createpage-login-href' => ' aanmelden ',
 541+ 'createpage-login-required2' => 'om afbeeldingen te uploaden',
 542+ 'createpage-please-wait' => 'Even geduld alstublieft...',
 543+ 'createpage-upload-directory-read-only' => 'Er kan niet geschreven worden in de uploadmap van de webserver',
 544+ 'headline-tip-3' => 'Niveau 3 koptekst',
 545+ 'createpage-about-info' => 'Dit is de vereenvoudigde tekstverwerker. Meer hulp is te vinden in [[s:Help:CreatePage|ShoutWiki Hub]].',
 546+ 'createpage-advanced-text' => 'U kunt ook de $1 gebruiken.',
 547+ 'createpage-advanced-edit' => 'uitgebreide tekstverwerker',
 548+ 'createpage-optionals-text' => 'Optionele secties toevoegen:',
 549+ 'createpage-save' => 'Opslaan',
 550+ 'tog-createpage-redlinks' => 'Gebruik <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">pagina aanmaken</a> als u verbroken verwijzigen volgt',
 551+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*Informatievenster.*\}\}/is',
 552+);
 553+
 554+/** Polish (Polskie)
 555+ * @author Bartek Łapiński
 556+ * @author Łukasz Garczewski
 557+ * @author Przemek Piotrowski
 558+ */
 559+$messages['pl'] = array(
 560+ 'createpage-edit-normal' => 'Edytor zaawansowany',
 561+ 'createpage-upload' => 'Załaduj obrazek',
 562+ 'createpage-hide' => 'Ukryj',
 563+ 'createpage' => 'Stwórz Stronę',
 564+ 'createpage-title' => 'Stwórz Stronę',
 565+ 'createpage-title-caption' => 'Tytuł',
 566+ 'createpage-choose-createplate' => 'Wybierz typ strony',
 567+ 'createpage-button-createplate-submit' => 'Załaduj ten szablon',
 568+ 'createpage-give-title' => 'Proszę podać tytuł',
 569+ 'createpage-title-invalid' => 'Proszę podać poprawny tytuł',
 570+ 'createpage-article-exists' => 'Ten artykuł już istnieje. Edytuj ',
 571+ 'createpage-article-exists2' => ' lub podaj inny tytuł',
 572+ 'createpage-advanced-warning' => 'Zmiana trybu edycji może spowodować utratę formatowania, czy chcesz kontynuować?',
 573+ 'createpage-login-warning' => 'Logowanie w tej chwili może spowodować utratę niezapisanych danych. Czy chcesz kontynuować?',
 574+ 'createpage-infobox-legend' => 'Infobox',
 575+ 'createpage-yes' => 'Tak',
 576+ 'createpage-no' => 'Nie',
 577+ 'createpage-categories' => 'Kategorie',
 578+ 'createpage-addcategory' => 'Dodaj kategorię',
 579+ 'createpage-top-of-page' => 'Początek strony',
 580+ 'createpage-uploaded-from' => 'Załadowane z Special:CreatePage',
 581+ 'createplate-list' => 'Blank|Pusty',
 582+ 'createpage-title-check-header' => 'Konieczne dokończenie sprawdzania tytułu',
 583+ 'createpage-title-check-text' => 'Nie możesz dokończyć obecnej akcji, zanim nie zakończy się procedura sprawdzania tytułu. Naciśnij jeszcze raz przycisk akcji, by ją dokończyć.',
 584+ 'createpage-img-uploaded' => 'Obrazek został załadowany',
 585+ 'createpage-preview-end' => 'Koniec podglądu. Możesz kontynuować tworzenie artykułu poniżej',
 586+ 'createpage-insert-image' => 'Wstaw Obrazek',
 587+ 'createpage-upload-aborted' => 'Wstawianie obrazka zostało anulowane',
 588+ 'createpage-initial-run' => 'Przejdź do edycji',
 589+ 'createpage-login-required' => 'Musisz ',
 590+ 'createpage-login-href' => ' zalogować się ',
 591+ 'createpage-login-required2' => 'by ładować obrazki',
 592+ 'createpage-please-wait' => 'Proszę czekać...',
 593+ 'createpage-upload-directory-read-only' => 'Katalog ładowania obrazków nie jest zapisywalny przez serwer',
 594+ 'headline-tip-3' => 'Nagłówek poziom 3',
 595+ 'createpage-about-info' => 'Jesteś w uproszczonym edytorze. Więcej informacji o nim znajdziesz na [[s:Help:CreatePage|ShoutWiki Hub]].',
 596+ 'createpage-advanced-text' => 'Możesz też użyć $1',
 597+ 'createpage-advanced-edit' => 'zaawansowanego edytora',
 598+ 'createpage-optionals-text' => 'Dodaj opcjonalne sekcje:',
 599+ 'tog-createpage-redlinks' => 'Otwórz <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">CreatePage\'a</a> po przejściu do nieistniejącej strony'
 600+);
 601+
 602+/** Piedmontese (Piemontèis)
 603+ * @author Dragonòt
 604+ */
 605+$messages['pms'] = array(
 606+ 'createpage-edit-normal' => 'Modìfiche Avansà',
 607+ 'createpage-upload' => 'Carié figura',
 608+ 'createpage-hide' => 'Stërmé',
 609+ 'createpage-show' => 'Mosté',
 610+ 'createpage' => 'Creé un neuv artìcol',
 611+ 'createpage-title' => 'Creé un neuv artìcol',
 612+ 'createpage-title-additional' => "It ses andàit daré a na pàgina ch'a esist pa ancó. Për creé la pàgina, ancamin-a a scrive ant la forma sota",
 613+ 'createpage-title-caption' => "Tìtol ëd l'artìcol",
 614+ 'createpage-choose-createplate' => 'Sern na sòrt ëd pàgina',
 615+ 'createpage-button-createplate-submit' => 'Caria sto stamp-sì',
 616+ 'createpage-give-title' => 'Për piasì spessìfica un tìtol',
 617+ 'createpage-title-invalid' => 'Për piasì spessìfica un tìtol bon',
 618+ 'createpage-article-exists' => 'Sto artìcol-sì a esist già. Modìfica',
 619+ 'createpage-article-exists2' => " o spessìfica n'àutr tìtol.",
 620+ 'createpage-advanced-warning' => 'Cangé manera ëd modifiché a peul rompe la formatassion ëd la pàgina, it veus-to continué?',
 621+ 'createpage-login-warning' => 'An intrand adess, it peule perde tut tò test pa salvà. It veus-to continué?',
 622+ 'createpage-infobox-legend' => 'Infobox',
 623+ 'createpage-yes' => 'É',
 624+ 'createpage-no' => 'Nò',
 625+ 'createpage-categories' => 'Categorìe',
 626+ 'createpage-addcategory' => 'Gionta categorìa',
 627+ 'createpage-top-of-page' => 'Testa dla pàgina',
 628+ 'createpage-uploaded-from' => 'Carià da Special:CreatePage',
 629+ 'createpage-title-check-header' => 'Contròl ëd tìtol forsà',
 630+ 'createpage-title-check-text' => "It peule pa fé n'assion fin che ël contròl ëd tìtol a sia finì. Për piasì sgnaca torna an sël boton ëd l'assion për andé anans.",
 631+ 'createpage-img-uploaded' => 'Figura carià da bin',
 632+ 'createpage-preview-end' => 'Fin ëd la previsualisassion. It peule arcominsé toe modìfiche sota:',
 633+ 'createpage-insert-image' => 'Ansëriss Figura',
 634+ 'createpage-upload-aborted' => "Figura ansërìa a l'é stàita scanselà",
 635+ 'createpage-initial-run' => 'Va anans a modifiché',
 636+ 'createpage-login-required' => 'It deuve ',
 637+ 'createpage-login-href' => ' rintré ant ël sistema ',
 638+ 'createpage-login-required2' => 'për carié figure',
 639+ 'createpage-please-wait' => 'Për piasì speta...',
 640+ 'createpage-upload-directory-read-only' => 'Ël webserver a-i la fa nen a scrive ansima a la directory ëd càrich.',
 641+ 'headline-tip-3' => 'Linea testà livel 3',
 642+ 'createpage-about-info' => "Sto sì a l'é l'editor semplificà. Për savèjne ëd pi va a [[s:Help:CreatePage|ShoutWiki Hub]].",
 643+ 'createpage-advanced-text' => 'It peule ëdcò dovré ël $1.',
 644+ 'createpage-advanced-edit' => 'editor avansà',
 645+ 'createpage-optionals-text' => 'Gionta session opsinaj:',
 646+ 'tog-createpage-redlinks' => 'Dòvra <a href="http://www.shoutwiki.com/wiki/Help:CreatePage">CreatePage</a> quand dré a colegament pa bon',
 647+);
 648+
 649+/** Portuguese (Português)
 650+ * @author Jesielt
 651+ */
 652+$messages['pt'] = array(
 653+ 'createpage-no' => 'Não',
 654+ 'createpage-yes' => 'Sim',
 655+);
 656+
 657+/** Brazilian Portuguese (Português do Brasil)
 658+ * @author Jesielt
 659+ */
 660+$messages['pt-br'] = array(
 661+ 'createpage-login-warning' => 'Ao fazer o login você irá perder todo o texto ainda não salvo. Deseja continuar ainda assim?',
 662+);
 663+
 664+/** Russian (Русский)
 665+ * @author Lockal
 666+ */
 667+$messages['ru'] = array(
 668+ 'createpage-addcategory' => 'Добавить категорию',
 669+ 'createpage-hide' => 'Скрыть',
 670+ 'createpage-show' => 'Показать',
 671+ 'createpage-insert-image' => 'Вставить изображение',
 672+ 'createpage-infobox-legend' => 'Карточка',
 673+ 'createpage-yes' => 'Да',
 674+ 'createpage-no' => 'Нет',
 675+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*Карточка.*\}\}/is',
 676+);
 677+
 678+/** Swedish (Svenska)
 679+ * @author Per
 680+ */
 681+$messages['sv'] = array(
 682+ 'createpage-upload' => 'Ladda upp en bild',
 683+ 'createpage-hide' => 'Göm',
 684+ 'createpage-show' => 'Visa',
 685+ 'createpage' => 'Skapa en ny artikel',
 686+ 'createpage-title' => 'Skapa en ny artikel',
 687+ 'createpage-title-caption' => 'Artikeltitel',
 688+ 'createpage-infobox-legend' => 'Inforuta',
 689+ 'createpage-yes' => 'Ja',
 690+ 'createpage-no' => 'Nej',
 691+ 'createpage-categories' => 'Kategorier',
 692+ 'createpage-addcategory' => 'Lägg till kategori',
 693+ 'createpage-top-of-page' => 'Överst på sidan',
 694+ 'createpage-insert-image' => 'Infoga bild',
 695+ 'createpage-login-required' => 'Du måste ',
 696+ 'createpage-please-wait' => 'Vänligen vänta...',
 697+ 'createpage-advanced-text' => 'Du kan också använda $1.',
 698+ 'createpage-advanced-edit' => 'avancerad editor',
 699+ 'createpage-template-infobox-format' => '/\{\{[^\{\}]*Inforuta.*\}\}/is',
 700+);
 701+
 702+/** Ukrainian (Українська)
 703+ * @author Prima klasy4na
 704+ */
 705+$messages['uk'] = array(
 706+ 'createpage-edit-normal' => 'Advanced Edit',
 707+ 'createpage-upload' => 'Завантажити зображення',
 708+ 'createpage-hide' => 'Сховати',
 709+ 'createpage-show' => 'Показати',
 710+ 'createpage' => 'Створити нову статтю',
 711+ 'createpage-title' => 'Створити нову статтю',
 712+ 'createpage-title-caption' => 'Назва статті',
 713+ 'createpage-yes' => 'Так',
 714+ 'createpage-no' => 'Ні',
 715+ 'createpage-categories' => 'Категорії',
 716+ 'createpage-addcategory' => 'Додати категорію',
 717+ 'createpage-login-required' => 'Вам необхідно ',
 718+ 'createpage-please-wait' => 'Будь ласка, зачекайте...',
 719+ 'createpage-advanced-text' => 'Ви можете також скористатись $1.',
 720+);
 721+
 722+/** Chinese (中文)
 723+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 724+ */
 725+$messages['zh'] = array(
 726+ 'createpage' => '發表新文章',
 727+ 'createpage-title' => '發表新文章',
 728+ 'createpage-title-caption' => '文章標題',
 729+ 'createpage-categories' => '分類:',
 730+);
 731+
 732+/** Chinese (PRC)‬ (‪中文(中国大陆)‬)
 733+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 734+ */
 735+$messages['zh-cn'] = array(
 736+ 'createpage' => '发表新文章',
 737+ 'createpage-title' => '发表新文章',
 738+ 'createpage-title-caption' => '文章标题',
 739+ 'createpage-categories' => '分类:',
 740+);
 741+
 742+/** Simplified Chinese (‪中文(简化字)‬)
 743+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 744+ */
 745+$messages['zh-hans'] = array(
 746+ 'createpage' => '发表新文章',
 747+ 'createpage-title' => '发表新文章',
 748+ 'createpage-title-caption' => '文章标题',
 749+ 'createpage-categories' => '分类:',
 750+);
 751+
 752+/** Traditional Chinese (‪中文(繁體)‬)
 753+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 754+ */
 755+$messages['zh-hant'] = array(
 756+ 'createpage' => '發表新文章',
 757+ 'createpage-title' => '發表新文章',
 758+ 'createpage-title-caption' => '文章標題',
 759+ 'createpage-categories' => '分類:',
 760+);
 761+
 762+/** Chinese (Hong Kong) (‪中文(香港)‬)
 763+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 764+ */
 765+$messages['zh-hk'] = array(
 766+ 'createpage' => '發表新文章',
 767+ 'createpage-title' => '發表新文章',
 768+ 'createpage-title-caption' => '文章標題',
 769+ 'createpage-categories' => '分類:',
 770+);
 771+
 772+/** Chinese (Singapore) (‪中文(新加坡)‬) */
 773+$messages['zh-sg'] = array(
 774+ 'createpage' => '发表新文章',
 775+ 'createpage-title' => '发表新文章',
 776+ 'createpage-title-caption' => '文章标题',
 777+ 'createpage-categories' => '分类:',
 778+);
 779+
 780+/** Taiwan Chinese (‪中文(台灣)‬)
 781+ * @author 許瑜真 (Yuchen Hsu/KaurJmeb)
 782+ */
 783+$messages['zh-tw'] = array(
 784+ 'createpage-edit-normal' => '進階編輯',
 785+ 'createpage-upload' => '上傳圖片',
 786+ 'createpage-hide' => '隱藏',
 787+ 'createpage' => '發表新文章',
 788+ 'createpage-title' => '發表新文章',
 789+ 'createpage-title-caption' => '文章標題',
 790+ 'createpage-button-createplate-submit' => '載入此模板',
 791+ 'createpage-article-exists' => '此頁面已存在',
 792+ 'createpage-advanced-warning' => '轉換編輯模式可能會影響頁面的格式,你確定要轉換嗎?',
 793+ 'createpage-categories' => '分類:',
 794+);
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreateAPage.i18n.php
___________________________________________________________________
Added: svn:eol-style
1795 + native
Index: trunk/extensions/CreateAPage/images/up.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/CreateAPage/images/up.png
___________________________________________________________________
Added: svn:mime-type
2796 + image/png
Index: trunk/extensions/CreateAPage/images/down.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/CreateAPage/images/down.png
___________________________________________________________________
Added: svn:mime-type
3797 + image/png
Index: trunk/extensions/CreateAPage/images/progress_bar.gif
Cannot display: file marked as a binary type.
svn:mime-type = image/gif
Property changes on: trunk/extensions/CreateAPage/images/progress_bar.gif
___________________________________________________________________
Added: svn:mime-type
4798 + image/gif
Index: trunk/extensions/CreateAPage/CreatePage.php
@@ -0,0 +1,177 @@
 2+<?php
 3+/**
 4+ * A special page to create a new article using the easy-to-use interface at
 5+ * Special:CreatePage.
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ * @version 3.80 (r15554)
 10+ * @author Bartek Łapiński <bartek@wikia-inc.com>
 11+ * @author Jack Phoenix <jack@countervandalism.net>
 12+ * @copyright Copyright © 2007-2008 Wikia Inc.
 13+ * @copyright Copyright © 2009-2011 Jack Phoenix
 14+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 15+ * @link http://www.mediawiki.org/wiki/Extension:CreateAPage Documentation
 16+ */
 17+
 18+if( !defined( 'MEDIAWIKI' ) ) {
 19+ die();
 20+}
 21+
 22+// Extension credits that will show up on Special:Version
 23+$wgExtensionCredits['specialpage'][] = array(
 24+ 'name' => 'CreateAPage',
 25+ 'author' => array( 'Bartek Łapiński', 'Łukasz Garczewski', 'Przemek Piotrowski', 'Jack Phoenix' ),
 26+ 'version' => '3.80',
 27+ 'description' => '[[Special:CreatePage|Easy to use interface]] for creating new articles',
 28+ 'url' => 'http://www.mediawiki.org/wiki/Extension:CreateAPage',
 29+);
 30+
 31+// Autoload classes and set up the new special page(s)
 32+$dir = dirname( __FILE__ ) . '/';
 33+$wgExtensionMessagesFiles['CreateAPage'] = $dir . 'CreateAPage.i18n.php';
 34+$wgAutoloadClasses['EasyTemplate'] = $dir . 'EasyTemplate.php'; // @todo FIXME: kill templates and remove this class
 35+$wgAutoloadClasses['CreateMultiPage'] = $dir . 'CreateMultiPage.php';
 36+$wgAutoloadClasses['CreatePage'] = $dir . 'SpecialCreatePage.body.php';
 37+$wgAutoloadClasses['CreatePageEditor'] = $dir . 'CreatePageEditor.php';
 38+$wgAutoloadClasses['CreatePageMultiEditor'] = $dir . 'CreatePageEditor.php';
 39+$wgAutoloadClasses['CreatePageCreateplateForm'] = $dir . 'CreatePageCreateplateForm.php';
 40+$wgAutoloadClasses['CreatePageImageUploadForm'] = $dir . 'CreatePageImageUploadForm.php';
 41+$wgAutoloadClasses['PocketSilentArticle'] = $dir . 'CreatePageEditor.php';
 42+$wgSpecialPages['CreatePage'] = 'CreatePage';
 43+$wgSpecialPageGroups['CreatePage'] = 'pagetools';
 44+
 45+// Load AJAX functions, too
 46+require_once $dir . 'SpecialCreatePage_ajax.php';
 47+
 48+// ResourceLoader support for MediaWiki 1.17+
 49+$wgResourceModules['ext.createAPage'] = array(
 50+ 'styles' => 'CreatePage.css',
 51+ 'localBasePath' => dirname( __FILE__ ),
 52+ 'remoteExtPath' => 'CreateAPage',
 53+ 'position' => 'top' // available since r85616
 54+);
 55+
 56+// Our only configuration setting -- use CreateAPage on redlinks (i.e. clicking
 57+// on a redlink takes you to index.php?title=Special:CreatePage&Createtitle=Title_of_our_page
 58+// instead of taking you to index.php?title=Title_of_our_page&action=edit&redlink=1)
 59+$wgCreatePageCoverRedLinks = false;
 60+
 61+// Hooked functions
 62+$wgHooks['EditPage::showEditForm:initial'][] = 'wfCreatePagePreloadContent';
 63+$wgHooks['Image::RecordUpload:article'][] = 'wfCreatePageShowNoImagePage';
 64+$wgHooks['CustomEditor'][] = 'wfCreatePageRedLinks';
 65+$wgHooks['ConfirmEdit::onConfirmEdit'][] = 'wfCreatePageConfirmEdit'; // ConfirmEdit CAPTCHA
 66+
 67+if ( $wgCreatePageCoverRedLinks ) {
 68+ $wgHooks['UserToggles'][] = 'wfCreatePageToggle';
 69+}
 70+
 71+// handle ConfirmEdit CAPTCHA, only for CreatePage, which will be treated a bit differently (edits in special page)
 72+function wfCreatePageConfirmEdit( &$captcha, &$editPage, $newtext, $section, $merged, &$result ) {
 73+ global $wgTitle, $wgCreatePageCoverRedLinks;
 74+
 75+ // Enable only if the configuration global is set to true,
 76+ // only for Special:CreatePage and only when ConfirmEdit is installed
 77+ $canonspname = SpecialPage::resolveAlias( $wgTitle->getDBkey() );
 78+ if ( !$wgCreatePageCoverRedLinks ) {
 79+ return true;
 80+ }
 81+ if ( $canonspname != 'CreatePage' ) {
 82+ return true;
 83+ }
 84+ if ( !class_exists( 'SimpleCaptcha' ) ) {
 85+ return true;
 86+ }
 87+
 88+ if( $captcha->shouldCheck( $editPage, $newtext, $section, $merged ) ) {
 89+ if( $captcha->passCaptcha() ) {
 90+ $result = true;
 91+ return false;
 92+ } else {
 93+ // display CAP page
 94+ $mainform = new CreatePageCreatePlateForm();
 95+ $mainform->showForm( '', false, array( &$captcha, 'editCallback' ) );
 96+ $editor = new CreatePageMultiEditor( $_SESSION['article_createplate'] );
 97+ $editor->GenerateForm( $newtext );
 98+
 99+ $result = false;
 100+ return false;
 101+ }
 102+ } else {
 103+ return true;
 104+ }
 105+}
 106+
 107+// when AdvancedEdit button is used, the existing content is preloaded
 108+function wfCreatePagePreloadContent( $editpage ) {
 109+ global $wgRequest;
 110+ if( $wgRequest->getCheck( 'createpage' ) ) {
 111+ $editpage->textbox1 = $_SESSION['article_content'];
 112+ }
 113+ return true;
 114+}
 115+
 116+// because MediaWiki jumps happily to the article page
 117+// when we create it - in this case, for image upload
 118+function wfCreatePageShowNoImagePage( $article, $title ) {
 119+ $article = new PocketSilentArticle( $title );
 120+ return true;
 121+}
 122+
 123+function wfCreatePageRedLinks( $article, $user ) {
 124+ global $wgRequest, $wgContentNamespaces, $wgCreatePageCoverRedLinks;
 125+
 126+ if ( !$wgCreatePageCoverRedLinks ) {
 127+ return true;
 128+ }
 129+
 130+ $namespace = $article->getTitle()->getNamespace();
 131+ if (
 132+ ( $user->getOption( 'createpage-redlinks', 1 ) == 0 ) ||
 133+ !in_array( $namespace, $wgContentNamespaces )
 134+ ) {
 135+ return true;
 136+ }
 137+
 138+ // nomulti should always bypass that (this is for AdvancedEdit mode)
 139+ if (
 140+ $article->getTitle()->exists() ||
 141+ ( 'nomulti' == $wgRequest->getVal( 'editmode' ) )
 142+ ) {
 143+ return true;
 144+ } else {
 145+ if ( $wgRequest->getCheck( 'wpPreview' ) ) {
 146+ return true;
 147+ }
 148+ $mainform = new CreatePageCreateplateForm();
 149+ $mainform->mTitle = $wgRequest->getVal( 'title' );
 150+ $mainform->mRedLinked = true;
 151+ $mainform->showForm( '' );
 152+ $mainform->showCreateplate( true );
 153+ return false;
 154+ }
 155+}
 156+
 157+/**
 158+ * Adds a new toggle into Special:Preferences when $wgCreatePageCoverRedLinks
 159+ * is set to true.
 160+ *
 161+ * @param $user Object: current User object
 162+ * @param $preferences Object: Preferences object
 163+ * @return Boolean: true
 164+ */
 165+function wfCreatePageToggle( $user, &$preferences ) {
 166+ $preferences['create-page-redlinks'] = array(
 167+ 'type' => 'toggle',
 168+ 'section' => 'editing',
 169+ 'label-message' => 'tog-createpage-redlinks',
 170+ );
 171+ return true;
 172+}
 173+
 174+// Restore what we temporarily encoded
 175+// moved from CreateMultiPage.php
 176+function wfCreatePageUnescapeKnownMarkupTags( &$text ) {
 177+ $text = str_replace( '<!---pipe--->', '|', $text );
 178+}
Property changes on: trunk/extensions/CreateAPage/CreatePage.php
___________________________________________________________________
Added: svn:eol-style
1179 + native
Index: trunk/extensions/CreateAPage/CreatePage.css
@@ -0,0 +1,401 @@
 2+/* Common formatting for fields */
 3+#wpTableMultiEdit,
 4+#cp-multiedit,
 5+.createpage-clear {
 6+ clear: both;
 7+}
 8+
 9+#createpageform .normal-input,
 10+#createpageform textarea {
 11+ border: solid 1px #a0a0a0;
 12+ padding: 2px 3px;
 13+}
 14+
 15+#createpageform textarea {
 16+ width: 92%;
 17+}
 18+
 19+#createpageform .bigarea {
 20+ width: 99%;
 21+}
 22+
 23+#createpageoverlay {
 24+ opacity: 0.5;
 25+ background-color: #dddeee;
 26+ filter: alpha (opacity=50);
 27+}
 28+
 29+#createpagepreview .actionBar,
 30+#createpageform .actionBar {
 31+ border-bottom: 1px solid #CCCCCC;
 32+ border-top: 1px solid #CCCCCC;
 33+ clear: both;
 34+ margin-top: -12 px;
 35+ padding: 4px 8px;
 36+ text-align: right;
 37+}
 38+
 39+* html #createpagepreview .actionBar,
 40+* html #createpageform .actionBar {
 41+ height: 1%;
 42+}
 43+
 44+#createpageform #createpageinfo {
 45+ clear: both;
 46+ padding-left: 5px;
 47+ padding-right: 10px;
 48+ text-align: left;
 49+}
 50+
 51+#createpageform .actionBar #wpRunInitialCheck {
 52+ float: left;
 53+ margin-left: 6px;
 54+}
 55+
 56+#createpagepreview .actionBarStrong,
 57+#createpageform .actionBarStrong {
 58+ background:#e9e9e9 none repeat scroll 0%;
 59+ border-bottom: 1px solid #000000;
 60+ border-top: 1px solid #000000;
 61+ margin-top: 10px;
 62+ padding-left: 6px;
 63+ text-align: left;
 64+ font-weight: bold;
 65+ color: #000000;
 66+}
 67+
 68+#createpageform .buttonBar {
 69+ text-align: left;
 70+}
 71+
 72+#createpageform .buttonDefault {
 73+ border-width: 6px;
 74+}
 75+
 76+#createpageform .upload_submit {
 77+ margin-left: 132px;
 78+ margin-bottom: 4px;
 79+ background: #3366CC none repeat scroll 0%;
 80+ border: 4px double #FFFFFF;
 81+ color: #FFFFFF;
 82+ cursor: pointer;
 83+ font-family: "Lucida Grande", sans-serif;
 84+ font-size: 8pt;
 85+ font-weight: bold;
 86+ padding: 2px 5px;
 87+ width: auto;
 88+}
 89+
 90+#createpageform .progress {
 91+ padding-left: 130px;
 92+ display: none;
 93+}
 94+
 95+#createpagebottom {
 96+ padding: 2px 2px 2px 2px;
 97+ margin-bottom: 4px;
 98+}
 99+
 100+#wpTableMultiEdit .upload_submit {
 101+ margin-left: 130px;
 102+ width: auto;
 103+}
 104+
 105+#wpTableMultiEdit .progress {
 106+ padding-left: 130px;
 107+}
 108+
 109+legend {
 110+ font-size: 1.2em;
 111+ font-weight: bold;
 112+}
 113+
 114+#cp-title-check {
 115+ clear: both;
 116+ margin: 5px 10px 5px 100px;
 117+ float: left;
 118+ font-weight: bold;
 119+}
 120+
 121+/* infobox */
 122+#Createtitlelabel {
 123+ float: left;
 124+ font-weight: bold;
 125+ width: 85px;
 126+ padding-left: 5px;
 127+ padding-right: 10px;
 128+ text-align: left;
 129+ /*text-transform: capitalize;*/
 130+ margin-top: 3px;
 131+}
 132+
 133+#wpTableMultiEdit .normal-label,
 134+#cp-infobox .normal-label {
 135+ float: left;
 136+ width: 120px;
 137+ font-weight: bold;
 138+ text-transform: capitalize;
 139+ text-align: right;
 140+ padding-right: 10px;
 141+}
 142+
 143+#wpTableMultiEdit .nofloat,
 144+#cp-infobox .nofloat {
 145+ margin-left: -20px;
 146+}
 147+
 148+#wpTableMultiEdit input .fileUpload,
 149+#cp-infobox input.fileUpload {
 150+ margin-right: 50px;
 151+}
 152+
 153+#wpTableMultiEdit div div .createpage_input_file,
 154+#cp-infobox div .createpage_input_file {
 155+ width: auto;
 156+ position: relative;
 157+ font: x-small/160% Verdana;
 158+ margin: 0 0 4px 0;
 159+ zoom: 1;
 160+ overflow: hidden;
 161+}
 162+
 163+#wpTableMultiEdit div div .createpage_input_file label,
 164+#cp-infobox div .createpage_input_file label {
 165+ float: right;
 166+ white-space: nowrap;
 167+ position: relative;
 168+ z-index: 1;
 169+ left: 0;
 170+ top: 0;
 171+ overflow: hidden;
 172+ cursor: pointer;
 173+ font-family: "Lucida Grande", sans-serif;
 174+ font-size: 9pt;
 175+ font-weight: bold;
 176+ padding: 2px 5px;
 177+ display: inline;
 178+ -webkit-border-top-right-radius: 8px;
 179+ -webkit-border-bottom-right-radius: 8px;
 180+}
 181+
 182+#wpTableMultiEdit div div .createpage_input_file_no_path label ,
 183+#cp-infobox div .createpage_input_file_no_path label {
 184+ float:left;
 185+}
 186+
 187+#wpTableMultiEdit div div .createpage_input_file label input,
 188+#cp-infobox div .createpage_input_file label input {
 189+ position: absolute;
 190+ right: 0;
 191+ top: 0;
 192+ border: none;
 193+ font-size: 5em;
 194+ line-height: 12px;
 195+ opacity: 0;
 196+ zoom: 1;
 197+ filter: alpha(opacity=0);
 198+ cursor: pointer;
 199+}
 200+
 201+#wpTableMultiEdit div div .createpage_input_file_no_path label,
 202+#cp-infobox div .createpage_input_file_no_path label {
 203+ -webkit-border-radius:8px;
 204+}
 205+
 206+#Createtitle,
 207+#wpTableMultiEdit .normal-input,
 208+#cp-infobox .normal-input {
 209+ margin-bottom: 5px;
 210+ width: 250px;
 211+}
 212+
 213+#cp-infobox .rename {
 214+ margin-left: 5px;
 215+ width: 200px;
 216+}
 217+
 218+#Createtitle {
 219+ float: left;
 220+ margin-top: 4px;
 221+ border: 1px solid #A0A0A0;
 222+ padding: 2px 3px;
 223+}
 224+
 225+.bordered {
 226+ border: 1px solid gray;
 227+ margin-left: 20px;
 228+ width: 450px;
 229+ padding-top: 4px;
 230+}
 231+
 232+#cp-infobox br {
 233+ clear: left;
 234+}
 235+
 236+#createpage_upload_submit {
 237+ margin-left: 110px;
 238+ width: auto !important;
 239+}
 240+
 241+#createpage_optionals {
 242+ margin-bottom: 15px;
 243+}
 244+
 245+#createpage_optionals_text {
 246+ font-weight: bold;
 247+ font-size: 9pt;
 248+}
 249+
 250+/* old template chooser */
 251+#cp-scroller {
 252+ width: 90%;
 253+ margin: 0 auto;
 254+ overflow: hidden;
 255+ padding: 20px 35px;
 256+ position: relative;
 257+}
 258+
 259+#cp-scroller a {
 260+ position: absolute;
 261+ text-decoration: none;
 262+ top: 50px;
 263+ z-index: 100;
 264+}
 265+
 266+#cp-scroller-left {
 267+ display: none;
 268+ left: 5px;
 269+}
 270+
 271+#cp-scroller-right {
 272+ display: none;
 273+ right: 5px;
 274+}
 275+
 276+#cp-scroller-inside {
 277+ width: 90%;
 278+ overflow: hidden;
 279+ margin: 0 auto;
 280+ position: relative;
 281+}
 282+
 283+#cp-scroller-list {
 284+ width: 2000px;
 285+}
 286+
 287+#cp-scroller-list, #cp-scroller-list li {
 288+ margin: 0;
 289+ overflow: hidden;
 290+ padding: 0;
 291+}
 292+
 293+#cp-scroller-list li {
 294+ float: left;
 295+ height: 90px;
 296+ margin: 0 10px 0 0;
 297+ width: 90px;
 298+ padding: 0;
 299+ text-align: center;
 300+}
 301+
 302+#cp-infobox-fieldset {
 303+ border: 2px 1px 1px 1px;
 304+}
 305+
 306+/* template chooser */
 307+#createpageform div.templateFrame {
 308+ border-right: 1px solid #CCCCCC;
 309+ float: left;
 310+ padding: 10px;
 311+}
 312+
 313+#createpageform div.templateFrame:hover {
 314+ background-color: #F1F1F1;
 315+ color: #000;
 316+ cursor: pointer;
 317+}
 318+
 319+#createpageform div.templateFrameSelected {
 320+ background-color: #e7e7e7;
 321+ color: #000;
 322+ border: solid 1px #2f6fab;
 323+}
 324+
 325+/* disabled on November 30, 2009 by Jack
 326+#createpageform div.templateFrameLast {
 327+ border-right: none;
 328+}*/
 329+
 330+#createpage_warning_copy,
 331+#createpage_warning_copy2 {
 332+ background-color: #FFFFFF;
 333+ border: 1px solid #AAAAAA;
 334+ color: #000000;
 335+}
 336+
 337+#createpage_warning_copy .boxHeader,
 338+#createpage_warning_copy2 .boxHeader {
 339+ padding: 3px 5px;
 340+}
 341+
 342+#createpage_warning_copy div.warning_text,
 343+#createpage_warning_copy2 div.warning_text {
 344+ font-size: 1.1em;
 345+ line-height: 1.5em;
 346+ padding: 10px;
 347+ margin-top: 10px;
 348+}
 349+
 350+#createpage_warning_copy div.warning_buttons,
 351+#createpage_warning_copy2 div.warning_buttons {
 352+ padding: 5px;
 353+ text-align: center;
 354+}
 355+
 356+#createpage_warning_copy div.warning_buttons input,
 357+#createpage_warning_copy2 div.warning_buttons input {
 358+ margin: 0 5px;
 359+}
 360+
 361+#createpage_cloud_section, #createpage_cloud_section_njs {
 362+ border: 1px solid lightgray;
 363+ padding: 15px 15px 15px 15px;
 364+}
 365+
 366+#wpCategoryTextarea {
 367+ display: none;
 368+}
 369+
 370+#wpCategoryInput, #wpCategoryButton {
 371+ margin: 4px 2px 0 2px;
 372+}
 373+
 374+#wpCategoryInput {
 375+ width: 450px;
 376+}
 377+
 378+.createpage-separator {
 379+ height: 10pt;
 380+}
 381+
 382+.createpage-controller {
 383+ float: right;
 384+ margin-right: 24px;
 385+}
 386+
 387+.createpage-lower {
 388+ margin-top: 5px;
 389+}
 390+
 391+.createpage-textarea {
 392+ float: left;
 393+}
 394+
 395+/* IE6 fixes */
 396+* html .createpage-clear {
 397+ position: relative;
 398+}
 399+
 400+* html .createpage-lower {
 401+ position: relative;
 402+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreatePage.css
___________________________________________________________________
Added: svn:eol-style
1403 + native
Index: trunk/extensions/CreateAPage/SpecialCreatePage_ajax.php
@@ -0,0 +1,145 @@
 2+<?php
 3+/**
 4+ * AJAX functions for CreateAPage extension.
 5+ */
 6+function axTitleExists() {
 7+ global $wgRequest;
 8+
 9+ $res = array( 'text' => false );
 10+
 11+ $title = $wgRequest->getVal( 'title' );
 12+ $mode = $wgRequest->getVal( 'mode' );
 13+ $title_object = Title::newFromText( $title );
 14+
 15+ if ( is_object( $title_object ) ) {
 16+ if ( $title_object->exists() ) {
 17+ $res = array(
 18+ 'url' => $title_object->getLocalURL(),
 19+ 'text' => $title_object->getPrefixedText(),
 20+ 'mode' => $mode,
 21+ );
 22+ }
 23+ } else {
 24+ $res = array( 'empty' => true );
 25+ }
 26+
 27+ return json_encode( $res );
 28+}
 29+
 30+function axMultiEditParse() {
 31+ global $wgRequest;
 32+ $me = '';
 33+
 34+ $template = $wgRequest->getVal( 'template' );
 35+ $title = Title::newFromText( "Createplate-{$template}", NS_MEDIAWIKI );
 36+
 37+ // transfer optional sections data
 38+ $optional_sections = array();
 39+ foreach( $_POST as $key => $value ) {
 40+ if( strpos( $key, 'wpOptionalInput' ) !== false ) {
 41+ $optional_sections = str_replace( 'wpOptionalInput', '', $key );
 42+ }
 43+ }
 44+
 45+ if ( $title->exists() ) {
 46+ $rev = Revision::newFromTitle( $title );
 47+ $me = CreateMultiPage::multiEditParse( 10, 10, '?', $rev->getText(), $optional_sections );
 48+ } else {
 49+ $me = CreateMultiPage::multiEditParse( 10, 10, '?', '<!---blanktemplate--->' );
 50+ }
 51+
 52+ return json_encode( $me );
 53+}
 54+
 55+function axMultiEditImageUpload() {
 56+ global $wgRequest;
 57+
 58+ $res = array();
 59+
 60+ $postfix = $wgRequest->getVal( 'num' );
 61+ $infix = '';
 62+ if ( $wgRequest->getVal( 'infix' ) != '' ) {
 63+ $infix = $wgRequest->getVal( 'infix' );
 64+ }
 65+
 66+ // do the real upload
 67+ $uploadform = new CreatePageImageUploadForm( $wgRequest );
 68+ $uploadform->mTempPath = $wgRequest->getFileTempName( 'wp' . $infix . 'UploadFile' . $postfix );
 69+ $uploadform->mFileSize = $wgRequest->getFileSize( 'wp' . $infix . 'UploadFile' . $postfix );
 70+ $uploadform->mSrcName = $wgRequest->getFileName( 'wp' . $infix . 'UploadFile' . $postfix );
 71+ $uploadform->CurlError = $wgRequest->getUploadError( 'wp' . $infix . 'UploadFile' . $postfix );
 72+ $uploadform->mLastTimestamp = $wgRequest->getText( 'wp' . $infix . 'LastTimestamp' . $postfix );
 73+
 74+ $par_name = $wgRequest->getText( 'wp' . $infix . 'ParName' . $postfix );
 75+ $file_ext = explode( '.', $uploadform->mSrcName );
 76+ $file_ext = @$file_ext[1];
 77+ $uploadform->mParameterExt = $file_ext;
 78+ if ( $infix == '' ) {
 79+ $uploadform->mDesiredDestName = $wgRequest->getText( 'Createtitle' ) . ' ' . trim( $par_name );
 80+ } else {
 81+ $uploadform->mDesiredDestName = $wgRequest->getText( 'Createtitle' );
 82+ }
 83+
 84+ $uploadform->mSessionKey = false;
 85+ $uploadform->mStashed = false;
 86+ $uploadform->mRemoveTempFile = false;
 87+
 88+ // some of the values are fixed, we have no need to add them to the form itself
 89+ $uploadform->mIgnoreWarning = 1;
 90+ $uploadform->mUploadDescription = wfMsg( 'createpage-uploaded-from' );
 91+ $uploadform->mWatchthis = 1;
 92+
 93+ $uploadedfile = $uploadform->execute();
 94+ if ( $uploadedfile['error'] == 0 ) {
 95+ $imageobj = wfLocalFile( $uploadedfile['timestamp'] );
 96+ $imageurl = $imageobj->createThumb( 60 );
 97+
 98+ $res = array(
 99+ 'error' => 0,
 100+ 'msg' => $uploadedfile['msg'],
 101+ 'url' => $imageurl,
 102+ 'timestamp' => $uploadedfile['timestamp'],
 103+ 'num' => $postfix
 104+ );
 105+ } else {
 106+ if ( $uploadedfile['once'] ) {
 107+ #if ( !$error_once ) {
 108+ $res = array(
 109+ 'error' => 1,
 110+ 'msg' => $uploadedfile['msg'],
 111+ 'num' => $postfix,
 112+ );
 113+ #}
 114+ $error_once = true;
 115+ } else {
 116+ $res = array(
 117+ 'error' => 1,
 118+ 'msg' => $uploadedfile['msg'],
 119+ 'num' => $postfix,
 120+ );
 121+ }
 122+ }
 123+
 124+ $text = json_encode( $res );
 125+ $ar = new AjaxResponse( $text );
 126+ $ar->setContentType( 'text/html; charset=utf-8' );
 127+ return $ar;
 128+}
 129+
 130+function axCreatepageAdvancedSwitch() {
 131+ global $wgRequest;
 132+
 133+ $mCreateplate = $wgRequest->getVal( 'createplates' );
 134+ $editor = new CreatePageMultiEditor( $mCreateplate );
 135+ $content = CreateMultiPage::unescapeBlankMarker( $editor->GlueArticle() );
 136+ wfCreatePageUnescapeKnownMarkupTags( $content );
 137+ $_SESSION['article_content'] = $content;
 138+
 139+ return json_encode( true );
 140+}
 141+
 142+global $wgAjaxExportList;
 143+$wgAjaxExportList[] = 'axTitleExists';
 144+$wgAjaxExportList[] = 'axMultiEditParse';
 145+$wgAjaxExportList[] = 'axMultiEditImageUpload';
 146+$wgAjaxExportList[] = 'axCreatepageAdvancedSwitch';
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/SpecialCreatePage_ajax.php
___________________________________________________________________
Added: svn:eol-style
1147 + native
Index: trunk/extensions/CreateAPage/CAP_TagCloud.php
@@ -0,0 +1,58 @@
 2+<?php
 3+/**
 4+ * @copyright Copyright © 2007, Wikia Inc.
 5+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 6+ */
 7+class CAP_TagCloud {
 8+ var $tags_min_pts = 8;
 9+ var $tags_max_pts = 32;
 10+ var $tags_highest_count = 0;
 11+ var $tags_size_type = 'pt';
 12+
 13+ public function __construct( $limit = 10 ) {
 14+ $this->limit = $limit;
 15+ $this->initialize();
 16+ }
 17+
 18+ public function initialize() {
 19+ $dbr = wfGetDB( DB_MASTER );
 20+ $res = $dbr->select(
 21+ 'categorylinks',
 22+ array( 'cl_to', 'COUNT(*) AS count' ),
 23+ array(),
 24+ __METHOD__,
 25+ array(
 26+ 'GROUP BY' => 'cl_to',
 27+ 'ORDER BY' => 'count DESC',
 28+ 'LIMIT' => $this->limit
 29+ )
 30+ );
 31+ wfSuppressWarnings(); // prevent PHP from bitching about strtotime()
 32+ foreach( $res as $row ) {
 33+ $tag_name = Title::makeTitle( NS_CATEGORY, $row->cl_to );
 34+ $tag_text = $tag_name->getText();
 35+ if( strtotime( $tag_text ) == '' ) { // don't want dates to show up
 36+ if( $row->count > $this->tags_highest_count ) {
 37+ $this->tags_highest_count = $row->count;
 38+ }
 39+ $this->tags[$tag_text] = array( 'count' => $row->count );
 40+ }
 41+ }
 42+ wfRestoreWarnings();
 43+
 44+ // sort tag array by key (tag name)
 45+ if( $this->tags_highest_count == 0 ) {
 46+ return;
 47+ }
 48+ ksort( $this->tags );
 49+ /* and what if we have _1_ category? like on a new wiki with nteen articles, mhm? */
 50+ if( $this->tags_highest_count == 1 ) {
 51+ $coef = $this->tags_max_pts - $this->tags_min_pts;
 52+ } else {
 53+ $coef = ( $this->tags_max_pts - $this->tags_min_pts )/( ( $this->tags_highest_count - 1 ) * 2 );
 54+ }
 55+ foreach( $this->tags as $tag => $att ) {
 56+ $this->tags[$tag]['size'] = $this->tags_min_pts + ( $this->tags[$tag]['count'] - 1 ) * $coef;
 57+ }
 58+ }
 59+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CAP_TagCloud.php
___________________________________________________________________
Added: svn:eol-style
160 + native
Index: trunk/extensions/CreateAPage/CreatePageEditor.php
@@ -0,0 +1,402 @@
 2+<?php
 3+/**
 4+ * @file
 5+ * @ingroup Extensions
 6+ * @author Bartek Łapiński <bartek@wikia-inc.com>
 7+ * @copyright Copyright © 2007 Bartek Łapiński, Wikia Inc.
 8+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 9+ */
 10+
 11+// all editor-related functions will go there
 12+abstract class CreatePageEditor {
 13+ var $mTemplate;
 14+
 15+ function __construct( $template ) {
 16+ $this->mTemplate = $template;
 17+ }
 18+
 19+ abstract public function GenerateForm();
 20+ abstract public function GlueArticle();
 21+}
 22+
 23+// wraps up special multi editor class
 24+class CreatePageMultiEditor extends CreatePageEditor {
 25+ var $mRedLinked, $mInitial, $mPreviewed;
 26+
 27+ function __construct( $template, $redlinked = false, $initial = false, $previewed = false ) {
 28+ $this->mTemplate = $template;
 29+ $this->mRedLinked = $redlinked;
 30+ $this->mInitial = $initial;
 31+ $this->mPreviewed = $previewed;
 32+ }
 33+
 34+ function GenerateForm( $content = false ) {
 35+ global $wgOut, $wgUser, $wgRequest;
 36+
 37+ $optional_sections = array();
 38+
 39+ foreach( $_POST as $key => $value ) {
 40+ if( strpos( $key, 'wpOptionalInput' ) !== false ) {
 41+ $optional_sections[] = str_replace( 'wpOptionalInput', '', $key );
 42+ }
 43+ }
 44+ if ( !$content ) {
 45+ $title = Title::newFromText( 'Createplate-' . $this->mTemplate, NS_MEDIAWIKI );
 46+ if ( $title->exists() ) {
 47+ $rev = Revision::newFromTitle( $title );
 48+ $me = CreateMultiPage::multiEditParse( 10, 10, '?', $rev->getText(), $optional_sections );
 49+ } else {
 50+ $me = CreateMultiPage::multiEditParse( 10, 10, '?', '<!---blanktemplate--->' );
 51+ }
 52+ } else {
 53+ $me = CreateMultiPage::multiEditParse( 10, 10, '?', $content, $optional_sections );
 54+ }
 55+
 56+ $wgOut->addHTML( '
 57+ <div id="cp-restricted">
 58+ <div id="createpageoverlay">
 59+ <div class="hd"></div>
 60+ <div class="bd"></div>
 61+ <div class="ft"></div>
 62+ </div>
 63+ ');
 64+
 65+ $wgOut->addHTML( "<div id=\"cp-multiedit\">{$me}</div>" );
 66+ // check for already submitted values - for a preview, for example
 67+ $summaryval = '';
 68+ if ( $wgRequest->getVal( 'wpSummary' ) != '' ) {
 69+ $summaryval = $wgRequest->getVal( 'wpSummary' );
 70+ }
 71+ if ( $this->mInitial ) {
 72+ if( $wgUser->getOption( 'watchcreations' ) ) {
 73+ $watchthischeck = 'checked="checked"';
 74+ } else {
 75+ $watchthischeck = '';
 76+ }
 77+
 78+ if( $wgUser->getOption( 'minordefault' ) ) {
 79+ $minoreditcheck = 'checked="checked"';
 80+ } else {
 81+ $minoreditcheck = '';
 82+ }
 83+ } else {
 84+ $watchthischeck = '';
 85+ $minoreditcheck = '';
 86+ if ( $wgRequest->getCheck( 'wpWatchthis' ) ) {
 87+ $watchthischeck = 'checked="checked"';
 88+ }
 89+ if ( $wgRequest->getCheck( 'wpMinoredit' ) ) {
 90+ $minoreditcheck = 'checked="checked"';
 91+ }
 92+ }
 93+
 94+ global $wgRightsText;
 95+ $copywarn = "<div id=\"editpage-copywarn\">\n" .
 96+ wfMsg( $wgRightsText ? 'copyrightwarning' : 'copyrightwarning2',
 97+ '[[' . wfMsgForContent( 'copyrightpage' ) . ']]',
 98+ $wgRightsText ) . "\n</div>";
 99+ $wgOut->addWikiText( $copywarn );
 100+ $editsummary = '<span id="wpSummaryLabel"><label for="wpSummary">' .
 101+ wfMsg( 'summary' ) . "</label></span>\n<input type='text' value=\"" .
 102+ $summaryval . '" name="wpSummary" id="wpSummary" maxlength="200" size="60" /><br />';
 103+
 104+ $checkboxhtml = '<input id="wpMinoredit" type="checkbox" accesskey="i" value="1" name="wpMinoredit" ' . $minoreditcheck . '/>' . "\n" .
 105+ '<label accesskey="i" title="' . wfMsg( 'tooltip-minoredit' ) . ' [alt-shift-i]" for="wpMinoredit">' . wfMsg( 'minoredit' ) . '</label>';
 106+ $checkboxhtml .= '<input id="wpWatchthis" type="checkbox" accesskey="w" value="1" name="wpWatchthis" ' . $watchthischeck . '/>' . "\n" .
 107+ '<label accesskey="w" title="' . wfMsg( 'tooltip-watch' ) . ' [alt-shift-w]" for="wpWatchthis">' . wfMsg( 'watchthis' ) . '</label>';
 108+
 109+ $wgOut->addHTML(
 110+ '<div id="createpagebottom">' .
 111+ $editsummary . $checkboxhtml .
 112+ '</div>'
 113+ );
 114+
 115+ $wgOut->addHTML('
 116+ <div class="actionBar buttonBar">
 117+ <input type="submit" id="wpSave" name="wpSave" value="' . wfMsg( 'createpage-save' ) . '" class="button color1" />
 118+ <input type="submit" id="wpPreview" name="wpPreview" value="' . wfMsg( 'preview' ) . '" class="button color1" />
 119+ <input type="submit" id="wpCancel" name="wpCancel" value="' . wfMsg( 'cancel' ) . '" class="button color1" />
 120+ </div>'
 121+ );
 122+
 123+ // stuff for red links - bottom edittools, to be more precise
 124+ if ( $this->mRedLinked && ( $this->mTemplate == 'Blank' ) ) {
 125+ $wgOut->addHTML( '<div id="createpage_editTools" class="mw-editTools">' );
 126+ $wgOut->addWikiText( wfMsgForContent( 'edittools' ) );
 127+ $wgOut->addHTML( '</div>' );
 128+ }
 129+
 130+ $wgOut->addHTML( '</form></div>' );
 131+ }
 132+
 133+ // take given categories and glue them together
 134+ function GlueCategories( $checkboxes_array, $categories ) {
 135+ global $wgContLang;
 136+
 137+ $text = '';
 138+ $ns_cat = $wgContLang->getFormattedNsText( NS_CATEGORY );
 139+
 140+ foreach( $checkboxes_array as $category ) {
 141+ $text .= "\n[[" . $ns_cat . ':' . $category . ']]';
 142+ }
 143+
 144+ // parse the textarea
 145+ $categories_array = preg_split( "/\|/", $categories, -1 );
 146+ foreach ( $categories_array as $category ) {
 147+ if ( !empty( $category ) ) {
 148+ $text .= "\n[[" . $ns_cat . ':' . $category . ']]';
 149+ }
 150+ }
 151+
 152+ return $text;
 153+ }
 154+
 155+ // get the infobox' text and substitute all known values...
 156+ function GlueInfobox( $infoboxes_array, $infobox_text ) {
 157+ $inf_pars = preg_split( "/\|/", $infobox_text, -1 );
 158+
 159+ // correct for additional |'s the users may have put in here...
 160+ $fixed_par_array = array();
 161+ $fix_corrector = 0;
 162+
 163+ for ( $i = 0; $i < count( $inf_pars ); $i++ ) {
 164+ // this was cut out from user supplying '|' inside the parameter...
 165+ if( ( strpos( $inf_pars[$i], '=' ) === false ) && ( 0 != $i ) ) {
 166+ $fixed_par_array[$i - ( 1 + $fix_corrector ) ] .= '|' . $inf_pars[$i];
 167+ $fix_corrector++;
 168+ } else {
 169+ $fixed_par_array[] = $inf_pars[$i];
 170+ }
 171+ }
 172+
 173+ $text = array_shift( $fixed_par_array );
 174+ $inf_par_num = 0;
 175+
 176+ foreach ( $fixed_par_array as $inf_par ) {
 177+ $inf_par_pair = preg_split( "/=/", $inf_par, -1 );
 178+ if ( is_array( $inf_par_pair ) ) {
 179+ $text .= '|' . $inf_par_pair[0] . ' = ' .
 180+ $this->escapeKnownMarkupTags(
 181+ trim( $infoboxes_array[$inf_par_num] )
 182+ ) . "\n";
 183+ $inf_par_num++;
 184+ }
 185+ }
 186+ return $text . "}}\n";
 187+ }
 188+
 189+ /**
 190+ * Since people can put in pipes and brackets without them knowing that
 191+ * it's BAD because it makes an infobox template writhe in agony... escape
 192+ * the tags
 193+ *
 194+ * @param $text String: text to escape
 195+ * @return String: input with pipes changed to HTML comments and brackets
 196+ * stripped out
 197+ */
 198+ function escapeKnownMarkupTags( $text ) {
 199+ $text = str_replace( '|', '<!---pipe--->', $text );
 200+ $text = str_replace( '{{', '', $text );
 201+ $text = str_replace( '}}', '', $text );
 202+ return $text;
 203+ }
 204+
 205+ function GlueArticle( $preview = false, $render_option = true ) {
 206+ global $wgRequest, $wgOut;
 207+
 208+ $text = '';
 209+ $infoboxes = array();
 210+ $categories = array();
 211+ $optionals = array();
 212+ $images = array();
 213+ $all_images = array();
 214+ $error_once = false;
 215+
 216+ foreach ( $_POST as $key => $value ) {
 217+ if( strpos( $key, 'wpOptionals' ) !== false ) {
 218+ if ( $render_option ) {
 219+ // build optional data
 220+ $optionals = explode( ',', $value );
 221+ }
 222+ } elseif( strpos( $key, 'wpTextboxes' ) !== false ) {
 223+ // check if this was optional
 224+ if( !in_array( $key, $optionals ) ) {
 225+ $text .= "\n" . $value;
 226+ }
 227+ } elseif( strpos( $key, 'wpInfoboxPar' ) !== false ) {
 228+ $infoboxes[] = $value;
 229+ } elseif( strpos( $key, 'category_' ) !== false ) {
 230+ $categories[] = $value;
 231+ } elseif( strpos( $key, 'wpDestFile' ) !== false ) {
 232+ $image_value = array();
 233+ $postfix = substr( $key, 10 );
 234+
 235+ if ( $wgRequest->getVal( 'wpNoUse' . $postfix ) == 'Yes' ) {
 236+ $infoboxes[] = $wgRequest->getVal( 'wpInfImg' . $postfix );
 237+ } else {
 238+ $image_value['watchthis'] = $_POST['wpWatchthis' . $postfix];
 239+
 240+ // do the real upload
 241+ $uploadform = new CreatePageImageUploadForm( $wgRequest );
 242+ $uploadform->mTempPath = $wgRequest->getFileTempName( 'wpUploadFile' . $postfix );
 243+ $uploadform->mFileSize = $wgRequest->getFileSize( 'wpUploadFile' . $postfix );
 244+ $uploadform->mSrcName = $wgRequest->getFileName( 'wpUploadFile' . $postfix );
 245+ $uploadform->CurlError = $wgRequest->getUploadError( 'wpUploadFile' . $postfix );
 246+
 247+ // required by latest functions
 248+ $par_name = $wgRequest->getText( 'wpParName' . $postfix );
 249+ if ( $uploadform->mSrcName ) {
 250+ $file_ext = explode( '.', $uploadform->mSrcName );
 251+ $file_ext = $file_ext[1];
 252+ } else {
 253+ $file_ext = '';
 254+ }
 255+ $uploadform->mParameterExt = $file_ext;
 256+ $uploadform->mDesiredDestName = $wgRequest->getText( 'Createtitle' ) . ' ' . trim( $par_name );
 257+ $uploadform->mSessionKey = false;
 258+ $uploadform->mStashed = false;
 259+ $uploadform->mRemoveTempFile = false;
 260+
 261+ // some of the values are fixed, we have no need to add them to the form itself
 262+ $uploadform->mIgnoreWarning = 1;
 263+ $uploadform->mUploadDescription = wfMsg( 'createpage-uploaded-from' );
 264+ $uploadform->mWatchthis = 1;
 265+ $uploadedfile = $uploadform->execute();
 266+ if ( $uploadedfile['error'] == 0 ) {
 267+ $infoboxes[] = $uploadedfile['msg'];
 268+ } else {
 269+ $infoboxes[] = '<!---imageupload--->';
 270+ if ( $uploadedfile['once'] ) {
 271+ if ( !$error_once ) {
 272+ if ( !$preview ) { // certainly they'll notice things on preview
 273+ $wgOut->addHTML( "<p class='error'>{$uploadedfile['msg']}</p>" );
 274+ }
 275+ }
 276+ $error_once = true;
 277+ } else {
 278+ if ( !$preview ) {
 279+ $wgOut->addHTML( "<p class='error'>{$uploadedfile['msg']}</p>" );
 280+ }
 281+ }
 282+ }
 283+ }
 284+ } elseif( strpos( $key, 'wpAllDestFile' ) !== false ) {
 285+ // upload and glue in images that are within the article content too
 286+
 287+ $image_value = array();
 288+ $postfix = substr( $key, 13 );
 289+ $image_value['watchthis'] = $_POST['wpWatchthis' . $postfix];
 290+
 291+ $uploadform = new CreatePageImageUploadForm( $wgRequest );
 292+ $uploadform->mTempPath = $wgRequest->getFileTempName( 'wpAllUploadFile' . $postfix );
 293+ $uploadform->mFileSize = $wgRequest->getFileSize( 'wpAllUploadFile' . $postfix );
 294+ $uploadform->mSrcName = $wgRequest->getFileName( 'wpAllUploadFile' . $postfix );
 295+ $uploadform->CurlError = $wgRequest->getUploadError( 'wpAllUploadFile' . $postfix );
 296+
 297+ // required by latest functions
 298+ if ( $uploadform->mSrcName ) {
 299+ $file_ext = explode( '.', $uploadform->mSrcName );
 300+ $file_ext = $file_ext[1];
 301+ } else {
 302+ $file_ext = '' ;
 303+ }
 304+ $uploadform->mParameterExt = $file_ext;
 305+ $uploadform->mDesiredDestName = $wgRequest->getText( 'Createtitle' );
 306+ $uploadform->mSessionKey = false;
 307+ $uploadform->mStashed = false;
 308+ $uploadform->mRemoveTempFile = false;
 309+
 310+ $uploadform->mIgnoreWarning = 1;
 311+ $uploadform->mUploadDescription = wfMsg( 'createpage-uploaded-from' );
 312+ $uploadform->mWatchthis = 1;
 313+ $uploadedfile = $uploadform->execute();
 314+ if ( $uploadedfile['error'] == 0 ) {
 315+ $all_images[] = $uploadedfile['msg'];
 316+ } else {
 317+ $all_images[] = '<!---imageupload--->';
 318+ if ( $uploadedfile['once'] ) {
 319+ if ( !$error_once ) {
 320+ if ( !$preview ) {
 321+ $wgOut->addHTML( "<p class='error'>{$uploadedfile['msg']}</p>" );
 322+ }
 323+ }
 324+ $error_once = true;
 325+ } else {
 326+ if ( !$preview ) {
 327+ $wgOut->addHTML( "<p class='error'>{$uploadedfile['msg']}</p>" );
 328+ }
 329+ }
 330+ }
 331+ }
 332+ }
 333+
 334+ if ( is_array( $all_images ) ) {
 335+ // glue in images, replacing all image tags with content
 336+ foreach ( $all_images as $myimage ) {
 337+ $repl_count = 1;
 338+ if ( $myimage != '<!---imageupload--->' ) {
 339+ $text = $this->str_replace_once(
 340+ '<!---imageupload--->',
 341+ '[[' . $myimage . '|thumb]]',
 342+ $text
 343+ );
 344+ }
 345+ }
 346+ }
 347+
 348+ if ( isset( $_POST['wpInfoboxValue'] ) ) {
 349+ $text = $this->GlueInfobox( $infoboxes, $_POST['wpInfoboxValue'] ) . $text;
 350+ }
 351+
 352+ if ( isset( $_POST['wpCategoryTextarea'] ) ) {
 353+ $text .= $this->GlueCategories( $categories, $_POST['wpCategoryTextarea'] );
 354+ }
 355+
 356+ return $text;
 357+ }
 358+
 359+ // by jmack@parhelic.com from php.net
 360+ function str_replace_once( $search, $replace, $subject ) {
 361+ if( ( $pos = strpos( $subject, $search ) ) !== false ) {
 362+ $ret = substr( $subject, 0, $pos ) . $replace . substr( $subject, $pos + strlen( $search ) );
 363+ } else {
 364+ $ret = $subject;
 365+ }
 366+ return( $ret );
 367+ }
 368+
 369+}
 370+
 371+// a small class to overcome some MediaWiki shortages :)
 372+// MediaWiki always shows a newly created article, which in this case
 373+// disrupts the form and generally doesn't suit us, and uploading a new
 374+// image creates a new article
 375+class PocketSilentArticle extends Article {
 376+ // don't SHOW article upon creation, because it's IRRITATING
 377+ function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC = false, $comment = false, $bot = false ) {
 378+ $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
 379+ ( $isminor ? EDIT_MINOR : 0 ) |
 380+ ( $suppressRC ? EDIT_SUPPRESS_RC : 0 );
 381+
 382+ if ( $comment && $summary != '' ) {
 383+ $text = "== {$summary} ==\n\n" . $text;
 384+ }
 385+
 386+ $this->doEdit( $text, $summary, $flags );
 387+
 388+ $dbw = wfGetDB( DB_MASTER );
 389+ if ( $watchthis ) {
 390+ if ( !$this->mTitle->userIsWatching() ) {
 391+ $dbw->begin();
 392+ $this->doWatch();
 393+ $dbw->commit();
 394+ }
 395+ } else {
 396+ if ( $this->mTitle->userIsWatching() ) {
 397+ $dbw->begin();
 398+ $this->doUnwatch();
 399+ $dbw->commit();
 400+ }
 401+ }
 402+ }
 403+}
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/CreatePageEditor.php
___________________________________________________________________
Added: svn:eol-style
1404 + native
Index: trunk/extensions/CreateAPage/templates/editpage.tmpl.php
@@ -0,0 +1,118 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<!-- CSS part -->
 4+<style type="text/css">
 5+/*<![CDATA[*/
 6+#wpTextbox1 {
 7+ display: none;
 8+}
 9+/*]]>*/
 10+</style>
 11+<div style="display:block;" id="wpTableMultiEdit" name="wpTableMultiEdit">
 12+<input type="hidden" id="wpOptionals" name="wpOptionals" value="">
 13+<?php
 14+
 15+$sections = 0;
 16+$optionalSections = array();
 17+
 18+foreach ( $boxes as $id => $box ) {
 19+ $display = ( empty( $box['display'] ) ) ? 'none' : 'block';
 20+ $id = trim( $id );
 21+ $html = 'name="wpTextboxes' . $id . '" id="wpTextboxes' . $id . '" style="display:' . $display . '"';
 22+ $value = '';
 23+ $clear = ' class="createpage-clear"';
 24+
 25+ switch( $box['type'] ) {
 26+ case 'section_display': {
 27+ $i = $id;
 28+ $title_found = false;
 29+ $visible = '';
 30+ while( $i < count( $boxes ) - 1 ) {
 31+ $i++;
 32+ if ( ( $boxes[$i]['type'] == 'title' ) || ( $boxes[$i]['type'] == 'optional_textarea' ) ) {
 33+ $title_found = true;
 34+ if ( $boxes[$i]['type'] == 'optional_textarea' ) {
 35+ $optionalSections[] = array( $sections, $box['value'] );
 36+ }
 37+ break;
 38+ }
 39+ if ( $boxes[$i]['type'] == 'section_display' ) {
 40+ break;
 41+ }
 42+ }
 43+ if ( $title_found ) {
 44+ $clear = '';
 45+ }
 46+ $value = $box['value'];
 47+ if ( $sections > 0 ) {
 48+ ?>
 49+ </div>
 50+ <?php
 51+ }
 52+ ?>
 53+ <div id="createpage_section_<?php echo $sections ?>">
 54+ <?php
 55+ $sections++;
 56+ break;
 57+ }
 58+ case 'text': {
 59+ $value = "<input type=\"text\" size=\"50\" {$html} value=\"" . $box['value'] . '">';
 60+ break;
 61+ }
 62+ case 'hidden': {
 63+ $value = "<input type=\"hidden\" {$html} value=\"" . $box['value'] . '">';
 64+ break;
 65+ }
 66+ case 'optional_textarea':
 67+ case 'textarea': {
 68+ $linenum = count( explode( "\n", $box['value'] ) ) + 1;
 69+ $linenum = ( $linenum > 8 ) ? 8 : $linenum;
 70+ $value = "<textarea type=\"text\" rows=\"5\" cols=\"{$cols}\" {$html} class=\"createpage-textarea\">" . $box['value'] . '</textarea>';
 71+ if ( $box['toolbar'] != '' ) {
 72+ $value = $box['toolbar'] . $value;
 73+ $value .= '<a href="#" id="wpTextDecrease' . $id . '" class="createpage-controller createpage-upper"><img src="' . $imgpath . 'up.png" alt="-" /></a>';
 74+ $value .= '<a href="#" id="wpTextIncrease' . $id . '" class="createpage-controller createpage-lower"><img src="' . $imgpath . 'down.png" alt="+" /></a>';
 75+ }
 76+ break;
 77+ }
 78+ default: {
 79+ $value = $box['value'];
 80+ }
 81+ }
 82+?>
 83+<div style="display:<?php echo $display ?>"<?php echo $clear ?>><?php echo $value ?></div>
 84+<?php
 85+}
 86+?>
 87+</div>
 88+<?php
 89+if( !empty( $optionalSections ) ) {
 90+?>
 91+ <div id="createpage_optionals"><span id="createpage_optionals_text"><?php echo wfMsg( 'createpage-optionals-text' ) ?></span><br />
 92+ <span id="createpage_optionals_content">
 93+<?php
 94+ $check = '';
 95+ foreach( $optionalSections as $opt ) {
 96+ if ( in_array( $opt[0], $optional_sections ) ) {
 97+ $check = 'checked="checked"';
 98+ }
 99+?>
 100+ <span id="wpOptional<?php echo $opt[0] ?>">
 101+ <input type="checkbox" id="wpOptionalInput<?php echo $opt[0] ?>" name="wpOptionalInput<?php echo $opt[0] ?>" <?php echo $check ?>/>
 102+ <span id="wpOptionalDesc<?php echo $opt[0] ?>"><?php echo $opt[1] ?></span>
 103+ </span>
 104+<?php
 105+ }
 106+?>
 107+ </span>
 108+ </div>
 109+<?php
 110+}
 111+
 112+
 113+?>
 114+
 115+
 116+
 117+
 118+</div>
 119+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/editpage.tmpl.php
___________________________________________________________________
Added: svn:eol-style
1120 + native
Index: trunk/extensions/CreateAPage/templates/infobox.tmpl.php
@@ -0,0 +1,51 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<fieldset id="cp-infobox-fieldset">
 4+<legend><?php echo wfMsg( 'createpage-infobox-legend' ) ?> <span style="font-size: small; font-weight: normal; margin-left: 5px">[<a id="cp-infobox-toggle" title="toggle" href="#"><?php echo wfMsg( 'createpage-hide' ) ?></a>]</span></legend>
 5+<div id="cp-infobox" style="display: block;">
 6+<input type="hidden" id="wpInfoboxValue" name="wpInfoboxValue" value="<?php echo htmlspecialchars( $infoboxes ) ?>" />
 7+<?php
 8+$inf_par_num = 0;
 9+$inf_image_num = 0;
 10+
 11+foreach ( $inf_pars as $inf_par ) {
 12+ $inf_par = preg_replace( "/=/", "<!---equals--->", $inf_par, 1 );
 13+ $inf_par_pair = preg_split( "/<\!---equals--->/", $inf_par, -1 );
 14+ if ( is_array( $inf_par_pair ) ) {
 15+ if ( preg_match( IMAGEUPLOAD_TAG_SPECIFIC, $inf_par_pair[1], $match ) ) {
 16+ $tmplImg = new EasyTemplate( dirname( __FILE__ ) );
 17+ $tmplImg->set_vars(array(
 18+ 'image_num' => $inf_image_num,
 19+ 'image_helper' => $inf_par,
 20+ 'image_name' => $inf_par_pair[0]
 21+ ));
 22+ $editimage = $tmplImg->render( 'editimage' );
 23+ $inf_image_num++;
 24+?>
 25+<div id="createpage_upload_div<?php echo $inf_image_num ?>">
 26+<label for="wpUploadFile" class="normal-label"><?php echo $inf_par_pair[0] ?></label><?php echo $editimage ?>
 27+<?php
 28+ } elseif( preg_match( INFOBOX_SEPARATOR, $inf_par_pair[1], $math ) ) {
 29+ # Replace each template parameter with <!---separator---> as value with:
 30+ ?>
 31+ <div class="createpage-separator">&nbsp;</div>
 32+ <input type="hidden" name="wpInfoboxPar<?php echo $inf_par_num ?>" value="<!---separator--->" id="wpInfoboxPar<?php echo $inf_par_num ?>" />
 33+ <?php
 34+ $inf_par_num++;
 35+ } else {
 36+?>
 37+<label for="wpInfoboxPar<?php echo $inf_par_num ?>" class="normal-label"><?php echo $inf_par_pair[0] ?></label><input type="text" id="wpInfoboxPar<?php echo $inf_par_num ?>" name="wpInfoboxPar<?php echo $inf_par_num ?>" value="<?php echo htmlspecialchars( trim( $inf_par_pair[1] ) ) ?>" class="normal-input" /><br />
 38+
 39+<script type="text/javascript">
 40+/*<![CDATA[*/
 41+YAHOO.util.Event.onContentReady('<?php echo "wpInfoboxPar" . $inf_par_num ?>', YAHOO.Createpage.ClearInput, {num: <?php echo $inf_par_num ?>});
 42+/*]]>*/
 43+</script>
 44+<?php
 45+ }
 46+ $inf_par_num++;
 47+ }
 48+}
 49+?>
 50+</div>
 51+</fieldset>
 52+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/infobox.tmpl.php
___________________________________________________________________
Added: svn:eol-style
153 + native
Index: trunk/extensions/CreateAPage/templates/toggles.tmpl.php
@@ -0,0 +1,55 @@
 2+<script type="text/javascript">
 3+/*<![CDATA[*/
 4+
 5+// data = [ div, link ]
 6+YAHOO.WRequest.toggle = function( e, data ) {
 7+ YAHOO.util.Event.preventDefault(e);
 8+
 9+ var display = '';
 10+ var text = '';
 11+
 12+ if ( 'none' != YAHOO.util.Dom.getStyle( data[0], 'display' ) ) {
 13+ display = 'none';
 14+ text = <?php echo Xml::encodeJsVar( wfMsg( 'createpage-show' ) ) ?>;
 15+ opacity = 0;
 16+
 17+ onFadeEnd = function() {
 18+ YAHOO.util.Dom.setStyle(data[0], 'display', display);
 19+ YAHOO.util.Dom.get(data[1]).innerHTML = text;
 20+ }
 21+
 22+ var fade = new YAHOO.util.Anim(YAHOO.util.Dom.get(data[0]), {opacity: {to: opacity}}, 0.5);
 23+ fade.onComplete.subscribe(onFadeEnd);
 24+ fade.animate();
 25+ } else {
 26+ display = 'block';
 27+ text = <?php echo Xml::encodeJsVar( wfMsg( 'createpage-hide' ) ) ?>;
 28+ opacity = 1;
 29+
 30+ YAHOO.util.Dom.setStyle(data[0], 'opacity', 0);
 31+
 32+ YAHOO.util.Dom.setStyle(data[0], 'display', display);
 33+ YAHOO.util.Dom.get(data[1]).innerHTML = text;
 34+
 35+ var fade = new YAHOO.util.Anim(YAHOO.util.Dom.get(data[0]), {opacity: {to: opacity}}, 0.5);
 36+ fade.animate();
 37+ }
 38+
 39+};
 40+
 41+YAHOO.util.Event.addListener('cp-chooser-toggle', 'click', YAHOO.WRequest.toggle, ['cp-chooser', 'cp-chooser-toggle']);
 42+
 43+// FIXME onAvailable?
 44+var listeners = YAHOO.util.Event.getListeners('cp-infobox-toggle');
 45+if ( listeners ) {
 46+ for ( var i = 0; i < listeners.length; ++i ) {
 47+ var listener = listeners[i];
 48+ if ( listener.type != 'click' ) {
 49+ YAHOO.util.Event.addListener('cp-infobox-toggle', 'click', YAHOO.WRequest.toggle, ['cp-infobox', 'cp-infobox-toggle']);
 50+ }
 51+ }
 52+} else {
 53+ YAHOO.util.Event.addListener('cp-infobox-toggle', 'click', YAHOO.WRequest.toggle, ['cp-infobox', 'cp-infobox-toggle']);
 54+}
 55+/*]]>*/
 56+</script>
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/toggles.tmpl.php
___________________________________________________________________
Added: svn:eol-style
157 + native
Index: trunk/extensions/CreateAPage/templates/templates-list.tmpl.php
@@ -0,0 +1,1151 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<noscript>
 4+<style type="text/css">
 5+/*<![CDATA[*/
 6+
 7+#wpTableMultiEdit div div .createpage_input_file label,
 8+#cp-infobox div .createpage_input_file label {
 9+ float: left !important;
 10+ background: #ffffff;
 11+ border: none;
 12+ color: black;
 13+ cursor: auto;
 14+}
 15+
 16+#wpTableMultiEdit div div .createpage_input_file label span,
 17+#cp-infobox div .createpage_input_file label span {
 18+ display: none !important;
 19+}
 20+
 21+#wpTableMultiEdit div div .createpage_input_file label input,
 22+#cp-infobox div .createpage_input_file label input {
 23+ position: relative !important;
 24+ font-size: 9pt !important;
 25+ line-height: 12px !important;
 26+ opacity: 100 !important;
 27+ zoom: 1 !important;
 28+ filter: alpha(opacity=100) !important;
 29+}
 30+
 31+/*]]>*/
 32+</style>
 33+</noscript>
 34+
 35+<script type="text/javascript">
 36+/*<![CDATA[*/
 37+
 38+var NoCanDo = false;
 39+
 40+YAHOO.Createpage.PreviewMode = '<?php echo !$ispreview ? 'No' : 'Yes' ?>';
 41+YAHOO.Createpage.RedLinkMode = '<?php echo !$isredlink ? 'No' : 'Yes' ?>';
 42+
 43+YAHOO.Createpage.RedirectCallback = {
 44+ success: function( oResponse ) {
 45+ window.location = wgServer + wgScript + '?title=' + escape( document.getElementById('Createtitle').value ) + '&action=edit&editmode=nomulti&createpage=true';
 46+ },
 47+ failure: function( oResponse ) {
 48+ },
 49+ timeout: 50000
 50+};
 51+
 52+YAHOO.Createpage.SubmitEnabled = false;
 53+
 54+YAHOO.Createpage.ClearInput = function( o ) {
 55+ var Cdone = false;
 56+ var Infobox_callback = function( e, o ) {
 57+ var previewarea = YAHOO.util.Dom.get('createpagepreview');
 58+ if ( !Cdone && ( previewarea == null ) ) {
 59+ Cdone = true;
 60+ YAHOO.util.Dom.get('wpInfoboxPar' + o.num).value = '';
 61+ }
 62+ }
 63+ YAHOO.util.Event.addListener( 'wpInfoboxPar' + o.num, 'focus', Infobox_callback, {num: o.num} );
 64+};
 65+
 66+YAHOO.Createpage.goToEdit = function( e ) {
 67+ var oForm = YAHOO.util.Dom.get('createpageform');
 68+ YAHOO.util.Event.preventDefault(e);
 69+ YAHOO.util.Connect.setForm( oForm, false );
 70+ YAHOO.util.Connect.asyncRequest( 'POST', wgScriptPath + '/index.php?action=ajax&rs=axCreatepageAdvancedSwitch', YAHOO.Createpage.RedirectCallback );
 71+ YAHOO.Createpage.warningPanel.hide();
 72+}
 73+
 74+YAHOO.Createpage.goToLogin = function( e ) {
 75+ YAHOO.util.Event.preventDefault(e);
 76+ if ( YAHOO.Createpage.RedLinkMode ) {
 77+ window.location = wgServer + wgScript + '?title=Special:UserLogin&returnto=' + escape( document.getElementById('Createtitle').value );
 78+ } else {
 79+ window.location = wgServer + wgScript + '?title=Special:UserLogin&returnto=Special:CreatePage';
 80+ }
 81+}
 82+
 83+YAHOO.Createpage.hideWarningPanel = function( e ) {
 84+ if ( YAHOO.Createpage.warningPanel ) {
 85+ YAHOO.Createpage.warningPanel.hide();
 86+ }
 87+}
 88+
 89+YAHOO.Createpage.showWarningPanel = function( e ) {
 90+ YAHOO.util.Event.preventDefault(e);
 91+ if ( document.getElementById('Createtitle').value != '' ) {
 92+ if ( !YAHOO.Createpage.warningPanel ) {
 93+ YAHOO.Createpage.buildWarningPanel();
 94+ }
 95+ YAHOO.Createpage.warningPanel.show();
 96+ YAHOO.util.Dom.get('wpCreatepageWarningYes').focus();
 97+ } else {
 98+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<span style="color: red;"><?php echo wfMsg( 'createpage-give-title' ) ?></span>';
 99+ }
 100+}
 101+
 102+YAHOO.Createpage.hideWarningLoginPanel = function( e ) {
 103+ if ( YAHOO.Createpage.warningLoginPanel ) {
 104+ YAHOO.Createpage.warningLoginPanel.hide();
 105+ }
 106+}
 107+
 108+YAHOO.Createpage.showWarningLoginPanel = function( e ) {
 109+ YAHOO.util.Event.preventDefault(e);
 110+ if ( document.getElementById('Createtitle').value != '' ) {
 111+ if ( !YAHOO.Createpage.warningLoginPanel ) {
 112+ YAHOO.Createpage.buildWarningLoginPanel();
 113+ }
 114+ YAHOO.Createpage.warningLoginPanel.show();
 115+ YAHOO.util.Dom.get('wpCreatepageWarningYes').focus();
 116+ } else {
 117+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<span style="color: red;"><?php echo wfMsg( 'createpage-give-title' ) ?></span>';
 118+ }
 119+}
 120+
 121+YAHOO.Createpage.Abort = function( e, o ) {
 122+ YAHOO.util.Connect.abort( o.request, o.callback );
 123+}
 124+
 125+YAHOO.Createpage.ToolbarButtons = [];
 126+
 127+<?php
 128+ $tool_arr = CreateMultiPage::getToolArray();
 129+ $tool_num = 0;
 130+ global $wgStylePath;
 131+ foreach ( $tool_arr as $single_tool ) { ?>
 132+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>] = [];
 133+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['image'] = '<?php echo $wgStylePath . '/common/images/' . $single_tool['image'] ?>';
 134+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['id'] = '<?php echo $single_tool['id'] ?>';
 135+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['open'] = '<?php echo $single_tool['open'] ?>';
 136+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['close'] = '<?php echo $single_tool['close'] ?>';
 137+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['sample'] = '<?php echo $single_tool['sample'] ?>';
 138+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['tip'] = '<?php echo $single_tool['tip'] ?>';
 139+ YAHOO.Createpage.ToolbarButtons[<?php echo $tool_num ?>]['key'] = '<?php echo $single_tool['key'] ?>';
 140+<?php
 141+ $tool_num++;
 142+ }
 143+?>
 144+
 145+YAHOO.Createpage.UploadCallback = function( oResponse ) {
 146+ if( /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test( oResponse.responseText ) ) {
 147+ var aResponse = eval( '(' + oResponse.responseText + ')' );
 148+ }
 149+ var ProgressBar = YAHOO.util.Dom.get( 'createpage_upload_progress_section' + aResponse['num'] );
 150+
 151+ if ( aResponse['error'] != 1 ) {
 152+ ProgressBar.innerHTML = "<?php echo wfMsg( 'createpage-img-uploaded' ) ?>";
 153+ var target_info = YAHOO.util.Dom.get( 'wpAllUploadTarget' + aResponse['num'] ).value;
 154+ var target_tag = YAHOO.util.Dom.get( target_info );
 155+ target_tag.value = '[[' + aResponse['msg'] + '|thumb]]';
 156+
 157+ var ImageThumbnail = YAHOO.util.Dom.get( 'createpage_image_thumb_section' + aResponse['num'] );
 158+ var thumb_container = YAHOO.util.Dom.get( 'createpage_main_thumb_section' + aResponse['num'] );
 159+ var tempstamp = new Date();
 160+ ImageThumbnail.src = aResponse['url'] + '?' + tempstamp.getTime();
 161+ if ( YAHOO.util.Dom.get( 'wpAllLastTimestamp' + aResponse['num'] ).value == 'None' ) {
 162+ var break_tag = document.createElement('br');
 163+ thumb_container.style.display = '';
 164+ var label_node = YAHOO.util.Dom.get( 'createpage_image_label_section' + aResponse['num'] );
 165+ var par_node = label_node.parentNode;
 166+ par_node.insertBefore( break_tag, label_node );
 167+ }
 168+ YAHOO.util.Dom.get( 'wpAllLastTimestamp' + oResponse.argument ).value = aResponse['timestamp'];
 169+ } else if ( ( aResponse['error'] == 1 ) && ( aResponse['msg'] == 'cp_no_login' ) ) {
 170+ ProgressBar.innerHTML = '<span style="color: red"><?php echo wfMsg( 'createpage-login-required' ) ?>' + '<a href="' + wgServer + wgScript +'?title=Special:Userlogin&returnto=Special:Createpage" id="createpage_login' + oResponse.argument + '"><?php echo wfMsg( 'createpage-login-href' ) ?></a>' + "<?php echo wfMsg( 'createpage-login-required2' ) ?></span>";
 171+ YAHOO.util.Event.addListener( 'createpage_login' + oResponse.argument, 'click', YAHOO.Createpage.showWarningLoginPanel );
 172+ } else {
 173+ ProgressBar.innerHTML = '<span style="color: red">' + aResponse['msg'] + '</span>';
 174+ }
 175+
 176+ YAHOO.util.Dom.get( 'createpage_image_text_section' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-insert-image' ) ?>";
 177+ YAHOO.util.Dom.get( 'createpage_upload_file_section' + oResponse.argument ).style.display = '';
 178+ YAHOO.util.Dom.get( 'createpage_image_text_section' + oResponse.argument ).style.display = '';
 179+ YAHOO.util.Dom.get( 'createpage_image_cancel_section' + oResponse.argument ).style.display = 'none';
 180+};
 181+
 182+YAHOO.Createpage.FailureCallback = function( oResponse ) {
 183+ YAHOO.util.Dom.get( 'createpage_image_text_section' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-insert-image' ) ?>";
 184+ YAHOO.util.Dom.get( 'createpage_upload_progress_section' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-upload-aborted' ) ?>";
 185+ YAHOO.util.Dom.get( 'createpage_upload_file_section' + oResponse.argument ).style.display = '';
 186+ YAHOO.util.Dom.get( 'createpage_image_text_section' + oResponse.argument ).style.display = '';
 187+ YAHOO.util.Dom.get( 'createpage_image_cancel_section' + oResponse.argument ).style.display = 'none';
 188+};
 189+
 190+YAHOO.Createpage.RestoreSection = function( section, text ) {
 191+ var section_content = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.OptionalContentTest, '', section );
 192+ for( var i = 0; i < section_content.length; i++ ) {
 193+ text = text.replace( section_content[i].id, '' );
 194+ }
 195+ section.style.display = 'block';
 196+ return text;
 197+}
 198+
 199+YAHOO.Createpage.UnuseSection = function( section, text ) {
 200+ var section_content = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.OptionalContentTest, '', section );
 201+ var first = true;
 202+ var ivalue = '';
 203+ for( var i = 0; i < section_content.length; i++ ) {
 204+ if ( first ) {
 205+ if ( '' != text ) {
 206+ ivalue += ',';
 207+ }
 208+ first = false;
 209+ } else {
 210+ ivalue += ',';
 211+ }
 212+ ivalue += section_content[i].id;
 213+ }
 214+ section.style.display = 'none';
 215+ return text + ivalue;
 216+}
 217+
 218+YAHOO.Createpage.ToggleSection = function( e, o ) {
 219+ var section = YAHOO.util.Dom.get( 'createpage_section_' + o.num );
 220+ var input = YAHOO.util.Dom.get( 'wpOptionalInput' + o.num );
 221+ var optionals = YAHOO.util.Dom.get( 'wpOptionals' );
 222+ var ivalue = '';
 223+ if ( input.checked ) {
 224+ optionals.value = YAHOO.Createpage.RestoreSection( section, optionals.value );
 225+ } else {
 226+ optionals.value = YAHOO.Createpage.UnuseSection( section, optionals.value );
 227+ }
 228+}
 229+
 230+YAHOO.Createpage.Upload = function( e, o ) {
 231+ var oForm = YAHOO.util.Dom.get('createpageform');
 232+ YAHOO.util.Event.preventDefault(e);
 233+ YAHOO.util.Connect.setForm( oForm, true );
 234+
 235+ var ProgressBar = YAHOO.util.Dom.get('createpage_upload_progress_section' + o.num);
 236+ ProgressBar.style.display = 'block';
 237+ ProgressBar.innerHTML = '<img src="' + wgServer + stylepath + '/skins/common/images/spinner.gif" width="16" height="16" alt="wait" border="0" />&nbsp;';
 238+
 239+ var callback = {
 240+ success: YAHOO.Createpage.UploadCallback,
 241+ failure: YAHOO.Createpage.FailureCallback,
 242+ argument: [o.num],
 243+ timeout: 240000
 244+ }
 245+
 246+ var sent_request = YAHOO.util.Connect.asyncRequest( 'POST', wgScriptPath + '/index.php?action=ajax&rs=axMultiEditImageUpload&infix=All&num=' + o.num, callback );
 247+ YAHOO.util.Dom.get( 'createpage_image_cancel_section' + o.num ).style.display = '';
 248+ YAHOO.util.Dom.get( 'createpage_image_text_section' + o.num ).style.display = 'none';
 249+
 250+ YAHOO.util.Event.addListener( 'createpage_image_cancel_section' + o.num, 'click', YAHOO.Createpage.Abort, {"request": sent_request, "callback": callback} );
 251+
 252+ var neoInput = document.createElement( 'input' );
 253+ var thisInput = YAHOO.util.Dom.get('createpage_upload_file_section' + o.num);
 254+ var thisContainer = YAHOO.util.Dom.get('createpage_image_label_section' + o.num);
 255+ thisContainer.removeChild( thisInput );
 256+
 257+ neoInput.setAttribute( 'type', 'file' );
 258+ neoInput.setAttribute( 'id', 'createpage_upload_file_section' + o.num );
 259+ neoInput.setAttribute( 'name', 'wpAllUploadFile' + o.num );
 260+ neoInput.setAttribute( 'tabindex', '-1' );
 261+
 262+ thisContainer.appendChild( neoInput );
 263+ YAHOO.util.Event.addListener( 'createpage_upload_file_section' + o.num, 'change', YAHOO.Createpage.Upload, {"num" : o.num } );
 264+
 265+ YAHOO.util.Dom.get( 'createpage_upload_file_section' + o.num ).style.display = 'none';
 266+}
 267+
 268+YAHOO.Createpage.buildWarningPanel = function( e ) {
 269+ var editwarn = document.getElementById( 'createpage_advanced_warning' );
 270+ var editwarn_copy = document.createElement( 'div' );
 271+ editwarn_copy.id = 'createpage_warning_copy';
 272+ editwarn_copy.innerHTML = editwarn.innerHTML;
 273+ document.body.appendChild( editwarn_copy );
 274+ YAHOO.Createpage.warningPanel = new YAHOO.widget.Panel('createpage_warning_copy', {
 275+ width: '250px',
 276+ modal: true,
 277+ constraintoviewport: true,
 278+ draggable: false,
 279+ fixedcenter: true,
 280+ underlay: 'none'
 281+ } );
 282+ YAHOO.Createpage.warningPanel.cfg.setProperty( 'zIndex', 1000 );
 283+ YAHOO.Createpage.warningPanel.render( document.body );
 284+ YAHOO.util.Event.addListener( 'wpCreatepageWarningYes', 'click', YAHOO.Createpage.goToEdit );
 285+ YAHOO.util.Event.addListener( 'wpCreatepageWarningNo', 'click', YAHOO.Createpage.hideWarningPanel );
 286+}
 287+
 288+YAHOO.Createpage.buildWarningLoginPanel = function( e ) {
 289+ var editwarn = document.getElementById( 'createpage_advanced_warning' );
 290+ var editwarn_copy = document.createElement( 'div' );
 291+ editwarn_copy.id = 'createpage_warning_copy2';
 292+ editwarn_copy.innerHTML = editwarn.innerHTML;
 293+ editwarn_copy.childNodes[1].innerHTML = "<?php echo wfMsg( 'login' ) ?>";
 294+ editwarn_copy.childNodes[3].innerHTML = "<?php echo wfMsg( 'createpage-login-warning' ) ?>";
 295+ document.body.appendChild( editwarn_copy );
 296+ YAHOO.Createpage.warningLoginPanel = new YAHOO.widget.Panel('createpage_warning_copy2', {
 297+ width: '250px',
 298+ modal: true,
 299+ constraintoviewport: true,
 300+ draggable: false,
 301+ fixedcenter: true,
 302+ underlay: 'none'
 303+ } );
 304+ YAHOO.Createpage.warningLoginPanel.cfg.setProperty( 'zIndex', 1000 );
 305+ YAHOO.Createpage.warningLoginPanel.render( document.body );
 306+ YAHOO.util.Event.addListener( 'wpCreatepageWarningYes', 'click', YAHOO.Createpage.goToLogin );
 307+ YAHOO.util.Event.addListener( 'wpCreatepageWarningNo', 'click', YAHOO.Createpage.hideWarningLoginPanel );
 308+}
 309+
 310+YAHOO.Createpage.onclickCategoryFn = function( cat, id ) {
 311+ return function() {
 312+ cloudRemove( escape( cat ), id );
 313+ return false;
 314+ }
 315+}
 316+
 317+YAHOO.Createpage.clearTitleMessage = function( e ) {
 318+ YAHOO.util.Event.preventDefault(e);
 319+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '';
 320+}
 321+
 322+YAHOO.Createpage.UploadTest = function( el ) {
 323+ if ( el.id.match( 'createpage_upload_file_section' ) ) {
 324+ return true;
 325+ } else {
 326+ return false;
 327+ }
 328+}
 329+
 330+YAHOO.Createpage.EditTextareaTest = function( el ) {
 331+ if ( el.id.match( 'wpTextboxes' ) && ( el.style.display != 'none' ) ) {
 332+ return true;
 333+ } else {
 334+ return false;
 335+ }
 336+}
 337+
 338+YAHOO.Createpage.OptionalSectionTest = function( el ) {
 339+ if ( el.id.match( 'wpOptionalInput' ) && ( el.style.display != 'none' ) ) {
 340+ return true;
 341+ } else {
 342+ return false;
 343+ }
 344+}
 345+
 346+YAHOO.Createpage.OptionalContentTest = function( el ) {
 347+ if ( el.id.match( 'wpTextboxes' ) ) {
 348+ return true;
 349+ } else {
 350+ return false;
 351+ }
 352+}
 353+
 354+YAHOO.Createpage.UploadEvent = function( el ) {
 355+ var j = parseInt( el.id.replace( 'createpage_upload_file_section', '' ) );
 356+ YAHOO.util.Event.addListener( 'createpage_upload_file_section' + j, 'change', YAHOO.Createpage.Upload, {num : j } );
 357+}
 358+
 359+YAHOO.Createpage.TextareaAddToolbar = function( el ) {
 360+ var el_id = parseInt( el.id.replace( 'wpTextboxes', '' ) );
 361+ YAHOO.Createpage.multiEditTextboxes[YAHOO.Createpage.multiEditTextboxes.length] = el_id;
 362+ YAHOO.Createpage.multiEditButtons[el_id] = [];
 363+ YAHOO.Createpage.multiEditCustomButtons[el_id] = [];
 364+ YAHOO.util.Event.addListener( el.id, 'focus', YAHOO.Createpage.showThisBox, {'toolbarId' : el_id } );
 365+
 366+ YAHOO.util.Event.addListener( 'wpTextIncrease' + el_id, 'click', YAHOO.Createpage.resizeThisTextarea, {'textareaId' : el_id, 'numRows' : 1 } );
 367+ YAHOO.util.Event.addListener( 'wpTextDecrease' + el_id, 'click', YAHOO.Createpage.resizeThisTextarea, {'textareaId' : el_id, 'numRows' : -1 } );
 368+
 369+ for ( var i = 0; i < YAHOO.Createpage.ToolbarButtons.length; i++ ) {
 370+ YAHOO.Createpage.addMultiEditButton(
 371+ YAHOO.Createpage.ToolbarButtons[i]['image'],
 372+ YAHOO.Createpage.ToolbarButtons[i]['tip'],
 373+ YAHOO.Createpage.ToolbarButtons[i]['open'],
 374+ YAHOO.Createpage.ToolbarButtons[i]['close'],
 375+ YAHOO.Createpage.ToolbarButtons[i]['sample'],
 376+ YAHOO.Createpage.ToolbarButtons[i]['id'] + el_id,
 377+ el_id
 378+ );
 379+ }
 380+}
 381+
 382+YAHOO.Createpage.foundCategories = [];
 383+
 384+YAHOO.Createpage.CheckCategoryCloud = function() {
 385+ var cat_textarea = YAHOO.util.Dom.get('wpCategoryTextarea');
 386+ if ( !cat_textarea ) {
 387+ return;
 388+ }
 389+
 390+ var cat_full_section = YAHOO.util.Dom.get('createpage_cloud_section');
 391+
 392+ var cloud_num = ( cat_full_section.childNodes.length - 1 ) / 2;
 393+ var n_cat_count = cloud_num;
 394+ var text_categories = new Array();
 395+ for ( i = 0; i < cloud_num; i++ ) {
 396+ var cloud_id = 'cloud' + i;
 397+ var found_category = YAHOO.util.Dom.get(cloud_id).innerHTML;
 398+ if ( found_category ) {
 399+ YAHOO.Createpage.foundCategories[i] = found_category;
 400+ }
 401+ }
 402+
 403+ var categories = cat_textarea.value;
 404+ if ( '' == categories ) {
 405+ return;
 406+ }
 407+
 408+ categories = categories.split("|");
 409+ for ( i = 0; i < categories.length; i++ ) {
 410+ text_categories [i] = categories[i];
 411+ }
 412+
 413+ for ( i = 0; i < text_categories.length;i++) {
 414+ var c_found = false;
 415+ for ( j in YAHOO.Createpage.foundCategories ) {
 416+ var core_cat = text_categories[i].replace (/\|.*/,'');
 417+ if ( YAHOO.Createpage.foundCategories[j] == core_cat ) {
 418+ this_button = YAHOO.util.Dom.get('cloud' + j);
 419+ var actual_cloud = YAHOO.Createpage.foundCategories[j];
 420+ var cl_num = j;
 421+
 422+ this_button.onclick = YAHOO.Createpage.onclickCategoryFn( text_categories[i], j );
 423+ this_button.style.color = '#419636';
 424+ c_found = true;
 425+ break;
 426+ }
 427+ }
 428+ if ( !c_found ) {
 429+ var n_cat = document.createElement( 'a' );
 430+ var s_cat = document.createElement( 'span' );
 431+ n_cat_count++;
 432+ var cat_num = n_cat_count - 1;
 433+ n_cat.setAttribute( 'id', 'cloud' + cat_num );
 434+ n_cat.setAttribute( 'href', '#' );
 435+ n_cat.onclick = YAHOO.Createpage.onclickCategoryFn( text_categories[i], cat_num );
 436+ n_cat.style.color = '#419636';
 437+ n_cat.style.fontSize = '10pt';
 438+ s_cat.setAttribute( 'id', 'tag' + n_cat_count );
 439+ t_cat = document.createTextNode( core_cat );
 440+ space = document.createTextNode( ' ' );
 441+ n_cat.appendChild( t_cat );
 442+ s_cat.appendChild( n_cat );
 443+ s_cat.appendChild( space );
 444+ cat_full_section.appendChild( s_cat );
 445+ }
 446+ }
 447+}
 448+
 449+YAHOO.Createpage.multiEditTextboxes = [];
 450+YAHOO.Createpage.multiEditButtons = [];
 451+YAHOO.Createpage.multiEditCustomButtons = [];
 452+
 453+YAHOO.Createpage.addMultiEditButton = function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId, toolbarId ) {
 454+ YAHOO.Createpage.multiEditButtons[toolbarId][YAHOO.Createpage.multiEditButtons[toolbarId].length] = {
 455+ 'imageId': imageId,
 456+ 'toolbarId': toolbarId,
 457+ 'imageFile': imageFile,
 458+ 'speedTip': speedTip,
 459+ 'tagOpen': tagOpen,
 460+ 'tagClose': tagClose,
 461+ 'sampleText': sampleText
 462+ };
 463+}
 464+
 465+YAHOO.Createpage.showThisBox = function( e, o ) {
 466+ YAHOO.util.Event.preventDefault(e);
 467+ YAHOO.util.Dom.get('toolbar' + o.toolbarId).style.display = '';
 468+ YAHOO.Createpage.hideOtherBoxes(o.toolbarId);
 469+}
 470+
 471+YAHOO.Createpage.resizeThisTextarea = function( e, o ) {
 472+ YAHOO.util.Event.preventDefault(e);
 473+ var r_textarea = YAHOO.util.Dom.get( 'wpTextboxes' + o.textareaId );
 474+ if (
 475+ !( ( r_textarea.rows < 4 ) && ( o.numRows < 0 ) ) &&
 476+ !( ( r_textarea.rows > 10 ) && ( o.numRows > 0 ) )
 477+ ) {
 478+ r_textarea.rows = r_textarea.rows + o.numRows;
 479+ }
 480+}
 481+
 482+YAHOO.Createpage.hideOtherBoxes = function( box_id ) {
 483+ for ( var i = 0; i < YAHOO.Createpage.multiEditTextboxes.length; i++ ) {
 484+ if ( YAHOO.Createpage.multiEditTextboxes[i] != box_id ) {
 485+ YAHOO.util.Dom.get( 'toolbar' + YAHOO.Createpage.multiEditTextboxes[i] ).style.display = 'none';
 486+ }
 487+ }
 488+}
 489+
 490+YAHOO.Createpage.multiEditSetupToolbar = function() {
 491+ for ( var j = 0; j < YAHOO.Createpage.multiEditButtons.length; j++ ) {
 492+ var toolbar = document.getElementById( 'toolbar' + j );
 493+ if ( toolbar ) {
 494+ var textbox = document.getElementById( 'wpTextboxes' + j );
 495+ if ( !textbox ) {
 496+ return false;
 497+ }
 498+ if ( !( document.selection && document.selection.createRange )
 499+ && textbox.selectionStart === null
 500+ ) {
 501+ return false;
 502+ }
 503+
 504+ for ( var i = 0; i < YAHOO.Createpage.multiEditButtons[j].length; i++ ) {
 505+ YAHOO.Createpage.insertMultiEditButton( toolbar, YAHOO.Createpage.multiEditButtons[j][i] );
 506+ }
 507+ }
 508+ }
 509+ return true;
 510+}
 511+
 512+YAHOO.Createpage.multiEditSetupOptionalSections = function() {
 513+ var snum = 0;
 514+ if ( YAHOO.util.Dom.get( 'createpage_optionals_content' ) ) {
 515+ var optionals = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.OptionalSectionTest, 'input', YAHOO.util.Dom.get( 'createpage_optionals_content' ) );
 516+ var optionalsElements = YAHOO.util.Dom.get( 'wpOptionals' );
 517+ for ( i = 0; i < optionals.length; i++ ) {
 518+ snum = optionals[i].id.replace( 'wpOptionalInput', '' );
 519+ if ( !YAHOO.util.Dom.get( 'wpOptionalInput' + snum ).checked ) {
 520+ optionalsElements.value = YAHOO.Createpage.UnuseSection( YAHOO.util.Dom.get( 'createpage_section_' + snum ), optionalsElements.value );
 521+ }
 522+ YAHOO.util.Event.addListener( optionals[i], 'change', YAHOO.Createpage.ToggleSection, {num: snum} );
 523+ }
 524+ }
 525+}
 526+
 527+YAHOO.Createpage.insertMultiEditButton = function( parent, item ) {
 528+ var image = document.createElement( 'img' );
 529+ image.width = 23;
 530+ image.height = 22;
 531+ image.className = 'mw-toolbar-editbutton';
 532+ if ( item.imageId ) {
 533+ image.id = item.imageId;
 534+ }
 535+ image.src = item.imageFile;
 536+ image.border = 0;
 537+ image.alt = item.speedTip;
 538+ image.title = item.speedTip;
 539+ image.style.cursor = 'pointer';
 540+
 541+ parent.appendChild( image );
 542+ YAHOO.util.Event.addListener(
 543+ item.imageId,
 544+ 'click',
 545+ YAHOO.Createpage.insertTags, {
 546+ 'tagOpen' : item.tagOpen,
 547+ 'tagClose' : item.tagClose,
 548+ 'sampleText' : item.sampleText,
 549+ 'textareaId' : 'wpTextboxes' + item.toolbarId
 550+ }
 551+ );
 552+ return true;
 553+}
 554+
 555+YAHOO.Createpage.insertTags = function( e, o ) {
 556+ YAHOO.util.Event.preventDefault(e);
 557+ var textarea = YAHOO.util.Dom.get( o.textareaId );
 558+ if ( !textarea ) {
 559+ return;
 560+ }
 561+ var selText, isSample = false;
 562+
 563+ if ( document.selection && document.selection.createRange ) {
 564+ if ( document.documentElement && document.documentElement.scrollTop ) {
 565+ var winScroll = document.documentElement.scrollTop;
 566+ } else if ( document.body ) {
 567+ var winScroll = document.body.scrollTop;
 568+ }
 569+ textarea.focus();
 570+ var range = document.selection.createRange();
 571+ selText = range.text;
 572+ checkSelectedText();
 573+ range.text = o.tagOpen + selText + o.tagClose;
 574+ if ( isSample && range.moveStart ) {
 575+ if ( window.opera ) {
 576+ o.tagClose = o.tagClose.replace(/\n/g,'');
 577+ }
 578+ range.moveStart('character', - o.tagClose.length - selText.length);
 579+ range.moveEnd('character', - o.tagClose.length);
 580+ }
 581+ range.select();
 582+ if ( document.documentElement && document.documentElement.scrollTop ) {
 583+ document.documentElement.scrollTop = winScroll;
 584+ } else if ( document.body ) {
 585+ document.body.scrollTop = winScroll;
 586+ }
 587+ } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
 588+ var textScroll = textarea.scrollTop;
 589+ textarea.focus();
 590+ var startPos = textarea.selectionStart;
 591+ var endPos = textarea.selectionEnd;
 592+ selText = textarea.value.substring( startPos, endPos );
 593+ checkSelectedText();
 594+ textarea.value = textarea.value.substring( 0, startPos )
 595+ + o.tagOpen + selText + o.tagClose
 596+ + textarea.value.substring( endPos, textarea.value.length );
 597+ if ( isSample ) {
 598+ textarea.selectionStart = startPos +o.tagOpen.length;
 599+ textarea.selectionEnd = startPos + o.tagOpen.length + selText.length;
 600+ } else {
 601+ textarea.selectionStart = startPos + o.tagOpen.length + selText.length + o.tagClose.length;
 602+ textarea.selectionEnd = textarea.selectionStart;
 603+ }
 604+ textarea.scrollTop = textScroll;
 605+ }
 606+
 607+ function checkSelectedText() {
 608+ if ( !selText ) {
 609+ selText = o.sampleText;
 610+ isSample = true;
 611+ } else if ( selText.charAt( selText.length - 1 ) == ' ' ) {
 612+ selText = selText.substring( 0, selText.length - 1 );
 613+ o.tagClose += ' ';
 614+ }
 615+ }
 616+}
 617+
 618+window.onresize = function() {
 619+ if ( YAHOO.Createpage.Overlay && ( YAHOO.util.Dom.get('createpageoverlay').style.visibility != 'hidden' ) ) {
 620+ YAHOO.Createpage.ResizeOverlay( 0 );
 621+ }
 622+};
 623+
 624+YAHOO.CreatepageInfobox.UploadCallback = function( oResponse ) {
 625+ if( /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test( oResponse.responseText ) ) {
 626+ var aResponse = eval( '(' + oResponse.responseText + ')' );
 627+ }
 628+ var ProgressBar = YAHOO.util.Dom.get( 'createpage_upload_progress' + oResponse.argument );
 629+ if ( aResponse['error'] != 1 ) {
 630+ var xInfoboxText = YAHOO.util.Dom.get( 'wpInfoboxValue' ).value;
 631+ var xImageHelper = YAHOO.util.Dom.get( 'wpInfImg' + oResponse.argument ).value;
 632+ YAHOO.util.Dom.get( 'wpInfImg' + oResponse.argument ).value = aResponse['msg'];
 633+ YAHOO.util.Dom.get( 'wpNoUse' + oResponse.argument ).value = 'Yes';
 634+ ProgressBar.innerHTML = "<?php echo wfMsg( 'createpage-img-uploaded' ) ?>";
 635+ var ImageThumbnail = YAHOO.util.Dom.get( 'createpage_image_thumb' + oResponse.argument );
 636+ var thumb_container = YAHOO.util.Dom.get( 'createpage_main_thumb' + oResponse.argument );
 637+ var tempstamp = new Date();
 638+ ImageThumbnail.src = aResponse['url'] + '?' + tempstamp.getTime();
 639+ if ( YAHOO.util.Dom.get( 'wpLastTimestamp' + oResponse.argument ).value == 'None' ) {
 640+ var break_tag = document.createElement( 'br' );
 641+ thumb_container.style.display = '';
 642+ var label_node = YAHOO.util.Dom.get( 'createpage_image_label' + oResponse.argument );
 643+ var par_node = label_node.parentNode;
 644+ par_node.insertBefore( break_tag, label_node );
 645+ }
 646+ YAHOO.util.Dom.get( 'wpLastTimestamp' + oResponse.argument ).value = aResponse['timestamp'];
 647+ } else if ( ( aResponse['error'] == 1 ) && ( aResponse['msg'] == 'cp_no_login' ) ) {
 648+ ProgressBar.innerHTML = '<span style="color: red"><?php echo wfMsg( 'createpage-login-required' ) ?>' + '<a href="' + wgServer + wgScript + '?title=Special:UserLogin&returnto=Special:CreatePage" id="createpage_login_infobox' + oResponse.argument + '" ><?php echo wfMsg( 'createpage-login-href' ) ?></a>' + "<?php echo wfMsg( 'createpage-login-required2' ) ?></span>";
 649+ YAHOO.util.Event.addListener('createpage_login_infobox' + oResponse.argument, 'click', YAHOO.Createpage.showWarningLoginPanel );
 650+ } else {
 651+ ProgressBar.innerHTML = '<span style="color: red">' + aResponse['msg'] + '</span>';
 652+ }
 653+ YAHOO.util.Dom.get( 'createpage_image_text' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-insert-image' ) ?>";
 654+ YAHOO.util.Dom.get( 'createpage_upload_file' + oResponse.argument ).style.display = '';
 655+ YAHOO.util.Dom.get( 'createpage_image_text' + oResponse.argument ).style.display = '';
 656+ YAHOO.util.Dom.get( 'createpage_image_cancel' + oResponse.argument ).style.display = 'none';
 657+};
 658+
 659+YAHOO.CreatepageInfobox.FailureCallback = function( oResponse ) {
 660+ YAHOO.util.Dom.get( 'createpage_image_text' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-insert-image' ) ?>";
 661+ YAHOO.util.Dom.get( 'createpage_upload_progress' + oResponse.argument ).innerHTML = "<?php echo wfMsg( 'createpage-upload-aborted' ) ?>";
 662+ YAHOO.util.Dom.get( 'createpage_upload_file' + oResponse.argument ).style.display = '';
 663+ YAHOO.util.Dom.get( 'createpage_image_text' + oResponse.argument ).style.display = '';
 664+ YAHOO.util.Dom.get( 'createpage_image_cancel' + oResponse.argument ).style.display = 'none';
 665+};
 666+
 667+YAHOO.CreatepageInfobox.Abort = function( e, o ) {
 668+ YAHOO.util.Connect.abort( o.request, o.callback );
 669+}
 670+
 671+YAHOO.CreatepageInfobox.Upload = function( e, o ) {
 672+ var n = o.num;
 673+ var oForm = YAHOO.util.Dom.get( 'createpageform' );
 674+ if ( oForm ) {
 675+ YAHOO.util.Event.preventDefault(e);
 676+ YAHOO.util.Connect.setForm( oForm, true );
 677+ var ProgressBar = YAHOO.util.Dom.get( 'createpage_upload_progress' + o.num );
 678+ ProgressBar.style.display = 'block';
 679+ ProgressBar.innerHTML = '<img src="' + wgServer + stylepath + '/common/images/spinner.gif" width="16" height="16" alt="wait" border="0" />&nbsp;';
 680+
 681+ var callback = {
 682+ upload: YAHOO.CreatepageInfobox.UploadCallback,
 683+ failure: YAHOO.CreatepageInfobox.FailureCallback,
 684+ timeout: 60000,
 685+ argument: [n]
 686+ };
 687+
 688+ var sent_request = YAHOO.util.Connect.asyncRequest( 'POST', wgScriptPath + '/index.php?action=ajax&rs=axMultiEditImageUpload&num=' + n, callback );
 689+ YAHOO.util.Dom.get( 'createpage_image_cancel' + o.num ).style.display = '';
 690+ YAHOO.util.Dom.get( 'createpage_image_text' + o.num ).style.display = 'none';
 691+
 692+ YAHOO.util.Event.addListener( 'createpage_image_cancel' + o.num, 'click', YAHOO.CreatepageInfobox.Abort, {"request": sent_request, "callback": callback} );
 693+
 694+ var neoInput = document.createElement( 'input' );
 695+ var thisInput = YAHOO.util.Dom.get( 'createpage_upload_file' + o.num );
 696+ var thisContainer = YAHOO.util.Dom.get( 'createpage_image_label' + o.num );
 697+ thisContainer.removeChild( thisInput );
 698+
 699+ neoInput.setAttribute( 'type', 'file' );
 700+ neoInput.setAttribute( 'id', 'createpage_upload_file' + o.num );
 701+ neoInput.setAttribute( 'name', 'wpUploadFile' + o.num );
 702+ neoInput.setAttribute( 'tabindex', '-1' );
 703+
 704+ thisContainer.appendChild( neoInput );
 705+ YAHOO.util.Event.addListener( 'createpage_upload_file' + o.num, 'change', YAHOO.CreatepageInfobox.Upload, {"num" : o.num } );
 706+
 707+ YAHOO.util.Dom.get( 'createpage_upload_file' + o.num ).style.display = 'none';
 708+ }
 709+}
 710+
 711+YAHOO.CreatepageInfobox.InputTest = function( el ) {
 712+ if ( el.id.match( 'wpInfoboxPar' ) ) {
 713+ return true;
 714+ } else {
 715+ return false;
 716+ }
 717+}
 718+
 719+YAHOO.CreatepageInfobox.InputEvent = function( el ) {
 720+ var j = parseInt( el.id.replace( 'wpInfoboxPar', '' ) );
 721+ YAHOO.util.Event.onContentReady( 'wpInfoboxPar' + j, YAHOO.Createpage.ClearInput, {num: j} );
 722+}
 723+
 724+YAHOO.CreatepageInfobox.UploadTest = function( el ) {
 725+ if ( el.id.match( 'createpage_upload_file' ) ) {
 726+ return true;
 727+ } else {
 728+ return false;
 729+ }
 730+}
 731+
 732+YAHOO.Createpage.InitialRound = function() {
 733+ YAHOO.util.Dom.get('Createtitle').setAttribute('autocomplete', 'off');
 734+ if ( ( YAHOO.Createpage.PreviewMode == 'No' ) && ( YAHOO.Createpage.RedLinkMode == 'No' ) ) {
 735+ YAHOO.Createpage.ContentOverlay();
 736+ } else {
 737+ var catlink = YAHOO.util.Dom.get( 'catlinks' );
 738+ if ( catlink ) {
 739+ var newCatlink = document.createElement( 'div' );
 740+ newCatlink.setAttribute( 'id', 'catlinks' );
 741+ newCatlink.innerHTML = catlink.innerHTML;
 742+ catlink.parentNode.removeChild( catlink );
 743+ var previewArea = YAHOO.util.Dom.get( 'createpagepreview' );
 744+ previewArea.insertBefore( newCatlink, YAHOO.util.Dom.get( 'createpage_preview_delimiter' ) );
 745+ }
 746+ }
 747+
 748+ var edit_textareas = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.EditTextareaTest, 'textarea', YAHOO.util.Dom.get('wpTableMultiEdit'), YAHOO.Createpage.TextareaAddToolbar );
 749+ if ( ( 'Yes' == YAHOO.Createpage.RedLinkMode ) && ( 'wpTextboxes0' == edit_textareas[0].id ) ) {
 750+ edit_textareas[0].focus();
 751+ } else {
 752+ var el_id = parseInt( edit_textareas[0].id.replace( 'wpTextboxes', '' ) );
 753+ YAHOO.util.Dom.get('toolbar' + el_id).style.display = '';
 754+ YAHOO.Createpage.hideOtherBoxes( el_id );
 755+ }
 756+ YAHOO.Createpage.multiEditSetupToolbar();
 757+ YAHOO.Createpage.multiEditSetupOptionalSections();
 758+ YAHOO.Createpage.CheckCategoryCloud();
 759+}
 760+
 761+YAHOO.Createpage.ContentOverlay = function() {
 762+ YAHOO.Createpage.Overlay = new YAHOO.widget.Overlay('createpageoverlay');
 763+ YAHOO.Createpage.ResizeOverlay( 20 );
 764+ YAHOO.Createpage.Overlay.render();
 765+ var helperButton = YAHOO.util.Dom.get('wpRunInitialCheck');
 766+ YAHOO.util.Event.addListener( helperButton, 'click', YAHOO.WRequest.watchTitle );
 767+ helperButton.style.display = '';
 768+}
 769+
 770+YAHOO.Createpage.appendHeight = function( elem_height, number ) {
 771+ var x_fixed_height = elem_height.replace('px', '');
 772+ x_fixed_height = parseFloat( x_fixed_height ) + number;
 773+ x_fixed_height = x_fixed_height.toString() + 'px';
 774+ return x_fixed_height;
 775+}
 776+
 777+YAHOO.Createpage.ResizeOverlay = function( number ) {
 778+ var cont_elem = new YAHOO.util.Element('cp-restricted');
 779+ var fixed_height;
 780+ var fixed_width;
 781+ if ( cont_elem.getStyle( 'height' ) == 'auto' ) {
 782+ fixed_height = YAHOO.util.Dom.get( 'cp-restricted' ).offsetHeight + number;
 783+ fixed_width = YAHOO.util.Dom.get( 'cp-restricted' ).offsetWidth;
 784+ } else {
 785+ fixed_height = cont_elem.getStyle( 'height' );
 786+ fixed_height = YAHOO.Createpage.appendHeight( fixed_height, number );
 787+ fixed_width = cont_elem.getStyle( 'width' );
 788+ }
 789+
 790+ YAHOO.Createpage.Overlay.cfg.setProperty( 'height', fixed_height );
 791+ YAHOO.Createpage.Overlay.cfg.setProperty( 'width', fixed_width );
 792+}
 793+
 794+YAHOO.util.Event.onContentReady( 'cp-multiedit', YAHOO.Createpage.InitialRound );
 795+
 796+YAHOO.CreatepageInfobox.UploadEvent = function( el ) {
 797+ var j = parseInt( el.id.replace( 'createpage_upload_file', '' ) );
 798+ YAHOO.util.Event.addListener( 'createpage_upload_file' + j, 'change', YAHOO.CreatepageInfobox.Upload, {'num' : j } );
 799+}
 800+
 801+YAHOO.util.Event.addListener( 'wpAdvancedEdit', 'click', YAHOO.Createpage.showWarningPanel );
 802+YAHOO.util.Event.addListener( 'Createtitle', 'focus', YAHOO.Createpage.clearTitleMessage );
 803+
 804+function cloudAdd( category, num ) {
 805+ category_text = YAHOO.util.Dom.get('wpCategoryTextarea');
 806+
 807+ if ( category_text.value == '' ) {
 808+ category_text.value += unescape( category );
 809+ } else {
 810+ category_text.value += '|' + unescape( category );
 811+ }
 812+ this_button = document.getElementById('cloud' + num);
 813+ this_button.onclick = function() {
 814+ eval("cloudRemove('" + category + "'," + num + ")");
 815+ return false;
 816+ }
 817+ this_button.style['color'] = '#419636';
 818+ return false;
 819+};
 820+
 821+function cloudInputAdd() {
 822+ category_input = YAHOO.util.Dom.get('wpCategoryInput');
 823+ category_text = YAHOO.util.Dom.get('wpCategoryTextarea');
 824+ var category = category_input.value;
 825+ if ( '' != category_input.value ) {
 826+ if ( category_text.value == '' ) {
 827+ category_text.value += unescape( category );
 828+ } else {
 829+ category_text.value += '|' + unescape( category );
 830+ }
 831+ category_input.value = '';
 832+ var c_found = false;
 833+ var core_cat = category.replace(/\|.*/,'');
 834+ for ( j in YAHOO.Createpage.foundCategories ) {
 835+ if ( YAHOO.Createpage.foundCategories[j] == core_cat ) {
 836+ this_button = YAHOO.util.Dom.get( 'cloud' + j );
 837+ var actual_cloud = YAHOO.Createpage.foundCategories[j];
 838+ var cl_num = j;
 839+
 840+ this_button.onclick = YAHOO.Createpage.onclickCategoryFn( core_cat, j );
 841+ this_button.style.color = '#419636';
 842+ c_found = true;
 843+ break;
 844+ }
 845+ }
 846+ if ( !c_found ) {
 847+ var n_cat = document.createElement( 'a' );
 848+ var s_cat = document.createElement( 'span' );
 849+ n_cat_count = YAHOO.Createpage.foundCategories.length;
 850+
 851+ var cat_full_section = YAHOO.util.Dom.get('createpage_cloud_section');
 852+ var cat_num = n_cat_count;
 853+ n_cat.setAttribute( 'id', 'cloud' + cat_num );
 854+ n_cat.setAttribute( 'href', '#' );
 855+ n_cat.onclick = YAHOO.Createpage.onclickCategoryFn( core_cat, cat_num );
 856+ n_cat.style.color = '#419636';
 857+ n_cat.style.fontSize = '10pt';
 858+ s_cat.setAttribute( 'id', 'tag' + cat_num );
 859+ t_cat = document.createTextNode( core_cat );
 860+ space = document.createTextNode( ' ' );
 861+ n_cat.appendChild( t_cat );
 862+ s_cat.appendChild( n_cat );
 863+ s_cat.appendChild( space );
 864+ cat_full_section.appendChild( s_cat );
 865+ YAHOO.Createpage.foundCategories[n_cat_count] = core_cat;
 866+ }
 867+ }
 868+}
 869+
 870+function cloudRemove( category, num ) {
 871+ category_text = YAHOO.util.Dom.get('wpCategoryTextarea');
 872+ this_pos = category_text.value.indexOf( unescape( category ) );
 873+ if ( this_pos != -1 ) {
 874+ category_text.value = category_text.value.substr( 0, this_pos - 1 ) + category_text.value.substr( this_pos + unescape( category ).length );
 875+ }
 876+ this_button = document.getElementById('cloud' + num);
 877+ this_button.onclick = function() {
 878+ eval("cloudAdd('" + category + "'," + num + ")");
 879+ return false;
 880+ };
 881+ this_button.style['color'] = '';
 882+ return false;
 883+};
 884+
 885+function cloudBuild( o ) {
 886+ var categories = o.value;
 887+ new_text = '';
 888+ categories = categories.split('|');
 889+ for ( i = 0; i < categories.length; i++ ) {
 890+ if ( categories[i] != '' ) {
 891+ new_text += '[[Category:' + categories[i] + ']]';
 892+ }
 893+ }
 894+ return new_text;
 895+};
 896+
 897+/*]]>*/
 898+</script>
 899+
 900+<?php if ( !$ispreview ) { ?>
 901+
 902+<div id="templateThumbs">
 903+<?php } ?>
 904+ <?php $elements_for_yui = array();
 905+ if ( !$ispreview ) {
 906+?>
 907+
 908+ <?php foreach ( $data as $e => $element ): ?>
 909+ <?php $name = $element['page']; ?>
 910+ <?php $label = str_replace( ' Page', '', $element['label'] ); ?>
 911+
 912+ <?php $elements_for_yui[] = "'cp-template-{$name}'"; ?>
 913+
 914+ <?php
 915+ $thumb = '';
 916+ if ( !empty( $element['preview'] ) ) {
 917+ $thumb = "<img id=\"cp-template-$name-thumb\" src=\"" . $element['preview'] . "\" alt=\"$name\" />";
 918+ } else {
 919+ }
 920+ ?>
 921+
 922+ <div class="templateFrame<?php if ( $e == count( $data ) - 1 ) { ?> templateFrameLast<?php } ?><?php if ( $selected[$name] == 'checked' ) { ?> templateFrameSelected<?php } ?>" id="cp-template-<?php echo $name ?>">
 923+ <label for="cp-template-<?php echo $name ?>-radio">
 924+ <?php echo $thumb ?>
 925+ </label>
 926+ <div>
 927+ <input type="radio" name="createplates" id="cp-template-<?php echo $name ?>-radio" value="<?php echo $name ?>" <?php echo $selected[$name] ?> />
 928+ <label for="cp-template-<?php echo $name ?>-radio"><?php echo $label ?></label>
 929+ </div>
 930+ </div>
 931+ <?php endforeach; ?>
 932+</div>
 933+
 934+<?php } ?>
 935+
 936+<div style="clear: both"></div>
 937+
 938+<script type="text/javascript">
 939+/*<![CDATA[*/
 940+
 941+var myid = 0;
 942+
 943+YAHOO.Createpage.TestInfoboxToggle = function() {
 944+ var listeners = YAHOO.util.Event.getListeners('cp-infobox-toggle');
 945+ if ( listeners ) {
 946+ for ( var i = 0; i < listeners.length; ++i ) {
 947+ var listener = listeners[i];
 948+ if ( listener.type != 'click' ) {
 949+ YAHOO.util.Event.addListener( 'cp-infobox-toggle', 'click', YAHOO.WRequest.toggle, ['cp-infobox', 'cp-infobox-toggle'] );
 950+ }
 951+ }
 952+ } else {
 953+ YAHOO.util.Event.addListener( 'cp-infobox-toggle', 'click', YAHOO.WRequest.toggle, ['cp-infobox', 'cp-infobox-toggle'] );
 954+ }
 955+}
 956+
 957+YAHOO.Createpage.MultiEdit = function() {
 958+ var elements = [<?php echo join( ', ', $elements_for_yui ) ?>];
 959+ var callback = {
 960+ success: function( e ) {
 961+ YAHOO.util.Dom.get('cp-multiedit').innerHTML = '';
 962+
 963+ if( /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test( e.responseText ) ) {
 964+ var res = eval( '(' + e.responseText + ')' );
 965+ }
 966+ if ( '' != res ) {
 967+ YAHOO.util.Dom.get('cp-multiedit').innerHTML = res;
 968+ }
 969+
 970+ var i;
 971+ for ( i in elements ) {
 972+ YAHOO.util.Dom.get( elements[i] ).className = 'templateFrame';
 973+ }
 974+
 975+ YAHOO.util.Dom.get( myid ).className += ' templateFrameSelected';
 976+
 977+ YAHOO.util.Event.onAvailable( 'cp-infobox-toggle', YAHOO.Createpage.TestInfoboxToggle );
 978+
 979+ var infobox_root = YAHOO.util.Dom.get('cp-infobox');
 980+ var infobox_inputs = YAHOO.util.Dom.getElementsBy( YAHOO.CreatepageInfobox.InputTest, 'input', infobox_root, YAHOO.CreatepageInfobox.InputEvent );
 981+ var infobox_uploads = YAHOO.util.Dom.getElementsBy( YAHOO.CreatepageInfobox.UploadTest, 'input', infobox_root, YAHOO.CreatepageInfobox.UploadEvent );
 982+ var content_root = YAHOO.util.Dom.get( 'wpTableMultiEdit' );
 983+ var section_uploads = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.UploadTest, 'input', content_root, YAHOO.Createpage.UploadEvent );
 984+
 985+ var cloud_div = YAHOO.util.Dom.get( 'createpage_cloud_div' );
 986+ if ( null != cloud_div ) {
 987+ cloud_div.style.display = 'block';
 988+ }
 989+ YAHOO.Createpage.CheckCategoryCloud();
 990+
 991+ var cont_elem = new YAHOO.util.Element( 'cp-restricted' );
 992+
 993+ if ( YAHOO.Createpage.Overlay && ( YAHOO.util.Dom.get('createpageoverlay').style.visibility != 'hidden' ) ) {
 994+ YAHOO.Createpage.ResizeOverlay( 20 );
 995+ }
 996+
 997+ YAHOO.Createpage.multiEditTextboxes = [];
 998+ YAHOO.Createpage.multiEditButtons = [];
 999+ YAHOO.Createpage.multiEditCustomButtons = [];
 1000+
 1001+ var edit_textareas = YAHOO.util.Dom.getElementsBy( YAHOO.Createpage.EditTextareaTest, 'textarea', content_root, YAHOO.Createpage.TextareaAddToolbar );
 1002+ // Link Suggest
 1003+ /*var link_sugg_area = YAHOO.util.Dom.get( 'wpTextbox1_container' );
 1004+ if ( link_sugg_area ) {
 1005+ if( YAHOO.env.ua.ie > 0 || YAHOO.env.ua.gecko > 0 ) {
 1006+ var oDS = new YAHOO.widget.DS_XHR( wgServer + wgScriptPath, ['results', 'title', 'title_org'] );
 1007+ oDS.scriptQueryAppend = 'action=ajax&rs=getLinkSuggest';
 1008+
 1009+ var content_root = YAHOO.util.Dom.get( 'wpTableMultiEdit' );
 1010+ var edit_textareas = YAHOO.util.Dom.getElementsBy(function( el ) {
 1011+ if ( el.id.match( 'wpTextboxes' ) && ( el.style.display != 'none' ) ) {
 1012+ return true;
 1013+ } else {
 1014+ return false;
 1015+ }
 1016+ }, 'textarea', content_root, function( el ) {
 1017+ LS_PrepareTextarea( el.id, oDS );
 1018+ });
 1019+ }
 1020+ }*/
 1021+
 1022+ if ( ( 'Yes' == YAHOO.Createpage.RedLinkMode ) && ( 'wpTextboxes0' == edit_textareas[0].id ) ) {
 1023+ edit_textareas[0].focus();
 1024+ } else {
 1025+ var el_id = parseInt( edit_textareas[0].id.replace( 'wpTextboxes', '' ) );
 1026+ YAHOO.util.Dom.get( 'toolbar' + el_id ).style.display = '';
 1027+ YAHOO.Createpage.hideOtherBoxes( el_id );
 1028+ }
 1029+
 1030+ var edittools_div = YAHOO.util.Dom.get( 'createpage_editTools' );
 1031+ if ( edittools_div ) {
 1032+ if ( 'cp-template-Blank' != myid ) {
 1033+ edittools_div.style.display = 'none';
 1034+ } else {
 1035+ edittools_div.style.display = '';
 1036+ }
 1037+ }
 1038+
 1039+ YAHOO.Createpage.multiEditSetupToolbar();
 1040+ YAHOO.Createpage.multiEditSetupOptionalSections();
 1041+ },
 1042+ failure: function(e) {
 1043+ YAHOO.util.Dom.get('cp-multiedit').innerHTML = '';
 1044+ },
 1045+ timeout: 50000
 1046+ };
 1047+
 1048+ return {
 1049+ init: function() {
 1050+ YAHOO.util.Event.addListener( elements, 'click', this.switchTemplate );
 1051+
 1052+ var i, src, tt;
 1053+ for ( i in elements ) {
 1054+ YAHOO.util.Dom.setStyle( elements[i] + '-radio', 'display', 'none' );
 1055+ }
 1056+ },
 1057+ switchTemplate: function( e ) {
 1058+ myid = this.id;
 1059+ YAHOO.util.Event.preventDefault(e);
 1060+
 1061+ YAHOO.util.Dom.get('cp-multiedit').innerHTML = '<img src="' + wgServer + wgScriptPath + '/extensions/CreateAPage/images/progress_bar.gif" width="70" height="11" alt="<?php echo wfMsg( 'createpage-please-wait' ) ?>" border="0" />';
 1062+ if ( YAHOO.Createpage.Overlay ) {
 1063+ YAHOO.Createpage.ResizeOverlay( 20 );
 1064+ }
 1065+ YAHOO.util.Connect.asyncRequest('GET', ajaxpath + '?action=ajax&rs=axMultiEditParse&template=' + this.id.replace('cp-template-', ''), callback);
 1066+ }
 1067+ };
 1068+}();
 1069+
 1070+YAHOO.Createpage.MultiEdit.init();
 1071+
 1072+YAHOO.Createpage.CheckExistingTitle = function( e ) {
 1073+ if ( YAHOO.util.Dom.get('Createtitle').value == '' ) {
 1074+ YAHOO.util.Event.preventDefault(e);
 1075+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<span style="color: red;"><?php echo wfMsg( 'createpage-give-title' ) ?></span>';
 1076+ window.location.hash = 'title_loc';
 1077+ YAHOO.Createpage.SubmitEnabled = false;
 1078+ } else if ( true == NoCanDo ) {
 1079+ TitleDialog = new YAHOO.widget.SimpleDialog("dlg", {
 1080+ width: "20em",
 1081+ effect: {effect:YAHOO.widget.ContainerEffect.FADE,
 1082+ duration:0.4},
 1083+ fixedcenter:true,
 1084+ modal:true,
 1085+ visible:false,
 1086+ draggable:false });
 1087+ TitleDialog.setHeader("<?php echo wfMsg( 'createpage-title-check-header' ); ?>");
 1088+ TitleDialog.setBody("<?php echo wfMsg( 'createpage-title-check-text' ); ?>");
 1089+ TitleDialog.cfg.setProperty( 'icon', YAHOO.widget.SimpleDialog.ICON_WARN );
 1090+ TitleDialog.cfg.setProperty( 'zIndex', 1000 );
 1091+ TitleDialog.render( document.body );
 1092+ TitleDialog.show();
 1093+ YAHOO.util.Event.preventDefault(e);
 1094+ YAHOO.Createpage.SubmitEnabled = false;
 1095+ }
 1096+ if (
 1097+ ( YAHOO.Createpage.SubmitEnabled !== true ) ||
 1098+ ( YAHOO.Createpage.Overlay && ( YAHOO.util.Dom.get('createpageoverlay').style.visibility != 'hidden' ) )
 1099+ ) {
 1100+ YAHOO.util.Event.preventDefault(e);
 1101+ }
 1102+}
 1103+
 1104+YAHOO.Createpage.SubmitEnable = function( e ) {
 1105+ YAHOO.Createpage.SubmitEnabled = true;
 1106+}
 1107+
 1108+YAHOO.util.Event.addListener( 'createpageform', 'submit', YAHOO.Createpage.CheckExistingTitle );
 1109+YAHOO.util.Event.addListener( 'wpSave', 'click', YAHOO.Createpage.SubmitEnable );
 1110+YAHOO.util.Event.addListener( 'wpPreview', 'click', YAHOO.Createpage.SubmitEnable );
 1111+YAHOO.util.Event.addListener( 'wpCancel', 'click', YAHOO.Createpage.SubmitEnable );
 1112+
 1113+/*]]>*/
 1114+</script>
 1115+<?php if ( !$ispreview ) { ?>
 1116+</div>
 1117+</fieldset>
 1118+<?php } ?>
 1119+<div style="display: none;" id="createpage_advanced_warning">
 1120+ <div class="boxHeader color1"><?php echo wfMsg( 'createpage-edit-normal' ) ?></div>
 1121+ <div class="warning_text"><?php echo wfMsg( 'createpage-advanced-warning' ) ?></div>
 1122+ <div class="warning_buttons">
 1123+ <input type="submit" id="wpCreatepageWarningYes" name="wpCreatepageWarningYes" value="<?php echo wfMsg( 'createpage-yes' ) ?>" style="font-weight:bolder" />
 1124+ <input type="submit" id="wpCreatepageWarningNo" name="wpCreatepageWarningNo" value="<?php echo wfMsg( 'createpage-no' ) ?>" />
 1125+ </div>
 1126+</div>
 1127+ <div id="createpage_createplate_list"></div>
 1128+ <noscript>
 1129+ <div class="actionBar">
 1130+ <input type="submit" name="wpSubmitCreateplate" id="wpSubmitCreateplate" value="<?php echo wfMsg( 'createpage-button-createplate-submit' ) ?>" class="button color1"/>
 1131+ </div>
 1132+ </noscript>
 1133+
 1134+<br />
 1135+<div class="actionBar">
 1136+<a name="title_loc"></a>
 1137+<?php if ( !$isredlink ) { ?>
 1138+<label for="Createtitle" id="Createtitlelabel"><?php echo wfMsg( 'createpage-title-caption' ) ?></label>
 1139+<input name="Createtitle" id="Createtitle" size="50" value="<?php echo htmlspecialchars( $createtitle ) ?>" maxlength="250" />
 1140+<?php } else { ?>
 1141+<div id="createpageinfo"><?php echo $aboutinfo ?></div>
 1142+<input type="hidden" name="Createtitle" id="Createtitle" value="<?php echo $createtitle ?>" />
 1143+<input type="hidden" name="Redlinkmode" id="Redlinkmode" value="<?php echo $isredlink ?>" />
 1144+<?php } ?>
 1145+<input id="wpRunInitialCheck" class="button color1" type="button" value="<?php echo wfMsg( 'createpage-initial-run' ) ?>" style="display: none;" />
 1146+<?php if ( !$isredlink ) { ?>
 1147+<input type="submit" id="wpAdvancedEdit" name="wpAdvancedEdit" value="<?php echo wfMsg( 'createpage-edit-normal' ) ?>" class="button color1" />
 1148+<?php } ?>
 1149+<div id="cp-title-check">&nbsp;</div>
 1150+</div>
 1151+<br />
 1152+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/templates-list.tmpl.php
___________________________________________________________________
Added: svn:eol-style
11153 + native
Index: trunk/extensions/CreateAPage/templates/editimage.tmpl.php
@@ -0,0 +1,33 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<!-- JavaScript part -->
 4+<script type="text/javascript">
 5+/*<![CDATA[*/
 6+YAHOO.util.Event.addListener( "createpage_upload_file<?php echo $image_num ?>", "change", YAHOO.CreatepageInfobox.Upload, {"num" : <?php echo $image_num ?> } );
 7+/*]]>*/
 8+</script>
 9+ <div class="createpage_input_file createpage_input_file_no_path">
 10+ <div class="thumb tleft" id="createpage_main_thumb<?php echo $image_num ?>" style="display: none">
 11+ <div class="thumbinner">
 12+ <img id="createpage_image_thumb<?php echo $image_num ?>" src="" alt="..." />
 13+ </div>
 14+ </div>
 15+ <label id="createpage_image_label<?php echo $image_num ?>" class="button color1">
 16+ <span id="createpage_image_text<?php echo $image_num ?>"><?php echo wfMsg( 'createpage-insert-image' ) ?></span>
 17+ <span id="createpage_image_cancel<?php echo $image_num ?>" style="display: none"><?php echo wfMsg( 'cancel' ) ?></span>
 18+ <input type="file" name="wpUploadFile<?php echo $image_num ?>" id="createpage_upload_file<?php echo $image_num ?>" tabindex="-1" />
 19+ </label>
 20+ <div id="createpage_upload_progress<?php echo $image_num ?>" class="progress">&nbsp;</div>
 21+ </div>
 22+ <input type="hidden" id="wpDestFile<?php echo $image_num ?>" name="wpDestFile<?php echo $image_num ?>" value="" />
 23+ <input type="hidden" name="wpIgnoreWarning<?php echo $image_num ?>" value="1" />
 24+ <input type="hidden" name="wpUploadDescription<?php echo $image_num ?>" value="<?php echo wfMsg( 'createpage-uploaded-from' ) ?>" />
 25+ <input type="hidden" name="wpWatchthis<?php echo $image_num ?>" value="1" />
 26+ <input type="hidden" id="wpLastTimestamp<?php echo $image_num ?>" name="wpLastTimestamp<?php echo $image_num ?>" value="None" />
 27+ <input type="hidden" id="wpInfImg<?php echo $image_num ?>" name="wpInfImg<?php echo $image_num ?>" value="<?php echo $image_helper ?>" />
 28+ <input type="hidden" id="wpParName<?php echo $image_num ?>" name="wpParName<?php echo $image_num ?>" value="<?php echo $image_name ?>" />
 29+ <input type="hidden" id="wpNoUse<?php echo $image_num ?>" name="wpNoUse<?php echo $image_num ?>" value="No" />
 30+ <noscript>
 31+ <input type="submit" id="createpage_upload_submit<?php echo $image_num ?>" name="wpImageUpload" value="<?php echo wfMsg( 'createpage-upload' ) ?>" class="upload_submit" />
 32+ </noscript>
 33+ </div>
 34+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/editimage.tmpl.php
___________________________________________________________________
Added: svn:eol-style
135 + native
Index: trunk/extensions/CreateAPage/templates/bigarea.tmpl.php
@@ -0,0 +1,21 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<div style="display:block;" id="wpTableMultiEdit" name="wpTableMultiEdit">
 4+<?php
 5+ $display = 'none';
 6+ $id = '1';
 7+ $html = 'name="wpTextboxes' . $id . '" id="wpTextboxes' . $id . '" style="display:' . $display . '"';
 8+ $value = "<input type=\"hidden\" {$html} value=\"" . "<!---blanktemplate--->" . '">';
 9+?>
 10+<div class="display:<?php echo $display ?>"><?php echo $value ?></div>
 11+<?php
 12+ $display = 'block';
 13+ $id = '0';
 14+ $html = 'name="wpTextboxes' . $id . '" id="wpTextboxes' . $id . '" style="display:' . $display . '" class="bigarea"';
 15+ $value = "<textarea type=\"text\" rows=\"25\" cols=\"80\" {$html}>" . $box . '</textarea>';
 16+ if ( $toolbar != '' ) {
 17+ $value = $toolbar . $value;
 18+ }
 19+?>
 20+<div class="display:<?php echo $display ?>"><?php echo $value ?></div>
 21+</div>
 22+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/bigarea.tmpl.php
___________________________________________________________________
Added: svn:eol-style
123 + native
Index: trunk/extensions/CreateAPage/templates/categorypage.tmpl.php
@@ -0,0 +1,68 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<!-- CSS part -->
 4+<style type="text/css">
 5+/*<![CDATA[*/
 6+#wpTextbox1 {
 7+ display: none;
 8+}
 9+/*]]>*/
 10+</style>
 11+
 12+<div id="createpage_cloud_div" style="display: none;">
 13+<div style="font-weight: bold;"><?php echo wfMsg( 'createpage-categories' ) ?></div>
 14+<?php if ( isset( $cloud->tags ) ) { ?>
 15+<div id="createpage_cloud_section">
 16+<?php
 17+$xnum = 0;
 18+foreach ( $cloud->tags as $xname => $xtag ) {
 19+?>
 20+ <span id="tag<?php echo $xnum ?>" style="font-size:<?php echo $xtag['size'] ?>pt">
 21+ <a href="#" id="cloud<?php echo $xnum ?>" onclick="cloudAdd(escape('<?php echo $xname ?>'), <?php echo $xnum ?>); return false;"><?php echo $xname ?></a>
 22+ </span>
 23+<?php
 24+$xnum++;
 25+}
 26+?>
 27+</div>
 28+<?php } // if ( $cloud->tags ) ?>
 29+<textarea accesskey="," name="wpCategoryTextarea" id="wpCategoryTextarea" rows="3" cols="<?php echo $cols ?>"<?php echo $ew ?>><?php echo $text_category ?></textarea>
 30+<input type="button" name="wpCategoryButton" id="wpCategoryButton" class="button color1" value="<?php echo wfMsg( 'createpage-addcategory' ) ?>" onclick="cloudInputAdd(); return false ;" />
 31+<input type="text" name="wpCategoryInput" id="wpCategoryInput" value="" />
 32+</div>
 33+<script type="text/javascript">
 34+/*<![CDATA[*/
 35+var div = document.getElementById('createpage_cloud_div');
 36+document.getElementById('createpage_cloud_div').style.display = 'block';
 37+/*]]>*/
 38+</script>
 39+<noscript>
 40+<?php if ( isset( $cloud->tags ) ) { ?>
 41+<div id="createpage_cloud_section_njs">
 42+<?php
 43+$xnum = 0;
 44+
 45+foreach ( $cloud->tags as $xname => $xtag ) {
 46+ $checked = ( array_key_exists( $xname, $array_category ) && ( $array_category[$xname] ) ) ? ' checked="checked"' : '';
 47+ $array_category[$xname] = 0;
 48+ #$xtag['size']
 49+?>
 50+ <span id="tag_njs_<?php echo $xnum ?>" style="font-size:9pt">
 51+ <input<?php echo $checked ?> type="checkbox" name="category_<?php echo $xnum ?>" id="category_<?php echo $xnum ?>" value="<?php echo $xname ?>">&nbsp;<?php echo $xname ?>
 52+ </span>
 53+<?php
 54+$xnum++;
 55+}
 56+
 57+$display_category = array();
 58+foreach ( $array_category as $xname => $visible ) {
 59+ if ( $visible == 1 ) {
 60+ $display_category[] = $xname;
 61+ }
 62+}
 63+$text_category = implode( ',', $display_category );
 64+?>
 65+</div>
 66+<?php } // if ( $cloud->tags ) ?>
 67+<textarea tabindex="<?php echo $num ?>" accesskey="," name="wpCategoryTextarea" id="wpCategoryTextarea" rows="3" cols="<?php echo $cols ?>"<?php echo $ew ?>><?php echo $text_category ?></textarea>
 68+</noscript>
 69+<!-- e:<?php echo __FILE__ ?> -->
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/categorypage.tmpl.php
___________________________________________________________________
Added: svn:eol-style
170 + native
Index: trunk/extensions/CreateAPage/templates/editimage-section.tmpl.php
@@ -0,0 +1,30 @@
 2+<!-- s:<?php echo __FILE__ ?> -->
 3+<!-- JavaScript part -->
 4+<script type="text/javascript">
 5+/*<![CDATA[*/
 6+YAHOO.util.Event.addListener( "createpage_upload_file_section<?php echo $imagenum ?>", "change", YWC.Upload, {"num" : <?php echo $imagenum ?> } );
 7+/*]]>*/
 8+</script>
 9+<div id="createpage_upload_div_section<?php echo $imagenum ?>">
 10+ <div class="createpage_input_file createpage_input_file_no_path">
 11+ <div class="thumb tleft" id="createpage_main_thumb_section<?php echo $imagenum ?>" style="display: none">
 12+ <div class="thumbinner"><img id="createpage_image_thumb_section<?php echo $imagenum ?>" src="" alt="..." /></div>
 13+ </div>
 14+ <label id="createpage_image_label_section<?php echo $imagenum ?>" class="button color1">
 15+ <span id="createpage_image_text_section<?php echo $imagenum ?>"><?php echo wfMsg( 'createpage-insert-image' ) ?></span>
 16+ <span id="createpage_image_cancel_section<?php echo $imagenum ?>" style="display: none"><?php echo wfMsg( 'cancel' ) ?></span>
 17+ <input type="file" name="wpAllUploadFile<?php echo $imagenum ?>" id="createpage_upload_file_section<?php echo $imagenum ?>" tabindex="-1" />
 18+ </label>
 19+ <div id="createpage_upload_progress_section<?php echo $imagenum ?>" class="progress">&nbsp;</div>
 20+ </div>
 21+ <input type="hidden" id="wpAllDestFile<?php echo $imagenum ?>" name="wpAllDestFile<?php echo $imagenum ?>" value="" />
 22+ <input type="hidden" name="wpAllIgnoreWarning<?php echo $imagenum ?>" value="1" />
 23+ <input type="hidden" name="wpAllUploadDescription<?php echo $imagenum ?>" value="<?php echo wfMsg( 'createpage-uploaded-from' ) ?>" />
 24+ <input type="hidden" id="wpAllLastTimestamp<?php echo $imagenum ?>" name="wpAllLastTimestamp<?php echo $imagenum ?>" value="None" />
 25+ <input type="hidden" id="wpAllUploadTarget<?php echo $imagenum ?>" name="wpAllUploadTarget<?php echo $imagenum ?>" value="wpTextboxes<?php echo $target_tag ?>" />
 26+ <input type="hidden" name="wpAllWatchthis<?php echo $imagenum ?>" value="1" />
 27+ <noscript>
 28+ <input type="submit" id="createpage_upload_submit_section<?php echo $imagenum ?>" name="wpImageUpload" value="<?php echo wfMsg( 'createpage-upload' ) ?>" class="upload_submit" />
 29+ </noscript>
 30+</div>
 31+<!-- e:<?php echo __FILE__ ?> -->
Property changes on: trunk/extensions/CreateAPage/templates/editimage-section.tmpl.php
___________________________________________________________________
Added: svn:eol-style
132 + native
Index: trunk/extensions/CreateAPage/templates/title-check.tmpl.php
@@ -0,0 +1,64 @@
 2+<script type="text/javascript">
 3+/*<![CDATA[*/
 4+YAHOO.namespace('WRequest');
 5+YAHOO.namespace('Createpage');
 6+YAHOO.namespace('CreatepageInfobox');
 7+
 8+var DisabledCr = false;
 9+
 10+var ajaxpath = wgScriptPath + '/index.php';
 11+
 12+YAHOO.WRequest.callbackTitle = {
 13+ success:
 14+ function( r ) {
 15+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '';
 16+ if( /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test( r.responseText ) ) {
 17+ var res = eval( '(' + r.responseText + ')' );
 18+ }
 19+ if ( ( false != res['text'] ) && ( true != res['empty'] ) ) {
 20+ var url = res['url' ].replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
 21+ var text = res['text'].replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
 22+
 23+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<span style="color: red;"><?php echo wfMsg( 'createpage-article-exists' ) ?> <a href="' + url + '?action=edit" title="' + text + '">' + text + '</a><?php echo wfMsg( 'createpage-article-exists2' ) ?></span>';
 24+ if ( YAHOO.Createpage.Overlay ) {
 25+ YAHOO.Createpage.Overlay.show();
 26+ var helperButton = YAHOO.util.Dom.get( 'wpRunInitialCheck' );
 27+ helperButton.style.display = '';
 28+ } else {
 29+ YAHOO.Createpage.ContentOverlay();
 30+ }
 31+ } else if ( true == res['empty'] ) {
 32+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<span style="color: red;"><?php echo wfMsg( 'createpage-title-invalid' ) ?></span>';
 33+ if ( YAHOO.Createpage.Overlay ) {
 34+ YAHOO.Createpage.ResizeOverlay( 0 );
 35+ YAHOO.Createpage.Overlay.show();
 36+ var helperButton = YAHOO.util.Dom.get( 'wpRunInitialCheck' );
 37+ helperButton.style.display = '';
 38+ } else {
 39+ YAHOO.Createpage.ContentOverlay();
 40+ }
 41+ } else {
 42+ if ( YAHOO.Createpage.Overlay ) {
 43+ YAHOO.Createpage.Overlay.hide();
 44+ var helperButton = YAHOO.util.Dom.get( 'wpRunInitialCheck' );
 45+ helperButton.style.display = 'none';
 46+ }
 47+ }
 48+ NoCanDo = false;
 49+ },
 50+ failure:
 51+ function( r ) {
 52+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '';
 53+ },
 54+ timeout: 50000
 55+};
 56+
 57+YAHOO.WRequest.watchTitle = function( e ) {
 58+ YAHOO.util.Dom.get('cp-title-check').innerHTML = '<img src="' + wgServer + wgScriptPath + '/extensions/CreateAPage/images/process_bar.gif" width="70" height="11" alt="<?php echo wfMsg( 'createpage-please-wait' ) ?>" border="0" />';
 59+ NoCanDo = true;
 60+ YAHOO.util.Connect.asyncRequest( 'GET', ajaxpath + '?action=ajax&rs=axTitleExists&title=' + YAHOO.util.Dom.get('Createtitle').value, YAHOO.WRequest.callbackTitle );
 61+};
 62+
 63+YAHOO.util.Event.addListener( 'Createtitle', 'change', YAHOO.WRequest.watchTitle );
 64+/*]]>*/
 65+</script>
\ No newline at end of file
Property changes on: trunk/extensions/CreateAPage/templates/title-check.tmpl.php
___________________________________________________________________
Added: svn:eol-style
166 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r102092CreateAPage: follow-up to r98699 as per Roan's review:...ashley13:34, 5 November 2011
r102093CreateAPage: follow-up to r98699 as per Roan's review: rename the extension s...ashley13:36, 5 November 2011

Comments

#Comment by Catrope (talk | contribs)   14:05, 31 October 2011
+$wgCreatePageCoverRedLinks = false;
+
+// Hooked functions
+$wgHooks['EditPage::showEditForm:initial'][] = 'wfCreatePagePreloadContent';
+$wgHooks['Image::RecordUpload:article'][] = 'wfCreatePageShowNoImagePage';
+$wgHooks['CustomEditor'][] = 'wfCreatePageRedLinks';
+$wgHooks['ConfirmEdit::onConfirmEdit'][] = 'wfCreatePageConfirmEdit'; // ConfirmEdit CAPTCHA
+
+if ( $wgCreatePageCoverRedLinks ) {
+	$wgHooks['UserToggles'][] = 'wfCreatePageToggle';
+}

It is impossible for LocalSettings.php to set $wgCreatePageCoverRedLinks to true in time for the second check. You should move the if statement to the hook function.

+		'section' => 'editing',

You should move the preference to one of the subsections of the 'editing' section. The only existing subsections are editing/textboxsize and editing/advancedediting so you probably want the latter.

The extension setup file name (CreatePage.php) doesn't match the directory name (CreateAPage), this is bad style.

#Comment by Jack Phoenix (talk | contribs)   13:37, 5 November 2011

Thanks for the code review, Roan! I've addressed the code issues in r102092 and renamed the setup file in r102093.

#Comment by Catrope (talk | contribs)   14:14, 31 October 2011

After hacking the setup file so the preference does appear, I noticed that it attempts to use HTML in the message. This doesn't work anymore. Screenshot:

Createapage-breakage.png

Status & tagging log