Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
chenfeiCF
2016-03-23 12:13:38 +08:00
5 changed files with 30 additions and 5 deletions
-1
View File
@@ -591,7 +591,6 @@ class baseControl
$this->output = json_encode($output);
}
/**
/**
* 默认渲染方法,适用于viewType = html的时候。
* Default parse method when viewType != json, like html.
+3 -1
View File
@@ -595,7 +595,9 @@ class baseHelper
*/
public static function isAjaxRequest()
{
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
$isAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
if(!$isAjax) $isAjax = (isset($_GET['HTTP_X_REQUESTED_WITH']) && $_GET['HTTP_X_REQUESTED_WITH'] == 'true');
return $isAjax;
}
/**
+2 -1
View File
@@ -1535,6 +1535,7 @@ class baseRouter
}
unset($passedParams['onlybody']);
unset($passedParams['HTTP_X_REQUESTED_WITH']);
$passedParams = array_values($passedParams);
$i = 0;
foreach($defaultParams as $key => $defaultValue)
@@ -1708,7 +1709,7 @@ class baseRouter
if(is_file($multiConfigFile)) include $multiConfigFile;
}
if(empty($this->siteCode))
if(!empty($this->siteCode))
{
$siteConfigFile = $this->configRoot . "sites/{$this->siteCode}.php";
if(is_file($siteConfigFile)) include $siteConfigFile;
+2 -2
View File
@@ -28,7 +28,7 @@
<div id='casesResults'>
<table class='table table-condensed table-hover' style='border: 1px solid #ddd; word-break:break-all'>
<?php $count = count($results);?>
<caption class='text-left' style='border: 1px solid #ddd; border-bottom: none;'>
<caption class='text-left'>
<strong><?php echo $lang->testcase->result?> &nbsp;<span> <?php printf($lang->testtask->showResult, $count)?></span> <span class='result-tip'></span></strong>
</caption>
<?php $failCount = 0; ?>
@@ -81,7 +81,7 @@
<?php endforeach;?>
</table>
<div id='resultTip' class='hide'><?php if($count > 0) echo $failCount > 0 ? "<span>" . sprintf($lang->testtask->showFail, $failCount) . "</span>":"<span class='text-success'>{$lang->testtask->passAll}</span>";?></div>
<style>.table-hover tr.result-detail:hover td {background: #fff}</style>
<style>.table-hover tr.result-detail:hover td {background: #fff} #casesResults > table > caption {border: 1px solid #ddd; margin-bottom: -1px}</style>
</div>
</div>
</div>
+23
View File
@@ -1,3 +1,4 @@
var ajaxFormUrl = '';
$.extend(
{
ajaxForm: function(formID, callback)
@@ -9,6 +10,28 @@ $.extend(
timeout : config.timeout,
dataType:'json',
beforeSubmit:function(arr, $form, options)
{
/* Check should use frame. */
var feature = {};
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
feature.formdata = window.FormData !== undefined;
var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
var hasFileInputs = fileInputs.length > 0;
var mp = 'multipart/form-data';
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
var fileAPI = feature.fileapi && feature.formdata;
var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
/* Append HTTP_X_REQUESTED_WITH on url when shouldUseFrame is true. */
if(shouldUseFrame)
{
if(ajaxFormUrl == '')ajaxFormUrl = options.url;
if(options.url != ajaxFormUrl) options.url = ajaxFormUrl;
options.url = options.url.indexOf('&') >= 0 ? options.url + '&HTTP_X_REQUESTED_WITH=true' : options.url + '?HTTP_X_REQUESTED_WITH=true';
}
},
success:function(response)
{
$.enableForm(formID);