This patch inserts a link to the existing node rather than a checkbox which makes the import process somewhat more user friendly.

$ diff amazon.module.orig amazon.module
1044,1049c1044,1062
<   $output['add'] = array(
<     '#type' => 'checkbox',
<     '#default_value' => 0,
<     '#prefix' => '<td>',
<     '#suffix' => '</td>'
<   );
---
>   $exists_query = db_query('SELECT n.nid FROM {node} n JOIN {amazonnode} a ON n.nid = a.nid '
>     ."WHERE n.type = 'amazon_node' AND a.asin = '$node->asin'");
>   $exists = db_num_rows($exists_query);
>   if (!$exists) {
>     $output['add'] = array(
>       '#type' => 'checkbox',
>       '#default_value' => 0,
>       '#prefix' => '<td>',
>       '#suffix' => '</td>'
>     );
>   } else {
>     $existing_node = db_fetch_object($exists_query);
>     $output['add'] = array(
>       '#type' => 'markup',
>       '#value' => "<a href=\"/node/$existing_node->nid\">X</a>",
>       '#prefix' => '<td>',
>       '#suffix' => '</td>'
>     );
>   }

Comments

samj’s picture

Should also turn off taxonomies when the node already exists:

1087c1100,1102
<   $output['taxonomy'] = _amazon_taxonomy_term_control();
---
>   if (!$exists) {
>     $output['taxonomy'] = _amazon_taxonomy_term_control();
>   }
Prometheus6’s picture

Assigned: Unassigned » Prometheus6
Status: Reviewed & tested by the community » Postponed

That's not a bad idea.

I'm postponing it because I want to eliminate some bugs in the 4.7 version before working the 5.0 version. It will definitely be in the 5.0 version.

Prometheus6’s picture

Status: Postponed » Active

It's not in there yet, but it will be so back to active status.

khoogheem’s picture

I would like to see something even more user friendly.. (sorry).

I would like to see there be an option on the import that allows you to
1) See already imported nodes (use the above patch to show the links)
2) Don't show already imported nodes. This should help speed things up so you can quickly import new items.

The other thing I would like is rather then just a button setup. It would be nice to see it setup more like the pager so you can get 1.2.3.... so if you have a bunch of items you can go to futher down then just one page at a time.

Prometheus6’s picture

Version: master » 4.7.x-1.x-dev
Status: Active » Patch (to be ported)

Can't have the normal pager links because they would have to use a different form input method (GET rather than PUT).

I've added an edit field though, so you can input the page you want to go to directly. And I've decided to backport it to the 4.7 branch. It is more user friendly.

csc4’s picture

I was wondering if you could confirm if this is in 4.7 yet and if not do you have any idea when it might be?

Prometheus6’s picture

It's in the dev package...I'll create a release today.

I didn't create a link to the existing node though...I just disappeared the check box.

Prometheus6’s picture

Status: Patch (to be ported) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)