Merge branch 'master' of github.com:colosa/processmaker

This commit is contained in:
Erik Amaru Ortiz
2013-11-04 10:13:03 -04:00
8 changed files with 62 additions and 50 deletions

View File

@@ -1775,7 +1775,7 @@ class G
}
$strContentAux = $strContentAux1 . $strContentAux;
}
}
}
@@ -5222,6 +5222,14 @@ class G
return $path;
}
public function isUserFunction($functionName) {
$allFunctions = get_defined_functions();
if (!isset($allFunctions['user'])) {
$allFunctions['user'] = array();
}
return in_array(strtolower($functionName), $allFunctions['user']);
}
}
/**

View File

@@ -412,6 +412,9 @@ class AdditionalTables extends BaseAdditionalTables
}
$stringOr .= ');';
eval($stringOr);
$oCriteriaCount = clone $oCriteria;
eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');
}
if (isset($_POST['sort'])) {

View File

@@ -422,7 +422,7 @@ class pmTablesProxy extends HttpProxyController
$table = $additionalTables->load( $httpData->id, true );
if ($filter != '') {
$result = $additionalTables::getAllData( $httpData->id, $start, $limit, true, $filter);
$result = $additionalTables->getAllData( $httpData->id, $start, $limit, true, $filter);
} else {
$result = $additionalTables->getAllData( $httpData->id, $start, $limit );
}

View File

@@ -13,14 +13,14 @@ if (isset ($_REQUEST ['action']) && isset($_REQUEST['sort']) && isset($_REQUEST[
}
}
if (! isset ($_REQUEST ['action'])) {
$res ['success'] = false;
$res ['message'] = 'You may request an action';
print G::json_encode ($res);
die ();
}
if (! function_exists ($_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);
@@ -471,49 +471,49 @@ function expandNode()
function sortContent()
{
extract(getExtJSParams());
$rootFolder = "/";
$oPMFolder = new AppFolder();
global $RBAC;
$user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED'];
$totalItems = 0;
$totalFolders = 0;
$totalDocuments = 0;
if (!(isset($_POST['sendWhat']))) {
$_POST['sendWhat'] = "both";
}
if (isset($_POST['renderTree'])) {
$limit = 1000000;
}
$direction = "DESC";
if (isset($_POST['dir'])) {
$direction = $_POST['dir'];
}
if (($_POST['sendWhat'] == "dirs") || ($_POST['sendWhat'] == "both")) {
$folderListObj = $oPMFolder->getFolderList(
($_POST["node"] != "root")? (($_POST["node"] == "NA")? "" : $_POST["node"]) : $rootFolder,
$limit,
$start
);
$folderList=$folderListObj['folders'];
$totalFolders=$folderListObj['totalFoldersCount'];
$totalItems+=count($folderList);
}
if (($_POST['sendWhat'] == "files") || ($_POST['sendWhat'] == "both")) {
global $RBAC;
$user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED'];
$folderContentObj = $oPMFolder->getDirectoryContentSortedBy(
($_POST["node"] != "root")? (($_POST["node"] == "NA")? "" : $_POST["node"]) : $rootFolder,
array(),
@@ -526,15 +526,15 @@ function sortContent()
$direction,
(isset($_POST["sort"]))? $_POST["sort"]:"appDocCreateDate"
);
$folderContent = $folderContentObj['documents'];
$totalDocuments = $folderContentObj['totalDocumentsCount'];
$totalItems += count($folderContent);
}
$processListTree = array();
$tempTree = array();
if (isset($folderList) && sizeof($folderList)>0) {
//$tempTree=array();
foreach ($folderList as $key => $obj) {
@@ -554,7 +554,7 @@ function sortContent()
$tempTree ['is_chmodable'] =true;
$tempTree ['is_readable'] =true;
$tempTree ['is_deletable'] =true;
if ((isset($_POST['option']) )&& ($_POST['option'] == "gridDocuments")) {
$tempTree ['icon'] = "/images/documents/extension/folder.png";
}
@@ -565,16 +565,16 @@ function sortContent()
if ($_POST ['node'] == '/') {
}
}
if (isset($folderContent)) {
foreach ($folderContent as $key => $obj) {
$mimeInformation = getMime($obj["APP_DOC_FILENAME"]);
$tempTree["text"] = $obj["APP_DOC_FILENAME"];
$tempTree["name"] = $obj["APP_DOC_FILENAME"];
$tempTree["type"] = $mimeInformation["description"];
$tempTree["icon"] = $mimeInformation["icon"];
$tempTree ['appdocid'] = $obj['APP_DOC_UID'];
$tempTree ['id'] = $obj['APP_DOC_UID_VERSION'];
$tempTree ['cls'] = 'file';
@@ -615,7 +615,7 @@ function sortContent()
$tempTree ['owner_lastname'] = "";
}
$tempTree ['deletelabel'] = $obj['DELETE_LABEL'];
if ((isset($obj['DOWNLOAD_LABEL'])) && ($obj['DOWNLOAD_LABEL']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL'];
@@ -623,7 +623,7 @@ function sortContent()
}
$tempTree ['downloadLabel'] = $obj['DOWNLOAD_LABEL'];
$tempTree ['downloadLink'] = $obj['DOWNLOAD_LINK'];
if ((isset($obj['DOWNLOAD_LABEL1'])) && ($obj['DOWNLOAD_LABEL1']!="")) {
$labelgen=strtoupper(str_replace(".","",$obj['DOWNLOAD_LABEL1']));
$tempTree ['downloadLabel'.$labelgen] = $obj['DOWNLOAD_LABEL1'];
@@ -631,30 +631,30 @@ function sortContent()
}
$tempTree ['downloadLabel1'] = $obj['DOWNLOAD_LABEL1'];
$tempTree ['downloadLink1'] = $obj['DOWNLOAD_LINK1'];
$tempTree ['appDocUidVersion'] = $obj['APP_DOC_UID_VERSION'];
$tempTree ['is_readable'] = true;
$tempTree ['is_file'] = true;
$tempTree["outDocGenerate"] = "";
if (isset($obj["OUT_DOC_GENERATE"])) {
switch ($obj["OUT_DOC_GENERATE"]) {
case "PDF":
case "DOC":
$mimeInformation = getMime($obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]));
$tempTree["text"] = $obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]);
$tempTree["name"] = $obj["APP_DOC_FILENAME"] . "." . strtolower($obj["OUT_DOC_GENERATE"]);
$tempTree["type"] = $mimeInformation["description"];
$tempTree["icon"] = $mimeInformation["icon"];
$tempTree["appDocFileName"] = $tempTree["name"];
$tempTree["downloadLabel"] = $tempTree["downloadLabel" . $obj["OUT_DOC_GENERATE"]];
$tempTree["downloadLink"] = $tempTree["downloadLink" . $obj["OUT_DOC_GENERATE"]];
$tempTree["id"] = $tempTree["id"] . "_" . $obj["OUT_DOC_GENERATE"];
$processListTree[] = $tempTree;
break;
case "BOTH":
@@ -664,20 +664,20 @@ function sortContent()
$strExpander = $strExpander . "<br />";
$mimeInformation = getMime($obj["APP_DOC_FILENAME"] . ".doc");
$strExpander = $strExpander . "<a href=\"javascript:;\" onclick=\"openActionDialog(this, 'download', 'doc'); return false;\" style=\"color: #000000; text-decoration: none;\"><img src=\"/images/documents/extension/doc.png\" style=\"margin-left: 25px; border: 0;\" alt=\"\" /> <b>" . $obj["APP_DOC_FILENAME"] . ".doc</b> (" . $mimeInformation["description"] . ")</a>";
$tempTree["outDocGenerate"] = $strExpander;
$tempTree["text"] = $obj["APP_DOC_FILENAME"];
$tempTree["name"] = $obj["APP_DOC_FILENAME"];
$tempTree["type"] = "";
$tempTree["icon"] = "/images/documents/extension/document.png";
$tempTree["appDocFileName"] = $tempTree["name"];
//$tempTree["downloadLabel"] = $obj["DOWNLOAD_LABEL"];
//$tempTree["downloadLink"] = $obj["DOWNLOAD_LINK"];
$tempTree["id"] = $tempTree["id"] . "_" . $obj["OUT_DOC_GENERATE"];
$processListTree[] = $tempTree;
break;
//case "NOFILE":
@@ -690,27 +690,27 @@ function sortContent()
) {
$ext = $arrayMatch[1];
$mimeInformation = getMime($obj["APP_DOC_FILENAME"] . ".$ext");
$tempTree["text"] = $obj["APP_DOC_FILENAME"] . ".$ext";
$tempTree["name"] = $obj["APP_DOC_FILENAME"] . ".$ext";
$tempTree["type"] = $mimeInformation["description"];
$tempTree["icon"] = $mimeInformation["icon"];
}
$processListTree[] = $tempTree;
}
$tempTree = array();
}
}
if ((isset($_POST['option'])) && ($_POST['option'] == "gridDocuments")) {
$processListTreeTemp["totalCount"] = $totalFolders + $totalDocuments;
$processListTreeTemp['msg']='correct reload';
$processListTreeTemp['items']=$processListTree;
$processListTree = $processListTreeTemp;
}
echo G::json_encode($processListTree);
}
@@ -1513,7 +1513,7 @@ function uploadExternalDocument()
$aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
}
//Get the Custom Folder ID (create if necessary)
$oFolder=new AppFolder();

View File

@@ -5,7 +5,7 @@ if (! isset( $_REQUEST['action'] )) {
print G::json_encode( $res );
die();
}
if (! function_exists( $_REQUEST['action'] )) {
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
$res['success'] = 'failure';
$res['message'] = 'The requested action does not exist';
header( "Content-Type: application/json" );

View File

@@ -13,7 +13,7 @@ if (! isset( $_REQUEST['action'] )) {
print G::json_encode( $res );
die();
}
if (! function_exists( $_REQUEST['action'] )) {
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
$res['success'] = 'failure';
$res['message'] = G::LoadTranslation( 'ID_REQUEST_ACTION_NOT_EXIST' );
print G::json_encode( $res );

View File

@@ -6,7 +6,7 @@ if (! isset( $_REQUEST['action'] )) {
print G::json_encode( $return );
die();
}
if (! function_exists( $_REQUEST['action'] )) {
if (! function_exists( $_REQUEST['action'] ) || !G::isUserFunction($_REQUEST['action'])) {
$return['success'] = 'failure';
$return['message'] = 'The requested action doesn\'t exists';
print G::json_encode( $return );

View File

@@ -102,7 +102,7 @@ Ext.onReady(function(){
clearTextButton = new Ext.Action({
text: 'X',
ctCls:'pm_search_x_button',
handler: GridByDefault
handler: GridByDefault
});
//This loop loads columns and fields to store and column model
@@ -463,14 +463,15 @@ onMessageContextMenu = function (grid, rowIndex, e) {
/////JS FUNCTIONS
//Do Search Function
DoSearch = function(){
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
infoGrid.store.setBaseParam('textFilter', searchText.getValue());
infoGrid.store.load({params: {start : 0 , limit : pageSize }});
};
//Load Grid By Default
GridByDefault = function(){
searchText.reset();
infoGrid.store.setBaseParam('textFilter', searchText.getValue());
infoGrid.store.load();
};