Index: trunk/extensions/PageSchemas/PS_Tabs.php |
— | — | @@ -5,17 +5,15 @@ |
6 | 6 | * |
7 | 7 | * @since 0.1 |
8 | 8 | * |
9 | | - * @file Push_Tab.php |
10 | | - * @ingroup Push |
| 9 | + * @file _Tab.php |
| 10 | + * @ingroup |
11 | 11 | * |
12 | 12 | * @author ankit |
13 | 13 | */ |
14 | 14 | final class PSTabs { |
15 | 15 | |
16 | | - /** |
17 | | - * Adds an "action" (i.e., a tab) to allow pushing the current article. |
18 | | - */ |
19 | | - public static function displayTab( $obj, &$content_actions ) { |
| 16 | + |
| 17 | + public static function displayTabs( $obj, &$content_actions ) { |
20 | 18 | global $wgUser; |
21 | 19 | |
22 | 20 | // Make sure that this is not a special page, the page has contents, and the user can push. |
— | — | @@ -54,34 +52,30 @@ |
55 | 53 | * Function currently called only for the 'Vector' skin, added in |
56 | 54 | * MW 1.16 - will possibly be called for additional skins later |
57 | 55 | */ |
58 | | - public static function displayTab2( $obj, &$links ) { |
| 56 | + public static function displayTabs2( $obj, &$links ) { |
59 | 57 | // The old '$content_actions' array is thankfully just a sub-array of this one |
60 | 58 | $views_links = $links['actions']; |
61 | | - self::displayTab( $obj, $views_links ); |
| 59 | + self::displayTabs( $obj, $views_links ); |
62 | 60 | $links['actions'] = $views_links; |
63 | 61 | return true; |
64 | 62 | } |
65 | 63 | |
66 | | - /** |
67 | | - * Handle actions not known to MediaWiki. If the action is push, |
68 | | - * display the push page by calling the displayPushPage method. |
69 | | - * |
70 | | - * @param string $action |
71 | | - * @param Article $article |
| 64 | + /** |
72 | 65 | * |
73 | 66 | * @return true |
74 | 67 | */ |
75 | 68 | public static function onUnknownAction( $action, Article $article ) { |
76 | 69 | $title = $article->getTitle(); |
77 | 70 | $category = $title->getText(); |
78 | | - if ( $action == 'generatepages' ) { |
79 | | - $gen_page = new GeneratePages(); |
80 | | - return $gen_page->execute($category); |
81 | | - } |
82 | | - else if( $action == 'editschema' ) { |
83 | | - $edit_schema = new EditSchema(); |
84 | | - return $edit_schema->execute($category); |
85 | | - } |
| 71 | + if ( $action == 'generatepages' ) { |
| 72 | + $gen_page = new GeneratePages(); |
| 73 | + $gen_page->execute($category); |
| 74 | + return false; |
| 75 | + } elseif ( $action == 'editschema' ) { |
| 76 | + $edit_schema = new EditSchema(); |
| 77 | + $edit_schema->execute($category); |
| 78 | + return false; |
| 79 | + } |
86 | 80 | return true; |
87 | 81 | } |
88 | 82 | } |
\ No newline at end of file |
Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | // for now - this may change later |
113 | 113 | // hide parsing warnings |
114 | 114 | libxml_use_internal_errors(true); |
115 | | - $xml_success = simplexml_load_string($xmlDTD . $xml); |
| 115 | + $xml_success = simplexml_load_string($xmlDTD.$xml); |
116 | 116 | $errors = libxml_get_errors(); |
117 | 117 | $error_msg = $errors[0]->message; |
118 | 118 | return $xml_success; |
— | — | @@ -144,8 +144,8 @@ |
145 | 145 | $text = "<p>Schema description:</p>\n"; |
146 | 146 | $text .= "<table class=\"pageSchema\">\n"; |
147 | 147 | $name = $class_schema_xml->attributes()->name; |
148 | | - $text .= self::tableRowHTML('paramGroup', 'PageSchema', $name); |
149 | | - foreach ( $class_schema_xml->children() as $tag => $child ) { |
| 148 | + $text .= self::tableRowHTML('paramGroup', 'PageSchema', $name); |
| 149 | + foreach ( $class_schema_xml->children() as $tag => $child ) { |
150 | 150 | if ( $tag == 'Form' ){ |
151 | 151 | $text .= self::parseFormElem($child); |
152 | 152 | } |
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php |
— | — | @@ -88,6 +88,9 @@ |
89 | 89 | $text_3 = '<p>'.wfMsg( 'ps-page-desc-edit-schema' ).'</p>'; |
90 | 90 | $text_4 = ''; |
91 | 91 | self::addJavascript(); |
| 92 | + $schema_name_label = wfMsg('ps-schema-name-label'); |
| 93 | + $add_xml_label = wfMsg('ps-add-xml-label'); |
| 94 | + |
92 | 95 | $pageSchemaObj = null; |
93 | 96 | $text_extensions = array(); //This var. will save the html text returned by the extensions |
94 | 97 | $js_extensions = array(); |
— | — | @@ -104,9 +107,8 @@ |
105 | 108 | } |
106 | 109 | $delimeter_label = wfMsg('ps-delimeter-label'); |
107 | 110 | $multiple_temp_label = wfMsg('ps-multiple-temp-label'); |
108 | | - $field_list_label = wfMsg('ps-field-list-label'); |
109 | | - $add_xml_label = wfMsg('ps-add-xml-label'); |
110 | | - $schema_name_label = wfMsg('ps-schema-name-label'); |
| 111 | + $field_list_label = wfMsg('ps-field-list-label'); |
| 112 | + |
111 | 113 | $text .= '<div id="templatesList">'; |
112 | 114 | $text .= '<div class="templateBox" >'; |
113 | 115 | $text .= '<fieldset style="background: #ddd;"><legend>Template</legend> '; |
— | — | @@ -145,7 +147,7 @@ |
146 | 148 | $add_field_button = Xml::element( 'input', |
147 | 149 | array( |
148 | 150 | 'type' => 'button', |
149 | | - 'value' => 'Add Field', |
| 151 | + 'value' => 'Add field', |
150 | 152 | 'onclick' => "createTemplateAddField(1)" |
151 | 153 | ) |
152 | 154 | ); |
— | — | @@ -160,7 +162,7 @@ |
161 | 163 | $add_template_button = Xml::element( 'input', |
162 | 164 | array( |
163 | 165 | 'type' => 'button', |
164 | | - 'value' => 'Add Template', |
| 166 | + 'value' => 'Add template', |
165 | 167 | 'onclick' => "createAddTemplate()" |
166 | 168 | ) |
167 | 169 | ); |
— | — | @@ -307,7 +309,7 @@ |
308 | 310 | else{ |
309 | 311 | if ( $category != "" ) { |
310 | 312 | $pageSchemaObj = new PSSchema( $category ); |
311 | | - $title = Title::newFromText( $category, NS_CATEGORY ); |
| 313 | + $title = Title::newFromText( $category, NS_CATEGORY ); |
312 | 314 | $pageId = $title->getArticleID(); |
313 | 315 | $dbr = wfGetDB( DB_SLAVE ); |
314 | 316 | //get the result set, query : slect page_props |
— | — | @@ -323,15 +325,14 @@ |
324 | 326 | ); |
325 | 327 | //first row of the result set |
326 | 328 | $row = $dbr->fetchRow( $res ); |
327 | | - if( $row == null ){ |
| 329 | + if( $row == null ){ |
328 | 330 | //Create form here, Cat doesnt exist, create new cat with this text |
329 | 331 | $text_1 .= $text; |
330 | 332 | $wgOut->addHTML( $text_1 ); |
331 | 333 | }else{ |
332 | | - if( ($row[1] == 'PageSchema') && ($row[2] != null )){ |
| 334 | + if( ($row[1] == 'PageSchema') && ($row[2] != null )){ |
333 | 335 | //Populate the form here with autocompleted values |
334 | | - $pageXmlstr = $row[2]; |
335 | | - |
| 336 | + $pageXmlstr = $row[2]; |
336 | 337 | $pageXml = simplexml_load_string ( $pageXmlstr ); |
337 | 338 | $ps_add_xml = ""; |
338 | 339 | $pageName = (string)$pageXml->attributes()->name; |
— | — | @@ -445,7 +446,7 @@ |
446 | 447 | $add_field_button = Xml::element( 'input', |
447 | 448 | array( |
448 | 449 | 'type' => 'button', |
449 | | - 'value' => 'Add Field', |
| 450 | + 'value' => 'Add field', |
450 | 451 | 'onclick' => "createTemplateAddField($template_num)" |
451 | 452 | ) |
452 | 453 | ); |
— | — | @@ -463,7 +464,7 @@ |
464 | 465 | $add_template_button = Xml::element( 'input', |
465 | 466 | array( |
466 | 467 | 'type' => 'button', |
467 | | - 'value' => 'Add Template', |
| 468 | + 'value' => 'Add template', |
468 | 469 | 'onclick' => "createAddTemplate()" |
469 | 470 | ) |
470 | 471 | ); |
Index: trunk/extensions/PageSchemas/PageSchemas.i18n.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | 'ps-schema-name-label' => 'Name of schema:', |
33 | 33 | 'editschema' => 'Edit schema', |
34 | 34 | 'generatepages' => 'Generate pages', |
35 | | - 'createpages' => 'Create Pages' , |
| 35 | + 'createpages' => 'Create schema' , |
36 | 36 | |
37 | 37 | ); |
38 | 38 | |
Index: trunk/extensions/PageSchemas/PageSchemas.php |
— | — | @@ -63,5 +63,5 @@ |
64 | 64 | $wgPageProps['PageSchema'] = 'Content of <PageSchema> tag'; |
65 | 65 | |
66 | 66 | $wgHooks['UnknownAction'][] = 'PSTabs::onUnknownAction'; |
67 | | -$wgHooks['SkinTemplateTabs'][] = 'PSTabs::displayTab'; |
68 | | -$wgHooks['SkinTemplateNavigation'][] = 'PSTabs::displayTab2'; |
\ No newline at end of file |
| 67 | +$wgHooks['SkinTemplateTabs'][] = 'PSTabs::displayTabs'; |
| 68 | +$wgHooks['SkinTemplateNavigation'][] = 'PSTabs::displayTabs2'; |
\ No newline at end of file |
Index: trunk/extensions/PageSchemas/PageSchemas.hooks.php |
— | — | @@ -56,6 +56,7 @@ |
57 | 57 | if ( $xml_object = PageSchemas::validateXML( $input, $error_msg ) ) { |
58 | 58 | // Store XML in the page_props table |
59 | 59 | $parser->getOutput()->setProperty( 'PageSchema', $input ); |
| 60 | + wfDebugLog( 'myextension', 'input ' . print_r( $xml_object, true ) ); |
60 | 61 | $text = PageSchemas::parsePageSchemas($xml_object); |
61 | 62 | } else { |
62 | 63 | // Store error message in the page_props table |