Merged in qronald/processmaker (pull request #1698)
Fix in endpoint location, download base64 and streaming file
This commit is contained in:
@@ -24,8 +24,8 @@ if ($actionAjax == "streaming") {
|
|||||||
|
|
||||||
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
||||||
|
|
||||||
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||||
$realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext;
|
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||||
|
|
||||||
if (file_exists( $realPath )) {
|
if (file_exists( $realPath )) {
|
||||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
|
|||||||
@@ -403,8 +403,8 @@ class Light
|
|||||||
//$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
//$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
||||||
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
||||||
|
|
||||||
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||||
$realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext;
|
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||||
|
|
||||||
$width = isset($fileData['width']) ? $fileData['width']:null;
|
$width = isset($fileData['width']) ? $fileData['width']:null;
|
||||||
$height = isset($fileData['height']) ? $fileData['height']:null;
|
$height = isset($fileData['height']) ? $fileData['height']:null;
|
||||||
@@ -604,8 +604,9 @@ class Light
|
|||||||
*/
|
*/
|
||||||
public function getInformation($userUid, $type, $app_uid)
|
public function getInformation($userUid, $type, $app_uid)
|
||||||
{
|
{
|
||||||
//$response = array();
|
$response = array();
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case 'unassigned':
|
||||||
case 'paused':
|
case 'paused':
|
||||||
case 'participated':
|
case 'participated':
|
||||||
$oCase = new \Cases();
|
$oCase = new \Cases();
|
||||||
|
|||||||
@@ -611,52 +611,18 @@ class Light extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url POST /case/:app_uid/input-document
|
* @url POST /case/:app_uid/upload/location
|
||||||
*
|
*
|
||||||
* @param string $app_uid { @min 32}{@max 32}
|
* @param string $app_uid { @min 32}{@max 32}
|
||||||
* @param string $tas_uid {@min 32}{@max 32}
|
* @param float $latitude {@min -90}{@max 90}
|
||||||
* @param string $app_doc_comment
|
|
||||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
|
||||||
*/
|
|
||||||
public function doPostInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$userUid = $this->getUserId();
|
|
||||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
|
||||||
$file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid);
|
|
||||||
$response = $this->parserInputDocument($file);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
|
||||||
}
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function parserInputDocument ($data)
|
|
||||||
{
|
|
||||||
$structure = array(
|
|
||||||
'app_doc_uid' => 'fileId',
|
|
||||||
'app_doc_filename' => 'fileName',
|
|
||||||
'app_doc_version' => 'version'
|
|
||||||
);
|
|
||||||
$response = $this->replaceFields($data, $structure);
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @url POST /case/:app_uid/input-document/location
|
|
||||||
*
|
|
||||||
* @param string $app_uid { @min 32}{@max 32}
|
|
||||||
* @param string $tas_uid {@min 32}{@max 32}
|
|
||||||
* @param string $app_doc_comment
|
|
||||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
|
||||||
* @param float $latitude {@min -90}{@max 90}
|
|
||||||
* @param float $longitude {@min -180}{@max 180}
|
* @param float $longitude {@min -180}{@max 180}
|
||||||
*/
|
*/
|
||||||
public function postInputDocumentLocation($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $latitude, $longitude)
|
public function postInputDocumentLocation($app_uid, $latitude, $longitude)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||||
|
|
||||||
$url = "http://maps.googleapis.com/maps/api/staticmap?center=".$latitude.','.$longitude."&format=jpg&size=600x600&zoom=15&markers=color:blue%7Clabel:S%7C".$latitude.','.$longitude;
|
$url = "http://maps.googleapis.com/maps/api/staticmap?center=".$latitude.','.$longitude."&format=jpg&size=600x600&zoom=15&markers=color:blue%7Clabel:S%7C".$latitude.','.$longitude;
|
||||||
$imageLocation = imagecreatefromjpeg($url);
|
$imageLocation = imagecreatefromjpeg($url);
|
||||||
$tmpfname = tempnam("php://temp","pmm");
|
$tmpfname = tempnam("php://temp","pmm");
|
||||||
@@ -668,17 +634,21 @@ class Light extends Api
|
|||||||
$_FILES["form"]["error"] = 0;
|
$_FILES["form"]["error"] = 0;
|
||||||
$sizes = getimagesize($tmpfname);
|
$sizes = getimagesize($tmpfname);
|
||||||
$_FILES["form"]["size"] = ($sizes['0'] * $sizes['1']);
|
$_FILES["form"]["size"] = ($sizes['0'] * $sizes['1']);
|
||||||
$file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid);
|
|
||||||
|
$request_data = array(array('name' => $_FILES["form"]["name"]));
|
||||||
|
$file = $oMobile->postUidUploadFiles($userUid, $app_uid, $request_data);
|
||||||
|
|
||||||
$strPathName = PATH_DOCUMENT . G::getPathFromUID($app_uid) . PATH_SEP;
|
$strPathName = PATH_DOCUMENT . G::getPathFromUID($app_uid) . PATH_SEP;
|
||||||
$strFileName = $file->app_doc_uid . "_" . $file->app_doc_version . ".jpg";
|
$strFileName = $file[0]['appDocUid'] . "_" . $file[0]['docVersion'] . ".jpg";
|
||||||
copy($tmpfname, $strPathName . "/" . $strFileName);
|
if (! is_dir( $strPathName )) {
|
||||||
$response = $this->parserInputDocument($file);
|
G::verifyPath( $strPathName, true );
|
||||||
|
}
|
||||||
|
copy($tmpfname, $strPathName . $strFileName);
|
||||||
unlink($tmpfname);
|
unlink($tmpfname);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
return $response;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user