예제 #1
0
    function display() {
        if (!$this->enabled) {
            $selectDisabled = "DISABLED";
            $onSubmit = "";
        } elseif (!$this->error) {
            $selectDisabled = "";
            $onSubmit = 'onsubmit="showQAPopup(event,\'' . urlStrRedirect($this->module . "/" . $this->submod . "/" . $this->action, $this->params) . '&launchAction=\' + $(\'launchAction\').value); return false;"';
        } else {
            $selectDisabled = "DISABLED";
            $onSubmit = "";
        }

        if (!$this->error && count($this->list) > 0) {
            $label = new RenderedLabel(3, sprintf(_T('Quick action on %s', 'msc'), $this->qa_on_name));
            $label->display();

?>
    <script type="text/javascript">
            document.observe("dom:loaded", function() { 
                var inputImg = $('launchActionImg');
                var src = inputImg.src;
                var style = inputImg.style;

                var inputImgInactive= new Element("img", {src: src, style: style, id: "launchActionImg"});
                var inputImgActive= new Element("input", {src: src, style: style, type: "image", id: "launchActionImg"});
                
                inputImg.replace(inputImgInactive.setOpacity(0.3));

                $('launchAction').observe('change', function() {
                    if ($('launchAction').selectedIndex == 0) {
                        $('launchActionImg').replace(inputImgInactive.setOpacity(0.3));
                    }
                    else {
                        $('launchActionImg').replace(inputImgActive);
                    }
                });
            });
</script>
<?php

            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            <form ' . $onSubmit . ' name="' . $this->name . '" id="'.$this->name . '">
                            <select name="launchAction" id="launchAction" style="border: 1px solid grey;" ' . $selectDisabled . '>
                                <option value="">'._T('Execute action...', 'msc').'</option>';
            foreach ($this->list as $script) {
                $script->display();
            }
            print '</select>';
            $img = new RenderedImgInput('/mmc/modules/msc/graph/images/button_ok.png');
            if ($this->enabled) {
                $img->display();
            } else {
                $img->displayWithNoRight();
            }
            print '
                            </form>
                        </td>
                        </tr>
                    </table>
                </div>';
        } elseif (!$this->error) {
            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            '._T('Quick action list is empty', 'msc').'
                        </td>
                        </tr>
                    </table>
                </div>';
        } else {
            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            '.$this->errmsg.'
                        </td>
                        </tr>
                    </table>
                </div>';
        }
?>
<script text="text/javascript">
function showQAPopup(evt, url) {
    $('popup').style.width = '300px';
    /*new Ajax.Updater('__popup_container', url, {onComplete: displayPopup(evt), evalScripts:true});*/
    new Ajax.Request(url, {
        onSuccess: function(t) {
            try {
                $('__popup_container').update(t.responseText);
            }
            catch(ex) {
                $('__popup_container').innerHTML = t.responseText;
            }
            $('popup').setStyle({"top": "280px",
                                 "left": "210px"
                                });
        },
        onComplete: displayPopup(evt)
    });
}
</script>
<?php
    }
예제 #2
0
    function display()
    {
        if (!$this->enabled) {
            $selectDisabled = "DISABLED";
            $onSubmit = "";
        } elseif (!$this->error) {
            $selectDisabled = "";
            $onSubmit = 'onsubmit="showQAPopup(event,\'' . urlStrRedirect($this->module . "/" . $this->submod . "/" . $this->action, $this->params) . '&launchAction=\' + jQuery(\'#launchAction\').val()); return false;"';
        } else {
            $selectDisabled = "DISABLED";
            $onSubmit = "";
        }
        if (!$this->error && count($this->list) > 0) {
            $label = new RenderedLabel(3, sprintf(_T('Quick action on %s', 'msc'), $this->qa_on_name));
            $label->display();
            ?>
            <script type="text/javascript">
                /* ==> NOT USED
                 document.observe("dom:loaded", function() {
                 var inputImg = $('launchActionImg');
                 var src = inputImg.src;
                 var style = inputImg.style;

                 var inputImgInactive= new Element("img", {src: src, style: style, id: "launchActionImg"});
                 var inputImgActive= new Element("input", {src: src, style: style, type: "image", id: "launchActionImg"});

                 inputImg.replace(inputImgInactive.setOpacity(0.3));

                 $('launchAction').observe('change', function() {
                 if ($('launchAction').selectedIndex == 0) {
                 $('launchActionImg').replace(inputImgInactive.setOpacity(0.3));
                 }
                 else {
                 $('launchActionImg').replace(inputImgActive);
                 }
                 });
                 });
                 */

                jQuery(function() {
                    //jQuery('#launchActionImg')

                    jQuery('#launchActionImg').attr('src', 'modules/msc/graph/images/status/success.png').hide();

                    jQuery('#launchAction').change(function() {
                        if (jQuery(this).val() == '')
                            jQuery('#launchActionImg').hide();
                        else
                            jQuery('#launchActionImg').show();
                    });

                });
            </script>
            <?php 
            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            <form ' . $onSubmit . ' name="' . $this->name . '" id="' . $this->name . '">
                            <select name="launchAction" id="launchAction" style="border: 1px solid grey;" ' . $selectDisabled . '>
                                <option value="">' . _T('Execute action...', 'msc') . '</option>';
            foreach ($this->list as $script) {
                $script->display();
            }
            print '</select>';
            $img = new RenderedImgInput('/mmc/modules/msc/graph/images/button_ok.png');
            if ($this->enabled) {
                $img->display();
            } else {
                $img->displayWithNoRight();
            }
            print '
                            </form>
                        </td>
                        </tr>
                    </table>
                </div>';
        } elseif (!$this->error) {
            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            ' . _T('Quick action list is empty', 'msc') . '
                        </td>
                        </tr>
                    </table>
                </div>';
        } else {
            print '
                <div id="msc-standard-host-actions"> <!-- STANDARD HOST ACTIONS -->
                    <table>
                        <tr>
                        <td>
                            ' . $this->errmsg . '
                        </td>
                        </tr>
                    </table>
                </div>';
        }
        ?>
        <script text="text/javascript">
            function showQAPopup(evt, url) {
                PopupWindow(evt, url, 300, function(evt) {
                    jQuery('#popup').css({
                        'left': '210px',
                        'top': '280px'
                    });
                    jQuery("#overlay").fadeIn();
                });
            }
        </script>
        <?php 
    }