+ add the feature of online help link and required fields note.

This commit is contained in:
wangchunsheng
2010-02-26 08:08:56 +00:00
parent 28c3b9bab2
commit 647950e4fd
3 changed files with 48 additions and 10 deletions

View File

@@ -22,6 +22,7 @@
* @link http://www.zentao.cn
*/
$config->version = '0.5 beta'; // <20><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ġ<DEB8>
$config->helpRoot = 'http://doc.zentao.cn/help/';
$config->encoding = 'UTF-8'; // <20><>վ<EFBFBD>ı<EFBFBD><C4B1>
$config->cookiePath = '/'; // cookie<69><65><EFBFBD><EFBFBD>Ч·<D0A7><C2B7><EFBFBD><EFBFBD>
$config->cookieLife = time() + 2592000; // cookie<69><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
@@ -34,9 +35,11 @@ $config->methodVar = 'f'; // requestType=GET:
$config->viewVar = 't'; // requestType=GET: ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$config->views = ',html,'; // ֧<>ֵ<EFBFBD><D6B5><EFBFBD>ͼ<EFBFBD>б<EFBFBD><D0B1><EFBFBD>
$config->langs = 'en'; // ֧<>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
$config->themes = 'default'; // ֧<>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
$config->langs['en'] = 'English';
$config->langs['zh-cn'] = 'Chinese Simplified';
$config->super2OBJ = true; // <20>Ƿ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>
$config->default->view = 'html'; // Ĭ<>ϵ<EFBFBD><CFB5><EFBFBD>ͼ<EFBFBD><CDBC>ʽ<EFBFBD><CABD>

View File

@@ -438,17 +438,27 @@ EOT;
global $app, $config;
$defaultViewType = $app->getViewType();
$themeRoot = $app->getWebRoot() . 'theme/';
$moduleName = $app->getModuleName();
$methodName = $app->getMethodName();
$clientLang = $app->getClientLang();
$requiredFields = '';
if(isset($config->$moduleName->$methodName->requiredFields)) $requiredFields = str_replace(' ', '', $config->$moduleName->$methodName->requiredFields);
$js = <<<EOT
<script language = 'javascript'>
webRoot = '$config->webRoot';
requestType = '$config->requestType';
pathType = '$config->pathType';
requestFix = '$config->requestFix';
moduleVar = '$config->moduleVar';
methodVar = '$config->methodVar';
viewVar = '$config->viewVar';
defaultView = '$defaultViewType';
themeRoot = '$themeRoot';
webRoot = '$config->webRoot';
requestType = '$config->requestType';
pathType = '$config->pathType';
requestFix = '$config->requestFix';
moduleVar = '$config->moduleVar';
methodVar = '$config->methodVar';
viewVar = '$config->viewVar';
defaultView = '$defaultViewType';
themeRoot = '$themeRoot';
currentModule = '$moduleName';
currentMethod = '$methodName';
clientLang = '$clientLang';
requiredFields = '$requiredFields';
zentaoHelpRoot = '$config->helpRoot';
</script>
EOT;

View File

@@ -98,11 +98,34 @@ function switchAccount(account)
location.href=link;
}
/* 设置ping的地址防止session超时。*/
function setPing()
{
$('#hiddenwin').attr('src', createLink('index', 'ping'));
}
/* 设置必填字段。*/
function setRequiredFields()
{
if(!requiredFields) return false;
requiredFields = requiredFields.split(',');
for(i = 0; i < requiredFields.length; i++)
{
$('#' + requiredFields[i]).after('<span class="red"> * </span>');
}
}
/* 设置帮助链接。*/
function setHelpLink()
{
$('input[id],select[id],textarea[id]').each(function()
{
if(!$(this).attr('name')) return;
$(this).after(' <a href=' + zentaoHelpRoot + '?lang=' + clientLang + '&module=' + currentModule + '&method=' + currentMethod + '&field=' + $(this).attr('name') + '>?</a> ');
}
);
}
/* 需要不需要ping已保证session不过期。 */
needPing = true;
@@ -110,5 +133,7 @@ needPing = true;
$(document).ready(function()
{
setNowrapObjTitle();
setHelpLink();
setRequiredFields();
if(needPing) setTimeout('setPing()', 1000 * 60 * 5); // 5分钟之后开始ping。
});