Permalink
Browse files

Merge pull request #2 from cluke009/master

merging
  • Loading branch information...
2 parents b6228d0 + ab52a68 commit 3fd331c5dfed2dadb01372dd2855e9fade2ec407 @brendoncrawford committed Feb 24, 2012
Showing with 27 additions and 12 deletions.
  1. +11 −9 ajax.js
  2. +5 −2 ajax.module
  3. +1 −0 ajax_ui/ajax_ui.module
  4. +10 −1 plugins/wysiwyg/ajax_wysiwyg.js
View
20 ajax.js
@@ -6,7 +6,7 @@
* @depends Drupal 6
* @author brendoncrawford
* @note This file uses a 79 character width limit.
- *
+ *
*
*/
@@ -20,7 +20,7 @@ Drupal.Ajax.firstRun = false;
* Init function.
* This is being executed by Drupal behaviours.
* See bottom of script.
- *
+ *
* @param {HTMLElement} context
* @return {Bool}
*/
@@ -58,7 +58,7 @@ Drupal.Ajax.init = function(context) {
/**
* Invokes plugins
- *
+ *
* @param {Object} formObj
* @param {Object} submitter
*/
@@ -76,7 +76,7 @@ Drupal.Ajax.invoke = function(hook, args) {
/**
* Handles submission
- *
+ *
* @param {Object} submitter_
* @return {Bool}
*/
@@ -100,6 +100,7 @@ Drupal.Ajax.go = function(formObj, submitter) {
name : 'drupal_ajax',
value : '1'
};
+ submitter.attr('disabled', 'disabled');
return true;
},
dataType : 'json',
@@ -113,6 +114,7 @@ Drupal.Ajax.go = function(formObj, submitter) {
success: function(data){
submitter.val(submitterVal);
Drupal.Ajax.response(submitter, formObj, data);
+ submitter.removeAttr('disabled');
return true;
}
});
@@ -121,7 +123,7 @@ Drupal.Ajax.go = function(formObj, submitter) {
/**
* Handles messaging
- *
+ *
* @param {Object} formObj
* @param {Object} submitter
* @param {Object} data
@@ -143,7 +145,7 @@ Drupal.Ajax.message = function(formObj, submitter, data, options) {
/**
* Writes message
- *
+ *
* @param {Object} formObj
* @param {Object} submitter
* @param {Object} options
@@ -188,7 +190,7 @@ Drupal.Ajax.writeMessage = function(formObj, submitter, options) {
/**
* Updates message containers
- *
+ *
* @param {Object} updaters
* @return {Bool}
*/
@@ -222,7 +224,7 @@ Drupal.Ajax.updater = function(updaters) {
/**
* Handles data response
- *
+ *
* @param {Object} submitter
* @param {Object} formObj
* @param {Object} data
@@ -306,7 +308,7 @@ Drupal.Ajax.response = function(submitter, formObj, data){
/**
* Redirects to appropriate page
- *
+ *
* @todo
* Some of this functionality should possibly hapen on
* the server instead of client.
View
7 ajax.module
@@ -157,6 +157,9 @@ function ajax_validator_set(&$form) {
* @return Bool
*/
function ajax_submitter_set(&$form, $found) {
+ if (!isset($_POST['drupal_ajax'])) {
+ return;
+ }
if (!$found['submitter']) {
$form['#submit'][] = 'ajax_submitter';
if (empty($form['#attributes']['class'])) {
@@ -286,11 +289,11 @@ function ajax_build_url($u) {
$out .= '@';
}
$out .= $u['host'];
-
+
if (!empty($u['port'])) {
$out .= ':' . $u['port'];
}
-
+
$out .= $u['path'];
if (!empty($u['query'])) {
$out .= '?';
View
1 ajax_ui/ajax_ui.module
@@ -221,6 +221,7 @@ function ajax_ui_admin_submit($form, &$form_state) {
}
}
variable_set('ajax', $out);
+ drupal_set_message('Settings saved');
return TRUE;
}
View
11 plugins/wysiwyg/ajax_wysiwyg.js
@@ -11,7 +11,7 @@
/**
* Ajax Forms plugin for wysiwyg API
- *
+ *
* @param {String} hook
* @param {Object} args
* @return {Bool}
@@ -27,5 +27,14 @@ Drupal.Ajax.plugins.wysiwyg = function(hook, args) {
}
}
}
+ if (hook === 'message') {
+ if (Drupal.wysiwyg && Drupal.wysiwygAttach) {
+ for (w in Drupal.wysiwyg.instances) {
+ p = Drupal.wysiwyg.instances[w];
+ e = $('#' + p.field);
+ Drupal.wysiwygAttach(e[0], p);
+ }
+ }
+ }
return true;
}

0 comments on commit 3fd331c

Please sign in to comment.