/[drupal]/contributions/modules/flexiconvert/flexiconvert.module
ViewVC logotype

Diff of /contributions/modules/flexiconvert/flexiconvert.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7, Wed May 7 21:26:47 2008 UTC revision 1.8, Tue Aug 19 02:34:40 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: flexiconvert.module,v 1.7 2008/05/07 21:26:47 aj045 Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 193  function flexiconvert_cck_running() { Line 193  function flexiconvert_cck_running() {
193  }  }
194    
195  /**  /**
196   * Returns the form for converting Flexinode types to CCK type.s   * Returns the form for converting Flexinode types to CCK types.
197   *   *
198   * If CCK is not running correctly, an error message is set instead of a form.   * If CCK is not running correctly, an error message is set instead of a form.
199   */   */
# Line 338  function flexiconvert_form_submit($form_ Line 338  function flexiconvert_form_submit($form_
338                          $type = flexiconvert_get_type($ffield['title']);                          $type = flexiconvert_get_type($ffield['title']);
339                          foreach($type->fields as $fd) {                          foreach($type->fields as $fd) {
340                                  //      Much of the code that appears below is straight from the CCK module.                                  //      Much of the code that appears below is straight from the CCK module.
341                                  //      The code there is quite messy and a bit hard to read but it gets the job done.                                  //      The code is quite messy and a bit hard to read but it gets the job done.
342                                  $field_name = trim($fd['label']);                                  $field_name = trim($fd['label']);
343                      $field_name = drupal_strtolower($field_name);                      $field_name = drupal_strtolower($field_name);
344                      $field_name = str_replace(array(' ', '-'), '_', $field_name);                      $field_name = str_replace(array(' ', '-'), '_', $field_name);
# Line 353  function flexiconvert_form_submit($form_ Line 353  function flexiconvert_form_submit($form_
353    
354                      $cck_type = _flexiconvert_field_to_cck($fd['field_type']);                      $cck_type = _flexiconvert_field_to_cck($fd['field_type']);
355    
356                                  db_query("INSERT INTO {node_field} (field_name, type, global_settings, required, multiple, db_storage) VALUES ('%s', '%s', '%s', %d, %d, %d)", $field_name, $cck_type, serialize(array('text_processing' => '1', 'max_length' => '', 'allowed_values' => '', 'allowed_values_php' => '')), $fd['required'], 0, 1);                                  db_query("INSERT INTO {node_field} (field_name, type, global_settings, required, multiple, db_storage) VALUES ('%s', '%s', '%s', %d, %d, %d)",
357                                  db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, display_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s', '%s')", $field_name, _flexiconvert_fix_single_type(strtolower($ffield['title'])), $fd['weight'], $fd['label'], $cck_type, serialize(array()), serialize(array()), '');            $field_name,
358              $cck_type,
359              serialize(array(
360                'text_processing' => '1',
361                'max_length' => '',
362                'allowed_values' => '',
363                'allowed_values_php' => ''
364              )),
365              $fd['required'],
366              0,
367              1
368            );
369                                    db_query("INSERT INTO {node_field_instance} (field_name, type_name, weight, label, widget_type, widget_settings, display_settings, description) VALUES ('%s', '%s', %d, '%s', '%s', '%s', '%s', '%s')",
370              $field_name,
371              _flexiconvert_fix_single_type(strtolower($ffield['title'])),
372              $fd['weight'],
373              $fd['label'],
374              $cck_type,
375              serialize(array()),
376              serialize(array()),
377              ''
378            );
379    
380                                  content_clear_type_cache();                                  content_clear_type_cache();
381    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2