Compare commits

..

2 Commits

Author SHA1 Message Date
wangyidong
befa7343c7 + add 4.2.beta tag. 2013-07-08 06:18:50 +00:00
wangyidong
d6d2087d65 + add 4.2.beta tag. 2013-07-08 05:53:28 +00:00
6256 changed files with 85906 additions and 834296 deletions

34
.gitignore vendored
View File

@@ -1,34 +0,0 @@
config/db.php
config/my.php
www/data/
www/install.php
www/upgrade.php
www/checklist.php
www/ok.txt
tools/*
release/*
tmp/*
tmp/log/*
tmp/model/*
tmp/cache/*
tmp/extension/*
extension/pro/*
extension/biz/*
extension/max/*
extension/xuan/*
extension/custom/*
test/data/sql/
.bak
.idea
.vscode
.gitignore
.DS_Store
vendor/
docker
.docker-sync
composer.lock
.editorconfig
CodeSniffer.conf
test/runtime/*
test/www
!/**/.gitkeep

View File

@@ -1,13 +0,0 @@
sonarqube:
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner -Dsonar.inclusions=$(git diff --name-only HEAD~1|tr '\n' ',')
allow_failure: true
only:
- master # or the name of your main branch

205
COPYING
View File

@@ -1,205 +0,0 @@
Z PUBLIC LICENSE 1.2
许可
Z PUBLIC LICENSE 由青岛易软天创网络科技有限公司www.cnezsoft.com起草简称ZPL协议。
任何人均可使用该协议来发布开源软件,并可对下面协议正文中以下划线标注的空白部分做相应修改,
除此之外的任何内容不得做任何修改。青岛易软天创网络科技有限公司拥有对该协议条款的最终解释权。
前言:
禅道项目管理软件(以下简称该软件)由 青岛易软天创网络科技有限公司www.cnezsoft.com开发以下简称我。我依法拥有该软件的所有版权。
本着共享开放的角度,我以开放源代码的形式发布该软件。您可以在遵守该协议的前提下使用该软件。
自您安装该软件开始,您和我之间的合同关系自动成立。除非您停止使用该软件或与我有签署额外合同,
您须认真遵循该授权协议约定的每一条款。
我的联系方式:
联系人:徐先生
电话: 4006-8899-23
Email co@cnezsoft.com
QQ 1492153927
地址: 青岛开发区井冈山路东方银座 C座 1106
约定:
下述条款中所指该软件的标志包括如下方面:
该软件源代码及文档中关于该软件的版权提示、文字、图片和链接。
该软件运行时界面上呈现出来的有关该软件的文字、图片和链接。
不包括如下方面:
该软件提供的演示数据中关于该软件的文字、图片和链接。
一、免责
该软件是以开放源代码的方式发行,您使用该软件无需任何费用,因此在使用该软件前,您须知晓:
1.1 我没有对该软件提供任何技术支持的义务,您可联系我购买商业的技术支持。
1.2 我对因使用该软件而产生直接或间接的任何问题不负任何责任。
1.3 开源不等于免费,开源不等于无版权,开源软件的发展需要您我共同的努力。
二、自用该软件
2.1 您个人或您就职的公司(组织)可自由使用该软件,我不对您或您就职公司(组织)的性质做任何限制。
2.2 您可以在您个人或您就职公司(组织)任意数量的电脑上运行该软件,我不对电脑的数量做任何限制。
2.3 您可以对该软件源代码进行修改以适应您个人或您所在公司(组织)使用的要求,您做的改动无需对外发布。
2.4 您个人或您就职公司(组织)使用该软件时,必须保留该软件的所有标志,不得以任何方式隐藏或遮掩任一标志。
三、为用户定制
3.1 您可以使用该软件为您的用户部署各种形式的应用,我不对应用的性质做任何限制。
3.2 您可以使用该软件为您的用户部署任意数量的应用,我不对应用的数量做任何限制。
3.3 您可以对该软件源代码进行修改以适应您的用户的要求,您做的改动无需对外发布。
3.4 您对该软件源代码所做的修改可以源代码或二进制的方式提供给您的用户。
3.5 您使用该软件为您的任一用户部署的任一应用都必须保留该软件所有的标志。
3.6 您使用该软件为您的任一用户部署的任一应用都不得以任何方式隐藏或遮掩该软件任一标志。
四、提供在线服务
4.1 您可以使用该软件搭建在线服务,为您的用户提供服务,我不对该服务及该服务用户的性质做任何限制。
4.2 您可以使用该软件搭建在线服务,为您的用户提供服务,我不对该服务的用户数量做任何限制。
4.3 您可以对该软件源代码进行修改以适应在线服务的要求,您做的改动无需对外发布。
4.4 您使用该软件搭建在线服务时,必须以明确的方式告知您的用户该服务是基于该软件搭建的。
4.5 您使用该软件搭建在线服务为您的任一用户部署的任一应用必须保留该软件所有的标志。
4.6 您使用该软件搭建在线服务为您的任一用户部署的任一应用不得以任何方式隐藏或遮掩该软件任一标志。
4.7 您使用该软件搭建在线服务时,不得为您的用户提供去除、隐藏或遮掩该软件任一标志的功能。
五、无改动发布或集成该软件
5.1 我欢迎并感谢您将该软件发布在您的个人网站、企业官网或者其他的第三方网站。
5.2 我欢迎并感谢您将该软件集成在其他系统中一起发布,比如云服务镜像、操作系统发行版等。
5.3 您在发布或者集成该软件的时候,不得对该软件源码做任何改动。
5.4 您在发布或者集成该软件的时候,须保留该软件的所有标志。
六、发布基于该软件的衍生作品
6.1 我欢迎并感谢您为该软件开发衍生作品。
6.2 您开发的衍生作品中涉及到对该软件源代码改动的地方,须遵循如下条款:
6.2.1 如修改了该软件的源代码,须依据本协议发布修改后的源代码。
6.2.2 如修改了该软件的源代码,须保留代码里面该软件原有的所有标志。
6.2.3 您可以在代码中追加您自己的标志。
6.2.4 您可以对您开发的衍生作品进行收费。
6.2.5 第三方的用户可在遵循6.2所有条款下可继续在您开发的衍生作品基础上进行修改并发布。
6.3 您开发的衍生作品中独立于本软件开发的代码,可以源代码或二进制的方式进行发布,可免费或收费发布。
6.4 您开发的衍生作品不得以任何方式去除、隐藏或遮掩该软件的任一标志。
七、发布基于该软件API的应用
7.1 我欢迎并感谢您为该软件开发基于API的各种应用比如客户端软件等。
7.2 您基于该软件API机制开发的应用可以源代码或者二进制的方式进行发布我对此没有任何限制。
7.3 您基于该软件API机制开发的应用授权协议可以自行约定我对此没有任何限制。
7.4 您基于该软件API机制开发的应用可以免费或者收费发布我对此没有任何限制。
八、授权例外
如果上述条款无法满足您使用该软件的要求,可联系我签署额外的合同以获得更灵活的授权许可。
九、合同约束
9.1 如果您违反了该协议的任一条款,该授权协议将自动终止,我保留通过法律手段追究责任的权利。
Z PUBLIC LICENSE 1.2
Authorization
Z PUBLIC LICENSE, also known as ZPL Agreement, is drafted by QingDao Nature Easy Soft Network Technology Co,LTD. (,www.cnezsoft.com).
Anyone can use the agreement to publish open source software, and modify the blank underlined part of the following text of the agreement accordingly.
No other text of the agreement shall be changed. QingDao Nature Easy Soft Network Technology Co,LTD has the final authority to interpret the terms of the agreement.
Preface
ZenTaoPMS (Hereinafter referred to as "the software") developed by Nature EasySoft Network Tecnology Co.ltd, QingDao, China (www.cnezsoft.com) (hereinafter referred to I). I'm entitled to all copyright of the software.
The software is released as open source software. You are authorized to use the software as long as you are in compliance with this agreement.
By installation of the software, you agree that a contractual relationship between you and me is automatically established.
You are obliged to fully comply with all the terms of this agreement unless you choose to stop using the software or you have signed additional contracts with me.
My Contact:
Contact: Mr. Xu
Phone: 4006-8899-23
Email: co@cnezsoft.com
QQ: 1492153927
Address: Qingdao Development Zone, the Oriental Kenzo C 1106
We agree:
Indications of the software include:
Notes, texts, pictures and links showing copyright attribution of the software in the source code and related documentation.
and texts, picture and links on the interface of the software when running.
Excluding
texts, picture and links on the interface of the demo versions of the software.
1. Disclaimer
The software is an open-source software, so you are authorized to use the software without paying a fee. Before you start to use it, please note:
1.1 I do not have any obligation to provide technical support for the software. You can contact me to purchase technical support service.
1.2 I'm not responsible for any liability caused by your using the software directly or indirectly.
1.3 Open source software does not mean it's free of charge, neither does it mean the software does not enjoy copyright.
2. For personal use
2.1 You or your company/organization are authorized to use the software for your internal use for both commercial and non-commercial purposes..
2.2 You or your company/organization are authorized to run the software on any number of computers.
2.3 You or your company/organization are authorized to modify the source code of the software to meet your requirements. You do not need to release the modified codes.
2.4 You or your company/organization must keep all the indications of the software when using it. None of the indications can be removed, hidden or obscured in any way.
3. For customized software
3.1 You are authorized to use the software to deploy various forms of application for your users in any way you like.
3.2 You are authorized to use the software to deploy any number of applications for your users.
3.3 You are authorized to modify the source code to meet your user's requirements without releasing the modified codes.
3.4 You are authorized to provide the modified codes to your users in either source code form or binary.
3.5 You must keep all the indications of the software when providing applications to your users.
3.6 None of the indications of the software may be removed, hidden or obscured in any way when you provide applications to your users.
4. Online service
4.1 You are authorized to use the software to build your online service for your users in any way you like.
4.2 You are authorized to use the software to build your online service for any number of your users.
4.3 You are authorized to modify the source codes of the software to meet your user's requirements on online service without releasing the modified codes.
4.4 You must notify your users clearly that your service is based on the software when you use it to build your online service.
4.5 You must keep all the indications of the software when providing online service to your users.
4.6 You must keep all the indications of the software in any application you make for your users. None of the indications can be hidden or obscured in any way.
4.7 You are forbidden from assisting your users by providing tools for your users to remove, hide or obscure any indication of the software when you use the software to build your online service.
5. Publish or integrate the software without modification
5.1 You are authorized to publish the software on your personal sites, corporate official website or other third-party sites.
5.2 You are authorized to integrate the software with other systems, such as cloud virtual machine images, operating system images and so on.
5.3 Do not modify the source code of the software when you publish or integrate it.
5.4 All indications of the software must be kept the same when you publish or integrate the software.
6. Publish derived work based on the software
6.1 You are authorized to develop derived work based on the software.
6.2 The modified codes of the software in your derived work must follow the following terms:
6.2.1 The source codes must be released if you make any modification to the software.
6.2.2 All indications of the software must be kept the same.
6.2.3 You are entitled to add your indications to the modified codes.
6.2.4 You are entitled to charge fees for the derived work you developed based on the software.
6.2.5 You agree to authorize third party users to modify and release the derived work in compliance with 6.2.
6.3 If the codes of the work are independently developed by yourself, You are authorized to release the work in either source code form or binary. You are entitled to charge your users or make it free.
6.4 None of the indications of the software can be removed, hidden or obscured in any way in the derived work you developed.
7. Publish applications based on API of the software
7.1 You are authorized to develop your applications based on the API of the software, for example, client software.
7.2 You are authorized to publish applications you developed based on the API in either source code form or binary.
7.3 You are authorized to use your own license to release applications you developed based on the API.
7.4 You are entitled to release applications you developed based on the API either free or with a charge.
8. Exceptions
If the terms above do not meet your requirements when using the software, please contact me for a more flexible license.
9. Termination
9.1 Violation of any of the terms of the agreement will result in immediate termination of this license. I reserve all rights to take legal actions in case of dispute.

301
Makefile
View File

