What is the status ?
Any chance for a D6 version?

(by the way, are users contributions identified by their Drupal account, or by a free text like in stand-alone EtherPad?)

Thanks

Comments

deviantintegral’s picture

There's a chance, but I don't have a use for it myself. I'd be glad to review any work to backport it to D6. If you've got time to dedicate to it, let me know and I can connect you with our contact at Hackpad to enable API access until they make it public.

As of yesterday, users are identified by their username. It probably needs to be updated with a theme('username') call, and then stripping out HTML, so real names can be used on sites that use them.

bburg’s picture

I am interested in working on a D6 backport for a project. I will ping you separately devientintegral for that contact.

bburg’s picture

StatusFileSize
new24.35 KB

Here is my initial effort for a D6 backport. Still a few issues to address most likely. But I was able to get this running on a local D6 install.

bburg’s picture

StatusFileSize
new25.22 KB

Let's try a version where the admin settings form isn't orphaned.

jvieille’s picture

Thanks a lot, I would be ahppy to test this.
Would it be possible to attach a patched module?

Thanks

bburg’s picture

StatusFileSize
new11.7 KB

Archived attached. I'll ping deviantintegral in a bit to add this as a proper module.

Also, fyi, looks like the D7 version needs a patch. Will try to get to this later.

deviantintegral’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

I did a quick read of the diff between the attachment and 7.x-1.x, and while I'm sure there are followups, it's far enough along I figured it was worth it to open a branch and at least have a proper version tag for the issue queue. I'll do a proper review and post comments soon.

deviantintegral’s picture

StatusFileSize
new25.22 KB

This has already been committed; just posting again so I can review it with dreditor.

deviantintegral’s picture

Status: Active » Needs work

So here's a high level pass of the code. If we get these things fixed, I think we can close this issue and open up new ones for specific changes as you get them in place. I've avoided all code style issues, but I figure we can deal with those one the module is in a closer-to-working state.

Be sure to file any followup patches against the new branch now that it's been created.

+++ b/hackpad.info
@@ -1,6 +1,6 @@
+description = Hackpad integration for Drupal. A backport of the D7 version. This is in a pre-alpha state. Not intended for producton use.

Let's remove this disclaimer, and put it on the module home page instead.

+++ b/hackpad.info
@@ -1,6 +1,6 @@
+core = 6.x

We're missing a dependency on CCK (content.module).

