TNS Internal:OnRamp/moveBPPBanalysis/drupal/themeANDcontentTypes/contentOrganization/page creation/migrateIssueArticle
From NSDLWiki
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 Article
CVS export from OnRamp's OnFire Distribution System
Labels of data to include: "Issue Title","Issue ID","Issue Number","Department Title ","Department ID","Column Title", "Column ID","Article Title","URL to Content","Meta Description","Contributor(s) Names", "Keywords","Audience","Education Level","NSDL Type","Access Rights","Access Rights URL", "Resource URL" Example values: "Polar Plants","March2009","12","Professional Learning","professional", "Science Content Knowledge","science","Plants of the Arctic and Antarctic", "http://onramp.nsdl.org/eserv/onramp:16700/mar09_pl_sc.html?status=true", "This article discusses the types of plants found in the Arctic and Antarctic as well as the adaptations that enable their survival in the polar regions' harsh conditions.", "Tracey Allen, Clarissa Reeson","plants, vascular, nonvascular, fungi, lichens, algae, Arctic, Antarctic, polar, adaptations","Educator", "Elementary School,Early Elementary,Kindergarten,Grade 1,Grade 2, Upper Elementary,Grade 3,Grade 4,Grade 5", "Reference Material,Nonfiction Reference","Free access", "http://beyondpenguins.nsdl.org/information.php?topic=use", "http://beyondpenguins.nsdl.org/issue/column.php?date=March2009& departmentid=professional&columnid=professional!science"
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 |
Column Title | column_title | Science Content Knowledge |
Column ID | column_id | professional!science |
Article Title | article_title | Plants of the Arctic and Antarctic |
URL to Content | content | http://onramp.nsdl.org/eserv/onramp:16700/mar09_pl_sc.html?status=true |
MetaDescription | mdesc | This article discusses the types of plants found in the Arctic and Antarctic as well as the adaptations that enable their survival in the polar regions' harsh conditions. |
Contributor(s) Names | contributors | array( Tracey Allen, Clarissa Reeson ) |
Keywords | keywords | array( plants, vascular, nonvascular, fungi, lichens, algae, Arctic, Antarctic, polar, adaptations ) |
Audience | audiences | array( Educator ) |
Education Level | edlevels | array( Elementary School,Early Elementary,Kindergarten,Grade 1,Grade 2,Upper Elementary,Grade 3,Grade 4,Grade 5 ) |
NSDL Type | nsdltypes | array( Reference Material,Nonfiction Reference ) |
Access Rights | accesses | array( Free access ) |
Access Rights URL | accessurl | http://beyondpenguins.nsdl.org/information.php?topic=use |
Resource URL | resourceurl | http://beyondpenguins.nsdl.org/issue/column.php?date=March2009&departmentid=professional&columnid=professional!science |
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'].') - '. 'Col ('.cvs_array['column_id'].') - '.cvs_array['article_title'] Example: Issue 12 (Polar Plants) - Col (professional!science) - Plants of the Arctic and Antarctic
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_iart" 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
Fields in field_data_body table:
Field Value Comment entity_type "node" bundle "ct_iart" 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['content'] get_body(cvs_array['content'],true)
stripped down content from content URL (header/footer code removed)body_summary cvs_array['mdesc'] body_format ??? No sure how this is determined.
php for getting body from url:
see getBody function in... https://svn.nsdl.org/polar/website/trunk/src/include/functions.php
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 Articles.
- Article Title (text) - 1 only
- Static Column (node ref) - 1 only
- Resource URL (text) - 1 only
- Contributor(s) (node ref) - unlimited
Article Title
Fields in field_data_field_iart_title table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. field_iart_title_value cvs_array['article_title'] field_iart_title_format NULL default?
Static Column
Query to find Static Column: // Find taxonomy tid based on column id (ex. professional!science) SELECT entity_id FROM field_data_field_tax_dptcol_id WHERE field_tax_dptcol_id_value=cvs_array['column_id'] tid = result->entity_id // Find static column SELECT entity_id FROM `field_data_taxonomy_vocabulary_2` WHERE bundle='ct_sdpt' && taxonomy_vocabulary_2_tid=tid
Fields in field_data_field_iart_scol_node table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. field_iart_scol_node_nid result->entity_id (ex. 21)
Resource URL
Fields in field_data_field_iart_resource_url table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. field_iart_resource_url_value cvs_array['resourceurl'] field_iart_resource_url_format NULL default?
Contributor(s)
Query to find Contributor(s): foreach( cvs_array['contributors'] as contributor{ // Find node nid of the contributor based on contributor's name (ex. Tracey Allen) SELECT nid FROM `node` WHERE TYPE='ct_ctr' && title=contributor }
Fields in field_data_field_iart_ctr_node table:
Field Value Comment entity_type "node" bundle "ct_iart" deleted 0 default? entity_id node->nid (ex. 55) revision_id node->vid (ex. 105) language "en" default? delta 0 | 1 | 2 ... counts up based on number of ctr added field_iart_ctr_node_nid results->nid (ex. 54)
find based on cvs_array['contributors']
(ex. Tracey Allen, Clarissa Reeson)
Taxonomy Fields
The following are the taxonomy fields for Issue Articles.
- Issue ID
- Column ID
- Keywords
- Audience
- Education Level
- NSDL Type
- Access Rights
- Access Rights URL
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_iart" 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. Body doesn't repeat. taxonomy_vocabulary_1_tid result->entity_id (ex. 12)
Column ID
Query to find taxonomy term: SELECT entity_id FROM field_data_field_tax_dptcol_id WHERE field_tax_dptcol_id_value=cvs_array['column_id']
Fields in field_data_taxonomy_vocabulary_2 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_2_tid result->entity_id (ex. 26)
Keywords
cvs_array['keywords'] is a comma separated list. Each term needs to be found separately. Keywords are free-tags, so if a match is not found, the keyword is added to the list of tags.
Query to find taxonomy term: foreach( cvs_array['keywords'] as keyword{ SELECT tid FROM taxonomy_term_data WHERE vid=6 && name=keyword } if results then tid = results->tid else { create new entry in taxonomy_term_data tid = generated tid from new entry }
Fields in taxonomy_term_data table:
Field Value Comment tid generated does conversion program generate this or drupal? vid generated does conversion program generate this or drupal? name keyword default? description NULL default? weight 0 default? format NULL default?
Fields in field_data_taxonomy_vocabulary_6 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_6_tid tid (ex. 838)
Audience
Query to find taxonomy term: foreach( cvs_array['audiences'] as audience{ SELECT tid FROM taxonomy_term_data WHERE vid=7 && name=audience }
Fields in field_data_taxonomy_vocabulary_7 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_7_tid result->tid (ex. 108)
Education Level
Query to find taxonomy term: foreach( cvs_array['edlevels'] as edlevel{ SELECT tid FROM taxonomy_term_data WHERE vid=14 && name=edlevel }
Fields in field_data_taxonomy_vocabulary_14 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_14_tid result->tid (ex. 696)
NSDL Type
Query to find taxonomy term: foreach( cvs_array['nsdltypes'] as nsdltype{ SELECT tid FROM taxonomy_term_data WHERE vid=15 && name=nsdltype }
Fields in field_data_taxonomy_vocabulary_15 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_15_tid result->tid (ex. 776)
Access Rights
Query to find taxonomy term: foreach( cvs_array['accesses'] as access{ SELECT tid FROM taxonomy_term_data WHERE vid=10 && name=access }
Fields in field_data_taxonomy_vocabulary_10 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_10_tid result->tid (ex. 247)
Access Rights URL
Query to find taxonomy term: SELECT tid FROM taxonomy_term_data WHERE vid=16 && name=cvs_array['accessurl']
Fields in field_data_taxonomy_vocabulary_16 table:
Field Value Comment entity_type "node" bundle "ct_iart" 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. Body doesn't repeat. taxonomy_vocabulary_16_tid result->tid (ex. 835)