/[drupal]/contributions/modules/amazontools/amazon.module
ViewVC logotype

Diff of /contributions/modules/amazontools/amazon.module

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

revision 1.63.2.4, Sun Feb 4 17:43:07 2007 UTC revision 1.63.2.5, Wed Feb 7 17:46:35 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* $Id: amazon.module,v 1.63.2.3 2007/01/26 03:30:41 prometheus6 Exp $ */  /* $Id: amazon.module,v 1.63.2.4 2007/02/04 17:43:07 prometheus6 Exp $ */
3  if (version_compare(phpversion(), '5', '<')) {  if (version_compare(phpversion(), '5', '<')) {
4    require_once('amazon.php4.inc');    require_once('amazon.php4.inc');
5  }  }
# Line 380  function amazon_form_alter($form_id, &$f Line 380  function amazon_form_alter($form_id, &$f
380      $node_type = $form_values['old_type']['#value'];      $node_type = $form_values['old_type']['#value'];
381      if (strpos($node_type, 'amazon') === FALSE) {      if (strpos($node_type, 'amazon') === FALSE) {
382              $form_values['workflow']['amazon_related_link'] = array(              $form_values['workflow']['amazon_related_link'] = array(
383                '#type' => 'checkbox',                '#type' => 'radios',
384                '#title' => t('Allow Amazon.com related product link'),                '#title' => t('Allow Amazon.com related product link'),
385                '#default_value' => variable_get('amazon_related_link_'.$node_type, 0),                '#default_value' => variable_get('amazon_related_link_'.$node_type, 0),
386                  '#options' => array(t('Disabled'), t('Enabled')),
387              );              );
388      }      }
389    }    }
390    elseif (($form_id == $form_values['type']['#value'] .'_node_form')) {    elseif (($form_id == $form_values['type']['#value'] .'_node_form')) {
391          $node = $form_values['#node'];          $node = $form_values['#node'];
392      if (variable_get('amazon_related_link_'.$form_values['type']['#value'], 0) > 0) {      if (variable_get('amazon_related_link_'.$form_values['type']['#value'], 0) > 0) {
393        $form_values['asin'] = array(          $form_values['asin_field'] = array(
394            '#type' => 'fieldset',
395            '#title' => t('Related Amazon.com product id'),
396            '#collapsible' => TRUE,
397            '#collapsed' => empty($node->asin),
398            );
399          $form_values['asin_field']['asin'] = array(
400          '#type' => 'textfield',          '#type' => 'textfield',
401          '#title' => t('Related books'),          '#title' => t('Related product(s)'),
402          '#size' => 20,          '#size' => 20,
403          '#maxlength' => 110,          '#maxlength' => 110,
404          '#default_value' => $node->asin,          '#default_value' => $node->asin,
405          '#description' => t('Enter a comma delimited list of ASINs for the related books.'),          '#description' => t('Enter a comma delimited list of up to 10 ASINs for the related books.'),
406          '#weight' => 10,          '#weight' => 10,
407          '#valid' => 'asin',          '#valid' => 'asin',
408        );        );
# Line 450  function amazon_node_node_form_submit($f Line 457  function amazon_node_node_form_submit($f
457    $form_values['title'] = $form_values['title'] ? $form_values['title'] : truncate_utf8($amazon_result[0]->title, 128, TRUE);    $form_values['title'] = $form_values['title'] ? $form_values['title'] : truncate_utf8($amazon_result[0]->title, 128, TRUE);
458    $form_values['body'] = $form_values['body'] ? $form_values['body'] : $amazon_result[0]->editorialreview;    $form_values['body'] = $form_values['body'] ? $form_values['body'] : $amazon_result[0]->editorialreview;
459    $form_values['log'] = $form_values['log'] ? $form_values['log'] : '';    $form_values['log'] = $form_values['log'] ? $form_values['log'] : '';
460    return node_form_submit($form_id, $form_values);    if ($form_values['op'] == t('Submit')) {
461        return node_form_submit($form_id, $form_values);
462      }
463  }  }
464    
465  function amazon_node_form_submit($form_id, &$form_values) {  function amazon_node_form_submit($form_id, &$form_values) {
# Line 459  function amazon_node_form_submit($form_i Line 468  function amazon_node_form_submit($form_i
468    $form_values['title'] = $form_values['title'] ? $form_values['title'] : truncate_utf8($amazon_result[0]->title, 128, TRUE);    $form_values['title'] = $form_values['title'] ? $form_values['title'] : truncate_utf8($amazon_result[0]->title, 128, TRUE);
469    $form_values['body'] = $form_values['body'] ? $form_values['body'] : $amazon_result[0]->editorialreview;    $form_values['body'] = $form_values['body'] ? $form_values['body'] : $amazon_result[0]->editorialreview;
470    $form_values['log'] = $form_values['log'] ? $form_values['log'] : '';    $form_values['log'] = $form_values['log'] ? $form_values['log'] : '';
471    if ($form_values['op'] == 'Submit') {    if ($form_values['op'] == t('Submit')) {
472      return node_form_submit($form_id, $form_values);      return node_form_submit($form_id, $form_values);
473    }    }
474  }  }
# Line 907  function _amazon_search_params($_search_ Line 916  function _amazon_search_params($_search_
916    
917  function _amazon_seach_search($_amazon_search_params) {  function _amazon_seach_search($_amazon_search_params) {
918    global $_amazon_search_amazonDOM;    global $_amazon_search_amazonDOM;
   $url = amazon_search_RESTURI($_amazon_search_params);  
 //  drupal_set_message("<a href=\"$url\">Raw XML</a>");  
919    // do the query    // do the query
920    $_amazon_search_amazonDOM = amazon_get_DOM($_amazon_search_params);    $_amazon_search_amazonDOM = amazon_get_DOM($_amazon_search_params);
921    // return the array of items    // return the array of items

Legend:
Removed from v.1.63.2.4  
changed lines
  Added in v.1.63.2.5

  ViewVC Help
Powered by ViewVC 1.1.2