+ Add ops module.

This commit is contained in:
zhaoke
2023-07-19 14:50:52 +08:00
parent 1350d275b1
commit edeb895555
12 changed files with 306 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
<?php
/**
* The control file of ops of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Jiangxiu Peng <pengjiangxiu@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
class ops extends control
{
/**
* Index.
*
* @access public
* @return void
*/
public function index()
{
$this->locate($this->createLink('deploy', 'browse'));
}
public function provider()
{
$this->setting('serverroom', 'provider');
}
public function city()
{
$this->setting('serverroom', 'city');
}
public function cpuBrand()
{
$this->setting('host', 'cpuBrand');
}
public function os($field = 'osVersion')
{
$this->setting('host', $field);
}
public function setting($module = 'serverroom', $field = 'provider', $currentLang = '')
{
if($module == 'host') $module = 'zahost';
if($field == 'osVersion') $field = 'linux';
$fieldList = $field . 'List';
if($_POST)
{
$this->loadModel('custom');
$lang = $_POST['lang'];
$this->custom->deleteItems("lang=$lang&module=$module&section=$fieldList");
foreach($_POST['keys'] as $index => $key)
{
$key = htmlspecialchars($key);
$value = htmlspecialchars($_POST['values'][$index]);
$system = htmlspecialchars($_POST['systems'][$index]);
$this->custom->setItem("{$lang}.$module.$fieldList.{$key}.{$system}", $value);
}
if(dao::isError()) die(js::error(dao::getError()));
$target = isonlybody() ? 'parent.parent' : 'parent';
$lang = str_replace('-', '_', $lang);
die(js::locate($this->createLink('ops', $this->methodName, "field={$field}"), $target));
}
$langModule = $module;
if($langModule == 'host') $langModule = 'zahost';
$this->app->loadLang('custom');
$this->app->loadLang($langModule);
if(empty($currentLang)) $currentLang = str_replace('-', '_', $this->app->getClientLang());
$this->view->title = $this->lang->ops->setting;
$this->view->position[] = $this->lang->ops->setting;
$this->view->module = $module;
$this->view->langModule = $langModule;
$this->view->field = $field;
$this->view->fieldList = $fieldList;
$this->view->currentLang = $currentLang;
$this->display();
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'Devops Setting';
$lang->ops->setting = 'Settings';
$lang->ops->provider = 'IDC Provider';
$lang->ops->provider = 'IDC Provider';
$lang->ops->cpuBrand = 'CPU Brand';
$lang->ops->city = 'IDC Location';
$lang->ops->os = 'OS Version';
$lang->ops->account = 'Account';
$lang->ops->domain = 'Domain';
$lang->ops->serverroom = 'IDC';
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'Devops Setting';
$lang->ops->setting = 'Settings';
$lang->ops->provider = 'IDC Provider';
$lang->ops->provider = 'IDC Provider';
$lang->ops->cpuBrand = 'CPU Brand';
$lang->ops->city = 'IDC Location';
$lang->ops->os = 'OS Version';
$lang->ops->account = 'Account';
$lang->ops->domain = 'Domain';
$lang->ops->serverroom = 'IDC';
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'Devops Setting';
$lang->ops->setting = 'Settings';
$lang->ops->provider = 'IDC Provider';
$lang->ops->provider = 'IDC Provider';
$lang->ops->cpuBrand = 'CPU Brand';
$lang->ops->city = 'IDC Location';
$lang->ops->os = 'OS Version';
$lang->ops->account = 'Account';
$lang->ops->domain = 'Domain';
$lang->ops->serverroom = 'IDC';
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'Devops Setting';
$lang->ops->setting = 'Settings';
$lang->ops->provider = 'IDC Provider';
$lang->ops->provider = 'IDC Provider';
$lang->ops->cpuBrand = 'CPU Brand';
$lang->ops->city = 'IDC Location';
$lang->ops->os = 'OS Version';
$lang->ops->account = 'Account';
$lang->ops->domain = 'Domain';
$lang->ops->serverroom = 'IDC';
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'devops设置';
$lang->ops->setting = '设置';
$lang->ops->provider = '服务商';
$lang->ops->provider = '服务商';
$lang->ops->cpuBrand = 'CPU品牌';
$lang->ops->city = '城市';
$lang->ops->os = '系统版本';
$lang->ops->account = '账号';
$lang->ops->domain = '域名';
$lang->ops->serverroom = '机房';
+11
View File
@@ -0,0 +1,11 @@
<?php
$lang->ops->common = 'devops设置';
$lang->ops->setting = '设置';
$lang->ops->provider = '服务商';
$lang->ops->provider = '服务商';
$lang->ops->cpuBrand = 'CPU品牌';
$lang->ops->city = '城市';
$lang->ops->os = '系统版本';
$lang->ops->account = '账号';
$lang->ops->domain = '域名';
$lang->ops->serverroom = '机房';
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* The custom view file of ops module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke Zhao <zhaoke@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'ops/view/setting.html.php';?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* The custom view file of ops module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke Zhao <zhaoke@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'ops/view/setting.html.php';?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* The custom view file of ops module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke Zhao <zhaoke@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'ops/view/setting.html.php';?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* The custom view file of ops module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Ke Zhao <zhaoke@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'ops/view/setting.html.php';?>
+96
View File
@@ -0,0 +1,96 @@
<?php
/**
* The custom view file of ops module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Congzhi Chen <congzhi@cnezsoft.com>
* @package ops
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
<?php
$itemRow = <<<EOT
<tr class='text-center'>
<td>
<input type='text' class="form-control" autocomplete='off' value="" name="keys[]">
<input type='hidden' value="0" name="systems[]">
</td>
<td>
<input type='text' class="form-control" autocomplete='off' value="" name="values[]">
</td>
<td class='c-actions text-left'>
<a href='javascript:void()' class='btn' onclick='addDevItem(this)'><i class='icon-plus'></i></a>
<a href='javascript:void()' class='btn' onclick='delDevItem(this)'><i class='icon-close'></i></a>
</td>
</tr>
EOT;
?>
<?php js::set('itemRow', $itemRow); ?>
<div id='mainContent' class='main-row'>
<?php if(!empty($lang->{$module}->osNameList) && array_key_exists($field, $lang->{$module}->osNameList)):?>
<div class='side-col'>
<div class='cell'>
<div class='list-group'>
<?php
foreach($lang->{$module}->osNameList as $key => $value)
{
echo html::a(inlink('os', "field=$key"), $value, '', "id='{$key}Tab'");
}
?>
</div>
</div>
</div>
<?php endif;?>
<div class='main-col main-content'>
<form method='post' target='hiddenwin'>
<div class='main-header'>
<h2><?php echo $lang->$module->$field;?></h2>
</div>
<table class='table table-form active-disabled table-condensed mw-600px'>
<tr class='text-center'>
<td class='w-120px'><strong><?php echo $lang->custom->key;?></strong></td>
<td><strong><?php echo $lang->custom->value;?></strong></td>
<th class='w-80px'></th>
</tr>
<?php foreach($lang->$module->$fieldList as $key => $value):?>
<tr class='text-center'>
<td><?php echo $key === '' ? 'NULL' : $key; echo html::hidden('keys[]', $key) . html::hidden('systems[]', 0);?></td>
<td>
<?php echo html::input("values[]", $value, "class='form-control' autocomplete='off' " . (empty($key) ? 'readonly' : ''));?>
</td>
<td class='c-actions text-left'>
<a href='javascript:void()' class='btn' onclick='addDevItem(this)'><i class='icon-plus'></i></a>
<a href='javascript:void()' class='btn' onclick='delDevItem(this)'><i class='icon-close'></i></a>
</td>
</tr>
<?php endforeach;?>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php
$appliedTo = array($this->app->getClientLang() => $lang->custom->currentLang, 'all' => $lang->custom->allLang);
echo html::radio('lang', $appliedTo, str_replace('_', '-', $currentLang));
echo html::submitButton();
if(common::hasPriv('custom', 'restore')) echo html::linkButton($lang->custom->restore, $this->createLink('custom', 'restore', "module=$module&field=$fieldList"), 'hiddenwin', '', 'btn btn-wide');
?>
</td>
</tr>
</table>
</form>
</div>
</div>
<script>
function addDevItem(clickedButton)
{
$(clickedButton).parent().parent().after(itemRow);
}
function delDevItem(clickedButton)
{
$(clickedButton).parent().parent().remove();
}
</script>
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>