? jskitcomments.epb.inc
Index: jskitcomments.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/jskitcomments/jskitcomments.admin.inc,v
retrieving revision 1.5
diff -u -p -r1.5 jskitcomments.admin.inc
--- jskitcomments.admin.inc	11 Aug 2009 07:39:20 -0000	1.5
+++ jskitcomments.admin.inc	5 Jan 2010 15:16:57 -0000
@@ -134,7 +134,61 @@ function jskitcomments_admin_settings() 
     '#title' => t('Avatars'),
     '#description' => t('Use this checkbox to turn avatars on/off'),
     '#default_value' => variable_get('jskitcomments_avatars', 0),
-  );  
+  );
+  
+  $form['custom']['epb'] = array(
+	'#type' => 'fieldset',
+	'#title' => t('External Profile Binding (EPB)'),
+	'#collapsible' => TRUE,
+	'#collapsed' => TRUE,
+  );
+  $form['custom']['epb']['jskitcomments_epb_on'] = array(
+	'#type' => 'checkbox',
+	'#title' => t('Use External Profile Binding (EPB)'),
+	'#description' => t('See the JS-Kit Echo Wiki for more information: ') . l('http://wiki.js-kit.com/External-Profile-Binding','http://wiki.js-kit.com/External-Profile-Binding'),
+	'#default_value' => variable_get('jskitcomments_epb_on',0),
+  );
+  
+  $form['custom']['epb']['jskitcomments_epb_secret'] = array(
+	'#type' => 'textfield',
+	'#title' => t('Secret Key'),
+	'#description' => t('In order to set up EPB for a site, the publisher and
+						JS-Kit need to agree on a secret key (used by JS-Kit to
+						ensure EPB-related data was not altered by a third
+						party) and the format of the host system user id.'),
+	'#default_value' => variable_get('jskitcomments_epb_secret',''),
+  );
+  
+  $form['custom']['epb']['jskitcomments_epb_id_format'] = array(
+	'#type' => 'textfield',
+	'#title' => t('<p>User ID Format (@id will be replaced with unique user identifier - from Drupal or, if defined below, third party cookie.)'),
+	'#description' => t('The user id is a key which identifies the host system\'s user within JS-Kit system. The id has a form of a URL (as per RFC3986) with the following additional constraints:</p>
+	<ul>
+    <li>The only allowed schema is "http".</li>
+    <li>No upper case letters allowed.</li>
+    <li>The URL should end with "/".</li>
+	</ul>
+	
+<p>JS-Kit places user ids of different publishers into the same namespace, so to avoid collisions the user ids are normally derived from the publisher\'s domain name. Here are the examples of valid user ids:</p>
 
+    <ul><li>http://joe.smith.domain.com/</li>
+    <li>http://domain.com/user/joe.smith/</li>
+  </ul>
+<p>JS-Kit needs to know which part of the user id is constant and which may vary
+for different users (the latter is joe.smith in the above examples).</p>'),
+	'#default_value' => variable_get('jskitcomments_epb_id_format',$base_url . '/@id/'),
+  );
+
+  $form['custom']['epb']['jskitcomments_epb_url'] = array(
+	'#type' => 'textfield',
+	'#title' => t('Non-drupal authentication EPB path (advanced and not common)'),
+	'#description' => t('Use this option if you would like to define a custom
+						php function (a menu hook) to define the values of the user
+						profile id and information. Enter the path below. The path
+						should be defined by a menu hook in your own custom module
+						that sets various properties and returns an EPB jason object.
+						See the jskitcomments.epb.inc file for an example.'),
+	'#default_value' => variable_get('jskitcomments_epb_url','/jskitcomments/epb'),
+  );
   return system_settings_form($form);
 }
Index: jskitcomments.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/jskitcomments/jskitcomments.js,v
retrieving revision 1.3
diff -u -p -r1.3 jskitcomments.js
--- jskitcomments.js	25 Jul 2009 16:03:52 -0000	1.3
+++ jskitcomments.js	5 Jan 2010 15:16:57 -0000
@@ -27,16 +27,37 @@ Drupal.behaviors.jskitcomments = functio
         cache: true
       }
       if (value == 'comments' && Drupal.settings.jskitcommentscss) {
-        ajaxOptions.success = function(data, status) { 
+        ajaxOptions.success = function(data, status) {
             JSKitAPI.subscribe('comments-data-loaded', function() {
               $('head').append('<link rel="stylesheet" type="text/css" href="' + Drupal.settings.jskitcommentscss + '"/>');
           });
         }
-      }
-      jQuery.ajax(ajaxOptions);
+      } else {
+		ajaxOptions.success = function(data, status){
+		}
+	  }
+	  
+	  var epburl = typeof(Drupal.settings.jskitcommentsEPBurl) !== 'undefined' ? Drupal.settings.jskitcommentsEPBurl.toString() : '';
+	  
+	  if(value == 'comments' && epburl != ''){
+		//get EPB and then load comments
+		var epbAjaxOptions = {
+		  type: 'GET',
+		  url: epburl,
+		  dataType: 'json',
+		  cache: true,
+		  success: function(data, status){
+			window.JSK$EPB = data;
+			jQuery.ajax(ajaxOptions);
+		  }
+		}
+		jQuery.ajax(epbAjaxOptions);
+	  } else {
+		jQuery.ajax(ajaxOptions);
+	  }
     });
 
-	// Make sure it doesn't process the elements twice.
+ 	// Make sure it doesn't process the elements twice.
     Drupal.settings.jskitcomments = false;
   }
 };
Index: jskitcomments.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/jskitcomments/jskitcomments.module,v
retrieving revision 1.10
diff -u -p -r1.10 jskitcomments.module
--- jskitcomments.module	17 Sep 2009 20:32:27 -0000	1.10
+++ jskitcomments.module	5 Jan 2010 15:16:57 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: jskitcomments.module,v 1.10 2009/09/17 20:32:27 rehos Exp $
+// $Id: jskitcomments.module,v 1.9 2009/08/11 07:42:27 rehos Exp $
 
 /**
  * Enable views API version 2
@@ -49,6 +49,14 @@ function jskitcomments_menu() {
     'page arguments' => array('jskitcomments_admin_settings'),
     'file' => 'jskitcomments.admin.inc'
   );
+  $items['jskitcomments/epb'] = array(
+    'title' => 'epb',
+    'page callback' => 'jskitcomments_generate_epb',
+    'access arguments' => array('access content'),
+    'file' => 'jskitcomments.epb.inc',
+    'type' => MENU_CALLBACK,
+  );
+
   return $items;
 }
 
@@ -303,6 +311,16 @@ function jskitcomments_add($type = NULL)
   }
   // Process the type of JavaScript from JS-Kit to load.
   if (isset($type) && !isset($added[$type])) {
+    
+    //Allow External Profile Binding
+    $epb = variable_get('jskitcomments_epb_on',0);
+    if($epb){
+      $epburl = variable_get('jskitcomments_epb_url','/jskitcommnts/epb');
+    } else {
+      $epburl = '';
+    }
+    drupal_add_js(array('jskitcommentsEPBurl' => array($epburl)), 'setting');
+        
     drupal_add_js(array('jskitcomments' => array($type)), 'setting');
     // Allow themes to add their own CSS to change the styling of the comments.
     if ($type == 'comments') {
