',
'#value' => t('Add Conference'),
'#attributes' => array('class' => 'add-conf', 'title' => t('Click here to add a conference.')),
'#weight' => 1,
'#submit' => array('ife_add_conf_submit'), // If no javascript action.
'#ahah' => array(
'path' => 'ife/people_ahah',
'wrapper' => 'ife-people',
'method' => 'replace',
'effect' => 'fade',
),
);
return $element;
}
function ife_person_process($element)
{
$element['#tree'] = TRUE;
if (!isset($element['#value']))
{
$element['#value'] = array('name'=>'');
}
$element['name'] = array(
'#type' => 'textfield',
'#title'=> t('Name(s)'),
'#size' => 30,
'#value' => $element['#value']['name'],
'#description' => t('Please enter last name first, followed by a comma and first name.'),
);
$element['date'] = array(
'#type' => 'datepicker',
'#title' => t('Date'),
'#size'=> 30,
'#value' => $element['#value']['date'],
'#description' => ' '.t('Use this field to express birth/death dates. You may use the date chooser, but the field is free-form')
);
$element['role'] = array(
'#type' => 'textfield',
'#size'=>30,
'#description'=>t('The role that this person plays with regards to the object.'),
'#value' => $element['#value']['role'],
'#autocomplete_path' => 'autocomplete_marcrelator/',
);
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this person will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['remove'] = array(
'#type' => 'submit',
'#prefix' => '
',
'#suffix' => '
',
'#value' => 'remove_'. $element['#default_value']['delta'],
'#submit' => array('ife_remove_person_submit'),
'#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')),
'#ahah' => array(
'path' => 'ife/people_ahah',
'wrapper' => 'ife-people',
'method' => 'replace',
'effect' => 'fade',
),
);
return $element;
}
function ife_org_process($element)
{
$element['#tree'] = TRUE;
if (!isset($element['#value']))
{
$element['#value'] = array('name'=>'');
}
$element['role'] = array(
'#type' => 'textfield',
'#size'=>30,
'#description'=>t('The role that this organization plays with regards to the object.'),
'#value' => $element['#value']['role'],
'#autocomplete_path' => 'autocomplete_marcrelator/',
);
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this organization will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['organization'] = array(
'#type' => 'textfield',
'#title' => t('Organization'),
'#size' => 30,
'#value' => $element['#value']['organization'],
);
$element['remove'] = array(
'#type' => 'submit',
'#prefix' => '
',
'#suffix' => '
',
'#value' => 'remove_'. $element['#default_value']['delta'],
'#submit' => array('ife_remove_person_submit'),
'#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')),
'#ahah' => array(
'path' => 'ife/people_ahah',
'wrapper' => 'ife-people',
'method' => 'replace',
'effect' => 'fade',
),
);
return $element;
}
function ife_conf_process($element)
{
$element['#tree'] = TRUE;
if (!isset($element['#value']))
{
$element['#value'] = array('name'=>'');
}
$element['role'] = array(
'#type' => 'textfield',
'#size'=>30,
'#description'=>t('The role that this conference plays with regards to the object.'),
'#value' => $element['#value']['role'],
'#autocomplete_path' => 'autocomplete_marcrelator/',
);
$element['subject'] = array(
'#type' => 'checkbox',
'#size'=>30,
'#description'=>t('If checked, this conference will be listed as a subject term. If selected, role field does not apply.'),
'#title' => t('Subject'),
'#value' => $element['#value']['subject'],
);
$element['conference'] = array(
'#type' => 'textfield',
'#title' => t('Conference'),
'#size' => 30,
'#value' => $element['#value']['conference'],
);
$element['date'] = array(
'#type' => 'datepicker',
'#title' => t('Date'),
'#size'=> 30,
'#value' => $element['#value']['date']
);
$element['remove'] = array(
'#type' => 'submit',
'#prefix' => '
',
'#suffix' => '
',
'#value' => 'remove_'. $element['#default_value']['delta'],
'#submit' => array('ife_remove_person_submit'),
'#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')),
'#ahah' => array(
'path' => 'ife/people_ahah',
'wrapper' => 'ife-people',
'method' => 'replace',
'effect' => 'fade',
),
);
return $element;
}
/**
* Our process callback to expand the control.
*/
function ife_sticky_textfield_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$element['#type'] = 'sticky_textfield';
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/**
* Our process callback to expand the control.
*/
function ife_datepicker_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/**
* Our process callback to expand the control.
*/
function ife_sticky_textarea_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$element['#type'] = 'sticky_textarea';
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/**
* Our process callback to expand the control.
*/
function ife_sticky_select_process($element,$edit,&$form_state)
{
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$element['#type'] = 'sticky_select';
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
return $element;
}
/**
* Our process callback to expand the control.
*/
function ife_copyright_process($element,$edit,&$form_state) {
module_load_include('inc','islandora_form_elements','includes/creative_commons');
if (isset($element['#sticky']) && $element['#sticky'] == TRUE)
{
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on')
{
$form_state['storage'][$element['#name']]=$element['#value'];
} elseif (isset($form_state['storage'][$element['#name']]))
{
$element['#value'] = $form_state['storage'][$element['#name']];
$element['#sticky_on'] = TRUE;
}
}
if ($element['#sticky']) {
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?' ':'');
}
$element['#tree'] = TRUE;
if (isset($element['#value']) && !is_array($element['#value'])) {
$matches=array();
if (preg_match('/by-*([a-z]+)-*([a-z]+)\/([\d\.]+)\/([a-z]*)/',$element['#value'],$matches)) {
$element['#value'] = array('cc_commercial' => $matches[1], 'cc_modifications' => $matches[2], 'cc_jurisdiction' => $matches[4]);
} else
$element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => '');
} else if (!isset($element['#value'])) {
$element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => '');
}
$element['cc'] = array('#type' => 'fieldset', '#title'=>$element['#title'], '#description' => $sticky.'
';
if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) {
drupal_add_js('misc/autocomplete.js');
$class[] = 'form-autocomplete';
$extra = '';
}
_form_set_class($element, $class);
if (isset($element['#field_prefix'])) {
$output .= ''. $element['#field_prefix'] .' ';
}
$output .= '';
if (isset($element['#field_suffix'])) {
$output .= ' '. $element['#field_suffix'] .'';
}
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?' ':'');
return theme('form_element', $element, $output . $sticky ) . $extra;
}
/**
* Format a sticky textarea.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, description, rows, cols, required, attributes
* @return
* A themed HTML string representing the textarea.
*
* @ingroup themeable
*/
function theme_sticky_textarea($element) {
$class = array('form-textarea');
// Add teaser behavior (must come before resizable)
if (!empty($element['#teaser'])) {
drupal_add_js('misc/teaser.js');
// Note: arrays are merged in drupal_get_js().
drupal_add_js(array('teaserCheckbox' => array($element['#id'] => $element['#teaser_checkbox'])), 'setting');
drupal_add_js(array('teaser' => array($element['#id'] => $element['#teaser'])), 'setting');
$class[] = 'teaser';
}
// Add resizable behavior
if ($element['#resizable'] !== FALSE) {
drupal_add_js('misc/textarea.js');
$class[] = 'resizable';
}
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?' ':'');
_form_set_class($element, $class);
return theme('form_element', $element, ''.$sticky);
}
/**
* Format a sticky select.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, description, rows, cols, required, attributes
* @return
* A themed HTML string representing the textarea.
*
* @ingroup themeable
*/
function theme_sticky_select($element) {
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?' ':'');
$select = '';
$size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
_form_set_class($element, array('form-select'));
$multiple = $element['#multiple'];
return theme('form_element', $element, ''.$sticky);
}
/**
* Theme function to format the output.
*
* We use the container-inline class so that all three of the HTML elements
* are placed next to each other, rather than on separate lines.
*/
function theme_datepicker($element) {
global $base_url;
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_js($path.'/js/jquery.ui.core.js');
drupal_add_js($path.'/js/jquery.ui.widget.js');
drupal_add_js($path.'/js/jquery.ui.datepicker.js');
drupal_add_css($path.'/css/ui-lightness/jquery-ui-1.8.4.custom.css');
$js = '$(document).ready(function () { $(\'#'.$element['#id'].'\').datepicker({ buttonImage: \''.$base_url.'/'.$path.'/images/date.png\', constrainInput: false, showOn: \'button\', changeMonth: true, changeYear: true }); });';
$size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"';
$maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"';
$class = array('form-text','datepicker');
$extra = '';
$output= '';
$output.='
';
if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) {
drupal_add_js('misc/autocomplete.js');
$class[] = 'form-autocomplete';
$extra = '';
}
_form_set_class($element, $class);
if (isset($element['#field_prefix'])) {
$output .= ''. $element['#field_prefix'] .' ';
}
$output .= '';
if (isset($element['#field_suffix'])) {
$output .= ' '. $element['#field_suffix'] .'';
}
$path=drupal_get_path('module','islandora_form_elements');
drupal_add_css($path.'/css/sticky.css');
$stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky';
$sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?' ':'');
return theme('form_element', $element, $output.$sticky ) . $extra;
}
/**
* Theme function to format the output.
*
* We use the container-inline class so that all three of the HTML elements
* are placed next to each other, rather than on separate lines.
*/
function theme_sticky_textfield($element) {
//echo '