/[drupal]/contributions/modules/cocomment/cocomment.module
ViewVC logotype

Contents of /contributions/modules/cocomment/cocomment.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download) (as text)
Sat Jul 19 22:02:02 2008 UTC (16 months, 1 week ago) by sanduhrs
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +10 -11 lines
File MIME type: text/x-php
Port to D6
1 <?php
2 // $Id: cocomment.module,v 1.8 2008/01/17 11:26:20 sanduhrs Exp $
3
4 /**
5 * CoComment integration
6 * http://www.cocomment.com
7 *
8 * @author
9 * Developed by Olaf Schettler
10 * Update to Drupal-5/6 by
11 * Stefan Auditor <stefan.auditor@erdfisch.de>
12 */
13
14 /**
15 * Implementation of hook_menu().
16 */
17 function cocomment_menu() {
18 //This is a workaround to reset $op to it's original value
19 //that has been changed by cocomment's enabler.js and prevents
20 //the comment submission
21 if ($_POST['form_id'] == 'comment_form') {
22 if ($_POST['op'] != t('Preview comment') AND $_POST['op'] != t('Post comment')) {
23 $_POST['op'] = t('Post comment');
24 }
25 }
26 }
27
28 /**
29 * Implementation of hook_comment().
30 */
31 function cocomment_comment($form, $op) {
32 global $base_url, $user;
33
34 if ($op == 'form' && $form['submit']) {
35 //load necessary information
36 $node = node_load($form['nid']['#value']);
37
38 //prepare data for cocomment
39 $coco = array(
40 'tool' => 'Drupal (+http://drupal.org/)',
41 'siteurl' => $base_url,
42 'sitetitle' => variable_get('site_name', $_SERVER['HTTP_HOST']),
43 'pageurl' => url('node/'. $node->nid, NULL, NULL, TRUE),
44 'pagetitle' => $node->title,
45 'textareaID' => 'comment',
46 'buttonID' => 'edit-submit',
47 'author' => $user->name ? $user->name : '',
48 'authorID' => 'name',
49 'formID' => 'comment-form',
50 );
51 //add data to site header
52 drupal_add_js('coco = '. drupal_to_js($coco), 'inline');
53
54 //add cocomment's enabler.js to the site
55 $item['cocomment'] = array(
56 '#value' => '<script type="text/javascript" id="cocomment-fetchlet" src="http://www.cocomment.com/js/enabler.js"></script>',
57 );
58
59 return $item;
60 }
61 }

  ViewVC Help
Powered by ViewVC 1.1.2