Merged in bugfix/HOR-3612 (pull request #6190)

HOR-3612

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2017-12-01 13:27:44 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 35 additions and 28 deletions

View File

@@ -185,6 +185,12 @@ class RBAC
'processes_GetFile.php' => [
'mailTemplates' => ['PM_FACTORY'],
'public' => ['PM_FACTORY']
],
'tools/ajaxListener.php' => [
'getList' => ['PM_SETUP'],
'save' => ['PM_SETUP'],
'delete' => ['PM_SETUP'],
'rebuild' => ['PM_SETUP']
]
];
$this->aliasPermissions['PM_CASES'] = [self::PM_GUEST_CASE];

View File

@@ -1,41 +1,24 @@
<?php
/**
* tools/ajaxListener.php Ajax Listener for Cases rpc requests
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
/**
*
* @author Erik Amaru Ortiz <erik@colosa.com>
* @date Jan 10th, 2010
*/
$action = $_REQUEST['action'];
unset($_REQUEST['action']);
global $RBAC;
$RBAC->allows(basename(dirname(__FILE__)) . PATH_SEP . basename(__FILE__), $action);
$ajax = new Ajax();
$ajax->$action($_REQUEST);
class Ajax
{
/**
* Get the list related to the translation
*
* @param array $params
*
* @return void
*/
public function getList($params)
{
$search = isset($params['search']) ? $params['search'] : null;
@@ -46,6 +29,11 @@ class Ajax
echo G::json_encode($result);
}
/**
* Save translation
*
* @return void
*/
public function save()
{
try {
@@ -53,6 +41,7 @@ class Ajax
$label = preg_replace("[\n|\r|\n\r]", ' ', $_POST['label']);
$res = Translation::addTranslation('LABEL', $id, 'en', $label);
$result = new stdClass();
if ($res['codError'] < 0) {
$result->success = false;
$result->msg = $res['message'];
@@ -67,10 +56,16 @@ class Ajax
print G::json_encode($result);
}
/**
* Delete translation
*
* @return void
*/
public function delete()
{
$ids = explode(',', $_POST['IDS']);
$category = 'LABEL';
$result = new stdClass();
try {
foreach ($ids as $id) {
@@ -89,8 +84,14 @@ class Ajax
print G::json_encode($result);
}
/**
* Rebuild translation
*
* @return void
*/
public function rebuild()
{
$result = new stdClass();
try {
$t = new Translation();
$result = Translation::generateFileTranslation('en');