Se aumenta end point para borrar folders en FILESMANAGER (incluido BEHAT). Se agrega listado de InputDocuments con WS (no es la version final)
This commit is contained in:
@@ -62,7 +62,7 @@ class FilesManager
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
|
||||
break;
|
||||
default:
|
||||
die();
|
||||
throw (new \Exception( 'Invalid value specified for `path`. Expecting `templates` or `public`'));
|
||||
break;
|
||||
}
|
||||
\G::verifyPath($sDirectory, true);
|
||||
@@ -314,7 +314,7 @@ class FilesManager
|
||||
}
|
||||
$sFile = end(explode("/",$path));
|
||||
$sPath = str_replace($sFile,'',$path);
|
||||
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
|
||||
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
@@ -383,7 +383,7 @@ class FilesManager
|
||||
}
|
||||
$sFile = end(explode("/",$path));
|
||||
$sPath = str_replace($sFile,'',$path);
|
||||
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
|
||||
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
@@ -392,9 +392,7 @@ class FilesManager
|
||||
}
|
||||
$oProcessMap = new \processMap(new \DBConnection());
|
||||
$oProcessMap->deleteFile($sProcessUID, $sMainDirectory, $sSubDirectory, $sFile);
|
||||
$c = new \Criteria("workflow");
|
||||
$c->add(\ProcessFilesPeer::PRF_UID, $prfUid, \Criteria::EQUAL);
|
||||
$rs = \ProcessFilesPeer::doDelete($c);
|
||||
$rs = \ProcessFilesPeer::doDelete($criteria);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -427,7 +425,7 @@ class FilesManager
|
||||
}
|
||||
$sFile = end(explode("/",$path));
|
||||
$sPath = str_replace($sFile,'',$path);
|
||||
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
|
||||
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
@@ -445,5 +443,43 @@ class FilesManager
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* @param array $path
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function deleteFolderProcessFilesManager($sProcessUID, $path)
|
||||
{
|
||||
try {
|
||||
$sDirToDelete = end(explode("/",$path));
|
||||
$sPath = str_replace($sDirToDelete,'',$path);
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
$sMainDirectory = current(explode("/", $path));
|
||||
$sSubDirectory = substr(str_replace($sMainDirectory,'',$sSubDirectory),1);
|
||||
switch ($sMainDirectory) {
|
||||
case 'templates':
|
||||
$sMainDirectory = 'mailTemplates';
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
||||
break;
|
||||
case 'public':
|
||||
$sMainDirectory = 'public';
|
||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
||||
break;
|
||||
default:
|
||||
die();
|
||||
break;
|
||||
}
|
||||
if (file_exists($sDirectory . $sDirToDelete)) {
|
||||
\G::rm_dir($sDirectory . $sDirToDelete);
|
||||
} else {
|
||||
throw (new \Exception( 'Invalid value specified for `path`.'));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -462,5 +462,192 @@ class InputDocument
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of Cases InputDocument
|
||||
*
|
||||
* @param string $caseUid
|
||||
* @param string $userUid
|
||||
*
|
||||
* return array Return an array with data of an InputDocument
|
||||
*/
|
||||
public function getCasesInputDocument($caseUid, $userUid)
|
||||
{
|
||||
try {
|
||||
|
||||
///
|
||||
global $G_PUBLISH;
|
||||
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
|
||||
|
||||
$endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint;
|
||||
|
||||
$sessionId = isset( $_SESSION['SESSION_ID'] ) ? $_SESSION['SESSION_ID'] : '';
|
||||
|
||||
//Apply proxy settings
|
||||
$proxy = array ();
|
||||
$sysConf = \System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
$proxy['proxy_host'] = $sysConf['proxy_host'];
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
$proxy['proxy_port'] = $sysConf['proxy_port'];
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
$proxy['proxy_login'] = $sysConf['proxy_user'];
|
||||
}
|
||||
if ($sysConf['proxy_pass'] != '') {
|
||||
$proxy['proxy_password'] = $sysConf['proxy_pass'];
|
||||
}
|
||||
}
|
||||
|
||||
@$client = new \SoapClient( $endpoint, $proxy );
|
||||
///
|
||||
|
||||
|
||||
$caseId = $caseUid;
|
||||
$sessionId = $userUid;
|
||||
$params = array ('sessionId' => $sessionId,'caseId' => $caseId);
|
||||
|
||||
$wsResponse = $client->__SoapCall( 'InputDocumentList', array ($params));
|
||||
|
||||
//g::pr($wsResponse);
|
||||
$result = \G::PMWSCompositeResponse( $wsResponse, 'documents' );
|
||||
|
||||
$G_PUBLISH = new \Publisher();
|
||||
$rows[] = array ('guid' => 'char','name' => 'char','processId' => 'char');
|
||||
|
||||
if (is_array( $result )) {
|
||||
foreach ($result as $key => $item) {
|
||||
if (isset( $item->item )) {
|
||||
foreach ($item->item as $index => $val) {
|
||||
if ($val->key == 'guid') {
|
||||
$guid = $val->value;
|
||||
}
|
||||
if ($val->key == 'filename') {
|
||||
$filename = $val->value;
|
||||
}
|
||||
if ($val->key == 'docId') {
|
||||
$docId = $val->value;
|
||||
}
|
||||
if ($val->key == 'version') {
|
||||
$version = $val->value;
|
||||
}
|
||||
if ($val->key == 'createDate') {
|
||||
$createDate = $val->value;
|
||||
}
|
||||
if ($val->key == 'createBy') {
|
||||
$createBy = $val->value;
|
||||
}
|
||||
if ($val->key == 'type') {
|
||||
$type = $val->value;
|
||||
}
|
||||
if ($val->key == 'link') {
|
||||
$link = $val->value;
|
||||
}
|
||||
}
|
||||
} elseif (is_array( $item )) {
|
||||
foreach ($item as $index => $val) {
|
||||
if ($val->key == 'guid') {
|
||||
$guid = $val->value;
|
||||
}
|
||||
if ($val->key == 'filename') {
|
||||
$filename = $val->value;
|
||||
}
|
||||
if ($val->key == 'docId') {
|
||||
$docId = $val->value;
|
||||
}
|
||||
if ($val->key == 'version') {
|
||||
$version = $val->value;
|
||||
}
|
||||
if ($val->key == 'createDate') {
|
||||
$createDate = $val->value;
|
||||
}
|
||||
if ($val->key == 'createBy') {
|
||||
$createBy = $val->value;
|
||||
}
|
||||
if ($val->key == 'type') {
|
||||
$type = $val->value;
|
||||
}
|
||||
if ($val->key == 'link') {
|
||||
$link = $val->value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset( $item->guid )) {
|
||||
$guid = $item->guid;
|
||||
}
|
||||
if (isset( $item->filename )) {
|
||||
$filename = $item->filename;
|
||||
}
|
||||
if (isset( $item->docId )) {
|
||||
$docId = $item->docId;
|
||||
}
|
||||
if (isset( $item->version )) {
|
||||
$version = $item->version;
|
||||
}
|
||||
if (isset( $item->createDate )) {
|
||||
$createDate = $item->createDate;
|
||||
}
|
||||
if (isset( $item->createBy )) {
|
||||
$createBy = $item->createBy;
|
||||
}
|
||||
if (isset( $item->type )) {
|
||||
$type = $item->type;
|
||||
}
|
||||
if (isset( $item->link )) {
|
||||
$link = $item->link;
|
||||
}
|
||||
}
|
||||
$rows[] = array ('guid' => $guid,'filename' => $filename,'docId' => $docId,'version' => $version,'createDate' => $createDate,'createBy' => $createBy,'type' => $type,'link' => $link);
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
/* testing//
|
||||
global $_DBArray;
|
||||
$_DBArray = (isset( $_SESSION['_DBArray'] ) ? $_SESSION['_DBArray'] : '');
|
||||
$_DBArray['inputDocument'] = $rows;
|
||||
$documentArray = array ();
|
||||
$documentArray[] = array ('guid' => 'char','filename' => 'char'
|
||||
);
|
||||
if (isset( $_DBArray['inputDocument'] )) {
|
||||
foreach ($_DBArray['inputDocument'] as $key => $val) {
|
||||
if ($key != 0 && isset( $val['filename'] )) {
|
||||
$documentArray[] = array ('guid' => $val['guid'],'filename' => $val['filename']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset( $_DBArray['outputDocument'] )) {
|
||||
foreach ($_DBArray['outputDocument'] as $key => $val) {
|
||||
if ($key != 0 && isset( $val['filename'] )) {
|
||||
$documentArray[] = array ('guid' => $val['guid'],'filename' => $val['filename']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_DBArray['documents'] = $documentArray;
|
||||
$_DBArray['WS_TMP_CASE_UID'] = $frm["CASE_ID"];
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
|
||||
G::LoadClass( 'ArrayPeer' );
|
||||
$c = new Criteria( 'dbarray' );
|
||||
$c->setDBArrayTable( 'inputDocument' );
|
||||
$c->addAscendingOrderByColumn( 'name' );
|
||||
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/wsrInputDocumentList', $c );
|
||||
|
||||
} elseif (is_object( $result )) {
|
||||
$_SESSION['WS_SESSION_ID'] = '';
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = date( "Y-m-d H:i:s" );
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
|
||||
}
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
break;*/
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,23 @@ class FilesManager extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $path
|
||||
*
|
||||
* @url DELETE /:prjUid/file-manager/folder
|
||||
*/
|
||||
public function doDeleteFolderProcessFilesManager($prjUid, $path)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \BusinessModel\FilesManager();
|
||||
$filesManager->deleteFolderProcessFilesManager($prjUid, $path);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ProcessFilesManagerStructure
|
||||
|
||||
@@ -59,3 +59,9 @@ debug = 1
|
||||
[alias: calendars]
|
||||
calendar = "Services\Api\ProcessMaker\Calendar"
|
||||
|
||||
[alias: case]
|
||||
case = "Services\Api\ProcessMaker\Case"
|
||||
|
||||
[alias: cases]
|
||||
case = "Services\Api\ProcessMaker\Case"
|
||||
input-document = "Services\Api\ProcessMaker\Cases\InputDocument"
|
||||
Reference in New Issue
Block a user