/** * Return footer html for fieldset * Add extra tooltip comments to elements * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ protected function _getFooterHtml($element) { $cronPath = Mage::getBaseDir() . '/shell/bronto/cron.php'; $phpPath = exec('which php'); $html = "<tr><td> </td>\n <td id=\"bronto-magecron-example\" colspan=\"3\">\n <em style=\"margin:5px;\">* Note: You will need to change the \$CRON_USER to match the cron user in your environment.</em>\n <br/>\n <strong style=\"margin:5px;\">To setup the cron script, you will need to add a command to your crontab file. Here are some examples:</strong>\n <div style=\"border:1px solid #ccc; padding:5px; margin:5px;\">\n<strong>To run the API Send Cron every minute:</strong>\n<pre>* * * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t send</pre>\n<strong>To run the API Retry Cron every 2 minutes:</strong>\n<pre>*/2 * * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t api</pre>\n<strong>To run the Reminder Cron every 15 minutes:</strong>\n<pre>*/15 * * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t reminder</pre>\n<strong>To run the Order Import Cron once Daily at Midnight:</strong>\n<pre>0 0 * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t order</pre>\n<strong>To run the Product Recommendation Cron once Daily at Midnight:</strong>\n<pre>0 0 * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t product</pre>\n<strong>To run the Customer Import Cron twice Daily:</strong>\n<pre>0 */2 * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t customer</pre>\n<strong>To run the Newsletter Opt-In Cron every 30 minutes:</strong>\n<pre>*/30 * * * * \$CRON_USER {$phpPath} {$cronPath} -a run -t newsletter</pre>\n<strong>To run all Module Crons once Daily:</strong>\n<pre>0 0 * * * \$CRON_USER {$phpPath} {$cronPath} -a run</pre>\n</div>\n</td></tr>"; return $html . parent::_getFooterHtml($element); }
/** * Prepare the layout * * @return Bronto_Common_Block_Adminhtml_System_Config_Cron */ protected function _prepareLayout() { if ($head = $this->getLayout()->getBlock('head')) { $head->addCss('bronto/cron.css'); } return parent::_prepareLayout(); }
protected function _getHeaderHtml($element) { $header = parent::_getHeaderHtml($element); $url = Mage::helper('adminhtml')->getUrl('adminhtml/ExportAdyenSettings'); $header .= '<div class="button-container"><button type="button"' . ' class="button' . '" id="' . $element->getHtmlId() . '-head" onclick="location.href = \'' . $url . '\' "' . $this->getUrl('*/*/state') . '\'); return false;"><span class="state-closed">' . $this->__('Export Settings') . '</span><span class="state-opened">'; return $header; }
public function render(Varien_Data_Form_Element_Abstract $element) { $step = $this->getCsHelper()->getStep(); if ($step != Commercesciences_Base_Helper_Data::STEP_ZERO) { return ''; } return parent::render($element); }
/** * Collapsed or expanded fieldset when page loaded? * * @param Varien_Data_Form_Element_Abstract $element * * @return bool */ protected function _getCollapseState($element) { $helper = Mage::helper('bronto_common/support'); if (!$helper->isRegistered()) { return 1; } return parent::_getCollapseState($element); }
protected function _getFrontendClass($element) { $class = parent::_getFrontendClass($element); if (!Mage::getSingleton('eltrino_diamantedesk/api')->getBranches()) { return $class . ' hidden_row'; } return $class; }
protected function _construct() { parent::_construct(); if (!$this->getTemplate()) { // Set the default template $this->setTemplate("klevu/search/form/information.phtml"); } }
protected function _getFooterHtml($element) { $ajaxUrl = $this->getUrl('support/adminhtml_support/sendmail'); $html = parent::_getFooterHtml($element); $html = '<h4>' . $this->__('Visit ') . '<span style="color: #ea7601; font-weight: normal; text-decoration: underline;">https://www.milople.com/magento-extensions/</span></h4>' . $html; $html .= Mage::helper('adminhtml/js')->getScript(" \n supportForm = new varienForm(\$('{$element->getHtmlId()}'));\n indiesSupport = function(){\n\t\t\t\tif (supportForm.validator.validate()){\n\t\t\t\t\tvar request = new Ajax.Request(\n '{$ajaxUrl}',\n {\n method:'post',\t\t\t\t\t\t\t\n onSuccess: function () {\n \t\t\t\t\t\t\t\talert('Mail has been sent successfully. We will be in touch with you within a short time.');\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('name').value = '';\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('email').value = '';\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('license').value = '';\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('subject').value = '';\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('reason').value = '';\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById('message').value = '';\n \t\t\t\t\t\t\t\t\t},\t\t\t\t\t\t\t\n parameters: Form.serialize(\$('{$element->getHtmlId()}'))\n }\n );\n }\n }\n successResponse = function(transport){\n if (transport && transport.responseText){\n try{\n response = eval('(' + transport.responseText + ')');\t\t\t\t\t\t\n }\n catch (e) {\n response = {};\n }\n }\n if ((typeof response.message) == 'string') {\n \$('ajax-response').update(response.message);\n } else {\n \$('ajax-response').update(response.message.join(\"\\n\"));\n }\n\t\t\t\talert('test1');\n new PeriodicalExecuter(function(pe){ \$('ajax-response').update(''); pe.stop(); }, 5);\n }\n "); return $html; }
/** * Collapsed or expanded fieldset when page loaded? * * @param Varien_Data_Form_Element_Abstract $element * * @return bool */ protected function _getCollapseState($element) { $user = Mage::getSingleton('admin/session')->getUser(); $extra = $user->getExtra(); if (!isset($extra['configState'][$element->getId()])) { return 1; } return parent::_getCollapseState($element); }
/** * Return header comment part of html for fieldset * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderCommentHtml($element) { $groupConfig = $this->getGroup($element)->asArray(); if (empty($groupConfig['help_url']) || !$element->getComment()) { return parent::_getHeaderCommentHtml($element); } $html = '<div class="comment">' . $element->getComment() . ' <a target="_blank" href="' . $groupConfig['help_url'] . '">' . Mage::helper('paypal')->__('Help') . '</a></div>'; return $html; }
/** * Show explanation * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderHtml($element) { $result = ''; $goodBackEnds = array(); $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend()); $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd); $message = ''; $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis'); $optionClasses = array(); $or = "' " . $this->__('or') . " '"; foreach ($dependClasses as $dependClass) { $ourClass = 'MageHost_' . $dependClass; if (mageFindClassFile($dependClass)) { $goodBackEnds[] = $ourClass; } else { $optionClasses[$dependClass] = $ourClass; } } if (empty($goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses)); } elseif (!in_array($currentBackEnd, $goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds)); $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd); $message .= '<br />'; foreach ($optionClasses as $dependClass => $ourClass) { $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass); } if (in_array('MageHost_Cm_Cache_Backend_File', $goodBackEnds)) { $message .= <<<EOF <br /> Please update your <code style="font-weight: normal;">app/etc/local.xml</code>, for example:<br /> <code style="font-weight: normal;"> <config><br /> <global><br /> ...<br /> <strong> <cache><br /> <backend>MageHost_Cm_Cache_Backend_File</backend><br /> </cache><br /> </strong> ...<br /> </global><br /> </config><br /> </code> EOF; } } if (!empty($message)) { $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message); } $result .= sprintf('<p>%s<br />%s</p>', $this->__('Most settings have direct affect.'), $this->__('Settings which affect cache tags have no effect on already cached blocks.')); $result .= parent::_getHeaderHtml($element); return $result; }
/** * @see parent */ public function render(Varien_Data_Form_Element_Abstract $element) { $exampleCode = 'ABC123'; $store = Mage::app()->getStore(); $helper = Mage::helper('bronto_common/coupon'); $comment = $element->getComment(); $comment = str_replace('{baseUrl}', $store->getUrl('/'), $comment); $comment = str_replace('{code}', $helper->getCouponParam(), $comment); $comment = str_replace('{example}', $exampleCode, $comment); $comment = str_replace('{error}', $helper->getErrorCodeParam(), $comment); $element->setComment($comment); return parent::render($element); }
protected function _getHeaderHtml($element) { $html = parent::_getHeaderHtml($element); if (Mage::helper('webforms')->isProduction()) { $html .= '<ul class="messages"><li class="success-msg"><ul><li><span>' . $this->__('License is active.') . '</span></li></ul></li></ul>'; } else { if (!Mage::getStoreConfig('webforms/license/serial')) { $html .= '<ul class="messages"><li class="error-msg"><ul><li><span>' . $this->__('Please, enter serial number.') . '</span></li></ul></li></ul>'; } else { $html .= '<ul class="messages"><li class="error-msg"><ul><li><span>' . $this->__('Incorrect serial number.') . '</span></li></ul></li></ul>'; } } return $html; }
/** * Return header comment part of html for fieldset * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderCommentHtml($element) { $groupConfig = $this->getGroup($element)->asArray(); $pattern = $groupConfig['pattern']; $url = $groupConfig['link_url']; if (empty($pattern) || empty($url)) { return parent::_getHeaderCommentHtml($element); } $message = $this->__($pattern, "<a href='{$url}' target='_blank' style='color:#ea7601'>{$url}</a>"); $html = '<div class="comment">'; $html .= '<p>' . $message . '<p/>'; $html .= '</div>'; $html .= '<br/>'; return $html; }
/** * Show explanation * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function _getHeaderCommentHtml(Varien_Data_Form_Element_Abstract $element) { $result = ''; $message = ''; if (!Mage::getStoreConfigFlag('dev/log/active')) { $message .= <<<EOF Warning: Magento loggig is disabled. To use logging you need to enable it via:<br /> <i>System > Configuration > ADVANCED > Developer > Log Settings</i> EOF; } if (!empty($message)) { $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message); } $result .= parent::_getHeaderCommentHtml($element); return $result; }
/** * Return header comment part of html for fieldset * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderCommentHtml($element) { $groupConfig = $this->getGroup($element)->asArray(); $url = $groupConfig['register_url']; $imgSrc = $this->getSkinUrl('rede/clickpag/images/bt_cadastro.png'); $logoSrc = $this->getSkinUrl('rede/clickpag/images/clickpag_rede.png'); if (empty($url) || !$element->getComment()) { return parent::_getHeaderCommentHtml($element); } $html = '<div class="comment">'; $html .= '<p><img src="' . $logoSrc . '"/><p/>'; $html .= '<p>' . $element->getComment() . '<p/>'; $html .= '<p><a target="_blank" href="' . $url . '"><img src="' . $imgSrc . '"/></a></p>'; $html .= '</div>'; $html .= '<br/>'; return $html; }
/** * Show explanation about Cache Backend that needs to be used * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderHtml($element) { $result = ''; if (is_dir(Mage::getBaseDir('base') . DIRECTORY_SEPARATOR . 'mini')) { $note = ''; $note .= "On our webservers CSS and JavaScript files can be automatically minified to optimize performance.<br />\n"; $note .= "These minified files are cached in the '<code>httpdocs/mini</code>' directory.<br />\n"; $note .= "When the Magento cache is cleaned, this extension will cleanup the minify cache.<br />\n"; $result .= sprintf('<ul class="messages"><li class="notice-msg"><ul><li><span>%s</span></li></ul></li></ul>', $note); } $goodBackEnds = array(); $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend()); $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd); $message = ''; $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis'); $optionClasses = array(); $or = "' " . $this->__('or') . " '"; foreach ($dependClasses as $dependClass) { $ourClass = 'MageHost_' . $dependClass; if (mageFindClassFile($dependClass)) { $goodBackEnds[] = $ourClass; } else { $optionClasses[$dependClass] = $ourClass; } } if (empty($goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses)); } elseif (!in_array($currentBackEnd, $goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds)); $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd); $message .= '<br />'; foreach ($optionClasses as $dependClass => $ourClass) { $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass); } } if (!empty($message)) { $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message); } $result .= parent::_getHeaderHtml($element); return $result; }
/** * Return footer html for fieldset * Add extra tooltip comments to elements * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ protected function _getFooterHtml($element) { $owner = Mage::getStoreConfig('bronto_verify/permissionchecker/owner'); $group = Mage::getStoreConfig('bronto_verify/permissionchecker/group'); $dir = Mage::getStoreConfig('bronto_verify/permissionchecker/directories'); $file = Mage::getStoreConfig('bronto_verify/permissionchecker/files'); if ('' != $owner || '' != $group) { $chown = 'sudo chown -R ' . ('' != $owner ? $owner : '') . ('' != $group ? ':' . $group : '') . ' ./*'; } else { $chown = ''; } $vMage = 'mage'; if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('<', 5)))) { $vMage = 'pear'; } $dPerm = '' == $dir ? '755' : $dir; $fPerm = '' == $file ? '644' : $file; $html = "<tr><td> </td>\n <td colspan=\"3\"><strong style=\"margin:5px;\">To apply permissions, Run These Commands in the shell at the root of your site:</strong>\n <div style=\"border:1px solid #ccc; padding:5px; margin:5px;\">\n<pre>{$chown}\nsudo find . -type d -exec chmod {$dPerm} {} \\;\nsudo find . -type f -exec chmod {$fPerm} {} \\;\nsudo chmod -R 777 media\nsudo chmod -R 777 var\nsudo chmod 550 {$vMage}\nsudo chmod o+w var/.htaccess app/etc</pre>\n</div></td></tr>"; return $html . parent::_getFooterHtml($element); }
/** * Show version info * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderHtml($element) { /** @var JeroenVermeulen_Solarium_Helper_Data $helper */ $helper = Mage::helper('jeroenvermeulen_solarium'); $searchIndexerProcess = $helper->getSearchIndexer(); $urlPath = ''; if (!empty($searchIndexerProcess)) { $urlPath = 'adminhtml/process/reindexProcess/process/' . $searchIndexerProcess->getData('process_id'); } $indexUrl = Mage::helper("adminhtml")->getUrl($urlPath); $howTo = '<ul>'; $howTo .= '<li>' . $helper->__('Step %d', 1) . ': '; $text = $helper->__('Configure and test your [Solr Server].'); $text = str_replace('[', '<!--suppress HtmlUnknownAnchorTarget --> <a onclick="$(\'jeroenvermeulen_solarium_server-state\').value=0; Fieldset.toggleCollapse(\'jeroenvermeulen_solarium_server\');" href="#jeroenvermeulen_solarium_server-head">', $text); $text = str_replace(']', '</a>', $text); $howTo .= $text; $howTo .= '</li>'; $howTo .= '<li>' . $helper->__('Step %d', 2) . ': '; $text = $helper->__('Enable Solarium Search in [General Settings] below, Save Config.'); $text = str_replace('[', '<!--suppress HtmlUnknownAnchorTarget --> <a onclick="$(\'jeroenvermeulen_solarium_general-state\').value=0; Fieldset.toggleCollapse(\'jeroenvermeulen_solarium_general\');" href="#jeroenvermeulen_solarium_general-head">', $text); $text = str_replace(']', '</a>', $text); $howTo .= $text; $howTo .= '</li>'; $howTo .= '<li>' . $helper->__('Step %d', 3) . ': '; $howTo .= '<a href="' . $indexUrl . '">'; $howTo .= $helper->__('Reindex the Catalog Search Index'); $howTo .= '</a>.</li>'; $howTo .= '<li>' . $helper->__('Step %d', 4) . ': '; $howTo .= $helper->__('Test searching via the frontend.'); $howTo .= $helper->__('If searching with a small typo works, Solarium search is active.'); $howTo .= '</ul><br />'; return $howTo . parent::_getHeaderHtml($element); }
/** * Show explanation * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getHeaderHtml($element) { $result = ''; $goodBackEnds = array(); $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend()); $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd); $message = ''; $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis'); $optionClasses = array(); $or = "' " . $this->__('or') . " '"; foreach ($dependClasses as $dependClass) { $ourClass = 'JeroenVermeulen_' . $dependClass; if (mageFindClassFile($dependClass)) { $goodBackEnds[] = $ourClass; } else { $optionClasses[$dependClass] = $ourClass; } } if (empty($goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses)); } elseif (!in_array($currentBackEnd, $goodBackEnds)) { $message .= 'ERROR:'; $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds)); $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd); $message .= '<br />'; foreach ($optionClasses as $dependClass => $ourClass) { $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass); } } if (!empty($message)) { $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message); } $result .= sprintf('<p>%s<br />%s</p>', $this->__('Most settings have direct affect.'), $this->__('Settings which affect cache tags have no effect on already cached blocks.')); $result .= parent::_getHeaderHtml($element); return $result; }
protected function _getHeaderHtml($element) { $headerHtml = parent::_getHeaderHtml($element); $debugInfo = array(); try { // Fetch public IP address of server - important if you have failing FTP transfers and need to add the public IP address to the firewall, etc. $url = 'https://www.xtento.com/license/info/getip'; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $ipAddress = file_get_contents($url); } else { $client = new Zend_Http_Client($url, array('timeout' => 10)); $response = $client->request('GET'); $ipAddress = $response->getBody(); } } catch (Exception $e) { return '------------------------------------------------<div style="display:none">Exception: ' . $e->getMessage() . '</div>' . $headerHtml; } $debugInfo[] = "Public Server IP Address: {$ipAddress}"; $debugInfo[] = "PHP memory_limit: " . ini_get('memory_limit'); $debugInfo[] = "PHP max_execution_time: " . ini_get('max_execution_time'); $debugInfo[] = "Magento Base Path: " . Mage::getBaseDir(); $headerHtml = str_replace('<table cellspacing="0" class="form-list">', implode("<br/>", $debugInfo) . '<table cellspacing="0" class="form-list">', $headerHtml); return $headerHtml; }
protected function _prepareLayout() { $this->getLayout()->getBlock('head')->addCss('ultnotes/css/style.css'); return parent::_prepareLayout(); }
protected function _getHeaderHtml($element) { $headerHtml = parent::_getHeaderHtml($element); if ($this->getGroup() && @current($this->getGroup()->data_model) !== false) { // Set up cache, using the Magento cache doesn't make sense as it won't cache if cache is disabled try { $cacheBackend = new Zend_Cache_Backend(); $cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 43200), array('cache_dir' => $cacheBackend->getTmpDir())); } catch (Exception $e) { return $headerHtml; } // Get data model $dataModelName = @current($this->getGroup()->data_model); $cacheKey = 'info_' . @current(explode("/", $dataModelName)); if (@current($this->getGroup()->module_name) !== false) { $moduleVersion = (string) @Mage::getConfig()->getNode()->modules->{current($this->getGroup()->module_name)}->version; if (!empty($moduleVersion)) { $cacheKey .= '_' . str_replace('.', '_', $moduleVersion); } } // Is the response cached? $cachedHtml = $cache->load($cacheKey); #$cachedHtml = false; // Test: disable cache if ($cachedHtml !== false && $cachedHtml !== '') { $storeHtml = $cachedHtml; } else { try { $dataModel = Mage::getSingleton($dataModelName); $dataModel->afterLoad(); // Fetch info whether updates for the module are available $url = 'ht' . 'tp://w' . 'ww.' . 'xte' . 'nto.' . 'co' . 'm/li' . 'cense/info/'; $version = Mage::getVersion(); $extensionVersion = $dataModel->getValue(); if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $storeHtml = file_get_contents($url . '?version=' . $version . '&d=' . $extensionVersion); } else { $client = new Zend_Http_Client($url, array('timeout' => 10)); $client->setParameterGet('version', $version); $client->setParameterGet('d', $extensionVersion); $response = $client->request('GET'); // Post version /*$client = new Zend_Http_Client($url, array('timeout' => 10)); $client->setParameterPost('version', $version); $client->setParameterPost('d', $extensionVersion); $response = $client->request('POST');*/ $storeHtml = $response->getBody(); } $cache->save($storeHtml, $cacheKey); } catch (Exception $e) { return '------------------------------------------------<div style="display:none">Exception: ' . $e->getMessage() . '</div>' . $headerHtml; } } if (preg_match('/There has been an error processing your request/', $storeHtml)) { return $headerHtml; } $headerHtml = str_replace('</div><table cellspacing="0" class="form-list">', $storeHtml . '</div><table cellspacing="0" class="form-list">', $headerHtml); // below 1.6 $headerHtml = str_replace('</span><table cellspacing="0" class="form-list">', $storeHtml . '</span><table cellspacing="0" class="form-list">', $headerHtml); // after 1.7 } return $headerHtml; }
/** * Add custom css class * * @param Varien_Data_Form_Element_Abstract $element * @return string */ protected function _getFrontendClass($element) { return parent::_getFrontendClass($element) . ' with-button ' . ($this->_isPaymentEnabled($element) ? ' enabled' : ''); }
/** * If all conditions described in <conditions> section of the group description are TRUE - render as it was * specified as <frontend_type>text</frontend_type>. Otherwise don't render anything. * * @param Varien_Data_Form_Element_Abstract $fieldset * @return string */ public function render(Varien_Data_Form_Element_Abstract $fieldset) { $this->_currentGroupName = $fieldset->getLegend(); $group = $this->getGroup(); $doRender = !empty($group) && isset($group->conditions); if ($doRender) { foreach ($group->conditions as $conditionLabels) { /* @var $conditionLabels Mage_Core_Model_Config_Element */ $xpath = ''; $shouldBeEmpty = null; $value = ''; foreach ($conditionLabels as $condition) { foreach ($condition as $conditionElement) { /* @var $conditionElement Mage_Core_Model_Config_Element */ switch ($conditionElement->getName()) { case 'xpath': $xpath = (string) $conditionElement; break; case 'empty': $shouldBeEmpty = true; break; case 'non_empty': $shouldBeEmpty = false; break; case 'value': $value = (string) $conditionElement; break; } } $node = Mage::app()->getConfig()->getNode($xpath); if ($shouldBeEmpty !== null) { $doRender = $shouldBeEmpty ? empty($node) : !empty($node); } else { $doRender = (string) $node == $value; } if (!$doRender) { break; } } } } return $doRender ? parent::render($fieldset) : ''; }
/** * Prepare the layout * * @return Bronto_Common_Block_Adminhtml_System_Config_Cron */ protected function _prepareLayout() { return parent::_prepareLayout(); }
protected function _getFooterHtml($element) { $html = parent::_getFooterHtml($element); $html .= Mage::helper('adminhtml/js')->getScript("\n \$\$('td.form-buttons')[0].update('');\n \$('{$element->getHtmlId()}' + '-head').setStyle('background: none;');\n \$('{$element->getHtmlId()}' + '-head').writeAttribute('onclick', 'return false;');\n \$('{$element->getHtmlId()}').show();\n "); return $html; }
/** * Return header comment part of html for fieldset * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $url = Mage::helper('adminhtml')->getUrl('*/system_email_template'); $element->setComment("Additional configuration located at: <strong>System › <a href=\"{$url}\">Transactional Emails</a></strong><br/><br/>"); return parent::render($element); }
/** * Add conflicts resolution js code to the fieldset * * @param Varien_Data_Form_Element_Abstract $element * @param bool $tooltipsExist Init tooltips observer or not * @return string */ protected function _getExtraJs($element, $tooltipsExist = false) { $js = ' document.observe("dom:loaded", function() { $$(".with-button button.button").each(function(configureButton) { togglePaypalSolutionConfigureButton(configureButton, true); }); var paypalConflictsObject = { "isConflict": false, "ecMissed": false, sharePayflowEnabling: function(enabler, isEvent) { var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0]; if (typeof ecPayflowEnabler == "undefined") { return; } var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler); if (!enabler.enablerObject.ecPayflow) { if ((!ecPayflowScopeElement || !ecPayflowScopeElement.checked) && isEvent && enabler.value == 1 ) { ecPayflowEnabler.value = 0; fireEvent(ecPayflowEnabler, "change"); } return; } var enablerScopeElement = adminSystemConfig.getScopeElement(enabler); if (enablerScopeElement && ecPayflowScopeElement && enablerScopeElement.checked != ecPayflowScopeElement.checked && (isEvent || ecPayflowScopeElement.checked) ) { $(ecPayflowScopeElement).click(); } var ecEnabler = $$(".paypal-ec-enabler")[0]; if (ecPayflowEnabler.value != enabler.value && (isEvent || enabler.value == 1)) { ecPayflowEnabler.value = enabler.value; fireEvent(ecPayflowEnabler, "change"); if (ecPayflowEnabler.value == 1) { if (typeof ecEnabler != "undefined") { var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler); ecEnabler.value = 1; if (ecEnablerScopeElement && ecEnablerScopeElement.checked) { paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false); } paypalConflictsObject.checklessEventAction(ecEnabler, true); } } } if (!isEvent && ecPayflowEnabler.value == 1 && typeof ecEnabler != "undefined") { var ecSolution = $$(".pp-method-express")[0]; if (typeof ecSolution != "undefined" && !$(ecSolution).hasClassName("enabled")) { ecSolution.addClassName("enabled"); } } }, onChangeEnabler: function(event) { paypalConflictsObject.checkPaymentConflicts($(Event.element(event)), "change"); }, onClickEnablerScope: function(event) { paypalConflictsObject.checkPaymentConflicts( $(adminSystemConfig.getUpTr($(Event.element(event))).select(".paypal-enabler")[0]), "click" ); }, getSharedElements: function(element) { var sharedElements = []; adminSystemConfig.mapClasses(element, true, function(elementClassName) { $$("." + elementClassName).each(function(sharedElement) { if (sharedElements.indexOf(sharedElement) == -1) { sharedElements.push(sharedElement); } }); }); if (sharedElements.length == 0) { sharedElements.push(element); } return sharedElements; }, checklessEventAction: function(element, isChange) { var action = isChange ? "change" : "click"; var handler = isChange ? paypalConflictsObject.onChangeEnabler : paypalConflictsObject.onClickEnablerScope; paypalConflictsObject.getSharedElements(element).each(function(sharedElement) { Event.stopObserving(sharedElement, action, handler); if (isChange) { sharedElement.value = element.value; if ($(sharedElement).requiresObj) { $(sharedElement).requiresObj.indicateEnabled(); } } }); if (isChange) { fireEvent(element, "change"); } else { $(element).click(); } paypalConflictsObject.getSharedElements(element).each(function(sharedElement) { Event.observe(sharedElement, action, handler); }); }, ecCheckAvailability: function() { var ecButton = $$(".pp-method-express button.button")[0]; if (typeof ecButton == "undefined") { return; } var couldBeConfigured = true; $$(".paypal-enabler").each(function(enabler) { if (enabler.enablerObject.ecEnabler || enabler.enablerObject.ecConflicts || enabler.enablerObject.ecSeparate ) { return; } if (enabler.value == 1) { couldBeConfigured = false; } }); if (couldBeConfigured) { togglePaypalSolutionConfigureButton(ecButton, true); } else { togglePaypalSolutionConfigureButton(ecButton, false); } }, // type could be "initial", "change", "click" checkPaymentConflicts: function(enabler, type) { var isEvent = (type != "initial"); var ecEnabler = $$(".paypal-ec-enabler")[0]; if (enabler.value == 0) { if (!enabler.enablerObject.ecIndependent && type == "change") { if (typeof ecEnabler != "undefined" && ecEnabler.value == 1) { var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler); if (!ecEnablerScopeElement || !ecEnablerScopeElement.checked) { ecEnabler.value = 0; paypalConflictsObject.checklessEventAction(ecEnabler, true); } } } paypalConflictsObject.ecCheckAvailability(); paypalConflictsObject.sharePayflowEnabling(enabler, isEvent); return; } var confirmationApproved = isEvent; var confirmationShowed = false; // check other solutions $$(".paypal-enabler").each(function(anotherEnabler) { var anotherEnablerScopeElement = adminSystemConfig.getScopeElement(anotherEnabler); if (!confirmationApproved && isEvent || $(anotherEnabler) == enabler || anotherEnabler.value == 0 && (!anotherEnablerScopeElement || !anotherEnablerScopeElement.checked) ) { return; } var conflict = enabler.enablerObject.ecConflicts && anotherEnabler.enablerObject.ecEnabler || enabler.enablerObject.ecEnabler && anotherEnabler.enablerObject.ecConflicts || !enabler.enablerObject.ecIndependent && anotherEnabler.enablerObject.ecConflicts || !enabler.enablerObject.ecEnabler && !anotherEnabler.enablerObject.ecEnabler; if (conflict && !confirmationShowed && anotherEnabler.value == 1) { if (isEvent) { confirmationApproved = confirm(\'' . $this->helper('core')->jsQuoteEscape($this->__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\'); } else { paypalConflictsObject.isConflict = true; } confirmationShowed = true; } if (conflict && confirmationApproved) { anotherEnabler.value = 0; if (anotherEnablerScopeElement && anotherEnablerScopeElement.checked && isEvent) { paypalConflictsObject.checklessEventAction(anotherEnablerScopeElement, false); } paypalConflictsObject.checklessEventAction(anotherEnabler, true); } }); if (!enabler.enablerObject.ecIndependent) { if (!isEvent && (typeof ecEnabler == "undefined" || ecEnabler.value == 0)) { if (!enabler.enablerObject.ecPayflow) { paypalConflictsObject.ecMissed = true; } } else if (isEvent && typeof ecEnabler != "undefined" && confirmationApproved) { var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler); if (ecEnablerScopeElement && ecEnablerScopeElement.checked) { paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false); } if (ecEnabler.value == 0) { ecEnabler.value = 1; paypalConflictsObject.checklessEventAction(ecEnabler, true); } } } if (!confirmationApproved && isEvent) { enabler.value = 0; paypalConflictsObject.checklessEventAction(enabler, true); } paypalConflictsObject.ecCheckAvailability(); paypalConflictsObject.sharePayflowEnabling(enabler, isEvent); } }; // fill enablers with conflict data $$(".paypal-enabler").each(function(enablerElement) { var enablerObj = { ecIndependent: false, ecConflicts: false, ecEnabler: false, ecSeparate: false, ecPayflow: false }; $(enablerElement).classNames().each(function(className) { switch (className) { case "paypal-ec-conflicts": enablerObj.ecConflicts = true; case "paypal-ec-independent": enablerObj.ecIndependent = true; break; case "paypal-ec-enabler": enablerObj.ecEnabler = true; enablerObj.ecIndependent = true; break; case "paypal-ec-separate": enablerObj.ecSeparate = true; enablerObj.ecIndependent = true; break; case "paypal-ec-pe": enablerObj.ecPayflow = true; break; } }); enablerElement.enablerObject = enablerObj; Event.observe(enablerElement, "change", paypalConflictsObject.onChangeEnabler); var enablerScopeElement = adminSystemConfig.getScopeElement(enablerElement); if (enablerScopeElement) { Event.observe(enablerScopeElement, "click", paypalConflictsObject.onClickEnablerScope); } }); // initially uncheck payflow var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0]; if (typeof ecPayflowEnabler != "undefined") { if (ecPayflowEnabler.value == 1) { ecPayflowEnabler.value = 0; fireEvent(ecPayflowEnabler, "change"); } var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler); if (ecPayflowScopeElement && !ecPayflowScopeElement.checked) { $(ecPayflowScopeElement).click(); } } $$(".paypal-enabler").each(function(enablerElement) { paypalConflictsObject.checkPaymentConflicts(enablerElement, "initial"); }); if (paypalConflictsObject.isConflict || paypalConflictsObject.ecMissed) { var notification = \'' . $this->helper('core')->jsQuoteEscape($this->__('The following error(s) occured:')) . '\'; if (paypalConflictsObject.isConflict) { notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('Some PayPal solutions conflict.')) . '\'; } if (paypalConflictsObject.ecMissed) { notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('PayPal Express Checkout is not enabled.')) . '\'; } notification += "\\n" + \'' . $this->helper('core')->jsQuoteEscape($this->__('Please re-enable the previously enabled payment solutions.')) . '\'; setTimeout(function() { alert(notification); }, 1); } $$(".requires").each(function(dependent) { var $dependent = $(dependent); if ($dependent.hasClassName("paypal-ec-enabler")) { $dependent.requiresObj.callback = function(required) { if ($(required).hasClassName("paypal-enabler") && required.value == 0) { $dependent.disable(); } } $dependent.requiresObj.requires.each(function(required) { $dependent.requiresObj.callback(required); }); } }); var originalFormValidation = configForm.validator.options.onFormValidate; configForm.validator.options.onFormValidate = function(result, form) { originalFormValidation(result, form); if (result) { var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0]; if (typeof ecPayflowEnabler == "undefined") { return; } var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler); if ((typeof ecPayflowScopeElement == "undefined" || !ecPayflowScopeElement.checked) && ecPayflowEnabler.value == 1 ) { $$(".paypal-ec-enabler").each(function(ecEnabler) { ecEnabler.value = 0; }); } } } }); '; return parent::_getExtraJs($element, $tooltipsExist) . $this->helper('adminhtml/js')->getScript($js); }
protected function _getFooterHtml($element) { $html = parent::_getFooterHtml($element); //$html = '<h4>' . $this->__('Installed Indies Extensions') . '</h4>' . $html; return $html; }