diff --git a/module/account/control.php b/module/account/control.php index dda72c1dce..37e0dbf6db 100644 --- a/module/account/control.php +++ b/module/account/control.php @@ -42,6 +42,7 @@ class account extends control $this->view->title = $this->lang->account->common; $this->view->accountList = $accountList; + $this->view->users = $this->loadModel('user')->getPairs('noletter,noempty,noclosed'); $this->view->pager = $pager; $this->view->param = $param; $this->view->orderBy = $orderBy; diff --git a/module/account/ui/browse.html.php b/module/account/ui/browse.html.php index 621402398b..166365cabf 100644 --- a/module/account/ui/browse.html.php +++ b/module/account/ui/browse.html.php @@ -31,7 +31,7 @@ jsVar('sortLink', helper::createLink('account', 'browse', "browseType=$browseTyp dtable ( - set::userMap($accountList), + set::userMap($users), set::cols(array_values($config->account->dtable->fieldList)), set::data($tableData), set::sortLink(jsRaw('createSortLink')), diff --git a/module/instance/js/view.ui.js b/module/instance/js/view.ui.js index b2327d1167..e35b3ad6a9 100644 --- a/module/instance/js/view.ui.js +++ b/module/instance/js/view.ui.js @@ -33,11 +33,36 @@ window.afterPageUpdate = function() if($('#statusTD').data('reload') === true || $('#memoryRate').data('load') == true) { reloadTimes++; - fetchContent({url: $.createLink('instance', 'view', 'id=' + instanceID), - selector: '#instanceInfoContainer', - id: 'instanceInfoContainer', - target: '#instanceInfoContainer', - }); + fetchContent + ({ + url: $.createLink('instance', 'view', 'id=' + instanceID), + selector: '#instanceInfoContainer', + id: 'instanceInfoContainer', + target: '#instanceInfoContainer', + }); } }, 4000); } + +$('.copy-btn').on('click', function() +{ + var copyText = $(this).parent().find('input'); + copyText.show(); + copyText[0].select(); + document.execCommand("Copy"); + copyText.hide(); + + var that = this; + $(that).tooltip + ({ + trigger: 'click', + placement: 'bottom', + title: copied, + tipClass: 'success', + show:true + }); + setTimeout(function() + { + $(that).tooltip('hide'); + }, 2000) +}) \ No newline at end of file diff --git a/module/instance/lang/de.php b/module/instance/lang/de.php index bf13e54c64..4fba0c3c0b 100644 --- a/module/instance/lang/de.php +++ b/module/instance/lang/de.php @@ -57,6 +57,10 @@ $lang->instance->installAt = 'Creation time'; $lang->instance->runDuration = 'Running'; $lang->instance->defaultAccount = 'Default User'; $lang->instance->defaultPassword = 'Default Password'; +$lang->instance->account = 'User'; +$lang->instance->password = 'Password'; +$lang->instance->token = 'Token'; +$lang->instance->copied = 'Copy successful'; $lang->instance->operationLog = 'Operation Record'; $lang->instance->installedService = 'Installed Service'; $lang->instance->runningService = 'Running Service'; diff --git a/module/instance/lang/en.php b/module/instance/lang/en.php index bf13e54c64..4fba0c3c0b 100644 --- a/module/instance/lang/en.php +++ b/module/instance/lang/en.php @@ -57,6 +57,10 @@ $lang->instance->installAt = 'Creation time'; $lang->instance->runDuration = 'Running'; $lang->instance->defaultAccount = 'Default User'; $lang->instance->defaultPassword = 'Default Password'; +$lang->instance->account = 'User'; +$lang->instance->password = 'Password'; +$lang->instance->token = 'Token'; +$lang->instance->copied = 'Copy successful'; $lang->instance->operationLog = 'Operation Record'; $lang->instance->installedService = 'Installed Service'; $lang->instance->runningService = 'Running Service'; diff --git a/module/instance/lang/fr.php b/module/instance/lang/fr.php index bf13e54c64..4fba0c3c0b 100644 --- a/module/instance/lang/fr.php +++ b/module/instance/lang/fr.php @@ -57,6 +57,10 @@ $lang->instance->installAt = 'Creation time'; $lang->instance->runDuration = 'Running'; $lang->instance->defaultAccount = 'Default User'; $lang->instance->defaultPassword = 'Default Password'; +$lang->instance->account = 'User'; +$lang->instance->password = 'Password'; +$lang->instance->token = 'Token'; +$lang->instance->copied = 'Copy successful'; $lang->instance->operationLog = 'Operation Record'; $lang->instance->installedService = 'Installed Service'; $lang->instance->runningService = 'Running Service'; diff --git a/module/instance/lang/zh-cn.php b/module/instance/lang/zh-cn.php index 65d301aabc..b0511be38b 100644 --- a/module/instance/lang/zh-cn.php +++ b/module/instance/lang/zh-cn.php @@ -58,6 +58,10 @@ $lang->instance->installAt = '创建时间'; $lang->instance->runDuration = '已运行'; $lang->instance->defaultAccount = '默认用户'; $lang->instance->defaultPassword = '默认密码'; +$lang->instance->account = '用户名'; +$lang->instance->password = '密码'; +$lang->instance->token = 'Token'; +$lang->instance->copied = '复制成功'; $lang->instance->operationLog = '操作记录'; $lang->instance->installedService = '已安装服务'; $lang->instance->runningService = '运行中的服务'; diff --git a/module/instance/ui/view.html.php b/module/instance/ui/view.html.php index 3bab2d2d5e..f030b46610 100644 --- a/module/instance/ui/view.html.php +++ b/module/instance/ui/view.html.php @@ -13,12 +13,24 @@ declare(strict_types=1); namespace zin; +jsVar('copied', $lang->instance->copied); jsVar('instanceID', $instance->id); $cpuInfo = $this->instance->printCpuUsage($instance, $instanceMetric->cpu, 'array'); $memoryInfo = $this->instance->printMemUsage($instance, $instanceMetric->memory, 'array'); $actions = $this->loadModel('common')->buildOperateMenu($instance); +if($type !== 'store') +{ + $defaultAccount = new stdclass(); + $defaultAccount->username = $instance->account; + $defaultAccount->password = $instance->password; + $defaultAccount->token = $instance->token; + + $lang->instance->defaultAccount = $lang->instance->account; + $lang->instance->defaultPassword = $lang->instance->password; +} + $dbListWg = array(); foreach($dbList as $db) { @@ -149,8 +161,9 @@ div h::th($lang->instance->installBy), h::th($lang->instance->installAt), $type !== 'store' ? null : h::th($lang->instance->runDuration), - $defaultAccount ? h::th($lang->instance->defaultAccount) : null, - $defaultAccount ? h::th($lang->instance->defaultPassword) : null, + !empty($defaultAccount->username) ? h::th($lang->instance->defaultAccount) : null, + !empty($defaultAccount->password) ? h::th($lang->instance->defaultPassword) : null, + !empty($defaultAccount->token) ? h::th($lang->instance->token) : null, $type === 'store' ? null : h::th($lang->instance->browseProject), ), h::tr @@ -170,8 +183,17 @@ div h::td(zget($users, $instance->createdBy, '')), h::td(substr($instance->createdAt, 0, 16)), $type !== 'store' ? null : h::td(common::printDuration($instance->runDuration)), - $defaultAccount ? h::td($defaultAccount->username) : null, - $defaultAccount ? h::td($defaultAccount->password) : null, + !empty($defaultAccount->username) ? h::td($defaultAccount->username) : null, + !empty($defaultAccount->password) ? h::td + ( + input(set::type('text'), set::value($defaultAccount->password), set::name('password'), setStyle('display', 'none')), + btn(set::class('copy-btn ghost'),set::icon('copy')) + ): null, + !empty($defaultAccount->token) ? h::td + ( + input(set::type('text'), set::value($defaultAccount->token), set::name('token'), setStyle('display', 'none')), + btn(set::class('copy-btn ghost'),set::icon('copy')) + ): null, $type === 'store' ? null : h::td ( btn diff --git a/www/install.php.tmp b/www/install.php.tmp new file mode 100644 index 0000000000..122755b3fa --- /dev/null +++ b/www/install.php.tmp @@ -0,0 +1,36 @@ + + * @package ZenTaoPMS + * @version $Id: install.php 4677 2013-04-26 06:23:58Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +error_reporting(0); +define('IN_INSTALL', true); + +/* Load the framework. */ +include '../framework/router.class.php'; +include '../framework/control.class.php'; +include '../framework/model.class.php'; +include '../framework/helper.class.php'; + +/* Instance the app. */ +$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); + +/* Check installed or not. */ +if(!isset($_SESSION['installing']) and isset($config->installed) and $config->installed) die(header('location: index.php')); + +/* Reset the config params to make sure the install program will be lauched. */ +$config->set('requestType', 'GET'); +$config->set('default.module', 'install'); +$app->setDebug(); + +/* During the installation, if the database params is setted, auto connect the db. */ +if(isset($config->installed) and $config->installed) $app->connectDB(); + +$app->parseRequest(); +$app->loadModule(); diff --git a/www/theme/default/images/main/ai_prompts.png b/www/theme/default/images/main/ai_prompts.png new file mode 100644 index 0000000000..bdba4ff25f Binary files /dev/null and b/www/theme/default/images/main/ai_prompts.png differ diff --git a/www/theme/default/images/main/ai_prompts_en.png b/www/theme/default/images/main/ai_prompts_en.png new file mode 100644 index 0000000000..d68985c9ec Binary files /dev/null and b/www/theme/default/images/main/ai_prompts_en.png differ diff --git a/www/theme/default/images/main/prompt_design.png b/www/theme/default/images/main/prompt_design.png new file mode 100644 index 0000000000..2a1b315cfd Binary files /dev/null and b/www/theme/default/images/main/prompt_design.png differ diff --git a/www/theme/default/images/main/prompt_design_en.png b/www/theme/default/images/main/prompt_design_en.png new file mode 100644 index 0000000000..f63f24ad44 Binary files /dev/null and b/www/theme/default/images/main/prompt_design_en.png differ diff --git a/www/theme/default/images/main/prompt_exec.png b/www/theme/default/images/main/prompt_exec.png new file mode 100644 index 0000000000..3593da654e Binary files /dev/null and b/www/theme/default/images/main/prompt_exec.png differ diff --git a/www/theme/default/images/main/prompt_exec_en.png b/www/theme/default/images/main/prompt_exec_en.png new file mode 100644 index 0000000000..74dcfe2d3c Binary files /dev/null and b/www/theme/default/images/main/prompt_exec_en.png differ diff --git a/www/upgrade.php.tmp b/www/upgrade.php.tmp new file mode 100644 index 0000000000..6d2eccafd7 --- /dev/null +++ b/www/upgrade.php.tmp @@ -0,0 +1,83 @@ + + * @package ZenTaoPMS + * @version $Id: upgrade.php 4677 2013-04-26 06:23:58Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +/* Judge my.php exists or not. */ +define('IN_UPGRADE', true); +$basePath = dirname(dirname(__FILE__)); +$dbConfig = $basePath . '/config/db.php'; +$myConfig = $basePath . '/config/my.php'; +if(file_exists($dbConfig)) +{ + if(file_exists($myConfig)) + { + $myContent = trim(file_get_contents($myConfig)); + $myContent = str_replace('"; + echo "Please execute the command 'chmod 777 $configDir' to modify the permissions to ensure that the ZenTao has operating file permissions in this directory"; + exit; + } + + if(!empty($myContent)) + { + $myContent = file_get_contents($myConfig) . "\n" . $myContent; + file_put_contents($myConfig, $myContent); + } +} +if(!file_exists($myConfig)) die(header('location: install.php')); +if(file_exists("{$basePath}/config/ext/secret.php") and !unlink("{$basePath}/config/ext/secret.php")) +{ + echo "请删除文件 {$basePath}/config/ext/secret.php,后刷新页面
"; + echo "Please delete {$basePath}/config/ext/secret.php and refresh."; + exit; +} + +error_reporting(0); + +/* Load the framework. */ +include '../framework/router.class.php'; +include '../framework/control.class.php'; +include '../framework/model.class.php'; +include '../framework/helper.class.php'; + +/* Instance the app. */ +$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); +$common = $app->loadCommon(); + +/* Reset the config params to make sure the install program will be lauched. */ +$config->set('requestType', 'GET'); +$config->set('default.module', 'upgrade'); +$app->setDebug(); + +/* Check the installed version is the latest or not. */ +$config->installedVersion = $common->loadModel('setting')->getVersion(); +if(($config->version[0] == $config->installedVersion[0] or (is_numeric($config->version[0]) and is_numeric($config->installedVersion[0]))) and version_compare($config->version, $config->installedVersion) <= 0) die(header('location: index.php')); + +/* If run in container, upgrade automatically. */ +if($app->isContainer()) +{ + $upgradeModel = $common->loadModel('upgrade'); + $alterSQL = $upgradeModel->checkConsistency(); + if(!empty($alterSQL)) $upgradeModel->dao->query("SET @@sql_mode= '';" . $alterSQL); + + $config->set('default.method', 'execute'); + $app->session->set('upgrading', true); + $app->session->set('step', ''); + $app->post->set('fromVersion', str_replace( '.', '_', strtolower($config->installedVersion))); +} + +/* Run it. */ +$app->parseRequest(); +if($common->checkUpgradeStatus()) $app->loadModule();