This is a very handy lightweight module and I was delighted to finally get it working (had neglected to enable filter).

It works as advertised, but I'd like to add a View fotonotes tab at node/% so that anyone viewing the original image node can immediately view the fotonotes that go with it. As is, the fotonotes have to be inserted in a node before anyone but the original editor can view them.

I've gone ahead and created the tab, but there are two problems.

First, not really knowing what I'm doing, I've just copied and pasted the function edit_fotonotes($node) code under a new function view_fotonotes($node). Combined with the permissions under the new $items['node/%node/viewfotonotes'] = array, this gives all users editing priviliges for any set of fotonotes.

Second, the path node/%node/viewfotonotes puts the tab in every node.

So . . .

1. How do I get fotonotes to display under the tab without the editing controls?
2. How do I get the tab to hide from nodes generated by other modules?

Here's the code for the tab, in case anyone's interested.

$items['node/%node/viewfotonotes'] = array(
'title' => 'View fotonotes',
'page callback' => 'view_fotonotes',
'page arguments' => array(1),
'access callback' => 'user_access',
'access arguments' => array('access fotonotes'),
'type' => MENU_LOCAL_TASK,
'weight' => '11',
);
CommentFileSizeAuthor
#3 viewfotonotestab.jpg186.16 KBmarkpenny

Comments

markpenny’s picture

Here's the code I'm using for function view_fotonotes($node)

function view_fotonotes($node) {
$nid = $node->nid;
$_SESSION['nid'] = $nid;

drupal_add_js(drupal_get_path('module', 'fotonotes') .'/fotonotes/fnclientlib/js/fnclient.js');
drupal_add_css(drupal_get_path('module', 'fotonotes') .'/fotonotes/fnclientlib/styles/fnclient.css');
$js = 'var fnServer = "'. base_path() .'fotonote/'. $nid .'";';
drupal_add_js($js, 'inline');
$output = theme('image', $node->images['preview'], $node->title, $node->title, array('class' => 'fn-image', 'id' => 'inote'. $node->nid));
return $output;
}
markpenny’s picture

Title: View fotonotes tab node/% » View fotonotes tab at node/%

By the way, the file I've been editing is fotonotes.module in the module root.

If you're a fellow novice and you decide to give the tab a try, remember to run update.php before checking whether it works, otherwise the necessary changes to menu_router in the database will not occur and there'll be nothing new to see on site.

markpenny’s picture

StatusFileSize
new186.16 KB

And here's what it looks like.

markpenny’s picture

Here's the code you need to get the effect I was after. Other users can view your notes under the tab, but there are no editing controls.

function view_fotonotes($node) {
$nid = $node->nid;
$_SESSION['nid'] = $nid;

drupal_add_js(drupal_get_path('module', 'fotonotes') .'/fotonotes/fnclientlib/js/fnclient.js');
drupal_add_css(drupal_get_path('module', 'fotonotes') .'/fotonotes/fnclientlib/styles/fnuser.css');
$js = 'var fnServer = "'. base_path() .'fotonote/";';
drupal_add_js($js, 'inline'); 
$output = theme('image', $node->images['preview'], $node->title, $node->title, array('class' => 'fn-image', 'id' => 'inote'. $node->nid));
return $output;
}
markpenny’s picture

Sorry. I had the wrong access arguments for menu_router. Here's the correct code.

$items['node/%node/viewfotonotes'] = array(
'title' => 'View fotonotes',
'page callback' => 'view_fotonotes',
'page arguments' => array(1),
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK,
'weight' => '11',
);
markpenny’s picture

Title: View fotonotes tab at node/% » Obsolete fotonotes image module tab thread
Status: Active » Closed (fixed)

Closing this and opening a new issue with resolution.