Index: trunk/extensions/AjaxShowEditors/Response.php |
— | — | @@ -15,10 +15,9 @@ |
16 | 16 | */ |
17 | 17 | function wfAjaxShowEditors( $articleId, $username ) { |
18 | 18 | global $wgOut; |
| 19 | + |
19 | 20 | $articleId = intval( $articleId ); |
20 | 21 | |
21 | | - wfLoadExtensionMessages( 'AjaxShowEditors' ); |
22 | | - |
23 | 22 | // Validate request |
24 | 23 | $title = Title::newFromID( $articleId ); |
25 | 24 | if ( !( $title ) ) { return wfMsg( 'ajax-se-pagedoesnotexist' ); } |
Index: trunk/extensions/AjaxShowEditors/Hooks.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | */ |
23 | 23 | function wfAjaxShowEditorsCleanup( $article, $user ) { |
24 | 24 | global $wgCommandLineMode; |
| 25 | + |
25 | 26 | if ( $wgCommandLineMode ) { |
26 | 27 | return true; |
27 | 28 | } |
— | — | @@ -40,24 +41,18 @@ |
41 | 42 | |
42 | 43 | // Only when editing a page |
43 | 44 | function wfAjaxShowEditorsAddCSS( $out ) { |
44 | | - global $action; |
45 | | - if ( $action != 'edit' ) { |
46 | | - return true; |
| 45 | + global $wgRequest, $wgExtensionAssetsPath; |
| 46 | + |
| 47 | + if ( $wgRequest->getVal( 'action' ) == 'edit' ) { |
| 48 | + $out->addStyle( "$wgExtensionAssetsPath/AjaxShowEditors/AjaxShowEditors.css" ); |
47 | 49 | } |
48 | | - global $wgScriptPath; |
49 | | - $out->addLink( |
50 | | - array( |
51 | | - 'rel' => 'stylesheet', |
52 | | - 'type' => 'text/css', |
53 | | - 'href' => $wgScriptPath . '/extensions/AjaxShowEditors/AjaxShowEditors.css', |
54 | | - ) |
55 | | - ); |
56 | 50 | return true; |
57 | 51 | } |
58 | 52 | |
59 | 53 | function wfAjaxShowEditorsAddJS( $out ) { |
60 | | - global $wgJsMimeType, $wgScriptPath ; |
61 | | - $out->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/AjaxShowEditors/AjaxShowEditors.js\"></script>\n" ); |
| 54 | + global $wgExtensionAssetsPath; |
| 55 | + |
| 56 | + $out->addScriptFile( "$wgExtensionAssetsPath/AjaxShowEditors/AjaxShowEditors.js" ); |
62 | 57 | return true; |
63 | 58 | } |
64 | 59 | |
— | — | @@ -65,8 +60,6 @@ |
66 | 61 | function wfAjaxShowEditorsShowBox( ) { |
67 | 62 | global $wgOut; |
68 | 63 | |
69 | | - wfLoadExtensionMessages( 'AjaxShowEditors' ); |
70 | | - |
71 | 64 | $wgOut->addWikiText( |
72 | 65 | '<div id="ajax-se"><p id="ajax-se-title">' . wfMsg( 'ajax-se-title' ) . '</p>' |
73 | 66 | . '<p id="ajax-se-editors">' . wfMsg( 'ajax-se-pending' ) . '</p>' |
Index: trunk/extensions/AjaxTest/AjaxTestPage.php |
— | — | @@ -27,17 +27,12 @@ |
28 | 28 | * @param $par Parameters passed to the page |
29 | 29 | */ |
30 | 30 | function execute( $par ) { |
31 | | - global $wgRequest, $wgOut; |
32 | | - global $wgJsMimeType, $wgScriptPath; |
| 31 | + global $wgOut, $wgExtensionAssetsPath; |
33 | 32 | |
34 | 33 | $this->setHeaders(); |
35 | 34 | |
36 | | - $wgOut->addScript( |
37 | | - "<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}/extensions/AjaxTest/AjaxTest.js\">" . |
38 | | - "</script>\n" |
39 | | - ); |
| 35 | + $wgOut->addScriptFile( "$wgExtensionAssetsPath/AjaxTest/AjaxTest.js" ); |
40 | 36 | |
41 | | - |
42 | 37 | $wgOut->addHTML( $this->makeInputForm() ); |
43 | 38 | } |
44 | 39 | |
— | — | @@ -45,38 +40,37 @@ |
46 | 41 | * Input form for entering a category |
47 | 42 | */ |
48 | 43 | function makeInputForm() { |
49 | | - $thisTitle = SpecialPage::getTitleFor( $this->getName() ); |
50 | 44 | $form = ''; |
51 | | - $form .= Xml::openElement( 'form', array( 'name' => 'ajaxtest', 'method' => 'get', 'action' => $thisTitle->getLocalUrl() ) ); |
52 | | - $form .= Xml::element( 'input', array( 'type' => 'text', 'name' => 'ajaxtest_text', 'id' => 'ajaxtest_text', 'value' => '', 'size' => '64' ) ) . ' '; |
53 | | - $form .= Xml::element( 'br' ); |
54 | | - $form .= Xml::element( 'label', array( 'for' => 'usestring' ), 'use string value' ); |
55 | | - $form .= Xml::element( 'input', array( 'type' => 'checkbox', 'name' => 'usestring', 'id' => 'usestring' ) ); |
56 | | - $form .= Xml::element( 'br' ); |
57 | | - $form .= Xml::element( 'label', array( 'for' => 'httpcache' ), 'use http cache' ); |
58 | | - $form .= Xml::element( 'input', array( 'type' => 'checkbox', 'name' => 'httpcache', 'id' => 'httpcache' ) ); |
59 | | - $form .= Xml::element( 'br' ); |
60 | | - $form .= Xml::element( 'label', array( 'for' => 'lastmod' ), 'use last modified' ); |
61 | | - $form .= Xml::element( 'input', array( 'type' => 'checkbox', 'name' => 'lastmod', 'id' => 'lastmod' ) ); |
62 | | - $form .= Xml::element( 'br' ); |
63 | | - $form .= Xml::element( 'label', array( 'for' => 'error' ), 'trigger error' ); |
64 | | - $form .= Xml::element( 'input', array( 'type' => 'checkbox', 'name' => 'error', 'id' => 'error' ) ); |
65 | | - $form .= Xml::element( 'br' ); |
66 | | - $form .= Xml::openElement( 'select', array( 'name' => 'ajaxtest_target', 'id' => 'ajaxtest_target' ) ); |
67 | | - $form .= Xml::element( 'option', array( 'value' => 'function' ), "function" ); |
68 | | - $form .= Xml::element( 'option', array( 'value' => 'element' ), "element" ); |
69 | | - $form .= Xml::element( 'option', array( 'value' => 'input' ), "input" ); |
70 | | - $form .= Xml::closeElement( 'select' ); |
71 | | - $form .= Xml::element( 'input', array( 'type' => 'button', 'onclick' => 'doAjaxTest();', 'value' => 'TEST' ) ); |
72 | | - $form .= Xml::element( 'input', array( 'type' => 'button', 'onclick' => 'clearAjaxTest();', 'value' => 'CLEAR' ) ); |
73 | | - # $form .= Xml::element( 'input', array( 'type' => 'button', 'onclick' => 'getElementById("ajaxtest_out").value= getElementById("ajaxtest_text").value;', 'value' => 'DUMMY' ) ); |
74 | | - $form .= Xml::closeElement( 'form' ); |
| 45 | + $form .= Html::openElement( 'form', array( 'name' => 'ajaxtest', 'method' => 'GET', 'action' => $this->getTitle()->getLocalUrl() ) ); |
| 46 | + $form .= Html::element( 'input', array( 'type' => 'text', 'name' => 'ajaxtest_text', 'id' => 'ajaxtest_text', 'value' => '', 'size' => '64' ) ) . ' '; |
| 47 | + $form .= Html::element( 'br' ); |
| 48 | + $form .= Html::element( 'label', array( 'for' => 'usestring' ), 'use string value' ); |
| 49 | + $form .= Html::element( 'input', array( 'type' => 'checkbox', 'name' => 'usestring', 'id' => 'usestring' ) ); |
| 50 | + $form .= Html::element( 'br' ); |
| 51 | + $form .= Html::element( 'label', array( 'for' => 'httpcache' ), 'use http cache' ); |
| 52 | + $form .= Html::element( 'input', array( 'type' => 'checkbox', 'name' => 'httpcache', 'id' => 'httpcache' ) ); |
| 53 | + $form .= Html::element( 'br' ); |
| 54 | + $form .= Html::element( 'label', array( 'for' => 'lastmod' ), 'use last modified' ); |
| 55 | + $form .= Html::element( 'input', array( 'type' => 'checkbox', 'name' => 'lastmod', 'id' => 'lastmod' ) ); |
| 56 | + $form .= Html::element( 'br' ); |
| 57 | + $form .= Html::element( 'label', array( 'for' => 'error' ), 'trigger error' ); |
| 58 | + $form .= Html::element( 'input', array( 'type' => 'checkbox', 'name' => 'error', 'id' => 'error' ) ); |
| 59 | + $form .= Html::element( 'br' ); |
| 60 | + $form .= Html::openElement( 'select', array( 'name' => 'ajaxtest_target', 'id' => 'ajaxtest_target' ) ); |
| 61 | + $form .= Html::element( 'option', array( 'value' => 'function' ), "function" ); |
| 62 | + $form .= Html::element( 'option', array( 'value' => 'element' ), "element" ); |
| 63 | + $form .= Html::element( 'option', array( 'value' => 'input' ), "input" ); |
| 64 | + $form .= Html::closeElement( 'select' ); |
| 65 | + $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'doAjaxTest();', 'value' => 'TEST' ) ); |
| 66 | + $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'clearAjaxTest();', 'value' => 'CLEAR' ) ); |
| 67 | + # $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'getElementById("ajaxtest_out").value= getElementById("ajaxtest_text").value;', 'value' => 'DUMMY' ) ); |
| 68 | + $form .= Html::closeElement( 'form' ); |
75 | 69 | |
76 | | - $form .= Xml::element( 'hr' ); |
77 | | - $form .= Xml::element( 'input', array( 'type' => 'text', 'name' => 'ajaxtest_out', 'id' => 'ajaxtest_out', 'value' => '', 'size' => '64' ) ) . ' '; |
78 | | - $form .= Xml::element( 'p', array( 'id' => 'ajaxtest_area' ) ); |
79 | | - $form .= Xml::element( 'hr' ); |
80 | | - $form .= Xml::element( 'p', array( 'id' => 'sajax_debug' ) ); |
| 70 | + $form .= Html::element( 'hr' ); |
| 71 | + $form .= Html::element( 'input', array( 'type' => 'text', 'name' => 'ajaxtest_out', 'id' => 'ajaxtest_out', 'value' => '', 'size' => '64' ) ) . ' '; |
| 72 | + $form .= Html::element( 'p', array( 'id' => 'ajaxtest_area' ) ); |
| 73 | + $form .= Html::element( 'hr' ); |
| 74 | + $form .= Html::element( 'p', array( 'id' => 'sajax_debug' ) ); |
81 | 75 | return $form; |
82 | 76 | } |
83 | 77 | } |
Index: trunk/extensions/AjaxTest/AjaxTest.i18n.php |
— | — | @@ -9,5 +9,6 @@ |
10 | 10 | $messages = array(); |
11 | 11 | |
12 | 12 | $messages['en'] = array( |
13 | | - 'ajaxtest-desc' => '[[Special:AjaxTest|AjaxTest]] extension', |
| 13 | + 'ajaxtest' => 'Ajax Test', |
| 14 | + 'ajaxtest-desc' => '[[Special:AjaxTest|AjaxTest]] extension', |
14 | 15 | ); |
Index: trunk/extensions/AjaxTest/AjaxTest.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | $dir = dirname( __FILE__ ) . '/'; |
40 | 40 | $wgExtensionMessagesFiles['AjaxTest'] = $dir . 'AjaxTest.i18n.php'; |
41 | 41 | $wgExtensionAliasesFiles['AjaxTest'] = $dir . 'AjaxTest.alias.php'; |
| 42 | +$wgAutoloadClasses['AjaxTestPage'] = $dir . 'AjaxTestPage.php'; |
42 | 43 | |
43 | 44 | /** |
44 | 45 | * register Ajax function |