The renovation of Machsom Watch
One of our favorite client that we are very proud of, and we accompanied from our early days, is www.MachsomWatch.org.
Lately we upgraded it from drupal 5.x to drupal 6.x and dressed it with a new beautiful design by Inbal Mizrach. As long with the design, an extreme UI process was made, what made us actually build, almost the entire site from scratch, over the existing content. One of the interesting challenge was to combine the checkpoints content with the daily reports from checkpoints.
*A checkpoint* - is a description of the checkpoint with map, flickr images and videos from the checkpoint.
*A daily report from the checkpoints* - is a daily report from one, two, three or more checkpoints, which tagged with those checkpoints tag.
The goal was to eliminate the checkpoint page, and under it to display the latest report from that checkpoint, and to make the checkpoint as a context for paging through daily reports from that checkpoint.
One more thing is to display the description, map, flickr images and embed video from the checkpoint context.
Keeping the original paths of the daily reports was a must, according to the amount and their google rank.
We created the check points navigation by going over the checkpoint terms
and links them to the latest report from that checkpoint,
while adding the tid (checkpoint) as a query to the path.
Well, it looks something like that:
<?php ...
//Get all terms from checkpoint vocabulary.
$terms = taxonomy_get_tree($vid);
//Get the nid for each checkpoint latest report.
foreach ($terms as $term) {
$nid = db_result(db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {term_node} t ON n.vid = t.vid WHERE n.type = “%s” AND t.tid = “%s” AND n.status <> 0 ORDER BY n.created DESC LIMIT 1 ', 'content_daily_report', $term->tid));
//Build the links with the name the term, href of from the latest report that we found
//and passing the link checkpoint as url query.
if ($nid) {
$items[] = l($term->name, "node/" . $nid, array('query' => 'checkpoint=' . $term->tid));
}
};
return theme('item-list', $items);
...
?>
Now when we'll chose a checkpoint to observe it, we'll actually go to his latest daily report with the checkpoint as a context (argument in the URL). We also can use this context to grab the resources (description, map, flickr images and embed video) from the checkpoint to display in the report page.
We are using this checkpoint context to browse through reports from the same context (checkpoint) by a jump menu or by their created day sorting pager.
A pager can look something like this:
<?php …
//Get the current object created date.
$node = menu_get_object();
$node_created = $node->created;
$node_type = $node->type;
//Get the checkpoint tid from the url query.
$current_tid = $_GET['checkpoint'];
//Return the prev result for the same checkpoint.
$prev_res = db_result(db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {term_node} t ON n.vid = t.vid WHERE n.type = “%s” AND t.tid = “%s” AND n.status 0 AND n.created 0 AND n.created > %d ORDER BY n.created ASC LIMIT 1 ', $node_type, $current_tid, $node_created));
$urlquery = $node_type == 'content_daily_report' ? 'checkpoint=' . $_GET['checkpoint'] : NULL;
if ($nid = $prev_res) {
//Build the links with the name of the link, href from the prev report that we found
//and passing the link checkpoint as url query.
$items[] = l(t('prev'), "node/" . $nid, array('query' => $urlquery));
}
else {
$items[] = t('prev');
}
if ($nid =$next_res) {
//Build the links with the name of the link, href from the next report that we found
//and passing the link checkpoint as url query.
$items[] = l(t('next'), "node/" . $nid, array('query' => $urlquery));
}
else {
$items[] = t('next');
}
return theme(checkpoint_daily_report_pager', $items);
...
?>
As long as we keep getting the checkpoint query from the URL, and passing it to the next one, we are keeping the context alive.
AttachmentSize machsomwatch-org-1.png214.32 KB machsomwatch-org-2.png163.57 KB machsomwatch-org-3.png96.64 KB