Browse Source

Fixed some bugs related to the entity editor and IE7.

pull/105/head
=Mark Roy 14 years ago
parent
commit
e84ad7c57b
  1. 11
      form_elements/includes/people.inc
  2. 2
      form_elements/islandora_form_elements.module
  3. 8
      form_elements/js/people_ahah.js

11
form_elements/includes/people.inc

@ -41,7 +41,6 @@ function _ife_find_people_element($form, &$keys = array()) {
function ife_people_ahah() { function ife_people_ahah() {
if (!isset($_POST['form_build_id'])) if (!isset($_POST['form_build_id']))
return; return;
@ -58,7 +57,6 @@ function ife_people_ahah() {
$_POST = _dummy_post_info($form, $_POST); $_POST = _dummy_post_info($form, $_POST);
$form_state['post'] = $_POST; $form_state['post'] = $_POST;
$form['#post'] = $_POST; $form['#post'] = $_POST;
drupal_process_form($form_id, $form, $form_state); drupal_process_form($form_id, $form, $form_state);
//ob_start(); echo '<pre>'; echo $_POST['form_build_id']."\n"; var_dump($form_state); echo '</pre>'; $dump = ob_get_contents(); ob_end_clean(); //ob_start(); echo '<pre>'; echo $_POST['form_build_id']."\n"; var_dump($form_state); echo '</pre>'; $dump = ob_get_contents(); ob_end_clean();
@ -109,7 +107,7 @@ function ife_remove_person_submit($form, &$form_state) {
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
//$form_state['rebuild'] = TRUE; $form_state['rebuild'] = TRUE;
} }
@ -136,14 +134,14 @@ function ife_add_person_submit($form, &$form_state) {
} }
//only add new person if we are not adding from repository. //only add new person if we are not adding from repository.
if (!isset($form_state['post']['add_from_repository']) || trim($form_state['post']['add_from_repository']) == '') { $elName = isset($qt_form['entity0']['#parents'][0])?$qt_form['entity0']['#parents'][0]:null;
if ($elName == null || !isset($form_state['clicked_button']['#post'][$elName]['add_from_repository']) || trim($form_state['clicked_button']['#post'][$elName]['add_from_repository']) == '') {
$people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => ''); $people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => '');
} }
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state); form_execute_handlers('submit', $form, $form_state);
$form_state['storage']['people'] = $people; $form_state['storage']['people'] = $people;
// $form_state['rebuild'] = TRUE; $form_state['rebuild'] = TRUE;
} }
@ -200,6 +198,7 @@ function ife_add_conf_submit($form, &$form_state) {
foreach ($peopleVals['people'] as $val) { foreach ($peopleVals['people'] as $val) {
$people[] = $val; $people[] = $val;
} }
$people[] = array('role' => '', 'conference' => '', 'subject' => ''); $people[] = array('role' => '', 'conference' => '', 'subject' => '');
unset($form_state['submit_handlers']); unset($form_state['submit_handlers']);

2
form_elements/islandora_form_elements.module

@ -154,6 +154,7 @@ function ife_people_process($element,$edit,&$form_state)
$json = json_decode($form_state['post'][$element['#name']]['add_from_repository']); $json = json_decode($form_state['post'][$element['#name']]['add_from_repository']);
$form_state['post'][$element['#name']]['add_from_repository'] = ''; // clear so that if the form is processed multiple times, it does not add twice.
$person=array(); $person=array();
@ -182,7 +183,6 @@ function ife_people_process($element,$edit,&$form_state)
$form_state['storage']['people']=$people; $form_state['storage']['people']=$people;
} else if (!isset($form_state['storage']['people']) || empty($form_state['storage']['people'])) } else if (!isset($form_state['storage']['people']) || empty($form_state['storage']['people']))
{ {
if ( (!isset($form_state['clicked_button']) || count($form_state['clicked_button']) == 0) && isset($element['#default_value']) && is_array($element['#default_value']) ) { if ( (!isset($form_state['clicked_button']) || count($form_state['clicked_button']) == 0) && isset($element['#default_value']) && is_array($element['#default_value']) ) {

8
form_elements/js/people_ahah.js

@ -3,12 +3,14 @@
if (Drupal.jsEnabled) { if (Drupal.jsEnabled) {
$(document).ready(function() { $(document).ready(function() {
if (Drupal.ahah != undefined) { $('#edit-mods-people-add-from-repository').blur(function () {
if ($('#edit-mods-people-add-from-repository').val() != '') {
$('#edit-mods-people-add-from-repository').change(function () {
$('#edit-mods-people-add-person').mousedown(); $('#edit-mods-people-add-person').mousedown();
}
}); });
if (Drupal.ahah != undefined) {
/** /**
* Override of Drupal.ahah.prototype.success. The only difference is that we * Override of Drupal.ahah.prototype.success. The only difference is that we
* allow for new Drupal.settings. * allow for new Drupal.settings.

Loading…
Cancel
Save