HTML Validation work

This commit is contained in:
Deon George
2010-02-25 02:03:10 +11:00
parent 1b55c84f06
commit f713afc8d1
33 changed files with 515 additions and 476 deletions

View File

@@ -558,7 +558,7 @@ class PageRender extends Visitor {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
echo $attribute->getValue($i);
echo htmlspecialchars($attribute->getValue($i));
}
/**
@@ -588,7 +588,7 @@ class PageRender extends Visitor {
$val = $attribute->getValue($i);
printf('<input type="text" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" readonly />',
printf('<input type="text" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" readonly="readonly" />',
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()),$i,htmlspecialchars($val));
}
@@ -598,14 +598,14 @@ class PageRender extends Visitor {
$val = $attribute->getValue($i);
if ($attribute->getHelper() || $attribute->getVerify())
echo '<table cellspacing="0" cellpadding="0" border=1><tr><td valign="top">';
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">';
printf('<input type="text" class="value" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" %s%s %s %s/>',
htmlspecialchars($attribute->getName()),$i,
htmlspecialchars($attribute->getName()),$i,
htmlspecialchars($val),
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
($attribute->getSize() > 0) ? sprintf('size="%s"',$attribute->getSize()) : '',
($attribute->getMaxLength() > 0) ? sprintf('maxlength="%s"',$attribute->getMaxLength()) : '');
@@ -689,8 +689,8 @@ class PageRender extends Visitor {
printf('<input type="file" class="value" name="new_values[%s][%s]" id="new_values_%s_%s" value="" %s%s %s %s/><br />',
htmlspecialchars($attribute->getName()),$i,
htmlspecialchars($attribute->getName()),$i,
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '',
($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : '');
}
@@ -705,8 +705,8 @@ class PageRender extends Visitor {
printf('<input type="text" class="value" id="new_values_%s_%s" name="new_values[%s][%s]" value="%s" %s%s %s %s/>&nbsp;',
$attribute->getName(),$i,
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($val),
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
($attribute->getSize() > 0) ? sprintf('size="%s"',$attribute->getSize()) : '',
($attribute->getMaxLength() > 0) ? sprintf('maxlength="%s"',$attribute->getMaxLength()) : '');
@@ -727,13 +727,13 @@ class PageRender extends Visitor {
printf('<span style="white-space: nowrap;"><input type="text" class="value" name="%s" id="%s" value="%s" %s%s %s %s/>&nbsp;',
$input_name,$id,htmlspecialchars($val),
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '',
($attribute->getMaxLength() > 0) ? 'maxlength="'.$attribute->getMaxLength().'"' : '');
# Draw a link for popping up the entry browser if this is the type of attribute that houses DNs.
draw_chooser_link(sprintf('entry_form.%s',$id),false);
draw_chooser_link('entry_form',$id,false);
echo '</span>';
if ($attribute->getHelper()) {
@@ -837,9 +837,9 @@ class PageRender extends Visitor {
$val = $attribute->getValue($i);
printf('<textarea class="roval" %s %s name="new_values[%s][%s]" id="new_values_%s_%s" readonly>%s</textarea>',
($attribute->getRows() > 0) ? 'rows="'.$attribute->getRows().'"' : '',
($attribute->getCols() > 0) ? 'cols="'.$attribute->getCols().'"' : '',
printf('<textarea class="roval" rows="%s" cols="%s" name="new_values[%s][%s]" id="new_values_%s_%s" readonly="readonly">%s</textarea>',
($attribute->getRows() > 0) ? $attribute->getRows() : 5,
($attribute->getCols() > 0) ? $attribute->getCols() : 100,
htmlspecialchars($attribute->getName()),$i,
htmlspecialchars($attribute->getName()),$i,
$val);
@@ -850,13 +850,13 @@ class PageRender extends Visitor {
$val = $attribute->getValue($i);
printf('<textarea class="value" %s %s name="new_values[%s][%s]" id="new_values_%s_%s" %s%s>%s</textarea>',
($attribute->getRows() > 0) ? 'rows="'.$attribute->getRows().'"' : '',
($attribute->getCols() > 0) ? 'cols="'.$attribute->getCols().'"' : '',
printf('<textarea class="value" rows="%s" cols="%s" name="new_values[%s][%s]" id="new_values_%s_%s" %s%s>%s</textarea>',
($attribute->getRows() > 0) ? $attribute->getRows() : 5,
($attribute->getCols() > 0) ? $attribute->getCols() : 100,
htmlspecialchars($attribute->getName()),$i,
htmlspecialchars($attribute->getName()),$i,
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
$val);
}
@@ -937,7 +937,7 @@ class PageRender extends Visitor {
$obfuscate_password = obfuscate_password_display($enc_type);
printf('<input type="%s" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" %s readonly /><br />',
printf('<input type="%s" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" %s readonly="readonly" /><br />',
($obfuscate_password ? 'password' : 'text'),
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()),
$i,htmlspecialchars($val),($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '');
@@ -969,8 +969,8 @@ class PageRender extends Visitor {
($obfuscate_password ? 'password' : 'text'),
htmlspecialchars($attribute->getName()),$i,$id,
htmlspecialchars($val),
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
($attribute->getSize() > 0) ? sprintf('size="%s"',$attribute->getSize()) : '',
($attribute->getMaxLength() > 0) ? sprintf('maxlength="%s"',$attribute->getMaxLength()) : '');
@@ -1016,24 +1016,24 @@ class PageRender extends Visitor {
if (($attribute->getSize() > 0) && ($attribute->getSize() < $attribute->getOptionCount())) {
printf('<select name="new_values[%s][]" size="%s" multiple>',
printf('<select name="new_values[%s][]" size="%s" multiple="multiple">',
htmlspecialchars($attribute->getName()),$attribute->getSize());
foreach ($attribute->getSelection() as $value => $description) {
if (in_array($value,$vals))
$selected[$value] = true;
printf('<option id="new_values_%s_%s" value="%s" onMouseDown="focus_%s(this);" onClick="blur_%s(this);" %s>%s</option>',
printf('<option id="new_values_%s_%s" value="%s" onmouseDown="focus_%s(this);" onclick="blur_%s(this);" %s>%s</option>',
htmlspecialchars($attribute->getName()),$j++,
$value,htmlspecialchars($attribute->getName()),htmlspecialchars($attribute->getName()),
isset($selected[$value]) ? 'selected' : '',$description);
isset($selected[$value]) ? 'selected="selected"' : '',$description);
echo "\n";
}
foreach ($vals as $val) {
if (! isset($selected[$val]))
printf('<option id="new_values_%s_%s" value="%s" onMouseDown="focus_%s(this);" onClick="blur_%s(this);" selected>%s</option>',
printf('<option id="new_values_%s_%s" value="%s" onmousedown="focus_%s(this);" onclick="blur_%s(this);" selected="selected">%s</option>',
htmlspecialchars($attribute->getName()),$j++,
$val,htmlspecialchars($attribute->getName()),
htmlspecialchars($attribute->getName()),$val);
@@ -1044,7 +1044,7 @@ class PageRender extends Visitor {
echo '</select>';
} else {
echo '<table cellspacing="0" cellpadding="0" border=0>';
echo '<table cellspacing="0" cellpadding="0" border="0">';
foreach ($attribute->getSelection() as $value => $description) {
if (in_array($value,$vals))
@@ -1053,19 +1053,19 @@ class PageRender extends Visitor {
printf('<tr><td><input type="checkbox" id="new_values_%s_%s" name="new_values[%s][]" value="%s" %s%s %s/></td><td><span style="white-space: nowrap;">&nbsp;%s</span></td></tr>',
htmlspecialchars($attribute->getName()),$j++,
htmlspecialchars($attribute->getName()),$value,
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
isset($selected[$value]) ? 'checked' : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
isset($selected[$value]) ? 'checked="checked"' : '',
$description);
}
foreach ($vals as $val)
if (! isset($selected[$val]))
printf('<tr><td><input type="checkbox" id="new_values_%s_%s" name="new_values[%s][]" value="%s" %s%s checked/></td><td><span style="white-space: nowrap;">&nbsp;%s</span></td></tr>',
printf('<tr><td><input type="checkbox" id="new_values_%s_%s" name="new_values[%s][]" value="%s" %s%s checked="checked"/></td><td><span style="white-space: nowrap;">&nbsp;%s</span></td></tr>',
htmlspecialchars($attribute->getName()),$j++,
htmlspecialchars($attribute->getName()),$val,
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
$val);
echo '</table>';
@@ -1091,12 +1091,12 @@ class PageRender extends Visitor {
printf('<select name="new_values[%s][]" id="new_values_%s_%s" %s%s>',
htmlspecialchars($attribute->getName()),
htmlspecialchars($attribute->getName()),$i,
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onBlur="blur_%s(this);" ',$attribute->getName()) : '');
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '');
foreach ($attribute->getSelection() as $value => $description) {
printf('<option value="%s" %s>%s</option>',$value,
($value == $val) ? 'selected' : '',$description);
($value == $val) ? 'selected="selected"' : '',$description);
if ($value == $val)
$found = true;
@@ -1108,7 +1108,7 @@ class PageRender extends Visitor {
}
if (!$found) {
printf('<option value="%s" selected>%s</option>',$val,$val == '' ? '&nbsp;' : $val);
printf('<option value="%s" selected="selected">%s</option>',$val,$val == '' ? '&nbsp;' : $val);
if ($val == '')
$empty_value = true;
echo "\n";