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

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

CVS export from OnRamp's OnFire Distribution System

Labels of data to include:

  "Issue Title","Issue ID","Issue Number","Issue Description"
    "Issue Image URL","Issue Image Title", "Issue Podcast URL"


Example values:

  "Polar Plants","March2009","12","Did you know that Antarctica is home 
      to two species of plants? At the opposite end of the earth, over 
      a thousand plant species grow on the Arctic tundra. And that's not 
      counting the many species of algae and lichens that are not classified 
      as plants. In this issue, we highlight high quality resources for 
      teaching plant classification, life cycles, and adaptations. Enrich 
      your practice with our professional resources and discover science 
      lessons and informational text to engage your students.",
    "http://onramp.nsdl.org/eserv/onramp:16444/web_DSC_0053_w.jpg?status=true",
    "White cottongrass in Kangerlussuaq, West Greenland. Photo copyright 
      Henning Thing, ThingsUnlimited.",
    "http://onramp.nsdl.org/eserv/onramp:16725/podcast_article_mar09.html?status=true"


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
Issue Description issue_desc Did you know that Antarctica is home to two species of plants? At the opposite end of the earth, over a thousand plant species grow on the Arctic tundra. And that's not counting the many species of algae and lichens that are not classified as plants. In this issue, we highlight high quality resources for teaching plant classification, life cycles, and adaptations. Enrich your practice with our professional resources and discover science lessons and informational text to engage your students.
Issue Image URL issue_img_url http://onramp.nsdl.org/eserv/onramp:16458/web_Alpine_Anemone.jpg?status=true
Issue Image Title issue_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.
Issue Podcast URL issue_pod_url http://onramp.nsdl.org/eserv/onramp:16725/podcast_article_mar09.html?status=true


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'].')
           
Example:

  Issue 12 (Polar Plants)
  
  
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_iss"
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_iss"
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 cvs_array['issue_desc']
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 CCK fields for Issues.

  • Issue Image (node ref) - 1 only -- NEEDS TO BE UPLOADED PRIOR TO DEPARTMENT
  • Issue Podcast (node ref) - 1 only -- NEEDS TO BE UPLOADED PRIOR TO DEPARTMENT


Issue Image

Image must have been imported first.

Query to find Issue Image:

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


Fields in field_data_field_iss_img_node table:
Field Value Comment
entity_type "node"
bundle "ct_iss"
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_iss_img_node_nid results->entity_id (ex. 52)


Issue Podcast

Podcast must have been imported first.

Query to find Issue Podcast:

  SELECT entity_id
    FROM field_ipod_onrampurl_value
    WHERE field_ipod_onrampurl_value=cvs_array[issue_podcast_url']
  }


Fields in field_data_field_iss_img_node table:
Field Value Comment
entity_type "node"
bundle "ct_iss"
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_iss_img_node_nid results->entity_id (ex. 52)


Taxonomy Fields

The following are the taxonomy fields for Issues.

  • Issue 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_iss"
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)
Personal tools