Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | /** |
154 | 154 | * Function to return the Property based on the xml passed from the PageSchema extension |
155 | 155 | */ |
156 | | - public static function sfCreatePageSchemasObject( $objectName, $xmlForField, &$object ) { |
| 156 | + public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) { |
157 | 157 | $sfarray = array(); |
158 | 158 | if ( $objectName == "FormInput" ) { |
159 | 159 | foreach ( $xmlForField->children() as $tag => $child ) { |
— | — | @@ -175,28 +175,25 @@ |
176 | 176 | |
177 | 177 | /** |
178 | 178 | */ |
179 | | - public static function sfGetPageList( $psSchemaObj, &$genPageList ) { |
| 179 | + public static function getPageList( $psSchemaObj, &$genPageList ) { |
180 | 180 | 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 ) { |
184 | 183 | $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; |
191 | 185 | } |
192 | 186 | $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; |
196 | 193 | return true; |
197 | 194 | } |
198 | 195 | /** |
199 | 196 | */ |
200 | | - public static function sfGeneratePages( $psSchemaObj, $toGenPageList ) { |
| 197 | + public static function generatePages( $psSchemaObj, $toGenPageList ) { |
201 | 198 | global $wgOut, $wgUser; |
202 | 199 | $template_all = $psSchemaObj->getTemplates(); |
203 | 200 | $form_templates = array(); |
— | — | @@ -221,7 +218,8 @@ |
222 | 219 | } |
223 | 220 | $template_text = SFTemplateField::createTemplateText( $template->getName(), $template_fields, null, $psSchemaObj->categoryName, null, null, null ); |
224 | 221 | $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 )){ |
226 | 224 | $params = array(); |
227 | 225 | $params['user_id'] = $wgUser->getId(); |
228 | 226 | $params['page_text'] = $template_text; |
— | — | @@ -233,9 +231,13 @@ |
234 | 232 | $form_templates[] = $form_template; |
235 | 233 | } |
236 | 234 | $form_name = $psSchemaObj->getFormName(); |
| 235 | + if( $form_name == null ){ |
| 236 | + return true; |
| 237 | + } |
237 | 238 | $form = SFForm::create( $form_name, $form_templates ); |
238 | 239 | $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 )){ |
240 | 242 | $full_text = $form->createMarkup(); |
241 | 243 | $params = array(); |
242 | 244 | $params['user_id'] = $wgUser->getId(); |
— | — | @@ -248,7 +250,7 @@ |
249 | 251 | /** |
250 | 252 | *Thi Function parses the Field elements in the xml of the pages. Hooks for PageSchemas extension |
251 | 253 | */ |
252 | | - public static function sfParseFieldElements( $field_xml, &$text_object ) { |
| 254 | + public static function parseFieldElements( $field_xml, &$text_object ) { |
253 | 255 | foreach ( $field_xml->children() as $tag => $child ) { |
254 | 256 | if ( $tag == "FormInput" ) { |
255 | 257 | $text = ""; |