« October 2008 | Main | December 2008 »

November 26, 2008

Creating a new drupal field

Create field through the UI

Use the menu to navigate to:
Administer -> Content management -> Content types -> manage fields

Also permission must be granted for users to write to the field. Go to:
Administer -> User management -> Permissions

Modify the code

A) To make a field display edit in the drupal UI

Modify the file:
sites/all/themes/blackdog/node-ustore.tpl.php
Code extract from node-ustore.tpl.php
<?php if ( !$teaser ) { print ( $field_coll_code_rendered ); print ( $field_series_rendered ); } print ( $field_title_rendered ); print ( $field_creator_rendered ); if ( !$teaser ) { print ( $field_subject_rendered ); print ( $field_accessrights_rendered ); } ?>

B) Add the element to Fedora dublin core

Modify the file:
sites/all/modules/ustore/ustore.inc (the function function _dc_content)
Code extract from ustore.inc
// append metadata, beginning with title; fedora takes care of identifier if ( $node->field_title ) { foreach ( $node->field_title as $title ) { $dc_title = $fedora_doc->createElement ('dc:title' ); $dc_title = $oai_dc->appendChild ( $dc_title ); $value = $fedora_doc->createTextNode ( $title['value'] ); $value = $dc_title->appendChild ( $value ); }
I created a function that executes the code above.
// do the cck fields _insert_dc_element($fedora_doc, $oai_dc, $node->field_creator, 'dc:creator' ); _insert_dc_element($fedora_doc, $oai_dc, $node->field_subject, 'dc:subject' ); _insert_dc_element($fedora_doc, $oai_dc, $node->field_rights, 'dc:rights' );

Eliminating the host table from awstats

Within the directory that contains the config files enter the command: perl -i -pe 's/ShowHostsStats=PHBL/ShowHostsStats=0/g' *.conf
Location of on walter desktop:
/opt/awstats-6.8/wwwroot/cgi-bin/awstats.ageconsearch.umn.edu.conf