New view fotonotes tab at node/node%

markpenny - May 31, 2008 - 16:43
Project:Fotonotes
Version:6.x-1.1-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:markpenny
Status:closed
Description

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

<?php
and
?>
this code and paste into fotonotes.module at line 33 or so (just after the end of the $items['fotonote'] array and just before return $items;).

<?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.

Not

AttachmentSize
fotonotesowneroradminview.png775.75 KB
fotonotestabauthenticateduserview.png658.55 KB

#1

markpenny - May 31, 2008 - 17:21
Status:active» closed

Sorry. Thought I was editing with the backbutton. Turned out I was generating another version.

 
 

Drupal is a registered trademark of Dries Buytaert.