BUG 8764 Al exportar procesos con nombres largos, no se visualiza to... SOLVED
- Al revisar la forma de exportacion se vio que para poder guardar un archivo el maximo del path mas el nombre del archivo no deberia de sobrepasar los 256 caracteres. - Se realizo la validacion para truncar el nombre del archivo cuando se llegue al limite, para ambos archivos .pm y .xpdl.
This commit is contained in:
@@ -2378,8 +2378,12 @@ class Processes {
|
||||
}
|
||||
$proTitle = (substr(G::inflect($data->process['PRO_TITLE']), 0, 245));
|
||||
$proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle);
|
||||
|
||||
|
||||
//Calculating the maximum length of file name
|
||||
$pathLength = strlen(PATH_DATA ."sites".PATH_SEP.SYS_SYS.PATH_SEP."files".PATH_SEP."output".PATH_SEP);
|
||||
$length = strlen($proTitle) + $pathLength;
|
||||
if ($length >= 250) {
|
||||
$proTitle = myTruncate($proTitle, 250 - $pathLength, '_', '');
|
||||
}
|
||||
$index = '';
|
||||
|
||||
$lastIndex = '';
|
||||
|
||||
@@ -323,6 +323,12 @@ class Xpdl extends processes
|
||||
}
|
||||
$proTitle = (substr(G::inflect($oData->process['PRO_TITLE']), 0, 245));
|
||||
$proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle);
|
||||
//Calculating the maximum length of file name
|
||||
$pathLength = strlen(PATH_DATA ."sites".PATH_SEP.SYS_SYS.PATH_SEP."files".PATH_SEP."output".PATH_SEP);
|
||||
$length = strlen($proTitle) + $pathLength;
|
||||
if ($length >= 250) {
|
||||
$proTitle = myTruncate($proTitle, 250 - $pathLength, '_', '');
|
||||
}
|
||||
$index = '';
|
||||
$lastIndex = '';
|
||||
do {
|
||||
|
||||
@@ -27,55 +27,72 @@
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
|
||||
try {
|
||||
function myTruncate($cadena,$limit, $break='.', $pad='...') {
|
||||
if (strlen($cadena) <= $limit) {
|
||||
return $cadena;
|
||||
}
|
||||
$breakpoint = strpos($cadena, $break, $limit);
|
||||
if (false !== $breakpoint) {
|
||||
$len =strlen($cadena) - 1;
|
||||
if ($breakpoint < $len) {
|
||||
$cadena = substr($cadena, 0, $breakpoint) . $pad;
|
||||
function myTruncate($chain, $limit, $break='.', $pad='...') {
|
||||
if (strlen($chain) <= $limit) {
|
||||
return $chain;
|
||||
}
|
||||
$breakpoint = strpos($chain, $break, $limit);
|
||||
if (false !== $breakpoint) {
|
||||
$len =strlen($chain) - 1;
|
||||
if ($breakpoint < $len) {
|
||||
$chain = substr($chain, 0, $breakpoint) . $pad;
|
||||
}
|
||||
}
|
||||
return $chain;
|
||||
}
|
||||
return $cadena;
|
||||
}
|
||||
function addTitlle($Category, $Id, $Lang) {
|
||||
require_once 'classes/model/Content.php';
|
||||
$content = new Content();
|
||||
$value = $content->load($Category,'', $Id, $Lang);
|
||||
return $value;
|
||||
}
|
||||
|
||||
function addTitlle($Category, $Id, $Lang) {
|
||||
require_once 'classes/model/Content.php';
|
||||
$content = new Content();
|
||||
$value = $content->load($Category,'', $Id, $Lang);
|
||||
return $value;
|
||||
}
|
||||
|
||||
$oJSON = new Services_JSON();
|
||||
$stdObj = $oJSON->decode( $_POST['data'] );
|
||||
if ( isset ($stdObj->pro_uid ) )
|
||||
$sProUid = $stdObj->pro_uid;
|
||||
else
|
||||
throw ( new Exception ( 'the process uid is not defined!.' ) );
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass('processes');
|
||||
G::LoadClass('xpdl');
|
||||
$oProcess = new Processes();
|
||||
$oXpdl = new Xpdl();
|
||||
$proFields = $oProcess->serializeProcess( $sProUid );
|
||||
$Fields = $oProcess->saveSerializedProcess ( $proFields );
|
||||
$xpdlFields = $oXpdl->xmdlProcess($sProUid);
|
||||
$Fields['FILENAMEXPDL'] = $xpdlFields['FILENAMEXPDL'];
|
||||
$Fields['FILENAME_LINKXPDL'] = $xpdlFields['FILENAME_LINKXPDL'];
|
||||
$pathLength = strlen(PATH_DATA ."sites".PATH_SEP.SYS_SYS.PATH_SEP."files".PATH_SEP."output".PATH_SEP);
|
||||
$length = strlen($Fields['PRO_TITLE']) + $pathLength;
|
||||
|
||||
/* Includes */
|
||||
G::LoadClass('processes');
|
||||
G::LoadClass('xpdl');
|
||||
$oProcess = new Processes();
|
||||
$oXpdl = new Xpdl();
|
||||
$proFields = $oProcess->serializeProcess( $sProUid );
|
||||
$Fields = $oProcess->saveSerializedProcess ( $proFields );
|
||||
$xpdlFields = $oXpdl->xmdlProcess($sProUid);
|
||||
$Fields['FILENAMEXPDL'] = $xpdlFields['FILENAMEXPDL'];
|
||||
$Fields['FILENAME_LINKXPDL'] = $xpdlFields['FILENAME_LINKXPDL'];
|
||||
foreach($Fields as $key => $value)
|
||||
{
|
||||
foreach($Fields as $key => $value)
|
||||
{
|
||||
if ($key == 'PRO_TITLE') {
|
||||
$Fields[$key] = myTruncate($value, 65, ' ', '...');
|
||||
}
|
||||
if ($key == 'FILENAME') {
|
||||
$Fields[$key] = myTruncate($value, 60, '_', '...');
|
||||
$Fields[$key] = myTruncate($value, 60, '_', '...pm');
|
||||
}
|
||||
if ($key == 'FILENAMEXPDL') {
|
||||
$Fields[$key] = myTruncate($value, 60, '_', '...');
|
||||
$Fields[$key] = myTruncate($value, 60, '_', '...xpdl');
|
||||
}
|
||||
}
|
||||
if (($length) >= 250) {
|
||||
if ($key == 'FILENAME_LINK') {
|
||||
list($file,$rest) = explode ('p=',$value);
|
||||
list($filenameLink,$rest) = explode ('&',$rest);
|
||||
$Fields[$key] = myTruncate($filenameLink, 250 - $pathLength, '_', '');
|
||||
$Fields[$key] = $file."p=".$Fields[$key].'&'.$rest;
|
||||
}
|
||||
if ($key == 'FILENAME_LINKXPDL') {
|
||||
list($file,$rest) = explode ('p=',$value);
|
||||
list($filenameLinkXpdl,$rest) = explode ('&',$rest);
|
||||
$Fields[$key] = myTruncate($filenameLinkXpdl, 250 - $pathLength , '_', '');
|
||||
$Fields[$key] = $file."p=".$Fields[$key].'&'.$rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Render page */
|
||||
$G_PUBLISH = new Publisher;
|
||||
@@ -85,7 +102,7 @@ foreach($Fields as $key => $value)
|
||||
}
|
||||
catch ( Exception $e ){
|
||||
$G_PUBLISH = new Publisher;
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$aMessage['MESSAGE'] = $e->getMessage();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
G::RenderPage('publish', 'raw' );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user