TNS Internal:OnRamp/moveBPPBanalysis/drupal/themeANDcontentTypes/contentOrganization/page creation/migrateIssueDepartment

From NSDLWiki

Jump to: navigation, search

Moving Beyond Penguins to Drupal -- Status

 Overview   Taxonomies   Content Types & Fields   Linking Components   Views   Page Creation 

Contents

[hide]


Organizing Content -> Page Creation

Migrating an Issue Department

CVS export from OnRamp's OnFire Distribution System

Labels of data to include:

  "Issue Title","Issue ID","Issue Number","Department Title ","Department ID",
    "Department Image URL","Department Image Title"


Example values:

  "Polar Plants","March2009","12","Professional Learning","professional",
    "http://onramp.nsdl.org/eserv/onramp:16458/web_Alpine_Anemone.jpg?status=true",
    "Alpine anemone, a type of wildflower found on tundra plains. Photo courtesy of B.J. McCaffery, 
      US Fish and Wildlife Service, Alaska Image Library."


Parse CVS into Array

Description array Key example array Value (from CVS example)
Issue Title issue_title Polar Plants
Issue ID issue_id March2009
Issue Number issue_num 12
Department Title dept_title Professional Learning
Department ID dept_id professional
Department Image URL dept_img_url http://onramp.nsdl.org/eserv/onramp:16458/web_Alpine_Anemone.jpg?status=true
Department Image Title dept_img_title Alpine anemone, a type of wildflower found on tundra plains. Photo courtesy of B.J. McCaffery, US Fish and Wildlife Service, Alaska Image Library.


Drupal Import

Create node

The node table holds the title and configurations. The field_data_body table holds the body text and its summary.


Title (node)

Setting up internal title:

  title = 'Issue '.cvs_array['issue_num'].' ('.cvs_array['issue_title'].') - '.
           'Dept - '.cvs_array['dept_title']
           
Example:

  Issue 12 (Polar Plants) - Dept - Professional Learning
  
  
Fields in node table:
Field Value Comment
nid generated does conversion program generate this or drupal?
vid generated does conversion program generate this or drupal?
type "ct_idpt"
language default "en" - assuming this is the default
title title
uid  ??? where does this come from and what does it mean?
status 1 is this the default
created auto_generated
changed auto_generated
comment default
promote default
moderate default
sticky default
tnid default
translate default


Content (not used)

Fields in field_data_body table:
Field Value Comment
entity_type "node"
bundle "ct_idpt"
deleted 0 default?
entity_id node->nid
revision_id node->vid
language "en" default?
delta 0 default? Used for repeating fields. Body doesn't repeat.
body_value  ??? NOT USED
body_summary  ???
body_format  ??? No sure how this is determined.


php for generating a node:

NOTE: This may not be accurate. Is 'node' the name of the table and the table is expecting 3 fields? Or is 'node' an abstract concept of a node and db_insert is determining the real table(s) and splitting the fields among the tables as appropriate. More research is needed for this.

<?php
//Based on code in: Database abstraction layer 
//  (search for first occurence of db_insert)

// construct node parts
$fields = array(
    'nid'   => 1, 
    'title' => cvs_array['title'], 
    'body'  => get_body(cvs_array['content'],true) );

// create new node
db_insert('node')->fields($fields)->execute();
?>


CCK Fields

The following are the CCK fields for Issue Departments.

  • Static Department (node ref) - 1 only
  • Department Image (node ref) - 1 only -- NEEDS TO BE UPLOADED PRIOR TO DEPARTMENT


Static Department

Query to find Static Department:

  // Find taxonomy tid based on department id (ex. professional)
  SELECT entity_id 
    FROM field_data_field_tax_dptcol_id 
    WHERE field_tax_dptcol_id_value=cvs_array['dept_id']

  tid = result->entity_id

  // Find static department
  SELECT entity_id
    FROM `field_data_taxonomy_vocabulary_2`
    WHERE bundle='ct_sdpt' && taxonomy_vocabulary_2_tid=tid


Fields in field_data_field_idpt_sdpt_node table:
Field Value Comment
entity_type "node"
bundle "ct_idpt"
deleted 0 default?
entity_id node->nid (ex. 55)
revision_id node->vid (ex. 105)
language "en" default?
delta 0 default? Used for repeating fields.
field_idpt_sdpt_node_nid result->entity_id (ex. 21)


Department Image

Image must have been imported first.

Query to find Department Image:

  SELECT entity_id
    FROM field_img_onrampurl_value
    WHERE field_img_onrampurl_value=cvs_array[dept_image_url']
  }


Fields in field_data_field_idpt_img_node table:
Field Value Comment
entity_type "node"
bundle "ct_idpt"
deleted 0 default?
entity_id node->nid (ex. 55)
revision_id node->vid (ex. 105)
language "en" default?
delta 0 default? Used for repeating fields.
field_idpt_img_node_nid results->entity_id (ex. 52)


Taxonomy Fields

The following are the taxonomy fields for Issue Departments.

  • Issue ID
  • Department ID


Issue ID

Query to find taxonomy term:

  SELECT entity_id 
    FROM field_data_field_tax_iss_id 
    WHERE field_tax_iss_id_value=cvs_array['issue_id']


Fields in field_data_taxonomy_vocabulary_1 table:
Field Value Comment
entity_type "node"
bundle "ct_idpt"
deleted 0 default?
entity_id node->nid (ex. 55)
revision_id node->vid (ex. 105)
language "und" default?
delta 0 default? Used for repeating fields.
taxonomy_vocabulary_1_tid result->entity_id (ex. 12)


Department ID

Query to find taxonomy term:

  SELECT entity_id 
    FROM field_data_field_tax_dptcol_id 
    WHERE field_tax_dptcol_id_value=cvs_array['dept_id']


Fields in field_data_taxonomy_vocabulary_2 table:
Field Value Comment
entity_type "node"
bundle "ct_idpt"
deleted 0 default?
entity_id node->nid (ex. 55)
revision_id node->vid (ex. 105)
language "und" default?
delta 0 default? Used for repeating fields.
taxonomy_vocabulary_2_tid result->entity_id (ex. 21)
Personal tools