@@ -1,31 +1,17 @@
VERSION = $(shell head -n 1 VERSION)
LITEVERSION = $(shell head -n 1 extension/lite/LITEVERSION)
XUANVERSION = $(shell head -n 1 xuanxuan/XUANVERSION)
XVERSION = $(shell head -n 1 xuanxuan/XVERSION)
VERSION=$(shell head -n 1 VERSION)
XUANPATH := $(XUANXUAN_SRC_PATH)
BUILD_PATH := $(if $(ZENTAO_BUILD_PATH),$(ZENTAO_BUILD_PATH),$(shell pwd))
RELEASE_PATH := $(if $(ZENTAO_RELEASE_PATH),$(ZENTAO_RELEASE_PATH),$(shell pwd))
all: tgz
linux: tgz build4linux
all:
make clean
make ci
clean:
rm -fr zentaopms
rm -fr zentaostory
rm -fr zentaotask
rm -fr zentaotest
rm -fr *.tar.gz
rm -fr *.zip
rm -fr api*
rm -fr build/linux/lampp
rm -rf buildroot/
rm -fr lampp
rm -fr zentaoxx
rm -fr tmp/
rm -f *.sh
common:
tgz:
mkdir zentaopms
cp -fr api zentaopms/
cp -fr bin zentaopms/
cp -fr config zentaopms/ && rm -fr zentaopms/config/my.php
cp -fr db zentaopms/
@@ -33,242 +19,63 @@ common:
cp -fr framework zentaopms/
cp -fr lib zentaopms/
cp -fr module zentaopms/
cp -fr extension zentaopms/
cp -fr sdk zentaopms/
cp -fr www zentaopms && rm -fr zentaopms/www/data/ && mkdir -p zentaopms/www/data/upload && mkdir zentaopms/www/data/course
mkdir zentaopms/tmp
mkdir zentaopms/tmp/cache/
mkdir zentaopms/tmp/extension/
mkdir zentaopms/tmp/log/
mkdir zentaopms/tmp/model/
mv zentaopms/www/install.php.tmp zentaopms/www/install.php
mv zentaopms/www/upgrade.php.tmp zentaopms/www/upgrade.php
cp -fr www zentaopms && rm -fr zentaopms/www/data/ && mkdir -p zentaopms/www/data/upload
cp -fr tmp zentaopms
rm -fr zentaopms/tmp/cache/*
rm -fr zentaopms/tmp/extension/*
rm -fr zentaopms/tmp/log/*
rm -fr zentaopms/tmp/model/*
cp VERSION zentaopms/
# create index.html of each folder.
for path in `find zentaopms/ -type d`; do touch "$$path/index.html"; done
rm zentaopms/www/index.html
# combine js and css files.
cp -fr tools zentaopms/tools && cd zentaopms/tools/ && php ./minifyfront.php
rm -fr zentaopms/tools
mkdir -p zentaopms/build/tools && cp build/tools/minifyfront.php zentaopms/build/tools/
cd zentaopms/build/tools/ && php ./minifyfront.php
rm -fr zentaopms/build
# create the restart file for svn.
# touch zentaopms/module/svn/restart
# delete the unused files.
find zentaopms -name .gitkeep |xargs rm -fr
# delee the unused files.
find zentaopms -name .svn |xargs rm -fr
find zentaopms -name tests |xargs rm -fr
# notify.zip.
mkdir zentaopms/www/data/notify/
zentaoxx:
#xuanxuan
mkdir -p zentaoxx/config/ext
mkdir -p zentaoxx/lib
mkdir -p zentaoxx/extension/xuan
mkdir -p zentaoxx/framework
mkdir -p zentaoxx/db
mkdir -p zentaoxx/www
mkdir -p zentaoxx/extension/xuan/common/ext/model/
cd $(XUANPATH); git pull; git archive --format=zip --prefix=xuan/ $(XUANVERSION) > xuan.zip
mv $(XUANPATH)/xuan.zip .
unzip xuan.zip
cp xuan/xxb/config/ext/_0_xuanxuan.php zentaoxx/config/ext/
cp -r xuan/xxb/lib/phpaes zentaoxx/lib/
cp -r xuan/xxb/framework/xuanxuan.class.php zentaoxx/framework/
cp -r xuan/xxb/db/*.sql zentaoxx/db/
cp -r xuan/xxb/module/im zentaoxx/extension/xuan/
cp -r xuan/xxb/module/client zentaoxx/extension/xuan/
cp -r xuan/xxb/module/conference zentaoxx/extension/xuan/
cp -r xuan/xxb/module/integration zentaoxx/extension/xuan/
cp -r xuan/xxb/module/license zentaoxx/extension/xuan/
mkdir -p zentaoxx/extension/xuan/common/view
cp -r xuan/xxb/module/common/view/header.modal.html.php zentaoxx/extension/xuan/common/view
cp -r xuan/xxb/module/common/view/marked.html.php zentaoxx/extension/xuan/common/view
cp -r xuan/xxb/module/common/view/footer.modal.html.php zentaoxx/extension/xuan/common/view
cp -r xuan/xxb/module/common/view/version.html.php zentaoxx/extension/xuan/common/view
mkdir -p zentaoxx/www/js/
cp -r xuan/xxb/www/js/markedjs zentaoxx/www/js/
cp -r xuan/xxb/www/js/version.js zentaoxx/www/js/
cp -r xuan/xxb/www/x.php zentaoxx/www/
mkdir zentaoxx/extension/xuan/action
cp -r xuan/xxb/module/action/ext zentaoxx/extension/xuan/action
cp -r xuan/xxb/config/ext/_1_maps.php zentaoxx/config/ext/
cp -r xuanxuan/config/* zentaoxx/config/
cp -r xuanxuan/extension/xuan/* zentaoxx/extension/xuan/
cp -r xuanxuan/www/* zentaoxx/www/
mv zentaoxx/db/ zentaoxx/db_bak
mkdir zentaoxx/db/
cp zentaoxx/db_bak/upgradexuanxuan*.sql zentaoxx/db_bak/xuanxuan.sql zentaoxx/db/
rm -rf zentaoxx/db_bak/
sed -i 's/XXBVERSION/$(XVERSION)/g' zentaoxx/config/ext/_0_xuanxuan.php
sed -i "/\$$config->xuanxuan->backend /c\\\$$config->xuanxuan->backend = 'zentao';" zentaoxx/config/ext/_0_xuanxuan.php
sed -i 's/site,//' zentaoxx/extension/xuan/im/model/user.php
sed -i 's/admin, g/g/' zentaoxx/extension/xuan/im/model/user.php
sed -i '/password = md5/d' zentaoxx/extension/xuan/im/model/user.php
sed -i 's/md5(\$$user->password.*$$/\$$user->password;/g' zentaoxx/extension/xuan/im/model/user.php
sed -i '/getSignedTime/d' zentaoxx/extension/xuan/im/control.php
sed -i "/loadModel('push')/d" zentaoxx/extension/xuan/im/control.php
sed -i "/this->push/d" zentaoxx/extension/xuan/im/control.php
sed -i "s/(int)(microtime/(double)(microtime/" zentaoxx/extension/xuan/im/control.php
sed -i "s/'yahoo', //g" zentaoxx/extension/xuan/im/config.php
sed -i "s/'gtalk', //g" zentaoxx/extension/xuan/im/config.php
sed -i "s/'wangwang', //g" zentaoxx/extension/xuan/im/config.php
sed -i "s/'site', //g" zentaoxx/extension/xuan/im/config.php
sed -i "s/'reload'/inlink('browse')/g" zentaoxx/extension/xuan/client/control.php
sed -i 's/tree/dept/' zentaoxx/extension/xuan/im/model.php
sed -i 's/tree/dept/' zentaoxx/extension/xuan/im/control.php
sed -i 's/im_/zt_im_/g' zentaoxx/db/*.sql
sed -i 's/xxb_user/zt_user/g' zentaoxx/db/*.sql
sed -i 's/xxb_file/zt_file/g' zentaoxx/db/*.sql
sed -i '/xxb_entry/d' zentaoxx/db/*.sql
sed -i '/deviceToken/d' zentaoxx/db/*.sql
sed -i '/deviceType/d' zentaoxx/db/*.sql
sed -i "/fetch('push', 'pushMessage');/d" zentaoxx/extension/xuan/im/control.php
#sed -i "s/marked\.html\.php';?>/marked\.html\.php';?>\n<div id='mainMenu' class='clearfix'><div class='btn-toolbar pull-left'><?php common::printAdminSubMenu('xuanxuan');?><\/div><\/div>/g" zentaoxx/extension/xuan/client/view/checkupgrade.html.php
sed -i '/var serverVersions/d' zentaoxx/extension/xuan/client/js/checkupgrade.js
sed -i '/var currentVersion/d' zentaoxx/extension/xuan/client/js/checkupgrade.js
sed -i '/setRequiredFields(/d' zentaoxx/extension/xuan/common/view/header.modal.html.php
sed -i 's/header.html.php/header.lite.html.php/g' zentaoxx/extension/xuan/common/view/header.modal.html.php
sed -i 's/footer.html.php/footer.lite.html.php/g' zentaoxx/extension/xuan/common/view/footer.modal.html.php
sed -i 's/v\.//g' zentaoxx/extension/xuan/im/js/debug.js
sed -i 's/helper::jsonEncode(/json_encode(/g' zentaoxx/framework/xuanxuan.class.php
sed -i 's/moduleRoot/getExtensionRoot() . "xuan\/"/' zentaoxx/framework/xuanxuan.class.php
sed -i "s/lang->goback,/lang->goback, '',/g" zentaoxx/extension/xuan/im/view/debug.html.php
sed -i 's/v\.//g' zentaoxx/extension/xuan/client/js/checkupgrade.js
sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/extension/xuan/im/control.php
sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/extension/xuan/im/model/conference.php
sed -i 's/xxb_/zt_/g' zentaoxx/db/*.sql
sed -i "s#\$this->app->getModuleRoot() . 'im/apischeme.json'#\$this->app->getExtensionRoot() . 'xuan/im/apischeme.json'#g" zentaoxx/extension/xuan/im/model.php
sed -i "s/'..\/..\/common\/view\/header.html.php'/\$$app->getModuleRoot() . 'common\/view\/header.html.php'/g" zentaoxx/extension/xuan/conference/view/admin.html.php
sed -i "s/'..\/..\/common\/view\/footer.html.php'/\$$app->getModuleRoot() . 'common\/view\/footer.html.php'/g" zentaoxx/extension/xuan/conference/view/admin.html.php
echo "ALTER TABLE \`zt_user\` ADD \`pinyin\` varchar(255) NOT NULL DEFAULT '' AFTER \`realname\`;" >> zentaoxx/db/xuanxuan.sql
mkdir zentaoxx/tools; cp tools/cn2tw.php zentaoxx/tools; cd zentaoxx/tools; php cn2tw.php
cp tools/en2de.php zentaoxx/tools; cd zentaoxx/tools; php en2de.php ../
rm -rf zentaoxx/tools
zip -rqm -9 zentaoxx.$(VERSION).zip zentaoxx/*
rm -rf xuan.zip xuan zentaoxx
package:
wget http://192.168.1.99/release/notify.zip -O zentaopms/www/data/notify/notify.zip
# change mode.
chmod -R 777 zentaopms/tmp/
chmod -R 777 zentaopms/www/data
chmod -R 777 zentaopms/config
chmod -R 777 zentaopms/extension/custom
chmod 777 -R zentaopms/tmp/
chmod 777 -R zentaopms/www/data
chmod 777 -R zentaopms/config
chmod 777 zentaopms/module
chmod 777 zentaopms/www
chmod a+rx zentaopms/bin/*
if [ ! -d "zentaopms/config/ext" ]; then mkdir zentaopms/config/ext; fi
find zentaopms/ -name ext |xargs chmod -R 777
mkdir zentaopms/tools; cp tools/cn2tw.php zentaopms/tools; cd zentaopms/tools; php cn2tw.php
#rm -r zentaopms/module/misc/ext
rm -rf zentaopms/tools
pms:
make common
make zentaoxx
unzip zentaoxx.*.zip
cp zentaoxx/* zentaopms/ -r
make package
zip -rq -9 ZenTaoPMS.$(VERSION).zip zentaopms
rm -fr zentaopms zentaoxx zentaoxx.*.zip
deb:
mkdir buildroot
cp -r build/debian/DEBIAN buildroot
sed -i '/^Version/cVersion: ${VERSION}' buildroot/DEBIAN/control
mkdir buildroot/opt
mkdir buildroot/etc/apache2/sites-enabled/ -p
cp build/debian/zentaopms.conf buildroot/etc/apache2/sites-enabled/
cp ZenTaoPMS.${VERSION}.zip buildroot/opt
cd buildroot/opt; unzip ZenTaoPMS.${VERSION}.zip; mv zentaopms zentao; rm ZenTaoPMS.${VERSION}.zip
sed -i 's/index.php/\/zentao\/index.php/' buildroot/opt/zentao/www/.htaccess
sudo dpkg -b buildroot/ ZenTaoPMS_${VERSION}_1_all.deb
rm -rf buildroot
rpm:
mkdir ~/rpmbuild/SPECS -p
cp build/rpm/zentaopms.spec ~/rpmbuild/SPECS
sed -i '/^Version/cVersion:${VERSION}' ~/rpmbuild/SPECS/zentaopms.spec
mkdir ~/rpmbuild/SOURCES
cp ZenTaoPMS.${VERSION}.zip ~/rpmbuild/SOURCES
mkdir ~/rpmbuild/SOURCES/etc/httpd/conf.d/ -p
cp build/debian/zentaopms.conf ~/rpmbuild/SOURCES/etc/httpd/conf.d/
mkdir ~/rpmbuild/SOURCES/opt/ -p
cd ~/rpmbuild/SOURCES; unzip ZenTaoPMS.${VERSION}.zip; mv zentaopms opt/zentao;
sed -i 's/index.php/\/zentao\/index.php/' ~/rpmbuild/SOURCES/opt/zentao/www/.htaccess
cd ~/rpmbuild/SOURCES; tar -czvf zentaopms-${VERSION}.tar.gz etc opt; rm -rf ZenTaoPMS.${VERSION}.zip etc opt;
rpmbuild -ba ~/rpmbuild/SPECS/zentaopms.spec
cp ~/rpmbuild/RPMS/noarch/zentaopms-${VERSION}-1.noarch.rpm ./
rm -rf ~/rpmbuild
en:
make common
cd zentaopms/; grep -rl 'zentao.net'|xargs sed -i 's/zentao.net/zentao.pm/g';
cd zentaopms/; grep -rl 'http://www.zentao.pm'|xargs sed -i 's/http:\/\/www.zentao.pm/https:\/\/www.zentao.pm/g';
cd zentaopms/config/; echo >> config.php; echo '$$config->isINT = true;' >> config.php
make zentaoxx
unzip zentaoxx.*.zip
cp zentaoxx/* zentaopms/ -r
make package
mv zentaopms zentaoalm
zip -r -9 ZenTaoALM.$(VERSION).int.zip zentaoalm
rm -fr zentaoalm
#echo $(VERSION).int > VERSION
#make endeb
#make enrpm
#echo $(VERSION) > VERSION
endeb:
mkdir buildroot
cp -r build/debian/DEBIAN buildroot
sed -i '/^Version/cVersion: ${VERSION}' buildroot/DEBIAN/control
mkdir buildroot/opt
mkdir buildroot/etc/apache2/sites-enabled/ -p
cp build/debian/zentaopms.conf buildroot/etc/apache2/sites-enabled/
cp ZenTaoALM.${VERSION}.zip buildroot/opt
cd buildroot/opt; unzip ZenTaoALM.${VERSION}.zip; mv zentaoalm zentao; rm ZenTaoALM.${VERSION}.zip
sed -i 's/index.php/\/zentao\/index.php/' buildroot/opt/zentao/www/.htaccess
sudo dpkg -b buildroot/ ZenTaoALM_${VERSION}_1_all.deb
rm -rf buildroot
enrpm:
mkdir ~/rpmbuild/SPECS -p
cp build/rpm/zentaopms.spec ~/rpmbuild/SPECS
sed -i '/^Version/cVersion:${VERSION}' ~/rpmbuild/SPECS/zentaopms.spec
sed -i '/^Name:/cName:zentaoalm' ~/rpmbuild/SPECS/zentaopms.spec
mkdir ~/rpmbuild/SOURCES
cp ZenTaoALM.${VERSION}.zip ~/rpmbuild/SOURCES
mkdir ~/rpmbuild/SOURCES/etc/httpd/conf.d/ -p
cp build/debian/zentaopms.conf ~/rpmbuild/SOURCES/etc/httpd/conf.d/zentaoalm.conf
mkdir ~/rpmbuild/SOURCES/opt/ -p
cd ~/rpmbuild/SOURCES; unzip ZenTaoALM.${VERSION}.zip; mv zentaoalm opt/zentao;
sed -i 's/index.php/\/zentao\/index.php/' ~/rpmbuild/SOURCES/opt/zentao/www/.htaccess
cd ~/rpmbuild/SOURCES; tar -czvf zentaoalm-${VERSION}.tar.gz etc opt; rm -rf ZenTaoALM.${VERSION}.zip etc opt;
rpmbuild -ba ~/rpmbuild/SPECS/zentaopms.spec
cp ~/rpmbuild/RPMS/noarch/zentaoalm-${VERSION}-1.noarch.rpm ./
rm -rf ~/rpmbuild
ciCommon:
git pull
make common
ifneq ($(XUANPATH), )
make zentaoxx
unzip zentaoxx.*.zip
cp zentaoxx/* zentaopms/ -r
endif
make package
zip -rq -9 ZenTaoPMS.$(VERSION).zip zentaopms
rm -fr zentaopms zentaoxx zentaoxx.*.zip
make en
rm -fr zentaopms zentaoxx zentaoxx.*.zip
ci:
make ciCommon
php tools/packZip.php $(VERSION)
sh zip.sh
rm -rf tmp/
php tools/packDeb.php $(VERSION)
sh deb.sh
rm -rf tmp/
php tools/packRpm.php $(VERSION)
sh rpm.sh
rm -rf tmp/
rm -f zentaobiz*.zip zentaomax*.zip $(BUILD_PATH)/ZenTaoPMS.$(VERSION).zip $(RELEASE_PATH)/ZenTaoALM.$(VERSION)*.zip $(RELEASE_PATH)/ZenTaoPMS.$(VERSION)*.zip $(RELEASE_PATH)/*.deb $(RELEASE_PATH)/*.rpm *.sh
cp ZenTaoPMS.$(VERSION).zip $(BUILD_PATH)
mv *.zip *.deb *.rpm $(RELEASE_PATH)
lite:
make ciCommon
php tools/packZip.php $(VERSION) $(LITEVERSION)
rm -f zentaobiz*.zip zentaomax*.zip $(BUILD_PATH)/ZenTaoPMS.$(VERSION).zip $(RELEASE_PATH)/ZenTaoALM.$(VERSION)*.zip $(RELEASE_PATH)/ZenTaoPMS.$(VERSION)*.zip $(RELEASE_PATH)/ZenTaoALM.$(LITEVERSION)*.zip $(RELEASE_PATH)/ZenTaoPMS.$(LITEVERSION)*.zip *.sh
cp ZenTaoPMS.$(VERSION).zip $(BUILD_PATH)
mv *.zip $(RELEASE_PATH)
# add zentaotest zentaotask zentaostory extension.
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaotest
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaotask
svn export https://svn.cnezsoft.com/easysoft/trunk/zentaoext/zentaostory
zip -rm -9 zentaotest.zip zentaotest
zip -rm -9 zentaotask.zip zentaotask
zip -rm -9 zentaostory.zip zentaostory
mv zentaotest.zip zentaopms/tmp/extension
mv zentaostory.zip zentaopms/tmp/extension
mv zentaotask.zip zentaopms/tmp/extension
# zip it.
zip -r -9 ZenTaoPMS.$(VERSION).zip zentaopms
rm -fr zentaopms
patchphpdoc:
sudo cp misc/doc/phpdoc/*.tpl /usr/share/php/data/PhpDocumentor/phpDocumentor/Converters/HTML/frames/templates/phphtmllib/templates/
phpdoc:
phpdoc -d bin,framework,config,lib,module,www -t api -o HTML:frames:phphtmllib -ti ZenTaoPMSAPI<50>ο<EFBFBD><CEBF>ֲ<EFBFBD> -s on -pp on -i *test*
phpdoc -d bin,framework,config,lib,module,www -t api.chm -o chm:default:default -ti ZenTaoPMSAPI<50>ο<EFBFBD><CEBF>ֲ<EFBFBD> -s on -pp on -i *test*
doxygen:
doxygen doc/doxygen/doxygen.conf
build4linux:
unzip ZenTaoPMS.$(VERSION).zip
rm -fr ZenTaoPMS.$(VERSION).zip
# build xmapp.
cd ./build/linux/ && ./buildxmapp.sh $(xampp)
mv ./build/linux/lampp ./
saas:
mkdir backup
mkdir tmp/model
mkdir tmp/extension
mkdir www/data/upload -p
chmod 777 backup
chmod 777 -R tmp
chmod 777 -R www/data

View File

@@ -1,47 +0,0 @@
## 1. What is ZenTao?
ZenTao is an open source project management software, developed by Qingdao Nature Easy Soft Network Technology Co. Ltd. Combining product management, project management, QA management, document management, company management and todo management. It is a professional project management software, covering the core process of software development projects.
ZenTao is practical and pragmatic. It has full features and beautiful interfaces, and is easy to use. ZenTao is well structured and can be flexibly extended. It also has powerful search features, various forms of statistical reports and complete API.
ZenTao focuses on development project management!
## 2. Why is it called ZenTao?
Zen(禅) and Tao(道) are the two Chinese characters that have rich meanings in both religion and culture. ZenTao Project Management Software takes the cultural meaning of Zen and Tao, and is expected to convey our understanding and thinking of management. Inspired by The Tao of Programming and The Zen of Programming, we named our software ZenTao.
## 3. Design philosophy of ZenTao Project Management Software
The main design philosophy of ZenTao Project Management Software is based on Scrum, an internationally popular Agile methodology. Scrum is very pragmatic and easy to operate, so it fits in the fast iterative development of software projects. However, Scrum only defines the core management framework. There are still many details and processes that have to be extended and developed. Based on the philosophy of Scrum and with the observation of the current development situations in China, ZenTao integrates bug management, test case management, release management and document management, and it completely covers the entire lifecycle of software development. In ZenTao, the concepts of product, project and test are clearly defined. Product team, development team and QA team coordinate and check with each other while they function differently. The three teams interact with each other through stories, tasks and bugs, and eventually deliver the product with quality.
## 4. Why choose ZenTao Project Management Software?
* ZenTao is a professional development project management software and cannot be replaced by any simple project management software.
* ZenTao has precise and pragmatic management philosphy, which will accelerate Agile development.
* ZenTao has full features as a project management software, so you dont have to integrate several systems together, like mantisbt + trac + testlink.
* Open source codes and flexible extension mechanism. It is convenient to use and develop based on ZenTao.
* Underlying framework and frontend UI framework are developed independently; robust and stable with beautiful interface and friendly interaction.
* Perfect community mechanism; you can get technical support and help in time.
* Zero input, which means you have no risk for choosing ZenTao, compared with other commercial software that cost you thousands of dollars.
* Support various deployments, either private or cloud.
## 5. Features of ZenTao Project Management Software
* Product management: including products, stories, plans, releases and roadmaps;
* Project management: including projects, tasks, teams, builds and burn-down charts;
* Quality management: including bugs, test cases, test tasks and test results;
* Document management: including product document library, project document library and customized document library;
* Work management: including to-do management and personal management, such as my tasks, my bugs, my story and my projects;
* Organization management: including department, users, groups and privileges;
* Statistics: various reports;
* Search: powerful search functions to help you find the data you need.
* Extension mechanism: extensible in almost any parts of ZenTao;
* API mechanism: convenient for integration with other systems.
## 6. Website
Our website is: [www.zentao.pm](http://www.zentao.pm)

View File

@@ -1,41 +0,0 @@
一、什么是禅道项目管理软件?
禅道是第一款国产的开源项目管理软件。它集产品管理、项目管理、质量管理、文档管理、 组织管理和事务管理于一体是一款专业的研发项目管理软件完整地覆盖了项目管理的核心流程。禅道管理思想注重实效软件架构合理操作简洁高效代码实现合理内置灵活的扩展机制和api调用机制支持多语言。
二、为什么用“禅道”这个名字?
禅和道是中国文化中极具代表意义的两个字,是中国传统文化的结晶。我们之所以选用“禅道”作为我们软件的名字,是希望通过这两个字来传达我们对管理的理解和思考。我们希望通过禅道来进行的管理,可以摒弃繁文缛节,还原管理的本质!
三、禅道的设计理念
禅道项目管理软件的主要管理思想基于国际流行的敏捷项目管理方 式——Scrum。scrum是一种注重实效的敏捷项目管理方式。它规定了核心的管理框架但具体的细节还需要团队自行扩充。禅道在遵循其管理方式基础上又融入了国内研发现状的很多需求比如bug管理测试用例管理发布管理文档管理等。因此禅道不仅仅是一款scrum敏捷项目管理工 具更是一款完备的项目管理软件。基于scrum又不局限于scrum。
禅道还首次创造性的将产品、项目、测试这三者的概念明确分开互相配合又互相制约通过需求、任务、bug来进行交相互动终通过项目拿到合格的产品。
四、选择禅道的八大理由:
1. 开源的软件,保证了您使用的放心和灵活。
2. 先进的管理思想,让您在竞争中拔得头筹。
3. 完备的管理功能,无需再整合其他多个系统。
4. 国产软件,中文支持,操作习惯更符合国人。
5. 灵活的扩展机制,可以保证您不局限于禅道自身的功能。
6. 日趋完善的社区机制,可以获得及时的技术支持和帮助,保证您无后顾之忧。
7. 几乎为零的投入,禅道作为开源软件,其投入几乎为零,相比动辄十几万的商业软件,您选择禅道没有任何风险。
8. 开发团队已经公司化运作保证软件的持久发展。我们从04年从事开源软件开发以来已经坚持了六年。
五、禅道的功能列表:
1. 产品管理:包括产品、需求、计划、发布、路线图等功能。
2. 项目管理包括项目、任务、团队、build、燃尽图等功能。
3. 质量管理包括bug、测试用例、测试任务、测试结果等功能。
4. 文档管理:包括产品文档库、项目文档库、自定义文档库等功能。
5. 事务管理包括todo管理我的任务、我的Bug、我的需求、我的项目等个人事务管理功能。
6. 组织管理:包括部门、用户、分组、权限等功能。
7. 统计功能:丰富的统计表。
8. 搜索功能:强大的搜索,帮助您找到相应的数据。
9. 灵活的扩展机制,几乎可以对禅道的任何地方进行扩展。
10. 强大的api机制方便与其他系统集成。
也许您已经"众里寻她千百度"那么让禅道带给您“蓦然回首那人却在灯火阑珊处”的惊喜吧Let's zentao!
禅道官方网站: [www.zentao.net](http://www.zentao.net)

View File

@@ -1 +1 @@
17.0.beta1
4.2.beta

View File

@@ -1,35 +0,0 @@
<?php
global $lang;
$config->zdisk = new stdclass();
$config->zdisk->root = array();
$config->zdisk->root['my'] = array('name' => $lang->my->common, 'type' => 'folder');
$config->zdisk->root['program'] = array('name' => $lang->program->common, 'type' => 'folder');
$config->zdisk->root['product'] = array('name' => $lang->product->common, 'type' => 'folder');
$config->zdisk->root['project'] = array('name' => $lang->project->common, 'type' => 'folder');
$config->zdisk->root['qa'] = array('name' => $lang->qa->common, 'type' => 'folder');
$config->zdisk->my = array();
$config->zdisk->my['todo'] = array('name' => $lang->user->todo, 'type' => 'file');
$config->zdisk->my['work'] = array('name' => $lang->my->work, 'type' => 'folder');
$config->zdisk->my['myproject'] = array('name' => $lang->projectCommon, 'type' => 'folder');
$config->zdisk->my['myexecution'] = array('name' => $lang->executionCommon, 'type' => 'folder');
$config->zdisk->work = array();
$config->zdisk->work['task'] = array('name' => $lang->user->task, 'type' => 'file');
$config->zdisk->work['story'] = array('name' => $lang->user->story, 'type' => 'file');
$config->zdisk->work['bug'] = array('name' => $lang->user->bug, 'type' => 'file');
$config->zdisk->work['case'] = array('name' => $lang->user->testCase, 'type' => 'file');
$config->zdisk->work['testtask'] = array('name' => $lang->user->testTask, 'type' => 'file');
$config->zdisk->myproject = array();
$config->zdisk->myproject['doing'] = array('name' => $lang->zdisk->doing, 'type' => 'file');
$config->zdisk->myproject['wait'] = array('name' => $lang->zdisk->wait, 'type' => 'file');
$config->zdisk->myproject['suspend'] = array('name' => $lang->zdisk->suspend, 'type' => 'file');
$config->zdisk->myproject['closed'] = array('name' => $lang->zdisk->closed, 'type' => 'file');
$config->zdisk->myproject['openedbyme'] = array('name' => $lang->zdisk->openedByMe, 'type' => 'file');
$config->zdisk->myexecution = array();
$config->zdisk->myexecution['undone'] = array('name' => $lang->zdisk->undone, 'type' => 'file');
$config->zdisk->myexecution['done'] = array('name' => $lang->zdisk->done, 'type' => 'file');

View File

@@ -1,127 +0,0 @@
<?php
/**
* The bug entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class bugEntry extends entry
{
/**
* GET method.
*
* @param int $bugID
* @access public
* @return void
*/
public function get($bugID)
{
$this->resetOpenApp($this->param('tab', 'product'));
$control = $this->loadController('bug', 'view');
$control->view($bugID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $data->data->bug;
/* Set product name and status */
$bug->productName = $data->data->product->name;
$bug->productStatus = $data->data->product->status;
/* Set module title */
$moduleTitle = '';
if(empty($bug->module)) $moduleTitle = '/';
if($bug->module)
{
$modulePath = $data->data->modulePath;
foreach($modulePath as $key => $module)
{
$moduleTitle .= $module->name;
if(isset($modulePath[$key + 1])) $moduleTitle .= '/';
}
}
$bug->moduleTitle = $moduleTitle;
$openedBuilds = array();
foreach(explode(',', $bug->openedBuild) as $buildID)
{
if(empty($buildID)) continue;
$openedBuild = new stdclass();
$openedBuild->id = $buildID;
$openedBuild->title = zget($data->data->builds, $buildID, '');
$openedBuilds[] = $openedBuild;
}
$bug->openedBuild = $openedBuilds;
if($bug->resolvedBuild)
{
$resolvedBuild = new stdclass();
$resolvedBuild->id = $bug->resolvedBuild;
$resolvedBuild->title = zget($data->data->builds, $bug->resolvedBuild, '');
$bug->resolvedBuild = $resolvedBuild;
}
$bug->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->bug);
$preAndNext = $data->data->preAndNext;
$bug->preAndNext = array();
$bug->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : '';
$bug->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : '';
$this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
}
/**
* PUT method.
*
* @param int $bugID
* @access public
* @return void
*/
public function put($bugID)
{
$oldBug = $this->loadModel('bug')->getByID($bugID);
/* Set $_POST variables. */
$fields = 'uid,title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task,module,steps,mailto,keywords';
$this->batchSetPost($fields, $oldBug);
$this->setPost('notifyEmail', implode(',', $this->request('notifyEmail', array())));
$control = $this->loadController('bug', 'edit');
$control->edit($bugID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->status)) return $this->sendError(400, 'error');
$bug = $this->bug->getByID($bugID);
$this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $bugID
* @access public
* @return void
*/
public function delete($bugID)
{
$control = $this->loadController('bug', 'delete');
$control->delete($bugID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The bug active entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class bugActiveEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
$fields = 'assignedTo,uid,openedBuild,comment';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'activate');
$control->activate($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The bug assign entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class bugAssignEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
$fields = 'assignedTo,mailto,comment';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'assignTo');
$control->assignTo($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,37 +0,0 @@
<?php
/**
* The bug close entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class bugCloseEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
$fields = 'comment';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'close');
$control->close($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The bug confirm entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class bugConfirmEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
**/
public function post($bugID)
{
$fields = 'assignedTo,mailto,comment,pri,type';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'confirmBug');
$control->confirmBug($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getById($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,61 +0,0 @@
<?php
/**
* The bug recordEstimate entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class bugRecordEstimateEntry extends Entry
{
/**
* GET method.
*
* @param int $bugID
* @access public
* @return void
*/
public function get($bugID)
{
if($this->config->edition == 'open') return $this->send400('ZenTaoPMS does not have bug effort function.');
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('bug', $bugID);
$data = $this->getData();
if(!$data) return $this->error('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$effort = $data->data->efforts;
$this->send(200, array('effort' => $effort));
}
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
if($this->config->edition == 'open') return $this->send400('ZenTaoPMS does not have bug effort function.');
$fields = 'id,dates,consumed,objectType,objectID,work';
$this->batchSetPost($fields);
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('bug', $bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The bug resolve entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class bugResolveEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
$fields = 'resolution,resolvedBuild,resolvedDate,duplicateBug,assignedTo,uid,comment';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'resolve');
$control->resolve($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->loadModel('bug')->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,resolvedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,105 +0,0 @@
<?php
/**
* The bugs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class bugsEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(empty($productID)) $productID = $this->param('product', 0);
if(empty($productID)) return $this->sendError(400, 'Need product id.');
$control = $this->loadController('bug', 'browse');
$control->browse($productID, $this->param('branch', 'all'), $this->param('status', ''), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$bugs = $data->data->bugs;
$pager = $data->data->pager;
$result = array();
$this->loadModel('product');
foreach($bugs as $bug)
{
$status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]);
if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed);
if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed);
if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs);
$bug->status = $status['code'];
$bug->statusName = $status['name'];
$product = $this->product->getById($bug->product);
$bug->productStatus = $product->status;
$result[$bug->id] = $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool');
}
$storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.id')->in(array_keys($result))
->andWhere('t1.story')->ne('0')
->andWhere('t1.storyVersion != t2.version')
->fetchPairs('id', 'id');
foreach($storyChangeds as $bugID)
{
$status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed);
$result[$bugID]->status = $status['code'];
$result[$bugID]->statusName = $status['name'];
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result)));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $productID
* @access public
* @return void
*/
public function post($productID = 0)
{
if(!$productID) $productID = $this->param('product');
if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product;
if(!$productID) return $this->sendError(400, 'Need product id.');
$fields = 'title,project,execution,openedBuild,assignedTo,pri,module,severity,type,story,task,mailto,keywords,steps,uid';
$this->batchSetPost($fields);
$this->setPost('product', $productID);
$this->setPost('notifyEmail', implode(',', $this->request('notifyEmail', array())));
$control = $this->loadController('bug', 'create');
$this->requireFields('title,pri,severity,type,openedBuild');
$control->create($productID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$bug = $this->loadModel('bug')->getByID($data->id);
$this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
}
}

View File

@@ -1,76 +0,0 @@
<?php
/**
* The build entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class buildEntry extends Entry
{
/**
* GET method.
*
* @param int $buildID
* @access public
* @return void
*/
public function get($buildID)
{
$control = $this->loadController('build', 'view');
$control->view($buildID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'success') return $this->send(200, $this->format($data->data->build, 'builder:user,stories:idList,bugs:idList,deleted:bool'));
/* Exception handling. */
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->sendError(400, 'error');
}
/**
* PUT method.
*
* @param int $buildID
* @access public
* @return void
*/
public function put($buildID)
{
$oldBuild = $this->loadModel('build')->getByID($buildID);
/* Set $_POST variables. */
$fields = 'execution,product,name,builder,date,scmPath,filePath,desc';
$this->batchSetPost($fields, $oldBuild);
$control = $this->loadController('build', 'edit');
$control->edit($buildID);
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$build = $this->build->getByID($buildID);
$this->send(200, $this->format($build, 'builder:user,stories:idList,bugs:idList,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $buildID
* @access public
* @return void
*/
public function delete($buildID)
{
$control = $this->loadController('build', 'delete');
$control->delete($buildID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,72 +0,0 @@
<?php
/**
* The builds entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class buildsEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(empty($projectID)) $projectID = $this->param('project', 0);
if(empty($projectID)) return $this->sendError(400, "Need project id.");
$control = $this->loadController('project', 'build');
$control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc'));
$data = $this->getData();
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$result = array();
foreach($data->data->projectBuilds as $productID => $builds)
{
foreach($builds as $build) $result[] = $this->format($build, 'bugs:idList,stories:idList,builder:user,deleted:bool');
}
return $this->send(200, array('total' => count($result), 'builds' => $result));
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
if(!$projectID) $projectID = $this->param('project', 0);
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'execution,product,name,builder,date,scmPath,filePath,desc';
$this->batchSetPost($fields);
$control = $this->loadController('build', 'create');
$this->requireFields('execution,product,name,builder,date');
$control->create(0, 0, $projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$build = $this->loadModel('build')->getByID($data->id);
$this->send(201, $build);
}
}

View File

@@ -1,30 +0,0 @@
<?php
/**
* The ciresults entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class ciresultsEntry extends entry
{
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$control = $this->loadController('ci', 'commitResult');
$control->commitResult();
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$this->send(201, array());
}
}

View File

@@ -1,49 +0,0 @@
<?php
/**
* The config entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class configEntry extends baseEntry
{
/**
* GET method.
*
* @param int $name language,version,timezone etc.
* @access public
* @return void
*/
public function get($name)
{
$config = array('name' => $name);
switch($name)
{
case 'language':
$config['value'] = $this->config->default->lang;
break;
case 'version':
$config['value'] = $this->config->version;
break;
case 'charset':
$config['value'] = $this->config->charset;
break;
case 'timezone':
$config['value'] = $this->config->timezone;
break;
case 'systemMode':
$config['value'] = $this->config->systemMode;
break;
default:
$this->sendError(400, 'No configuration.');
return;
}
$this->send(200, $config);
}
}

View File

@@ -1,35 +0,0 @@
<?php
/**
* The configs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class configsEntry extends baseEntry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$configs = array();
$configs[] = array('key' => 'language', 'value' => $this->config->default->lang);
$configs[] = array('key' => 'version', 'value' => $this->config->version);
$configs[] = array('key' => 'charset', 'value' => $this->config->charset);
$configs[] = array('key' => 'timezone', 'value' => $this->config->timezone);
$configs[] = array('key' => 'systemMode', 'value' => $this->config->systemMode);
$configs[] = array('key' => 'hourUnit', 'value' => $this->config->hourUnit);
$configs[] = array('key' => 'CRProduct', 'value' => $this->config->CRProduct);
$configs[] = array('key' => 'CRExecution', 'value' => $this->config->CRExecution);
$this->send(200, $configs);
}
}

View File

@@ -1,70 +0,0 @@
<?php
/**
* The department entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class departmentEntry extends Entry
{
/**
* GET method.
*
* @param int $departmentID
* @access public
* @return void
*/
public function get($departmentID)
{
$dept = $this->loadModel('dept')->getByID($departmentID);
if(!$dept) return $this->send404();
return $this->send(200, $dept);
}
/**
* PUT method.
*
* @param int $departmentID
* @access public
* @return void
*/
public function put($departmentID)
{
$oldDept = $this->loadModel('dept')->getByID($departmentID);
/* Set $_POST variables. */
$fields = 'parent,name,manager';
$this->batchSetPost($fields, $oldDept);
$this->requireFields('name');
$control = $this->loadController('dept', 'edit');
$control->edit($departmentID);
$this->getData();
$department = $this->dept->getByID($departmentID);
$this->send(200, $department);
}
/**
* DELETE method.
*
* @param int $departmentID
* @access public
* @return void
*/
public function delete($departmentID)
{
$control = $this->loadController('dept', 'delete');
$control->delete($departmentID, 'true');
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,20 +0,0 @@
<?php
/**
* The departments entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class departmentsEntry extends entry
{
public function get()
{
$depts = $this->loadModel('dept')->getDataStructure();
return $this->send(200, $depts);
}
}

View File

@@ -1,88 +0,0 @@
<?php
/**
* The doc entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class docEntry extends entry
{
/**
* GET method.
*
* @param int $docID
* @access public
* @return void
*/
public function get($docID)
{
$this->resetOpenApp($this->param('tab', 'doc'));
$control = $this->loadController('doc', 'view');
$control->view($docID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$doc = $data->data->doc;
unset($doc->draft);
if(!empty($doc->files)) $doc->files = array_values((array)$doc->files);
/* Set lib name */
$doc->libName = $data->data->lib->name;
$preAndNext = $data->data->preAndNext;
$doc->preAndNext = array();
$doc->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : '';
$doc->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : '';
$this->send(200, $this->format($doc, 'addedBy:user,addedDate:time,assignedTo:user,assignedDate:date,editedBy:user,editedDate:time,mailto:userList'));
}
/**
* PUT method.
*
* @param int $storyID
* @access public
* @return void
*/
public function put($storyID)
{
$oldStory = $this->loadModel('story')->getByID($storyID);
/* Set $_POST variables. */
$fields = 'type';
$this->batchSetPost($fields, $oldStory);
$this->setPost('parent', 0);
$control = $this->loadController('story', 'edit');
$control->edit($storyID);
$this->getData();
$story = $this->story->getByID($storyID);
$this->sendSuccess(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $storyID
* @access public
* @return void
*/
public function delete($storyID)
{
$control = $this->loadController('story', 'delete');
$control->delete($storyID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The doclibs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class doclibsEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$type = $this->param('type', 0);
$objectID = $this->param('objectID', 0);
$libs = $this->loadModel('doc')->getLibs($type, $this->param('extra', ''), $this->param('appendLibs', ''), $objectID);
$result = array();
foreach($libs as $libID => $libName)
{
$lib = new stdclass();
$lib->id = $libID;
$lib->name = $libName;
$result[] = $lib;
}
krsort($result);
return $this->send(200, array('libs' => array_values($result)));
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The docs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class docsEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get($libID = 0)
{
if(empty($libID)) $libID = $this->param('lib', 0);
if(empty($libID)) return $this->sendError(400, 'Need lib id.');
$docTree = $this->loadModel('doc')->getDocTree($libID);
foreach($docTree as $i => $module)
{
if(empty($module->id))
{
unset($docTree[$i]);
foreach($module->children as $doc) $docTree[] = $doc;
}
}
return $this->send(200, array('docs' => array_values($docTree)));
}
}

View File

@@ -1,24 +0,0 @@
<?php
/**
* The error entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class errorEntry extends Entry
{
/**
* 404 Not Found.
*
* @access public
* @return void
*/
public function notFound()
{
$this->send(404, array('error' => 'not found'));
}
}

View File

@@ -1,158 +0,0 @@
<?php
/**
* The execution entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionEntry extends Entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID)
{
$fields = $this->param('fields');
$productID = $this->param('productID');
$status = $this->param('status', 'all');
$control = $this->loadController('execution', 'view');
$control->view($executionID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$execution = $this->format($data->data->execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool');
$execution->progress = ($execution->totalConsumed + $execution->totalLeft) ? round($execution->totalConsumed / ($execution->totalConsumed + $execution->totalLeft) * 100, 1) : 0;
$execution->teamMembers = array_values((array)$data->data->teamMembers);
$execution->products = array();
foreach($data->data->products as $productID => $executionProduct)
{
if($status == 'noclosed' and $executionProduct->status == 'closed') continue;
$product = new stdclass();
$product->id = $executionProduct->id;
$product->name = $executionProduct->name;
$product->plans = array();
foreach($executionProduct->plans as $planID)
{
$plan = new stdclass();
$plan->id = $planID;
$plan->name = $data->data->planGroups->{$productID}->{$planID};
$product->plans[] = $plan;
}
$execution->products[] = $product;
}
$this->loadModel('testcase');
$execution->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
if(!$fields) $this->send(200, $execution);
$users = $data->data->users;
/* Set other fields. */
$fields = explode(',', strtolower($fields));
foreach($fields as $field)
{
switch($field)
{
case 'modules':
$control = $this->loadController('tree', 'browsetask');
$control->browsetask($executionID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$execution->modules = $data->data->tree;
}
case 'builds':
$execution->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone', $executionID, 'execution');
break;
case 'moduleoptionmenu':
$execution->moduleOptionMenu = $this->loadModel('tree')->getTaskOptionMenu($executionID, 0, 0, 'allModule');
break;
case 'members':
$execution->members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');;
unset($execution->members['']);
break;
case 'stories':
$stories = $this->loadModel('story')->getExecutionStories($executionID);
foreach($stories as $storyID => $story) $stories[$storyID] = $this->filterFields($story, 'id,title,module,pri,status,stage,estimate');
$execution->stories = array_values($stories);
break;
case 'actions':
$actions = $data->data->actions;
$execution->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->execution);
break;
case "dynamics":
$dynamics = $data->data->dynamics;
$execution->dynamics = $this->loadModel('action')->processDynamicForAPI($dynamics);
break;
case 'chartdata':
list($dateList, $interval) = $this->loadModel('execution')->getDateList($execution->begin, $execution->end, 'noweekend', '0', 'Y-m-d');
$execution->chartData = $this->execution->buildBurnData($executionID, $dateList, 'noweekend', 'left');
break;
}
}
return $this->send(200, $execution);
}
/**
* PUT method.
*
* @param int $executionID
* @access public
* @return void
*/
public function put($executionID)
{
$oldExecution = $this->loadModel('execution')->getByID($executionID);
/* Set $_POST variables. */
$fields = 'project,code,name,begin,end,lifetime,desc,days,acl,status,PO,PM,QD,RD';
$this->batchSetPost($fields, $oldExecution);
$this->setPost('whitelist', $this->request('whitelist', explode(',', $oldExecution->whitelist)));
$products = $this->loadModel('product')->getProducts($executionID);
$this->setPost('products', $this->request('products', array_keys($products)));
$control = $this->loadController('execution', 'edit');
$control->edit($executionID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$execution = $this->execution->getByID($executionID);
$this->send(200, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $executionID
* @access public
* @return void
*/
public function delete($executionID)
{
$control = $this->loadController('execution', 'delete');
$control->delete($executionID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,72 +0,0 @@
<?php
/**
* The execution bugs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionBugsEntry extends entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID = 0)
{
if(!$executionID) $executionID = $this->param('execution', 0);
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
$control = $this->loadController('execution', 'bug');
$control->bug($executionID, $this->param('product', 0), $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$bugs = $data->data->bugs;
$pager = $data->data->pager;
$result = array();
$this->loadModel('product');
foreach($bugs as $bug)
{
$status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]);
if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed);
if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed);
if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs);
$bug->status = $status['code'];
$bug->statusName = $status['name'];
$product = $this->product->getById($bug->product);
$bug->productStatus = $product->status;
$result[$bug->id] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool');
}
$storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.id')->in(array_keys($result))
->andWhere('t1.story')->ne('0')
->andWhere('t1.storyVersion != t2.version')
->fetchPairs('id', 'id');
foreach($storyChangeds as $bugID)
{
$status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed);
$result[$bugID]->status = $status['code'];
$result[$bugID]->statusName = $status['name'];
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result)));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,41 +0,0 @@
<?php
/**
* The execution builds entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionBuildsEntry extends entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID = 0)
{
if(empty($executionID)) $executionID = $this->param('execution', 0);
if(empty($executionID)) return $this->sendError(400, "Need execution id.");
$control = $this->loadController('execution', 'build');
$control->build($executionID, $this->param('status', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc'));
$data = $this->getData();
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$result = array();
foreach($data->data->executionBuilds as $builds)
{
foreach($builds as $build) $result[] = $this->format($build, 'builder:user,bugs:idList,stories:idList,deleted:bool');
}
return $this->send(200, array('total' => count($result), 'builds' => $result));
}
}

View File

@@ -1,49 +0,0 @@
<?php
/**
* The execution cases entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionCasesEntry extends entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID = 0)
{
if(!$executionID) $executionID = $this->param('execution', 0);
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
$control = $this->loadController('execution', 'testcase');
$control->testcase($executionID, $this->param('status', 'all'), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$cases = $data->data->cases;
$pager = $data->data->pager;
$result = array();
foreach($cases as $case)
{
$case->statusName = $this->lang->testcase->statusList[$case->status];
$result[] = $this->format($case, 'openedDate:time,reviewedDate:date,lastEditedDate:time,lastRunDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'cases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,153 +0,0 @@
<?php
/**
* The executions entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionsEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
$appendFields = $this->param('fields', '');
$withProject = $this->param('withProject', '');
if(strpos(strtolower(",{$appendFields},"), ',dropmenu,') !== false) return $this->getDropMenu();
if($projectID)
{
$control = $this->loadController('project', 'execution');
$control->execution($this->param('status', 'undone'), $projectID, $this->param('order', 'id_desc'), $this->param('product', 0), 0, $this->param('limit', 20), $this->param('page', 1));
/* Response */
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$executions = $data->data->executionStats;
$pager = $data->data->pager;
$projects = $data->data->projects;
}
else
{
$control = $this->loadController('execution', 'all');
$control->all($this->param('status', 'all'), $this->param('project', $projectID), $this->param('order', 'id_desc'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$executions = $data->data->executionStats;
$pager = $data->data->pager;
$projects = $data->data->projects;
}
$result = array();
foreach($data->data->executionStats as $execution)
{
foreach($execution->hours as $field => $value) $execution->$field = $value;
$execution = $this->filterFields($execution, 'id,name,project,code,type,parent,begin,end,status,openedBy,openedDate,delay,progress,' . $appendFields);
$result[] = $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool');
}
$data = array();
$data['page'] = $pager->pageID;
$data['total'] = $pager->recTotal;
$data['limit'] = $pager->recPerPage;
$data['executions'] = $result;
if(!empty($withProject)) $data['projects'] = $projects;
return $this->send(200, $data);
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
$fields = 'project,code,name,begin,end,lifetime,desc,days';
$this->batchSetPost($fields);
$projectID = $this->param('project', $projectID);
$this->setPost('project', $projectID);
$this->setPost('acl', $this->request('acl', 'private'));
$this->setPost('PO', $this->request('PO', ''));
$this->setPost('PM', $this->request('PM', ''));
$this->setPost('QD', $this->request('QD', ''));
$this->setPost('RD', $this->request('RD', ''));
$this->setPost('whitelist', $this->request('whitelist', array()));
$this->setPost('products', $this->request('products', array()));
$this->setPost('plans', $this->request('plans', array()));
$control = $this->loadController('execution', 'create'); $this->requireFields('name,code,begin,end,days');
$control->create($projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$execution = $this->loadModel('execution')->getByID($data->id);
$this->send(201, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool'));
}
/**
* Get drop menu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$control = $this->loadController('execution', 'ajaxGetDropMenu');
$control->ajaxGetDropMenu($this->request('executionID', 0), $this->request('module', 'execution'), $this->request('method', 'task'), $this->request('extra', ''));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$account = $this->app->user->account;
$projects = $data->data->projects;
$dropMenu = array('involved' => array(), 'other' => array(), 'closed' => array());
foreach($data->data->executions as $projectID => $projectExecutions)
{
foreach($projectExecutions as $execution)
{
if(helper::diffDate(date('Y-m-d'), $execution->end) > 0) $execution->delay = true;
$teams = $execution->teams;
$execution = $this->filterFields($execution, 'id,project,model,type,name,code,status,PM,delay');
$projectName = zget($projects, $execution->project, '');
if($projectName) $execution->name = $projectName . '/' . $execution->name;
if($execution->status == 'closed')
{
$dropMenu['closed'][] = $execution;
}
elseif($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $account or isset($teams->$account)))
{
$dropMenu['involved'][] = $execution;
}
else
{
$dropMenu['other'][] = $execution;
}
}
}
$this->send(200, $dropMenu);
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* The execution entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package execution
* @version 1
* @link http://www.zentao.net
*/
class executionStoriesEntry extends entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID)
{
if(empty($executionID)) $this->param('execution', 0);
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
$control = $this->loadController('execution', 'story');
$control->story($executionID, $this->param('order', 'id_desc'), $this->param('status', 'all'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$stories = $data->data->stories;
$pager = $data->data->pager;
$result = array();
$this->loadModel('product');
foreach($stories as $story)
{
$product = $this->product->getById($story->product);
$story->productStatus = $product->status;
$result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,85 +0,0 @@
<?php
/**
* The product entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class feedbackEntry extends Entry
{
/**
* GET method.
*
* @param int $feedbackID
* @access public
* @return void
*/
public function get($feedbackID)
{
$control = $this->loadController('feedback', 'adminView');
$control->adminView($feedbackID);
$data = $this->getData();
$feedback = $data->data->feedback;
$feedback->publicStatus = $feedback->public;
$feedback->productName = $data->data->product;
$feedback->moduleName = isset($data->data->modulePath[0]->name) ? $data->data->modulePath[0]->name : '/';
$feedback->resultType = $data->data->type;
if(isset($feedback->resultInfo) and $feedback->resultInfo->deleted == 0) $feedback->resultStatus = $this->loadModel('feedback')->processStatus($feedback->resultType, $feedback->resultInfo);
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$feedback->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->feedback);
$this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
}
/**
* PUT method.
*
* @param int $feedbackID
* @access public
* @return void
*/
public function put($feedbackID)
{
$oldFeedback = $this->loadModel('feedback')->getById($feedbackID);
$fields = 'module,product,type,title,public,desc,status,feedbackBy,notifyEmail,notify,uid';
$this->batchSetPost($fields, $oldFeedback);
$control = $this->loadController('feedback', 'edit');
$control->edit($feedbackID, '');
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$feedback = $this->feedback->getByID($feedbackID);
return $this->send(200, $this->format($feedback, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:time,processedBy:user,processedDate:time,closedBy:user,closedDate:time,editedBy:user,editedDate:time,mailto:userList,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $feedbackID
* @access public
* @return void
*/
public function delete($feedbackID)
{
$control = $this->loadController('feedback', 'delete');
$control->delete($feedbackID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* The feedback assignto entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class feedbackAssignToEntry extends Entry
{
/**
* POST method.
*
* @param int $feedbackID
* @access public
* @return void
*/
public function post($feedbackID)
{
$feedback = $this->loadModel('feedback')->getById($feedbackID);
$fields = 'assignedTo,comment,mailto';
$this->batchSetPost($fields);
$control = $this->loadController('feedback', 'assignTo');
$control->assignTo($feedbackID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$feedback = $this->loadModel('feedback')->getById($feedbackID);
$this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'));
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* The feedback close entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class feedbackCloseEntry extends Entry
{
/**
* POST method.
*
* @param int $feedbackID
* @access public
* @return void
*/
public function post($feedbackID)
{
$feedback = $this->loadModel('feedback')->getById($feedbackID);
$fields = 'closedReason,comment';
$this->batchSetPost($fields);
$control = $this->loadController('feedback', 'close');
$control->close($feedbackID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$feedback = $this->loadModel('feedback')->getById($feedbackID);
$this->send(200, $feedback);
}
}

View File

@@ -1,95 +0,0 @@
<?php
/**
* The executions entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class feedbacksEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
if(strpos(strtolower($this->param('fields')), 'moduleandproduct') !== false) return $this->getModuleAndProduct();
$control = $this->loadController('feedback', 'admin');
$control->admin($this->param('status', 'unclosed'), 0, $this->param('orderBy', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$feedbacks = $data->data->feedbacks;
$pager = $data->data->pager;
$result = array();
foreach($feedbacks as $feedback)
{
$result[] = $this->format($feedback, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:time,processedBy:user,processedDate:time,closedBy:user,closedDate:time,editedBy:user,editedDate:time,mailto:userList,deleted:bool');
}
$data = array();
$data['page'] = $pager->pageID;
$data['total'] = $pager->recTotal;
$data['limit'] = $pager->recPerPage;
$data['feedbacks'] = $result;
return $this->send(200, $data);
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'module,product,type,title,public,desc,status,feedbackBy,notifyEmail,notify,uid';
$this->batchSetPost($fields);
$control = $this->loadController('feedback', 'create');
$this->requireFields('title,product');
$control->create();
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$feedback = $this->loadModel('feedback')->getById($data->id);
$this->send(201, $this->format($feedback, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:time,processedBy:user,processedDate:time,closedBy:user,closedDate:time,editedBy:user,editedDate:time,assignedTo:user,assignedDate:time,feedbackBy:user,mailto:userList,deleted:bool'));
}
/**
* GET method.
*
* @access public
* @return void
*/
public function getModuleAndProduct()
{
$control = $this->loadController('feedback', 'create');
$control->create();
$data = $this->getData();
$modules = $data->data->modules;
$products = $data->data->products;
$data = array();
$data['modules'] = $modules;
$data['products'] = $products;
return $this->send(200, $data);
}
}

View File

@@ -1,45 +0,0 @@
<?php
/**
* The file entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class fileEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get($fileID)
{
$control = $this->loadController('file', 'download');
$control->download($fileID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->send(200, $data);
}
/**
* PUT method.
*
* @access public
* @return void
*/
public function put($fileID)
{
$uid = $this->param('uid', '');
$action = $this->param('action', '');
if($action == 'remove') unset($_SESSION['album']['used'][$uid][$fileID]);
$this->send(200, array('id' => $fileID));
}
}

View File

@@ -1,34 +0,0 @@
<?php
/**
* The files entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class filesEntry extends Entry
{
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$uid = $this->param('uid', '');
$control = $this->loadController('file', 'ajaxUpload');
$control->ajaxUpload($uid);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->send(200, array('id' => $data->id, 'url' => $data->url));
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* The repo entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author xiawenlong <xiawenlong@cnezsoft.com>
* @package repo
* @version 1
* @link http://www.zentao.net
*/
class gitlabWebhookEntry extends baseEntry
{
/**
* Repo webhook.
*
* @access public
* @return void
*/
public function post()
{
$repoID = $this->param('repoID');
if(empty($repoID)) return;
$this->loadModel('repo');
$repo = $this->repo->getRepoByID($repoID);
if(empty($repo)) return;
$headers = getallheaders(); /* Fetch all HTTP request headers. */
$event = isset($headers['X-Gitlab-Event']) ? $headers['X-Gitlab-Event'] : '';
$token = isset($headers['X-Gitlab-Token']) ? $headers['X-Gitlab-Token'] : '';
if(empty($event) || empty($token)) return;
$this->repo->handleWebhook($event, $token, $this->requestBody, $repo);
}
}

View File

@@ -1,49 +0,0 @@
<?php
/**
* The groups entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class groupsEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$groups = $this->loadModel('group')->getList();
$privsGroup = $this->dao->select('`group`,module, method')->from(TABLE_GROUPPRIV)->orderBy('module')->fetchGroup('group');
$usersGroup = $this->dao->select('t1.`group`,t1.account,t2.realname')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->fetchGroup('group');
foreach($groups as $i => $group)
{
if($group->acl)
{
$acl = json_decode($group->acl, true);
$group->acl = array();
$group->acl['views'] = $acl['views'];
}
$privs = zget($privsGroup, $group->id, array());
$group->privs = array();
foreach($privs as $priv) $group->privs[$priv->module][$priv->method] = true;
$accounts = zget($usersGroup, $group->id, array());
$group->accounts = array();
foreach($accounts as $account) $group->accounts[$account->account] = $account->realname;
$groups[$i] = $group;
}
return $this->send(200, $groups);
}
}

View File

@@ -1,79 +0,0 @@
<?php
/**
* The issue entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class issueEntry extends Entry
{
/**
* GET method.
*
* @param int|string $issueID. Issues id for Gitlab has '-', such as task-1, bug-1.
* @access public
* @return void
*/
public function get($issueID)
{
/* If $issueID has '-', go to productIssue entry point for Gitlab. */
if(strpos($issueID, '-') !== FALSE) return $this->fetch('productIssue', 'get', array('issueID' => $issueID));
/* Otherwise, get issue of project. */
$control = $this->loadController('issue', 'view');
$control->view($issueID);
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->status) and $data->status == 'success') return $this->send(200, $this->format($data->data->issue, 'createdDate:time,editedDate:time,assignedDate:time'));
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->sendError(400, 'error');
}
/**
* PUT method.
*
* @param int $issueID
* @access public
* @return void
*/
public function put($issueID)
{
$oldIssue = $this->loadModel('issue')->getByID($issueID);
/* Set $_POST variables. */
$fields = 'type,title,severity,pri,assignedTo,deadline,desc';
$this->batchSetPost($fields, $oldIssue);
$control = $this->loadController('issue', 'edit');
$control->edit($issueID);
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$issue = $this->issue->getByID($issueID);
$this->send(200, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time'));
}
/**
* DELETE method.
*
* @param int $issueID
* @access public
* @return void
*/
public function delete($issueID)
{
$control = $this->loadController('issue', 'delete');
$control->delete($issueID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,100 +0,0 @@
<?php
/**
* The issues entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class issuesEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if($projectID) return $this->getProjectIssues($projectID);
/* Get my issues defaultly. */
$control = $this->loadController('my', 'issue');
$control->issue($this->param('type', 'assignedTo'), $this->param('order', 'id_desc'), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$pager = $data->data->pager;
$result = array();
foreach($data->data->issues as $issue)
{
$result[] = $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'issues' => $result));
}
/**
* Get issues of project.
*
* @param int $projectID
* @access public
* @return void
*/
private function getProjectIssues($projectID)
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$control = $this->loadController('issue', 'browse');
$control->browse($projectID, $this->param('type', 'all'), 0, $this->param('order', ''), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$pager = $data->data->pager;
$result = array();
foreach($data->data->issueList as $issue)
{
$result[] = $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'issues' => $result));
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'type,title,severity,pri,assignedTo,deadline,desc';
$this->batchSetPost($fields);
$control = $this->loadController('issue', 'create');
$this->requireFields('type,title,severity');
$control->create($projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and!isset($data->id)) return $this->sendError(400, $data->message);
$issue = $this->loadModel('issue')->getByID($data->id);
$this->send(201, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time'));
}
}

View File

@@ -1,79 +0,0 @@
<?php
/**
* The langs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class langsEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$modules = $this->param('modules', '');
$language = $this->param('lang', '');
if($language and !isset($this->config->langs[$language])) return $this->sendError(400, 'Error lang parameter');
if(empty($modules)) return $this->sendError(400, 'Need modules');
if(empty($language)) $language = 'zh-cn';
$this->app->setClientLang($language);
$modules = explode(',', $modules);
foreach($modules as $module)
{
if($module == 'all')
{
$loadedModule = array();
foreach(glob($this->app->getModuleRoot() . '*') as $modulePath)
{
if(!is_dir($modulePath)) continue;
$moduleName = basename($modulePath);
$this->app->loadLang($moduleName);
$loadedModule[$moduleName] = $moduleName;
}
foreach(glob($this->app->getExtensionRoot() . '*') as $extensionPath)
{
if(!is_dir($extensionPath)) continue;
$edition = basename($extensionPath);
if($edition == 'lite') continue;
if($edition == 'biz' or $edition == 'max')
{
if($this->config->edition == 'open') continue;
if($this->config->edition != 'open' and $this->config->edition != $edition) continue;
}
foreach(glob($extensionPath . '/*') as $modulePath)
{
if(!is_dir($modulePath)) continue;
$moduleName = basename($modulePath);
if(isset($loadedModule[$moduleName])) continue;
$this->app->loadLang($moduleName);
$loadedModule[$moduleName] = $moduleName;
}
}
break;
}
$this->app->loadLang($module);
}
return $this->send(200, $this->lang);
}
}

View File

@@ -1,80 +0,0 @@
<?php
/**
* The meetings entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class meetingsEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(empty($projectID)) $projectID = $this->param('project', 0);
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
/* Get meetings by project. */
$control = $this->loadController('meeting', 'browse');
$control->browse($projectID, $this->param('status', 'all'), '', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$pager = $data->data->pager;
$result = array();
foreach($data->data->meetings as $risk)
{
$result[] = $this->format($risk, 'createdDate:time,editedDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'meetings' => $result));
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
$this->batchSetPost($fields);
$this->setPost('impact', $this->request('impact', 3));
$this->setPost('probability', $this->request('probability', 3));
$this->setPost('rate', $this->request('rate', 9));
$this->setPost('pri', 'middle');
$control = $this->loadController('risk', 'create');
$this->requireFields('name');
$control->create($projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$risk = $this->loadModel('risk')->getByID($data->id);
$this->send(201, $this->format($risk, 'createdDate:time,editedDate:time'));
}
}

View File

@@ -1,43 +0,0 @@
<?php
/**
* The modules entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class modulesEntry extends Entry
{
/**
* Get method.
*
* @access public
* @return void
*/
public function get()
{
$objectType = $this->param('type', '');
$objectID = $this->param('id', '');
if(!$objectType or !$objectID) return $this->sendError(400, 'Need id and type.');
if(!in_array($objectType, array('story', 'task', 'bug', 'case'))) return $this->sendError(400, 'Type is not allowed');
if($objectType == 'task')
{
$control = $this->loadController('tree', 'browsetask');
$control->browseTask($objectID);
}
else
{
$control = $this->loadController('tree', 'browse');
$control->browse($objectID, $objectType);
}
$data = $this->getData();
if(isset($data->status) and $data->status == 'success') return $this->send(200, array('modules' => $data->data->tree));
return $this->send400(isset($data->message) ? $data->message: 'error');
}
}

View File

@@ -1,46 +0,0 @@
<?php
/**
* The options entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class optionsEntry extends entry
{
/**
* GET method.
*
* @param string $type
* @access public
* @return void
*/
public function get($type = '')
{
if(!$type) return $this->sendError(400, 'error');
$options = array();
switch($type)
{
case 'bug':
$this->app->loadLang('bug');
$options['type'] = $this->lang->bug->typeList;
$options['pri'] = $this->lang->bug->priList;
$options['severity'] = $this->lang->bug->severityList;
$options['modules'] = new stdclass();
$product = $this->param('product', 0);
if($product) $options['modules'] = $this->loadModel('tree')->getOptionMenu($product, 'bug');
$execution = $this->param('execution', 0);
$options['build'] = $this->loadModel('build')->getBuildPairs($product, 'all', '', $execution, 'execution');
break;
}
return $this->send(200, array('options' => $options));
}
}

View File

@@ -1,24 +0,0 @@
<?php
/**
* The ping entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class pingEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$this->send(200, array('token' => session_id(), 'tokenLife' => ini_get('session.gc_maxlifetime')));
}
}

View File

@@ -1,139 +0,0 @@
<?php
/**
* The product entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productEntry extends Entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID)
{
$fields = $this->param('fields');
$control = $this->loadController('product', 'view');
$control->view($productID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$product = $this->format($data->data->product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user,feedback:user');
$this->loadModel('testcase');
$product->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
if(!$fields) return $this->send(200, $product);
/* Set other fields. */
$fields = explode(',', strtolower($fields));
foreach($fields as $field)
{
switch($field)
{
case 'modules':
$control = $this->loadController('tree', 'browse');
$control->browse($productID, 'story');
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$product->modules = $data->data->tree;
}
break;
case 'execution':
$product->execution = $this->loadModel('product')->getExecutionPairsByProduct($productID);
break;
case 'bugstatistic':
$product->bugStatistic = $this->loadModel('bug')->getStatistic($productID);
break;
case 'moduleoptionmenu':
$product->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'story', 0, '0');
break;
case 'parentstories':
$product->parentstories= $this->loadModel('story')->getParentStoryPairs($productID);
break;
case 'builds':
$product->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone,withbranch', $this->param('object', 0), $this->param('objectType', 'execution'));
break;
case 'actions':
$product->addComment = common::hasPriv('action', 'comment') ? true : false;
$users = $this->loadModel('user')->getPairs();
$actions = $data->data->actions;
$product->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->product);
break;
case 'lastexecution':
$execution = $this->dao->select('t2.id,t2.name,t2.type')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->eq($productID)
->andWhere('t2.type')->in('sprint,stage')
->orderBy('t2.id desc')
->limit(1)
->fetch();
if($execution)
{
$workhour = $this->loadModel('project')->computerProgress(array($execution->id => $execution));
if(isset($workhour[$execution->id])) $execution->progress = $workhour[$execution->id]->progress;
}
$product->lastExecution = $execution;
break;
}
}
return $this->send(200, $product);
}
/**
* PUT method.
*
* @param int $productID
* @access public
* @return void
*/
public function put($productID)
{
$oldProduct = $this->loadModel('product')->getByID($productID);
/* Set $_POST variables. */
$fields = 'program,line,name,PO,QD,RD,type,desc,whitelist,status,acl';
$this->batchSetPost($fields, $oldProduct);
$control = $this->loadController('product', 'edit');
$control->edit($productID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$product = $this->product->getByID($productID);
$this->send(200, $this->format($product, 'createdDate:time'));
}
/**
* DELETE method.
*
* @param int $productID
* @access public
* @return void
*/
public function delete($productID)
{
$control = $this->loadController('product', 'delete');
$control->delete($productID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,205 +0,0 @@
<?php
/**
* The productissue entry point of ZenTaoPMS.
* It is only used by Gitlab.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productIssueEntry extends entry
{
/**
* GET method.
*
* @param string $issueID, such as task-1, story-1, bug-1
* @access public
* @return void
*/
public function get($issueID)
{
$this->loadModel('entry');
$idParams = explode('-', $issueID);
if(count($idParams) < 2) $this->sendError(400, 'The id of issue is wrong.');
$type = $idParams[0];
$id = intval($idParams[1]);
$issue = new stdclass();
switch($type)
{
case 'story':
$this->app->loadLang('story');
$storyStatus = array('' => '', 'draft' => 'opened', 'active' => 'opened', 'changed' => 'opened', 'closed' => 'closed');
$story = $this->dao->select('*')->from(TABLE_STORY)->where('id')->eq($id)->fetch();
if(!$story) $this->send404();
$issue->id = $issueID;
$issue->title = $story->title;
$issue->labels = array($this->app->lang->story->common, zget($this->app->lang->story->categoryList, $story->category));
$issue->pri = $story->pri;
$issue->openedDate = $story->openedDate;
$issue->openedBy = $story->openedBy;
$issue->lastEditedDate = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedDate : $story->lastEditedDate;
$issue->lastEditedBy = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedBy : $story->lastEditedBy;
$issue->status = $storyStatus[$story->status];
$issue->url = helper::createLink('story', 'view', "storyID=$id");
$storySpec = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('story')->eq($id)->andWhere('version')->eq($story->version)->fetch();
$issue->desc = $storySpec->spec;
$issue->assignedTo = $story->assignedTo == "" ? array() : array($story->assignedTo);
break;
case 'bug':
$this->app->loadLang('bug');
$bugStatus = array('' => '', 'active' => 'opened', 'resolved' => 'opened', 'closed' => 'closed');
$bug = $this->dao->select('*')->from(TABLE_BUG)->where('id')->eq($id)->fetch();
if(!$bug) $this->send404();
$issue->id = $issueID;
$issue->title = $bug->title;
$issue->labels = array($this->app->lang->bug->common, zget($this->app->lang->bug->typeList, $bug->type));
$issue->pri = $bug->pri;
$issue->openedDate = $bug->openedDate;
$issue->openedBy = $bug->openedBy;
$issue->lastEditedDate = helper::isZeroDate($bug->lastEditedDate) ? $bug->openedDate : $bug->lastEditedDate;
$issue->lastEditedBy = helper::isZeroDate($bug->lastEditedDate) ? $bug->openedBy : $bug->lastEditedBy;
$issue->status = $bugStatus[$bug->status];
$issue->url = helper::createLink('bug', 'view', "bugID=$id");
$issue->desc = $bug->steps;
$issue->assignedTo = $bug->assignedTo == "" ? array() : array($bug->assignedTo);
break;
case 'task':
$this->app->loadLang('task');
$taskStatus = array('' => '', 'wait' => 'opened', 'doing' => 'opened', 'done' => 'opened', 'pause' => 'opened', 'cancel' => 'opened', 'closed' => 'closed');
$task = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($id)->fetch();
if(!$task) $this->send404();
$issue->id = $issueID;
$issue->title = $task->name;
$issue->labels = array($this->app->lang->task->common, zget($this->app->lang->task->typeList, $task->type));
$issue->pri = $task->pri;
$issue->openedDate = $task->openedDate;
$issue->openedBy = $task->openedBy;
$issue->lastEditedDate = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedDate : $task->lastEditedDate;
$issue->lastEditedBy = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedBy : $task->lastEditedBy;
$issue->status = $taskStatus[$task->status];
$issue->url = helper::createLink('task', 'view', "taskID=$id");
$issue->desc = $task->desc;
/* Get assignees for task, the task object has the type of multiple assign only so far. */
$users = $this->dao->select('account')->from(TABLE_TEAM)
->where('type')->eq('task')
->andWhere('root')->eq($task->id)
->fetchAll();
if($users)
{
foreach($users as $user) $issue->assignedTo[] = $user->account;
}
else
{
$issue->assignedTo = $task->assignedTo == "" ? array() : array($task->assignedTo);
}
break;
default:
$this->send404();
}
$actions = $this->loadModel('action')->getList($type, $id);
$issue->comments = array_values($this->processActions($type, $actions));
/* Get all users in issues so that we can get user detail later in batch. */
$accountList = array();
foreach($issue->assignedTo as $account) $accountList[] = $account;
$accountList[] = $issue->openedBy;
$accountList = array_unique($accountList);
$profileList = $this->loadModel('user')->getUserDetailsForAPI($accountList);
/* Set the user detail to assignedTo and openedBy. */
foreach($issue->assignedTo as $key => $account)
{
if($account == 'closed')
{
$issue->assignedTo = array();
break;
}
$issue->assignedTo[$key] = $profileList[$account];
}
$issue->openedBy = $profileList[$issue->openedBy];
$this->send(200, array('issue' => $this->format($issue, 'openedDate:time,lastEditedDate:time')));
}
/**
* Process actions of one issue.
*
* @param string $type bug|task|story
* @param array $actions
* @access public
* @return array
*/
public function processActions($type, $actions)
{
$accountList = array();
foreach($actions as $action)
{
$accountList[] = $action->actor;
ob_start();
if(method_exists($this->action, "printActionForGitLab"))
{
$this->action->printActionForGitLab($action);
}
else
{
$this->action->printAction($action);
}
$action->title = ob_get_contents();
ob_clean();
$action->body_html = '';
if(!empty($action->history))
{
ob_start();
$this->action->printChanges($action->objectType, $action->history);
$action->body_html = ob_get_contents();
ob_clean();
}
if(!empty($action->comment))
{
$comment = strip_tags($action->comment) == $action->comment ? nl2br($action->comment) : $action->comment;
$action->body_html = "{$comment}";
}
}
/* Format user detail and date. */
$accountList = array_unique($accountList);
$profileList = $this->loadModel('user')->getUserDetailsForAPI($accountList);
foreach($actions as $key => $action)
{
$action->actor = isset($profileList[$action->actor]) ? $profileList[$action->actor] : array();
$action->date = gmdate("Y-m-d\TH:i:s\Z", strtotime($action->date));
/* Unset this action when actor is System. */
if(empty($action->actor)) unset($actions[$key]);
}
return $actions;
}
}

View File

@@ -1,353 +0,0 @@
<?php
/**
* The productissue entry point of ZenTaoPMS.
* It is only used by Gitlab.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productIssuesEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID)
{
if(!is_numeric($productID)) $this->sendError(400, 'The product_id is not supported');
$taskFields = 'id,status';
$taskStatus = array('' => '');
$taskStatus['opened'] = 'wait,doing,done,pause';
$taskStatus['closed'] = 'closed';
$storyFields = 'id,status';
$storyStatus = array('' => '');
$storyStatus['opened'] = 'draft,active,changed';
$storyStatus['closed'] = 'closed';
$bugFields = 'id,status';
$bugStatus = array('' => '');
$bugStatus['opened'] = 'active,resolved';
$bugStatus['closed'] = 'closed';
$productID = (int)$productID;
$status = $this->param('status', '');
$search = $this->param('search', '');
$page = intval($this->param('page', 1));
$limit = intval($this->param('limit', 20));
$order = $this->param('order', 'openedDate_desc');
$labels = $this->param('labels', '');
$labels = $labels ? explode(',', $labels) : array();
$orderParams = explode('_', $order);
$order = $orderParams[0];
$sort = (isset($orderParams[1]) and strtolower($orderParams[1]) == 'asc') ? 'asc' : 'desc';
if($status == 'all') $status = '';
if(!in_array($status, array('opened', 'closed', ''))) $this->sendError(400, 'The status is not supported');
switch($order)
{
case 'openedDate':
$taskFields .= ',openedDate';
$storyFields .= ',openedDate';
$bugFields .= ',openedDate';
break;
case 'title':
$taskFields .= ',name as title';
$storyFields .= ',title';
$bugFields .= ',title';
break;
case 'lastEditedDate':
$taskFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate";
$storyFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate";
$bugFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate";
break;
default:
$this->sendError(400, 'The order is not supported');
}
$issues = array();
$storyFilter = array();
$bugFilter = array();
$taskFilter = array();
$labelTypes = array();
if(!empty($labels))
{
$this->app->loadLang('story');
$this->app->loadLang('task');
$this->app->loadLang('bug');
$storyTypeMap = array_flip($this->app->lang->story->categoryList);
$taskTypeMap = array_flip($this->app->lang->task->typeList);
$bugTypeMap = array_flip($this->app->lang->bug->typeList);
$allValidLabels = array_merge(array_keys(array_merge($storyTypeMap, $taskTypeMap, $bugTypeMap)), array($this->app->lang->story->common, $this->app->lang->task->common, $this->app->lang->bug->common));
foreach($labels as $label)
{
/* Return empty result if label is not exists.*/
if(!in_array($label, $allValidLabels)) $this->send(200, array('page' => $page, 'total' => 0, 'limit' => $limit, 'issues' => array()));
if($label == $this->app->lang->story->common) $storyFilter[] = 'all';
if(isset($storyTypeMap[$label])) $storyFilter[] = $storyTypeMap[$label];
if($label == $this->app->lang->task->common) $taskFilter[] = 'all';
if(isset($taskTypeMap[$label])) $taskFilter[] = $taskTypeMap[$label];
if($label == $this->app->lang->bug->common) $bugFilter[] = 'all';
if(isset($bugTypeMap[$label])) $bugFilter[] = $bugTypeMap[$label];
}
}
if(!empty($storyFilter)) $labelTypes[] = 'story';
if(!empty($taskFilter)) $labelTypes[] = 'task';
if(!empty($bugFilter)) $labelTypes[] = 'bug';
/* If posted labels are not conflictive. */
if(count($labelTypes) < 2)
{
$storyFilter = array_unique($storyFilter);
$taskFilter = array_unique($taskFilter);
$bugFilter = array_unique($bugFilter);
$executions = $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->fetchPairs();
/* Get tasks. */
if(empty($labelTypes) or in_array('task', $labelTypes))
{
$query = $this->dao->select($taskFields)->from(TABLE_TASK)->where('execution')->in(array_values($executions))
->beginIF($search)->andWhere('name')->like("%$search%")->fi()
->beginIF($status)->andWhere('status')->in($taskStatus[$status])->fi()
->andWhere('deleted')->eq(0);
foreach($taskFilter as $filter) if($filter != 'all') $query->andWhere('type')->eq($filter);
$tasks = $query->fetchAll();
foreach($tasks as $task) $issues[] = array('id' => $task->id, 'type' => 'task', 'order' => $task->$order, 'status' => $this->getKey($task->status, $taskStatus));
}
/* Get stories. */
if(empty($labelTypes) or in_array('story', $labelTypes))
{
$query = $this->dao->select($storyFields)->from(TABLE_STORY)
->where('product')->eq($productID)
->beginIF($search)->andWhere('title')->like("%$search%")->fi()
->beginIF($status)->andWhere('status')->in($storyStatus[$status])->fi()
->andWhere('deleted')->eq(0);
foreach($storyFilter as $filter) if($filter != 'all') $query->andWhere('category')->eq($filter);
$stories = $query->fetchAll();
foreach($stories as $story) $issues[] = array('id' => $story->id, 'type' => 'story', 'order' => $story->$order, 'status' => $this->getKey($story->status, $storyStatus));
}
/* Get bugs. */
if(empty($labelTypes) or in_array('bug', $labelTypes))
{
$query = $this->dao->select($bugFields)->from(TABLE_BUG)
->where('product')->eq($productID)
->beginIF($search)->andWhere('title')->like("%$search%")->fi()
->beginIF($status)->andWhere('status')->in($bugStatus[$status])->fi()
->andWhere('deleted')->eq(0);
foreach($bugFilter as $filter) if($filter != 'all') $query->andWhere('type')->eq($filter);
$bugs = $query->fetchAll();
foreach($bugs as $bug) $issues[] = array('id' => $bug->id, 'type' => 'bug', 'order' => $bug->$order, 'status' => $this->getKey($bug->status, $bugStatus));
}
}
array_multisort(array_column($issues, 'order'), $sort == 'asc' ? SORT_ASC : SORT_DESC, $issues);
$total = count($issues);
$issues = $page < 1 ? array() : array_slice($issues, ($page-1) * $limit, $limit);
$result = $this->processIssues($issues);
$this->send(200, array('page' => $page, 'total' => $total, 'limit' => $limit, 'issues' => $result));
}
/**
* Process issues, format fields.
*
* @param array $issues
* @param int $page
* @param int $limit
* @access public
* @return array
*/
public function processIssues($issues)
{
$this->app->loadLang('story');
$this->app->loadLang('task');
$this->app->loadLang('bug');
$this->loadModel('entry');
$tasks = array();
$stories = array();
$bugs = array();
foreach($issues as $issue)
{
if($issue['type'] == 'story') $stories[] = $issue['id'];
if($issue['type'] == 'task') $tasks[] = $issue['id'];
if($issue['type'] == 'bug') $bugs[] = $issue['id'];
}
if(!empty($tasks)) $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($tasks)->fetchAll('id');
if(!empty($stories)) $stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($stories)->fetchAll('id');
if(!empty($bugs)) $bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($bugs)->fetchAll('id');
$result = array();
foreach($issues as $issue)
{
$r = new stdclass();
if($issue['type'] == 'task')
{
$task = $tasks[$issue['id']];
$r->id = 'task-' . $task->id;
$r->title = $task->name;
$r->labels = array($this->app->lang->task->common, zget($this->app->lang->task->typeList, $task->type));
$r->pri = $task->pri;
$r->openedDate = $task->openedDate;
$r->openedBy = $task->openedBy;
$r->lastEditedDate = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedDate : $task->lastEditedDate;
$r->lastEditedBy = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedBy : $task->lastEditedBy;
$r->status = $issue['status'];
$r->url = helper::createLink('task', 'view', "taskID=$task->id");
$r->assignedTo = array();
/* Get assignees for task, the task object has the type of multiple assign only so far. */
$users = $this->dao->select('account')->from(TABLE_TEAM)
->where('type')->eq('task')
->andWhere('root')->eq($task->id)
->fetchAll();
if($users)
{
foreach($users as $user)
{
$r->assignedTo[] = $user->account;
}
}
else
{
if($task->assignedTo == "")
{
$r->assignedTo = array();
}
else
{
$r->assignedTo = array($task->assignedTo);
}
}
}
elseif($issue['type'] == 'story')
{
$story = $stories[$issue['id']];
$r->id = 'story-' . $story->id;
$r->title = $story->title;
$r->labels = array($this->app->lang->story->common, zget($this->app->lang->story->categoryList, $story->category));
$r->pri = $story->pri;
$r->openedDate = $story->openedDate;
$r->openedBy = $story->openedBy;
$r->lastEditedDate = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedDate : $story->lastEditedDate;
$r->lastEditedBy = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedBy : $story->lastEditedBy;
$r->status = $issue['status'];
$r->url = helper::createLink('story', 'view', "storyID=$story->id");
if($story->assignedTo == "")
{
$r->assignedTo = array();
}
else
{
$r->assignedTo = array($story->assignedTo);
}
}
elseif($issue['type'] == 'bug')
{
$bug = $bugs[$issue['id']];
$r->id = 'bug-' . $bug->id;
$r->title = $bug->title;
$r->labels = array($this->app->lang->bug->common, zget($this->app->lang->bug->typeList, $bug->type));
$r->pri = $bug->pri;
$r->openedDate = $bug->openedDate;
$r->openedBy = $bug->openedBy;
$r->lastEditedDate = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedDate : $bug->lastEditedDate;
$r->lastEditedBy = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedBy : $bug->lastEditedBy;
$r->status = $issue['status'];
$r->url = helper::createLink('bug', 'view', "bugID=$bug->id");
if($bug->assignedTo == "")
{
$r->assignedTo = array();
}
else
{
$r->assignedTo = array($bug->assignedTo);
}
}
$result[] = $this->format($r, 'openedDate:time,lastEditedDate:time');
}
/**
* Get all users in issues so that we can bulk get user detail later.
*
*/
$userList = array();
foreach($result as $issue)
{
foreach($issue->assignedTo as $account)
{
$userList[] = $account;
}
$userList[] = $issue->openedBy;
}
$userList = array_unique($userList);
$userDetails = $this->loadModel('user')->getUserDetailsForAPI($userList);
/**
* Set the user detail to assignedTo and openedBy.
*
*/
foreach($result as $issue)
{
foreach($issue->assignedTo as $key => $account)
{
if($account == 'closed')
{
$issue->assignedTo = array();
break;
}
$issue->assignedTo[$key] = $userDetails[$account];
}
$issue->openedBy = $userDetails[$issue->openedBy];
}
return $result;
}
/**
* Get key in array by value.
*
* @param string $value
* @param array $array
* @access private
* @return string
*/
private function getKey($value, $array)
{
foreach($array as $key => $values)
{
if($values and strpos($values, $value) !== FALSE) return $key;
}
return '';
}
}

View File

@@ -1,92 +0,0 @@
<?php
/**
* The productplan entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplanEntry extends Entry
{
/**
* GET method.
*
* @param int $planID
* @access public
* @return void
*/
public function get($planID)
{
$fields = $this->param('fields');
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$plan = $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array');
return $this->send(200, $plan);
}
/**
* PUT method.
*
* @param int $planID
* @access public
* @return void
*/
public function put($planID)
{
$oldPlan = $this->loadModel('productplan')->getByID($planID);
/* Set $_POST variables. */
$fields = 'title,begin,end,desc';
$this->batchSetPost($fields, $oldPlan);
$control = $this->loadController('productplan', 'edit');
$control->edit($planID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
/* Get plan info. */
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array'));
}
/**
* DELETE method.
*
* @param int $productID
* @access public
* @return void
*/
public function delete($planID)
{
$control = $this->loadController('productplan', 'delete');
$control->delete($planID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* The productplanlinkbugs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplanLinkBugsEntry extends entry
{
/**
* POST method.
*
* @param int $planID
* @access public
* @return void
*/
public function post($planID)
{
$fields = 'bugs';
$this->batchSetPost($fields);
$control = $this->loadController('productplan', 'linkBug');
$control->linkBug($planID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'success')
{
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$plan = $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array');
return $this->send(200, $plan);
}
$this->sendError(400, array('message' => isset($data->message) ? $data->message : 'error'));
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* The productplanlinkstories entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplanLinkStoriesEntry extends entry
{
/**
* POST method.
*
* @param int $planID
* @access public
* @return void
*/
public function post($planID)
{
$fields = 'stories';
$this->batchSetPost($fields);
$control = $this->loadController('productplan', 'linkStory');
$control->linkStory($planID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'success')
{
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$plan = $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array');
return $this->send(200, $plan);
}
$this->sendError(400, array('message' => isset($data->message) ? $data->message : 'error'));
}
}

View File

@@ -1,93 +0,0 @@
<?php
/**
* The productplans entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplansEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(!$productID) $productID = $this->param('product', 0);
if(!$productID) return $this->sendError(400, 'No product id.');
$control = $this->loadController('productplan', 'browse');
$control->browse($productID, $this->param('branch', 0), $this->param('status', 'all'), $this->param('order', 'begin_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
/* Response */
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
$plans = $data->data->plans;
$pager = $data->data->pager;
foreach($plans as $plan)
{
if($plan->parent > 0 and isset($result[$plan->parent]))
{
$parentPlan = $result[$plan->parent];
if(!isset($parentPlan->children) or !is_array($parentPlan->children)) $parentPlan->children = array();
$parentPlan->children[] = $plan;
$result[$plan->parent] = $parentPlan;
}
else
{
$result[$plan->id] = $this->format($plan, 'begin:date,end:date,deleted:bool,project:int');
}
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'plans' => array_values($result)));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $productID
* @access public
* @return void
*/
public function post($productID = 0)
{
if(!$productID) $productID = $this->param('product', 0);
if(!$productID) return $this->sendError(400, 'No product id.');
$fields = 'branch,begin,end,title,desc';
$this->batchSetPost($fields);
$this->setPost('product', $productID);
$this->setPost('parent', $this->request('parent', 0));
$this->setPost('branch', $this->request('branch', 0));
$control = $this->loadController('productplan', 'create');
$control->create($productID, $this->param('branch', 0), $this->param('parent', 0));
$data = $this->getData();
if(isset($data->result) and $data->result == 'success')
{
$plan = $this->loadModel('productplan')->getByID($data->id);
$plan->stories = array();
$plan->bugs = array();
return $this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,project:int'));
}
$this->sendError(400, array('message' => isset($data->message) ? $data->message : 'error'));
}
}

View File

@@ -1,45 +0,0 @@
<?php
/**
* The productplanunlinkbugs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplanUnlinkBugsEntry extends entry
{
/**
* POST method.
*
* @param int $planID
* @access public
* @return void
*/
public function post($planID)
{
$productplan = $this->loadModel('productplan');
foreach($this->request('bugs', array()) as $bugID)
{
$productplan->unlinkBug($bugID, $planID);
if(dao::isError()) return $this->sendError('error');
}
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$plan = $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array');
return $this->send(200, $plan);
}
}

View File

@@ -1,45 +0,0 @@
<?php
/**
* The productplanunlinkstories entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productplanUnlinkStoriesEntry extends entry
{
/**
* POST method.
*
* @param int $planID
* @access public
* @return void
*/
public function post($planID)
{
$productplan = $this->loadModel('productplan');
foreach($this->request('stories', array()) as $storyID)
{
$productplan->unlinkStory($storyID, $planID);
if(dao::isError()) return $this->sendError('error');
}
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$plan = $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array');
return $this->send(200, $plan);
}
}

View File

@@ -1,128 +0,0 @@
<?php
/**
* The product projects entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productProjectsEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(empty($productID)) $productID = $this->param('product', 0);
if(empty($productID)) return $this->sendError('400', "Need product id");
$appendFields = $this->param('fields', '');
$control = $this->loadController('product', 'project');
$control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc'));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
foreach($data->data->projectStats as $project)
{
foreach($project->hours as $field => $value) $project->$field = $value;
$project = $this->filterFields($project, 'id,name,code,model,type,budget,budgetUnit,parent,begin,end,status,openedBy,openedDate,PM,delay,progress,' . $appendFields);
$result[] = $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time');
}
$data = array();
$data['total'] = count($result);
$data['projects'] = $result;
$withUser = $this->param('withUser', '');
if(!empty($withUser)) $data['users'] = $users;
return $this->send(200, $data);
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
// TODO There is no handle for 401.
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'name,begin,end,products';
$this->batchSetPost($fields);
$this->setPost('code', $this->request('code', ''));
$this->setPost('acl', $this->request('acl', 'private'));
$this->setPost('parent', $this->request('program', 0));
$this->setPost('whitelist', $this->request('whitelist', array()));
$this->setPost('PM', $this->request('PM', ''));
$this->setPost('model', $this->request('model', 'scrum'));
$control = $this->loadController('project', 'create');
$this->requireFields('name,code,begin,end,products');
$control->create($this->request('model', 'scrum'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$project = $this->loadModel('project')->getByID($data->id);
$this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time'));
}
/**
* Get drop menu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$control = $this->loadController('project', 'ajaxGetDropMenu');
$control->ajaxGetDropMenu($this->request('projectID', 0), $this->request('module', 'project'), $this->request('method', 'browse'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array());
foreach($data->data->projects as $programID => $projects)
{
foreach($projects as $project)
{
if(helper::diffDate(date('Y-m-d'), $project->end) > 0) $project->delay = true;
$project = $this->filterFields($project, 'id,model,type,name,code,parent,status,PM,delay');
if($project->status == 'closed')
{
$dropMenu['closed'][] = $project;
}
elseif($project->PM == $this->app->user->account)
{
$dropMenu['owner'][] = $project;
}
else
{
$dropMenu['other'][] = $project;
}
}
}
$this->send(200, $dropMenu);
}
}

View File

@@ -1,248 +0,0 @@
<?php
/**
* The products entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class productsEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($programID = 0)
{
$fields = $this->param('fields', '');
if(strpos(strtolower(",{$fields},"), ',dropmenu,') !== false) return $this->getDropMenu();
if(!$programID) $programID = $this->param('program', 0);
$projectID = $this->param('project', 0);
$mergeChildren = $this->param('mergeChildren', '');
if($programID)
{
$control = $this->loadController('program', 'product');
$control->product($programID, $this->param('status', 'all'), $this->param('order', 'order_asc'), 0, $this->param('limit', '20'), $this->param('page', '1'));
/* Response */
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$products = $data->data->products;
}
elseif($projectID)
{
$control = $this->loadController('project', 'manageProducts');
$control->manageProducts($projectID);
/* Response */
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$products = $data->data->linkedProducts;
}
else
{
$control = $this->loadController('product', 'all');
$control->all($this->param('status', 'all'), $this->param('order', 'order_asc'));
/* Response */
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$products = $data->data->productStats;
if($mergeChildren) $products = $data->data->productStructure;
}
$result = array();
if($mergeChildren)
{
$programs = $this->mergeChildren($products);
return $this->send(200, $programs);
}
else
{
$accounts = array();
foreach($products as $product)
{
$accounts[$product->PO] = $product->PO;
$accounts[$product->QD] = $product->QD;
$accounts[$product->RD] = $product->RD;
$accounts[$product->createdBy] = $product->createdBy;
if(isset($product->feedback)) $accounts[$product->feedback] = $product->feedback;
if(!empty($product->mailto))
{
foreach(explode(',', $product->mailto) as $account)
{
$account = trim($account);
if(empty($account)) continue;
$accounts[$account] = $account;
}
}
$result[] = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
}
$data = array();
$data['total'] = count($result);
$data['products'] = $result;
$withUser = $this->param('withUser', '');
if(!empty($withUser)) $data['users'] = $this->loadModel('user')->getListByAccounts($accounts, 'account');
return $this->send(200, $data);
}
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'program,code,line,name,PO,QD,RD,type,desc,whitelist';
$this->batchSetPost($fields);
$this->setPost('acl', $this->request('acl', 'private'));
$this->setPost('whitelist', $this->request('whitelist', array()));
$control = $this->loadController('product', 'create');
$this->requireFields('name,code');
$control->create($this->request('program', 0));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
/* Response */
$product = $this->loadModel('product')->getByID($data->id);
$product = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
$this->send(200, $product);
}
/**
* Get dropmenu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$control = $this->loadController('product', 'ajaxGetDropMenu');
$control->ajaxGetDropMenu($this->request('productID', 0), $this->request('module', 'product'), $this->request('method', 'browse'), $this->request('extra', ''), $this->request('from', ''));
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array());
foreach($data->data->products as $programID => $products)
{
foreach($products as $product)
{
$product = $this->filterFields($product, 'id,program,name,code,status,PO');
if($product->status == 'closed')
{
$dropMenu['closed'][] = $product;
}
elseif($product->PO == $this->app->user->account)
{
$dropMenu['owner'][] = $product;
}
else
{
$dropMenu['other'][] = $product;
}
}
}
$this->send(200, $dropMenu);
}
/**
* Merge children products.
*
* @param array $products
* @access public
* @return void
*/
public function mergeChildren($products)
{
$programs = array();
foreach($products as $programID => $program)
{
$programs[$programID] = new stdclass();
if(!empty($programID))
{
$programs[$programID]->id = $programID;
$programs[$programID]->name = $program->programName;
$programs[$programID]->type = 'program';
}
$unclosedTotal = 0;
foreach($program as $field => $value)
{
if(!isset($programs[$programID]->children)) $programs[$programID]->children = array();
if(isset($value->products))
{
$lineID = $field;
if(empty($lineID))
{
foreach($value->products as $product)
{
unset($product->desc);
$programs[$programID]->children[$product->id] = $product;
if($product->status != 'closed') $unclosedTotal += 1;
}
}
else
{
$line = new stdclass();
$line->id = $lineID;
$line->name = $value->lineName;
$line->type = 'line';
$line->children = array();
foreach($value->products as $product)
{
unset($product->desc);
$line->children[$product->id] = $product;
if($product->status != 'closed') $unclosedTotal += 1;
}
if(isset($line->children)) $line->children = array_values($line->children);
$programs[$programID]->children[$lineID] = $line;
}
if(isset($programs[$programID]->children)) $programs[$programID]->children = array_values($programs[$programID]->children);
$programs[$programID]->unclosedTotal = $unclosedTotal;
}
}
}
$topProducts = array();
if(isset($programs[0]))
{
$topProducts = $programs[0]->children;
unset($programs[0]);
}
$programs = array_values($programs);
foreach($topProducts as $product) $programs[] = $product;
return $programs;
}
}

View File

@@ -1,70 +0,0 @@
<?php
/**
* The program entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class programEntry extends Entry
{
/**
* GET method.
*
* @param int $programID
* @access public
* @return void
*/
public function get($programID)
{
$program = $this->loadModel('program')->getByID($programID);
if(!$program) return $this->send404();
$this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList'));
}
/**
* PUT method.
*
* @param int $programID
* @access public
* @return void
*/
public function put($programID)
{
$oldProgram = $this->loadModel('program')->getByID($programID);
/* Set $_POST variables. */
$fields = 'name,PM,budget,budgetUnit,desc,parent,begin,end,realBegan,realEnd,acl,whitelist';
$this->batchSetPost($fields, $oldProgram);
$this->setPost('parent', $this->request('parent', 0));
$control = $this->loadController('program', 'edit');
$control->edit($programID);
$this->getData();
$program = $this->program->getByID($programID);
$this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList'));
}
/**
* DELETE method.
*
* @param int $programID
* @access public
* @return void
*/
public function delete($programID)
{
$control = $this->loadController('program', 'delete');
$control->delete(0, $programID, 'true');
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,127 +0,0 @@
<?php
/**
* The programs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class programsEntry extends Entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$_COOKIE['showClosed'] = $this->param('showClosed', 0);
$mergeChildren = $this->param('mergeChildren', 0);
$this->config->systemMode = 'new';
$fields = $this->param('fields', '');
if(stripos(strtolower(",{$fields},"), ",dropmenu,") !== false) return $this->getDropMenu();
$program = $this->loadController('program', 'browse');
$program->browse($this->param('status', 'all'), $this->param('order', 'order_asc'));
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$programs = $data->data->programs;
$progressList = $data->data->progressList;
$users = $data->data->users;
$result = array();
foreach($programs as $program)
{
if(isset($progressList->{$program->id})) $program->progress = $progressList->{$program->id};
$program = $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList');
if($mergeChildren)
{
unset($program->desc);
$program->end = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end;
$programBudget = $this->loadModel('project')->getBudgetWithUnit($program->budget);
$program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
if(empty($program->parent)) $result[$program->id] = $program;
if(isset($programs->{$program->parent}))
{
$parentProgram = $programs->{$program->parent};
if(!isset($parentProgram->children)) $parentProgram->children = array();
$parentProgram->children[] = $program;
}
}
else
{
$result[] = $program;
}
}
return $this->send(200, array('programs' => array_values($result)));
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'name,PM,budget,budgetUnit,desc,begin,end';
$this->batchSetPost($fields);
$this->setPost('acl', $this->request('acl', 'open'));
$this->setPost('whitelist', $this->request('whitelist', array()));
$control = $this->loadController('program', 'create');
$this->requireFields('name,begin,end');
$control->create($this->request('parent', 0));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$program = $this->loadModel('program')->getByID($data->id);
$this->send(201, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList'));
}
/**
* Get drop menu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$programs = $this->dao->select('id,name,parent,path,grade,`order`')->from(TABLE_PROJECT)
->where('deleted')->eq('0')
->andWhere('type')->eq('program')
->andWhere('id')->in($this->app->user->view->programs)
->beginIF(empty($_COOKIE['showClosed']))->andWhere('status')->ne('closed')->fi()
->orderBy('grade desc, `order`')
->fetchAll('id');
$dropMenu = array();
foreach($programs as $programID => $program)
{
if(empty($program->parent))
{
$dropMenu[] = $program;
}
elseif(isset($programs[$program->parent]))
{
if(!isset($programs[$program->parent]->children)) $programs[$program->parent]->children = array();
$programs[$program->parent]->children[] = $program;
}
}
$this->send(200, $dropMenu);
}
}

View File

@@ -1,144 +0,0 @@
<?php
/**
* The project entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class projectEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID)
{
$fields = strtolower($this->param('fields'));
$control = $this->loadController('project', 'view');
$control->view($projectID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$project = $this->format($data->data->project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool');
$this->loadModel('testcase');
$project->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
if(empty($fields)) return $this->send(200, $project);
/* Set other fields. */
$fields = explode(',', $fields);
foreach($fields as $field)
{
switch($field)
{
case 'team':
$teams = array();
$accounts = array();
foreach($data->data->teamMembers as $account => $team)
{
$team = $this->filterFields($team, "account,role,join,realname");
$teams[$account] = $team;
$accounts[$account] = $account;
}
$users = $this->loadModel('user')->getListByAccounts($accounts, 'account');
foreach($teams as $account => $team)
{
$user = zget($users, $account, '');
$team->avatar = $user->avatar;
}
$project->teams = $teams;
break;
case "products":
$project->products = array();
$productList = $this->loadModel('product')->getProducts($projectID, $this->param('status', 'all'));
foreach($productList as $product) $project->products[] = $product;
break;
case "stat":
$project->stat = $data->data->statData;
break;
case "workhour":
$workhour = $data->data->workhour;
$workhour->progress = ($workhour->totalConsumed + $workhour->totalLeft) ? floor($workhour->totalConsumed / ($workhour->totalConsumed + $workhour->totalLeft) * 1000) / 1000 * 100 : 0;
$project->workhour = $workhour;
break;
case "actions":
$actions = $data->data->actions;
$project->actions = $this->loadModel('action')->processActionForAPI($actions, (array)$data->data->users, $this->lang->project);
break;
case "dynamics":
$dynamics = $data->data->dynamics;
$project->dynamics = $this->loadModel('action')->processDynamicForAPI($dynamics);
break;
}
}
return $this->send(200, $project);
}
/**
* PUT method.
*
* @param int $projectID
* @access public
* @return void
*/
public function put($projectID)
{
$oldProject = $this->loadModel('project')->getByID($projectID);
$linkedProducts = $this->loadModel('product')->getProducts($projectID);
/* Set $_POST variables. */
$fields = 'name,begin,end,acl,parent,desc,PM,whitelist';
$this->batchSetPost($fields, $oldProject);
$products = array();
$plans = array();
foreach($linkedProducts as $product)
{
$products[] = $product->id;
foreach($product->plans as $planID) $plans[] = $planID;
}
$this->setPost('products', $products);
$this->setPost('plans', $plans);
$control = $this->loadController('project', 'edit');
$control->edit($projectID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$project = $this->project->getByID($projectID);
$this->send(200, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $projectID
* @access public
* @return void
*/
public function delete($projectID)
{
$control = $this->loadController('project', 'delete');
$control->delete($projectID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,72 +0,0 @@
<?php
/**
* The project bugs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class projectBugsEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(empty($projectID)) $projectID = $this->param('project', 0);
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
$control = $this->loadController('project', 'bug');
$control->bug($projectID, $this->param('product', 0), $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$bugs = $data->data->bugs;
$pager = $data->data->pager;
$result = array();
$this->loadModel('product');
foreach($bugs as $bug)
{
$status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]);
if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed);
if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed);
if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs);
$bug->status = $status['code'];
$bug->statusName = $status['name'];
$product = $this->product->getById($bug->product);
$bug->productStatus = $product->status;
$result[$bug->id] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool');
}
$storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.id')->in(array_keys($result))
->andWhere('t1.story')->ne('0')
->andWhere('t1.storyVersion != t2.version')
->fetchPairs('id', 'id');
foreach($storyChangeds as $bugID)
{
$status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed);
$result[$bugID]->status = $status['code'];
$result[$bugID]->statusName = $status['name'];
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result)));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,51 +0,0 @@
<?php
/**
* The project cases entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class projectCasesEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(!$projectID) $projectID = $this->param('project', 0);
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
$this->resetOpenApp('project');
$this->app->session->set('project', $projectID, $this->app->tab);
$control = $this->loadController('project', 'testcase');
$control->testcase($projectID, $this->param('product', 0), $this->param('branch', 0), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$cases = $data->data->cases;
$pager = $data->data->pager;
$result = array();
foreach($cases as $case)
{
$case->statusName = $this->lang->testcase->statusList[$case->status];
$result[] = $this->format($case, 'openedDate:time,reviewedDate:date,lastEditedDate:time,lastRunDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'cases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,75 +0,0 @@
<?php
/**
* The projectreleases entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class projectReleasesEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(empty($projectID)) $projectID = $this->param('project');
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
$control = $this->loadController('projectrelease', 'browse');
$control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
/* Response */
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
$releases = $data->data->releases;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'name,build,product,date,notify,mailto';
$this->batchSetPost($fields);
$this->setPost('desc', $this->request('desc', ''));
$control = $this->loadController('projectrelease', 'create');
$this->requireFields('name,date');
$control->create($projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and!isset($data->id)) return $this->sendError(400, $data->message);
$release = $this->loadModel('projectrelease')->getByID($data->id);
$this->send(201, $release);
}
}

View File

@@ -1,143 +0,0 @@
<?php
/**
* The project entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class projectsEntry extends entry
{
/**
* GET method.
*
* @param int $programID
* @access public
* @return void
*/
public function get($programID = 0)
{
if(!$programID) $programID = $this->param('program', 0);
$appendFields = $this->param('fields', '');
if(stripos(strtolower(",{$appendFields},"), ',dropmenu,') !== false) return $this->getDropMenu();
$_COOKIE['involved'] = $this->param('involved', 0);
$this->config->systemMode = 'new';
if($programID)
{
$control = $this->loadController('program', 'project');
$control->project($programID, $this->param('status', 'all'), $this->param('order', 'order_asc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
else
{
$control = $this->loadController('project', 'browse');
$control->browse($programID, $this->param('status', 'all'), 0, $this->param('order', 'order_asc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
if(isset($data->status) and $data->status == 'success')
{
$pager = $data->data->pager;
$users = $data->data->users;
$result = array();
foreach($data->data->projectStats as $project)
{
foreach($project->hours as $field => $value) $project->$field = $value;
$result[] = $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool');
}
$data = array();
$data['page'] = $pager->pageID;
$data['total'] = $pager->recTotal;
$data['limit'] = (int)$pager->recPerPage;
$data['projects'] = $result;
$withUser = $this->param('withUser', '');
if(!empty($withUser)) $data['users'] = $users;
return $this->send(200, $data);
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'name,begin,end,products';
$this->batchSetPost($fields);
$this->setPost('code', $this->request('code', ''));
$this->setPost('acl', $this->request('acl', 'private'));
$this->setPost('parent', $this->request('program', 0));
$this->setPost('whitelist', $this->request('whitelist', array()));
$this->setPost('PM', $this->request('PM', ''));
$this->setPost('model', $this->request('model', 'scrum'));
$this->setPost('parent', $this->request('parent', 0));
$control = $this->loadController('project', 'create');
$this->requireFields('name,code,begin,end,products');
$control->create($this->request('model', 'scrum'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$project = $this->loadModel('project')->getByID($data->id);
$this->send(201, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool'));
}
/**
* Get drop menu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$control = $this->loadController('project', 'ajaxGetDropMenu');
$control->ajaxGetDropMenu($this->request('projectID', 0), $this->request('module', 'project'), $this->request('method', 'browse'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array());
foreach($data->data->projects as $programID => $projects)
{
foreach($projects as $project)
{
if(helper::diffDate(date('Y-m-d'), $project->end) > 0) $project->delay = true;
$project = $this->filterFields($project, 'id,model,type,name,code,parent,status,PM,delay');
if($project->status == 'closed')
{
$dropMenu['closed'][] = $project;
}
elseif($project->PM == $this->app->user->account)
{
$dropMenu['owner'][] = $project;
}
else
{
$dropMenu['other'][] = $project;
}
}
}
$this->send(200, $dropMenu);
}
}

View File

@@ -1,49 +0,0 @@
<?php
/**
* The project entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package project
* @version 1
* @link http://www.zentao.net
*/
class projectStoriesEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID)
{
if(!$projectID) $projectID = $this->param('project');
if(!$projectID) return $this->sendError(400, 'Need product id.');
$control = $this->loadController('projectstory', 'story');
$control->story($projectID, $this->param('product', 0), $this->param('branch', ''), $this->param('status', 'unclosed'), 0, 'story', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$stories = $data->data->stories;
$pager = $data->data->pager;
$result = array();
$this->loadModel('product');
foreach($stories as $story)
{
$product = $this->product->getById($story->product);
$story->productStatus = $product->status;
$result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,75 +0,0 @@
<?php
/**
* The release entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class releaseEntry extends Entry
{
/**
* GET method.
*
* @param int $planID
* @access public
* @return void
*/
public function get($releaseID)
{
$control = $this->loadController('release', 'view');
$control->view($releaseID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$release = $this->format($data->data->release, 'date:date,deleted:bool');
return $this->send(200, $release);
}
/**
* PUT method.
*
* @param int $releaseID
* @access public
* @return void
*/
public function put($releaseID)
{
$oldRelease = $this->loadModel('release')->getByID($releaseID);
/* Set $_POST variables. */
$fields = 'name,build,status,desc';
$this->batchSetPost($fields, $oldRelease);
$control = $this->loadController('release', 'edit');
$control->edit($releaseID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$release = $this->release->getByID($releaseID);
$this->sendSuccess(200, $this->format($release, 'date:date,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $releaseID
* @access public
* @return void
*/
public function delete($releaseID)
{
$control = $this->loadController('release', 'delete');
$control->delete($releaseID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,43 +0,0 @@
<?php
/**
* The productplans entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class releasesEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(empty($productID)) $productID = $this->param('product');
if(empty($productID)) return $this->sendError(400, 'Need product id.');
$control = $this->loadController('release', 'browse');
$control->browse($productID, $this->param('branch', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
/* Response */
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
$releases = $data->data->releases;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,375 +0,0 @@
<?php
/**
* The reports entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class reportsEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$fields = $this->param('fields', '');
$dept = $this->param('dept', 0);
$account = $this->param('account', '');
$year = $this->param('year', date('Y'));
if(empty($fields)) return $this->send(400, 'Need fields param for report.');
$accounts = array();
if($account) $accounts = array($account => $account);
if(empty($accounts) and $dept) $accounts = array_keys($this->loadModel('dept')->getDeptUserPairs($dept));
if(empty($accounts) and empty($dept)) $accounts = array_keys($this->loadModel('user')->getPairs('noclosed'));
$fields = explode(',', strtolower($fields));
$report = array();
foreach($fields as $field)
{
$field = trim($field);
if(empty($field)) continue;
if($field == 'projectoverview')
{
$report['projectOverview'] = $this->projectOverview($accounts);
}
elseif($field == 'radar')
{
$report['radar'] = $this->radar($accounts, $year);
}
elseif($field == 'projectprogress')
{
$report['projectProgress'] = $this->projectProgress();
}
elseif($field == 'executionprogress')
{
$report['executionProgress'] = $this->executionProgress();
}
elseif($field == 'productprogress')
{
$report['productProgress'] = $this->productProgress();
}
elseif($field == 'bugprogress')
{
$report['bugProgress'] = $this->bugProgress();
}
elseif($field == 'bugprogress')
{
$report['bugProgress'] = $this->bugProgress();
}
elseif($field == 'output')
{
$report['output'] = $this->loadModel('report')->getOutput4API($accounts, $year);
}
}
return $this->send(200, $report);
}
/**
* Get project overview by status.
*
* @param array $accounts
* @access public
* @return array
*/
public function projectOverview($accounts)
{
$statusOverview = $this->loadModel('report')->getProjectStatusOverview($accounts);
$this->app->loadLang('project');
$total = 0;
$overview = array();
foreach($statusOverview as $status => $count)
{
$total += $count;
$statusName = zget($this->lang->project->statusList, $status);
$overview[$status] = array();
$overview[$status]['code'] = $status;
$overview[$status]['name'] = $statusName;
$overview[$status]['total'] = $count;
}
$projectOverview = array();
$projectOverview['total'] = $total;
$projectOverview['overview'] = array_values($overview);
return $projectOverview;
}
/**
* Get radar data. include product, execution, qa, devel and other.
*
* @param array $accounts
* @param string $year
* @access public
* @return array
*/
public function radar($accounts, $year)
{
$contributions = $this->loadModel('report')->getUserYearContributions($accounts, $year);
$annualDataConfig = $this->config->report->annualData;
$radarData = array('product' => 0, 'execution' => 0, 'devel' => 0, 'qa' => 0, 'other' => 0);
foreach($contributions as $objectType => $objectContributions)
{
foreach($objectContributions as $actionName => $count)
{
$radarTypes = isset($annualDataConfig['radar'][$objectType][$actionName]) ? $annualDataConfig['radar'][$objectType][$actionName] : array('other');
foreach($radarTypes as $radarType) $radarData[$radarType] += $count;
}
}
$radar = array();
foreach($radarData as $radarType => $total)
{
$radar[$radarType]['code'] = $radarType;
$radar[$radarType]['name'] = $this->lang->report->annualData->radarItems[$radarType];
$radar[$radarType]['total'] = $total;
}
return array_values($radar);
}
/**
* Get project progress.
*
* @access public
* @return array
*/
public function projectProgress()
{
$projects = $this->loadModel('program')->getProjectStats(0, 'all');
$this->app->loadLang('project');
$processedProjects = array();
$statusList['all']['total'] = 0;
$statusList['doing']['total'] = 0;
$statusList['wait']['total'] = 0;
$statusList['closed']['total'] = 0;
foreach($projects as $project)
{
$newProject = new stdclass();
$newProject->id = $project->id;
$newProject->name = $project->name;
$newProject->status = $project->status;
$newProject->progress = round($project->hours->progress, 1);
$newProject->totalConsumed = round($project->hours->totalConsumed, 1);
$newProject->totalLeft = round($project->hours->totalLeft, 1);
if(isset($project->delay)) $newProject->delay = $project->delay;
$statusList['all']['total'] += 1;
if(isset($statusList[$project->status])) $statusList[$project->status]['total'] += 1;
$processedProjects[$project->id] = $newProject;
}
foreach(array_keys($statusList) as $status)
{
$statusName = zget($this->lang->project->statusList, $status);
if($status == 'all') $statusName = $this->lang->project->featureBar['all'];
$statusList[$status]['code'] = $status;
$statusList[$status]['name'] = $statusName;
}
return array('statusList' => $statusList, 'projects' => array_values($processedProjects));
}
/**
* Get execution progress.
*
* @access public
* @return array
*/
public function executionProgress()
{
$executions = $this->loadModel('project')->getStats(0, 'all', 0, 0, 30, 'id_desc');
$this->app->loadLang('execution');
$processedExecutions = array();
$statusList['all']['total'] = 0;
$statusList['doing']['total'] = 0;
$statusList['wait']['total'] = 0;
$statusList['closed']['total'] = 0;
foreach($executions as $execution)
{
$newExecution = new stdclass();
$newExecution->id = $execution->id;
$newExecution->name = $execution->name;
$newExecution->status = $execution->status;
$newExecution->progress = round($execution->hours->progress, 1);
$newExecution->totalConsumed = round($execution->hours->totalConsumed, 1);
$newExecution->totalLeft = round($execution->hours->totalLeft, 1);
if(isset($execution->delay)) $newExecution->delay = $execution->delay;
$statusList['all']['total'] += 1;
if(isset($statusList[$execution->status])) $statusList[$execution->status]['total'] += 1;
$processedExecutions[$execution->id] = $newExecution;
}
foreach(array_keys($statusList) as $status)
{
$statusName = zget($this->lang->execution->statusList, $status);
if($status == 'all') $statusName = $this->lang->execution->allTasks;
$statusList[$status]['code'] = $status;
$statusList[$status]['name'] = $statusName;
}
return array('statusList' => $statusList, 'executions' => array_values($processedExecutions));
}
/**
* Get product progress with story.
*
* @access public
* @return array
*/
public function productProgress()
{
$this->app->loadLang('product');
$this->app->loadLang('story');
$storyStatusStat = $this->dao->select('t1.product,t2.name,t2.status,t1.status as storyStatus,count(*) as storyCount')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi()
->groupBy('t1.product,t1.status')
->orderBy('t1.product_desc,t1.status')
->fetchAll();
$productStatusList['all']['total'] = 0;
$productStatusList['normal']['total'] = 0;
$productStatusList['closed']['total'] = 0;
$processedProducts = array();
$productStoryStat = array();
foreach($storyStatusStat as $product)
{
$productStoryStat[$product->product][$product->storyStatus] = $product->storyCount;
if(isset($processedProducts[$product->product])) continue;
$newProduct = new stdclass();
$newProduct->id = $product->product;
$newProduct->name = $product->name;
$newProduct->status = $product->status;
$processedProducts[$product->product] = $newProduct;
$productStatusList['all']['total'] += 1;
if(isset($productStatusList[$product->status])) $productStatusList[$product->status]['total'] += 1;
}
/* Set story status statistics integrate into product. */
$storyStatusList = array('draft' => array(), 'active' => array(), 'changed' => array(), 'closed' => array());
foreach($processedProducts as $productID => $product)
{
$product->storyStat = array();
foreach(array_keys($storyStatusList) as $storyStatus) $product->storyStat[$storyStatus] = isset($productStoryStat[$productID][$storyStatus]) ? $productStoryStat[$productID][$storyStatus] : 0;
$product->progress = $product->storyStat['closed'] == 0 ? 0 : round($product->storyStat['closed'] / array_sum($product->storyStat) * 100, 1);
}
foreach(array_keys($productStatusList) as $status)
{
$statusName = zget($this->lang->product->statusList, $status);
if($status == 'all') $statusName = $this->lang->product->allStory;
if($status == 'normal') $statusName = $this->lang->product->unclosed;
$productStatusList[$status]['code'] = $status;
$productStatusList[$status]['name'] = $statusName;
}
foreach(array_keys($storyStatusList) as $status)
{
$statusName = zget($this->lang->story->statusList, $status);
$storyStatusList[$status]['code'] = $status;
$storyStatusList[$status]['name'] = $statusName;
}
return array('productStatusList' => $productStatusList, 'products' => array_values($processedProducts), 'storyStatusList' => $storyStatusList);
}
/**
* Get bug progress by product.
*
* @access public
* @return array
*/
public function bugProgress()
{
$this->app->loadLang('product');
$this->app->loadLang('bug');
$bugStatusStat = $this->dao->select('t1.product,t2.name,t2.status,t1.status as bugStatus,count(*) as bugCount')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi()
->groupBy('t1.product,t1.status')
->orderBy('t1.product_desc,t1.status')
->fetchAll();
$productStatusList['all']['total'] = 0;
$productStatusList['normal']['total'] = 0;
$productStatusList['closed']['total'] = 0;
$processedProducts = array();
$productBugStat = array();
foreach($bugStatusStat as $product)
{
$productBugStat[$product->product][$product->bugStatus] = $product->bugCount;
if(isset($processedProducts[$product->product])) continue;
$newProduct = new stdclass();
$newProduct->id = $product->product;
$newProduct->name = $product->name;
$newProduct->status = $product->status;
$processedProducts[$product->product] = $newProduct;
$productStatusList['all']['total'] += 1;
if(isset($productStatusList[$product->status])) $productStatusList[$product->status]['total'] += 1;
}
/* Set bug status statistics integrate into product. */
$bugStatusList = array('active' => array(), 'resolved' => array(), 'closed' => array());
foreach($processedProducts as $productID => $product)
{
$product->bugStat = array();
foreach(array_keys($bugStatusList) as $bugStatus) $product->bugStat[$bugStatus] = isset($productBugStat[$productID][$bugStatus]) ? $productBugStat[$productID][$bugStatus] : 0;
}
foreach(array_keys($productStatusList) as $status)
{
$statusName = zget($this->lang->product->statusList, $status);
if($status == 'all') $statusName = $this->lang->product->allStory;
if($status == 'normal') $statusName = $this->lang->product->unclosed;
$productStatusList[$status]['code'] = $status;
$productStatusList[$status]['name'] = $statusName;
}
foreach(array_keys($bugStatusList) as $status)
{
$statusName = zget($this->lang->bug->statusList, $status);
$bugStatusList[$status]['code'] = $status;
$bugStatusList[$status]['name'] = $statusName;
}
return array('productStatusList' => $productStatusList, 'bugs' => array_values($processedProducts), 'bugStatusList' => $bugStatusList);
}
}

View File

@@ -1,32 +0,0 @@
<?php
/**
* The reporules entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class repoRulesEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$control = $this->loadController('repo', 'ajaxGetRules');
$control->ajaxGetRules();
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->send(200, $data->rules);
}
}

View File

@@ -1,40 +0,0 @@
<?php
/**
* The repos entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class reposEntry extends entry
{
/**
* GET method.
*
* @access public
* @return void
*/
public function get()
{
$control = $this->loadController('repo', 'maintain');
$control->maintain(0, $this->param('order', 'id_desc'), 0, $this->param('limit', 100), $this->param('page', 1));
/* Response */
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
$pager = $data->data->pager;
$repos = $data->data->repoList;
foreach($repos as $repo) $result[] = $this->format($repo, 'deleted:bool,lastSync:datetime,synced:bool,product:idList');
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'repos' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
}

View File

@@ -1,75 +0,0 @@
<?php
/**
* The risk entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class riskEntry extends Entry
{
/**
* GET method.
*
* @param int $riskID
* @access public
* @return void
*/
public function get($riskID)
{
$control = $this->loadController('risk', 'view');
$control->view($riskID);
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->status) and $data->status == 'success') return $this->send(200, $this->format($data->data->risk, 'createdDate:time,editedDate:time'));
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$this->sendError(400, 'error');
}
/**
* PUT method.
*
* @param int $riskID
* @access public
* @return void
*/
public function put($riskID)
{
$oldRisk = $this->loadModel('risk')->getByID($riskID);
if(!$oldRisk) return $this->send404();
/* Set $_POST variables. */
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
$this->batchSetPost($fields, $oldRisk);
$control = $this->loadController('risk', 'edit');
$control->edit($riskID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$risk = $this->risk->getByID($riskID);
$this->send(200, $this->format($risk, 'createdDate:time,editedDate:time'));
}
/**
* DELETE method.
*
* @param int $riskID
* @access public
* @return void
*/
public function delete($riskID)
{
$control = $this->loadController('risk', 'delete');
$control->delete($riskID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,87 +0,0 @@
<?php
/**
* The risks entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class risksEntry extends entry
{
/**
* GET method.
*
* @param int $projectID
* @access public
* @return void
*/
public function get($projectID = 0)
{
if(!$projectID)
{
/* Get my risks defaultly. */
$control = $this->loadController('my', 'risk');
$control->risk($this->param('type', 'assignedTo'), $this->param('order', 'id_desc'), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
else
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
/* Get risks by project. */
$control = $this->loadController('risk', 'browse');
$control->browse($projectID, $this->param('type', 'all'), '', $this->param('order', ''), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
if(!isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$pager = $data->data->pager;
$result = array();
foreach($data->data->risks as $risk)
{
$result[] = $this->format($risk, 'createdDate:time,editedDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'risks' => $result));
}
/**
* POST method.
*
* @param int $projectID
* @access public
* @return void
*/
public function post($projectID = 0)
{
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
$this->batchSetPost($fields);
$this->setPost('impact', $this->request('impact', 3));
$this->setPost('probability', $this->request('probability', 3));
$this->setPost('rate', $this->request('rate', 9));
$this->setPost('pri', 'middle');
$control = $this->loadController('risk', 'create');
$this->requireFields('name');
$control->create($projectID);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$risk = $this->loadModel('risk')->getByID($data->id);
$this->send(201, $this->format($risk, 'createdDate:time,editedDate:time'));
}
}

View File

@@ -1,132 +0,0 @@
<?php
/**
* The stakeholder entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class stakeholdersEntry extends entry
{
/**
* GET method.
*
* @param int $programID
* @access public
* @return void
*/
public function get($programID = 0)
{
if(!$programID) $programID = $this->param('program', 0);
if($programID)
{
$control = $this->loadController('program', 'stakeholder');
$control->stakeholder($programID, $this->param('order', 't1.id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
if(isset($data->status) and $data->status == 'success')
{
$this->app->loadLang('stakeholder');
$pager = $data->data->pager;
$users = $data->data->users;
$result = array();
foreach($data->data->stakeholders as $stakeholder)
{
$stakeholder->roleName = zget($this->lang->user->roleList, $stakeholder->role, '');
$stakeholder->typeName = zget($this->lang->stakeholder->fromList, $stakeholder->from, '');
$result[] = $stakeholder;
}
$data = array();
$data['page'] = $pager->pageID;
$data['total'] = $pager->recTotal;
$data['limit'] = (int)$pager->recPerPage;
$data['stakeholders'] = $result;
$withUser = $this->param('withUser', '');
if(!empty($withUser)) $data['users'] = $users;
return $this->send(200, $data);
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @access public
* @return void
*/
public function post()
{
$fields = 'name,begin,end,products';
$this->batchSetPost($fields);
$this->setPost('code', $this->request('code', ''));
$this->setPost('acl', $this->request('acl', 'private'));
$this->setPost('parent', $this->request('program', 0));
$this->setPost('whitelist', $this->request('whitelist', array()));
$this->setPost('PM', $this->request('PM', ''));
$this->setPost('model', $this->request('model', 'scrum'));
$control = $this->loadController('project', 'create');
$this->requireFields('name,code,begin,end,products');
$control->create($this->request('model', 'scrum'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->result)) return $this->sendError(400, 'error');
$project = $this->loadModel('project')->getByID($data->id);
$this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time'));
}
/**
* Get drop menu.
*
* @access public
* @return void
*/
public function getDropMenu()
{
$control = $this->loadController('project', 'ajaxGetDropMenu');
$control->ajaxGetDropMenu($this->request('projectID', 0), $this->request('module', 'project'), $this->request('method', 'browse'));
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array());
foreach($data->data->projects as $programID => $projects)
{
foreach($projects as $project)
{
if(helper::diffDate(date('Y-m-d'), $project->end) > 0) $project->delay = true;
$project = $this->filterFields($project, 'id,model,type,name,code,parent,status,PM,delay');
if($project->status == 'closed')
{
$dropMenu['closed'][] = $project;
}
elseif($project->PM == $this->app->user->account)
{
$dropMenu['owner'][] = $project;
}
else
{
$dropMenu['other'][] = $project;
}
}
}
$this->send(200, $dropMenu);
}
}

View File

@@ -1,92 +0,0 @@
<?php
/**
* The stories entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storiesEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(!$productID) $productID = $this->param('product');
if(!$productID) return $this->sendError(400, 'Need product id.');
$control = $this->loadController('product', 'browse');
$control->browse($productID, $this->param('branch', ''), $this->param('status', 'unclosed'), 0, $this->param('type', 'story'), $this->param('order', 'id_desc'), 0, $this->param('limit', 500), $this->param('page', 1));
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$stories = $data->data->stories;
$pager = $data->data->pager;
$requirements = $this->loadModel('story')->getRequirements($productID);
$result = array();
$this->loadModel('product');
foreach($stories as $story)
{
$product = $this->product->getById($story->product);
$story->productStatus = $product->status;
if(isset($story->children))
{
$story->children = array_values((array)$story->children);
foreach($story->children as $id => $children)
{
$childrenProduct = $this->product->getById($children->product);
$story->children[$id]->productStatus = $childrenProduct->status;
}
}
$result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result, 'requirements' => $requirements));
}
/**
* POST method.
*
* @param int $productID
* @access public
* @return void
*/
public function post($productID = 0)
{
if(!$productID) $productID = $this->param('product', 0);
if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product;
if(!$productID) return $this->sendError(400, 'Need product id.');
$fields = 'title,spec,verify,reviewer,type,parent,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords,notifyemail,uid,URS';
$this->batchSetPost($fields);
/* If reviewer is not post, set needNotReview. */
$reviewer = $this->request('reviewer');
if(empty($reviewer)) $this->setPost('needNotReview', 1);
$this->setPost('product', $productID);
$this->setPost('type', $this->param('type', 'story'));
$control = $this->loadController('story', 'create');
$this->requireFields('title,spec,pri,category');
$control->create($productID, $this->param('branch', 0), $this->param('moduleID', 0), $this->param('storyID', 0), $this->param('objectID', 0), $this->param('bugID', 0));
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$story = $this->loadModel('story')->getByID($data->id);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,129 +0,0 @@
<?php
/**
* The story entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyEntry extends Entry
{
/**
* GET method.
*
* @param int $storyID
* @access public
* @return void
*/
public function get($storyID)
{
$this->resetOpenApp($this->param('tab', 'product'));
$control = $this->loadController('story', 'view');
$control->view($storyID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $data->data->story;
if(!empty($story->children)) $story->children = array_values((array)$story->children);
if(isset($story->planTitle)) $story->planTitle = array_values((array)$story->planTitle);
if($story->parent > 0) $story->parentPri = $this->dao->select('pri')->from(TABLE_STORY)->where('id')->eq($story->parent)->fetch('pri');
/* Set product name and status*/
$story->productName = $data->data->product->name;
$story->productStatus = $data->data->product->status;
/* Set module title */
$moduleTitle = '';
if(empty($story->module)) $moduleTitle = '/';
if($story->module)
{
$modulePath = $data->data->modulePath;
foreach($modulePath as $key => $module)
{
$moduleTitle .= $module->name;
if(isset($modulePath[$key + 1])) $moduleTitle .= '/';
}
}
$story->moduleTitle = $moduleTitle;
$storyTasks = array();
foreach($story->tasks as $executionTasks)
{
foreach($executionTasks as $task)
{
if(!isset($data->data->executions->{$task->execution})) continue;
$storyTasks[] = $this->filterFields($task, 'id,name,type,status,assignedTo');
}
}
$story->tasks = $this->format($storyTasks, 'assignedTo:user');
$story->bugs = array();
foreach($data->data->bugs as $bug) $story->bugs[] = $this->filterFields($bug, 'id,title,status,pri,severity');
$story->cases = array();
foreach($data->data->cases as $case) $story->cases[] = $this->filterFields($case, 'id,title,pri,status');
$story->requirements = array();
foreach($data->data->relations as $relation) $story->requirements[] = $this->filterFields($relation, 'id,title');
$story->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->story);
$preAndNext = $data->data->preAndNext;
$story->preAndNext = array();
$story->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : '';
$story->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : '';
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
/**
* PUT method.
*
* @param int $storyID
* @access public
* @return void
*/
public function put($storyID)
{
$oldStory = $this->loadModel('story')->getByID($storyID);
/* Set $_POST variables. */
$fields = 'title,product,parent,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords,uid,stage,notifyEmail';
$this->batchSetPost($fields, $oldStory);
$control = $this->loadController('story', 'edit');
$control->edit($storyID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
if(!isset($data->status)) return $this->sendError(400, 'error');
$story = $this->story->getByID($storyID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
/**
* DELETE method.
*
* @param int $storyID
* @access public
* @return void
*/
public function delete($storyID)
{
$control = $this->loadController('story', 'delete');
$control->delete($storyID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,40 +0,0 @@
<?php
/**
* The bug change point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class storyActiveEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$fields = 'assignedTo,status,comment';
$this->batchSetPost($fields);
$control = $this->loadController('story', 'activate');
$control->activate($storyID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $story);
}
}

View File

@@ -1,37 +0,0 @@
<?php
/**
* The story assignto entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyAssignToEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$fields = 'assignedTo,comment';
$this->batchSetPost($fields);
$control = $this->loadController('story', 'assignTo');
$control->assignTo($storyID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,50 +0,0 @@
<?php
/**
* The bug change point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyChangeEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$oldStory = $this->loadModel('story')->getByID($storyID);
$fields = 'reviewer,comment,executions,bugs,cases,tasks,reviewedBy,uid';
$this->batchSetPost($fields);
$fields = 'title,spec,verify';
$this->batchSetPost($fields, $oldStory);
/* If reviewer is not post, set needNotReview. */
if(empty($this->request('reviewer')))
{
$this->setPost('reviewer', array());
$this->setPost('needNotReview', 1);
}
$control = $this->loadController('story', 'change');
$this->requireFields('title');
$control->change($storyID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time'));
}
}

View File

@@ -1,37 +0,0 @@
<?php
/**
* The story close entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyCloseEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$fields = 'closedReason,duplicateStory,childStories,comment';
$this->batchSetPost($fields);
$control = $this->loadController('story', 'close');
$control->close($storyID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,30 +0,0 @@
<?php
/**
* The story recall entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyRecallEntry extends Entry
{
/**
* Delete method.
*
* @param int $storyID
* @access public
* @return void
*/
public function delete($storyID)
{
$control = $this->loadController('story', 'recall');
$control->recall($storyID);
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,61 +0,0 @@
<?php
/**
* The story recordEstimate entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyRecordEstimateEntry extends Entry
{
/**
* GET method.
*
* @param int $storyID
* @access public
* @return void
*/
public function get($storyID)
{
if($this->config->edition == 'open') return $this->send400('ZenTaoPMS does not have story effort function.');
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('story', $storyID);
$data = $this->getData();
if(!$data) return $this->error('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$effort = $data->data->efforts;
$this->send(200, array('effort' => $effort));
}
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
if($this->config->edition == 'open') return $this->send400('ZenTaoPMS does not have story effort function.');
$fields = 'id,dates,consumed,objectType,objectID,work';
$this->batchSetPost($fields);
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('story', $storyID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getById($storyID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,40 +0,0 @@
<?php
/**
* The story review of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class storyReviewEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$fields = 'reviewedDate,result,closedReason,pri,estimate,comment';
$this->batchSetPost($fields);
$control = $this->loadController('story', 'review');
$control->review($storyID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,81 +0,0 @@
<?php
/**
* The tabs entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class tabsEntry extends baseEntry
{
/**
* Get tabs.
*
* @param string $moduleName work|
* @access public
* @return void
*/
public function get($moduleName)
{
$menus = array();
if($moduleName == 'work')
{
$this->app->loadLang('my');
$tabs = array('calendar', 'task', 'bug', 'story', 'issue', 'risk', 'myMeeting');
foreach($tabs as $menuKey)
{
if(!isset($this->lang->my->$menuKey)) continue;
if(!common::hasPriv('my', $menuKey)) continue;
$label = $this->lang->my->$menuKey;
if($menuKey == 'calendar') $label = $this->lang->my->calendarAction;
$menu = new stdclass();
$menu->code = $menuKey;
$menu->name = $label;
$menus[] = $menu;
}
}
elseif($moduleName == 'product')
{
$this->app->loadLang('product');
$tabs = array('story', 'plan', 'project', 'release', 'requirement', 'doc', 'view');
foreach($tabs as $menuKey)
{
if($menuKey == 'requirement' and empty($this->config->URAndSR)) continue;
if(isset($this->lang->product->menu->$menuKey))
{
$menuName = $this->lang->product->menu->$menuKey;
if(!isset($menuName['link'])) continue;
list($label, $module, $method) = explode('|', $menuName['link']);
if(!common::hasPriv($module, $method)) continue;
}
else
{
if(!common::hasPriv('product', $menuKey)) continue;
}
$label = zget($this->lang->product, $menuKey, '');
if($menuKey == 'view') $label = $this->lang->overview;
if($menuKey == 'doc') $label = $this->lang->doc->common;
if($menuKey == 'project') $label = $this->lang->project->common;
if($menuKey == 'story') $label = $this->lang->createObjects['story'];
if($menuKey == 'requirement') $label = $this->lang->URCommon;
$menu = new stdclass();
$menu->code = $menuKey;
$menu->name = $label;
$menus[] = $menu;
}
}
$this->send(200, array('tabs' => $menus));
}
}

View File

@@ -1,135 +0,0 @@
<?php
/**
* The task entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskEntry extends Entry
{
/**
* GET method.
*
* @param int $taskID
* @access public
* @return void
*/
public function get($taskID)
{
$this->resetOpenApp($this->param('tab', 'execution'));
$control = $this->loadController('task', 'view');
$control->view($taskID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $data->data->task;
if(!empty($task->children)) $task->children = array_values((array)$task->children);
if($task->parent > 0) $task->parentPri = $this->dao->select('pri')->from(TABLE_TASK)->where('id')->eq($task->parent)->fetch('pri');
/* Set execution name */
$task->executionName = $data->data->execution->name;
/* Set module title */
$moduleTitle = '';
if(empty($task->module)) $moduleTitle = '/';
if($task->module)
{
$modulePath = $data->data->modulePath;
foreach($modulePath as $key => $module)
{
$moduleTitle .= $module->name;
if(isset($modulePath[$key + 1])) $moduleTitle .= '/';
}
}
$task->moduleTitle = $moduleTitle;
$queryAccounts = array();
if($task->assignedTo) $queryAccounts[$task->assignedTo] = $task->assignedTo;
if(!empty($task->team))
{
foreach($task->team as $account => $team) $queryAccounts[$account] = $account;
}
$usersWithAvatar = $this->loadModel('user')->getListByAccounts($queryAccounts, 'account');
if(!empty($task->team))
{
$teams = array();
foreach($task->team as $account => $team)
{
$user = zget($usersWithAvatar, $account, '');
$team->realname = $user ? $user->realname : $account;
$team->avatar = $user ? $user->avatar : '';
$team->estimate = round($team->estimate, 1);
$team->consumed = round($team->consumed, 1);
$team->left = round($team->left, 1);
$allHours = $team->consumed + $team->left;
$team->progress = empty($allHours) ? 0 : round($team->consumed / $allHours * 100, 1);
$teams[] = $team;
}
$task->team = $teams;
}
$task->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->task);
$preAndNext = $data->data->preAndNext;
$task->preAndNext = array();
$task->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : '';
$task->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : '';
$execution = $this->loadModel('project')->getByID($task->execution, 'execution');
$task->executionStatus = $execution->status;
$this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
/**
* PUT method.
*
* @param int $taskID
* @access public
* @return void
*/
public function put($taskID)
{
$oldTask = $this->loadModel('task')->getByID($taskID);
/* Set $_POST variables. */
$fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,teamConsumed,teamLeft,multiple,mailto,uid';
$this->batchSetPost($fields, $oldTask);
$control = $this->loadController('task', 'edit');
$control->edit($taskID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->task->getByID($taskID);
$this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
/**
* DELETE method.
*
* @param int $taskID
* @access public
* @return void
*/
public function delete($taskID)
{
$control = $this->loadController('task', 'delete');
$control->delete(0, $taskID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,38 +0,0 @@
<?php
/**
* The task active entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class taskActiveEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$fields = 'assignedTo,left,comment';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'activate');
$control->activate($taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $this->format($task, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,41 +0,0 @@
<?php
/**
* The task assignto entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskAssignToEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$task = $this->loadModel('task')->getByID($taskID);
$fields = 'assignedTo,comment,left';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'assignTo');
$this->requireFields('assignedTo');
$control->assignTo($task->execution, $taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time'));
}
}

View File

@@ -1,86 +0,0 @@
<?php
/**
* The task batch create entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskBatchCreateEntry extends Entry
{
/**
* POST method.
*
* @param int $executionID
* @access public
* @return void
*/
public function post($executionID = 0)
{
if(!$executionID) $executionID = $this->param('execution', 0);
if(!$executionID) return $this->send400('Need execution id.');
$storyID = $this->param('story', 0);
$moduleID = $this->param('module', 0);
$taskID = $this->param('task', 0);
if(!isset($this->requestBody->tasks))
{
return $this->send400('Need tasks.');
}
$modules = array();
$parents = array();
$names = array();
$colors = array();
$types = array();
$estimates = array();
$estStarted = array();
$deadlines = array();
$desc = array();
$pri = array();
$stories = array();
foreach($this->request('tasks') as $key => $task)
{
$number = $key + 1;
if(!isset($task->name) or !isset($task->type)) return $this->send400('Task must have name and type.');
$modules[$number] = isset($task->module) ? $task->module : $moduleID;
$parents[$number] = isset($task->parent) ? $task->parent : $taskID;
$names[$number] = $task->name;
$colors[$number] = isset($task->color) ? $task->color : '';
$types[$number] = $task->type;
$estimates[$number] = isset($task->estimate) ? $task->estimate : 0;
$estStarted[$number] = isset($task->estStarted) ? $task->estStarted : 0;
$deadlines[$number] = isset($task->deadline) ? $task->deadline : null;
$desc[$number] = isset($task->desc) ? $task->desc : '';
$pri[$number] = isset($task->pri) ? $task->pri : 0;
$stories[$number] = isset($task->story) ? $task->story : $storyID;
}
$this->setPost('module', $modules);
$this->setPost('parent', $parents);
$this->setPost('name', $names);
$this->setPost('color', $colors);
$this->setPost('type', $types);
$this->setPost('estimate', $estimates);
$this->setPost('estStarted', $estStarted);
$this->setPost('deadline', $deadlines);
$this->setPost('desc', $desc);
$this->setPost('pri', $pri);
$this->setPost('story', $stories);
$control = $this->loadController('task', 'batchCreate');
$control->batchCreate($executionID, $storyID, $moduleID, $taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(!$taskID) return $this->send(200, array());
$task = $this->loadModel('task')->getById($taskID);
return $this->send(200, array('task' => $task));
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* The task close entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskCloseEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$task = $this->loadModel('task')->getByID($taskID);
$fields = 'comment';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'close');
$control->close($taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $task);
}
}

View File

@@ -1,45 +0,0 @@
<?php
/**
* The task component entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskComponentEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$fields = 'name,color,type,assignedTo,parent,estimate,story,module,pri,desc,estStarted,deadline';
$this->batchSetPost($fields);
$fields = explode(',', $fields);
foreach($fields as $field) $this->setArrayPost($field);
$task = $this->loadModel('task')->getById($taskID);
$control = $this->loadController('task', 'batchCreate');
$control->batchCreate($task->execution, 0, 0, $taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->task->getById($data->idList[0]);
$this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
public function setArrayPost($field)
{
$_POST[$field] = array('0' => $_POST[$field]);
}
}

View File

@@ -1,46 +0,0 @@
<?php
/**
* The task finish entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskFinishEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$task = $this->loadModel('task')->getByID($taskID);
$fields = 'assignedTo,realStarted';
$this->batchSetPost($fields, $task);
$fields = 'finishedDate,comment';
$this->batchSetPost($fields);
$this->setPost('currentConsumed', $this->request('currentConsumed', 0));
$this->setPost('consumed', $this->request('currentConsumed', 0) + $task->consumed);
$control = $this->loadController('task', 'finish');
$this->requireFields('assignedTo,currentConsumed,realStarted,finishedDate');
$control->finish($taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time'));
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* The task pause entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskPauseEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$task = $this->loadModel('task')->getByID($taskID);
$fields = 'comment';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'pause');
$control->pause($taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $task);
}
}

View File

@@ -1,77 +0,0 @@
<?php
/**
* The task recordEstimate entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskRecordEstimateEntry extends Entry
{
/**
* GET method.
*
* @param int $taskID
* @access public
* @return void
*/
public function get($taskID)
{
if($this->config->edition != 'open')
{
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('task', $taskID);
}
else
{
$control = $this->loadController('task', 'recordEstimate');
$control->recordEstimate($taskID);
}
$data = $this->getData();
if(!$data) return $this->error('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$effort = array();
if($this->config->edition != 'open' and $data->data->efforts) $effort = $data->data->efforts;
if($this->config->edition == 'open' and $data->data->estimates) $effort = $data->data->estimates;
$this->send(200, array('effort' => $effort));
}
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
if($this->config->edition != 'open')
{
$fields = 'id,dates,consumed,left,objectType,objectID,work';
$this->batchSetPost($fields);
$control = $this->loadController('effort', 'createForObject');
$control->createForObject('task', $taskID);
}
else
{
$fields = 'id,dates,consumed,left,work';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'recordEstimate');
$control->recordEstimate($taskID);
}
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getById($taskID);
$this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,83 +0,0 @@
<?php
/**
* The tasks entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class tasksEntry extends entry
{
/**
* GET method.
*
* @param int $executionID
* @access public
* @return void
*/
public function get($executionID = 0)
{
if(!$executionID)
{
/* Get my tasks defaultly. */
$control = $this->loadController('my', 'task');
$control->task($this->param('type', 'assignedTo'), $this->param('order', 'id_desc'), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
}
else
{
/* Get tasks by execution. */
$control = $this->loadController('execution', 'task');
$control->task($executionID, $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 100), $this->param('page', 1));
$data = $this->getData();
}
if(isset($data->status) and $data->status == 'success')
{
$tasks = $data->data->tasks;
$pager = $data->data->pager;
$result = array();
foreach($tasks as $task)
{
if(isset($task->children)) $task->children = array_values((array)$task->children);
$result[] = $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'tasks' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $executionID
* @access public
* @return void
*/
public function post($executionID)
{
$fields = 'name,type,assignedTo,estimate,story,execution,project,module,pri,desc,estStarted,deadline,mailto,team,teamEstimate,multiple,uid';
$this->batchSetPost($fields);
$assignedTo = $this->request('assignedTo');
if($assignedTo and !is_array($assignedTo)) $this->setPost('assignedTo', array($assignedTo));
$this->setPost('execution', $executionID);
$control = $this->loadController('task', 'create');
$this->requireFields('name,assignedTo,type,estStarted,deadline');
$control->create($executionID, $this->request('storyID', 0), $this->request('moduleID', 0), $this->request('copyTaskID', 0), $this->request('copyTodoID', 0));
$data = $this->getData();
if(!isset($data->id)) return $this->sendError(400, $data->message);
$task = $this->loadModel('task')->getByID($data->id);
$this->send(201, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
}

View File

@@ -1,40 +0,0 @@
<?php
/**
* The task start entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskStartEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$task = $this->loadModel('task')->getByID($taskID);
$fields = 'assignedTo,realStarted,consumed,left,comment';
$this->batchSetPost($fields);
$control = $this->loadController('task', 'start');
$this->requireFields('left');
$control->start($taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->loadModel('task')->getByID($taskID);
$this->send(200, $task);
}
}

View File

@@ -1,93 +0,0 @@
<?php
/**
* The testcase entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class testcaseEntry extends entry
{
/**
* GET method.
*
* @param int $testcaseID
* @access public
* @return void
*/
public function get($testcaseID)
{
$control = $this->loadController('testcase', 'view');
$control->view($testcaseID, $this->param('version', 0));
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(!isset($data->case)) $this->sendError(400, 'error');
$case = $data->case;
$case->steps = (isset($case->steps) and !empty($case->steps)) ? array_values(get_object_vars($case->steps)) : array();
$this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool'));
}
/**
* PUT method.
*
* @param int $caseID
* @access public
* @return void
*/
public function put($caseID)
{
$oldCase = $this->loadModel('testcase')->getByID($caseID);
/* Set $_POST variables. */
$fields = 'title,pri,story,type,stage,product,module,branch,precondition';
$this->batchSetPost($fields, $oldCase);
/* Set steps and expects. */
if(isset($this->requestBody->steps))
{
$steps = array();
$expects = array();
$stepType = array();
foreach($this->requestBody->steps as $step)
{
$steps[] = $step->desc;
$expects[] = $step->expect;
$stepType[] = 'item';
}
$this->setPost('steps', $steps);
$this->setPost('expects', $expects);
$this->setPost('stepType', $stepType);
}
$control = $this->loadController('testcase', 'edit');
$control->edit($caseID);
$this->getData();
$case = $this->testcase->getByID($caseID);
$this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool'));
}
/**
* DELETE method.
*
* @param int $testcaseID
* @access public
* @return void
*/
public function delete($testcaseID)
{
$control = $this->loadController('testcase', 'delete');
$control->delete($testcaseID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -1,111 +0,0 @@
<?php
/**
* The testcases entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class testcasesEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($productID = 0)
{
if(empty($productID)) $productID = $this->param('product', 0);
if(empty($productID)) return $this->sendError(400, 'Need product id.');
$this->app->cookie->caseModule = 0;
$this->app->cookie->caseSuite = 0;
$type = 'all';
$param = 0;
$moduleID = $this->param('module', 0);
if($moduleID)
{
$type = 'byModule';
$param = $moduleID;
}
$control = $this->loadController('testcase', 'browse');
$control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$cases = $data->data->cases;
$pager = $data->data->pager;
$result = array();
foreach($cases as $case)
{
$case->statusName = $this->lang->testcase->statusList[$case->status];
$result[] = $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'testcases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $productID
* @access public
* @return void
*/
public function post($productID = 0)
{
if(!$productID) $productID = $this->param('product');
if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product;
if(!$productID) return $this->sendError(400, 'Need product id.');
$fields = 'module,type,stage,story,title,precondition,pri';
$this->batchSetPost($fields);
$this->setPost('product', $productID);
/* Set steps and expects. */
if(isset($this->requestBody->steps))
{
$steps = array();
$expects = array();
$stepType = array();
foreach($this->requestBody->steps as $step)
{
$type = isset($step->type) ? $step->type : 'step';
$steps[] = $step->desc;
$expects[] = $type == 'group' ? '' : $step->expect;
$stepType[] = $type;
}
$this->setPost('steps', $steps);
$this->setPost('expects', $expects);
$this->setPost('stepType', $stepType);
}
$control = $this->loadController('testcase', 'create');
$this->requireFields('title,type,pri,steps');
$control->create(0);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
$case = $this->loadModel('testcase')->getByID($data->id);
$case->steps = (isset($case->steps) and !empty($case->steps)) ? array_values($case->steps) : array();
$this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool'));
}
}

View File

@@ -1,88 +0,0 @@
<?php
/**
* The testresults entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class testresultsEntry extends entry
{
/**
* GET method.
*
* @param int $productID
* @access public
* @return void
*/
public function get($caseID = 0)
{
if(!$caseID) return $this->sendError(400, 'Need case id.');
$version = $this->param('version', 0);
$runID = $this->param('runID', 0);
$control = $this->loadController('testtask', 'results');
$control->results($runID, $caseID, $version);
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$results = array();
foreach($data->data->results as $result)
{
$result->stepResults = array_values((array)$result->stepResults);
$results[] = $result;
}
return $this->send(200, array('results' => $results));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
return $this->sendError(400, 'error');
}
/**
* POST method.
*
* @param int $caseID
* @access public
* @return void
*/
public function post($caseID = 0)
{
if(!$caseID) $caseID = $this->param('case');
if(!$caseID) return $this->sendError(400, 'Need case id.');
$case = $this->loadModel('testcase')->getByID($caseID);
$runID = $this->param('runID', 0);
$version = $this->param('version', $case->version);
$this->setPost('case', $caseID);
/* Set steps and expects. */
if(isset($this->requestBody->steps))
{
$results = array();
$reals = array();
foreach($this->requestBody->steps as $step)
{
$results[] = $step->result;
$reals[] = $step->real;
}
$this->setPost('steps', $results);
$this->setPost('reals', $reals);
}
$control = $this->loadController('testtask', 'runCase');
$control->runCase($runID, $caseID, $version);
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$this->send(200, array());
}
}

View File

@@ -1,58 +0,0 @@
<?php
/**
* The testsuite entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class testsuiteEntry extends entry
{
/**
* GET method.
*
* @param int $testsuiteID
* @access public
* @return void
*/
public function get($testsuiteID)
{
$control = $this->loadController('testsuite', 'view');
$control->view($testsuiteID, $this->param('version', 0));
$data = $this->getData();
if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(!isset($data->data->suite)) $this->sendError(400, 'error');
$suite = $this->format($data->data->suite, 'addedBy:user,addedDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool');
$suite->testcases = array();
foreach($data->data->cases as $case)
{
$suite->testcases[] = $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool');
}
$this->send(200, $suite);
}
/**
* DELETE method.
*
* @param int $testsuiteID
* @access public
* @return void
*/
public function delete($testsuiteID)
{
$control = $this->loadController('testsuite', 'delete');
$control->delete($testsuiteID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
}
}

Some files were not shown because too many files have changed in this diff Show More