CODE STYLE

- workflow/engine/menus/cases.php
- workflow/engine/methods/appFolder/appFolderAjax.php
This commit is contained in:
Marco Antonio Nina
2012-07-19 17:13:59 -04:00
parent 3e22cd5c25
commit fb83aef89b
2 changed files with 1530 additions and 1505 deletions

View File

@@ -26,14 +26,18 @@ global $RBAC;
global $G_TMP_MENU; global $G_TMP_MENU;
$G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader');
$G_TMP_MENU->AddIdRawOption('CASES_START_CASE', 'casesStartPage?action=startCase', G::LoadTranslation('ID_NEW_CASE'), '' ); $G_TMP_MENU->AddIdRawOption('CASES_START_CASE', 'casesStartPage?action=startCase',
$G_TMP_MENU->AddIdRawOption('CASES_INBOX', 'casesListExtJs?action=todo', G::LoadTranslation('ID_INBOX'), 'icon-cases-inbox.png' ); G::LoadTranslation('ID_NEW_CASE'), '');
$G_TMP_MENU->AddIdRawOption('CASES_DRAFT', 'casesListExtJs?action=draft', G::LoadTranslation('ID_DRAFT'), 'mail-mark-task.png' ); $G_TMP_MENU->AddIdRawOption('CASES_INBOX', 'casesListExtJs?action=todo', G::LoadTranslation('ID_INBOX'),
$G_TMP_MENU->AddIdRawOption('CASES_SENT', 'casesListExtJs?action=sent', G::LoadTranslation('ID_SENT'), 'icon-cases-outbox.png'); 'icon-cases-inbox.png');
$G_TMP_MENU->AddIdRawOption('CASES_SELFSERVICE', 'casesListExtJs?action=selfservice',G::LoadTranslation('ID_UNASSIGNED'), 'rotate_cw.png' ); $G_TMP_MENU->AddIdRawOption('CASES_DRAFT', 'casesListExtJs?action=draft', G::LoadTranslation('ID_DRAFT'),
$G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'), 'mail-queue.png' ); 'mail-mark-task.png' );
//$G_TMP_MENU->AddIdRawOption('CASES_CANCELLED', 'casesListExtJs?action=cancelled', G::LoadTranslation('ID_CANCELLED'), 'edit-clear-list.png' ); $G_TMP_MENU->AddIdRawOption('CASES_SENT', 'casesListExtJs?action=sent', G::LoadTranslation('ID_SENT'),
//$G_TMP_MENU->AddIdRawOption('CASES_FOLDERS1', '../appFolder/appFolderList', G::LoadTranslation('ID_FOLDERS'), 'folderV2.gif' ); 'icon-cases-outbox.png');
$G_TMP_MENU->AddIdRawOption('CASES_SELFSERVICE', 'casesListExtJs?action=selfservice',
G::LoadTranslation('ID_UNASSIGNED'),'rotate_cw.png');
$G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'),
'mail-queue.png');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) { if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
//$G_TMP_MENU->AddIdRawOption('CASES_GRAL', 'casesListExtJs?action=gral', G::LoadTranslation('ID_GENERAL')); //$G_TMP_MENU->AddIdRawOption('CASES_GRAL', 'casesListExtJs?action=gral', G::LoadTranslation('ID_GENERAL'));
@@ -42,29 +46,36 @@ if ( $RBAC->userCanAccess('PM_ALLCASES') == 1 ) {
$G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) { if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
$G_TMP_MENU->AddIdRawOption('CASES_SEARCH', 'casesListExtJs?action=search', G::LoadTranslation('ID_ADVANCEDSEARCH'), 'system-search.png' ); $G_TMP_MENU->AddIdRawOption('CASES_SEARCH', 'casesListExtJs?action=search',
G::LoadTranslation('ID_ADVANCEDSEARCH'), 'system-search.png' );
} }
$G_TMP_MENU->AddIdRawOption('ADMIN', '', G::LoadTranslation('ID_CASES_MENU_ADMIN'), '', '', 'blockHeader'); $G_TMP_MENU->AddIdRawOption('ADMIN', '', G::LoadTranslation('ID_CASES_MENU_ADMIN'), '', '', 'blockHeader');
if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) { if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
//$G_TMP_MENU->AddIdRawOption('CASES_TO_REVISE_NORMAL', 'cases_List?l=to_revise', G::LoadTranslation('ID_TO_REVISE'), 'document-review.png' ); //$G_TMP_MENU->AddIdRawOption('CASES_TO_REVISE_NORMAL', 'cases_List?l=to_revise',
$G_TMP_MENU->AddIdRawOption('CASES_TO_REVISE', 'casesListExtJs?action=to_revise', G::LoadTranslation('ID_TO_REVISE'), 'document-review.png' ); //G::LoadTranslation('ID_TO_REVISE'), 'document-review.png' );
$G_TMP_MENU->AddIdRawOption('CASES_TO_REVISE', 'casesListExtJs?action=to_revise',
G::LoadTranslation('ID_TO_REVISE'), 'document-review.png');
//$G_TMP_MENU->AddIdRawOption('CASES_SCHEDULER','cases_Scheduler_List',G::LoadTranslation('ID_SCHEDULER_LIST')); //$G_TMP_MENU->AddIdRawOption('CASES_SCHEDULER','cases_Scheduler_List',G::LoadTranslation('ID_SCHEDULER_LIST'));
//$G_TMP_MENU->AddIdRawOption('CASES_SCHEDULER_LOG','cases_Scheduler_Log',G::LoadTranslation('ID_SCHEDULER_LOG')); //$G_TMP_MENU->AddIdRawOption('CASES_SCHEDULER_LOG','cases_Scheduler_Log',G::LoadTranslation('ID_SCHEDULER_LOG'));
} }
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) { if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
//$G_TMP_MENU->AddIdRawOption('CASES_TO_REASSIGN_NORMAL', 'cases_List?l=to_reassign', G::LoadTranslation('ID_TO_REASSIGN'), 'reassing.png' ); //$G_TMP_MENU->AddIdRawOption('CASES_TO_REASSIGN_NORMAL', 'cases_List?l=to_reassign',
$G_TMP_MENU->AddIdRawOption('CASES_TO_REASSIGN', 'casesListExtJs?action=to_reassign', G::LoadTranslation('ID_TO_REASSIGN'), 'reassing.png' ); //G::LoadTranslation('ID_TO_REASSIGN'), 'reassing.png' );
$G_TMP_MENU->AddIdRawOption('CASES_TO_REASSIGN', 'casesListExtJs?action=to_reassign',
G::LoadTranslation('ID_TO_REASSIGN'), 'reassing.png' );
} }
if ($RBAC->userCanAccess('PM_FOLDERS_VIEW') == 1) { if ($RBAC->userCanAccess('PM_FOLDERS_VIEW') == 1) {
$G_TMP_MENU->AddIdRawOption('CASES_FOLDERS', 'casesStartPage?action=documents', G::LoadTranslation('ID_FOLDERS'), 'folderV2.gif','','blockHeaderNoChild' ); $G_TMP_MENU->AddIdRawOption('CASES_FOLDERS', 'casesStartPage?action=documents', G::LoadTranslation('ID_FOLDERS'),
'folderV2.gif', '', 'blockHeaderNoChild' );
} }
//$G_TMP_MENU->AddIdRawOption('CASES_START_PAGE', 'casesStartPage?action=mainDashboard', ucwords(strtolower(G::LoadTranslation('ID_DASHBOARD'))), '' ); //$G_TMP_MENU->AddIdRawOption('CASES_START_PAGE', 'casesStartPage?action=mainDashboard',
//ucwords(strtolower(G::LoadTranslation('ID_DASHBOARD'))),'');
//Load Other registered Dashboards (From plugins) //Load Other registered Dashboards (From plugins)
$oPluginRegistry = & PMPluginRegistry::getSingleton (); $oPluginRegistry = & PMPluginRegistry::getSingleton ();
@@ -76,9 +87,9 @@ if(count($dashBoardPages)>0){
$tabName=$tabInfo->sName; $tabName=$tabInfo->sName;
$tabIcon=str_replace("ICON_","",$tabInfo->sIcon); $tabIcon=str_replace("ICON_","",$tabInfo->sIcon);
if ($tabName!= "") { if ($tabName!= "") {
$G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName, ucwords(strtolower($tabName)), '' ); $G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName,
ucwords(strtolower($tabName)), '');
} }
} }
} }

