PMC-1518 Restructure the offline definition over the PM Tables
This commit is contained in:
@@ -20087,6 +20087,24 @@ msgstr "User has been updated successfully"
|
|||||||
msgid "Off"
|
msgid "Off"
|
||||||
msgstr "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
|
# TRANSLATION
|
||||||
# LABEL/ID_OF_THE_MONTH
|
# LABEL/ID_OF_THE_MONTH
|
||||||
#: LABEL/ID_OF_THE_MONTH
|
#: LABEL/ID_OF_THE_MONTH
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
use ProcessMaker\Model\AdditionalTables as AdditionalTablesModel;
|
||||||
use ProcessMaker\Validation\ExceptionRestApi;
|
use ProcessMaker\Validation\ExceptionRestApi;
|
||||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
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
|
* 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_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_OBJECT_UPDATE','en','User has been updated successfully','2014-01-15') ,
|
||||||
( 'LABEL','ID_OFF','en','Off','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_OF_THE_MONTH','en','of the month(s)','2014-01-15') ,
|
||||||
( 'LABEL','ID_OK','en','Ok','2015-09-17') ,
|
( 'LABEL','ID_OK','en','Ok','2015-09-17') ,
|
||||||
( 'LABEL','ID_OLD_VERSION','en','old version','2014-01-15') ,
|
( 'LABEL','ID_OLD_VERSION','en','old version','2014-01-15') ,
|
||||||
|
|||||||
@@ -90,4 +90,16 @@ class AdditionalTables extends Model
|
|||||||
|
|
||||||
return $data;
|
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({
|
var frmDetails = new Ext.FormPanel({
|
||||||
id: 'frmDetails',
|
id: 'frmDetails',
|
||||||
@@ -811,7 +797,6 @@ Ext.onReady(function () {
|
|||||||
Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME);
|
Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME);
|
||||||
Ext.getCmp('REP_TAB_NAME').setDisabled(false);
|
Ext.getCmp('REP_TAB_NAME').setDisabled(false);
|
||||||
Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION);
|
Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION);
|
||||||
Ext.getCmp('checkboxAvailableOffline').setValue(TABLE.ADD_TAB_OFFLINE === 1);
|
|
||||||
loadTableRowsFromArray(TABLE.FIELDS);
|
loadTableRowsFromArray(TABLE.FIELDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,7 +926,6 @@ function createReportTable()
|
|||||||
REP_TAB_CONNECTION: "workflow",
|
REP_TAB_CONNECTION: "workflow",
|
||||||
REP_TAB_TYPE: "",
|
REP_TAB_TYPE: "",
|
||||||
REP_TAB_GRID: "",
|
REP_TAB_GRID: "",
|
||||||
REP_TAB_OFFLINE: Ext.getCmp("checkboxAvailableOffline").checked === true ? "1" : "0",
|
|
||||||
columns: Ext.util.JSON.encode(columns)
|
columns: Ext.util.JSON.encode(columns)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var editButton;
|
|||||||
var deleteButton;
|
var deleteButton;
|
||||||
var importButton;
|
var importButton;
|
||||||
var exportButton;
|
var exportButton;
|
||||||
|
var offlineEnableDisable;
|
||||||
var dataButton;
|
var dataButton;
|
||||||
|
|
||||||
var store;
|
var store;
|
||||||
@@ -108,6 +109,26 @@ Ext.onReady(function () {
|
|||||||
disabled: true
|
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({
|
dataButton = new Ext.Action({
|
||||||
id: 'dataButton',
|
id: 'dataButton',
|
||||||
text: ' ' + _('ID_DATA'),
|
text: ' ' + _('ID_DATA'),
|
||||||
@@ -252,18 +273,21 @@ Ext.onReady(function () {
|
|||||||
editButton.disable();
|
editButton.disable();
|
||||||
deleteButton.disable();
|
deleteButton.disable();
|
||||||
exportButton.disable();
|
exportButton.disable();
|
||||||
|
offlineEnableDisable.disable();
|
||||||
dataButton.disable();
|
dataButton.disable();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
editButton.enable();
|
editButton.enable();
|
||||||
deleteButton.enable();
|
deleteButton.enable();
|
||||||
exportButton.enable();
|
exportButton.enable();
|
||||||
|
offlineEnableDisable.enable();
|
||||||
dataButton.enable();
|
dataButton.enable();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
editButton.disable();
|
editButton.disable();
|
||||||
deleteButton.enable();
|
deleteButton.enable();
|
||||||
exportButton.enable();
|
exportButton.enable();
|
||||||
|
offlineEnableDisable.enable();
|
||||||
dataButton.disable();
|
dataButton.disable();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -365,6 +389,7 @@ Ext.onReady(function () {
|
|||||||
dataButton, '-',
|
dataButton, '-',
|
||||||
importButton,
|
importButton,
|
||||||
exportButton,
|
exportButton,
|
||||||
|
offlineEnableDisable,
|
||||||
'->',
|
'->',
|
||||||
searchText,
|
searchText,
|
||||||
clearTextButton,
|
clearTextButton,
|
||||||
@@ -515,6 +540,7 @@ DeletePMTable = function () {
|
|||||||
editButton.disable();
|
editButton.disable();
|
||||||
deleteButton.disable();
|
deleteButton.disable();
|
||||||
exportButton.disable();
|
exportButton.disable();
|
||||||
|
offlineEnableDisable.disable();
|
||||||
dataButton.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;
|
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) {
|
function PopupCenter(pageURL, title, w, h) {
|
||||||
var left = (Ext.getBody().getViewSize().width / 3);
|
var left = (Ext.getBody().getViewSize().width / 3);
|
||||||
@@ -947,4 +972,40 @@ function pmtablesErrors(aOverwrite, aRelated, aMessage) {
|
|||||||
for (i = 0; i < aOverwrite.length; i++) {
|
for (i = 0; i < aOverwrite.length; i++) {
|
||||||
Ext.get(aOverwrite[i]['NAME_TABLE']).setStyle({border: '0', marginTop: '0'});
|
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