Browse Source

Fixed some bugs related to the entity editor and IE7.

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

13
form_elements/includes/people.inc

@ -41,7 +41,6 @@ function _ife_find_people_element($form, &$keys = array()) {
function ife_people_ahah() {
if (!isset($_POST['form_build_id']))
return;
@ -58,10 +57,9 @@ function ife_people_ahah() {
$_POST = _dummy_post_info($form, $_POST);
$form_state['post'] = $_POST;
$form['#post'] = $_POST;
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();
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
$qt_form = _ife_find_people_element($form);
@ -109,7 +107,7 @@ function ife_remove_person_submit($form, &$form_state) {
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$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.
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' => '');
}
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$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) {
$people[] = $val;
}
$people[] = array('role' => '', 'conference' => '', 'subject' => '');
unset($form_state['submit_handlers']);

12
form_elements/islandora_form_elements.module

@ -145,15 +145,16 @@ function ife_people_process($element,$edit,&$form_state)
$people= array();
if (isset($form_state['storage']['people']) && !empty($form_state['storage']['people'])) {
foreach ($form_state['storage']['people'] as $ent) {
if ( trim($ent['name']) != '' || trim($ent['organization']) != '' || trim($ent['conference']) != '' || trim($ent['role']) != '' || trim($ent['date']) != '') {
$people[]=$ent;
}
}
foreach ($form_state['storage']['people'] as $ent) {
if ( trim($ent['name']) != '' || trim($ent['organization']) != '' || trim($ent['conference']) != '' || trim($ent['role']) != '' || trim($ent['date']) != '') {
$people[]=$ent;
}
}
}
$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();
@ -182,7 +183,6 @@ function ife_people_process($element,$edit,&$form_state)
$form_state['storage']['people']=$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']) ) {

12
form_elements/js/people_ahah.js

@ -3,11 +3,13 @@
if (Drupal.jsEnabled) {
$(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-person').mousedown();
}
});
$('#edit-mods-people-add-from-repository').change(function () {
$('#edit-mods-people-add-person').mousedown();
});
if (Drupal.ahah != undefined) {
/**
* Override of Drupal.ahah.prototype.success. The only difference is that we
@ -87,4 +89,4 @@ Drupal.ahah.prototype.success = function (response, status) {
});
}
})(jQuery);
})(jQuery);

Loading…
Cancel
Save