Merged in feature/PMC-1518 (pull request #7195)
PMC-1518 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -20087,6 +20087,24 @@ msgstr "User has been updated successfully"
|
||||
msgid "Off"
|
||||
msgstr "Off"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_OFFLINE_TABLES
|
||||
#: LABEL/ID_OFFLINE_TABLES
|
||||
msgid "Offline Tables"
|
||||
msgstr "Offline Tables"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_OFFLINE_TABLES_ENABLE
|
||||
#: LABEL/ID_OFFLINE_TABLES_ENABLE
|
||||
msgid "Set Offline"
|
||||
msgstr "Set Offline"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_OFFLINE_TABLES_DISABLE
|
||||
#: LABEL/ID_OFFLINE_TABLES_DISABLE
|
||||
msgid "Set Online"
|
||||
msgstr "Set Online"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_OF_THE_MONTH
|
||||
#: LABEL/ID_OF_THE_MONTH
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\AdditionalTables as AdditionalTablesModel;
|
||||
use ProcessMaker\Validation\ExceptionRestApi;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
|
||||
@@ -218,6 +219,34 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the offline property.
|
||||
* @param stdClass $httpData
|
||||
* @return stdClass
|
||||
*/
|
||||
public function updateOffline(stdClass $httpData): stdClass
|
||||
{
|
||||
$result = new stdClass();
|
||||
try {
|
||||
$array = G::json_decode(stripslashes($httpData->rows));
|
||||
$data = [];
|
||||
$enable = false;
|
||||
foreach ($array as $value) {
|
||||
if ($value->type !== "NORMAL") {
|
||||
$data[] = $value->id;
|
||||
$enable = $value->offline ? 1 : 0;
|
||||
}
|
||||
}
|
||||
AdditionalTablesModel::updatePropertyOffline($data, $enable);
|
||||
$result->success = true;
|
||||
$result->message = $enable ? G::LoadTranslation("ID_ENABLE") : G::LoadTranslation("ID_DISABLE");
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->message = $e->getMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete pm table
|
||||
*
|
||||
|
||||
@@ -60216,6 +60216,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_OBJECT_REMOVE','en','Object has been removed successfully','2014-01-15') ,
|
||||
( 'LABEL','ID_OBJECT_UPDATE','en','User has been updated successfully','2014-01-15') ,
|
||||
( 'LABEL','ID_OFF','en','Off','2014-01-15') ,
|
||||
( 'LABEL','ID_OFFLINE_TABLES','en','Offline Tables','2019-12-19') ,
|
||||
( 'LABEL','ID_OFFLINE_TABLES_ENABLE','en','Set Offline Tables','2019-12-19') ,
|
||||
( 'LABEL','ID_OFFLINE_TABLES_DISABLE','en','Set Online Tables','2019-12-19') ,
|
||||
( 'LABEL','ID_OF_THE_MONTH','en','of the month(s)','2014-01-15') ,
|
||||
( 'LABEL','ID_OK','en','Ok','2015-09-17') ,
|
||||
( 'LABEL','ID_OLD_VERSION','en','old version','2014-01-15') ,
|
||||
|
||||
@@ -90,4 +90,16 @@ class AdditionalTables extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the offline property.
|
||||
* @param array $tablesUid
|
||||
* @param int $value
|
||||
* @return void
|
||||
*/
|
||||
public static function updatePropertyOffline(array $tablesUid, $value): void
|
||||
{
|
||||
$query = AdditionalTables::whereIn('ADD_TAB_UID', $tablesUid)
|
||||
->update(['ADD_TAB_OFFLINE' => $value]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,20 +741,6 @@ Ext.onReady(function () {
|
||||
}
|
||||
]
|
||||
});
|
||||
items.push({
|
||||
layout: "column",
|
||||
style: "margin-left: 255px;",
|
||||
hidden: false,
|
||||
items: [
|
||||
{
|
||||
xtype: "checkbox",
|
||||
id: "checkboxAvailableOffline",
|
||||
name: "checkboxAvailableOffline",
|
||||
checked: false,
|
||||
boxLabel: _("ID_AVAILABLE_OFFLINE_THE_MOBILE_APPLICATIONS")
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
var frmDetails = new Ext.FormPanel({
|
||||
id: 'frmDetails',
|
||||
@@ -811,7 +797,6 @@ Ext.onReady(function () {
|
||||
Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME);
|
||||
Ext.getCmp('REP_TAB_NAME').setDisabled(false);
|
||||
Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION);
|
||||
Ext.getCmp('checkboxAvailableOffline').setValue(TABLE.ADD_TAB_OFFLINE === 1);
|
||||
loadTableRowsFromArray(TABLE.FIELDS);
|
||||
}
|
||||
|
||||
@@ -941,7 +926,6 @@ function createReportTable()
|
||||
REP_TAB_CONNECTION: "workflow",
|
||||
REP_TAB_TYPE: "",
|
||||
REP_TAB_GRID: "",
|
||||
REP_TAB_OFFLINE: Ext.getCmp("checkboxAvailableOffline").checked === true ? "1" : "0",
|
||||
columns: Ext.util.JSON.encode(columns)
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ var editButton;
|
||||
var deleteButton;
|
||||
var importButton;
|
||||
var exportButton;
|
||||
var offlineEnableDisable;
|
||||
var dataButton;
|
||||
|
||||
var store;
|
||||
@@ -108,6 +109,26 @@ Ext.onReady(function () {
|
||||
disabled: true
|
||||
});
|
||||
|
||||
offlineEnableDisable = new Ext.Action({
|
||||
id: 'offlineEnableDisable',
|
||||
text: _('ID_OFFLINE_TABLES'),
|
||||
iconCls: 'silk-add',
|
||||
icon: '/images/offline-pin.png',
|
||||
menu: [{
|
||||
text: _('ID_OFFLINE_TABLES_ENABLE'),
|
||||
handler: function () {
|
||||
OfflineEnableDisablePMTable(true);
|
||||
}
|
||||
}, {
|
||||
text: _('ID_OFFLINE_TABLES_DISABLE'),
|
||||
handler: function () {
|
||||
OfflineEnableDisablePMTable(false);
|
||||
}
|
||||
}
|
||||
],
|
||||
disabled: true
|
||||
});
|
||||
|
||||
dataButton = new Ext.Action({
|
||||
id: 'dataButton',
|
||||
text: ' ' + _('ID_DATA'),
|
||||
@@ -252,18 +273,21 @@ Ext.onReady(function () {
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
exportButton.disable();
|
||||
offlineEnableDisable.disable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
case 1:
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
offlineEnableDisable.enable();
|
||||
dataButton.enable();
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
offlineEnableDisable.enable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
}
|
||||
@@ -365,6 +389,7 @@ Ext.onReady(function () {
|
||||
dataButton, '-',
|
||||
importButton,
|
||||
exportButton,
|
||||
offlineEnableDisable,
|
||||
'->',
|
||||
searchText,
|
||||
clearTextButton,
|
||||
@@ -515,6 +540,7 @@ DeletePMTable = function () {
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
exportButton.disable();
|
||||
offlineEnableDisable.disable();
|
||||
dataButton.disable();
|
||||
}
|
||||
}
|
||||
@@ -777,7 +803,6 @@ function updateTagPermissions() {
|
||||
location.href = 'pmReports/reportsAjax?action=permissionList&ADD_TAB_NAME=' + rowsSelected[0].get('ADD_TAB_NAME') + '&ADD_TAB_UID=' + rowsSelected[0].get('ADD_TAB_UID') + '&pro_uid=' + PRO_UID + '&flagProcessmap=' + flagProcessmap;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
function PopupCenter(pageURL, title, w, h) {
|
||||
var left = (Ext.getBody().getViewSize().width / 3);
|
||||
@@ -948,3 +973,39 @@ function pmtablesErrors(aOverwrite, aRelated, aMessage) {
|
||||
Ext.get(aOverwrite[i]['NAME_TABLE']).setStyle({border: '0', marginTop: '0'});
|
||||
}
|
||||
}
|
||||
|
||||
function OfflineEnableDisablePMTable(enableDisable) {
|
||||
var rows = Ext.getCmp('infoGrid').getSelectionModel().getSelections();
|
||||
if (rows.length <= 0) {
|
||||
return;
|
||||
}
|
||||
var selections = [];
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
selections[i] = {
|
||||
id: rows[i].get('ADD_TAB_UID'),
|
||||
type: rows[i].get('ADD_TAB_TYPE'),
|
||||
offline: enableDisable
|
||||
};
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: 'pmTablesProxy/updateOffline',
|
||||
params: {
|
||||
rows: Ext.util.JSON.encode(selections)
|
||||
},
|
||||
success: function (response) {
|
||||
Ext.MessageBox.hide();
|
||||
var result = Ext.util.JSON.decode(response.responseText);
|
||||
if (result.success) {
|
||||
PMExt.notify(_("ID_OFFLINE_TABLES"), result.message.nl2br());
|
||||
} else {
|
||||
PMExt.error(_("ID_ERROR"), result.message.nl2br());
|
||||
}
|
||||
Ext.getCmp('infoGrid').getStore().reload();
|
||||
},
|
||||
failure: function (target, response) {
|
||||
Ext.MessageBox.hide();
|
||||
Ext.getCmp('infoGrid').getStore().reload();
|
||||
Ext.Msg.alert(_('ID_ERROR'), response.result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
BIN
workflow/public_html/images/offline-pin.png
Normal file
BIN
workflow/public_html/images/offline-pin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 317 B |
Reference in New Issue
Block a user