calebtr's blog

changing elements with jQuery when Drupal dynamically assigns ids

I find myself really enjoying jQuery these days because it provides an easy cross-platform shorthand for things that I like to do to make the user experience better.

Our form to answer reference questions is a regular Drupal node form, but I want to change the 'Submit' button to be more descriptive, depending if the librarian is answering a question, requesting clarification, saving a draft, or whatever.

Our form looks something like this, just imagine a submit button at the bottom labeled 'Send answer'.

tuning drupal's search index with hook_nodeapi and $node->build_mode

I've been working on getting our search index to exclude certain fields from custom content types so that hidden information isn't available by searching for it.

Modules can affect what content a node displays through their hook_nodeapi function by modifying the $node object's 'content' parameter.

For example, to add a simple phrase near the bottom of every node when it is viewed:


function my_module_nodeapi(&$node,$op) {
if ($op =='view') {
$node->content['extra_info'] = array(
'#value' => 'The moon is made of cheese.',
'#weight' => 100,
);
}

restoring a single node from backup

Now and then I have to restore a MySQL drupal table from backup, and I've been using the instructions at Mike's *NIX notes to do it. It works great.

Except when the table in question is {node_revisions}, which contains the default body field for most Drupal content, and your site has changed enough that you really just want to restore one entry, not the entire site.

faking faceted search with views and views fastsearch

I was responding to a post on Drupal4Lib about modifying Drupal search results to show facets for content types and was writing just how easy I thought it would be, when I decided that if it was really easy I could have some fun trying to make it work.

Instead of using the Search module, I used the Views module with the addition of Views FastSearch. I'm on Drupal 5, so this might not work with the new version of Views, but you'll get the idea.

subject guides on the fly

I wanted to write up some of what we've got in the works just in case anyone has filled some of the missing pieces yet :)

Our virtual reference service records transcripts. The transcripts go in custom nodes. A custom index extracts URLs and another custom table extracts phrases from the patron's question. Phrases are groups of two or three words that don't contain a stopword and aren't broken by punctuation.

The slow, slow prototype, http://www.oregonlibraries.net/guides, shows popular phrases in questions in the past week. Clicking on a phrase (or searching for another) shows websites shared in transcripts where the question contained that phrase, sorted by how many times it happened.

Syndicate content