Grid 1.1 Solve Bugs: 5330, 6509, 6150, 6153, 6328
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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,7 +2369,8 @@ 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>
|
||||||
* @access public
|
* @access public
|
||||||
@@ -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) {
|
||||||
window.location = res.openCase.PAGE;
|
if (res.NewDynaform){
|
||||||
|
window.location = res.openCase.PAGE + '&new=yes';
|
||||||
|
}else{
|
||||||
|
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,95 +72,25 @@ 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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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 = '';
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,53 +102,53 @@ var verifyData = function(oForm) {
|
|||||||
var fieldsTmp = [];
|
var fieldsTmp = [];
|
||||||
var words = '';
|
var words = '';
|
||||||
var aReservedWords = new Array('ADD','ALL','ALTER','ANALYZE','AND','AS','ASC','ASENSITIVE','BEFORE',
|
var aReservedWords = new Array('ADD','ALL','ALTER','ANALYZE','AND','AS','ASC','ASENSITIVE','BEFORE',
|
||||||
'BETWEEN','BIGINT','BINARY','BLOB','BOTH','BY','CALL','CASCADE','CASE',
|
'BETWEEN','BIGINT','BINARY','BLOB','BOTH','BY','CALL','CASCADE','CASE',
|
||||||
'CHANGE','CHAR','CHARACTER','CHECK','COLLATE','COLUMN','CONDITION',
|
'CHANGE','CHAR','CHARACTER','CHECK','COLLATE','COLUMN','CONDITION',
|
||||||
'CONSTRAINT','CONTINUE','CONVERT','CREATE','CROSS','CURRENT_DATE',
|
'CONSTRAINT','CONTINUE','CONVERT','CREATE','CROSS','CURRENT_DATE',
|
||||||
'CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURSOR','DATABASE',
|
'CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURSOR','DATABASE',
|
||||||
'DATABASES','DAY_HOUR','DAY_MICROSECOND','DAY_MINUTE','DAY_SECOND','DEC',
|
'DATABASES','DAY_HOUR','DAY_MICROSECOND','DAY_MINUTE','DAY_SECOND','DEC',
|
||||||
'DECIMAL','DECLARE','DEFAULT','DELAYED','DELETE','DESC','DESCRIBE',
|
'DECIMAL','DECLARE','DEFAULT','DELAYED','DELETE','DESC','DESCRIBE',
|
||||||
'DETERMINISTIC','DISTINCT','DISTINCTROW','DIV','DOUBLE','DROP','DUAL',
|
'DETERMINISTIC','DISTINCT','DISTINCTROW','DIV','DOUBLE','DROP','DUAL',
|
||||||
'EACH','ELSE','ELSEIF','ENCLOSED','ESCAPED','EXISTS','EXIT','EXPLAIN',
|
'EACH','ELSE','ELSEIF','ENCLOSED','ESCAPED','EXISTS','EXIT','EXPLAIN',
|
||||||
'FALSE','FETCH','FLOAT','FLOAT4','FLOAT8','FOR','FORCE','FOREIGN','FROM',
|
'FALSE','FETCH','FLOAT','FLOAT4','FLOAT8','FOR','FORCE','FOREIGN','FROM',
|
||||||
'FULLTEXT','GRANT','GROUP','HAVING','HIGH_PRIORITY','HOUR_MICROSECOND',
|
'FULLTEXT','GRANT','GROUP','HAVING','HIGH_PRIORITY','HOUR_MICROSECOND',
|
||||||
'HOUR_MINUTE','HOUR_SECOND','IF','IGNORE','IN','INDEX','INFILE','INNER',
|
'HOUR_MINUTE','HOUR_SECOND','IF','IGNORE','IN','INDEX','INFILE','INNER',
|
||||||
'INOUT','INSENSITIVE','INSERT','INT','INT1','INT2','INT3','INT4','INT8',
|
'INOUT','INSENSITIVE','INSERT','INT','INT1','INT2','INT3','INT4','INT8',
|
||||||
'INTEGER','INTERVAL','INTO','IS','ITERATE','JOIN','KEY','KEYS','KILL',
|
'INTEGER','INTERVAL','INTO','IS','ITERATE','JOIN','KEY','KEYS','KILL',
|
||||||
'LEADING','LEAVE','LEFT','LIKE','LIMIT','LINES','LOAD','LOCALTIME',
|
'LEADING','LEAVE','LEFT','LIKE','LIMIT','LINES','LOAD','LOCALTIME',
|
||||||
'LOCALTIMESTAMP','LOCK','LONG','LONGBLOB','LONGTEXT','LOOP','LOW_PRIORITY',
|
'LOCALTIMESTAMP','LOCK','LONG','LONGBLOB','LONGTEXT','LOOP','LOW_PRIORITY',
|
||||||
'MATCH','MEDIUMBLOB','MEDIUMINT','MEDIUMTEXT','MIDDLEINT','MINUTE_MICROSECOND',
|
'MATCH','MEDIUMBLOB','MEDIUMINT','MEDIUMTEXT','MIDDLEINT','MINUTE_MICROSECOND',
|
||||||
'MINUTE_SECOND','MOD','MODIFIES','NATURAL','NOT','NO_WRITE_TO_BINLOG','NULL',
|
'MINUTE_SECOND','MOD','MODIFIES','NATURAL','NOT','NO_WRITE_TO_BINLOG','NULL',
|
||||||
'NUMERIC','ON','OPTIMIZE','OPTION','OPTIONALLY','OR','ORDER','OUT','OUTER',
|
'NUMERIC','ON','OPTIMIZE','OPTION','OPTIONALLY','OR','ORDER','OUT','OUTER',
|
||||||
'OUTFILE','PRECISION','PRIMARY','PROCEDURE','PURGE','READ','READS','REAL',
|
'OUTFILE','PRECISION','PRIMARY','PROCEDURE','PURGE','READ','READS','REAL',
|
||||||
'REFERENCES','REGEXP','RELEASE','RENAME','REPEAT','REPLACE','REQUIRE',
|
'REFERENCES','REGEXP','RELEASE','RENAME','REPEAT','REPLACE','REQUIRE',
|
||||||
'RESTRICT','RETURN','REVOKE','RIGHT','RLIKE','SCHEMA','SCHEMAS','SECOND_MICROSECOND',
|
'RESTRICT','RETURN','REVOKE','RIGHT','RLIKE','SCHEMA','SCHEMAS','SECOND_MICROSECOND',
|
||||||
'SELECT','SENSITIVE','SEPARATOR','SET','SHOW','SMALLINT','SONAME','SPATIAL',
|
'SELECT','SENSITIVE','SEPARATOR','SET','SHOW','SMALLINT','SONAME','SPATIAL',
|
||||||
'SPECIFIC','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING','SQL_BIG_RESULT',
|
'SPECIFIC','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING','SQL_BIG_RESULT',
|
||||||
'SQL_CALC_FOUND_ROWS','SQL_SMALL_RESULT','SSL','STARTING','STRAIGHT_JOIN',
|
'SQL_CALC_FOUND_ROWS','SQL_SMALL_RESULT','SSL','STARTING','STRAIGHT_JOIN',
|
||||||
'TABLE','TERMINATED','THEN','TINYBLOB','TINYINT','TINYTEXT','TO','TRAILING',
|
'TABLE','TERMINATED','THEN','TINYBLOB','TINYINT','TINYTEXT','TO','TRAILING',
|
||||||
'TRIGGER','TRUE','UNDO','UNION','UNIQUE','UNLOCK','UNSIGNED','UPDATE','USAGE',
|
'TRIGGER','TRUE','UNDO','UNION','UNIQUE','UNLOCK','UNSIGNED','UPDATE','USAGE',
|
||||||
'USE','USING','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','VALUES','VARBINARY',
|
'USE','USING','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','VALUES','VARBINARY',
|
||||||
'VARCHAR','VARCHARACTER','VARYING','WHEN','WHERE','WHILE','WITH','WRITE',
|
'VARCHAR','VARCHARACTER','VARYING','WHEN','WHERE','WHILE','WITH','WRITE',
|
||||||
'XOR','YEAR_MONTH','ZEROFILL','ASENSITIVE','CALL','CONDITION','CONTINUE',
|
'XOR','YEAR_MONTH','ZEROFILL','ASENSITIVE','CALL','CONDITION','CONTINUE',
|
||||||
'CURSOR','DECLARE','DETERMINISTIC','EACH','ELSEIF','EXIT','FETCH','INOUT',
|
'CURSOR','DECLARE','DETERMINISTIC','EACH','ELSEIF','EXIT','FETCH','INOUT',
|
||||||
'INSENSITIVE','ITERATE','LEAVE','LOOP','MODIFIES','OUT','READS','RELEASE',
|
'INSENSITIVE','ITERATE','LEAVE','LOOP','MODIFIES','OUT','READS','RELEASE',
|
||||||
'REPEAT','RETURN','SCHEMA','SCHEMAS','SENSITIVE','SPECIFIC','SQL',
|
'REPEAT','RETURN','SCHEMA','SCHEMAS','SENSITIVE','SPECIFIC','SQL',
|
||||||
'SQLEXCEPTION','SQLSTATE','SQLWARNING','TRIGGER','UNDO','WHILE');
|
'SQLEXCEPTION','SQLSTATE','SQLWARNING','TRIGGER','UNDO','WHILE');
|
||||||
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]) {
|
||||||
words = words +" "+getGridField('FIELDS', i, 'FLD_NAME').value;
|
words = words +" "+getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (words != ''){
|
if (words != ''){
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:G_STRINGS.ID_FIELDS_RESERVED_WORDS + ' ' + words
|
label:G_STRINGS.ID_FIELDS_RESERVED_WORDS + ' ' + words
|
||||||
});
|
});
|
||||||
words='';
|
words='';
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
}
|
}
|
||||||
for (var i = 1; i <= iRows; i++) {
|
for (var i = 1; i <= iRows; i++) {
|
||||||
if (getGridField('FIELDS', i, 'FLD_NAME').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_NAME').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
@@ -235,56 +161,48 @@ var verifyData = function(oForm) {
|
|||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'TEXT':
|
case 'TEXT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_KEY').checked ) {
|
if (getGridField('FIELDS', i, 'FLD_KEY').checked ) {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 4;
|
iMessage = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'DATE':
|
case 'DATE':
|
||||||
break;
|
break;
|
||||||
case 'INT':
|
case 'INT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'FLOAT':
|
case 'FLOAT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
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)) {
|
||||||
fieldsTmp[getGridField('FIELDS', i, 'FLD_NAME').value]++;
|
fieldsTmp[getGridField('FIELDS', i, 'FLD_NAME').value]++;
|
||||||
} else {
|
} else {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 5;
|
iMessage = 5;
|
||||||
sDuplicate = getGridField('FIELDS', i, 'FLD_NAME').value;
|
sDuplicate = getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bContinue){
|
if(bContinue){
|
||||||
var sFldName = getGridField('FIELDS', i, 'FLD_NAME').value;
|
var sFldName = getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
var sFirstCharFldName = sFldName.charAt(0);
|
var sFirstCharFldName = sFldName.charAt(0);
|
||||||
pattern =/[A-Za-z_]/;
|
pattern =/[A-Za-z_]/;
|
||||||
if(pattern.test(sFirstCharFldName) == false) {
|
if(pattern.test(sFirstCharFldName) == false) {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 6;
|
iMessage = 6;
|
||||||
sInvalidField = getGridField('FIELDS', i, 'FLD_NAME').value;
|
sInvalidField = getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var bContinueKey = false;
|
var bContinueKey = false;
|
||||||
@@ -309,32 +227,32 @@ var verifyData = function(oForm) {
|
|||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_NAME_REQUIRED)"
|
label:"@G::LoadTranslation(ID_FIELD_NAME_REQUIRED)"
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_SIZE_REQUIRED)"
|
label:"@G::LoadTranslation(ID_FIELD_SIZE_REQUIRED)"
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:G_STRINGS.ID_FIELD_FOREIGN_TABLE
|
label:G_STRINGS.ID_FIELD_FOREIGN_TABLE
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_CANNOT_BE_PRIMARY_KEY)"
|
label:"@G::LoadTranslation(ID_FIELD_CANNOT_BE_PRIMARY_KEY)"
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_DUPLICATE)" + " " + sDuplicate
|
label:"@G::LoadTranslation(ID_FIELD_DUPLICATE)" + " " + sDuplicate
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_INVALID)" + " " + sInvalidField
|
label:"@G::LoadTranslation(ID_FIELD_INVALID)" + " " + sInvalidField
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -348,20 +266,19 @@ 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) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var iOtherRow = iRow - 1;
|
var iOtherRow = iRow - 1;
|
||||||
break;
|
break;
|
||||||
case 'DOWN':
|
case 'DOWN':
|
||||||
if (iRow == Number_Rows_Grid('FIELDS', 'FLD_UID')) {
|
if (iRow == Number_Rows_Grid('FIELDS', 'FLD_UID')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var iOtherRow = iRow + 1;
|
var iOtherRow = iRow + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var FLD_UID = getGridField('FIELDS', iOtherRow, 'FLD_UID').value;
|
var FLD_UID = getGridField('FIELDS', iOtherRow, 'FLD_UID').value;
|
||||||
@@ -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,73 +76,25 @@ 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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
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');
|
break;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -162,40 +110,40 @@ var onClickForeignKey = function(iRow) {
|
|||||||
oAux.value = '';
|
oAux.value = '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var aReservedWords = new Array('ADD','ALL','ALTER','ANALYZE','AND','AS','ASC','ASENSITIVE','BEFORE',
|
var aReservedWords = new Array('ADD','ALL','ALTER','ANALYZE','AND','AS','ASC','ASENSITIVE','BEFORE',
|
||||||
'BETWEEN','BIGINT','BINARY','BLOB','BOTH','BY','CALL','CASCADE','CASE',
|
'BETWEEN','BIGINT','BINARY','BLOB','BOTH','BY','CALL','CASCADE','CASE',
|
||||||
'CHANGE','CHAR','CHARACTER','CHECK','COLLATE','COLUMN','CONDITION',
|
'CHANGE','CHAR','CHARACTER','CHECK','COLLATE','COLUMN','CONDITION',
|
||||||
'CONSTRAINT','CONTINUE','CONVERT','CREATE','CROSS','CURRENT_DATE',
|
'CONSTRAINT','CONTINUE','CONVERT','CREATE','CROSS','CURRENT_DATE',
|
||||||
'CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURSOR','DATABASE',
|
'CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURSOR','DATABASE',
|
||||||
'DATABASES','DAY_HOUR','DAY_MICROSECOND','DAY_MINUTE','DAY_SECOND','DEC',
|
'DATABASES','DAY_HOUR','DAY_MICROSECOND','DAY_MINUTE','DAY_SECOND','DEC',
|
||||||
'DECIMAL','DECLARE','DEFAULT','DELAYED','DELETE','DESC','DESCRIBE',
|
'DECIMAL','DECLARE','DEFAULT','DELAYED','DELETE','DESC','DESCRIBE',
|
||||||
'DETERMINISTIC','DISTINCT','DISTINCTROW','DIV','DOUBLE','DROP','DUAL',
|
'DETERMINISTIC','DISTINCT','DISTINCTROW','DIV','DOUBLE','DROP','DUAL',
|
||||||
'EACH','ELSE','ELSEIF','ENCLOSED','ESCAPED','EXISTS','EXIT','EXPLAIN',
|
'EACH','ELSE','ELSEIF','ENCLOSED','ESCAPED','EXISTS','EXIT','EXPLAIN',
|
||||||
'FALSE','FETCH','FLOAT','FLOAT4','FLOAT8','FOR','FORCE','FOREIGN','FROM',
|
'FALSE','FETCH','FLOAT','FLOAT4','FLOAT8','FOR','FORCE','FOREIGN','FROM',
|
||||||
'FULLTEXT','GRANT','GROUP','HAVING','HIGH_PRIORITY','HOUR_MICROSECOND',
|
'FULLTEXT','GRANT','GROUP','HAVING','HIGH_PRIORITY','HOUR_MICROSECOND',
|
||||||
'HOUR_MINUTE','HOUR_SECOND','IF','IGNORE','IN','INDEX','INFILE','INNER',
|
'HOUR_MINUTE','HOUR_SECOND','IF','IGNORE','IN','INDEX','INFILE','INNER',
|
||||||
'INOUT','INSENSITIVE','INSERT','INT','INT1','INT2','INT3','INT4','INT8',
|
'INOUT','INSENSITIVE','INSERT','INT','INT1','INT2','INT3','INT4','INT8',
|
||||||
'INTEGER','INTERVAL','INTO','IS','ITERATE','JOIN','KEY','KEYS','KILL',
|
'INTEGER','INTERVAL','INTO','IS','ITERATE','JOIN','KEY','KEYS','KILL',
|
||||||
'LEADING','LEAVE','LEFT','LIKE','LIMIT','LINES','LOAD','LOCALTIME',
|
'LEADING','LEAVE','LEFT','LIKE','LIMIT','LINES','LOAD','LOCALTIME',
|
||||||
'LOCALTIMESTAMP','LOCK','LONG','LONGBLOB','LONGTEXT','LOOP','LOW_PRIORITY',
|
'LOCALTIMESTAMP','LOCK','LONG','LONGBLOB','LONGTEXT','LOOP','LOW_PRIORITY',
|
||||||
'MATCH','MEDIUMBLOB','MEDIUMINT','MEDIUMTEXT','MIDDLEINT','MINUTE_MICROSECOND',
|
'MATCH','MEDIUMBLOB','MEDIUMINT','MEDIUMTEXT','MIDDLEINT','MINUTE_MICROSECOND',
|
||||||
'MINUTE_SECOND','MOD','MODIFIES','NATURAL','NOT','NO_WRITE_TO_BINLOG','NULL',
|
'MINUTE_SECOND','MOD','MODIFIES','NATURAL','NOT','NO_WRITE_TO_BINLOG','NULL',
|
||||||
'NUMERIC','ON','OPTIMIZE','OPTION','OPTIONALLY','OR','ORDER','OUT','OUTER',
|
'NUMERIC','ON','OPTIMIZE','OPTION','OPTIONALLY','OR','ORDER','OUT','OUTER',
|
||||||
'OUTFILE','PRECISION','PRIMARY','PROCEDURE','PURGE','READ','READS','REAL',
|
'OUTFILE','PRECISION','PRIMARY','PROCEDURE','PURGE','READ','READS','REAL',
|
||||||
'REFERENCES','REGEXP','RELEASE','RENAME','REPEAT','REPLACE','REQUIRE',
|
'REFERENCES','REGEXP','RELEASE','RENAME','REPEAT','REPLACE','REQUIRE',
|
||||||
'RESTRICT','RETURN','REVOKE','RIGHT','RLIKE','SCHEMA','SCHEMAS','SECOND_MICROSECOND',
|
'RESTRICT','RETURN','REVOKE','RIGHT','RLIKE','SCHEMA','SCHEMAS','SECOND_MICROSECOND',
|
||||||
'SELECT','SENSITIVE','SEPARATOR','SET','SHOW','SMALLINT','SONAME','SPATIAL',
|
'SELECT','SENSITIVE','SEPARATOR','SET','SHOW','SMALLINT','SONAME','SPATIAL',
|
||||||
'SPECIFIC','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING','SQL_BIG_RESULT',
|
'SPECIFIC','SQL','SQLEXCEPTION','SQLSTATE','SQLWARNING','SQL_BIG_RESULT',
|
||||||
'SQL_CALC_FOUND_ROWS','SQL_SMALL_RESULT','SSL','STARTING','STRAIGHT_JOIN',
|
'SQL_CALC_FOUND_ROWS','SQL_SMALL_RESULT','SSL','STARTING','STRAIGHT_JOIN',
|
||||||
'TABLE','TERMINATED','THEN','TINYBLOB','TINYINT','TINYTEXT','TO','TRAILING',
|
'TABLE','TERMINATED','THEN','TINYBLOB','TINYINT','TINYTEXT','TO','TRAILING',
|
||||||
'TRIGGER','TRUE','UNDO','UNION','UNIQUE','UNLOCK','UNSIGNED','UPDATE','USAGE',
|
'TRIGGER','TRUE','UNDO','UNION','UNIQUE','UNLOCK','UNSIGNED','UPDATE','USAGE',
|
||||||
'USE','USING','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','VALUES','VARBINARY',
|
'USE','USING','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','VALUES','VARBINARY',
|
||||||
'VARCHAR','VARCHARACTER','VARYING','WHEN','WHERE','WHILE','WITH','WRITE',
|
'VARCHAR','VARCHARACTER','VARYING','WHEN','WHERE','WHILE','WITH','WRITE',
|
||||||
'XOR','YEAR_MONTH','ZEROFILL','ASENSITIVE','CALL','CONDITION','CONTINUE',
|
'XOR','YEAR_MONTH','ZEROFILL','ASENSITIVE','CALL','CONDITION','CONTINUE',
|
||||||
'CURSOR','DECLARE','DETERMINISTIC','EACH','ELSEIF','EXIT','FETCH','INOUT',
|
'CURSOR','DECLARE','DETERMINISTIC','EACH','ELSEIF','EXIT','FETCH','INOUT',
|
||||||
'INSENSITIVE','ITERATE','LEAVE','LOOP','MODIFIES','OUT','READS','RELEASE',
|
'INSENSITIVE','ITERATE','LEAVE','LOOP','MODIFIES','OUT','READS','RELEASE',
|
||||||
'REPEAT','RETURN','SCHEMA','SCHEMAS','SENSITIVE','SPECIFIC','SQL',
|
'REPEAT','RETURN','SCHEMA','SCHEMAS','SENSITIVE','SPECIFIC','SQL',
|
||||||
'SQLEXCEPTION','SQLSTATE','SQLWARNING','TRIGGER','UNDO','WHILE');
|
'SQLEXCEPTION','SQLSTATE','SQLWARNING','TRIGGER','UNDO','WHILE');
|
||||||
var verifyData = function(oForm) {
|
var verifyData = function(oForm) {
|
||||||
if (oForm.onsubmit()) {
|
if (oForm.onsubmit()) {
|
||||||
var bContinue = true;
|
var bContinue = true;
|
||||||
@@ -203,21 +151,20 @@ 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]) {
|
||||||
words = words +" "+getGridField('FIELDS', i, 'FLD_NAME').value;
|
words = words +" "+getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (words != ''){
|
if (words != ''){
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:G_STRINGS.ID_FIELDS_RESERVED_WORDS + ' ' + words
|
label:G_STRINGS.ID_FIELDS_RESERVED_WORDS + ' ' + words
|
||||||
});
|
});
|
||||||
words='';
|
words='';
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
}
|
}
|
||||||
for (var i = 1; i <= iRows; i++) {
|
for (var i = 1; i <= iRows; i++) {
|
||||||
if (getGridField('FIELDS', i, 'FLD_NAME').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_NAME').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
@@ -230,57 +177,49 @@ var verifyData = function(oForm) {
|
|||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'TEXT':
|
case 'TEXT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_KEY').checked ) {
|
if (getGridField('FIELDS', i, 'FLD_KEY').checked ) {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 4;
|
iMessage = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'DATE':
|
case 'DATE':
|
||||||
break;
|
break;
|
||||||
case 'INT':
|
case 'INT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'FLOAT':
|
case 'FLOAT':
|
||||||
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
if (getGridField('FIELDS', i, 'FLD_SIZE').value == '') {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 2;
|
iMessage = 2;
|
||||||
}
|
}
|
||||||
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)) {
|
||||||
fieldsTmp[getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase()]++;
|
fieldsTmp[getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase()]++;
|
||||||
} else {
|
} else {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 5;
|
iMessage = 5;
|
||||||
sDuplicate = getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase();
|
sDuplicate = getGridField('FIELDS', i, 'FLD_NAME').value.toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check invalid character
|
// Check invalid character
|
||||||
if(bContinue){
|
if(bContinue){
|
||||||
var sFld_name = getGridField('FIELDS', i, 'FLD_NAME').value;
|
var sFld_name = getGridField('FIELDS', i, 'FLD_NAME').value;
|
||||||
var firstChar = sFld_name.charAt(sFld_name);
|
var firstChar = sFld_name.charAt(sFld_name);
|
||||||
pattern =/[A-Za-z_]/;
|
pattern =/[A-Za-z_]/;
|
||||||
if(pattern.test(firstChar) == false) {
|
if(pattern.test(firstChar) == false) {
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
iMessage = 6;
|
iMessage = 6;
|
||||||
sInvalidCharacter = sFld_name;
|
sInvalidCharacter = sFld_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -306,32 +245,32 @@ var verifyData = function(oForm) {
|
|||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:'@G::LoadTranslation(ID_FIELD_NAME_REQUIRED)'
|
label:'@G::LoadTranslation(ID_FIELD_NAME_REQUIRED)'
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:'@G::LoadTranslation(ID_FIELD_SIZE_REQUIRED)'
|
label:'@G::LoadTranslation(ID_FIELD_SIZE_REQUIRED)'
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:G_STRINGS.ID_FIELD_FOREIGN_TABLE
|
label:G_STRINGS.ID_FIELD_FOREIGN_TABLE
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_CANNOT_BE_PRIMARY_KEY)"
|
label:"@G::LoadTranslation(ID_FIELD_CANNOT_BE_PRIMARY_KEY)"
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_DUPLICATE)" + " " + sDuplicate
|
label:"@G::LoadTranslation(ID_FIELD_DUPLICATE)" + " " + sDuplicate
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:"@G::LoadTranslation(ID_FIELD_INVALID)" + " " + sInvalidCharacter
|
label:"@G::LoadTranslation(ID_FIELD_INVALID)" + " " + sInvalidCharacter
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -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,45 +311,46 @@ 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;
|
||||||
for (i = 0; i < aAux.length; i++) {
|
for (i = 0; i < aAux.length; i++) {
|
||||||
var sChar = aAux[i].substring(0,1).toUpperCase();
|
var sChar = aAux[i].substring(0,1).toUpperCase();
|
||||||
sAux += sChar + aAux[i].substring(1,aAux[i].length).toLowerCase();
|
sAux += sChar + aAux[i].substring(1,aAux[i].length).toLowerCase();
|
||||||
}
|
}
|
||||||
pattern =/[A-Za-z_]/;
|
pattern =/[A-Za-z_]/;
|
||||||
var first = sAux.charAt(sAux);
|
var first = sAux.charAt(sAux);
|
||||||
if(pattern.test(first) == false) {
|
if(pattern.test(first) == false) {
|
||||||
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();
|
||||||
var firstChar = sTbl_name.charAt(sTbl_name);
|
var firstChar = sTbl_name.charAt(sTbl_name);
|
||||||
pattern =/[A-Za-z_]/;
|
pattern =/[A-Za-z_]/;
|
||||||
if(pattern.test(firstChar) == false) {
|
if(pattern.test(firstChar) == false) {
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:'@G::LoadTranslation(ID_TABLE_INVALID_SYNTAX)' + ' ' + sTbl_name
|
label:'@G::LoadTranslation(ID_TABLE_INVALID_SYNTAX)' + ' ' + sTbl_name
|
||||||
});
|
});
|
||||||
oSaveButton.disabled = true;
|
oSaveButton.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reserved words
|
// Reserved words
|
||||||
var sTableName = getField('ADD_TAB_NAME').value.toUpperCase();
|
var sTableName = getField('ADD_TAB_NAME').value.toUpperCase();
|
||||||
|
|
||||||
for(var i = 0; i < aReservedWords.length; i++ ) {
|
for(var i = 0; i < aReservedWords.length; i++ ) {
|
||||||
if(sTableName == aReservedWords[i]) {
|
if(sTableName == aReservedWords[i]) {
|
||||||
new leimnud.module.app.alert().make({
|
new leimnud.module.app.alert().make({
|
||||||
label:G_STRINGS.ID_TABLE_RESERVED_WORDS + ' ' + sTableName
|
label:G_STRINGS.ID_TABLE_RESERVED_WORDS + ' ' + sTableName
|
||||||
});
|
});
|
||||||
oSaveButton.disabled = true;
|
oSaveButton.disabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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