r92368 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92367‎ | r92368 | r92369 >
Date:16:55, 16 July 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
Modified generatePAge and genpageList functions to use array of title object instead of titleString.
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -152,7 +152,7 @@
153153 /**
154154 * Function to return the Property based on the xml passed from the PageSchema extension
155155 */
156 - public static function sfCreatePageSchemasObject( $objectName, $xmlForField, &$object ) {
 156+ public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) {
157157 $sfarray = array();
158158 if ( $objectName == "FormInput" ) {
159159 foreach ( $xmlForField->children() as $tag => $child ) {
@@ -175,28 +175,25 @@
176176
177177 /**
178178 */
179 - public static function sfGetPageList( $psSchemaObj, &$genPageList ) {
 179+ public static function getPageList( $psSchemaObj, &$genPageList ) {
180180 global $wgOut, $wgUser;
181 - $template_all = $psSchemaObj->getTemplates();
182 - $form_templates = array();
183 - foreach ( $template_all as $template ) {
 181+ $template_all = $psSchemaObj->getTemplates();
 182+ foreach ( $template_all as $template ) {
184183 $title = Title::makeTitleSafe( NS_TEMPLATE, $template->getName() );
185 - $genPageList[] = 'Template:'.$title->getText();
186 - //Creating Form Templates at this time
187 - $form_template = SFTemplateInForm::create( $template->getName(),
188 - $template->getLabel(),
189 - $template->isMultiple() );
190 - $form_templates[] = $form_template;
 184+ $genPageList[] = $title;
191185 }
192186 $form_name = $psSchemaObj->getFormName();
193 - $form = SFForm::create( $form_name, $form_templates );
194 - $title = Title::makeTitleSafe( SF_NS_FORM, $form->form_name );
195 - $genPageList[] = 'Form:'.$title->getText();
 187+ if( $form_name == null ){
 188+ return true;
 189+ }
 190+ //$form = SFForm::create( $form_name, $form_templates );
 191+ $title = Title::makeTitleSafe( SF_NS_FORM, $form_name );
 192+ $genPageList[] = $title;
196193 return true;
197194 }
198195 /**
199196 */
200 - public static function sfGeneratePages( $psSchemaObj, $toGenPageList ) {
 197+ public static function generatePages( $psSchemaObj, $toGenPageList ) {
201198 global $wgOut, $wgUser;
202199 $template_all = $psSchemaObj->getTemplates();
203200 $form_templates = array();
@@ -221,7 +218,8 @@
222219 }
223220 $template_text = SFTemplateField::createTemplateText( $template->getName(), $template_fields, null, $psSchemaObj->categoryName, null, null, null );
224221 $title = Title::makeTitleSafe( NS_TEMPLATE, $template->getName() );
225 - if( in_array('Template:'.$title->getText(), $toGenPageList )){
 222+ $key_title = PageSchemas::titleString( $title );
 223+ if( in_array($key_title, $toGenPageList )){
226224 $params = array();
227225 $params['user_id'] = $wgUser->getId();
228226 $params['page_text'] = $template_text;
@@ -233,9 +231,13 @@
234232 $form_templates[] = $form_template;
235233 }
236234 $form_name = $psSchemaObj->getFormName();
 235+ if( $form_name == null ){
 236+ return true;
 237+ }
237238 $form = SFForm::create( $form_name, $form_templates );
238239 $title = Title::makeTitleSafe( SF_NS_FORM, $form->form_name );
239 - if( in_array('Form:'.$title->getText(), $toGenPageList )){
 240+ $key_title = PageSchemas::titleString( $title );
 241+ if( in_array($key_title, $toGenPageList )){
240242 $full_text = $form->createMarkup();
241243 $params = array();
242244 $params['user_id'] = $wgUser->getId();
@@ -248,7 +250,7 @@
249251 /**
250252 *Thi Function parses the Field elements in the xml of the pages. Hooks for PageSchemas extension
251253 */
252 - public static function sfParseFieldElements( $field_xml, &$text_object ) {
 254+ public static function parseFieldElements( $field_xml, &$text_object ) {
253255 foreach ( $field_xml->children() as $tag => $child ) {
254256 if ( $tag == "FormInput" ) {
255257 $text = "";