From 647950e4fd2af4bd1fb66f52d1bcd5a0d155685b Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Fri, 26 Feb 2010 08:08:56 +0000 Subject: [PATCH] + add the feature of online help link and required fields note. --- trunk/config/config.php | 5 ++++- trunk/lib/front/front.class.php | 28 +++++++++++++++++++--------- trunk/www/js/my.js | 25 +++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/trunk/config/config.php b/trunk/config/config.php index d0cd836d8b..ecbc9a7e27 100644 --- a/trunk/config/config.php +++ b/trunk/config/config.php @@ -22,6 +22,7 @@ * @link http://www.zentao.cn */ $config->version = '0.5 beta'; // 版本号,切勿修改。 +$config->helpRoot = 'http://doc.zentao.cn/help/'; $config->encoding = 'UTF-8'; // 网站的编码。 $config->cookiePath = '/'; // cookie的有效路径。 $config->cookieLife = time() + 2592000; // cookie的生命周期。 @@ -34,9 +35,11 @@ $config->methodVar = 'f'; // requestType=GET: $config->viewVar = 't'; // requestType=GET: 模板变量名。 $config->views = ',html,'; // 支持的视图列表。 -$config->langs = 'en'; // 支持的语言列表。 $config->themes = 'default'; // 支持的主题列表。 +$config->langs['en'] = 'English'; +$config->langs['zh-cn'] = 'Chinese Simplified'; + $config->super2OBJ = true; // 是否通过对象来访问全局变量。 $config->default->view = 'html'; // 默认的视图格式。 diff --git a/trunk/lib/front/front.class.php b/trunk/lib/front/front.class.php index adf63c9da7..ce061cea2b 100644 --- a/trunk/lib/front/front.class.php +++ b/trunk/lib/front/front.class.php @@ -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 = << -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'; EOT; diff --git a/trunk/www/js/my.js b/trunk/www/js/my.js index 8f3a802499..87c47032d3 100644 --- a/trunk/www/js/my.js +++ b/trunk/www/js/my.js @@ -98,11 +98,34 @@ function switchAccount(account) location.href=link; } +/* 璁剧疆ping鐨勫湴鍧锛岄槻姝ession瓒呮椂銆*/ 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(' * '); + } +} + +/* 璁剧疆甯姪閾炬帴銆*/ +function setHelpLink() +{ + $('input[id],select[id],textarea[id]').each(function() + { + if(!$(this).attr('name')) return; + $(this).after(' ? '); + } + ); +} + /* 闇瑕佷笉闇瑕乸ing锛屽凡淇濊瘉session涓嶈繃鏈熴 */ needPing = true; @@ -110,5 +133,7 @@ needPing = true; $(document).ready(function() { setNowrapObjTitle(); + setHelpLink(); + setRequiredFields(); if(needPing) setTimeout('setPing()', 1000 * 60 * 5); // 5鍒嗛挓涔嬪悗寮濮媝ing銆 });