Library day in the life - 5 - Day 3

Day three started off with a Go Train that decided to arrive 20 minutes late. Three cheers for mass transit. The delay was a good thing, it gave me 20 extra minutes and I was able to finish Calvino's, "Six Memos for the Next Millennium."

Morning

Morning soundtrack: BBC World Service podcast, Search Engine - Trolling 101, Funkstörung - Appendix

In the trenches of morning emails. ILL requests for theses to be made open access, therefore said theses are made open access. Hooray open access! In the background queued up a few merges. Wait. Wait. Wait. Called Bepress support to work through some workflow issues with electronic submissions of theses and dissertations with graduate studies. Very, Very close to moving toward complete electronic submission of theses and dissertations!!! Lunch in my office, at my desk, as per usual.

Afternoon

Afternoon soundtrack: Funkstörung - Appetite For Discstruction, Plaid - Spokes, Quinoline Yellow - Cyriack Parasol, Telefon Tel Aviv - Map of What is Effortless

More hacking at the Dublin Core html headers. Error. No output. OMG, Output! Not the right output. *FACEPALM* $creators != $creator. Pay attention to your variable names and sometimes you have to explicitly iterate through your arrays kids! (Thanks Matt!) Sloppy code below. Checked server logs, ran server updates, and downloaded and installed drupal module updates on the dev server to round out the afternoon. Chaos Tools had quite a bit of new svn adds. No commits since the svn repository disappeared for a bit with an office move :( ADVERTISEMENT: Check out my significant other's blog if you are interested in what library day in the life is for a public children's librarian.

<php>
global $base_url;

// The path of the node

$node_path=$node->nid;
if($node->path) $node_path=$node->path;

// HEADER PROLOG

$dc[] = '<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />';
$dc[] = '<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />';

//DC TERM - Creator
foreach(element_children($node->field_creator) as $key) {
  $creators[]= $node->field_creator[$key]['value'];
  foreach($creators as $creator) {
    $dc[] = '<meta name="DC.creator" content="' . strip_tags($creator) . '" />';
  }
}

//DC TERM - subject
foreach(element_children($node->field_subject) as $key) {
  $subjects[]= $node->field_subject[$key]['value'];
  foreach($subjects as $subject) {
    $dc[] = '<meta name="DC.subject" content="' . strip_tags($subject) . '" />';
  }
}

//DC TERM - description
foreach(element_children($node->field_description) as $key) {
  $descriptions[]= $node->field_description[$key]['value'];
  foreach($descriptions as $description) {
    $dc[] = '<meta name="DC.description" content="' . strip_tags($description) . '" />';
  }
}

//DC TERM - publisher
foreach(element_children($node->field_publisher) as $key) {
  $publishers[]= $node->field_publisher[$key]['value'];
  foreach($publishers as $publisher) {
    $dc[] = '<meta name="DC.publisher" content="' . strip_tags($publisher) . '" />';
  }
}

//DC TERM - contributor
foreach(element_children($node->field_contributor) as $key) {
  $contributors[]= $node->field_contributor[$key]['value'];
  foreach($contributors as $contributor) {
    $dc[] = '<meta name="DC.contributor" content="' . strip_tags($contributor) . '" />';
  }
}

//DC TERM - Date
foreach(element_children($node->field_date) as $key) {
  $dates[]= $node->field_date[$key]['value'];
  foreach($dates as $date) {
    $dc[] = '<meta name="DC.date" content="' . strip_tags($date) . '" />';
  }
}

//DC TERM - Date 
foreach(element_children($node->field_date2) as $key) {
  $date2s[]= $node->field_date2[$key]['value'];
  foreach($date2s as $date2) {
    $dc[] = '<meta name="DC.date2" content="' . strip_tags($date2) . '" />';
  }
}

//DC TERM - type
foreach(element_children($node->field_type) as $key) {
  $types[]= $node->field_type[$key]['value'];
  foreach($types as $type) {
    $dc[] = '<meta name="DC.type" content="' . strip_tags($type) . '" />';
  }
}

//DC TERM - format
foreach(element_children($node->field_format) as $key) {
  $formats[]= $node->field_format[$key]['value'];
  foreach($formats as $format) {
    $dc[] = '<meta name="DC.format" content="' . strip_tags($format) . '" />';
  }
}

//DC TERM - Identifier
foreach(element_children($node->field_identifier) as $key) {
  $identifiers[]= $node->field_identifier[$key]['value'];
  foreach($identifiers as $identifier) {
    $dc[] = '<meta name="DC.identifier" content="' . $identifier . '" />';
  }
}

//DC TERM - Language
foreach(element_children($node->field_language) as $key) {
  $languages[]= $node->field_language[$key]['value'];
  foreach($languages as $language) {
    $dc[] = '<meta name="DC.language" content="' . $language . '" />';
  }
}

//DC TERM - Relation
foreach(element_children($node->field_relation) as $key) {
  $relations[]= $node->field_relation[$key]['value'];
  foreach($relations as $relation) {
    $dc[] = '<meta name="DC.relation" content="' . strip_tags($relation) . '" />';
  }
}

//DC TERM - Source
foreach(element_children($node->field_source) as $key) {
  $sources[]= $node->field_source[$key]['value'];
  foreach($sources as $source) {
    $dc[] = '<meta name="DC.source" content="' . $source . '" />';
  }
}

//DC TERM - Coverage
foreach(element_children($node->field_coverage) as $key) {
  $coverages[]= $node->field_coverage[$key]['value'];
  foreach($coverages as $coverage) {
    $dc[] = '<meta name="DC.coverage" content="' . strip_tags($coverage) . '" />';
  }
}

//DC TERM - Rights
foreach(element_children($node->field_right) as $key) {
  $rights[]= $node->field_right[$key]['value'];
  foreach($rights as $right) {
    $dc[] = '<meta name="DC.right" content="' . strip_tags($right) . '" />';
  }
}

$created = strftime("%Y-%m-%d %H:%M:%S +01:00", $node->created);
$changed = strftime("%Y-%m-%d %H:%M:%S +01:00", $node->changed);
$dc_created = strftime("%Y-%m-%d", $node->created);
$dc_changed = strftime("%Y-%m-%d", $node->changed);

if($created) {
  $dc[] = '<meta name="DC.date.created" scheme="DCTERMS.W3CDTF" content="' . $dc_created . '" />';
  $meta[] = '<meta name="date" scheme="ISO8601" content="' . $created . '" />';
}
if($changed) {
  $dc[] = '<meta name="DC.Date.X-MetadataLastModified" scheme="DCTERMS.W3CDTF" content="'. $dc_changed.'" />';
  $dc[] = '<meta name="DC.date.modified" scheme="DCTERMS.W3CDTF" content="' . $dc_changed . '" />';
  $meta[] = '<meta name="modified" scheme="ISO8601" content="'. $changed.'" />';
}

$node_field[0]['value'] = implode("\n", $meta) . "\n" .  implode("\n", $dc) . "\n";
</php>

Related

comments powered by Disqus