<commit_before><?php
/**
 * Created by JetBrains PhpStorm.
 * User: mike
 * Date: 27.10.12
 * Time: 13:54
 * To change this template use File | Settings | File Templates.
 */
class Hackathon_ProductDnD_Model_Observer extends Mage_Core_Block_Template
{
    /**
     * Adds layout handles based on configuration.
     *
     * @param Varien_Event_Observer $observer
     */
    public function addActivationLayoutHandles($observer)
    {
        $request = Mage::app()->getRequest();
        if (Mage::helper('hackathon_productdnd')->isActivated()
            && $request->getModuleName() == 'catalog'
            && $request->getControllerName() == 'category'
            && $request->getActionName() == 'view') {
            $layout = $observer->getLayout();
            $update = $layout->getUpdate();
            $update->addHandle('hackathon_productdnd_enabled');
        }
    }
	
	/**
	 * Adds the sortable.js to the head of the page after the ajax-Request for the category-products
	 * was loaded
	 * 
	 * @param Varien_Event_Observer $observer
	 */
	 public function addSortableScript($observer)
	 {
	 	$this->setTemplate('hackathon/productdnd/sortable.phtml');
		// Mage::log(get_class_methods($this));
		$content = $observer->getResponse()->getContent();
		$additional = $this->toHtml();
		Mage::log($additional);
		$content .= $additional;
	 }
}<commit_msg>[~TASK] add the sortable template to the observer response<commit_after><?php
/**
 * Created by JetBrains PhpStorm.
 * User: mike
 * Date: 27.10.12
 * Time: 13:54
 * To change this template use File | Settings | File Templates.
 */
class Hackathon_ProductDnD_Model_Observer extends Mage_Core_Block_Template
{
    /**
     * Adds layout handles based on configuration.
     *
     * @param Varien_Event_Observer $observer
     */
    public function addActivationLayoutHandles($observer)
    {
        $request = Mage::app()->getRequest();
        if (Mage::helper('hackathon_productdnd')->isActivated()
            && $request->getModuleName() == 'catalog'
            && $request->getControllerName() == 'category'
            && $request->getActionName() == 'view') {
            $layout = $observer->getLayout();
            $update = $layout->getUpdate();
            $update->addHandle('hackathon_productdnd_enabled');
        }
    }
	
	/**
	 * Adds the sortable.js to the head of the page after the ajax-Request for the category-products
	 * was loaded
	 * 
	 * @param Varien_Event_Observer $observer
	 */
	 public function addSortableScript($observer)
	 {
	 	$this->setTemplate('hackathon/productdnd/sortable.phtml');
		$content = $observer->getResponse()->getContent();
		$additional = $this->toHtml();
		Mage::log($additional);
		$content .= $additional;
		$observer->getResponse()->setContent($content);
	 }
}
{'fraction_non_alphanumeric': 0.14208826695371368, 'fraction_numerical': 0.007176175098672408, 'mean_word_length': 3.224242424242424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '416576', 'n_tokens_mistral': 888, 'n_tokens_neox': 809, 'n_words': 174}