Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php |
— | — | @@ -46,6 +46,9 @@ |
47 | 47 | }); |
48 | 48 | jQuery('#templatesList').append(newField); |
49 | 49 | } |
| 50 | +function updateFieldNum(field_num){ |
| 51 | + fieldNum = field_num; |
| 52 | +} |
50 | 53 | function addjQueryToCheckbox(){ |
51 | 54 | jQuery('.isListCheckbox').click(function() { |
52 | 55 | if (jQuery(this).is(":checked")) |
— | — | @@ -252,7 +255,7 @@ |
253 | 256 | $params['page_text'] = $pageText.$Xmltext; |
254 | 257 | $jobs[] = new PSCreatePageJob( $title, $params ); |
255 | 258 | Job::batchInsert( $jobs ); |
256 | | - } |
| 259 | + } |
257 | 260 | } |
258 | 261 | else{ |
259 | 262 | if ( $category != "" ) { |
— | — | @@ -320,10 +323,10 @@ |
321 | 324 | $template_add_xml .= (string)$field_xml->asXML(); |
322 | 325 | } |
323 | 326 | } |
324 | | - foreach ($template_xml->children() as $field_xml) { |
| 327 | + $text_4 .= '<div id="fieldsList_'.$template_num.'">'; |
| 328 | + foreach ($template_xml->children() as $field_xml) { |
325 | 329 | if ( $field_xml->getName() == "Field" ){ |
326 | | - $fieldName = (string)$field_xml->attributes()->name; |
327 | | - $text_4 .= '<div id="fieldsList_'.$template_num.'">'; |
| 330 | + $fieldName = (string)$field_xml->attributes()->name; |
328 | 331 | $text_4 .= '<div class="fieldBox" >'; |
329 | 332 | $text_4 .= '<fieldset style="background: #bbb;"><legend>Field</legend> '; |
330 | 333 | if( ((string)$field_xml->attributes()->list) == "list") { |
— | — | @@ -337,11 +340,11 @@ |
338 | 341 | $fieldLabel = (string)$child; |
339 | 342 | } |
340 | 343 | } |
341 | | - $text_4 .= '<p>Field name: <input size="15" name="f_name_'.$template_num.'" value="'.$fieldName.'" >'; |
| 344 | + $text_4 .= '<p>Field name: <input size="15" name="f_name_'.$field_count.'" value="'.$fieldName.'" >'; |
342 | 345 | $text_4 .= 'Display label: <input size="15" name="f_label_'.$field_count.'" value="'.$fieldLabel.'" > |
343 | 346 | </p> '; |
344 | 347 | if($list_values){ |
345 | | - $text_4 .= '<p><input type="checkbox" name="f_is_list_'.$template_num.'" checked class="isListCheckbox" /> This field can hold a list of values</p> '; |
| 348 | + $text_4 .= '<p><input type="checkbox" name="f_is_list_'.$field_count.'" checked class="isListCheckbox" /> This field can hold a list of values</p> '; |
346 | 349 | $text_4 .= '<div class="delimiterInput" style="display:" ><p>Delimiter for values (default is ","): <input type="text" name="f_delimiter_'.$field_count.'" value="'.$delimiter.'" /> </p></div>'; |
347 | 350 | }else{ |
348 | 351 | $text_4 .= '<p><input type="checkbox" name="f_is_list_'.$field_count.'" class="isListCheckbox" /> This field can hold a list of values</p> '; |
— | — | @@ -355,23 +358,25 @@ |
356 | 359 | $text_ex = preg_replace('/starter/', $field_count, $text_ex_array[$field_count]); |
357 | 360 | $text_4 .= $text_ex; |
358 | 361 | } |
359 | | - } |
| 362 | + } |
360 | 363 | $text_4 .= '<p>Additional XML: |
361 | 364 | <textarea rows=4 style="width: 100%" name="f_add_xml_'.$field_count.'"></textarea> |
362 | 365 | </p> |
363 | 366 | <input type="button" value="Remove field" class="deleteField" /></fieldset> |
364 | 367 | </div> |
365 | | - </div> |
366 | 368 | '; |
367 | 369 | $field_count++; |
368 | | - } |
369 | | - |
| 370 | + $text_4 .= '<script type="text/javascript"> |
| 371 | + updateFieldNum('.$field_count.'); |
| 372 | + </script>'; |
| 373 | + } |
370 | 374 | } |
| 375 | + $text_4 .= '</div>'; |
371 | 376 | $add_field_button = Xml::element( 'input', |
372 | 377 | array( |
373 | 378 | 'type' => 'button', |
374 | 379 | 'value' => 'Add Field', |
375 | | - 'onclick' => "createTemplateAddField(1)" |
| 380 | + 'onclick' => "createTemplateAddField($template_num)" |
376 | 381 | ) |
377 | 382 | ); |
378 | 383 | $text_4 .= Xml::tags( 'p', null, $add_field_button ) . "\n"; |
— | — | @@ -380,7 +385,7 @@ |
381 | 386 | <textarea rows=4 style="width: 100%" name="t_add_xml_'.$template_num.'">'.$template_add_xml.'</textarea> |
382 | 387 | </p> |
383 | 388 | <p><input type="button" value="Remove template" class="deleteTemplate" /></p> |
384 | | - </fieldset> </div></div>'; |
| 389 | + </fieldset> </div>'; |
385 | 390 | |
386 | 391 | } |
387 | 392 | } |