Mage_GoogleBase_Block_Adminhtml_Types_Edit Class Reference

Inheritance diagram for Mage_GoogleBase_Block_Adminhtml_Types_Edit:

Mage_Adminhtml_Block_Widget_Form_Container Mage_Adminhtml_Block_Widget_Container Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getHeaderText ()
 getHeaderCssClass ()


Detailed Description

Definition at line 35 of file Edit.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Mage_Adminhtml_Block_Widget_Form_Container.

Definition at line 37 of file Edit.php.

00038     {
00039         parent::__construct();
00040         $this->_blockGroup = 'googlebase';
00041         $this->_controller = 'adminhtml_types';
00042         $this->_mode = 'edit';
00043         $model = Mage::registry('current_item_type');
00044         $this->_removeButton('reset');
00045         $this->_updateButton('save', 'label', $this->__('Save Mapping'));
00046         $this->_updateButton('save', 'id', 'save_button');
00047         $this->_updateButton('delete', 'label', $this->__('Delete Mapping'));
00048         if(!$model->getId()) {
00049             $this->_removeButton('delete');
00050         }
00051 
00052         $this->_formInitScripts[] = '
00053             var itemType = function() {
00054                 return {
00055                     updateAttributes: function() {
00056                         if ($("select_attribute_set").value != "" && $("select_itemtype").value != "" && itemType.confirmChanges())
00057                         {
00058                             var elements = [$("select_attribute_set"),$("select_itemtype"),$("select_target_country")].flatten();
00059                             $(\'save_button\').disabled = true;
00060                             new Ajax.Updater("attributes_details", "'.$this->getUrl('*/*/loadAttributes').'",
00061                                 {
00062                                     parameters:Form.serializeElements(elements),
00063                                     evalScripts:true,
00064                                     onComplete:function(){ $(\'save_button\').disabled = false; }
00065                                 }
00066                             );
00067                         }
00068                     },
00069 
00070                     reloadItemTypes: function() {
00071                         if ($("select_target_country").value != "" && itemType.confirmChanges())
00072                         {
00073                             var elements = [$("select_attribute_set"),$("select_itemtype"),$("select_target_country")].flatten();
00074                             new Ajax.Updater("gbase_itemtype_select", "'.$this->getUrl('*/*/loadItemTypes').'",
00075                                 {
00076                                     parameters:Form.serializeElements(elements),
00077                                     evalScripts:true,
00078                                     onComplete:function(){
00079                                         $(\'save_button\').disabled = false;
00080                                         Event.observe($("select_itemtype"), \'change\', itemType.updateAttributes);
00081                                     }
00082                                 }
00083                             );
00084 
00085                             new Ajax.Updater("attribute_set_select", "'.$this->getUrl('*/*/loadAttributeSets').'",
00086                                 {
00087                                     parameters:Form.serializeElements(elements),
00088                                     evalScripts:true,
00089                                     onComplete:function(){
00090                                         $(\'save_button\').disabled = false;
00091                                         Event.observe($("select_attribute_set"), \'change\', itemType.updateAttributes);
00092                                     }
00093                                 }
00094                             );
00095                             $("attributes_details").innerHTML = "' . $this->__('Please, select Attribute Set and Google Item Type to load attributes') . '";
00096                         }
00097                     },
00098 
00099                     confirmChanges: function() {
00100                         var blocksCount = Element.select($("attributes_details"), "div[id^=gbase_attribute_]").length;
00101                         if (blocksCount > 0 && confirm("'.$this->__('Current Mapping will be reloaded. Continue?').'") || blocksCount == 0)
00102                         {
00103                             return true;
00104                         }
00105                         return false;
00106                     }
00107                 }
00108             }();
00109 
00110              Event.observe(window, \'load\', function(){
00111                 if ($("select_attribute_set")) {
00112                     Event.observe($("select_attribute_set"), \'change\', itemType.updateAttributes);
00113                 }
00114                 if ($("select_itemtype")) {
00115                     Event.observe($("select_itemtype"), \'change\', itemType.updateAttributes);
00116                 }
00117                 if ($("select_target_country")) {
00118                     Event.observe($("select_target_country"), \'change\', itemType.reloadItemTypes);
00119                 }
00120            });
00121         ';
00122     }


Member Function Documentation

getHeaderCssClass (  ) 

Get header CSS class

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Form_Container.

Definition at line 133 of file Edit.php.

00133                                         {
00134         return 'icon-head head-customer-groups';
00135     }

getHeaderText (  ) 

Get header text

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Container.

Definition at line 124 of file Edit.php.

00125     {
00126         if(!is_null(Mage::registry('current_item_type')->getId())) {
00127             return $this->__('Edit Item Type "%s"', $this->htmlEscape(Mage::registry('current_item_type')->getGbaseItemtype()));
00128         } else {
00129             return $this->__('New Item Type');
00130         }
00131     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:14 2009 for Magento by  doxygen 1.5.8