Se agregan metodo POST para FILES MANAGER y se corrige code style en varios documentos
This commit is contained in:
@@ -198,10 +198,11 @@ class CaseScheduler
|
||||
$sTASKS = $sTaskUID;
|
||||
$sWS_USER = trim( $userName );
|
||||
$sWS_PASS = trim( $userPass );
|
||||
if (\G::is_https())
|
||||
if (\G::is_https()) {
|
||||
$http = 'https://';
|
||||
else
|
||||
} else {
|
||||
$http = 'http://';
|
||||
}
|
||||
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
|
||||
@$client = new \SoapClient( $endpoint );
|
||||
$user = $sWS_USER;
|
||||
@@ -285,7 +286,7 @@ class CaseScheduler
|
||||
throw (new \Exception( 'task not found for id: '. $aData['TAS_UID']));
|
||||
}
|
||||
if ($aData['SCH_NAME']=='') {
|
||||
throw (new \Exception( 'the Case Scheduler name can`t be empty'));
|
||||
throw (new \Exception( '`sch_name` can`t be empty'));
|
||||
}
|
||||
if ($this->existsName($sProcessUID, $aData['SCH_NAME'])) {
|
||||
throw (new \Exception( 'duplicate Case Scheduler name'));
|
||||
@@ -342,7 +343,6 @@ class CaseScheduler
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '';
|
||||
switch ($sOption) {
|
||||
case '1':
|
||||
// Option 1
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '1';
|
||||
$sValue = $aData['SCH_DAYS_PERFORM_TASK'];
|
||||
switch ($sValue) {
|
||||
@@ -538,13 +538,13 @@ class CaseScheduler
|
||||
/**
|
||||
* Update case scheduler for a project
|
||||
* @param string $sProcessUID
|
||||
* @param string $sSchUID
|
||||
* @param array $aData
|
||||
* @param string $userUID
|
||||
* @param string $sSchUID
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function updateCaseScheduler($sProcessUID, $sSchUID = '', $aData, $userUID)
|
||||
public function updateCaseScheduler($sProcessUID, $aData, $userUID, $sSchUID = '')
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
@@ -567,7 +567,7 @@ class CaseScheduler
|
||||
throw (new \Exception( 'task not found for id: '. $aData['TAS_UID']));
|
||||
}
|
||||
if ($aData['SCH_NAME']=='') {
|
||||
throw (new \Exception( 'the Case Scheduler name can`t be empty'));
|
||||
throw (new \Exception( '`sch_name` can`t be empty'));
|
||||
}
|
||||
if ($this->existsNameUpdate($sSchUID, $aData['SCH_NAME'])) {
|
||||
throw (new \Exception( 'duplicate Case Scheduler name'));
|
||||
@@ -624,7 +624,6 @@ class CaseScheduler
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '';
|
||||
switch ($sOption) {
|
||||
case '1':
|
||||
// Option 1
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '1';
|
||||
$sValue = $aData['SCH_DAYS_PERFORM_TASK'];
|
||||
switch ($sValue) {
|
||||
|
||||
@@ -47,11 +47,9 @@ class FilesManager
|
||||
switch ($sMainDirectory) {
|
||||
case 'mailTemplates':
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP;
|
||||
$sEditable = false;
|
||||
break;
|
||||
case 'public':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP;
|
||||
$sEditable = true;
|
||||
break;
|
||||
default:
|
||||
die();
|
||||
@@ -75,6 +73,13 @@ class FilesManager
|
||||
}
|
||||
}
|
||||
foreach ($aFiles as $aFile) {
|
||||
$extention = end(explode(".", $aFile['FILE']));
|
||||
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' ||
|
||||
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
|
||||
$sEditable = true;
|
||||
} else {
|
||||
$sEditable = false;
|
||||
}
|
||||
$aTheFiles[] = array('name' => $aFile['FILE'],
|
||||
'type' => "file",
|
||||
'path' => $sDirectory.$aFile['FILE'],
|
||||
@@ -86,7 +91,125 @@ class FilesManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Process File Manager
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* @param string $userUid {@min 32} {@max 32}
|
||||
* @param array $aData
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function addProcessFilesManager($sProcessUID, $userUid, $aData)
|
||||
{
|
||||
try {
|
||||
if ($aData['path'] == 'templates/' || $aData['path'] == 'folder/') {
|
||||
switch ($aData['path']) {
|
||||
case 'templates/':
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||
$sEditable = false;
|
||||
break;
|
||||
case 'folder/':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||
break;
|
||||
default:
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||
}
|
||||
$extention = end(explode(".", $aData['file_name']));
|
||||
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' ||
|
||||
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
|
||||
$sEditable = true;
|
||||
} else {
|
||||
$sEditable = false;
|
||||
}
|
||||
$sPkProcessFiles = \G::generateUniqueID();
|
||||
$oProcessFiles = new \ProcessFiles();
|
||||
$sDate = date( 'Y-m-d H:i' );
|
||||
$oProcessFiles->setPrfUid( $sPkProcessFiles );
|
||||
$oProcessFiles->setProUid( $sProcessUID );
|
||||
$oProcessFiles->setUsrUid( $userUid );
|
||||
$oProcessFiles->setPrfUpdateUsrUid( '' );
|
||||
$oProcessFiles->setPrfPath( $sDirectory );
|
||||
$oProcessFiles->setPrfType( 'file' );
|
||||
$oProcessFiles->setPrfEditable( $sEditable );
|
||||
$oProcessFiles->setPrfCreateDate( $sDate );
|
||||
$oProcessFiles->save();
|
||||
$fp = fopen($sDirectory, 'w');
|
||||
$content = $aData['content'];
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
|
||||
'pro_uid' => $oProcessFiles->getProUid(),
|
||||
'usr_uid' => $oProcessFiles->getUsrUid(),
|
||||
'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(),
|
||||
'prf_path' => $oProcessFiles->getPrfPath(),
|
||||
'prf_type' => $oProcessFiles->getPrfType(),
|
||||
'prf_editable' => $oProcessFiles->getPrfEditable(),
|
||||
'prf_create_date' => $oProcessFiles->getPrfCreateDate(),
|
||||
'prf_update_date' => $oProcessFiles->getPrfUpdateDate());
|
||||
return $oProcessFile;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Process Files Manager
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getProcessFilesManagerDownload($sProcessUID)
|
||||
{
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Process Files Manager
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function uploadProcessFilesManager($sProcessUID)
|
||||
{
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Process Files Manager
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function deleteProcessFilesManager($sProcessUID)
|
||||
{
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -141,14 +141,14 @@ class ProcessSupervisor
|
||||
|
||||
/**
|
||||
* Return available supervisors
|
||||
* @param string $sProcessUID
|
||||
* @param string $obj_type
|
||||
* @param string $sProcessUID
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getAvailableProcessSupervisors($sProcessUID = '', $obj_type)
|
||||
public function getAvailableProcessSupervisors($obj_type, $sProcessUID = '')
|
||||
{
|
||||
try {
|
||||
// Groups
|
||||
|
||||
@@ -168,10 +168,11 @@ class ProjectUser
|
||||
$sWS_PASS = trim( $oData['password'] );
|
||||
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
|
||||
$sWE_USR = $oData->WE_USR;
|
||||
if (\G::is_https())
|
||||
if (\G::is_https()) {
|
||||
$http = 'https://';
|
||||
else
|
||||
} else {
|
||||
$http = 'http://';
|
||||
}
|
||||
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
|
||||
@$client = new \SoapClient( $endpoint );
|
||||
$user = $sWS_USER;
|
||||
|
||||
@@ -240,5 +240,5 @@ class Assignee extends Api
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class CaseScheduler extends Api
|
||||
$userUid = $this->getUserId();
|
||||
$request_data = (array)($request_data);
|
||||
$caseScheduler = new \BusinessModel\CaseScheduler();
|
||||
$objectData = $caseScheduler->updateCaseScheduler($prjUid, $schUid, $request_data, $userUid);
|
||||
$objectData = $caseScheduler->updateCaseScheduler($prjUid, $request_data, $userUid, $schUid);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
@@ -234,4 +234,3 @@ class CaseSchedulerStructure
|
||||
public $sch_repeat_every;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,4 +40,103 @@ class FilesManager extends Api
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $path {@choice templates,folder,}
|
||||
*
|
||||
* @url GET /:prjUid/process-file-manager-download
|
||||
*/
|
||||
public function doGetProcessFilesManagerDownload($prjUid, $path = '')
|
||||
{
|
||||
try {
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->getProcessFilesManagerDownload($prjUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param ProcessFilesManagerStructure $request_data
|
||||
*
|
||||
* @url POST /:prjUid/process-file-manager
|
||||
*/
|
||||
public function doPostProcessFilesManager($prjUid, ProcessFilesManagerStructure $request_data)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->addProcessFilesManager($prjUid, $userUid, $request_data);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url POST /:prjUid/process-file-manager-upload
|
||||
*/
|
||||
public function doPostProcessFilesManagerUpload($prjUid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url DELETE /:prjUid/process-file-manager-delete
|
||||
*/
|
||||
public function doDeleteProcessFilesManager($prjUid)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->deleteProcessFilesManager($prjUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
class ProcessFilesManagerStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $file_name;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $path;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $content;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class ProcessSupervisors extends Api
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getAvailableProcessSupervisors($prjUid, $obj_type);
|
||||
$arrayData = $supervisor->getAvailableProcessSupervisors($obj_type, $prjUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
@@ -174,7 +174,6 @@ class ProcessSupervisors extends Api
|
||||
* @url GET /:prjUid/process-supervisor/available-input-documents
|
||||
*/
|
||||
public function doGetAvailableProcessSupervisorInputDocument($prjUid)
|
||||
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
@@ -312,3 +311,4 @@ class ProcessSupervisors extends Api
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,22 +89,21 @@ class ProjectUsers extends Api
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class wsUserCanStartTaskStructure
|
||||
{ /**
|
||||
{
|
||||
/**
|
||||
* @var string {@from body} {@min 32} {@max 32}
|
||||
*/
|
||||
public $act_uid;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $password;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user