Grid 1.1 Solve Bugs: 5330, 6509, 6150, 6153, 6328
This commit is contained in:
@@ -1,16 +1,34 @@
|
|||||||
var G_Grid = function(oForm, sGridName){
|
var G_Grid = function(oForm, sGridName){
|
||||||
// G_Field integration - Start
|
|
||||||
var oGrid = this;
|
var oGrid = this;
|
||||||
this.parent = G_Field;
|
this.parent = G_Field;
|
||||||
this.parent(oForm, '', sGridName);
|
this.parent(oForm, '', sGridName);
|
||||||
// G_Field integration - End
|
|
||||||
this.sGridName = sGridName;
|
this.sGridName = sGridName;
|
||||||
this.sAJAXPage = oForm.ajaxServer || '';
|
this.sAJAXPage = oForm.ajaxServer || '';
|
||||||
this.oGrid = document.getElementById(this.sGridName);
|
this.oGrid = document.getElementById(this.sGridName);
|
||||||
|
this.onaddrow = function(iRow){};
|
||||||
|
this.ondeleterow = function(){};
|
||||||
|
|
||||||
this.aFields = [];
|
this.aFields = [];
|
||||||
this.aElements = [];
|
this.aElements = [];
|
||||||
this.aFunctions = [];
|
this.aFunctions = [];
|
||||||
this.aFormulas = [];
|
this.aFormulas = [];
|
||||||
|
|
||||||
|
this.allDependentFields = ''; //Stores all dependent fields
|
||||||
|
|
||||||
|
this.alertMe = function (txt){
|
||||||
|
new leimnud.module.app.alert().make( {
|
||||||
|
label : txt
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getObjectName = function(Name){
|
||||||
|
var arr = Name.split('][');
|
||||||
|
var aux = arr.pop();
|
||||||
|
aux = aux.replace(']','');
|
||||||
|
return aux;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Begin SetFields ---------------------------------------------------------------------
|
||||||
this.setFields = function(aFields, iRow) {
|
this.setFields = function(aFields, iRow) {
|
||||||
this.aFields = aFields;
|
this.aFields = aFields;
|
||||||
var i, j, k, aAux, oAux, sDependentFields;
|
var i, j, k, aAux, oAux, sDependentFields;
|
||||||
@@ -19,7 +37,8 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
switch (this.aFields[i].sType) {
|
switch (this.aFields[i].sType) {
|
||||||
case 'text':
|
case 'text':
|
||||||
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')){
|
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')){
|
||||||
this.aElements.push(new G_Text(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + ']['
|
this.aElements.push(
|
||||||
|
new G_Text(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + ']['
|
||||||
+ this.aFields[i].sFieldName));
|
+ this.aFields[i].sFieldName));
|
||||||
this.aElements[this.aElements.length - 1].validate = this.aFields[i].oProperties.validate;
|
this.aElements[this.aElements.length - 1].validate = this.aFields[i].oProperties.validate;
|
||||||
if(this.aFields[i].oProperties.strTo) {
|
if(this.aFields[i].oProperties.strTo) {
|
||||||
@@ -64,17 +83,23 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set dependent fields
|
// Set dependent fields
|
||||||
|
sw1 = false;
|
||||||
|
if (this.allDependentFields == '') sw1 = true; //Check if dependent fields are setted.
|
||||||
for (i = 0; i < this.aFields.length; i++) {
|
for (i = 0; i < this.aFields.length; i++) {
|
||||||
j = iRow || 1;
|
j = iRow || 1;
|
||||||
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
|
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
|
||||||
if (aFields[i].oProperties.dependentFields != '') {
|
if (aFields[i].oProperties.dependentFields != '') {
|
||||||
this.setDependents(j, this.getElementByName(j, this.aFields[i].sFieldName), aFields[i].oProperties.dependentFields);
|
this.setDependents(j, this.getElementByName(j, this.aFields[i].sFieldName), aFields[i].oProperties.dependentFields, sw1);
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.setDependents = function(iRow, me, theDependentFields) {
|
//End Set Fields --------------------------------------------------------
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
this.setDependents = function(iRow, me, theDependentFields, sw) {
|
||||||
var i;
|
var i;
|
||||||
var dependentFields = theDependentFields || '';
|
var dependentFields = theDependentFields || '';
|
||||||
dependentFields = dependentFields.split(',');
|
dependentFields = dependentFields.split(',');
|
||||||
@@ -83,9 +108,16 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
if (oField) {
|
if (oField) {
|
||||||
me.dependentFields[i] = oField;
|
me.dependentFields[i] = oField;
|
||||||
me.dependentFields[i].addDependencie(me);
|
me.dependentFields[i].addDependencie(me);
|
||||||
|
if (sw){ //Gets all dependent field only first time
|
||||||
|
if (this.allDependentFields != '') this.allDependentFields += ',';
|
||||||
|
this.allDependentFields += dependentFields[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.unsetFields = function() {
|
this.unsetFields = function() {
|
||||||
var i, j = 0, k, l = 0;
|
var i, j = 0, k, l = 0;
|
||||||
k = this.aElements.length / this.aFields.length;
|
k = this.aElements.length / this.aFields.length;
|
||||||
@@ -95,11 +127,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
l++;
|
l++;
|
||||||
this.aElements.splice(j - l, 1);
|
this.aElements.splice(j - l, 1);
|
||||||
}
|
}
|
||||||
//////for (i = 0; i < this.aElements.length ;i++) {
|
|
||||||
//////alert(this.aElements[i].name +" --- "+this.aElements[i].value());
|
|
||||||
//////}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
this.getElementByName = function(iRow, sName) {
|
this.getElementByName = function(iRow, sName) {
|
||||||
var i;
|
var i;
|
||||||
for (i = 0; i < this.aElements.length; i++) {
|
for (i = 0; i < this.aElements.length; i++) {
|
||||||
@@ -109,6 +139,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.getElementValueByName = function(iRow, sName) {
|
this.getElementValueByName = function(iRow, sName) {
|
||||||
var oAux = document.getElementById('form[' + this.sGridName + '][' + iRow + '][' + sName + ']');
|
var oAux = document.getElementById('form[' + this.sGridName + '][' + iRow + '][' + sName + ']');
|
||||||
if (oAux) {
|
if (oAux) {
|
||||||
@@ -117,6 +150,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
return 'Object not found!';
|
return 'Object not found!';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.getFunctionResult = function(sName) {
|
this.getFunctionResult = function(sName) {
|
||||||
var oAux = document.getElementById('form[SYS_GRID_AGGREGATE_' + this.sGridName + '_' + sName + ']');
|
var oAux = document.getElementById('form[SYS_GRID_AGGREGATE_' + this.sGridName + '_' + sName + ']');
|
||||||
if (oAux) {
|
if (oAux) {
|
||||||
@@ -126,227 +162,233 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.addGridRow = function() {
|
this.addGridRow = function() {
|
||||||
var i, aObjects, aDatePicker;
|
var i, aObjects, aDatePicker;
|
||||||
|
var defaultValue = '';
|
||||||
|
var gridType = '';
|
||||||
var oRow = document.getElementById('firstRow_' + this.sGridName);
|
var oRow = document.getElementById('firstRow_' + this.sGridName);
|
||||||
var aCells = oRow.getElementsByTagName('td');
|
var aCells = oRow.getElementsByTagName('td');
|
||||||
var oNewRow = this.oGrid.insertRow(this.oGrid.rows.length - 1);
|
var oNewRow = this.oGrid.insertRow(this.oGrid.rows.length - 1);
|
||||||
|
var currentRow = this.oGrid.rows.length - 2;
|
||||||
|
|
||||||
oNewRow.onmouseover=function(){
|
oNewRow.onmouseover=function(){
|
||||||
highlightRow(this, '#D9E8FF');
|
highlightRow(this, '#D9E8FF');
|
||||||
}
|
};
|
||||||
oNewRow.onmouseout=function(){
|
oNewRow.onmouseout=function(){
|
||||||
highlightRow(this, '#fff');
|
highlightRow(this, '#fff');
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// Clone Cells Loop
|
||||||
for (i = 0; i < aCells.length; i++) {
|
for (i = 0; i < aCells.length; i++) {
|
||||||
oNewRow.appendChild(aCells[i].cloneNode(true));
|
oNewRow.appendChild(aCells[i].cloneNode(true)); //Clone First Cell exactly.
|
||||||
if (i == 0) {
|
switch (i){
|
||||||
oNewRow.getElementsByTagName('td')[i].innerHTML = this.oGrid.rows.length - 2;
|
case 0:
|
||||||
} else {
|
oNewRow.getElementsByTagName('td')[i].innerHTML = currentRow;
|
||||||
if (i == (aCells.length - 1)) {
|
break;
|
||||||
oNewRow.getElementsByTagName('td')[i].innerHTML = oNewRow.getElementsByTagName('td')[i].innerHTML.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
case aCells.length - 1:
|
||||||
} else {
|
oNewRow.getElementsByTagName('td')[i].innerHTML = oNewRow.getElementsByTagName('td')[i].innerHTML.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
break;
|
||||||
if (aObjects) {
|
default:
|
||||||
if (aObjects[0]) {
|
eNodeName = aCells[i].innerHTML.substring(aCells[i].innerHTML.indexOf('<')+1, aCells[i].innerHTML.indexOf(' '));
|
||||||
if (aObjects[0].onclick) {
|
eNodeName = eNodeName.toLowerCase();
|
||||||
sAux = new String(aObjects[0].onclick);
|
switch(eNodeName){
|
||||||
eval('aObjects[0].onclick = ' + sAux.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]') + ';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enodename = aCells[i].innerHTML.substring(aCells[i].innerHTML.indexOf('<')+1, aCells[i].innerHTML.indexOf(' '));
|
|
||||||
enodename = enodename.toLowerCase();
|
|
||||||
|
|
||||||
switch (enodename) {
|
|
||||||
case 'input':
|
case 'input':
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('input');
|
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('input');
|
||||||
|
|
||||||
if (aObjects){
|
if (aObjects){
|
||||||
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
|
aObjects[0].id = newID;
|
||||||
aObjects[0].setAttribute('id', newID);
|
|
||||||
//aObjects[0].setAttribute('value', '');
|
|
||||||
aObjects[0].name = newID;
|
aObjects[0].name = newID;
|
||||||
if (/*@cc_on!@*/0) { // Internet Explorer test (needs to be modified for IE8)
|
|
||||||
aObjects[0].mergeAttributes(document.createElement("<INPUT id='" + newID + "' name='" + newID + "'/>"), false);
|
|
||||||
var aux = oNewRow.getElementsByTagName('td')[i].innerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
|
||||||
var attributDefaultValue;
|
|
||||||
if( tags.length >= 0 ){ //then it is not a datepicker
|
|
||||||
scriptTags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('script');
|
|
||||||
attributes = elementAttributesNS(aObjects[0], 'pm');
|
attributes = elementAttributesNS(aObjects[0], 'pm');
|
||||||
if(attributes.defaultvalue != undefined && attributes.defaultvalue != '')
|
if (attributes.defaultvalue != '' && typeof attributes.defaultvalue != 'undefined'){
|
||||||
attributDefaultValue=attributes.defaultvalue;
|
defaultValue = attributes.defaultvalue;
|
||||||
else
|
|
||||||
attributDefaultValue='';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aObjects[0].type != 'checkbox') {
|
|
||||||
if(attributDefaultValue!='' && attributDefaultValue!=undefined)
|
|
||||||
aObjects[0].value = attributDefaultValue;
|
|
||||||
else
|
|
||||||
aObjects[0].value = '';
|
|
||||||
}else{
|
}else{
|
||||||
aObjects[0].checked = false;
|
defaultValue = '';
|
||||||
}
|
}
|
||||||
if (aObjects[0].detachEvent) {
|
switch(aObjects[0].type){
|
||||||
try {
|
case 'text': //TEXTBOX, CURRENCY, PERCENTAGE, DATEPICKER
|
||||||
aObjects[0].detachEvent('onkeypress', this.getElementByName(1, aObjects[0].id.split('][')[2].replace(']', '')).validateKey);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
//Nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//verifying if it is a datepicker
|
|
||||||
tags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
tags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
||||||
|
if (tags.length == 2){ //DATEPICKER
|
||||||
if( tags.length == 2 ){ //then it is a datepicker
|
//Copy Images
|
||||||
scriptTags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('script');
|
img1 = tags[0].innerHTML;
|
||||||
datePickerTriggerId = tags[1].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
img2 = tags[1].innerHTML;
|
||||||
attributes = elementAttributesNS(aObjects[0], 'pm');
|
//Create new trigger name
|
||||||
|
var datePickerTriggerId = tags[1].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
oNewRow.getElementsByTagName('td')[i].removeChild(scriptTags[0]);
|
//Remove 'a' tag for date picker trigger
|
||||||
oNewRow.getElementsByTagName('td')[i].removeChild(tags[1]);
|
oNewRow.getElementsByTagName('td')[i].removeChild(tags[1]);
|
||||||
|
//Capture Script and remove
|
||||||
|
scriptTags = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('script');
|
||||||
|
oNewRow.getElementsByTagName('td')[i].removeChild(scriptTags[0]);
|
||||||
|
//Create 'a' to remove Date
|
||||||
if (tags[0].onclick){
|
if (tags[0].onclick){
|
||||||
evOnclick = new String(tags[0].onclick);
|
var onclickevn = new String(tags[0].onclick);
|
||||||
eval('tags[0].onclick = ' + evOnclick.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]') + ';');
|
eval('tags[0].onclick = ' + onclickevn.replace(/\[1\]/g, '\[' + currentRow + '\]') + ';');
|
||||||
}
|
}
|
||||||
|
//Create new 'a' to trigger DatePicker
|
||||||
var datePickerTrigger = document.createElement('a');
|
var a2 = document.createElement('a');
|
||||||
datePickerTrigger.id = datePickerTriggerId;
|
a2.id = datePickerTriggerId;
|
||||||
datePickerTrigger.name = datePickerTriggerId;
|
a2.innerHTML = img2;
|
||||||
|
oNewRow.getElementsByTagName('td')[i].appendChild(a2);
|
||||||
var datePickerTriggerImg = document.createElement('img');
|
//Load DatePicker Trigger
|
||||||
datePickerTriggerImg.src = '/images/pmdateicon.png';
|
|
||||||
datePickerTriggerImg.border = 0;
|
|
||||||
datePickerTriggerImg.width = 12;
|
|
||||||
datePickerTriggerImg.height = 12;
|
|
||||||
datePickerTriggerImg.style.position = 'relative';
|
|
||||||
datePickerTriggerImg.style.left = '-17px';
|
|
||||||
datePickerTriggerImg.style.top = '0px';
|
|
||||||
|
|
||||||
datePickerTrigger.appendChild(datePickerTriggerImg);
|
|
||||||
oNewRow.getElementsByTagName('td')[i].appendChild(datePickerTrigger);
|
|
||||||
datePicker4("", newID, attributes.mask, attributes.start, attributes.end, attributes.time);
|
datePicker4("", newID, attributes.mask, attributes.start, attributes.end, attributes.time);
|
||||||
}else {
|
|
||||||
if (/*@cc_on!@*/0) {
|
|
||||||
oNewRow.getElementsByTagName('td')[i].innerHTML = aux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('span');
|
|
||||||
if (aObjects) {
|
|
||||||
if (aObjects[0]) {
|
|
||||||
// aObjects[0].name =
|
|
||||||
// aObjects[0].name.replace(/\[1\]/g, '\[' +
|
|
||||||
// (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
aObjects[0].id = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
}
|
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
|
||||||
if (aObjects) {
|
|
||||||
if (aObjects[0]) {
|
|
||||||
if (aObjects[0].onclick) {
|
|
||||||
sAux = new String(aObjects[0].onclick);
|
|
||||||
eval('aObjects[0].onclick = ' + sAux.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]') + ';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('div');
|
|
||||||
|
|
||||||
if (aObjects.length > 0) {
|
|
||||||
|
|
||||||
if (aObjects[0]) {
|
|
||||||
aObjects[0].id = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
aObjects[0].name = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
if (aObjects[0].onclick) {
|
|
||||||
sAux = new String(aObjects[0].onclick);
|
|
||||||
eval('aObjects[0].onclick = ' + sAux.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]') + ';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
|
||||||
if (aObjects) {
|
|
||||||
if (aObjects[0]) {
|
|
||||||
if (aObjects[0].onclick) {
|
|
||||||
sAux = new String(aObjects[0].onclick);
|
|
||||||
eval('aObjects[0].onclick = ' + sAux.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]') + ';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
aObjects[0].value = defaultValue;
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'checkbox': //CHECKBOX
|
||||||
|
aObjects[0].checked = false;
|
||||||
|
aObjects[0].value = defaultValue;
|
||||||
|
break;
|
||||||
|
case 'hidden': //HIDDEN
|
||||||
|
aObjects[0].value = defaultValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aObjects = null;
|
||||||
|
break;
|
||||||
|
case 'textarea': //TEXTAREA
|
||||||
|
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('textarea');
|
||||||
|
if (aObjects){
|
||||||
|
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
|
aObjects[0].id = newID;
|
||||||
|
aObjects[0].name = newID;
|
||||||
|
attributes = elementAttributesNS(aObjects[0], 'pm');
|
||||||
|
if (attributes.defaultvalue != '' && typeof attributes.defaultvalue != 'undefined'){
|
||||||
|
defaultValue = attributes.defaultvalue;
|
||||||
|
}else{
|
||||||
|
defaultValue = '';
|
||||||
|
}
|
||||||
|
aObjects[0].innerHTML = defaultValue;
|
||||||
|
}
|
||||||
|
aObjects = null;
|
||||||
|
break;
|
||||||
|
case 'select': //DROPDOWN
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('select');
|
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('select');
|
||||||
if (aObjects){
|
if (aObjects){
|
||||||
|
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
|
aObjects[0].id = newID;
|
||||||
|
aObjects[0].name = newID;
|
||||||
|
attributes = elementAttributesNS(aObjects[0], 'pm');
|
||||||
|
if (attributes.defaultvalue != '' && typeof attributes.defaultvalue != 'undefined'){
|
||||||
|
defaultValue = attributes.defaultvalue;
|
||||||
|
//Set '' for Default Value when dropdown has dependent fields.
|
||||||
|
if (attributes.dependent == '1') defaultValue = '';
|
||||||
|
}else{
|
||||||
|
defaultValue = '';
|
||||||
|
}
|
||||||
|
if (attributes.gridtype != '' && typeof attributes.gridtype != 'undefined'){
|
||||||
|
gridType = attributes.gridtype;
|
||||||
|
}else{
|
||||||
|
gridType = '';
|
||||||
|
}
|
||||||
|
aDependents = this.allDependentFields.split(',');
|
||||||
|
sObject = this.getObjectName(newID);
|
||||||
|
//Check if dropdow is dependent
|
||||||
|
sw = false;
|
||||||
|
for (x=0; x < aDependents.length; x++){
|
||||||
|
if (aDependents[x] == sObject) sw = true;
|
||||||
|
}
|
||||||
|
//Delete Options if dropdow is dependent
|
||||||
|
//only remains empty value
|
||||||
|
if (sw){
|
||||||
var oAux = document.createElement(aObjects[0].tagName);
|
var oAux = document.createElement(aObjects[0].tagName);
|
||||||
oAux.name = aObjects[0].name.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
oAux.setAttribute("required", aObjects[0].getAttribute("required"));
|
|
||||||
oAux.id = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
for ( var j = 0; j < aObjects[0].options.length; j++) {
|
for ( var j = 0; j < aObjects[0].options.length; j++) {
|
||||||
|
if (aObjects[0].options[j].value == ''){
|
||||||
var oOption = document.createElement('OPTION');
|
var oOption = document.createElement('OPTION');
|
||||||
oOption.value = aObjects[0].options[j].value;
|
oOption.value = aObjects[0].options[j].value;
|
||||||
oOption.text = aObjects[0].options[j].text;
|
oOption.text = aObjects[0].options[j].text;
|
||||||
oAux.options.add(oOption);
|
oAux.options.add(oOption);
|
||||||
}
|
}
|
||||||
aObjects[0].parentNode.replaceChild(oAux, aObjects[0]);
|
|
||||||
/**
|
|
||||||
* note added by gustavo cruz gustavo-at-colosa-dot-com
|
|
||||||
* the piece of code below has been comented in revision 2123
|
|
||||||
* i have tested it and seems to work well, please check this.
|
|
||||||
* aObjects[0].name.replace(/\[1\]/g, '\[' +
|
|
||||||
* (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
* aObjects[0].id = aObjects[0].id.replace(/\[1\]/g,
|
|
||||||
* '\[' + (this.oGrid.rows.length - 2) + '\]');
|
|
||||||
* aObjects[0].selectedIndex = 0;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
break;
|
aObjects[0].innerHTML = ''; //Delete options
|
||||||
case 'textarea':
|
for (var r =0; r < oAux.options.length; r++){
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('textarea');
|
var xOption = document.createElement('OPTION');
|
||||||
if (aObjects) {
|
xOption.value = oAux.options[r].value;
|
||||||
aObjects[0].name = aObjects[0].name.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
xOption.text = oAux.options[r].text;
|
||||||
aObjects[0].id = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
aObjects[0].options.add(xOption);
|
||||||
aObjects[0].value = '';
|
|
||||||
}
|
}
|
||||||
break;
|
}else{
|
||||||
|
//Set Default Value if it's not a Dependent Field
|
||||||
case 'a':
|
if (defaultValue != ''){
|
||||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
var oAux = document.createElement(aObjects[0].tagName);
|
||||||
if (aObjects) {
|
for ( var j = 0; j < aObjects[0].options.length; j++) {
|
||||||
aObjects[0].name = aObjects[0].name.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
var oOption = document.createElement('OPTION');
|
||||||
aObjects[0].id = aObjects[0].id.replace(/\[1\]/g, '\[' + (this.oGrid.rows.length - 2) + '\]');
|
oOption.value = aObjects[0].options[j].value;
|
||||||
aObjects[0].value = '';
|
oOption.text = aObjects[0].options[j].text;
|
||||||
|
if (aObjects[0].options[j].value === defaultValue){
|
||||||
|
oOption.setAttribute('selected','selected');
|
||||||
|
}
|
||||||
|
oAux.options.add(oOption);
|
||||||
|
}
|
||||||
|
aObjects[0].innerHTML = ''; //Delete options
|
||||||
|
for (var r =0; r < oAux.options.length; r++){
|
||||||
|
var xOption = document.createElement('OPTION');
|
||||||
|
xOption.value = oAux.options[r].value;
|
||||||
|
xOption.text = oAux.options[r].text;
|
||||||
|
if (_BROWSER.name == 'msie'){
|
||||||
|
if (oAux.options[r].getAttribute('selected') != ''){
|
||||||
|
xOption.setAttribute('selected','selected');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (oAux.options[r].getAttribute('selected') == 'selected'){
|
||||||
|
xOption.setAttribute('selected','selected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aObjects[0].options.add(xOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TODO: Implement Default Value and Dependent Fields Trigger for grid dropdowns
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
oNewRow.getElementsByTagName('td')[i].innerHTML = ' ';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
aObjects = null;
|
aObjects = null;
|
||||||
|
break;
|
||||||
|
case 'a': //LINKS
|
||||||
|
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('a');
|
||||||
|
if (aObjects){
|
||||||
|
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||||
|
aObjects[0].id = newID;
|
||||||
|
aObjects[0].name = newID;
|
||||||
|
}
|
||||||
|
aObjects = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (this.aFields.length > 0) {
|
if (this.aFields.length > 0) {
|
||||||
this.setFields(this.aFields, this.oGrid.rows.length - 2);
|
this.setFields(this.aFields, currentRow);
|
||||||
}
|
}
|
||||||
if (this.aFunctions.length > 0) {
|
if (this.aFunctions.length > 0) {
|
||||||
this.assignFunctions(this.aFunctions, 'change', this.oGrid.rows.length - 2);
|
this.assignFunctions(this.aFunctions, 'change', currentRow);
|
||||||
}
|
}
|
||||||
if (this.aFormulas.length > 0) {
|
if (this.aFormulas.length > 0) {
|
||||||
this.assignFormulas(this.aFormulas, 'change', this.oGrid.rows.length - 2);
|
this.assignFormulas(this.aFormulas, 'change', currentRow);
|
||||||
}
|
}
|
||||||
|
//Recalculate functions if are declared
|
||||||
|
if (this.aFunctions.length > 0) {
|
||||||
|
for (i = 0; i < this.aFunctions.length; i++) {
|
||||||
|
oAux = document.getElementById('form[' + this.sGridName + '][' + currentRow + '][' + this.aFunctions[i].sFieldName + ']');
|
||||||
|
if (oAux) {
|
||||||
|
switch (this.aFunctions[i].sFunction) {
|
||||||
|
case 'sum':
|
||||||
|
this.sum(false, oAux);
|
||||||
|
break;
|
||||||
|
case 'avg':
|
||||||
|
this.avg(false, oAux);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Fires OnAddRow Event
|
||||||
|
//FIXME: This feature does not work in IE
|
||||||
if (this.onaddrow) {
|
if (this.onaddrow) {
|
||||||
this.onaddrow(this.oGrid.rows.length - 2);
|
this.onaddrow(currentRow);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
this.deleteGridRow = function(sRow) {
|
this.deleteGridRow = function(sRow) {
|
||||||
var i, iRow, iRowAux, oAux, ooAux;
|
var i, iRow, iRowAux, oAux, ooAux;
|
||||||
if (this.oGrid.rows.length == 3) {
|
if (this.oGrid.rows.length == 3) {
|
||||||
@@ -368,7 +410,7 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
* Dynaform - by Nyeke <erik@colosa.com
|
* Dynaform - by Nyeke <erik@colosa.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
deleteRowOnDybaform(this, iRow);
|
deleteRowOnDynaform(this, iRow);
|
||||||
|
|
||||||
iRowAux = iRow + 1;
|
iRowAux = iRow + 1;
|
||||||
while (iRowAux <= (this.oGrid.rows.length - 2)) {
|
while (iRowAux <= (this.oGrid.rows.length - 2)) {
|
||||||
@@ -487,37 +529,12 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.aFunctions.length > 0) {
|
if (this.aFunctions.length > 0) {
|
||||||
|
|
||||||
for (i = 0; i < this.aFunctions.length; i++) {
|
for (i = 0; i < this.aFunctions.length; i++) {
|
||||||
oAux = document.getElementById('form[' + this.sGridName + '][1][' + this.aFunctions[i].sFieldName + ']');
|
oAux = document.getElementById('form[' + this.sGridName + '][1][' + this.aFunctions[i].sFieldName + ']');
|
||||||
if (oAux) {
|
if (oAux) {
|
||||||
switch (this.aFunctions[i].sFunction) {
|
switch (this.aFunctions[i].sFunction) {
|
||||||
case 'sum':
|
case 'sum':
|
||||||
this.sum(false, oAux);
|
this.sum(false, oAux);
|
||||||
/*
|
|
||||||
aaAux=oAux.name.split('][');
|
|
||||||
sNamef=aaAux[2].replace(']', '');
|
|
||||||
var sumaSol = 0;
|
|
||||||
this.aElements.length;
|
|
||||||
var j=1;k=0;
|
|
||||||
for ( var i = 0; i < this.aElements.length; i++) {
|
|
||||||
nnName= this.aElements[i].name.split('][');
|
|
||||||
if (nnName[2] == sNamef && j <= (this.oGrid.rows.length-2)){
|
|
||||||
ooAux=this.getElementByName(j, nnName[2]);
|
|
||||||
|
|
||||||
if(ooAux!=null){
|
|
||||||
|
|
||||||
sumaSol += parseFloat(G.cleanMask(ooAux.value() || 0, ooAux.mask).result.replace(/,/g, ''))
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sumaSol = sumaSol.toFixed(2);
|
|
||||||
oAux = document.getElementById('form[SYS_GRID_AGGREGATE_' + oGrid.sGridName + '_' + sNamef + ']');
|
|
||||||
oAux.value = sumaSol;
|
|
||||||
oAux = document.getElementById('form[SYS_GRID_AGGREGATE_' + oGrid.sGridName + '__' + sNamef + ']');
|
|
||||||
oAux.innerHTML = sumaSol;//return;
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
case 'avg':
|
case 'avg':
|
||||||
this.avg(false, oAux);
|
this.avg(false, oAux);
|
||||||
@@ -526,6 +543,8 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Fires OnAddRow Event
|
||||||
|
//FIXME: This feature does not work in IE
|
||||||
if (this.ondeleterow) {
|
if (this.ondeleterow) {
|
||||||
this.ondeleterow();
|
this.ondeleterow();
|
||||||
}
|
}
|
||||||
@@ -533,6 +552,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}.extend(this)
|
}.extend(this)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.assignFunctions = function(aFields, sEvent, iRow) {
|
this.assignFunctions = function(aFields, sEvent, iRow) {
|
||||||
iRow = iRow || 1;
|
iRow = iRow || 1;
|
||||||
var i, j, oAux;
|
var i, j, oAux;
|
||||||
@@ -566,10 +588,16 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.setFunctions = function(aFunctions) {
|
this.setFunctions = function(aFunctions) {
|
||||||
this.aFunctions = aFunctions;
|
this.aFunctions = aFunctions;
|
||||||
this.assignFunctions(this.aFunctions, 'change');
|
this.assignFunctions(this.aFunctions, 'change');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.sum = function(oEvent, oDOM) {
|
this.sum = function(oEvent, oDOM) {
|
||||||
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
||||||
var i, aAux, oAux, fTotal, sMask, nnName;
|
var i, aAux, oAux, fTotal, sMask, nnName;
|
||||||
@@ -584,7 +612,7 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
if (aAux[2] == nnName[2] && j <= (this.oGrid.rows.length-2)){
|
if (aAux[2] == nnName[2] && j <= (this.oGrid.rows.length-2)){
|
||||||
oAux=this.getElementByName(j, nnName[2]);
|
oAux=this.getElementByName(j, nnName[2]);
|
||||||
if(oAux!=null){
|
if(oAux!=null){
|
||||||
fTotal += parseFloat(G.cleanMask(oAux.value() || 0, oAux.mask).result.replace(/,/g, ''))
|
fTotal += parseFloat(G.cleanMask(oAux.value() || 0, oAux.mask).result.replace(/,/g, ''));
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@@ -602,6 +630,8 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
// oAux.innerHTML = G.toMask(fTotal, sMask).result;
|
// oAux.innerHTML = G.toMask(fTotal, sMask).result;
|
||||||
oAux.innerHTML = fTotal;
|
oAux.innerHTML = fTotal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
this.avg = function(oEvent, oDOM) {
|
this.avg = function(oEvent, oDOM) {
|
||||||
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
||||||
var i, aAux, oAux, fTotal, sMask;
|
var i, aAux, oAux, fTotal, sMask;
|
||||||
@@ -630,6 +660,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
oAux.innerHTML = 0;
|
oAux.innerHTML = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.assignFormulas = function(aFields, sEvent, iRow) {
|
this.assignFormulas = function(aFields, sEvent, iRow) {
|
||||||
iRow = iRow || 1;
|
iRow = iRow || 1;
|
||||||
var i, j, oAux;
|
var i, j, oAux;
|
||||||
@@ -646,10 +679,14 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
this.setFormulas = function(aFormulas) {
|
this.setFormulas = function(aFormulas) {
|
||||||
this.aFormulas = aFormulas;
|
this.aFormulas = aFormulas;
|
||||||
this.assignFormulas(this.aFormulas, 'change');
|
this.assignFormulas(this.aFormulas, 'change');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
this.evaluateFormula = function(oEvent, oDOM, oField) {
|
this.evaluateFormula = function(oEvent, oDOM, oField) {
|
||||||
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
|
||||||
var aAux, sAux, i, oAux;
|
var aAux, sAux, i, oAux;
|
||||||
@@ -919,7 +956,9 @@ var G_Grid = function(oForm, sGridName) {
|
|||||||
* [integer: row index]
|
* [integer: row index]
|
||||||
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@mail.com>
|
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@mail.com>
|
||||||
*/
|
*/
|
||||||
function deleteRowOnDybaform(grid, sRow) {
|
|
||||||
|
|
||||||
|
function deleteRowOnDynaform(grid, sRow) {
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp( {
|
var oRPC = new leimnud.module.rpc.xmlhttp( {
|
||||||
url : '../gulliver/genericAjax',
|
url : '../gulliver/genericAjax',
|
||||||
args : 'request=deleteGridRowOnDynaform&gridname=' + grid.sGridName + '&rowpos=' + sRow
|
args : 'request=deleteGridRowOnDynaform&gridname=' + grid.sGridName + '&rowpos=' + sRow
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class XmlForm_Field {
|
|||||||
var $group = 0;
|
var $group = 0;
|
||||||
var $mode = '';
|
var $mode = '';
|
||||||
var $defaultValue = NULL;
|
var $defaultValue = NULL;
|
||||||
|
var $gridFieldType = '';
|
||||||
/*to change the presentation*/
|
/*to change the presentation*/
|
||||||
var $enableHtml = false;
|
var $enableHtml = false;
|
||||||
var $style = '';
|
var $style = '';
|
||||||
@@ -667,6 +668,52 @@ class XmlForm_Field {
|
|||||||
}
|
}
|
||||||
return $sValue;
|
return $sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares NS Default Text
|
||||||
|
* @author Enrique Ponce de Leon <enrique@colosa.com>
|
||||||
|
* @param boolean optional (true = always show, false = show only if not empty)
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function NSDefaultValue($show = false){
|
||||||
|
$idv = 'pm:defaultvalue="'.$this->defaultValue.'"';
|
||||||
|
if ($show){
|
||||||
|
return $idv;
|
||||||
|
}else{
|
||||||
|
return ($this->defaultValue != '')? $idv : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares NS Grid Type
|
||||||
|
* @author Enrique Ponce de Leon <enrique@colosa.com>
|
||||||
|
* @param boolean optional (true = always show, false = show only if not empty)
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function NSGridType($show = false){
|
||||||
|
$igt = 'pm:gridtype="'.$this->gridFieldType.'"';
|
||||||
|
if ($show){
|
||||||
|
return $igt;
|
||||||
|
}else{
|
||||||
|
return ($this->gridFieldType != '')? $igt : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares NS Grid Type
|
||||||
|
* @author Enrique Ponce de Leon <enrique@colosa.com>
|
||||||
|
* @param boolean optional (true = always show, false = show only if not empty)
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function NSDependentFields($show = false){
|
||||||
|
$idf = 'pm:dependent="'.(($this->dependentFields != '')? '1':'0').'"';
|
||||||
|
if ($show){
|
||||||
|
return $idf;
|
||||||
|
}else{
|
||||||
|
return ($this->dependentFields != '')? $idf : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Class XmlForm_Field_Title
|
* Class XmlForm_Field_Title
|
||||||
@@ -788,14 +835,18 @@ class XmlForm_Field_SimpleText extends XmlForm_Field
|
|||||||
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
||||||
// that it means not required or required respectively.
|
// that it means not required or required respectively.
|
||||||
$this->mode = $this->modeForGrid;
|
$this->mode = $this->modeForGrid;
|
||||||
|
if (isNewDynaform($owner)=='1'){
|
||||||
|
$values = array();
|
||||||
|
$values[] = $this->defaultValue;
|
||||||
|
}
|
||||||
foreach ( $values as $v ) {
|
foreach ( $values as $v ) {
|
||||||
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
||||||
if ($this->readOnly)
|
if ($this->readOnly)
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>';
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
|
||||||
else
|
else
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '"style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>';
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '"style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
|
||||||
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '"style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' required="' . $isRequired . '"style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
||||||
} else {
|
} else {
|
||||||
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
||||||
}
|
}
|
||||||
@@ -901,6 +952,7 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText
|
|||||||
} else {
|
} else {
|
||||||
$isRequired = '0';
|
$isRequired = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note added by Gustavo Cruz
|
// Note added by Gustavo Cruz
|
||||||
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
||||||
// that it means not required or required respectively.
|
// that it means not required or required respectively.
|
||||||
@@ -917,11 +969,11 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText
|
|||||||
$v =($v!='')?$v:$this->defaultValue;
|
$v =($v!='')?$v:$this->defaultValue;
|
||||||
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
||||||
if ($this->readOnly)
|
if ($this->readOnly)
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" pm:defaultvalue="'.$this->defaultValue.'"/>';
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>';
|
||||||
else
|
else
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" pm:defaultvalue="'.$this->defaultValue.'"/>';
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>';
|
||||||
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
||||||
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
$result [] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '" required="' . $isRequired . '" style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
||||||
} else {
|
} else {
|
||||||
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
||||||
}
|
}
|
||||||
@@ -993,7 +1045,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
|
|||||||
function render($value = NULL, $owner = NULL)
|
function render($value = NULL, $owner = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
//echo $this->sqlConnection;
|
|
||||||
if (! $this->sqlConnection)
|
if (! $this->sqlConnection)
|
||||||
$this->sqlConnection = 'workflow';
|
$this->sqlConnection = 'workflow';
|
||||||
|
|
||||||
@@ -1289,6 +1341,8 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
|
|||||||
var $wrap = 'OFF';
|
var $wrap = 'OFF';
|
||||||
var $hint = '';
|
var $hint = '';
|
||||||
var $className;
|
var $className;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function render
|
* Function render
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
@@ -1337,6 +1391,7 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function renderGrid($values = NULL, $owner) {
|
function renderGrid($values = NULL, $owner) {
|
||||||
|
$this->gridFieldType = 'textarea';
|
||||||
// Note added by Gustavo Cruz
|
// Note added by Gustavo Cruz
|
||||||
// set the variable isRequired if the needs to be validated
|
// set the variable isRequired if the needs to be validated
|
||||||
if ($this->required){
|
if ($this->required){
|
||||||
@@ -1344,6 +1399,12 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
|
|||||||
} else {
|
} else {
|
||||||
$isRequired = '0';
|
$isRequired = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNewDynaform($owner)==1){
|
||||||
|
echo 'Nuevo';
|
||||||
|
$values = array();
|
||||||
|
$values[] = $this->defaultValue;
|
||||||
|
}
|
||||||
// Note added by Gustavo Cruz
|
// Note added by Gustavo Cruz
|
||||||
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
|
||||||
// that it means not required or required respectively.
|
// that it means not required or required respectively.
|
||||||
@@ -1353,11 +1414,11 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
|
|||||||
$this->mode = $this->modeForGrid;
|
$this->mode = $this->modeForGrid;
|
||||||
foreach ( $values as $v ) {
|
foreach ( $values as $v ) {
|
||||||
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
|
||||||
|
if (is_null($v)) $v = $this->defaultValue;
|
||||||
if ($this->readOnly)
|
if ($this->readOnly)
|
||||||
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" readOnly="readOnly">'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" readOnly="readOnly" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
||||||
else
|
else
|
||||||
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '">'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
||||||
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
|
||||||
|
|
||||||
if (stristr ( $_SERVER ['HTTP_USER_AGENT'], 'iPhone' )) {
|
if (stristr ( $_SERVER ['HTTP_USER_AGENT'], 'iPhone' )) {
|
||||||
@@ -1365,7 +1426,7 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
|
|||||||
|
|
||||||
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
|
||||||
} else { //start add Alvaro
|
} else { //start add Alvaro
|
||||||
$varaux = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '">'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
$varaux = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
|
||||||
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'<div style="display:none;">'.$varaux.'</div>';
|
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'<div style="display:none;">'.$varaux.'</div>';
|
||||||
//end add Alvaro
|
//end add Alvaro
|
||||||
}
|
}
|
||||||
@@ -1398,6 +1459,7 @@ class XmlForm_Field_Currency extends XmlForm_Field_SimpleText {
|
|||||||
var $formula = '';
|
var $formula = '';
|
||||||
var $function = '';
|
var $function = '';
|
||||||
var $hint;
|
var $hint;
|
||||||
|
var $gridFieldType = 'currency';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* render the field in a dynaform
|
* render the field in a dynaform
|
||||||
@@ -1406,13 +1468,17 @@ class XmlForm_Field_Currency extends XmlForm_Field_SimpleText {
|
|||||||
* @return <String>
|
* @return <String>
|
||||||
*/
|
*/
|
||||||
function render( $value = NULL, $owner = NULL) {
|
function render( $value = NULL, $owner = NULL) {
|
||||||
|
//$this->gridFieldType = 'currency';
|
||||||
|
if (isNewDynaform($owner)==1){
|
||||||
|
$value = $this->defaultValue;
|
||||||
|
}
|
||||||
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
|
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
|
||||||
if ($this->mode === 'edit') {
|
if ($this->mode === 'edit') {
|
||||||
if ($this->readOnly)
|
if ($this->readOnly)
|
||||||
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
|
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$html = '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
|
$html = '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
|
||||||
|
|
||||||
if($this->hint){
|
if($this->hint){
|
||||||
$html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
|
$html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
|
||||||
@@ -1464,11 +1530,10 @@ class XmlForm_Field_Percentage extends XmlForm_Field_SimpleText {
|
|||||||
var $formula = '';
|
var $formula = '';
|
||||||
var $function = '';
|
var $function = '';
|
||||||
var $hint;
|
var $hint;
|
||||||
|
var $gridFieldType = 'percentage';
|
||||||
|
|
||||||
function render( $value = NULL, $owner = NULL) {
|
function render( $value = NULL, $owner = NULL) {
|
||||||
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
|
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
|
||||||
|
|
||||||
if ($this->mode === 'edit') {
|
if ($this->mode === 'edit') {
|
||||||
if ($this->readOnly)
|
if ($this->readOnly)
|
||||||
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
|
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities ( $value, ENT_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
|
||||||
@@ -1780,11 +1845,18 @@ class XmlForm_Field_YesNo extends XmlForm_Field
|
|||||||
* @return <array>
|
* @return <array>
|
||||||
*/
|
*/
|
||||||
function renderGrid($values = array(), $owner) {
|
function renderGrid($values = array(), $owner) {
|
||||||
|
$this->gridFieldType = 'yesno';
|
||||||
$result = array ();
|
$result = array ();
|
||||||
$r = 1;
|
$r = 1;
|
||||||
|
|
||||||
|
if (isNewDynaform($owner)==1){
|
||||||
|
$values = array();
|
||||||
|
$values[] = $this->defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->mode = $this->modeForGrid;
|
$this->mode = $this->modeForGrid;
|
||||||
foreach ( $values as $v ) {
|
foreach ( $values as $v ) {
|
||||||
$html = (($this->mode == 'view' || $owner->modeGrid == 'view')? ($v === '0' ? 'NO' : 'YES') : '') . '<select id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->mode == 'view' || $owner->modeGrid == 'view')? ' style="display:none;"' : '') . '>';
|
$html = (($this->mode == 'view' || $owner->modeGrid == 'view')? ($v === '0' ? 'NO' : 'YES') : '') . '<select id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->mode == 'view' || $owner->modeGrid == 'view')? ' style="display:none;"' : '') . ' '.$this->NSDefaultValue().' '.$this->NSGridType().'>';
|
||||||
$html .= '<option value="' . '0' . '"' . ($v === '0' ? ' selected' : '') . '>' . 'NO' . '</input>';
|
$html .= '<option value="' . '0' . '"' . ($v === '0' ? ' selected' : '') . '>' . 'NO' . '</input>';
|
||||||
$html .= '<option value="' . '1' . '"' . ($v === '1' ? ' selected' : '') . '>' . 'YES' . '</input>';
|
$html .= '<option value="' . '1' . '"' . ($v === '1' ? ' selected' : '') . '>' . 'YES' . '</input>';
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
@@ -1923,7 +1995,6 @@ class XmlForm_Field_Dropdownpt extends XmlForm_Field {
|
|||||||
function render($value = NULL, $owner = NULL) {
|
function render($value = NULL, $owner = NULL) {
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
|
|
||||||
//G::pr($this->value); die;
|
|
||||||
$id = $this->value->id;
|
$id = $this->value->id;
|
||||||
$value = isset($this->value->value)? $this->value->value: '';
|
$value = isset($this->value->value)? $this->value->value: '';
|
||||||
$items = $this->value->items;
|
$items = $this->value->items;
|
||||||
@@ -2076,6 +2147,7 @@ class XmlForm_Field_Checkbox extends XmlForm_Field
|
|||||||
*/
|
*/
|
||||||
function renderGrid($values = array(), $owner)
|
function renderGrid($values = array(), $owner)
|
||||||
{
|
{
|
||||||
|
$this->gridFieldType = 'checkbox';
|
||||||
$result = array ();
|
$result = array ();
|
||||||
$r = 1;
|
$r = 1;
|
||||||
foreach ( $values as $v ) {
|
foreach ( $values as $v ) {
|
||||||
@@ -2087,7 +2159,7 @@ class XmlForm_Field_Checkbox extends XmlForm_Field
|
|||||||
$disabled = '';
|
$disabled = '';
|
||||||
}
|
}
|
||||||
//$disabled = (($this->value == 'view') ? 'disabled="disabled"' : '');
|
//$disabled = (($this->value == 'view') ? 'disabled="disabled"' : '');
|
||||||
$html = $res = "<input id='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' value='{$this->value}' name='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' type='checkbox' $checked $disabled readonly = '{$this->readOnly}'/>";
|
$html = $res = "<input id='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' value='{$this->value}' name='form[" . $owner->name . "][" . $r . "][" . $this->name . "]' type='checkbox' $checked $disabled readonly = '{$this->readOnly}' ".$this->NSDefaultValue()." ".$this->NSGridType()."/>";
|
||||||
$result [] = $html;
|
$result [] = $html;
|
||||||
$r ++;
|
$r ++;
|
||||||
}
|
}
|
||||||
@@ -2297,6 +2369,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
|||||||
return isset($value) && ( array_key_exists( $value , $this->options ) );*/
|
return isset($value) && ( array_key_exists( $value , $this->options ) );*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function render
|
* Function render
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
@@ -2327,6 +2400,15 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
|||||||
$isRequired = '0';
|
$isRequired = '0';
|
||||||
}
|
}
|
||||||
//end
|
//end
|
||||||
|
|
||||||
|
if (isNewDynaform($owner)==1){
|
||||||
|
if ($this->dependentFields != ''){
|
||||||
|
$value = "";
|
||||||
|
}else{
|
||||||
|
$value = $this->defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// added by Gustavo Cruz
|
// added by Gustavo Cruz
|
||||||
if($this->readonly == true || $this->modeGridDrop === 'view'){
|
if($this->readonly == true || $this->modeGridDrop === 'view'){
|
||||||
$readOnlyField = "disabled";
|
$readOnlyField = "disabled";
|
||||||
@@ -2334,7 +2416,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
|||||||
// added end
|
// added end
|
||||||
if (! $onlyValue) {
|
if (! $onlyValue) {
|
||||||
if ($this->mode === 'edit') {
|
if ($this->mode === 'edit') {
|
||||||
$html = '<select '.$readOnlyField.' pm:required="'.$isRequired.'" class="module_app_input___gray" id="form' . $rowId . '[' . $this->name . ']" name="form' . $rowId . '[' . $this->name . ']" ' . (($this->style) ? 'style="' . $this->style . '"' : '') . '>';
|
$html = '<select '.$readOnlyField.' pm:required="'.$isRequired.'" class="module_app_input___gray" id="form' . $rowId . '[' . $this->name . ']" name="form' . $rowId . '[' . $this->name . ']" ' . (($this->style) ? 'style="' . $this->style . '"' : '') . ' '.$this->NSDefaultValue().' '.$this->NSGridType().' '.$this->NSDependentFields(true).'>';
|
||||||
} elseif ($this->mode === 'view') {
|
} elseif ($this->mode === 'view') {
|
||||||
$html = $this->htmlentities ( isset ( $this->options [$value] ) ? $this->options [$value] : '', ENT_COMPAT, 'utf-8' );
|
$html = $this->htmlentities ( isset ( $this->options [$value] ) ? $this->options [$value] : '', ENT_COMPAT, 'utf-8' );
|
||||||
$html .= '<select '.$readOnlyField.' pm:required="'.$isRequired.'" class="module_app_input___gray" id="form' . $rowId . '[' . $this->name . ']" name="form' . $rowId . '[' . $this->name . ']" style="display:none" ' . (($this->style) ? 'style="' . $this->style . '"' : '') . '>';
|
$html .= '<select '.$readOnlyField.' pm:required="'.$isRequired.'" class="module_app_input___gray" id="form' . $rowId . '[' . $this->name . ']" name="form' . $rowId . '[' . $this->name . ']" style="display:none" ' . (($this->style) ? 'style="' . $this->style . '"' : '') . '>';
|
||||||
@@ -2397,6 +2479,8 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
|||||||
*/
|
*/
|
||||||
function renderGrid($values = array(), $owner = NULL, $onlyValue = false, $therow = -1)
|
function renderGrid($values = array(), $owner = NULL, $onlyValue = false, $therow = -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->gridFieldType = 'dropdown';
|
||||||
$result = array ();
|
$result = array ();
|
||||||
$r = 1;
|
$r = 1;
|
||||||
if(! isset($owner->modeGrid)) $owner->modeGrid = '';
|
if(! isset($owner->modeGrid)) $owner->modeGrid = '';
|
||||||
@@ -2818,6 +2902,7 @@ class XmlForm_Field_Grid extends XmlForm_Field
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->values = $values;
|
$this->values = $values;
|
||||||
|
|
||||||
$this->NewLabel = G::LoadTranslation('ID_NEW');
|
$this->NewLabel = G::LoadTranslation('ID_NEW');
|
||||||
$this->DeleteLabel = G::LoadTranslation('ID_DELETE');
|
$this->DeleteLabel = G::LoadTranslation('ID_DELETE');
|
||||||
|
|
||||||
@@ -3741,8 +3826,6 @@ class XmlForm_Field_Xmlform extends XmlForm_Field {
|
|||||||
$this->xmlform->parseFile ( $this->xmlfile . '.xml', $language, false );
|
$this->xmlform->parseFile ( $this->xmlfile . '.xml', $language, false );
|
||||||
$this->fields = $this->xmlform->fields;
|
$this->fields = $this->xmlform->fields;
|
||||||
$this->scriptURL = $this->xmlform->scriptURL;
|
$this->scriptURL = $this->xmlform->scriptURL;
|
||||||
//echo "content:" . $this->scriptURL;
|
|
||||||
//die;
|
|
||||||
$this->id = $this->xmlform->id;
|
$this->id = $this->xmlform->id;
|
||||||
unset ( $this->xmlform );
|
unset ( $this->xmlform );
|
||||||
}
|
}
|
||||||
@@ -3766,8 +3849,6 @@ class XmlForm_Field_Xmlform extends XmlForm_Field {
|
|||||||
$tpl->template = $tpl->printTemplate ( $this );
|
$tpl->template = $tpl->printTemplate ( $this );
|
||||||
//In the header
|
//In the header
|
||||||
|
|
||||||
// echo "content:" . $this->scriptURL;
|
|
||||||
// die;
|
|
||||||
$oHeadPublisher = & headPublisher::getSingleton ();
|
$oHeadPublisher = & headPublisher::getSingleton ();
|
||||||
$oHeadPublisher->addScriptFile ( $this->scriptURL );
|
$oHeadPublisher->addScriptFile ( $this->scriptURL );
|
||||||
$oHeadPublisher->addScriptCode ( $tpl->printJavaScript ( $this ) );
|
$oHeadPublisher->addScriptCode ( $tpl->printJavaScript ( $this ) );
|
||||||
@@ -3915,7 +3996,7 @@ class XmlForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//var_dump($this->requiredFields);
|
|
||||||
$oJSON = new Services_JSON ( );
|
$oJSON = new Services_JSON ( );
|
||||||
$this->objectRequiredFields = str_replace('"', "%27", str_replace("'", "%39", $oJSON->encode ( $this->requiredFields )) );
|
$this->objectRequiredFields = str_replace('"', "%27", str_replace("'", "%39", $oJSON->encode ( $this->requiredFields )) );
|
||||||
|
|
||||||
@@ -3932,6 +4013,7 @@ class XmlForm
|
|||||||
/* fwrite ($f, '$this = unserialize( \'' .
|
/* fwrite ($f, '$this = unserialize( \'' .
|
||||||
addcslashes( serialize ( $this ), '\\\'' ) . '\' );' . "\n" );*/
|
addcslashes( serialize ( $this ), '\\\'' ) . '\' );' . "\n" );*/
|
||||||
foreach ( $this as $key => $value ) {
|
foreach ( $this as $key => $value ) {
|
||||||
|
//cho $key .'<br/>';
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'home' :
|
case 'home' :
|
||||||
case 'fileName' :
|
case 'fileName' :
|
||||||
@@ -4167,7 +4249,6 @@ class xmlformTemplate extends Smarty
|
|||||||
*/
|
*/
|
||||||
function getFields(&$form, $therow = -1)
|
function getFields(&$form, $therow = -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
$result = array ();
|
$result = array ();
|
||||||
foreach ( $form->fields as $k => $v ) {
|
foreach ( $form->fields as $k => $v ) {
|
||||||
if ($form->mode != '') { #@ last modification: erik
|
if ($form->mode != '') { #@ last modification: erik
|
||||||
@@ -4188,6 +4269,7 @@ class xmlformTemplate extends Smarty
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset ( $form->owner )) {
|
if (isset ( $form->owner )) {
|
||||||
|
|
||||||
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
|
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
|
||||||
$i = count ( $value );
|
$i = count ( $value );
|
||||||
$j = count ( $form->owner->values [$form->name] );
|
$j = count ( $form->owner->values [$form->name] );
|
||||||
@@ -4195,7 +4277,13 @@ class xmlformTemplate extends Smarty
|
|||||||
$value [] = '';
|
$value [] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$aObj = $form->owner;
|
||||||
|
}else{
|
||||||
|
$aObj = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($v->type == 'grid') {
|
if ($v->type == 'grid') {
|
||||||
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $value, $form, $therow );
|
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $value, $form, $therow );
|
||||||
} else {
|
} else {
|
||||||
@@ -4358,3 +4446,14 @@ class XmlForm_Field_Image extends XmlForm_Field
|
|||||||
$value = date($tmp);
|
$value = date($tmp);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the current dynaform is new or reopened
|
||||||
|
* @author Enrique Ponce de Leon <enrique@colosa.com>
|
||||||
|
* @package gulliver.system
|
||||||
|
*/
|
||||||
|
function isNewDynaform($owner){
|
||||||
|
$sw = ($_SESSION['NEW_CASE']=='New')? '1' : '0';
|
||||||
|
return $sw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -216,6 +216,9 @@ function startCase() {
|
|||||||
if (isset ( $_SESSION ['TASK'] )) unset ( $_SESSION ['TASK'] );
|
if (isset ( $_SESSION ['TASK'] )) unset ( $_SESSION ['TASK'] );
|
||||||
if (isset ( $_SESSION ['INDEX'] )) unset ( $_SESSION ['INDEX'] );
|
if (isset ( $_SESSION ['INDEX'] )) unset ( $_SESSION ['INDEX'] );
|
||||||
if (isset ( $_SESSION ['STEP_POSITION'] )) unset ( $_SESSION ['STEP_POSITION'] );
|
if (isset ( $_SESSION ['STEP_POSITION'] )) unset ( $_SESSION ['STEP_POSITION'] );
|
||||||
|
if (isset ( $_SESSION ['START_NEW_CASE'] )) unset ( $_SESSION ['START_NEW_CASE'] );
|
||||||
|
|
||||||
|
//echo 'Start new case<br />';
|
||||||
|
|
||||||
/* Process */
|
/* Process */
|
||||||
try {
|
try {
|
||||||
@@ -224,6 +227,7 @@ function startCase() {
|
|||||||
lookinginforContentProcess($_POST['processId']);
|
lookinginforContentProcess($_POST['processId']);
|
||||||
|
|
||||||
$aData = $oCase->startCase ( $_REQUEST ['taskId'], $_SESSION ['USER_LOGGED'] );
|
$aData = $oCase->startCase ( $_REQUEST ['taskId'], $_SESSION ['USER_LOGGED'] );
|
||||||
|
|
||||||
$_SESSION ['APPLICATION'] = $aData ['APPLICATION'];
|
$_SESSION ['APPLICATION'] = $aData ['APPLICATION'];
|
||||||
$_SESSION ['INDEX'] = $aData ['INDEX'];
|
$_SESSION ['INDEX'] = $aData ['INDEX'];
|
||||||
$_SESSION ['PROCESS'] = $aData ['PROCESS'];
|
$_SESSION ['PROCESS'] = $aData ['PROCESS'];
|
||||||
@@ -240,6 +244,8 @@ function startCase() {
|
|||||||
$_SESSION ['BREAKSTEP'] ['NEXT_STEP'] = $aNextStep;
|
$_SESSION ['BREAKSTEP'] ['NEXT_STEP'] = $aNextStep;
|
||||||
$aData ['openCase'] = $aNextStep;
|
$aData ['openCase'] = $aNextStep;
|
||||||
|
|
||||||
|
$aData ['NewDynaform'] = true; //Sets New Dynaform value
|
||||||
|
|
||||||
$aData ['status'] = 'success';
|
$aData ['status'] = 'success';
|
||||||
print (G::json_encode ( $aData )) ;
|
print (G::json_encode ( $aData )) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ if( $RBAC->userCanAccess('PM_CASES') != 1 ) {
|
|||||||
require_once 'classes/model/AppDelay.php';
|
require_once 'classes/model/AppDelay.php';
|
||||||
G::LoadClass('case');
|
G::LoadClass('case');
|
||||||
|
|
||||||
|
//Clean NEW_CASE session variable if case isn't new.
|
||||||
|
if ($_GET['new']!='yes') $_SESSION['NEW_CASE'] = '';
|
||||||
|
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
|
|
||||||
//cleaning the case session data
|
//cleaning the case session data
|
||||||
|
|||||||
@@ -46,6 +46,15 @@
|
|||||||
if( isset($_GET['APP_UID']) && isset($_GET['DEL_INDEX'])) {
|
if( isset($_GET['APP_UID']) && isset($_GET['DEL_INDEX'])) {
|
||||||
$case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX']);
|
$case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX']);
|
||||||
$appNum = $case['APP_TITLE'];
|
$appNum = $case['APP_TITLE'];
|
||||||
|
|
||||||
|
//Sets NEW_CASE session variable when we're starting a new case
|
||||||
|
if (isset($_GET['new'])){
|
||||||
|
if ($_GET['new']=='yes'){
|
||||||
|
$_SESSION['NEW_CASE'] = 'New';
|
||||||
|
}else{
|
||||||
|
$_SESSION['NEW_CASE'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_GET['to_revise'])){
|
if (!isset($_GET['to_revise'])){
|
||||||
|
|||||||
@@ -376,7 +376,11 @@ function openCaseA(n){
|
|||||||
var res = Ext.util.JSON.decode(response.responseText);
|
var res = Ext.util.JSON.decode(response.responseText);
|
||||||
|
|
||||||
if (res.openCase) {
|
if (res.openCase) {
|
||||||
|
if (res.NewDynaform){
|
||||||
|
window.location = res.openCase.PAGE + '&new=yes';
|
||||||
|
}else{
|
||||||
window.location = res.openCase.PAGE;
|
window.location = res.openCase.PAGE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Ext.Msg.show({
|
Ext.Msg.show({
|
||||||
title : TRANSLATIONS.ID_ERROR_CREATING_NEW_CASE, // 'Error creating a new Case',
|
title : TRANSLATIONS.ID_ERROR_CREATING_NEW_CASE, // 'Error creating a new Case',
|
||||||
|
|||||||
@@ -65,10 +65,6 @@
|
|||||||
|
|
||||||
<JS type="javascript">
|
<JS type="javascript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var changeToUpper = function() {
|
|
||||||
this.value = this.value.toUpperCase();
|
|
||||||
};
|
|
||||||
|
|
||||||
var onChangeType = function(iRow, bEmpty) {
|
var onChangeType = function(iRow, bEmpty) {
|
||||||
var iRow = iRow | this.name.split('][')[1];
|
var iRow = iRow | this.name.split('][')[1];
|
||||||
var oAux;
|
var oAux;
|
||||||
@@ -76,98 +72,28 @@ var onChangeType = function(iRow, bEmpty) {
|
|||||||
case 'VARCHAR':
|
case 'VARCHAR':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
if (bEmpty) {
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
}
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
if (!getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY').checked) {
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
case 'TEXT':
|
case 'TEXT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.value = '';
|
oAux.value = '';
|
||||||
oAux.readOnly = 'readOnly';
|
oAux.readOnly = 'readOnly';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
if (bEmpty) {
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
}
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'DATE':
|
case 'DATE':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.value = '';
|
oAux.value = '';
|
||||||
oAux.readOnly = 'readOnly';
|
oAux.readOnly = 'readOnly';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'INT':
|
case 'INT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
if (bEmpty) {
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
}
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
if (bEmpty) {
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
}
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
if (bEmpty) {
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
case 'FLOAT':
|
case 'FLOAT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onClickForeignKey = function(iRow) {
|
|
||||||
var iRow = iRow | this.name.split('][')[1];
|
|
||||||
var oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
if (getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY').checked) {
|
|
||||||
oAux.disabled = false;
|
|
||||||
oAux.value = '';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var verifyData = function(oForm) {
|
var verifyData = function(oForm) {
|
||||||
if (oForm.onsubmit()) {
|
if (oForm.onsubmit()) {
|
||||||
var bContinue = true;
|
var bContinue = true;
|
||||||
@@ -258,14 +184,6 @@ var verifyData = function(oForm) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (bContinue) {
|
|
||||||
if (getGridField('FIELDS', i, 'FLD_FOREIGN_KEY').checked) {
|
|
||||||
if (getGridField('FIELDS', i, 'FLD_FOREIGN_KEY_TABLE').value == '') {
|
|
||||||
bContinue = false;
|
|
||||||
iMessage = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// Check duplicate fields
|
// Check duplicate fields
|
||||||
if(bContinue) {
|
if(bContinue) {
|
||||||
if(!(getGridField('FIELDS', i, 'FLD_NAME').value in fieldsTmp)) {
|
if(!(getGridField('FIELDS', i, 'FLD_NAME').value in fieldsTmp)) {
|
||||||
@@ -348,7 +266,6 @@ var verifyData = function(oForm) {
|
|||||||
|
|
||||||
var changeValues = function(iRow, sType) {
|
var changeValues = function(iRow, sType) {
|
||||||
iRow = parseInt(iRow);
|
iRow = parseInt(iRow);
|
||||||
|
|
||||||
switch (sType) {
|
switch (sType) {
|
||||||
case 'UP':
|
case 'UP':
|
||||||
if (iRow == 1) {
|
if (iRow == 1) {
|
||||||
@@ -403,40 +320,30 @@ var changeValues = function(iRow, sType) {
|
|||||||
onChangeType(iOtherRow, false);
|
onChangeType(iOtherRow, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
var dynaformOnload = function() {
|
function LoadPMTable() {
|
||||||
//Adding events for the grid fields
|
//Adding events for the grid fields
|
||||||
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
||||||
var oAux;
|
var oAux;
|
||||||
for (var i = 1; i <= iRows; i++) {
|
for (var i = 1; i <= iRows; i++) {
|
||||||
oAux = getGridField('FIELDS', i, 'FLD_NAME');
|
|
||||||
leimnud.event.add(oAux, 'change', {method:changeToUpper,instance:oAux,event:true});
|
|
||||||
oAux = getGridField('FIELDS', i, 'FLD_TYPE');
|
oAux = getGridField('FIELDS', i, 'FLD_TYPE');
|
||||||
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
||||||
//oAux = getGridField('FIELDS', i, 'FLD_FOREIGN_KEY');
|
|
||||||
//leimnud.event.add(oAux, 'click', {method:onClickForeignKey,instance:oAux,event:true});
|
|
||||||
onChangeType(i, false);
|
onChangeType(i, false);
|
||||||
//onClickForeignKey(i, false);
|
|
||||||
}
|
}
|
||||||
getObject('FIELDS').onaddrow = function(iRow) {
|
getObject('FIELDS').onaddrow = function(iRow) {
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_NAME');
|
|
||||||
leimnud.event.add(oAux, 'change', {method:changeToUpper,instance:oAux,event:true});
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_TYPE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_TYPE');
|
||||||
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
||||||
//oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
//leimnud.event.add(oAux, 'click', {method:onClickForeignKey,instance:oAux,event:true});
|
|
||||||
onChangeType(iRow, true);
|
onChangeType(iRow, true);
|
||||||
//onClickForeignKey(iRow, true);
|
|
||||||
|
|
||||||
document.getElementById('FIELDS').rows[iRow].getElementsByTagName('td')[10].innerHTML = document.getElementById('FIELDS').rows[1].getElementsByTagName('td')[10].innerHTML.replace('[1]', '[' + iRow + ']');
|
document.getElementById('FIELDS').rows[iRow].getElementsByTagName('td')[10].innerHTML = document.getElementById('FIELDS').rows[1].getElementsByTagName('td')[10].innerHTML.replace('[1]', '[' + iRow + ']');
|
||||||
document.getElementById('FIELDS').rows[iRow].getElementsByTagName('td')[11].innerHTML = document.getElementById('FIELDS').rows[1].getElementsByTagName('td')[11].innerHTML.replace('[1]', '[' + iRow + ']');
|
document.getElementById('FIELDS').rows[iRow].getElementsByTagName('td')[11].innerHTML = document.getElementById('FIELDS').rows[1].getElementsByTagName('td')[11].innerHTML.replace('[1]', '[' + iRow + ']');
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function cancel(){
|
function cancel(){
|
||||||
window.location = 'additionalTablesList';
|
window.location = 'additionalTablesList';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynaformOnload = LoadPMTable;
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
|
|
||||||
</JS>
|
</JS>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<FLD_UID type="text" size="1" style="display:none;"/>
|
<FLD_UID type="text" size="1" style="display:none;"/>
|
||||||
|
|
||||||
<FLD_NAME type="text" size="15" maxlength="64" validate="Field">
|
<FLD_NAME type="text" size="15" maxlength="64" validate="Field" strto="UPPER">
|
||||||
<en>Field Name</en>
|
<en>Field Name</en>
|
||||||
</FLD_NAME>
|
</FLD_NAME>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<FLD_UID type="text" size="1" style="display:none;"/>
|
<FLD_UID type="text" size="1" style="display:none;"/>
|
||||||
|
|
||||||
<FLD_NAME type="text" size="15" maxlength="64" validate="Field">
|
<FLD_NAME type="text" size="15" maxlength="64" validate="Field" strto="UPPER">
|
||||||
<en>Field Name</en>
|
<en>Field Name</en>
|
||||||
</FLD_NAME>
|
</FLD_NAME>
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,6 @@
|
|||||||
|
|
||||||
<JS type="javascript">
|
<JS type="javascript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var changeToUpper = function() {
|
|
||||||
this.value = this.value.toUpperCase();
|
|
||||||
};
|
|
||||||
|
|
||||||
var onChangeType = function(iRow) {
|
var onChangeType = function(iRow) {
|
||||||
var iRow = iRow | this.name.split('][')[1];
|
var iRow = iRow | this.name.split('][')[1];
|
||||||
var oAux;
|
var oAux;
|
||||||
@@ -80,72 +76,24 @@ var onChangeType = function(iRow) {
|
|||||||
case 'VARCHAR':
|
case 'VARCHAR':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'TEXT':
|
case 'TEXT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.value = '';
|
oAux.value = '';
|
||||||
oAux.readOnly = 'readOnly';
|
oAux.readOnly = 'readOnly';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'DATE':
|
case 'DATE':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.value = '';
|
oAux.value = '';
|
||||||
oAux.readOnly = 'readOnly';
|
oAux.readOnly = 'readOnly';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'INT':
|
case 'INT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = false;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
case 'FLOAT':
|
case 'FLOAT':
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_SIZE');
|
||||||
oAux.readOnly = '';
|
oAux.readOnly = '';
|
||||||
/*oAux = getGridField('FIELDS', iRow, 'FLD_AUTO_INCREMENT');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
oAux.checked = false;
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY_TABLE');
|
|
||||||
oAux.disabled = true;
|
|
||||||
oAux.value = '';*/
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -203,7 +151,6 @@ var verifyData = function(oForm) {
|
|||||||
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
||||||
var fieldsTmp = [];
|
var fieldsTmp = [];
|
||||||
var words = '';
|
var words = '';
|
||||||
|
|
||||||
for (var i = 1; i <= iRows; i++) {
|
for (var i = 1; i <= iRows; i++) {
|
||||||
for(var j = 0; j < aReservedWords.length; j++ ) {
|
for(var j = 0; j < aReservedWords.length; j++ ) {
|
||||||
if(getGridField('FIELDS', i, 'FLD_NAME').value == aReservedWords[j]) {
|
if(getGridField('FIELDS', i, 'FLD_NAME').value == aReservedWords[j]) {
|
||||||
@@ -253,14 +200,6 @@ var verifyData = function(oForm) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (bContinue) {
|
|
||||||
if (getGridField('FIELDS', i, 'FLD_FOREIGN_KEY').checked) {
|
|
||||||
if (getGridField('FIELDS', i, 'FLD_FOREIGN_KEY_TABLE').value == '') {
|
|
||||||
bContinue = false;
|
|
||||||
iMessage = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// Check duplicate fields
|
// Check duplicate fields
|
||||||
if(bContinue) {
|
if(bContinue) {
|
||||||
if(!(getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase() in fieldsTmp)) {
|
if(!(getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase() in fieldsTmp)) {
|
||||||
@@ -344,8 +283,7 @@ var verifyData = function(oForm) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
leimnud.event.add(window, 'load', function() {
|
function LoadPMTable(){
|
||||||
//Adding ajax validations
|
|
||||||
leimnud.event.add(getField('ADD_TAB_NAME'), 'change', function() {
|
leimnud.event.add(getField('ADD_TAB_NAME'), 'change', function() {
|
||||||
getField('ADD_TAB_NAME').value = getField('ADD_TAB_NAME').value.toUpperCase();
|
getField('ADD_TAB_NAME').value = getField('ADD_TAB_NAME').value.toUpperCase();
|
||||||
var sTableNameOld = getField('ADD_TAB_NAME_OLD').value;
|
var sTableNameOld = getField('ADD_TAB_NAME_OLD').value;
|
||||||
@@ -373,7 +311,7 @@ leimnud.event.add(window, 'load', function() {
|
|||||||
oSaveButton.disabled = false;
|
oSaveButton.disabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (getField('ADD_TAB_CLASS_NAME').value == '') {
|
|
||||||
var aAux = getField('ADD_TAB_NAME').value.split('_');
|
var aAux = getField('ADD_TAB_NAME').value.split('_');
|
||||||
var sAux = '';
|
var sAux = '';
|
||||||
var i;
|
var i;
|
||||||
@@ -387,7 +325,7 @@ leimnud.event.add(window, 'load', function() {
|
|||||||
sAux = '_' + sAux;;
|
sAux = '_' + sAux;;
|
||||||
}
|
}
|
||||||
getField('ADD_TAB_CLASS_NAME').value = sAux;
|
getField('ADD_TAB_CLASS_NAME').value = sAux;
|
||||||
// }
|
|
||||||
|
|
||||||
// Validate ilegal character
|
// Validate ilegal character
|
||||||
var sTbl_name = getField('ADD_TAB_NAME').value.toUpperCase();
|
var sTbl_name = getField('ADD_TAB_NAME').value.toUpperCase();
|
||||||
@@ -412,6 +350,7 @@ leimnud.event.add(window, 'load', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
leimnud.event.add(getField('ADD_TAB_CLASS_NAME'), 'change', function() {
|
leimnud.event.add(getField('ADD_TAB_CLASS_NAME'), 'change', function() {
|
||||||
var sClassNameOld = getField('ADD_TAB_CLASS_NAME_OLD').value;
|
var sClassNameOld = getField('ADD_TAB_CLASS_NAME_OLD').value;
|
||||||
var oSaveButton = getField('btnSave');
|
var oSaveButton = getField('btnSave');
|
||||||
@@ -434,49 +373,31 @@ leimnud.event.add(window, 'load', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//if (sClassNameOld != '') {
|
|
||||||
oSaveButton.disabled = false;
|
oSaveButton.disabled = false;
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Adding events for the grid fields
|
//Adding events for the grid fields
|
||||||
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
var iRows = Number_Rows_Grid('FIELDS', 'FLD_UID');
|
||||||
var oAux;
|
var oAux;
|
||||||
for (var i = 1; i <= iRows; i++) {
|
for (var i = 1; i <= iRows; i++) {
|
||||||
oAux = getGridField('FIELDS', i, 'FLD_NAME');
|
|
||||||
leimnud.event.add(oAux, 'change', {method:changeToUpper,instance:oAux,event:true});
|
|
||||||
oAux = getGridField('FIELDS', i, 'FLD_TYPE');
|
oAux = getGridField('FIELDS', i, 'FLD_TYPE');
|
||||||
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
||||||
//oAux = getGridField('FIELDS', i, 'FLD_FOREIGN_KEY');
|
|
||||||
//leimnud.event.add(oAux, 'click', {method:onClickForeignKey,instance:oAux,event:true});
|
|
||||||
onChangeType(i);
|
onChangeType(i);
|
||||||
//onClickForeignKey(i);
|
|
||||||
}
|
}
|
||||||
if (getObject('FIELDS')){
|
|
||||||
getObject('FIELDS').onaddrow = function(iRow) {
|
getObject('FIELDS').onaddrow = function(iRow) {
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_NAME');
|
|
||||||
leimnud.event.add(oAux, 'change', {method:changeToUpper,instance:oAux,event:true});
|
|
||||||
oAux = getGridField('FIELDS', iRow, 'FLD_TYPE');
|
oAux = getGridField('FIELDS', iRow, 'FLD_TYPE');
|
||||||
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
leimnud.event.add(oAux, 'change', {method:onChangeType,instance:oAux,event:true});
|
||||||
//oAux = getGridField('FIELDS', iRow, 'FLD_FOREIGN_KEY');
|
|
||||||
//leimnud.event.add(oAux, 'click', {method:onClickForeignKey,instance:oAux,event:true});
|
|
||||||
onChangeType(iRow);
|
onChangeType(iRow);
|
||||||
//onClickForeignKey(iRow);
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
leimnud.event.add(getField('ADD_TAB_CLASS_NAME'), 'click', function() {
|
|
||||||
//alert('sss');
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function cancel(){
|
function cancel(){
|
||||||
window.location = 'additionalTablesList';
|
window.location = 'additionalTablesList';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynaformOnload = LoadPMTable;
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</JS>
|
</JS>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user