r94897 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94896‎ | r94897 | r94898 >
Date:15:33, 18 August 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
Some minor fixes.
Modified paths:
  • /trunk/extensions/PageSchemas/PS_Tabs.php (modified) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.classes.php (modified) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.hooks.php (modified) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.i18n.php (modified) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.php (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PS_Tabs.php
@@ -5,17 +5,15 @@
66 *
77 * @since 0.1
88 *
9 - * @file Push_Tab.php
10 - * @ingroup Push
 9+ * @file _Tab.php
 10+ * @ingroup
1111 *
1212 * @author ankit
1313 */
1414 final class PSTabs {
1515
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 ) {
2018 global $wgUser;
2119
2220 // Make sure that this is not a special page, the page has contents, and the user can push.
@@ -54,34 +52,30 @@
5553 * Function currently called only for the 'Vector' skin, added in
5654 * MW 1.16 - will possibly be called for additional skins later
5755 */
58 - public static function displayTab2( $obj, &$links ) {
 56+ public static function displayTabs2( $obj, &$links ) {
5957 // The old '$content_actions' array is thankfully just a sub-array of this one
6058 $views_links = $links['actions'];
61 - self::displayTab( $obj, $views_links );
 59+ self::displayTabs( $obj, $views_links );
6260 $links['actions'] = $views_links;
6361 return true;
6462 }
6563
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+ /**
7265 *
7366 * @return true
7467 */
7568 public static function onUnknownAction( $action, Article $article ) {
7669 $title = $article->getTitle();
7770 $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+ }
8680 return true;
8781 }
8882 }
\ No newline at end of file
Index: trunk/extensions/PageSchemas/PageSchemas.classes.php
@@ -111,7 +111,7 @@
112112 // for now - this may change later
113113 // hide parsing warnings
114114 libxml_use_internal_errors(true);
115 - $xml_success = simplexml_load_string($xmlDTD . $xml);
 115+ $xml_success = simplexml_load_string($xmlDTD.$xml);
116116 $errors = libxml_get_errors();
117117 $error_msg = $errors[0]->message;
118118 return $xml_success;
@@ -144,8 +144,8 @@
145145 $text = "<p>Schema description:</p>\n";
146146 $text .= "<table class=\"pageSchema\">\n";
147147 $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 ) {
150150 if ( $tag == 'Form' ){
151151 $text .= self::parseFormElem($child);
152152 }
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -88,6 +88,9 @@
8989 $text_3 = '<p>'.wfMsg( 'ps-page-desc-edit-schema' ).'</p>';
9090 $text_4 = '';
9191 self::addJavascript();
 92+ $schema_name_label = wfMsg('ps-schema-name-label');
 93+ $add_xml_label = wfMsg('ps-add-xml-label');
 94+
9295 $pageSchemaObj = null;
9396 $text_extensions = array(); //This var. will save the html text returned by the extensions
9497 $js_extensions = array();
@@ -104,9 +107,8 @@
105108 }
106109 $delimeter_label = wfMsg('ps-delimeter-label');
107110 $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+
111113 $text .= '<div id="templatesList">';
112114 $text .= '<div class="templateBox" >';
113115 $text .= '<fieldset style="background: #ddd;"><legend>Template</legend> ';
@@ -145,7 +147,7 @@
146148 $add_field_button = Xml::element( 'input',
147149 array(
148150 'type' => 'button',
149 - 'value' => 'Add Field',
 151+ 'value' => 'Add field',
150152 'onclick' => "createTemplateAddField(1)"
151153 )
152154 );
@@ -160,7 +162,7 @@
161163 $add_template_button = Xml::element( 'input',
162164 array(
163165 'type' => 'button',
164 - 'value' => 'Add Template',
 166+ 'value' => 'Add template',
165167 'onclick' => "createAddTemplate()"
166168 )
167169 );
@@ -307,7 +309,7 @@
308310 else{
309311 if ( $category != "" ) {
310312 $pageSchemaObj = new PSSchema( $category );
311 - $title = Title::newFromText( $category, NS_CATEGORY );
 313+ $title = Title::newFromText( $category, NS_CATEGORY );
312314 $pageId = $title->getArticleID();
313315 $dbr = wfGetDB( DB_SLAVE );
314316 //get the result set, query : slect page_props
@@ -323,15 +325,14 @@
324326 );
325327 //first row of the result set
326328 $row = $dbr->fetchRow( $res );
327 - if( $row == null ){
 329+ if( $row == null ){
328330 //Create form here, Cat doesnt exist, create new cat with this text
329331 $text_1 .= $text;
330332 $wgOut->addHTML( $text_1 );
331333 }else{
332 - if( ($row[1] == 'PageSchema') && ($row[2] != null )){
 334+ if( ($row[1] == 'PageSchema') && ($row[2] != null )){
333335 //Populate the form here with autocompleted values
334 - $pageXmlstr = $row[2];
335 -
 336+ $pageXmlstr = $row[2];
336337 $pageXml = simplexml_load_string ( $pageXmlstr );
337338 $ps_add_xml = "";
338339 $pageName = (string)$pageXml->attributes()->name;
@@ -445,7 +446,7 @@
446447 $add_field_button = Xml::element( 'input',
447448 array(
448449 'type' => 'button',
449 - 'value' => 'Add Field',
 450+ 'value' => 'Add field',
450451 'onclick' => "createTemplateAddField($template_num)"
451452 )
452453 );
@@ -463,7 +464,7 @@
464465 $add_template_button = Xml::element( 'input',
465466 array(
466467 'type' => 'button',
467 - 'value' => 'Add Template',
 468+ 'value' => 'Add template',
468469 'onclick' => "createAddTemplate()"
469470 )
470471 );
Index: trunk/extensions/PageSchemas/PageSchemas.i18n.php
@@ -31,7 +31,7 @@
3232 'ps-schema-name-label' => 'Name of schema:',
3333 'editschema' => 'Edit schema',
3434 'generatepages' => 'Generate pages',
35 - 'createpages' => 'Create Pages' ,
 35+ 'createpages' => 'Create schema' ,
3636
3737 );
3838
Index: trunk/extensions/PageSchemas/PageSchemas.php
@@ -63,5 +63,5 @@
6464 $wgPageProps['PageSchema'] = 'Content of &lt;PageSchema&gt; tag';
6565
6666 $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 @@
5757 if ( $xml_object = PageSchemas::validateXML( $input, $error_msg ) ) {
5858 // Store XML in the page_props table
5959 $parser->getOutput()->setProperty( 'PageSchema', $input );
 60+ wfDebugLog( 'myextension', 'input ' . print_r( $xml_object, true ) );
6061 $text = PageSchemas::parsePageSchemas($xml_object);
6162 } else {
6263 // Store error message in the page_props table

Status & tagging log