Public Member Functions | |
__construct () | |
getHeaderText () |
Definition at line 35 of file Add.php.
__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 Add.php.
00038 { 00039 parent::__construct(); 00040 00041 $this->_controller = 'review'; 00042 $this->_mode = 'add'; 00043 00044 $this->_updateButton('save', 'label', Mage::helper('review')->__('Save Review')); 00045 $this->_updateButton('save', 'id', 'save_button'); 00046 00047 $this->_updateButton('reset', 'id', 'reset_button'); 00048 00049 $this->_formScripts[] = ' 00050 toggleParentVis("add_review_form"); 00051 toggleVis("save_button"); 00052 toggleVis("reset_button"); 00053 '; 00054 00055 $this->_formInitScripts[] = ' 00056 var review = function() { 00057 return { 00058 productInfoUrl : null, 00059 formHidden : true, 00060 00061 gridRowClick : function(data, click) { 00062 if(Event.findElement(click,\'TR\').title){ 00063 review.productInfoUrl = Event.findElement(click,\'TR\').title; 00064 review.loadProductData(); 00065 review.showForm(); 00066 review.formHidden = false; 00067 } 00068 }, 00069 00070 loadProductData : function() { 00071 var con = new Ext.lib.Ajax.request(\'POST\', review.productInfoUrl, {success:review.reqSuccess,failure:review.reqFailure}, {form_key:FORM_KEY}); 00072 }, 00073 00074 showForm : function() { 00075 toggleParentVis("add_review_form"); 00076 toggleVis("productGrid"); 00077 toggleVis("save_button"); 00078 toggleVis("reset_button"); 00079 }, 00080 00081 updateRating: function() { 00082 elements = [$("select_stores"), $("rating_detail").getElementsBySelector("input[type=\'radio\']")].flatten(); 00083 $(\'save_button\').disabled = true; 00084 var params = Form.serializeElements(elements); 00085 if (!params.isAjax) { 00086 params.isAjax = "true"; 00087 } 00088 if (!params.form_key) { 00089 params.form_key = FORM_KEY; 00090 } 00091 new Ajax.Updater("rating_detail", "'.$this->getUrl('*/*/ratingItems').'", {parameters:params, evalScripts: true, onComplete:function(){ $(\'save_button\').disabled = false; } }); 00092 }, 00093 00094 reqSuccess :function(o) { 00095 var response = Ext.util.JSON.decode(o.responseText); 00096 if( response.error ) { 00097 alert(response.message); 00098 } else if( response.id ){ 00099 $("product_id").value = response.id; 00100 00101 $("product_name").innerHTML = \'<a href="' . $this->getUrl('*/catalog_product/edit') . 'id/\' + response.id + \'" target="_blank">\' + response.name + \'</a>\'; 00102 } else if( response.message ) { 00103 alert(response.message); 00104 } 00105 } 00106 } 00107 }(); 00108 00109 Event.observe(window, \'load\', function(){ 00110 if ($("select_stores")) { 00111 Event.observe($("select_stores"), \'change\', review.updateRating); 00112 } 00113 }); 00114 '; 00115 }
getHeaderText | ( | ) |
Get header text
Reimplemented from Mage_Adminhtml_Block_Widget_Container.
Definition at line 117 of file Add.php.
00118 { 00119 return Mage::helper('review')->__('Add New Review'); 00120 }