| 1 |
<?php |
<?php |
| 2 |
// $Id: biblio.module,v 1.143 2009/01/27 23:05:30 rhaschke Exp $ |
// $Id: biblio.module,v 1.144 2009/01/28 08:30:31 rhaschke Exp $ |
| 3 |
/** |
/** |
| 4 |
* biblio.module for Drupal |
* biblio.module for Drupal |
| 5 |
* |
* |
| 974 |
'#hideRole' => count($options) <= 1, |
'#hideRole' => count($options) <= 1, |
| 975 |
); |
); |
| 976 |
// Add the current choices to the form. |
// Add the current choices to the form. |
| 977 |
$default_values = array('name' => '', 'cid' => '', 'auth_type' => current($options)); |
$default_values = array('name' => '', 'cid' => '', 'auth_type' => key($options)); |
| 978 |
for ($delta = 0; $delta < $contributor_count; $delta++) { |
for ($delta = 0; $delta < $contributor_count; $delta++) { |
| 979 |
if (isset($contributors[$delta])) { // contributor already exists |
if (isset($contributors[$delta])) { // contributor already exists |
| 980 |
$values = $contributors[$delta]; |
$values = $contributors[$delta]; |
| 1052 |
function biblio_contributors_js($tid, $auth_category, $other_fields = FALSE) { |
function biblio_contributors_js($tid, $auth_category, $other_fields = FALSE) { |
| 1053 |
$delta = count($_POST['biblio_contributors'][$auth_category]); |
$delta = count($_POST['biblio_contributors'][$auth_category]); |
| 1054 |
// Build our new form element. |
// Build our new form element. |
| 1055 |
$ctypes = _biblio_get_auth_types($auth_category, $biblio_type); |
$ctypes = _biblio_get_auth_types($auth_category, $tid); |
| 1056 |
$ctypes = db_query('SELECT * FROM {biblio_contributor_type_data} |
$ctypes = db_query('SELECT * FROM {biblio_contributor_type_data} |
| 1057 |
WHERE auth_type IN ('.implode(',',$ctypes).')'); |
WHERE auth_type IN ('.implode(',',$ctypes).')'); |
| 1058 |
while ($ctype = db_fetch_object($ctypes)) { |
while ($ctype = db_fetch_object($ctypes)) { |
| 1059 |
$options[$ctype->auth_type] = $ctype->title; |
$options[$ctype->auth_type] = $ctype->title; |
| 1060 |
} |
} |
| 1061 |
|
|
| 1062 |
$default_values = array('name' => '', 'cid' => '', 'auth_type' => '', 'rank' => $delta); |
$default_values = array('name' => '', 'cid' => '', 'auth_type' => key($options), 'rank' => $delta); |
| 1063 |
$form_element = _biblio_contributor_form($delta, $auth_category, $default_values, $options); |
$form_element = _biblio_contributor_form($delta, $auth_category, $default_values, $options); |
| 1064 |
drupal_alter('form', $form_element, array(), 'biblio_contributors_js'); |
drupal_alter('form', $form_element, array(), 'biblio_contributors_js'); |
| 1065 |
// Build the new form. |
// Build the new form. |