IE标准改变:哪个指针元素绑定到哪个方法?

时间:2015-11-13 17:36:33

标签: internet-explorer internet-explorer-9 internet-explorer-11

IE9-11标准的变化导致我客户的专有代码中的单个按钮异常,这真的很奇怪,其他4个按钮工作正常......

*所以,我需要帮助找到异常的原因......以及如何解决它(bind?)。

我是'新'员工,我在前任的工作中磕磕绊绊;非常感谢任何帮助或建议!

问题概述:5个按钮中的4个在IE 9-11中成功打开请求的报告; 5个按钮中的5个在FF,Chrome和Safari中成功打开请求的报告。 所有按钮ONCE在所有浏览器中导出。

'Event Registration' Button is the Culprit!

**我知道代码杂乱无章;我把它全部留下来让因特网可以看到我正在做的事情。

通过此模板/ x-export.php文件调用该页面

/template/x-export.php

<?

        // increase memory for this program in order to support large data arrays
        ini_set('memory_limit', '256M');

        // set admin flag
        $x_flag->flag_set('x-admin', true);

        // set module flag
        $x_flag->flag_set('x-module', 'export');

        // set submodule flag
        $x_flag->flag_set('x-submodule', 'export');

        // set route flags
        $x_flag->flag_set('x-route', 'x-export');
        $x_flag->flag_set('x-route-group', 'x-export');

        // set page title
        $x_template->template_page_title_set(___('Export Data'));

        // check if admin logged in
        if (!$x_admin->admin_id())
        {
                $x_cookie->cookie_set_session('adminurl', $x_url->url_current());
                $x_route->route_go('/admin-login');
        }

        // check access
        x_Access::access_module_check('export');
        x_Access::access_admin_check('export_view');

        // init export
        x_Export::init();

//      x_Access::access_admin_check('custom_information_upload_add');

//      $_sections = x_Json::json_smart_load_array('client_information_files');

//      $_sections = $x_config->___CONFIG['x_export_sections'];

