コード例 #1
0
ファイル: Form.php プロジェクト: CE-Webmaster/CE-Hub
    protected function _afterToHtml($html)
    {
        $html .= '
<script type="text/javascript">

    getElementsByClass = function(classList, node) {
        var node = node || document;
        if(node.getElementsByClassName) {
            return node.getElementsByClassName(classList);
        } else {
            var nodes = node.getElementsByTagName("*"),
            nodesLength = nodes.length,
            classes = classList.split(/\\s+/),
            classesLength = classes.length,
            result = [], i,j;
            for(i = 0; i < nodesLength; i++) {
                for(j = 0; j < classesLength; j++)  {
                    if(nodes[i].className.search("\\\\b" + classes[j] + "\\\\b") != -1) {
                        result.push(nodes[i]);
                        break;
                    }
                }
            }
            return result;
        }
    }

    var fieldsets = getElementsByClass("magicslideshowFieldset");
    var header = null;
    var buttons = null;
    var magicslideshowFieldsetId = "";
    for(var i = 0, l = fieldsets.length; i < l; i++) {
        header = fieldsets[i].previousSibling;
        while(header.nodeType!=1) {
            header = header.previousSibling;
        }
        header.style.cursor = "pointer";
        buttons = getElementsByClass("form-buttons", header);
        buttons[0].innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        buttons[0].className += " fieldsetOpen";
        header.onclick = function() {
            var buttons = getElementsByClass("form-buttons", this);
            var fieldset = this.nextSibling;
            while(fieldset.nodeType!=1) {
                fieldset = fieldset.nextSibling;
            }
            if(buttons[0].className.match(/\\bfieldsetOpen\\b/)) {
                buttons[0].className = buttons[0].className.replace(/\\bfieldsetOpen\\b/, "fieldsetClose");
                fieldset.style.display = "none";
                this.style.marginBottom = "5px";
            } else {
                buttons[0].className = buttons[0].className.replace(/\\bfieldsetClose\\b/, "fieldsetOpen");
                fieldset.style.display = "block";
                this.style.marginBottom = "0px";
            }
            return false;
        }
        var id = fieldsets[i].id.replace(/_group_fieldset_\\d+/g, "");
        if(magicslideshowFieldsetId != id) {
            magicslideshowFieldsetId = id;
        } else {
            header.click();
        }
    }


</script>
';
        return parent::_afterToHtml($html);
    }
コード例 #2
0
ファイル: Form.php プロジェクト: monkviper/magento-lite
 /**
  * Append dependence block at then end of form block
  *
  *
  */
 protected function _afterToHtml($html)
 {
     if ($this->_getDependence()) {
         $html .= $this->_getDependence()->toHtml();
     }
     $html = parent::_afterToHtml($html);
     return $html;
 }
コード例 #3
0
ファイル: Form.php プロジェクト: buttasg/cowgirlk
    protected function _afterToHtml($html)
    {
        $html .= '
<script type="text/javascript">

    getElementsByClass = function(classList, node) {
        var node = node || document;
        if(node.getElementsByClassName) {
            return node.getElementsByClassName(classList);
        } else {
            var nodes = node.getElementsByTagName("*"),
            nodesLength = nodes.length,
            classes = classList.split(/\\s+/),
            classesLength = classes.length,
            result = [], i,j;
            for(i = 0; i < nodesLength; i++) {
                for(j = 0; j < classesLength; j++)  {
                    if(nodes[i].className.search("\\\\b" + classes[j] + "\\\\b") != -1) {
                        result.push(nodes[i]);
                        break;
                    }
                }
            }
            return result;
        }
    }

    var fieldsets = getElementsByClass("magiczoomplusFieldset");
    var header = null;
    var buttons = null;
    var magiczoomplusFieldsetId = "";
    for(var i = 0, l = fieldsets.length; i < l; i++) {
        header = fieldsets[i].previousSibling;
        while(header.nodeType!=1) {
            header = header.previousSibling;
        }
        header.style.cursor = "pointer";
        buttons = getElementsByClass("form-buttons", header);
        buttons[0].innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        buttons[0].className += " fieldsetOpen";
        header.onclick = function() {
            var buttons = getElementsByClass("form-buttons", this);
            var fieldset = this.nextSibling;
            while(fieldset.nodeType!=1) {
                fieldset = fieldset.nextSibling;
            }
            if(buttons[0].className.match(/\\bfieldsetOpen\\b/)) {
                buttons[0].className = buttons[0].className.replace(/\\bfieldsetOpen\\b/, "fieldsetClose");
                fieldset.style.display = "none";
                this.style.marginBottom = "5px";
            } else {
                buttons[0].className = buttons[0].className.replace(/\\bfieldsetClose\\b/, "fieldsetOpen");
                fieldset.style.display = "block";
                this.style.marginBottom = "0px";
            }
            return false;
        }
        var id = fieldsets[i].id.replace(/_group_fieldset_\\d+/g, "");
        if(magiczoomplusFieldsetId != id) {
            magiczoomplusFieldsetId = id;
        } else {
            header.click();
        }
    }
    initOptionsValidation("magiczoomplus[product][template]", "magiczoomplus[product][magicscroll]");
    var magicscrollIcon = document.createElement("img");
    magicscrollIcon.id = "magicscroll_icon";
    magicscrollIcon.src = "' . $this->getSkinUrl("magiczoomplus/magicscroll.png") . '";
    document.getElementById("product-magicscrollYes").parentNode.insertBefore(magicscrollIcon, document.getElementById("product-magicscrollYes"));


</script>
';
        return parent::_afterToHtml($html);
    }
コード例 #4
0
ファイル: Form.php プロジェクト: buttasg/cowgirlk
 protected function _afterToHtml($html)
 {
     $html .= '<script type="text/javascript">addForm = new varienForm(\'add_form\', \'\');</script>';
     return parent::_afterToHtml($html);
 }
コード例 #5
0
 protected function _afterToHtml($html)
 {
     $html = str_replace('__*__', ' <span class="required">*</span>', $html);
     return parent::_afterToHtml($html);
 }