View File

@@ -24,7 +24,8 @@ $functionName ( $functionParams );
* @param void * @param void
* @return true * @return true
**/ **/
function delete() { function delete()
{
include_once ("classes/model/AppDocument.php"); include_once ("classes/model/AppDocument.php");
include_once ("classes/model/AppFolder.php"); include_once ("classes/model/AppFolder.php");
@@ -55,33 +56,36 @@ $functionName ( $functionParams );
* @param string $opt * @param string $opt
* @return true * @return true
**/ **/
function deleteDocuments($aDocuments, $opt){ function deleteDocuments($aDocuments, $opt)
{
include_once ("classes/model/AppDocument.php"); include_once ("classes/model/AppDocument.php");
$oAppDocument = new AppDocument (); $oAppDocument = new AppDocument ();
foreach ($aDocuments as $key => $val) { foreach ($aDocuments as $key => $val) {
if ($opt == 'documents') { if ($opt == 'documents') {
list($sFileUID,$docVersion) = explode('_',$val); list($sFileUID,$docVersion) = explode('_',$val);
} else { } else {
$sFileUID = $val['sAppDocUid']; $sFileUID = $val['sAppDocUid'];
$docVersion = $val['iVersion']; $docVersion = $val['iVersion'];
} }
$oAppDocument->remove($sFileUID,$docVersion); $oAppDocument->remove($sFileUID,$docVersion);
} }
return true; return true;
} }
///////////////////////////////////////////// /////////////////////////////////////////////
function getExtJSParams() { function getExtJSParams()
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '', 'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => ""); {
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '',
'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => "");
$result = array(); $result = array();
foreach ($validParams as $paramName => $paramDefault) { foreach ($validParams as $paramName => $paramDefault) {
$result[$paramName] = isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault; $result[$paramName] = isset($_REQUEST[$paramName]) ?
$_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault;
} }
return $result; return $result;
} }
function sendJsonResultGeneric($response, $callback) { function sendJsonResultGeneric($response, $callback)
{
header("Content-Type: application/json"); header("Content-Type: application/json");
$finalResponse = G::json_encode($response); $finalResponse = G::json_encode($response);
if ($callback != '') { if ($callback != '') {
@@ -91,7 +95,8 @@ function sendJsonResultGeneric($response, $callback) {
} }
} }
function expandNode(){ function expandNode()
{
extract(getExtJSParams()); extract(getExtJSParams());
require_once ("classes/model/AppFolder.php"); require_once ("classes/model/AppFolder.php");
@@ -102,38 +107,33 @@ function expandNode(){
if ($_POST ['node']=="") { if ($_POST ['node']=="") {
$_POST ['node'] ="/"; $_POST ['node'] ="/";
} }
if ($_POST ['node']=="root") { if ($_POST ['node']=="root") {
$_POST ['node'] ="/"; $_POST ['node'] ="/";
} }
if (!(isset($_POST['sendWhat']))) { if (!(isset($_POST['sendWhat']))) {
$_POST['sendWhat']="both"; $_POST['sendWhat']="both";
} }
if (isset($_POST['renderTree'])) { if (isset($_POST['renderTree'])) {
$limit = 1000000; $limit = 1000000;
} }
$totalItems=0; $totalItems=0;
$totalFolders=0; $totalFolders=0;
$totalDocuments=0; $totalDocuments=0;
if (($_POST['sendWhat'] == "dirs") || ($_POST['sendWhat'] == "both")) { if (($_POST['sendWhat'] == "dirs") || ($_POST['sendWhat'] == "both")) {
$folderListObj = $oPMFolder->getFolderList ($_POST ['node'] != 'root' ?
$_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, $limit, $start);
$folderListObj = $oPMFolder->getFolderList ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, $limit, $start);
//G::pr($folderListObj); //G::pr($folderListObj);
$folderList=$folderListObj['folders']; $folderList=$folderListObj['folders'];
$totalFolders=$folderListObj['totalFoldersCount']; $totalFolders=$folderListObj['totalFoldersCount'];
$totalItems+=count($folderList); $totalItems+=count($folderList);
//G::pr($folderListObj); //G::pr($folderListObj);
} }
if (($_POST['sendWhat'] == "files") || ($_POST['sendWhat'] == "both")) { if (($_POST['sendWhat'] == "files") || ($_POST['sendWhat'] == "both")) {
global $RBAC; global $RBAC;
$user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED']; $user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED'];
$folderContentObj = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), NULL, NULL, $limit, $start, $user); $folderContentObj = $oPMFolder->getFolderContent ($_POST ['node'] != 'root' ?
$_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), null, null, $limit, $start, $user);
$folderContent=$folderContentObj['documents']; $folderContent=$folderContentObj['documents'];
$totalDocuments=$folderContentObj['totalDocumentsCount']; $totalDocuments=$folderContentObj['totalDocumentsCount'];
$totalItems+=count($folderContent); $totalItems+=count($folderContent);
@@ -157,7 +157,8 @@ function expandNode(){
$tempTree ['type'] = "Directory"; $tempTree ['type'] = "Directory";
$tempTree ['is_file'] = false; $tempTree ['is_file'] = false;
$tempTree ['appDocCreateDate'] = $obj['FOLDER_CREATE_DATE']; $tempTree ['appDocCreateDate'] = $obj['FOLDER_CREATE_DATE'];
$tempTree ['qtip'] ='<strong>Directory: </strong>'.$obj['FOLDER_NAME'].'<br /><strong>Create Date:</strong> '.$obj['FOLDER_CREATE_DATE'].''; $tempTree ['qtip'] ='<strong>Directory: </strong>'.$obj['FOLDER_NAME'].
'<br /><strong>Create Date:</strong> '.$obj['FOLDER_CREATE_DATE'].'';
$tempTree ['is_writable'] =true; $tempTree ['is_writable'] =true;
$tempTree ['is_chmodable'] =true; $tempTree ['is_chmodable'] =true;
$tempTree ['is_readable'] =true; $tempTree ['is_readable'] =true;
@@ -181,7 +182,6 @@ function expandNode(){
$processListTree [] = $tempTree; $processListTree [] = $tempTree;
$tempTree=array(); $tempTree=array();
} }
/*if ($_POST ['node'] == '/') { /*if ($_POST ['node'] == '/') {
$notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER'); $notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER');
$tempTree ['text'] = $notInFolderLabel; $tempTree ['text'] = $notInFolderLabel;
@@ -215,18 +215,13 @@ function expandNode(){
*/ */
/*$processListTree [] = $tempTree; /*$processListTree [] = $tempTree;
$tempTree=array(); $tempTree=array();
}*/ }*/
} else { } else {
if ($_POST ['node'] == '/') { if ($_POST ['node'] == '/') {
//$tempTree=array(); //$tempTree=array();
//$processListTree [] = array(); //$processListTree [] = array();
} }
} }
if (isset($folderContent)) { if (isset($folderContent)) {
foreach ($folderContent as $key => $obj) { foreach ($folderContent as $key => $obj) {
$tempTree ['text'] = $obj['APP_DOC_FILENAME']; $tempTree ['text'] = $obj['APP_DOC_FILENAME'];
@@ -241,7 +236,6 @@ function expandNode(){
} else { } else {
$arrayType=array($obj['OUT_DOC_GENERATE']); $arrayType=array($obj['OUT_DOC_GENERATE']);
} }
foreach ($arrayType as $keyType => $fileType) { foreach ($arrayType as $keyType => $fileType) {
$tempTree ['text'.$fileType] = $obj['APP_DOC_FILENAME'].".".strtolower($fileType); $tempTree ['text'.$fileType] = $obj['APP_DOC_FILENAME'].".".strtolower($fileType);
$tempTree ['name'.$fileType] = $obj['APP_DOC_FILENAME'].".".strtolower($fileType); $tempTree ['name'.$fileType] = $obj['APP_DOC_FILENAME'].".".strtolower($fileType);
@@ -251,19 +245,14 @@ function expandNode(){
} }
} }
$tempTree ['appdocid'] = $obj['APP_DOC_UID']; $tempTree ['appdocid'] = $obj['APP_DOC_UID'];
$tempTree ['id'] = $obj['APP_DOC_UID_VERSION']; $tempTree ['id'] = $obj['APP_DOC_UID_VERSION'];
$tempTree ['cls'] = 'file'; $tempTree ['cls'] = 'file';
//$tempTree ['draggable'] = true; //$tempTree ['draggable'] = true;
$tempTree ['leaf'] = true; $tempTree ['leaf'] = true;
$tempTree ['is_file'] = true; $tempTree ['is_file'] = true;
//if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) { //if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
//} //}
$tempTree ['docVersion'] = $obj['DOC_VERSION']; $tempTree ['docVersion'] = $obj['DOC_VERSION'];
$tempTree ['appUid'] = $obj['APP_UID']; $tempTree ['appUid'] = $obj['APP_UID'];
$tempTree ['usrUid'] = $obj['USR_UID']; $tempTree ['usrUid'] = $obj['USR_UID'];
@@ -286,7 +275,6 @@ function expandNode(){
} elseif (isset($obj['INP_DOC_VERSIONING'])) { } elseif (isset($obj['INP_DOC_VERSIONING'])) {
$tempTree ['appDocVersionable'] = $obj['INP_DOC_VERSIONING']; $tempTree ['appDocVersionable'] = $obj['INP_DOC_VERSIONING'];
} }
if (isset($obj['USR_LASTNAME']) && isset($obj['USR_LASTNAME'])) { if (isset($obj['USR_LASTNAME']) && isset($obj['USR_LASTNAME'])) {
$tempTree ['owner'] = $obj['USR_USERNAME']; $tempTree ['owner'] = $obj['USR_USERNAME'];
$tempTree ['owner_firstname'] = $obj['USR_FIRSTNAME']; $tempTree ['owner_firstname'] = $obj['USR_FIRSTNAME'];
@@ -295,7 +283,6 @@ function expandNode(){
$tempTree ['owner'] = $obj['USR_USERNAME']; $tempTree ['owner'] = $obj['USR_USERNAME'];
$tempTree ['owner_firstname'] = ""; $tempTree ['owner_firstname'] = "";
$tempTree ['owner_lastname'] = ""; $tempTree ['owner_lastname'] = "";
} }
$tempTree ['deletelabel'] = $obj['DELETE_LABEL']; $tempTree ['deletelabel'] = $obj['DELETE_LABEL'];
@@ -363,10 +350,12 @@ function expandNode(){
print G::json_encode ($processListTree); print G::json_encode ($processListTree);
} }
function openPMFolder(){ function openPMFolder()
{
$WIDTH_PANEL = 350; $WIDTH_PANEL = 350;
G::LoadClass ('tree'); G::LoadClass ('tree');
$folderContent = $oPMFolder->getFolderList ( $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder ); $folderContent = $oPMFolder->getFolderList ($_POST ['folderID'] != '0' ?
$_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder);
//krumo($folderContent); //krumo($folderContent);
if (! is_array ($folderContent)) { if (! is_array ($folderContent)) {
echo $folderContent; echo $folderContent;
@@ -386,15 +375,16 @@ function openPMFolder(){
$i ++; $i ++;
//if ($obj->item_type=="F") { //if ($obj->item_type=="F") {
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2'; $RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
$id_delete = G::LoadTranslation('ID_DELETE'); $id_delete = G::LoadTranslation('ID_DELETE');
$id_edit = G::LoadTranslation('ID_EDIT'); $id_edit = G::LoadTranslation('ID_EDIT');
$htmlGroup = <<<GHTML $htmlGroup = <<<GHTML
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable"> <table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable">
<tr id="{$i}" onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer' )" class="{$RowClass}" style="cursor:hand"> <tr id="{$i}" onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer')"
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#" onclick="focusRow(this, 'Selected');openPMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');"> class="{$RowClass}" style="cursor:hand">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#"
onclick="focusRow(this, 'Selected');openPMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');">
<img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;{$obj['FOLDER_NAME']}</a> <img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;{$obj['FOLDER_NAME']}</a>
<a href="#" onclick="deletePMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');">&nbsp; {$id_delete}</a> <a href="#" onclick="deletePMFolder('{$obj['FOLDER_UID']}','{$_POST['rootfolder']}');">&nbsp; {$id_delete}</a>
</td> </td>
@@ -405,7 +395,6 @@ GHTML;
$ch = & $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child')); $ch = & $tree->addChild ($key, $htmlGroup, array ('nodeType' => 'child'));
$ch->point = ' '; $ch->point = ' ';
} }
$RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2'; $RowClass = ($i % 2 == 0) ? 'Row1' : 'Row2';
$key = 0; $key = 0;
@@ -413,8 +402,10 @@ GHTML;
$notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER'); $notInFolderLabel = G::LoadTranslation ('ID_NOT_IN_FOLDER');
$htmlGroup = <<<GHTML $htmlGroup = <<<GHTML
<table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable"> <table cellspacing='0' cellpadding='0' border='1' style='border:0px;' width="100%" class="pagedTable">
<tr id="{$i}" onclick="focusRow(this, 'Selected');openPMFolder('NA');" onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer' )" class="{$RowClass}"> <tr id="{$i}" onclick="focusRow(this, 'Selected');openPMFolder('NA');"
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#" onclick=""><img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;- {$notInFolderLabel} -</a>&nbsp;</td> onmouseout="setRowClass(this, '{$RowClass}')" onmouseover="setRowClass(this, 'RowPointer')" class="{$RowClass}">
<td width='' class='treeNode' style='border:0px;background-color:transparent;'><a href="#" onclick="">
<img src="/images/folderV2.gif" border = "0" valign="middle" />&nbsp;- {$notInFolderLabel} -</a>&nbsp;</td>
</tr> </tr>
</table> </table>
@@ -429,15 +420,18 @@ GHTML;
} }
function getPMFolderContent(){ function getPMFolderContent()
{
$swSearch = false; $swSearch = false;
if (isset ( $_POST ['folderID'] )) { //Render content of a folder if (isset ($_POST ['folderID'])) {
//Render content of a folder
$folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder; $folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder;
$folderContent = $oPMFolder->getFolderContent ($folderID); $folderContent = $oPMFolder->getFolderContent ($folderID);
} else { // Perform a Search } else {
// Perform a Search
$swSearch = true; $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')); array_unshift ($folderContent, array ('id' => 'char'));
if (! is_array ($folderContent)) { if (! is_array ($folderContent)) {
@@ -465,18 +459,23 @@ function getPMFolderContent(){
} }
if (! $swSearch) { if (! $swSearch) {
$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 ('propeltable', 'paged-table', 'appFolder/appFolderDocumentList',
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderDocumentListHeader', '', array (), 'appFolderList?folderID=' . $_POST ['folderID'] ); $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']);
} else { } else {
$G_PUBLISH->AddContent ('propeltable', 'paged-table', 'appFolder/appFolderDocumentListSearch', $c, array ()); $G_PUBLISH->AddContent ('propeltable', 'paged-table', 'appFolder/appFolderDocumentListSearch', $c, array ());
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'appFolder/appFolderDocumentListHeader', '', array (), 'appFolderList?folderID=/' ); $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentListHeader', '', array (),
'appFolderList?folderID=/');
} }
G::RenderPage ('publish', 'raw'); G::RenderPage ('publish', 'raw');
} }
function getPMFolderTags(){ function getPMFolderTags()
{
// Default font sizes // Default font sizes
$min_font_size = 12; $min_font_size = 12;
$max_font_size = 30; $max_font_size = 30;
@@ -502,7 +501,9 @@ function getPMFolderTags(){
$href = "#"; $href = "#";
//$href="?q="$tag; //$href="?q="$tag;
$size = $min_font_size + ($count - $minimum_count) * ($max_font_size - $min_font_size) / $spread; $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 . '" onClick="getPMFolderSearchResult(\'' . $tag . '\',\'TAG\')"' . ' title="\'' . $tag . '\' returned a count of ' . $count . '">' . htmlspecialchars ( stripslashes ( $tag ) ) . '</a>'; $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>';
} }
$cloud_html = join ("\n", $cloud_tags) . "\n"; $cloud_html = join ("\n", $cloud_tags) . "\n";
@@ -510,11 +511,10 @@ function getPMFolderTags(){
} }
function uploadDocument(){ function uploadDocument()
{
$uploadDocumentComponent=array(); $uploadDocumentComponent=array();
$uploadDocumentComponent["xtype"]= "tabpanel"; $uploadDocumentComponent["xtype"]= "tabpanel";
$uploadDocumentComponent["stateId"]= "upload_tabpanel"; $uploadDocumentComponent["stateId"]= "upload_tabpanel";
$uploadDocumentComponent["activeTab"]= "uploadform"; $uploadDocumentComponent["activeTab"]= "uploadform";
@@ -523,7 +523,8 @@ function uploadDocument(){
$uploadDocumentComponent["stateEvents"]= array("tabchange"); $uploadDocumentComponent["stateEvents"]= array("tabchange");
$uploadDocumentComponent["getState"]= "function_getState"; $uploadDocumentComponent["getState"]= "function_getState";
$functionsToReplace['function_getState']="function() { return { $functionsToReplace['function_getState']="function() {
return {
activeTab:this.items.indexOf(this.getActiveTab()) activeTab:this.items.indexOf(this.getActiveTab())
}; };
}"; }";
@@ -535,7 +536,6 @@ function uploadDocument(){
$itemA=array(); $itemA=array();
$itemA["xtype"]= "swfuploadpanel"; $itemA["xtype"]= "swfuploadpanel";
$itemA["title"]= "flashupload"; $itemA["title"]= "flashupload";
$itemA["height"]= "300"; $itemA["height"]= "300";
@@ -576,13 +576,15 @@ function uploadDocument(){
$itemA["labelWidth"]="125"; $itemA["labelWidth"]="125";
$itemA["url"]="URL_SCRIPT"; $itemA["url"]="URL_SCRIPT";
$itemA["title"]=G::LoadTranslation('ID_UPLOAD'); $itemA["title"]=G::LoadTranslation('ID_UPLOAD');
//$itemA["tooltip"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />"; //$itemA["tooltip"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
//Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
$itemA["frame"]=true; $itemA["frame"]=true;
$itemA["items"]=array(); $itemA["items"]=array();
$itemB=array(); $itemB=array();
$itemB["xtype"]="displayfield"; $itemB["xtype"]="displayfield";
$itemB["value"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />"; $itemB["value"]="Max File Size <strong>". ((get_max_file_size() / 1024) / 1024)." MB</strong><br />
Max Post Size<strong>". ((get_max_upload_limit() / 1024) / 1024)." MB</strong><br />";
//$itemA["items"][]=$itemB; //$itemA["items"][]=$itemB;
for ($i=0; $i<7; $i++) { for ($i=0; $i<7; $i++) {
@@ -731,7 +733,6 @@ function uploadDocument(){
$finalResponse=G::json_encode($uploadDocumentComponent); $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) { foreach ($functionsToReplace as $key => $originalFunction) {
$finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse); $finalResponse=str_replace('"'.$key.'"',$originalFunction,$finalResponse);
} }
echo ($finalResponse); echo ($finalResponse);
@@ -749,17 +750,22 @@ function uploadDocument(){
$Fields ['appId'] = $_POST ['appId']; $Fields ['appId'] = $_POST ['appId'];
$Fields ['docType'] = $_POST ['docType']; $Fields ['docType'] = $_POST ['docType'];
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=' . $_POST ['docID'] . '&appId=' . $_POST ['appId'] . '&docType=' . $_POST ['docType'] ); $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields,
'appFolderSaveDocument?UID=' . $_POST ['docID'] . '&appId=' . $_POST ['appId'] . '&docType=' .
$_POST ['docType']);
G::RenderPage ('publish', 'raw'); G::RenderPage ('publish', 'raw');
*/ */
} }
function copyAction(){ function copyAction()
{
copyMoveAction("copy"); copyMoveAction("copy");
} }
function moveAction(){ function moveAction()
{
copyMoveAction("move"); copyMoveAction("move");
} }
function copyMoveAction($type){ function copyMoveAction($type)
{
require_once ("classes/model/AppFolder.php"); require_once ("classes/model/AppFolder.php");
$oPMFolder = new AppFolder (); $oPMFolder = new AppFolder ();
@@ -798,8 +804,6 @@ function copyMoveAction($type){
$itemField["allowBlank"]=false; $itemField["allowBlank"]=false;
$copyDialog["items"][]=$itemField; $copyDialog["items"][]=$itemField;
$copyDialog["buttons"]=array(); $copyDialog["buttons"]=array();
$itemButton=array(); $itemButton=array();
@@ -856,29 +860,29 @@ function copyMoveAction($type){
$finalResponse=G::json_encode($copyDialog); $finalResponse=G::json_encode($copyDialog);
foreach ($functionsToReplace as $key => $originalFunction) { 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); $finalResponse=str_replace("URL_SCRIPT","../appFolder/appFolderAjax.php",$finalResponse);
echo ($finalResponse); echo ($finalResponse);
} }
function copyExecute(){ function copyExecute()
{
copyMoveExecute("copy"); copyMoveExecute("copy");
} }
function moveExecute(){ function moveExecute()
{
copyMoveExecute("move"); copyMoveExecute("move");
} }
function copyMoveExecute($type){ function copyMoveExecute($type)
{
uploadExternalDocument(); uploadExternalDocument();
} }
function documentVersionHistory(){ function documentVersionHistory()
{
$folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder; $folderID = $_POST ['folderID'] != '0' ? $_POST ['folderID'] == 'NA' ? "" : $_POST ['folderID'] : $rootFolder;
$folderContent = $oPMFolder->getFolderContent ($folderID, array ($_POST ['appDocId'])); $folderContent = $oPMFolder->getFolderContent ($folderID, array ($_POST ['appDocId']));
@@ -898,13 +902,15 @@ function documentVersionHistory(){
$G_PUBLISH = new Publisher (); $G_PUBLISH = new Publisher ();
require_once ('classes/class.xmlfield_InputPM.php'); require_once ('classes/class.xmlfield_InputPM.php');
$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 uploadExternalDocument(){ function uploadExternalDocument()
{
$response['action']=$_POST['action']. " - ".$_POST['option']; $response['action']=$_POST['action']. " - ".$_POST['option'];
$response['error']="error"; $response['error']="error";
$response['message']="error"; $response['message']="error";
@@ -919,34 +925,38 @@ function uploadExternalDocument(){
$quequeUpload=array(); $quequeUpload=array();
// upload files & check for errors // upload files & check for errors
for ($i=0; $i<$uploadedInstances; $i++) { for ($i=0; $i<$uploadedInstances; $i++) {
$errors[$i]=NULL; $errors[$i] = null;
$tmp = $_FILES['uploadedFile']['tmp_name'][$i]; $tmp = $_FILES['uploadedFile']['tmp_name'][$i];
$items[$i] = stripslashes($_FILES['uploadedFile']['name'][$i]); $items[$i] = stripslashes($_FILES['uploadedFile']['name'][$i]);
if($sw_error_exists) $up_err = $_FILES['uploadedFile']['error'][$i]; if ($sw_error_exists) {
else $up_err=(file_exists($tmp)?0:4); $up_err = $_FILES['uploadedFile']['error'][$i];
} else {
$up_err=(file_exists($tmp)?0:4);
}
if ($items[$i]=="" || $up_err==4) { if ($items[$i]=="" || $up_err==4) {
$emptyInstances++; $emptyInstances++;
continue; continue;
} }
if ($up_err==1 || $up_err==2) { if ($up_err==1 || $up_err==2) {
$errors[$i]='miscfilesize'; $errors[$i]='miscfilesize';
$sw_error=true; continue; $sw_error = true;
continue;
} }
if ($up_err==3) { if ($up_err==3) {
$errors[$i]='miscfilepart'; $errors[$i]='miscfilepart';
$sw_error=true; continue; $sw_error=true;
continue;
} }
if (!@is_uploaded_file($tmp)) { if (!@is_uploaded_file($tmp)) {
$errors[$i]='uploadfile'; $errors[$i]='uploadfile';
$sw_error=true; continue; $sw_error=true;
continue;
} }
//The uplaoded files seems to be correct and ready to be uploaded. Add to the Queque //The uplaoded files seems to be correct and ready to be uploaded. Add to the Queque
$fileInfo=array("tempName"=>$tmp,"fileName"=>$items[$i]); $fileInfo=array("tempName"=>$tmp,"fileName"=>$items[$i]);
$quequeUpload[]=$fileInfo; $quequeUpload[]=$fileInfo;
}}elseif(isset($_POST['selitems'])){ }
} elseif (isset($_POST['selitems'])) {
$response=""; $response="";
$response['msg']="correct reload"; $response['msg']="correct reload";
$response['success']=true; $response['success']=true;
@@ -960,7 +970,6 @@ function uploadExternalDocument(){
$docInfo['FOLDER_UID'] = $_POST['new_dir']; $docInfo['FOLDER_UID'] = $_POST['new_dir'];
$docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s'); $docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
$oAppDocument->update($docInfo); $oAppDocument->update($docInfo);
//G::pr($docInfo); //G::pr($docInfo);
} }
} }
@@ -975,7 +984,6 @@ function uploadExternalDocument(){
$folderId=$_POST['dir']==""?"/":$_POST['dir']; $folderId=$_POST['dir']==""?"/":$_POST['dir'];
$appId=$_POST['appId']; $appId=$_POST['appId'];
$docType=isset($_POST['docType'])?$_GET['docType']:"INPUT"; $docType=isset($_POST['docType'])?$_GET['docType']:"INPUT";
//save info //save info
require_once ("classes/model/AppDocument.php"); require_once ("classes/model/AppDocument.php");
@@ -991,10 +999,8 @@ function uploadExternalDocument(){
$aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']); $aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
} }
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
//Get the Custom Folder ID (create if necessary) //Get the Custom Folder ID (create if necessary)
$oFolder=new AppFolder(); $oFolder=new AppFolder();
if ($docUid!=-1) { if ($docUid!=-1) {
@@ -1006,11 +1012,12 @@ function uploadExternalDocument(){
$folderId=$folderId; $folderId=$folderId;
$fileTags="EXTERNAL"; $fileTags="EXTERNAL";
} }
foreach ($quequeUpload as $key => $fileObj) { foreach ($quequeUpload as $key => $fileObj) {
switch ($actionType) { switch ($actionType) {
case "R": //replace case "R":
$aFields = array('APP_DOC_UID' => $appDocUid, //replace
$aFields = array(
'APP_DOC_UID' => $appDocUid,
'APP_UID' => $appId, 'APP_UID' => $appId,
'DOC_VERSION' => $docVersion, 'DOC_VERSION' => $docVersion,
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
@@ -1018,53 +1025,53 @@ function uploadExternalDocument(){
'DOC_UID' => $docUid, 'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType, 'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '', 'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'], 'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId, 'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags); 'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->update($aFields); $oAppDocument->update($aFields);
break; break;
case "NV": //New Version case "NV":
//New Version
$aFields = array(
$aFields = array('APP_DOC_UID' => $appDocUid, 'APP_DOC_UID' => $appDocUid,
'APP_UID' => $appId, 'APP_UID' => $appId,
'DEL_INDEX' => 1, 'DEL_INDEX' => 1,
'USR_UID' => $_SESSION['USER_LOGGED'], 'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid, 'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType, 'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '', 'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'], 'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId, 'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags); 'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields); $oAppDocument->create($aFields);
break; break;
default: //New default:
$aFields = array('APP_UID' => $appId, //New
$aFields = array(
'APP_UID' => $appId,
'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1, 'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
'USR_UID' => $_SESSION['USER_LOGGED'], 'USR_UID' => $_SESSION['USER_LOGGED'],
'DOC_UID' => $docUid, 'DOC_UID' => $docUid,
'APP_DOC_TYPE' => $docType, 'APP_DOC_TYPE' => $docType,
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
$_POST['form']['APP_DOC_COMMENT'] : '',
'APP_DOC_TITLE' => '', 'APP_DOC_TITLE' => '',
'APP_DOC_FILENAME' => $fileObj['fileName'], 'APP_DOC_FILENAME' => $fileObj['fileName'],
'FOLDER_UID' => $folderId, 'FOLDER_UID' => $folderId,
'APP_DOC_TAGS' => $fileTags); 'APP_DOC_TAGS' => $fileTags
);
$oAppDocument->create($aFields); $oAppDocument->create($aFields);
break; break;
} }
$sAppDocUid = $oAppDocument->getAppDocUid(); $sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion(); $iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename()); $info = pathinfo($oAppDocument->getAppDocFilename());
@@ -1080,7 +1087,6 @@ function uploadExternalDocument(){
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry =& PMPluginRegistry::getSingleton(); $oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) { if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
$oData['APP_UID'] = $appId; $oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData ( $documentData = new uploadDocumentData (
$appId, $appId,
@@ -1089,35 +1095,33 @@ function uploadExternalDocument(){
$fileObj['fileName'], $fileObj['fileName'],
$sAppDocUid $sAppDocUid
); );
//$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData); //$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData);
//unlink ($sPathName . $sFileName); //unlink ($sPathName . $sFileName);
} }
//end plugin //end plugin
if($sw_error) { // there were errors if ($sw_error) {
// there were errors
$err_msg=""; $err_msg="";
for ($i=0; $i<$uploadedInstances; $i++) { for ($i=0; $i<$uploadedInstances; $i++) {
if($errors[$i]==NULL) continue; if ($errors[$i]==null) {
continue;
}
$err_msg .= $items[$i]." : ".$errors[$i]."\n"; $err_msg .= $items[$i]." : ".$errors[$i]."\n";
} }
$response['error']=$err_msg; $response['error']=$err_msg;
$response['message']=$err_msg; $response['message']=$err_msg;
$response['success']=false; $response['success']=false;
} } elseif ($emptyInstances==$uploadedInstances) {
elseif ($emptyInstances==$uploadedInstances) {
$response['error']="You may upload at least one file"; $response['error']="You may upload at least one file";
$response['message']="You may upload at least one file"; $response['message']="You may upload at least one file";
$response['success']=false; $response['success']=false;
} } else {
else {
$response['error']="Upload complete"; $response['error']="Upload complete";
$response['message']="Upload complete"; $response['message']="Upload complete";
$response['success']=true; $response['success']=true;
} }
} }
} }
} }
print_r(G::json_encode($response)); print_r(G::json_encode($response));
/* /*
@@ -1129,17 +1133,23 @@ function uploadExternalDocument(){
$Fields ['appId'] = "00000000000000000000000000000000"; $Fields ['appId'] = "00000000000000000000000000000000";
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID'] ); $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields,
'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID']);
G::RenderPage ('publish', 'raw'); G::RenderPage ('publish', 'raw');
*/ */
} }
function newFolder(){ function newFolder()
{
require_once ("classes/model/AppFolder.php"); require_once ("classes/model/AppFolder.php");
$oPMFolder = new AppFolder (); $oPMFolder = new AppFolder ();
//G::pr($_POST); //G::pr($_POST);
if($_POST ['dir']=="") $_POST ['dir']="/"; if ($_POST ['dir']=="") {
if($_POST ['dir']=="root") $_POST ['dir']="/"; $_POST ['dir']="/";
}
if ($_POST ['dir']=="root") {
$_POST ['dir']="/";
}
$folderStructure = $oPMFolder->getFolderStructure ($_POST ['dir']); $folderStructure = $oPMFolder->getFolderStructure ($_POST ['dir']);
//G::pr($folderStructure); //G::pr($folderStructure);
$folderPath = $folderStructure ['PATH']; $folderPath = $folderStructure ['PATH'];
@@ -1148,7 +1158,6 @@ function newFolder(){
$formNewFolder=array(); $formNewFolder=array();
$formNewFolder["xtype"]="form"; $formNewFolder["xtype"]="form";
$formNewFolder["id"]= "simpleform"; $formNewFolder["id"]= "simpleform";
$formNewFolder["labelWidth"]=125; $formNewFolder["labelWidth"]=125;
@@ -1157,8 +1166,6 @@ function newFolder(){
$formNewFolder["frame"]= true; $formNewFolder["frame"]= true;
$formNewFolder["items"]= array(); $formNewFolder["items"]= array();
$field=array(); $field=array();
$field["xtype"]= "label"; $field["xtype"]= "label";
$field["fieldLabel"]= "Path"; $field["fieldLabel"]= "Path";
@@ -1199,10 +1206,8 @@ function newFolder(){
$field["allowBlank"]=false; $field["allowBlank"]=false;
$formNewFolder["items"][]= $field; $formNewFolder["items"][]= $field;
$formNewFolder["buttons"]= array(); $formNewFolder["buttons"]= array();
$button = array(); $button = array();
$button["text"] = "Create"; $button["text"] = "Create";
$button["handler"] = 'handlerCreate'; $button["handler"] = 'handlerCreate';
@@ -1261,7 +1266,8 @@ function newFolder(){
*/ */
} }
function appFolderSave(){ function appFolderSave()
{
require_once ("classes/model/AppFolder.php"); require_once ("classes/model/AppFolder.php");
$oPMFolder = new AppFolder (); $oPMFolder = new AppFolder ();
$form = $_POST['form']; $form = $_POST['form'];
@@ -1279,21 +1285,21 @@ function appFolderSave(){
$response=array_merge($response,$folderCreateResponse); $response=array_merge($response,$folderCreateResponse);
print_r(G::json_encode($response)); print_r(G::json_encode($response));
} }
function documentInfo(){ function documentInfo()
{
$oFolder = new AppFolder (); $oFolder = new AppFolder ();
$Fields = $oPMFolder->getCompleteDocumentInfo ( $_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'], $_POST ['docID'], $_POST ['usrUid'] ); $Fields = $oPMFolder->getCompleteDocumentInfo ($_POST ['appId'], $_POST ['appDocId'], $_POST ['docVersion'],
$_POST ['docID'], $_POST ['usrUid']);
$G_PUBLISH = new Publisher (); $G_PUBLISH = new Publisher ();
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentInfo', '', $Fields, ''); $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'appFolder/appFolderDocumentInfo', '', $Fields, '');
G::RenderPage ('publish', 'raw'); G::RenderPage ('publish', 'raw');
} }
function documentdelete(){ function documentdelete()
{
include_once ("classes/model/AppDocument.php"); include_once ("classes/model/AppDocument.php");
$oAppDocument = new AppDocument (); $oAppDocument = new AppDocument ();
$oAppDocument->remove($_POST['sFileUID'],$_POST['docVersion']); $oAppDocument->remove($_POST['sFileUID'],$_POST['docVersion']);
@@ -1303,14 +1309,16 @@ function documentdelete(){
unlink($sPathName.$_POST['sFileUID'].'_1.jpg');*/ unlink($sPathName.$_POST['sFileUID'].'_1.jpg');*/
} }
function deletePMFolder(){ function deletePMFolder()
{
include_once ("classes/model/AppFolder.php"); include_once ("classes/model/AppFolder.php");
$oAppFoder = new AppFolder (); $oAppFoder = new AppFolder ();
$oAppFoder->remove($_POST['sFileUID'],$_POST['rootfolder']); $oAppFoder->remove($_POST['sFileUID'],$_POST['rootfolder']);
} }
function getMime($fileName){ function getMime($fileName)
{
$fileName=basename($fileName); $fileName=basename($fileName);
$fileNameA=explode(".",$fileName); $fileNameA=explode(".",$fileName);
$return['description']=G::LoadTranslation("MIME_DES_FILE"); $return['description']=G::LoadTranslation("MIME_DES_FILE");
@@ -1325,15 +1333,19 @@ function getMime($fileName){
return $return; return $return;
} }
function get_max_file_size() { // get php max_upload_file_size function get_max_file_size()
{
// get php max_upload_file_size
return calc_php_setting_bytes(ini_get("upload_max_filesize")); return calc_php_setting_bytes(ini_get("upload_max_filesize"));
} }
function get_max_upload_limit() { function get_max_upload_limit()
{
return calc_php_setting_bytes(ini_get('post_max_size')); return calc_php_setting_bytes(ini_get('post_max_size'));
} }
function calc_php_setting_bytes( $value ) { function calc_php_setting_bytes($value)
{
//if(@eregi("G$",$value)) { //if(@eregi("G$",$value)) {
// $value = substr($value,0,-1); // $value = substr($value,0,-1);
// $value = round($value*1073741824); // $value = round($value*1073741824);
@@ -1347,34 +1359,36 @@ function calc_php_setting_bytes( $value ) {
if (@preg_match("/G$/i", $value)) { if (@preg_match("/G$/i", $value)) {
$value = substr($value, 0, -1); $value = substr($value, 0, -1);
$value = round($value * 1073741824); $value = round($value * 1073741824);
} } else {
else {
if (@preg_match("/M$/i", $value)) { if (@preg_match("/M$/i", $value)) {
$value = substr($value, 0, -1); $value = substr($value, 0, -1);
$value = round($value * 1048576); $value = round($value * 1048576);
} } else {
else {
if (@preg_match("/K$/i", $value)) { if (@preg_match("/K$/i", $value)) {
$value = substr($value, 0, -1); $value = substr($value, 0, -1);
$value = round($value * 1024); $value = round($value * 1024);
} }
} }
} }
return $value; return $value;
} }
function get_abs_item($dir, $item) { // get absolute file+path function get_abs_item($dir, $item)
{
// get absolute file+path
if (is_array($item)) { if (is_array($item)) {
// FTP Mode // FTP Mode
$abs_item = '/' . get_abs_dir($dir)."/".$item['name']; $abs_item = '/' . get_abs_dir($dir)."/".$item['name'];
if( get_is_dir($item)) $abs_item.='/'; if (get_is_dir($item)) {
$abs_item.='/';
}
return extPathName($abs_item); return extPathName($abs_item);
} }
return extPathName(get_abs_dir($dir)."/".$item); return extPathName(get_abs_dir($dir)."/".$item);
} }
function extPathName($p_path,$p_addtrailingslash = false) { function extPathName($p_path, $p_addtrailingslash=false)
{
$retval = ""; $retval = "";
$isWin = (substr(PHP_OS, 0, 3) == 'WIN'); $isWin = (substr(PHP_OS, 0, 3) == 'WIN');
@@ -1416,6 +1430,6 @@ function extPathName($p_path,$p_addtrailingslash = false) {
$retval = '/'.$retval; $retval = '/'.$retval;
} }
} }
return $retval; return $retval;
} }