/[drupal]/contributions/modules/yui_button/yui_button.module
ViewVC logotype

Diff of /contributions/modules/yui_button/yui_button.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4, Tue Jun 24 04:08:53 2008 UTC revision 1.5, Tue Jun 24 04:43:51 2008 UTC
# Line 26  function yui_button_form_alter(&$form, $ Line 26  function yui_button_form_alter(&$form, $
26    array_walk($form, '_yui_button_form_alter');    array_walk($form, '_yui_button_form_alter');
27  }  }
28    
29  function _yui_button_form_alter($element, $id) {  function _yui_button_form_alter($element, $id, $parentId = null) {
30      $id = ($parentId != null ? $parentId . '-' : '') . $id;
31    if (is_array($element)) {    if (is_array($element)) {
32      array_walk($element, '_yui_button_form_alter');      if (isset($element['#tree'])) {
33          array_walk($element, '_yui_button_form_alter', $id);
34        }
35        else {
36          array_walk($element, '_yui_button_form_alter');
37        }
38      switch ($element['#type']) {      switch ($element['#type']) {
39        case 'button':        case 'button':
40          render_button($id);          render_button($id);
# Line 47  function _yui_button_form_alter($element Line 53  function _yui_button_form_alter($element
53          break;          break;
54        case 'select':        case 'select':
55        case 'weight':        case 'weight':
56          render_button('menu-' . $id, 'menu');          render_button($id, 'menu');
57          break;          break;
58      }      }
59    }    }
# Line 96  function render_button($id, $type = 'but Line 102  function render_button($id, $type = 'but
102        YAHOO.util.Event.onContentReady('edit-$id', function() {        YAHOO.util.Event.onContentReady('edit-$id', function() {
103          var menu = document.createElement('input');          var menu = document.createElement('input');
104          var menuID = YAHOO.util.Dom.generateId(menu, 'edit-${id}-menu');          var menuID = YAHOO.util.Dom.generateId(menu, 'edit-${id}-menu');
         var name = YAHOO.util.Dom.get('edit-$id').getAttribute('name');  
         var form = YAHOO.util.Dom.getAncestorByTagName('edit-$id', 'form');  
105          YAHOO.util.Dom.insertBefore(menu, 'edit-$id');          YAHOO.util.Dom.insertBefore(menu, 'edit-$id');
106    
107          var options = YAHOO.util.Dom.get('edit-$id').options;          var options = YAHOO.util.Dom.get('edit-$id').options;
# Line 114  function render_button($id, $type = 'but Line 118  function render_button($id, $type = 'but
118            var oMenuItem = p_aArgs[0];            var oMenuItem = p_aArgs[0];
119                oMenuItem.subscribe('click', function() {                oMenuItem.subscribe('click', function() {
120                  button.set('label', this.cfg.getProperty('text'));                  button.set('label', this.cfg.getProperty('text'));
                 //YAHOO.util.Dom.get('edit-$id').setAttribute('value', this.cfg.getProperty('text'));  
121                });                });
122          });          });
 /*  
         var newEdit = document.createElement('input');  
         newEdit.setAttribute('id', 'edit-$id');  
         newEdit.setAttribute('name', name);  
         newEdit.setAttribute('type', 'hidden');  
         newEdit.setAttribute('value', selectedValue);  
         form.appendChild(newEdit);*/  
123        });", "inline", "footer");        });", "inline", "footer");
124    }    }
125    else if ($type == 'radios') {    else if ($type == 'radios') {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2