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

Diff of /contributions/modules/nf_handshake/nf_handshake.module

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

revision 1.5, Mon Sep 17 16:06:15 2007 UTC revision 1.6, Tue Sep 18 04:21:34 2007 UTC
# Line 1930  function theme_nf_handshake_initiate($fo Line 1930  function theme_nf_handshake_initiate($fo
1930              $data_text .= $data. '<br />';              $data_text .= $data. '<br />';
1931            }            }
1932          }          }
1933        }          if ($data_text == '') {
1934        if ($data_text == '') {            $data_text .= t('<strong>No Value Entered</strong>');
1935          $data_text .= t('<strong>No Value Entered</strong>');            $form['handshake']['fields'][$key4]['#attributes'] = array('disabled' => 1);
1936          $form['handshake']['fields'][$key4]['#attributes'] = array('disabled' => 1);            $form['handshake']['fields'][$key4]['#return_value'] = 'NULL';
1937          $form['handshake']['fields'][$key4]['#return_value'] = 'NULL';          }
1938            else {
1939              $type_name = $exp_val[0];
1940              $type = content_types($type_name);
1941              $field_types = _content_field_types();
1942              $formatter = 'default';
1943              $field = $type['fields'][$exp_val[1]];
1944              $node = node_load($user_types[$exp_val[0]]->nid);
1945              $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
1946              $module = $field_types[$field['type']]['module'];
1947              if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
1948                $function = $module .'_field';
1949                if (function_exists($function)) {
1950                  $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
1951                }
1952              }
1953              else {
1954                foreach ($node_field as $delta => $item) {
1955                  $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
1956                }
1957                $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
1958              }
1959            }
1960        }        }
1961        $rows[] = array(array('data' => drupal_render($form['handshake']['fields'][$key4]), 'width' => '20%'), array('data' => $data_text, 'width' => '*'));        $rows[] = array(array('data' => drupal_render($form['handshake']['fields'][$key4]), 'width' => '20%'), array('data' => $data_text, 'width' => '*'));
1962      }      }
# Line 1945  function theme_nf_handshake_initiate($fo Line 1967  function theme_nf_handshake_initiate($fo
1967            foreach ($the_rest as $key3 => $value3) {            foreach ($the_rest as $key3 => $value3) {
1968              $exp_val2 = explode('::', $key3);              $exp_val2 = explode('::', $key3);
1969              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {
1970                foreach ($user_data[$exp_val2[0]][$exp_val2[1]] as $column => $data) {                $type_name = $exp_val2[0];
1971                  if (!empty($data)) {                $type = content_types($type_name);
1972                    $data_text .= $data. '<br />';                $field_types = _content_field_types();
1973                  $formatter = 'default';
1974                  $field = $type['fields'][$exp_val2[1]];
1975                  $node = node_load($user_types[$exp_val2[0]]->nid);
1976                  $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
1977                  $module = $field_types[$field['type']]['module'];
1978                  if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
1979                    $function = $module .'_field';
1980                    if (function_exists($function)) {
1981                      $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
1982                  }                  }
1983                }                }
1984                  else {
1985                    foreach ($node_field as $delta => $item) {
1986                      $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
1987                    }
1988                    $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
1989                  }
1990              }              }
1991            }            }
1992          if ($data_text == '') {            if ($data_text == '') {
1993            $data_text .= t('<strong>No Value Entered</strong>');              $data_text .= t('<strong>No Value Entered</strong>');
1994          $form['handshake']['fields'][$key4]['#attributes'] = array('disabled' => 1);              $form['handshake']['fields'][$key4]['#attributes'] = array('disabled' => 1);
1995          $form['handshake']['fields'][$key4]['#return_value'] = 'NULL';              $form['handshake']['fields'][$key4]['#return_value'] = 'NULL';
1996          }            }
1997          $rows[] = array(array('data' => drupal_render($form['handshake']['fields'][$key4]), 'width' => '35%'), array('data' => $data_text, 'width' => '*'));            else {
1998    
1999              }
2000              $rows[] = array(array('data' => drupal_render($form['handshake']['fields'][$key4]), 'width' => '35%'), array('data' => $data_text, 'width' => '*'));
2001    
2002          }          }
2003        }        }
# Line 2855  function theme_nf_handshake_view_hsr($fo Line 2895  function theme_nf_handshake_view_hsr($fo
2895              $data_text .= $data. '<br />';              $data_text .= $data. '<br />';
2896            }            }
2897          }          }
2898        }          if ($data_text == '') {
2899        if ($data_text == '') {            $data_text .= t('<strong>No Value Entered</strong>');
2900          $data_text .= t('<strong>No Value Entered</strong>');            $form['request']['fields'][$key4]['#attributes'] = array('disabled' => 1);
2901          $form['request']['fields'][$key4]['#attributes'] = array('disabled' => 1);            $form['request']['fields'][$key4]['#return_value'] = 'NULL';
2902          $form['request']['fields'][$key4]['#return_value'] = 'NULL';          }
2903            else {
2904              $type_name = $exp_val[0];
2905              $type = content_types($type_name);
2906              $field_types = _content_field_types();
2907              $formatter = 'default';
2908              $field = $type['fields'][$exp_val[1]];
2909              $node = node_load($user_types[$exp_val[0]]->nid);
2910              $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
2911              $module = $field_types[$field['type']]['module'];
2912              if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
2913                $function = $module .'_field';
2914                if (function_exists($function)) {
2915                  $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
2916                }
2917              }
2918              else {
2919                foreach ($node_field as $delta => $item) {
2920                  $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
2921                }
2922                $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
2923              }
2924            }
2925        }        }
2926        $rows[] = array(array('data' => drupal_render($form['request']['fields'][$key4]), 'width' => '20%'), array('data' => $data_text, 'width' => '*'));        $rows[] = array(array('data' => drupal_render($form['request']['fields'][$key4]), 'width' => '20%'), array('data' => $data_text, 'width' => '*'));
2927      }      }
# Line 2870  function theme_nf_handshake_view_hsr($fo Line 2932  function theme_nf_handshake_view_hsr($fo
2932            foreach ($the_rest as $key3 => $value3) {            foreach ($the_rest as $key3 => $value3) {
2933              $exp_val2 = explode('::', $key3);              $exp_val2 = explode('::', $key3);
2934              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {
2935                foreach ($user_data[$exp_val2[0]][$exp_val2[1]] as $column => $data) {                $type_name = $exp_val2[0];
2936                  if (!empty($data)) {                $type = content_types($type_name);
2937                    $data_text .= $data. '<br />';                $field_types = _content_field_types();
2938                  $formatter = 'default';
2939                  $field = $type['fields'][$exp_val2[1]];
2940                  $node = node_load($user_types[$exp_val2[0]]->nid);
2941                  $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
2942                  $module = $field_types[$field['type']]['module'];
2943                  if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
2944                    $function = $module .'_field';
2945                    if (function_exists($function)) {
2946                      $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
2947                    }
2948                  }
2949                  else {
2950                    foreach ($node_field as $delta => $item) {
2951                      $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
2952                  }                  }
2953                    $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
2954                }                }
2955              }              }
2956            }            }
2957          if ($data_text == '') {          if ($data_text == '') {
2958            $data_text .= t('<strong>No Value Entered</strong>');            $data_text .= t('<strong>No Value Entered</strong>');
2959          $form['request']['fields'][$key4]['#attributes'] = array('disabled' => 1);            $form['request']['fields'][$key4]['#attributes'] = array('disabled' => 1);
2960          $form['request']['fields'][$key4]['#return_value'] = 'NULL';            $form['request']['fields'][$key4]['#return_value'] = 'NULL';
2961          }          }
2962          $rows[] = array(array('data' => drupal_render($form['request']['fields'][$key4]), 'width' => '35%'), array('data' => $data_text, 'width' => '*'));          $rows[] = array(array('data' => drupal_render($form['request']['fields'][$key4]), 'width' => '35%'), array('data' => $data_text, 'width' => '*'));
2963    
# Line 3221  function nf_handshake_view_user_data($ui Line 3298  function nf_handshake_view_user_data($ui
3298        $data_text = '';        $data_text = '';
3299        $exp_val = explode('::', $key4);        $exp_val = explode('::', $key4);
3300        if (!empty($user_types[$exp_val[0]]) && $user_types[$exp_val[0]] != NULL) {        if (!empty($user_types[$exp_val[0]]) && $user_types[$exp_val[0]] != NULL) {
3301          foreach ($user_data[$exp_val[0]][$exp_val[1]] as $column => $data) {          //start new stuff
3302            if (!empty($data)) {          $type_name = $exp_val[0];
3303              $data_text .= $data. '<br />';          $type = content_types($type_name);
3304            $field_types = _content_field_types();
3305            $formatter = 'default';
3306            $field = $type['fields'][$exp_val[1]];
3307            $node = node_load($user_types[$exp_val[0]]->nid);
3308            $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
3309            $module = $field_types[$field['type']]['module'];
3310            if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
3311              $function = $module .'_field';
3312              if (function_exists($function)) {
3313                $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
3314            }            }
3315          }          }
3316            else {
3317              foreach ($node_field as $delta => $item) {
3318                $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
3319              }
3320              $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
3321            }
3322            //end
3323        }        }
3324        $rows[] = array(array('data' => $key4, 'width' => '20%'), array('data' => $data_text, 'width' => '*'));        $rows[] = array(array('data' => t($field['widget']['label']), 'width' => '20%'), array('data' => $data_text, 'width' => '*'));
3325      }      }
3326      else {      else {
3327        foreach ($groups as $group => $the_rest) {        foreach ($groups as $group => $the_rest) {
# Line 3236  function nf_handshake_view_user_data($ui Line 3330  function nf_handshake_view_user_data($ui
3330            foreach ($the_rest as $key3 => $value3) {            foreach ($the_rest as $key3 => $value3) {
3331              $exp_val2 = explode('::', $key3);              $exp_val2 = explode('::', $key3);
3332              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {              if (!empty($user_types[$exp_val2[0]]) && $user_types[$exp_val2[0]] != NULL) {
3333                foreach ($user_data[$exp_val2[0]][$exp_val2[1]] as $column => $data) {                //start new stuff
3334                  if (!empty($data)) {                $type_name = $exp_val2[0];
3335                    $data_text .= $data. '<br />';                $type = content_types($type_name);
3336                  $field_types = _content_field_types();
3337                  $formatter = 'default';
3338                  $field = $type['fields'][$exp_val2[1]];
3339                  $node = node_load($user_types[$exp_val2[0]]->nid);
3340                  $node_field = isset($node->$field['field_name']) ? $node->$field['field_name'] : array();
3341                  $module = $field_types[$field['type']]['module'];
3342                  if (content_handle('field', 'view', $field) == CONTENT_CALLBACK_CUSTOM && $module != 'cck_address' && $module != 'cck_fullname') {
3343                    $function = $module .'_field';
3344                    if (function_exists($function)) {
3345                      $data_text = $function('view', $node, $field, $node_field, NULL, NULL);
3346                    }
3347                  }
3348                  else {
3349                    foreach ($node_field as $delta => $item) {
3350                      $node_field[$delta]['view'] = content_format($field, $item, $formatter, $node);
3351                  }                  }
3352                    $data_text = theme('handshake_field', $node, $field, $node_field, NULL, NULL);
3353                }                }
3354                  //end
3355              }              }
3356            }            }
3357          $rows[] = array(array('data' => $key4, 'width' => '35%'), array('data' => $data_text, 'width' => '*'));          $rows[] = array(array('data' => t($field['widget']['label']), 'width' => '35%'), array('data' => $data_text, 'width' => '*'));
3358          }          }
3359        }        }
3360      }      }
# Line 3294  function nf_handshake_view_user_data($ui Line 3405  function nf_handshake_view_user_data($ui
3405  } // function nf_handshake_view_user_data()  } // function nf_handshake_view_user_data()
3406    
3407  /**  /**
3408     * Format an individual field for display. Stolen from content.module
3409     *
3410     * @param $node
3411     *   The node being displayed (provided for context).
3412     * @param $field
3413     *   The field that is to be displayed (for information about the label, field
3414     *   type, and so forth).
3415     * @param $items
3416     *   The actual items to theme. This will be a linear array, each element of
3417     *   which has a "view" property which contains the filtered, formatted contents
3418     *   of the item.
3419     * @param $teaser
3420     *   Whether the node is being displayed as a teaser or full version.
3421     * @param $page
3422     *   Whether the node is being displayed as a full web page.
3423     *
3424     * @return
3425     *   An HTML string containing the fully themed field.
3426     */
3427    function theme_handshake_field(&$node, &$field, &$items, $teaser, $page) {
3428      //$label_display = isset($field['display_settings']['label']['format']) ? $field['display_settings']['label']['format'] : 'above';
3429      //$label = t($field['widget']['label']);
3430      $items_output = '';
3431    
3432      foreach ($items as $delta => $item) {
3433        if (!empty($item['view']) || $item['view'] === "0") {
3434          $items_output .= '<div class="field-item">';
3435          if ($label_display == 'inline') {
3436            $items_output .= '<div class="field-label-inline'. ($delta ? '' : '-first') .'">';
3437            $items_output .= $label .':&nbsp;</div>' ;
3438          }
3439          $items_output .= $item['view'] .'</div>';
3440        }
3441      }
3442    
3443      $output = '';
3444      if (!empty($items_output)) {
3445        $output .= '<div class="field field-type-'. strtr($field['type'], '_', '-') .' field-'. strtr($field['field_name'], '_', '-') .'">';
3446        //if ($label_display == 'above') {
3447        //  $output .= '<div class="field-label">'. $label .':&nbsp;</div>';
3448        //}
3449        $output .= '<div class="field-items">'. $items_output .'</div>';
3450        $output .= '</div>';
3451      }
3452      return $output;
3453    } // function theme_handshake_field()
3454    
3455    /**
3456   * Confirm that a handshake is meant to be revoked.   * Confirm that a handshake is meant to be revoked.
3457   *   *
3458   * Note that what a revokation does is 'Reject' the handshake and establish the revoker as the auid regardless of whether they were originally the   * Note that what a revokation does is 'Reject' the handshake and establish the revoker as the auid regardless of whether they were originally the

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.2