//print "<pre>";print_r($_sections);exit;

        // process upload file
        if ($x_form->form_int('update'))
        {
//print "<pre>";print_r($_POST);print_r($_FILES);exit;
//print "(" . $x_form->form_str('section') . ")";exit;
                if ($x_form->form_str('section'))
                {
                        $_section = $x_form->form_str('section');
                        if (isset(x_Export::$sections[$_section]))
                        {
                                // set section data array variables
                                $_sectionname = x_Export::name($_section);
                                $_sectionfields = x_Export::fields($_section);
                                $_sectionfieldnames = x_Export::fieldnames($_section);
                                $_sectionfieldtypes = x_Export::fieldtypes($_section);

                                @require_once('/www/liquidx/addon/PHPExcel/PHPExcel.php');

//                              $_tmp_file = $_FILES['upload']['tmp_name'];

//                              $_title = $_sectionname . ' - Exported From ' . $x_config->config_str('company_name');
                                $_title = $_sectionname . ' Data';

                                $objPHPExcel = new PHPExcel();
// Set properties
                                $objPHPExcel->getProperties()->setCreator('LiquidX')
                                        ->setTitle($_title)
                                        ->setSubject($_title)
                                        ->setDescription($_title)
                                        ->setKeywords($_section)
                                        ->setCategory($_section);


/**
 * Fill worksheet from values in array
 *
 * @param   array   $source                 Source array
 * @param   mixed   $nullValue              Value in source array that stands for blank cell
 * @param   string  $startCell              Insert array starting from this cell address as the top left coordinate
 * @param   boolean $strictNullComparison   Apply strict comparison when testing for null values in the array
 * @throws Exception
 * @return PHPExcel_Worksheet
 */

                                // init data array
                                $_data = x_Array::array_init();

                                // query database
                                $_query = "SELECT * FROM `" . $x_db->db_escape($_section) . "` ORDER BY id ASC";

                                // init header field names
                                $_headerfields = x_Array::array_init();

//___oldway___          $_query = "SELECT * FROM `news` WHERE newssectionid = '" . $x_db->db_escape(x_NewsSection::newssection_id()) . "' ORDER BY id DESC LIMIT " . $_start . "," . $_perpage;
                                $_result = $x_db->db_query($_query);
                                while ($_sectiondata = $x_db->db_fetch_assoc($_result))
                                {
                                        // extract allowed field names
                                        if (!x_Array::array_size($_headerfields))
                                        {
                                                foreach ($_sectiondata as $_key => $_value)
                                                {
                                                        if (in_array($_key, $_sectionfields))
                                                        {
//                                                              $_headerfields[] = $_key;
                                                                $_headerfields[] = $_sectionfieldnames[$_key];
                                                        }
                                                }
//print_r($_headerfields);exit;
                                        }

                                        // extract allowed fields and add them to the data array
                                        $_rowdata = x_Array::array_init();
                                        foreach ($_sectiondata as $_key => $_value)
                                        {
                                                if (in_array($_key, $_sectionfields))
                                                {
                                                        if (isset($_sectionfieldtypes[$_key]))
                                                        {
                                                                if (!empty($_sectionfieldtypes[$_key]))
                                                                {
                                                                        $_type = $_sectionfieldtypes[$_key];
                                                                        if ($_type == 'datecode')
                                                                        {
//-YYYY/MM/DD                                                                           $_value = substr($_value, 0, 4) . '/' . substr($_value, 4, 2) . '/' . substr($_value, 6, 2);
                                                                                $_value =  substr($_value, 4, 2) . '/' . substr($_value, 6, 2) . '/' . substr($_value, 0, 4);
                                                                        }
                                                                        elseif ($_type == 'timestamp')
                                                                        {
//-another-option-                                                                              $_value = date("m/d/Y - H:i:s", $_value);
                                                                                $_value = intval($_value) ? date("m/d/Y h:i:sa", $_value) : '';
                                                                        }
                                                                        elseif ($_type == 'yesno')
                                                                        {
                                                                                $_value = intval($_value) ? 'Yes' : 'No';
                                                                        }
                                                                        elseif ($_type == 'dollar')
                                                                        {
                                                                                $_value = '$' . number_format($_value);
                                                                        }
                                                                        elseif ($_type == 'dollarcent')
                                                                        {
                                                                                $_value = '$' . number_format($_value, 2);
                                                                        }
                                                                        elseif ($_type == 'commas')
                                                                        {
                                                                                $_value = number_format($_value);
                                                                        }
                                                                        elseif ($_type == 'uppercase')
                                                                        {
                                                                                $_value = strtoupper($_value);
                                                                        }
                                                                        elseif ($_type == 'lowercase')
                                                                        {
                                                                                $_value = strtolower($_value);
                                                                        }
                                                                        elseif ($_type == 'decimal1')
                                                                        {
                                                                                $_value = number_format($_value, 1);
                                                                        }
                                                                        elseif ($_type == 'decimal2')
                                                                        {
                                                                                $_value = number_format($_value, 2);
                                                                        }
                                                                        elseif ($_type == 'eventname')
                                                                        {
                                                                                x_Event::init($_value);
                                                                                $_value = strlen(x_Event::str('name')) ? x_Event::str('name') : $_value;
                                                                        }
                                                                        elseif ($_type == 'eventsectionname')
                                                                        {
                                                                                x_EventSection::init($_value);
                                                                                $_value = strlen(x_EventSection::name()) ? x_EventSection::name() : $_value;
                                                                        }
                                                                        elseif ($_type == 'locationname')
                                                                        {
                                                                                x_Location::init($_value);
                                                                                $_value = x_Location::str('name');
                                                                        }
                                                                        elseif (preg_match("/^json\:/i", $_type))
                                                                        {
                                                                                @list(,$_jsonfile,$_jsonfield) = explode(':', $_type, 3);
                                                                                $_subdata = x_Json::json_smart_load_array($_jsonfile);
//if ($_value) { print "($_jsonfile)\n"; print_r($_subdata);exit;print "($_value)($_jsonfield)";exit; }
                                                                                if (is_array($_subdata))
                                                                                {
                                                                                        if (isset($_subdata[$_value]))
                                                                                        {
                                                                                                if (empty($_jsonfield))
                                                                                                {
                                                                                                        $_value = $_subdata[$_value];
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                        if (isset($_subdata[$_value][$_jsonfield]))
                                                                                                        {
                                                                                                                $_value = $_subdata[$_value][$_jsonfield];
                                                                                                        }
                                                                                                }
                                                                                        }
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                        $_rowdata[] = $_value;
                                                }
                                        }
                                        $_data[] = $_rowdata;
                                }


                                array_unshift($_data, $_headerfields);

/*
                                if (x_Array::array_size($_data))
                                {
                                        $_rowdata = x_Array::array_init();
                                        foreach ($_sectionfields as $_key => $_value)
                                        {
                                                if (in_array($_key, $_sectionfields))
                                                {
                                                        $_rowdata[] = $_sectiondata_key;
                                                }
                                        }
                                        array_unshift($_rowdata, $_data);
                                }
*/

//-debug-               print_r($_data);exit;

                                $objPHPExcel->getActiveSheet()->fromArray($_data, NULL, 'A1');

                                $objPHPExcel->getActiveSheet()->setTitle($_title);

                                $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
                                $_filename = x_Str::str_seo($_title) . '.xlsx';
                                $_filepath = $x_config->path_upload_custom($_filename);
                                $objWriter->save($_filepath);

                                echo    $x_config->config_str('route_upload') . '/' . $_filename;
/*
//                              header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
                                header('Content-Type: application/octet-stream');
                                header("Content-Disposition: attachment; filename=" . $_filename);
                                header("Expires: 0");
                                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                                header("Cache-Control: private", false);
                                header('Content-Length: ' . filesize($_filepath));
                                ob_clean();
                                flush();
                                readfile($_filepath);
*/

//                              $x_route->route_go('/x-export');

                                // redirect user to exported data file for download
//                              $x_route->route_go($x_config->config_str('route_upload') . '/' . $_filename);

                                // done
                                die();


/*
                                $reader = PHPExcel_IOFactory::load($_tmp_file);
                                $sheet = $reader->getActiveSheet();
                                $_data = $sheet->toArray(null, true, true, true);

//print "<pre>";print_r($_data);exit;
                                $_headers = $_data[1];
//                              $_headers = array_shift($_data);
//print "Headers<pre>";print_r($_headers);exit;


                                $_field = false;
                                if (isset($_sections[$_section]['group_field']))
                                {
                                        if (!empty($_sections[$_section]['group_field']))
                                        {
//print "<pre>";print_r($_sections[$_section]);exit;
                                                foreach ($_headers as $_key => $_value)
                                                {
                                                        if (!empty($_value))
                                                        {
                                                                if (strtolower($_value) == strtolower($_sections[$_section]['group_field']))
                                                                {
//print "key($_key) = value($_value)<br />";
                                                                        $_field = $_key;
                                                                        break;
                                                                }
                                                        }
                                                }
                                        }
                                }

                                foreach ($_data as $_key => $_subdata)
                                {
                                        foreach ($_subdata as $_subkey => $_subvalue)
                                        {
                                                $_data[$_key][$_subkey] = x_Str::str_filter_html($_subvalue);
                                        }
                                }

                                file_put_contents($x_config->path($_section . '.dat', 'file/information/'), serialize($_data));
*/

//print "($_tmp_file)";exit;

                                // done, show continue page
//                              $_returl = strlen($x_cookie->cookie_str('x_lasturl')) ? $x_cookie->cookie_str('x_lasturl') : '/';
//                              $x_template->continue_page(___('File Uploaded'), ___("Your <strong>" . $_sections[$_section]['name'] . "</strong> file has been uploaded and imported successfully!", ___('File Uploaded')), '', '/x-export');
                        }
                }
        }

        // display template
        $x_template->template_show('x-export');

这个/action/x-export.php填充'sections'/按钮并在'submit'时从db中分配变量。

/action/x-export.php

</style>
<section id="x-export">
        <div class="page-body">
                <header id="page-body-header">
                        <h1>{{flag:page-header}}</h1>
                        <h4>Use this area to export data from the database.</h4>
                </header>
<?
//      $_sections = x_Json::json_smart_load_array('client_information_files');

//      $_sections = $x_config->___CONFIG['x_export_sections'];

/*
        $_sections = x_Array::array_init();
        foreach ($x_config->___CONFIG as $_key => $_value)
        {
                if (preg_match("/^x_export_section_/i", $_key))
                {
                        $_section = preg_replace("/^x_export_section_/i", "", $_key);
                        if (!preg_match("/\_/", $_section))
                        {
                                if ($x_config->config_int('x_export_section_' . $_section . '_active'))
                                {
                                        $_sections[$_section] = $x_config->config_str('x_export_section_' . $_section . '_name');
                                }
                        }
                }
        }
*/

        if (is_array(x_Export::$sections))
        {

//print "<pre>";print_r($_sections);exit;
                foreach (x_Export::$sections as $_section => $_sectiondata)
                {
//print "<pre>";print_r($_sectiondata);exit;
                        $_sectionname = $_sectiondata['name'];
//-replaced-            if ($x_config->config_int('x_export_' . $_section . '_active'))
//-replaced-            {

                        $_filetime = file_exists($x_config->path($_section . '.dat', 'file/information/')) ? filemtime($x_config->path($_section . '.dat', 'file/information/')) : 0;
                        $_timestr = intval($_filetime) ? '<span>' . date('Y-m-d', $_filetime) . '</span>' : '';
//                      $_timestr = intval($_filetime) ? '<span>(' . date('Y-m-d', $_filetime) . ' / ' . date('h:ia', $_filetime) . ')</span>' : '';
?>
                <div class="x-export-section">
                        <form role="form" method="post" class="x-form" id="x-<?= $_section; ?>-form">
                                <input id="x-<?= $_section; ?>-update" type="hidden" name="update" value="1" />
                                <input id="x-<?= $_section; ?>-sessionid" type="hidden" name="sessionid" value="<?= $x_user->user_sessionid(); ?>" />
                                <input id="x-<?= $_section; ?>-authcode" type="hidden" name="authcode" value="<?= $x_user->user_authcode(); ?>" />
                                <input id="x-<?= $_section; ?>-section" type="hidden" name="section" value="<?= $_section; ?>" />
                                <div class="x-field">
                                        <input id="x-<?= $_section; ?>-submit" class="x-button-submit" type="submit" name="submit" value="<?= $_sectionname; ?>" />
                                </div>
                        </form>
                </div>
<?
                }
        }
?>


        </div>

<script>
$(document).ready(function()
{

        $('[id^=x-][id$=-submit]').on('click', function(evt)
        {
                evt.preventDefault();
//alert('check');
                var     x_section = $(this).attr('id').replace(/^x-/gm, '').replace(/-submit$/gm, '');
                var     x_last_progress_pct = 0;


                $.ajax(
                {
                        type:   'post',
                        url:            '/x-export',
                        data:   {
                                                update:         1,
                                                imageupload:    1,
                                                sessionid:      $('#x-' + x_section + '-sessionid').val(),
                                                authcode:               $('#x-' + x_section + '-authcode').val(),
                                                section:                $('#x-' + x_section + '-section').val()
                                        },
                        success:        function(strUrl)
                                        {
//console.log(strUrl);
                                                if (!$('#x-export-download-frame'))
                                                {
                                                        $('body').append('<iframe id="x-export-download-frame" style="display: none"><iframe>')
                                                }
                                                $('#x-export-download-frame').remove();
                                                $('body').append('<iframe id="x-export-download-frame" style="display: none"><iframe>')
//-test-
                                                $('#x-export-download-frame').attr('src', strUrl);

//                                              $('#x-export-download-frame').attr('src', '/upload/events-data.xlsx');
// $("#iframeID").attr('src', 'downloadFileURL');
                                        }
                });

                return  false;
/*
                $('#x-' + x_section + '-form').ajaxForm({
                        data:                   {
                                                                update:         1,
                                                                imageupload:    1,
                                                                sessionid:      $('#x-' + x_section + '-sessionid').val(),
                                                                authcode:               $('#x-' + x_section + '-authcode').val()
                                                                section:                $('#x-' + x_section + '-section').val()
                                                        },
                        beforeSubmit:           function(formData, jqForm, options)
                                                        {
                                                        },
                        uploadProgress: function (event, position, total, percentComplete)
                                                        {
                                                        },
                        success:                        function(strData)
                                                        {

//console.log(retstr);
//alert('success');
                                                        }
                }).submit();
*/
        }); 




});
</script>

</section>

因为问题不在于数据被拉动,我猜测“事件注册”导出的异常(IE中的死/无动作)在IE或代码中。

0 个答案:

没有答案