up observations

This commit is contained in:
qronald
2017-05-24 08:39:04 -04:00
parent c0e80d1d32
commit 1063802933
2 changed files with 18 additions and 29 deletions

View File

@@ -125,24 +125,19 @@ switch ($_POST['action']) {
$result->success = true;
$result->groups = $arrData;
$result->total_groups = $data['totalCount'];
G::header('Content-Type: application/json');
echo G::json_encode( $result );
break;
case 'exitsGroupName':
$groupName = strip_tags($_POST['GRP_NAME']);
if ($groupName) {
require_once 'classes/model/Groupwf.php';
G::LoadClass('Groupswf');
$oGroup = new Groupwf();
$oCriteria = $oGroup->loadByGroupname($_POST['GRP_NAME']);
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
$response = ($aRow) ? \G::json_encode(['success' => true]) : \G::json_decode(['success' => false]);
} else {
$response = \G::json_encode(['success' => true, 'msg' => \G::LoadTranslation('ID_FIELD_INVALID')]);
}
require_once 'classes/model/Groupwf.php';
G::LoadClass( 'Groupswf' );
$oGroup = new Groupwf();
$oCriteria = $oGroup->loadByGroupname( $_POST['GRP_NAME'] );
$oDataset = GroupwfPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$response = ($aRow) ? 'true' : 'false';
echo $response;
break;
case 'saveNewGroup':

View File

@@ -182,13 +182,7 @@ Ext.onReady(function(){
text: _("ID_SAVE"),
handler: function (btn, ev)
{
var reg = new RegExp(/(<([^>]+)>)/ig),
nameGroups = newForm.getForm().findField('name').getValue();
if (reg.test(nameGroups)){
Ext.Msg.alert(_('ID_WARNING'), _("ID_FIELD_INVALID", _("ID_GROUP_NAME")));
newForm.getForm().findField('name').setValue("");
return false;
} else if (nameGroups.trim() == "") {
if( newForm.getForm().findField('name').getValue().trim() == "") {
Ext.Msg.alert(_('ID_WARNING'), _("ID_FIELD_REQUIRED", _("ID_GROUP_NAME")));
newForm.getForm().findField('name').setValue("");
return false;
@@ -440,8 +434,8 @@ CheckGroupName = function(grp_name, function_success, function_failure){
params: {action: 'exitsGroupName', GRP_NAME: grp_name},
success: function(resp, opt){
viewport.getEl().unmask();
var response = JSON.parse(resp.responseText);
(!response.success) ? function_success() : function_failure(response.msg);
var checked = eval(resp.responseText);
(!checked) ? function_success() : function_failure();
},
failure: function(r,o) {
viewport.getEl().unmask();
@@ -458,11 +452,11 @@ SaveNewGroupAction = function(){
};
//Show Duplicate Group Name Message
DuplicateGroupName = function (msg) {
Ext.getCmp("btnCreateSave").setDisabled(false);
Ext.getCmp("btnUpdateSave").setDisabled(false);
newForm.getForm().findField('name').setValue("");
PMExt.warning(_('ID_GROUPS'), msg ? msg : _('ID_MSG_GROUP_NAME_EXISTS'));
DuplicateGroupName = function(){
Ext.getCmp("btnCreateSave").setDisabled(false);
Ext.getCmp("btnUpdateSave").setDisabled(false);
PMExt.warning(_('ID_GROUPS'), _('ID_MSG_GROUP_NAME_EXISTS'));
};
//Save New Group