This commit is contained in:
Marco Antonio Nina Mena
2017-12-04 13:25:35 +00:00
committed by Julio Cesar Laura Avendaño
parent abe71a6ffe
commit 0d533e19d9
363 changed files with 23948 additions and 44623 deletions

View File

@@ -6,42 +6,42 @@ $filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_GET = $filter->xssFilterHard($_GET);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
if (! isset ($_SESSION ['USER_LOGGED'])) {
if (! isset($_SESSION ['USER_LOGGED'])) {
$res ['success'] = false;
$res ['error'] = G::LoadTranslation('ID_LOGIN_AGAIN');
$res ['login'] = true;
print G::json_encode ($res);
die ();
print G::json_encode($res);
die();
}
$search = isset($_REQUEST ['search']) ? $_REQUEST ['search'] : null;
if (isset ($_REQUEST ['action']) && isset($_REQUEST['sort']) && isset($_REQUEST['dir'])) {
if (isset($_REQUEST ['action']) && isset($_REQUEST['sort']) && isset($_REQUEST['dir'])) {
sortContent();
}
if (! isset ($_REQUEST ['action'])) {
if (! isset($_REQUEST ['action'])) {
$res ['success'] = false;
$res ['message'] = 'You may request an action';
print G::json_encode ($res);
die ();
print G::json_encode($res);
die();
}
$_REQUEST['action'] = ($_REQUEST['action'] == 'rename') ? 'renameFolder' : $_REQUEST['action'];
if (! function_exists ($_REQUEST['action']) || !G::isUserFunction($_REQUEST['action'])) {
if (! function_exists($_REQUEST['action']) || !G::isUserFunction($_REQUEST['action'])) {
$res ['success'] = false;
$res ['message'] = 'The requested action does not exist';
print G::json_encode ($res);
die ();
print G::json_encode($res);
die();
}
if (($_REQUEST['action']) != 'renameFolder') {
$functionName = $_REQUEST ['action'];
$functionParams = isset ($_REQUEST ['params']) ? $_REQUEST ['params'] : array ();
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
$functionName ($functionParams);
$functionName($functionParams);
} else {
if (!isset($_REQUEST['item']) ||
!isset($_REQUEST['newitemname']) ||
@@ -49,7 +49,7 @@ if (($_REQUEST['action']) != 'renameFolder') {
exit();
}
$functionName = 'renameFolder';
$functionParams = isset ($_REQUEST ['params']) ? $_REQUEST ['params'] : array ();
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
$oldname = $_REQUEST ['item'];
$newname = $_REQUEST ['newitemname'];
$oUid = $_REQUEST ['selitems'];
@@ -60,7 +60,7 @@ if (($_REQUEST['action']) != 'renameFolder') {
$uid = $oUid;
}
renameFolder ($oldname, $newname, $uid);
renameFolder($oldname, $newname, $uid);
}
/////////////////////////////////////////////
@@ -69,7 +69,7 @@ function renameFolder($oldname, $newname, $uid)
{
$folder = new AppFolder();
//Clean Folder name (delete spaces...)
$newname = trim( $newname );
$newname = trim($newname);
$fields = array();
@@ -79,7 +79,7 @@ function renameFolder($oldname, $newname, $uid)
$folder->update($fields);
$msgLabel= G::LoadTranslation ('ID_EDIT_SUCCESSFULLY');
$msgLabel= G::LoadTranslation('ID_EDIT_SUCCESSFULLY');
echo "{action: '', error:'error',message: '$msgLabel', success: 'success',folderUID: 'root'}";
}
@@ -91,26 +91,26 @@ function renameFolder($oldname, $newname, $uid)
**/
function delete()
{
include_once ("classes/model/AppDocument.php");
include_once ("classes/model/AppFolder.php");
include_once("classes/model/AppDocument.php");
include_once("classes/model/AppFolder.php");
switch ($_REQUEST['option']) {
case 'documents':
deleteDocuments($_REQUEST['selitems'], $_REQUEST['option']);
break;
case 'directory':
$oAppFoder = new AppFolder ();
$oAppDocument = new AppDocument ();
$oAppFoder = new AppFolder();
$oAppDocument = new AppDocument();
$aDocuments = $oAppDocument->getDocumentsinFolders($_REQUEST['item']);
if (count($aDocuments) > 0) {
deleteDocuments($aDocuments, $_REQUEST['option']);
}
$oAppFoder->remove($_REQUEST['item'],'');
$oAppFoder->remove($_REQUEST['item'], '');
break;
}
$msgLabel= G::LoadTranslation ('ID_DELETED_SUCCESSFULLY');
$msgLabel= G::LoadTranslation('ID_DELETED_SUCCESSFULLY');
echo "{action: '', error:'error',message: '$msgLabel', success: 'success',folderUID: 'root'}";
}
@@ -123,16 +123,16 @@ function delete()
**/
function deleteDocuments($aDocuments, $opt)
{
include_once ("classes/model/AppDocument.php");
$oAppDocument = new AppDocument ();
include_once("classes/model/AppDocument.php");
$oAppDocument = new AppDocument();
foreach ($aDocuments as $key => $val) {
if ($opt == 'documents') {
list($sFileUID,$docVersion) = explode('_',$val);
list($sFileUID, $docVersion) = explode('_', $val);
} else {
$sFileUID = $val['sAppDocUid'];
$docVersion = $val['iVersion'];
}
$oAppDocument->remove($sFileUID,$docVersion);
$oAppDocument->remove($sFileUID, $docVersion);
}
return true;
}
@@ -247,7 +247,7 @@ function expandNode()
$tempTree ['is_readable'] =true;
$tempTree ['is_deletable'] =true;
if ((isset($_POST['option']) )&& ($_POST['option'] == "gridDocuments")) {
if ((isset($_POST['option']))&& ($_POST['option'] == "gridDocuments")) {
$tempTree ['icon'] = "/images/documents/extension/folder.png";
}
//$tempTree ['leaf'] = true;
@@ -351,7 +351,7 @@ function expandNode()
$tempTree ['appDocComment'] = $tempTree ['qtip'] = $obj['APP_DOC_COMMENT'];
$tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
if (isset($obj['APP_NUMBER'])) {
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)", $obj['APP_NUMBER'], $obj['APP_TITLE'], $obj['STATUS']);
} else {
$tempTree ['appLabel'] = "No case related";
}
@@ -374,7 +374,7 @@ function expandNode()
$tempTree ['deletelabel'] = $obj['DELETE_LABEL'];
if ((isset($obj['DOWNLOAD_LABEL'])) && ($obj['DOWNLOAD_LABEL']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL']));
$labelgen=strtoupper(str_replace(".", "", $obj['DOWNLOAD_LABEL']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL'];
$tempTree ['downloadLink'.$labelgen] = $obj['DOWNLOAD_LINK'];
}
@@ -382,7 +382,7 @@ function expandNode()
$tempTree ['downloadLink'] = $obj['DOWNLOAD_LINK'];
if ((isset($obj['DOWNLOAD_LABEL1'])) && ($obj['DOWNLOAD_LABEL1']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL1']));
$labelgen=strtoupper(str_replace(".", "", $obj['DOWNLOAD_LABEL1']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL1'];
$tempTree ['downloadLink'.$labelgen] = $obj['DOWNLOAD_LINK1'];
}
@@ -575,7 +575,7 @@ function sortContent()
$tempTree ['is_readable'] =true;
$tempTree ['is_deletable'] =true;
if ((isset($_POST['option']) )&& ($_POST['option'] == "gridDocuments")) {
if ((isset($_POST['option']))&& ($_POST['option'] == "gridDocuments")) {
$tempTree ['icon'] = "/images/documents/extension/folder.png";
}
$processListTree [] = $tempTree;
@@ -614,7 +614,7 @@ function sortContent()
$tempTree ['appDocComment'] = $tempTree ['qtip'] = $obj['APP_DOC_COMMENT'];
$tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
if (isset($obj['APP_NUMBER'])) {
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)", $obj['APP_NUMBER'], $obj['APP_TITLE'], $obj['STATUS']);
} else {
$tempTree ['appLabel'] = "No case related";
}
@@ -637,7 +637,7 @@ function sortContent()
$tempTree ['deletelabel'] = $obj['DELETE_LABEL'];
if ((isset($obj['DOWNLOAD_LABEL'])) && ($obj['DOWNLOAD_LABEL']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL']));
$labelgen=strtoupper(str_replace(".", "", $obj['DOWNLOAD_LABEL']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL'];
$tempTree ['downloadLink'.$labelgen] = $obj['DOWNLOAD_LINK'];
}
@@ -645,7 +645,7 @@ function sortContent()
$tempTree ['downloadLink'] = $obj['DOWNLOAD_LINK'];
if ((isset($obj['DOWNLOAD_LABEL1'])) && ($obj['DOWNLOAD_LABEL1']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL1']));
$labelgen=strtoupper(str_replace(".", "", $obj['DOWNLOAD_LABEL1']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL1'];
$tempTree ['downloadLink'.$labelgen] = $obj['DOWNLOAD_LINK1'];
}
@@ -737,15 +737,15 @@ function sortContent()
function openPMFolder()
{
$WIDTH_PANEL = 350;
$folderContent = $oPMFolder->getFolderList ($_POST ['folderID'] != '0' ?
$folderContent = $oPMFolder->getFolderList($_POST ['folderID'] != '0' ?
$_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder);
//krumo($folderContent);
if (! is_array ($folderContent)) {
if (! is_array($folderContent)) {
echo $folderContent;
exit ();
exit();
}
$tree = new PmTree ();
$tree = new PmTree();
$tree->name = 'DMS';
$tree->nodeType = "blank";
@@ -776,7 +776,7 @@ function openPMFolder()
<div id="child_{$obj['FOLDER_UID']}"></div>
GHTML;
$ch = & $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child'));
$ch = $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child'));
$ch->point = ' ';
}
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
@@ -795,64 +795,80 @@ function openPMFolder()
<div id="child_NA"></div>
GHTML;
$ch = & $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child'));
$ch = $tree->addChild($key, $htmlGroup, array('nodeType' => 'child'));
$ch->point = ' ';
}
print ($tree->render ()) ;
print($tree->render()) ;
}
function getPMFolderContent()
{
$swSearch = false;
if (isset ($_POST ['folderID'])) {
if (isset($_POST ['folderID'])) {
//Render content of a folder
$folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder;
$folderContent = $oPMFolder->getFolderContent ($folderID);
$folderContent = $oPMFolder->getFolderContent($folderID);
} else {
// Perform a Search
$swSearch = true;
$folderContent = $oPMFolder->getFolderContent (null, array (), $_POST ['searchKeyword'], $_POST ['type']);
$folderContent = $oPMFolder->getFolderContent(null, array(), $_POST ['searchKeyword'], $_POST ['type']);
}
array_unshift ($folderContent, array ('id' => 'char'));
if (! is_array ($folderContent)) {
array_unshift($folderContent, array('id' => 'char'));
if (! is_array($folderContent)) {
echo $folderContent;
exit ();
exit();
}
$_DBArray ['PM_FOLDER_DOC'] = $folderContent;
$_SESSION ['_DBArray'] = $_DBArray;
$c = new Criteria ('dbarray');
$c->setDBArrayTable ('PM_FOLDER_DOC');
$c->addAscendingOrderByColumn ('id');
$G_PUBLISH = new Publisher ();
$c = new Criteria('dbarray');
$c->setDBArrayTable('PM_FOLDER_DOC');
$c->addAscendingOrderByColumn('id');
$G_PUBLISH = new Publisher();
$labelFolderAddFile = "";
$labelFolderAddFolder = "";
if ($RBAC->userCanAccess ('PM_FOLDERS_ADD_FILE') == 1) {
$labelFolderAddFile = G::LoadTranslation ('ID_ATTACH');
if ($RBAC->userCanAccess('PM_FOLDERS_ADD_FILE') == 1) {
$labelFolderAddFile = G::LoadTranslation('ID_ATTACH');
}
if ($RBAC->userCanAccess ('PM_FOLDERS_ADD_FOLDER') == 1) {
$labelFolderAddFolder = G::LoadTranslation ('ID_NEW_FOLDER');
if ($RBAC->userCanAccess('PM_FOLDERS_ADD_FOLDER') == 1) {
$labelFolderAddFolder = G::LoadTranslation('ID_NEW_FOLDER');
}
if (! $swSearch) {
$G_PUBLISH->AddContent ('propeltable', 'paged-table', 'appFolder/appFolderDocumentList',
$c, array ('folderID' => $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ?
$G_PUBLISH->AddContent(
'propeltable',
'paged-table',
'appFolder/appFolderDocumentList',
$c,
array('folderID' => $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ?
"/" : $_POST ['folderID'] : $rootFolder, 'labelFolderAddFile' => $labelFolderAddFile,
'labelFolderAddFolder' => $labelFolderAddFolder));
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentListHeader', '',
array (), 'appFolderList?folderID=' . $_POST ['folderID']);
'labelFolderAddFolder' => $labelFolderAddFolder)
);
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'appFolder/appFolderDocumentListHeader',
'',
array(),
'appFolderList?folderID=' . $_POST ['folderID']
);
} else {
$G_PUBLISH->AddContent ('propeltable', 'paged-table', 'appFolder/appFolderDocumentListSearch', $c, array ());
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentListHeader', '', array (),
'appFolderList?folderID=/');
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'appFolder/appFolderDocumentListSearch', $c, array());
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'appFolder/appFolderDocumentListHeader',
'',
array(),
'appFolderList?folderID=/'
);
}
G::RenderPage ('publish', 'raw');
G::RenderPage('publish', 'raw');
}
function getPMFolderTags()
@@ -863,12 +879,12 @@ function getPMFolderTags()
$rootFolder = "/";
$folderID = $_POST ['rootFolder'] != '0' ? $_POST ['rootFolder'] == 'NA' ? "" : $_POST ['rootFolder'] : $rootFolder;
$tags = $oPMFolder->getFolderTags ($folderID);
$tags = $oPMFolder->getFolderTags($folderID);
$minimum_count = 0;
$maximum_count = 0;
if ((is_array ($tags)) && (count ($tags) > 0)) {
$minimum_count = min (array_values ($tags));
$maximum_count = max (array_values ($tags));
if ((is_array($tags)) && (count($tags) > 0)) {
$minimum_count = min(array_values($tags));
$maximum_count = max(array_values($tags));
}
$spread = $maximum_count - $minimum_count;
@@ -877,19 +893,18 @@ function getPMFolderTags()
}
$cloud_html = '';
$cloud_tags = array (); // create an array to hold tag code
$cloud_tags = array(); // create an array to hold tag code
foreach ($tags as $tag => $count) {
$href = "#";
//$href="?q="$tag;
$size = $min_font_size + ($count - $minimum_count) * ($max_font_size - $min_font_size) / $spread;
$cloud_tags [] = '<a style="font-size: ' . floor ($size) . 'px' . '" class="tag_cloud" href="' . $href .
$cloud_tags [] = '<a style="font-size: ' . floor($size) . 'px' . '" class="tag_cloud" href="' . $href .
'" onClick="getPMFolderSearchResult(\'' . $tag . '\',\'TAG\')"' . ' title="\'' . $tag .
'\' returned a count of ' . $count . '">' . htmlspecialchars (stripslashes ($tag)) . '</a>';
'\' returned a count of ' . $count . '">' . htmlspecialchars(stripslashes($tag)) . '</a>';
}
$cloud_html = join ("\n", $cloud_tags) . "\n";
$cloud_html = join("\n", $cloud_tags) . "\n";
print "$cloud_html";
}
function uploadDocument()
@@ -1113,11 +1128,11 @@ function uploadDocument()
// $uploadDocumentComponent["items"][]=$itemA;
$finalResponse=G::json_encode($uploadDocumentComponent);
$finalResponse=str_replace("URL_SCRIPT","../appFolder/appFolderAjax.php",$finalResponse);
$finalResponse=str_replace("URL_SCRIPT", "../appFolder/appFolderAjax.php", $finalResponse);
foreach ($functionsToReplace as $key => $originalFunction) {
$finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse);
$finalResponse=str_replace('"'.$key.'"', $originalFunction, $finalResponse);
}
echo ($finalResponse);
echo($finalResponse);
}
function copyAction()
{
@@ -1130,21 +1145,21 @@ function moveAction()
function findChilds($uidFolder, $path, $arrayPath)
{
$Criteria = new Criteria ();
$Criteria->addSelectColumn ( AppFolderPeer::FOLDER_UID );
$Criteria->addSelectColumn ( AppFolderPeer::FOLDER_PARENT_UID );
$Criteria->addSelectColumn ( AppFolderPeer::FOLDER_NAME );
$Criteria->addSelectColumn ( AppFolderPeer::FOLDER_CREATE_DATE );
$Criteria->addSelectColumn ( AppFolderPeer::FOLDER_UPDATE_DATE );
$Criteria = new Criteria();
$Criteria->addSelectColumn(AppFolderPeer::FOLDER_UID);
$Criteria->addSelectColumn(AppFolderPeer::FOLDER_PARENT_UID);
$Criteria->addSelectColumn(AppFolderPeer::FOLDER_NAME);
$Criteria->addSelectColumn(AppFolderPeer::FOLDER_CREATE_DATE);
$Criteria->addSelectColumn(AppFolderPeer::FOLDER_UPDATE_DATE);
$Criteria->add(AppFolderPeer::FOLDER_PARENT_UID, $uidFolder);
$Criteria->addAscendingOrderByColumn(AppFolderPeer::FOLDER_NAME);
$rs = appFolderPeer::doSelectRS ( $Criteria );
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
$rs = appFolderPeer::doSelectRS($Criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$folderResult = array ();
$appFoder = new AppFolder ();
$folderResult = array();
$appFoder = new AppFolder();
while ($rs->next()) {
$row = $rs->getRow();
$path = ($uidFolder != '/')? $path : '';
@@ -1156,7 +1171,7 @@ function findChilds($uidFolder, $path, $arrayPath)
}
function copyMoveAction($type)
{
$oPMFolder = new AppFolder ();
$oPMFolder = new AppFolder();
$dir=$_REQUEST['dir'];
$paths = array();
@@ -1165,7 +1180,7 @@ function copyMoveAction($type)
$folderSelected = $oPMFolder->load($dir);
$root = array("/","/");
array_unshift ($folderResult, $root);
array_unshift($folderResult, $root);
$folderResultSel = array();
foreach ($folderResult as $key => $value) {
$count = strlen($value[1]);
@@ -1286,10 +1301,10 @@ function copyMoveAction($type)
$finalResponse=G::json_encode($copyDialog);
foreach ($functionsToReplace as $key => $originalFunction) {
$finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse);
$finalResponse=str_replace('"'.$key.'"', $originalFunction, $finalResponse);
}
$finalResponse=str_replace("URL_SCRIPT","../appFolder/appFolderAjax.php",$finalResponse);
echo ($finalResponse);
$finalResponse=str_replace("URL_SCRIPT", "../appFolder/appFolderAjax.php", $finalResponse);
echo($finalResponse);
}
function copyExecute()
@@ -1310,27 +1325,32 @@ function copyMoveExecute($type)
function documentVersionHistory()
{
$folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder;
$folderContent = $oPMFolder->getFolderContent ($folderID, array ($_POST ['appDocId']));
$folderContent = $oPMFolder->getFolderContent($folderID, array($_POST ['appDocId']));
array_unshift ($folderContent, array ('id' => 'char'));
if (! is_array ($folderContent)) {
array_unshift($folderContent, array('id' => 'char'));
if (! is_array($folderContent)) {
echo $folderContent;
exit ();
exit();
}
$_DBArray ['PM_FOLDER_DOC_HISTORY'] = $folderContent;
$_SESSION ['_DBArray'] = $_DBArray;
$c = new Criteria ('dbarray');
$c->setDBArrayTable ('PM_FOLDER_DOC_HISTORY');
$c->addAscendingOrderByColumn ('id');
$G_PUBLISH = new Publisher ();
$c = new Criteria('dbarray');
$c->setDBArrayTable('PM_FOLDER_DOC_HISTORY');
$c->addAscendingOrderByColumn('id');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent ('propeltable', 'paged-table', 'appFolder/appFolderDocumentListHistory', $c,
array ('folderID' => $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ?
"/" : $_POST ['folderID'] : $rootFolder));
$G_PUBLISH->AddContent(
'propeltable',
'paged-table',
'appFolder/appFolderDocumentListHistory',
$c,
array('folderID' => $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ?
"/" : $_POST ['folderID'] : $rootFolder)
);
G::RenderPage ('publish', 'raw');
G::RenderPage('publish', 'raw');
}
function overwriteFile($node, $fileName)
@@ -1340,7 +1360,7 @@ function overwriteFile($node, $fileName)
$appDocument = new AppDocument();
$pMFolder = new AppFolder();
$user = ($RBAC->userCanAccess('PM_ALLCASES') == 1) ? '' : $_SESSION['USER_LOGGED'];
$folderContentObj = $pMFolder->getFolderContent ($node, array(), null, null, '', '', $user);
$folderContentObj = $pMFolder->getFolderContent($node, array(), null, null, '', '', $user);
foreach ($folderContentObj['documents'] as $key => $value) {
if ($folderContentObj['documents'][$key]['APP_DOC_FILENAME'] == $fileName) {
$appDocument->remove(trim($folderContentObj['documents'][$key]['APP_DOC_UID']), $folderContentObj['documents'][$key]['DOC_VERSION']);
@@ -1351,7 +1371,7 @@ function overwriteFile($node, $fileName)
function copyMoveExecuteTree($uidFolder, $newUidFolder)
{
$appFoder = new AppFolder ();
$appFoder = new AppFolder();
$folderContent = $appFoder->getFolderContent($uidFolder);
$folderOrigin = $appFoder->getFolderStructure($uidFolder);
@@ -1361,15 +1381,15 @@ function copyMoveExecuteTree($uidFolder, $newUidFolder)
$FolderParentUid = trim($newUidFolder);//$form['FOLDER_PARENT_UID'];
$FolderName = $folderOrigin[$uidFolder]['NAME'];
$newFolderContent = $appFoder->createFolder ($FolderName, $FolderParentUid, "new");
$newFolderContent = $appFoder->createFolder($FolderName, $FolderParentUid, "new");
$appDocument = new AppDocument();
if ($_REQUEST['action'] == 'moveExecute') {
$appFoder->remove($uidFolder,$folderOrigin[$uidFolder]['PARENT']);
$appFoder->remove($uidFolder, $folderOrigin[$uidFolder]['PARENT']);
}
$action = $_REQUEST['action'];
foreach ($folderContent['documents'] as $keys => $value) {
$docInfo = $appDocument->load($value['APP_DOC_UID'],$value['DOC_VERSION']);
$docInfo = $appDocument->load($value['APP_DOC_UID'], $value['DOC_VERSION']);
$docInfo['FOLDER_UID'] = $newFolderContent['folderUID'];
$docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
$docInfo['APP_DOC_STATUS'] = 'ACTIVE';
@@ -1391,8 +1411,8 @@ function copyMoveExecuteTree($uidFolder, $newUidFolder)
$arrayPathFromFile = G::getPathFromFileUID($docInfo["APP_UID"], $docUid);
$newFile = $arrayPathFromFile[0] . PATH_SEP . $arrayPathFromFile[1] . "_" . $docInfo["DOC_VERSION"] . "." . $extension;
if(!file_exists($path . $arrayPathFromFile[0])) {
mkdir( $path . $arrayPathFromFile[0], 0777, true );
if (!file_exists($path . $arrayPathFromFile[0])) {
mkdir($path . $arrayPathFromFile[0], 0777, true);
}
copy($path . $originFile, $path . $newFile);
@@ -1403,9 +1423,9 @@ function copyMoveExecuteTree($uidFolder, $newUidFolder)
return $newFolderContent['folderUID'];
}
function checkTree ($uidOriginFolder, $uidNewFolder)
function checkTree($uidOriginFolder, $uidNewFolder)
{
$appFoder = new AppFolder ();
$appFoder = new AppFolder();
$newFoldercontent = copyMoveExecuteTree($uidOriginFolder, $uidNewFolder);
$listfolder = $appFoder->getFolderList($uidOriginFolder);
@@ -1490,7 +1510,7 @@ function uploadExternalDocument()
$oAppDocument = new AppDocument();
if (isset($_POST['selitems']) && is_array($_POST['selitems'])) {
foreach ($_POST['selitems'] as $docId) {
$arrayDocId = explode ('_',$docId);
$arrayDocId = explode('_', $docId);
$docInfo=$oAppDocument->load($arrayDocId[0]);
$docInfo['FOLDER_UID'] = $_POST['new_dir'];
$docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
@@ -1539,9 +1559,9 @@ function uploadExternalDocument()
$oFolder=new AppFolder();
if ($docUid!=-1) {
//krumo("jhl");
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'],$appId);
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId);
//Tags
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'],$appId);
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'], $appId);
} else {
$folderId=$folderId;
$fileTags="EXTERNAL";
@@ -1624,9 +1644,9 @@ function uploadExternalDocument()
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (
$documentData = new uploadDocumentData(
$appId,
$_SESSION['USER_LOGGED'],
$sPathName . $sFileName,
@@ -1666,7 +1686,7 @@ function uploadExternalDocument()
function newFolder()
{
$oPMFolder = new AppFolder ();
$oPMFolder = new AppFolder();
//G::pr($_POST);
if ($_POST ['dir']=="") {
$_POST ['dir']="/";
@@ -1674,11 +1694,11 @@ function newFolder()
if ($_POST ['dir']=="root") {
$_POST ['dir']="/";
}
$folderStructure = $oPMFolder->getFolderStructure ($_POST ['dir']);
$folderStructure = $oPMFolder->getFolderStructure($_POST ['dir']);
//G::pr($folderStructure);
$folderPath = $folderStructure ['PATH'];
$parentUid = $_POST ['dir'];
$folderUid = G::GenerateUniqueID ();
$folderUid = G::GenerateUniqueID();
$formNewFolder=array();
@@ -1774,15 +1794,14 @@ function newFolder()
$response=G::json_encode($formNewFolder);
//This will add the functions to the Json response without quotes!
$response=str_replace('"handlerCreate"',$handlerCreate,$response);
$response=str_replace('"handlerCancel"',$handlerCancel,$response);
$response=str_replace('"handlerCreate"', $handlerCreate, $response);
$response=str_replace('"handlerCancel"', $handlerCancel, $response);
print_r($response);
}
function appFolderSave()
{
$oPMFolder = new AppFolder ();
$oPMFolder = new AppFolder();
$form = $_POST['form'];
$FolderUid = $form['FOLDER_UID'];
$FolderParentUid = $form['FOLDER_PARENT_UID'];
@@ -1793,29 +1812,34 @@ function appFolderSave()
$response['error']="error";
$response['message']="error";
$response['success']=false;
$folderCreateResponse = $oPMFolder->createFolder ($FolderName, $FolderParentUid, "new");
$folderCreateResponse = $oPMFolder->createFolder($FolderName, $FolderParentUid, "new");
$response=array_merge($response,$folderCreateResponse);
$response=array_merge($response, $folderCreateResponse);
print_r(G::json_encode($response));
}
function documentInfo()
{
$oFolder = new AppFolder ();
$Fields = $oPMFolder->getCompleteDocumentInfo ($_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'],
$_POST ['docID'], $_POST ['usrUid']);
$G_PUBLISH = new Publisher ();
$oFolder = new AppFolder();
$Fields = $oPMFolder->getCompleteDocumentInfo(
$_POST ['appId'],
$_POST ['appDocId'],
$_POST ['docVersion'],
$_POST ['docID'],
$_POST ['usrUid']
);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentInfo', '', $Fields, '');
G::RenderPage ('publish', 'raw');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'appFolder/appFolderDocumentInfo', '', $Fields, '');
G::RenderPage('publish', 'raw');
}
function documentdelete()
{
include_once ("classes/model/AppDocument.php");
$oAppDocument = new AppDocument ();
$oAppDocument->remove($_POST['sFileUID'],$_POST['docVersion']);
include_once("classes/model/AppDocument.php");
$oAppDocument = new AppDocument();
$oAppDocument->remove($_POST['sFileUID'], $_POST['docVersion']);
/*we need to delete fisicaly the file use the follow code
$appId= "00000000000000000000000000000000";
$sPathName = PATH_DOCUMENT . $appId . PATH_SEP;
@@ -1824,16 +1848,15 @@ function documentdelete()
function deletePMFolder()
{
include_once ("classes/model/AppFolder.php");
$oAppFoder = new AppFolder ();
$oAppFoder->remove($_POST['sFileUID'],$_POST['rootfolder']);
include_once("classes/model/AppFolder.php");
$oAppFoder = new AppFolder();
$oAppFoder->remove($_POST['sFileUID'], $_POST['rootfolder']);
}
function getMime($fileName)
{
$fileName=basename($fileName);
$fileNameA=explode(".",$fileName);
$fileNameA=explode(".", $fileName);
$return['description']=G::LoadTranslation("MIME_DES_FILE");
$return['icon']="/images/documents/extension/document.png";
if (count($fileNameA)>1) {
@@ -1915,7 +1938,7 @@ function extPathName($p_path, $p_addtrailingslash = false)
}
// Check if UNC path
$unc = substr($retval,0,2) == '\\\\' ? 1 : 0;
$unc = substr($retval, 0, 2) == '\\\\' ? 1 : 0;
// Remove double \\
$retval = str_replace('\\\\', '\\', $retval);
@@ -1933,10 +1956,10 @@ function extPathName($p_path, $p_addtrailingslash = false)
}
// Check if UNC path
$unc = substr($retval,0,2) == '//' ? 1 : 0;
$unc = substr($retval, 0, 2) == '//' ? 1 : 0;
// Remove double //
$retval = str_replace('//','/',$retval);
$retval = str_replace('//', '/', $retval);
// If UNC path, we have to add one / in front or everything breaks!
if ($unc == 1) {