diff --git a/misc/ajax.js b/misc/ajax.js index bb4a6e1..62b717b 100644 --- a/misc/ajax.js +++ b/misc/ajax.js @@ -230,16 +230,16 @@ Drupal.ajax = function (base, element, element_settings) { * will test to see if the key press is valid to trigger this event and * if it is, trigger it for us and prevent other keypresses from triggering. * In this case we're handling RETURN and SPACEBAR keypresses (event codes 13 - * and 32. RETURN is often used to submit a form when in a textfield, and - * SPACE is often used to activate an element without submitting. + * and 32. RETURN is often used to submit a form when in a textfield, and + * SPACE is often used to activate an element without submitting. */ Drupal.ajax.prototype.keypressResponse = function (element, event) { // Create a synonym for this to reduce code confusion. var ajax = this; // Detect enter key and space bar and allow the standard response for them, - // except for form elements of type 'text' and 'textarea', where the - // spacebar activation causes inappropriate activation if #ajax['keypress'] is + // except for form elements of type 'text' and 'textarea', where the + // spacebar activation causes inappropriate activation if #ajax['keypress'] is // TRUE. On a text-type widget a space should always be a space. if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) { $(ajax.element_settings.element).trigger(ajax.element_settings.event); @@ -514,23 +514,10 @@ Drupal.ajax.prototype.commands = { // $(response.data) as new HTML rather than a CSS selector. Also, if // response.data contains top-level text nodes, they get lost with either // $(response.data) or $('
').replaceWith(response.data). + response.data = 'text node'; var new_content_wrapped = $('
').html(response.data); var new_content = new_content_wrapped.contents(); - // For legacy reasons, the effects processing code assumes that new_content - // consists of a single top-level element. Also, it has not been - // sufficiently tested whether attachBehaviors() can be successfully called - // with a context object that includes top-level text nodes. However, to - // give developers full control of the HTML appearing in the page, and to - // enable Ajax content to be inserted in places where DIV elements are not - // allowed (e.g., within TABLE, TR, and SPAN parents), we check if the new - // content satisfies the requirement of a single top-level element, and - // only use the container DIV created above when it doesn't. For more - // information, please see http://drupal.org/node/736066. - if (new_content.length != 1 || new_content.get(0).nodeType != 1) { - new_content = new_content_wrapped; - } - // If removing content from the wrapper, detach behaviors first. switch (method) { case 'html': @@ -567,6 +554,22 @@ Drupal.ajax.prototype.commands = { if (new_content.parents('html').length > 0) { // Apply any settings from the returned JSON if available. var settings = response.settings || ajax.settings || Drupal.settings; + + // For legacy reasons, the effects processing code assumes that new_content + // consists of a single top-level element. Also, it has not been + // sufficiently tested whether attachBehaviors() can be successfully called + // with a context object that includes top-level text nodes. However, to + // give developers full control of the HTML appearing in the page, and to + // enable Ajax content to be inserted in places where DIV elements are not + // allowed (e.g., within TABLE, TR, and SPAN parents), we check if the new + // content satisfies the requirement of a single top-level element, and + // only use the container DIV created above when it doesn't. For more + // information, please see http://drupal.org/node/736066. + console.dir(new_content.get(0)); + if (new_content.length != 1 || new_content.get(0).nodeType != 1) { + new_content = new_content.parent(); + } + Drupal.attachBehaviors(new_content, settings); } }, diff --git a/misc/states.js b/misc/states.js index 6d98da8..3384469 100644 --- a/misc/states.js +++ b/misc/states.js @@ -72,6 +72,9 @@ states.Dependent.comparisons = { // as a string before applying the strict comparison in compare(). Otherwise // numeric keys in the form's #states array fail to match string values // returned from jQuery's val(). + + console.log('teee') + return (typeof value === 'string') ? compare(reference.toString(), value) : compare(reference, value); } }; @@ -131,9 +134,27 @@ states.Dependent.prototype = { */ compare: function (reference, selector, state) { var value = this.values[selector][state.name]; - if (reference.constructor.name in states.Dependent.comparisons) { + + + console.log(reference, "reference") + console.log(typeof reference, "reference") + console.log($.type(reference), "type") + console.log($.type(reference).name, "type name") + console.log(reference.constructor); + + var name = reference.constructor.name; + if (!name) { + name = $.type(reference); + name = name.charAt(0).toUpperCase() + name.slice(1); + } + + + console.log(name, "name") + + + if (name in states.Dependent.comparisons) { // Use a custom compare function for certain reference value types. - return states.Dependent.comparisons[reference.constructor.name](reference, value); + return states.Dependent.comparisons[name](reference, value); } else { // Do a plain comparison otherwise. diff --git a/modules/file/file.js b/modules/file/file.js index fffec6b..517c1db 100644 --- a/modules/file/file.js +++ b/modules/file/file.js @@ -96,7 +96,7 @@ Drupal.file = Drupal.file || { var clickedButton = this; // Only disable upload fields for Ajax buttons. - if (!$(clickedButton).hasClass('ajax-processed')) { + if ($(clickedButton).hasClass('ajax-processed')) { return; } diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index cc3908e..4f34a27 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -522,7 +522,7 @@ function node_form_submit_build_node($form, &$form_state) { * Form constructor for the node deletion confirmation form. * * @see node_delete_confirm_submit() - */ + */ function node_delete_confirm($form, &$form_state, $node) { $form['#node'] = $node; // Always provide entity id in the same form key as in the entity edit form. diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 828fde0..72788b0 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -635,6 +635,7 @@ function theme_taxonomy_overview_terms($variables) { * @see taxonomy_form_term_submit() */ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = NULL) { + // During initial form build, add the term entity to the form state for use // during form building and processing. During a rebuild, use what is in the // form state. @@ -691,6 +692,7 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = '#weight' => 0, ); + $form['vocabulary_machine_name'] = array( '#type' => 'value', '#value' => isset($term->vocabulary_machine_name) ? $term->vocabulary_machine_name : $vocabulary->name, @@ -799,6 +801,7 @@ function taxonomy_form_term_validate($form, &$form_state) { * @see taxonomy_form_term() */ function taxonomy_form_term_submit($form, &$form_state) { + if ($form_state['triggering_element']['#value'] == t('Delete')) { // Execute the term deletion. if ($form_state['values']['delete'] === TRUE) { @@ -871,6 +874,10 @@ function taxonomy_form_term_submit_build_taxonomy_term($form, &$form_state) { * @see taxonomy_term_confirm_delete_submit() */ function taxonomy_term_confirm_delete($form, &$form_state, $tid) { + + print '
';
+  dpm($form_state);
+  print '
'; $term = taxonomy_term_load($tid); // Always provide entity id in the same form key as in the entity edit form.