+++ b/hackpad.install
@@ -34,6 +34,13 @@ function hackpad_field_schema($field) {
+  //Nothing to do

This doesn't match the docblock. But if we don't need it, let's just remove it entirely?

+++ b/hackpad.js
@@ -3,19 +3,18 @@
+  //attach: function(context) {

Lets remove all commented code that isn't needed anymore from D7.

+++ b/hackpad.js
@@ -3,19 +3,18 @@
+console.log(settings);

We should remove all console.log() calls as some browsers will throw errors if it's not defined.

+++ b/hackpad.module
@@ -50,51 +50,51 @@ function hackpad_menu() {
-  return variable_get('hackpad_enabled') && user_access($permission, $account);

Good catch. Submit a patch for the 7.x branch?

+++ b/hackpad.module
@@ -50,51 +50,51 @@ function hackpad_menu() {
+ * The documentation doesn't reference the #attached property, but this goes for the d7 version as well. ¶

#attached was added for D7, and doesn't work in D6. We might just have to be broader and include hackpad.js on every page.

+++ b/hackpad.module
@@ -50,51 +50,51 @@ function hackpad_menu() {
- * Implements hook_theme().

We should pull the hook_theme() implementation below up here so at least we start with it in the same place as the 7.x branch.

+++ b/hackpad.module
@@ -265,42 +423,60 @@ function hackpad_element_process($element, &$form_state, $complete_form) {
+      if(!class_exists('HackpadPad')){

Let's use Autoload here to keep some consistency with D7.

https://drupal.org/project/autoload

+++ b/hackpad.module
@@ -265,42 +423,60 @@ function hackpad_element_process($element, &$form_state, $complete_form) {
+          $pad = new HackpadPad($form_state['input']['hackpad_pad_id_' . $delta]); dpm('hackpad_widget multiple');

Remove dpm()'s from the code so it doesn't break for site installs that don't have devel enabled yet.

+++ b/hackpad.module
@@ -265,42 +423,60 @@ function hackpad_element_process($element, &$form_state, $complete_form) {
+        drupal_set_message('Could not connect to Hackpad service. Please verify your credentials in <a href="admin/config/services/hackpad">The settings form</a> and try again.','error');

I think this URL needs to be changed. As well, this text needs to be a t() call.

+++ b/includes/hackpad.admin.inc
@@ -18,14 +21,6 @@ function hackpad_settings_form($form, $form_state) {
-    ),

Agreed on removing these. It's just something nice for the admin UI, and it's not worth writing the custom code for a rarely used form.

+++ b/includes/hackpad.api.inc
@@ -14,12 +14,14 @@ class HackpadApi {
-    $api = &drupal_static('HACKPAD_API');

Let's depend on ctools and use ctools_static() which is identical to drupal_static in D7.

bburg’s picture

Thanks a bunch for the feedback deviantintegral! I'll get to work on these this week.

jvieille’s picture

As soon as a first dev module is issued, I'll glad to test it.
Thanks

bburg’s picture

StatusFileSize
new9.96 KB

6.x-1.x Patch based on devientintegral's feedback. I a couple of issues to note:

-Since only the subdomain owner has permission to create pads in that subdomain, we will need to capture that user's email address, which is registered with the hackpad service in the global settings form so pads can be created on their behalf. Otherwise we get a HackpadRequestException thrown, which is not caught at the moment.

-Users keep being created in the hackpad service as "Anonymous" --For my own purposes, I created a separate patch that integrates with the realname module. There I called token_replace directly, but it may be nice to run usernames through theme_username(), to allow any rewriting. We will just need to filter out the html markup.

**Edit: I like to always include an install hook, even when there is no installation activity. This allows a module to be automatically installed in profiles.

jvieille’s picture

Can you submit the patched module?
Thanks

jvieille’s picture

I am testing this, using the moduel available in "view all releases" + path#12.

It does not work. When I do "test embedding" or create a node with a hackpad field, I get a blank screen with the text:

Error
The website encountered an unexpected error. Please try again later.

In the logs:
HackpadRequestException: Unauthorized in HackpadApi->request() (line 70 of /home/xxx/public_html/sites/all/modules/hackpad/includes/hackpad.api.inc).

If I disable the line 70 in hackpad.api.inc :

   if ($response->code != 200) {
//        throw new HackpadRequestException($response->error, $response->code);

the crash does not occur and I get the message "Domain id does not match request."

If I trace $response=>request with dpm():

POST /api/1.0/pad/create?asUser=webmaster%40see.asso.fr&oauth_consumer_key=HI2E1SN5rkg&oauth_nonce=4739d944c638c8924feef54bb10f222c&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1384812958&oauth_version=1.0&oauth_signature=JJCwSb9bJGP%2FSnj6ehek%2BcOtB0g%3D HTTP/1.0
Host: see.hackpad.com
User-Agent: Drupal (+http://drupal.org/)
Content-Length: 0
content-type: 

Thanks for help

jvieille’s picture

I finally made it working:

1) changed this

    if ($response->code != 200) {
-         throw new HackpadRequestException($response->error, $response->code);
+        drupal_set_message(t($response->error . " - " . $response->code),'error');
    }

2) The API key for the domain I set keeps changing : I just stay tuned to the current API key
Why is that???

3) only registered users can create pads
That is odd. I posted a separate issue for that

jvieille’s picture

Category: Support request » Task
Issue summary: View changes
StatusFileSize
new22.47 KB

Actually, the D6 port is quite far from the D7 version.
I added all the missing stuff I found and got it working.
Should I hold waiting for an update, or continue to maintin the code on my side?
My working module is attached