version 1.45, 2003/01/15 22:19:08 |
version 1.46, 2003/01/27 20:50:01 |
|
|
* http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.44 2003/01/12 14:58:38 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.45 2003/01/15 22:19:08 nepto Exp $ */ |
|
|
/* phpMyEdit intro {{{ */ |
/* phpMyEdit intro {{{ */ |
/* |
/* |
|
|
if (count($required_ar) > 0) { |
if (count($required_ar) > 0) { |
echo '<script type="text/javascript"><!--'."\n"; |
echo '<script type="text/javascript"><!--'."\n"; |
echo ' |
echo ' |
|
function phpMyEdit_trim(str) |
|
{ |
|
while (str.substring(0, 1) == " " |
|
|| str.substring(0, 1) == "\\n" |
|
|| str.substring(0, 1) == "\\r") |
|
{ |
|
str = str.substring(1, str.length); |
|
} |
|
while (str.substring(str.length - 1, str.length) == " " |
|
|| str.substring(str.length - 1, str.length) == "\\n" |
|
|| str.substring(str.length - 1, str.length) == "\\r") |
|
{ |
|
str = str.substring(0, str.length - 1); |
|
} |
|
return str; |
|
} |
|
|
function phpMyEdit_form_control(theForm) |
function phpMyEdit_form_control(theForm) |
{'."\n"; |
{'."\n"; |
foreach ($required_ar as $field_num) { |
foreach ($required_ar as $field_num) { |
if ($this->col_has_values($field_num)) { |
if ($this->col_has_values($field_num)) { |
$condition = '.selectedIndex == -1'; |
$condition = 'theForm.%s.selectedIndex == -1'; |
$multiple = $this->fdd[$field_num]['select'] == 'M' |
$multiple = $this->fdd[$field_num]['select'] == 'M' |
|| $this->col_is_set($field_num); |
|| $this->col_is_set($field_num); |
} else { |
} else { |
$condition = '.value.length == 0'; |
$condition = 'phpMyEdit_trim(theForm.%s.value) == ""'; |
$multiple = false; |
$multiple = false; |
} |
} |
|
|
/* Multiple selects have their name like ``name[]''. |
/* Multiple selects have their name like ``name[]''. |
It is not possible to work with it directly, because |
It is not possible to work with them directly, because |
theForm.name[].something will result into JavaScript |
theForm.name[].something will result into JavaScript |
syntax error. Following search algorithm is provided |
syntax error. Following search algorithm is provided |
as a workaround for this. |
as a workaround for this. |
Line 790 function phpMyEdit_form_control(theForm) |
|
Line 807 function phpMyEdit_form_control(theForm) |
|
break; |
break; |
} |
} |
} |
} |
if (multiple_select != null && multiple_select'.$condition.') { |
if (multiple_select != null && multiple_select.selectedIndex == -1) { |
alert("'.$this->labels['Please enter'].' '.$this->fdd[$field_num]['name'].'."); |
alert("'.$this->labels['Please enter'].' '.$this->fdd[$field_num]['name'].'."); |
return false; |
return false; |
}'."\n"; |
}'."\n"; |
} else { |
} else { |
echo ' |
echo ' |
if (theForm.'.$this->fds[$field_num].$condition.') { |
if ('.sprintf($condition, $this->fds[$field_num]).') { |
alert("'.$this->labels['Please enter'].' '.$this->fdd[$field_num]['name'].'."); |
alert("'.$this->labels['Please enter'].' '.$this->fdd[$field_num]['name'].'."); |
theForm.'.$this->fds[$field_num].'.focus(); |
theForm.'.$this->fds[$field_num].'.focus(); |
return false; |
return false; |