BUG 5073 Feature Case Notes "Free Notes"
This Feature allow a user to post a note at any stage of a Case and from cases lists Conflicts: workflow/engine/data/mssql/schema.sql workflow/engine/methods/cases/casesListExtJs.php workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css workflow/engine/templates/cases/casesList.js workflow/engine/templates/cases/open.js
This commit is contained in:
72
workflow/engine/methods/cases/caseNotesAjax.php
Normal file
72
workflow/engine/methods/cases/caseNotesAjax.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
if (!isset($_REQUEST ['action'])) {
|
||||
$res ['success'] = 'failure';
|
||||
$res ['message'] = 'You may request an action';
|
||||
print json_encode($res);
|
||||
die ();
|
||||
}
|
||||
if (!function_exists($_REQUEST ['action'])) {
|
||||
$res ['success'] = 'failure';
|
||||
$res ['message'] = 'The requested action doesn\'t exists';
|
||||
header("Content-Type: application/json");
|
||||
print json_encode($res);
|
||||
die ();
|
||||
}
|
||||
|
||||
$functionName = $_REQUEST ['action'];
|
||||
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
|
||||
|
||||
$functionName($functionParams);
|
||||
|
||||
function getExtJSParams() {
|
||||
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '', 'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => "");
|
||||
$result = array();
|
||||
foreach ($validParams as $paramName => $paramDefault) {
|
||||
$result[$paramName] = isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function sendJsonResultGeneric($response, $callback) {
|
||||
header("Content-Type: application/json");
|
||||
$finalResponse = json_encode($response);
|
||||
if ($callback != '') {
|
||||
print $callback . "($finalResponse);";
|
||||
} else {
|
||||
print $finalResponse;
|
||||
}
|
||||
}
|
||||
|
||||
function getNotesList() {
|
||||
extract(getExtJSParams());
|
||||
require_once ( "classes/model/AppNotes.php" );
|
||||
if ((isset($_REQUEST['appUid'])) && (trim($_REQUEST['appUid']) != "")) {
|
||||
$appUid = $_REQUEST['appUid'];
|
||||
} else {
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
}
|
||||
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
|
||||
$appNotes = new AppNotes();
|
||||
$response = $appNotes->getNotesList($appUid, $usrUid, $start, $limit);
|
||||
sendJsonResultGeneric($response['array'], $callback);
|
||||
}
|
||||
|
||||
function postNote() {
|
||||
extract(getExtJSParams());
|
||||
if ((isset($_REQUEST['appUid'])) && (trim($_REQUEST['appUid']) != "")) {
|
||||
$appUid = $_REQUEST['appUid'];
|
||||
} else {
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
}
|
||||
$usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : "";
|
||||
require_once ( "classes/model/AppNotes.php" );
|
||||
|
||||
$noteContent=addslashes($_POST['noteText']);
|
||||
|
||||
$appNotes=new AppNotes();
|
||||
$response=$appNotes->postNewNote($appUid, $usrUid, $noteContent);
|
||||
|
||||
sendJsonResultGeneric($response, $callback);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user