New view fotonotes tab at node/node%
| Project: | Fotonotes |
| Version: | 6.x-1.1-beta1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | markpenny |
| Status: | closed |
Jump to:
This patch to fotonotes.module allows all users with 'view original images' permissions to view but not edit fotonotes right in the image node.
Step 1. Copy (without the "
<?php
" and "
?><?php
$items['node/%node/fotonotes'] = array(
'title' => 'Fotonotes',
'page callback' => 'view_fotonotes',
'page arguments' => array(1),
'access callback' => 'user_access',
'access arguments' => array('view original images'),
'type' => MENU_LOCAL_TASK,
'weight' => '11',
);
?>Step 2. Copy (as above) this code and paste into fotonotes.module at about line 57 (between the end of the code block for function edit_fotonotes and the beginning of the code block for function fotonotes_check_access).
<?php
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;
}
?>Step 3. Run example.com/update.php. (Replace example.com with the address of your website.)
Step 4. Enjoy.
Note: This patch puts the Fotonotes tab in all nodes generated by all modules. I am still working on confining it to image module nodes. When clicked in non-image module nodes, it returns a blank page.
The attached pngs show what the result looks like to node owners, admins and authenticated users.
fotonotesowneroradminview.png
fotonotestabauthenticateduserview.png

#1
Sorry. Thought I was editing with the backbutton. Turned out I was just submitting another version.