HTML Validation work
This commit is contained in:
@@ -498,17 +498,21 @@ class TemplateRender extends PageRender {
|
||||
|
||||
$avail_templates = $this->getTemplates();
|
||||
$templates = $avail_templates->getTemplates($this->getMode(),$this->getModeContainer());
|
||||
printf('<center><h3>%s</h3></center>',$msg);
|
||||
printf('<h3 style="text-align: center;">%s</h3>',$msg);
|
||||
|
||||
$href_parms = array_to_query_string($_GET,array('meth'));
|
||||
printf('<form name="template_choice_form" action="cmd.php?%s" method="post">',htmlspecialchars($href_parms));
|
||||
printf('<form id="template_choice_form" action="cmd.php?%s" method="post">',htmlspecialchars($href_parms));
|
||||
echo "\n\n";
|
||||
|
||||
foreach ($_POST as $p => $v)
|
||||
printf('<input type="hidden" name="%s" value="%s">',$p,$v);
|
||||
echo "\n\n";
|
||||
if (count($_POST)) {
|
||||
echo '<div>';
|
||||
foreach ($_POST as $p => $v)
|
||||
printf('<input type="hidden" name="%s" value="%s" />',$p,$v);
|
||||
echo '</div>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
echo '<table class="forminput" width="100%" border=0>';
|
||||
echo '<table class="forminput" width="100%" border="0">';
|
||||
echo '<tr>';
|
||||
printf('<td class="heading" style="vertical-align: top">%s:</td>',_('Templates'));
|
||||
echo '<td>';
|
||||
@@ -542,7 +546,7 @@ class TemplateRender extends PageRender {
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
htmlspecialchars($details->getID()),htmlspecialchars($details->getID()),htmlspecialchars($href_parms),$details->getID(),_('Retrieving DN'));
|
||||
else
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="document.forms.template_choice_form.submit()" /></td>',
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="document.getElementById(\'template_choice_form\').submit()" /></td>',
|
||||
htmlspecialchars($details->getID()),htmlspecialchars($details->getID()));
|
||||
}
|
||||
|
||||
@@ -552,7 +556,7 @@ class TemplateRender extends PageRender {
|
||||
htmlspecialchars($details->getID()));
|
||||
|
||||
if ($isInValid)
|
||||
printf('<span style="color: gray"><acronym title="%s">',_($isInValid));
|
||||
printf('<span id="%s" style="color: gray"><acronym title="%s">',htmlspecialchars($details->getID()),_($isInValid));
|
||||
|
||||
echo _($details->getTitle());
|
||||
|
||||
@@ -579,7 +583,7 @@ class TemplateRender extends PageRender {
|
||||
printf('<td><input type="radio" name="template" value="none" id="none" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
htmlspecialchars($href_parms),'none',_('Retrieving DN'));
|
||||
else
|
||||
echo '<td><input type="radio" name="template" value="none" id="none" onclick="document.forms.template_choice_form.submit()" /></td>';
|
||||
echo '<td><input type="radio" name="template" value="none" id="none" onclick="document.getElementById(\'template_choice_form\').submit()" /></td>';
|
||||
|
||||
printf('<td class="icon"><label for="none"><img src="%s/ldap-default.png" alt="" /></label></td>',IMGDIR);
|
||||
printf('<td class="label"><label for="none">%s</label></td>',_('Default'));
|
||||
@@ -640,7 +644,7 @@ class TemplateRender extends PageRender {
|
||||
} else {
|
||||
# Draw internal attributes
|
||||
if (get_request('show_internal_attrs','REQUEST')) {
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
echo '<table class="entry" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
$this->drawInternalAttributes();
|
||||
echo '</table><br/>';
|
||||
echo "\n";
|
||||
@@ -700,7 +704,7 @@ class TemplateRender extends PageRender {
|
||||
case 'creation':
|
||||
$subtitle = sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$this->getServer()->getName(),
|
||||
_('Container'),$this->container);
|
||||
_('Container'),htmlspecialchars($this->container));
|
||||
|
||||
if ($this->template_id) {
|
||||
$subtitle .= '<br />';
|
||||
@@ -714,7 +718,7 @@ class TemplateRender extends PageRender {
|
||||
case 'modification':
|
||||
$subtitle = sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$this->getServer()->getName(),
|
||||
_('Distinguished Name'),$this->dn);
|
||||
_('Distinguished Name'),htmlspecialchars($this->dn));
|
||||
|
||||
if ($this->template_id) {
|
||||
$subtitle .= '<br />';
|
||||
@@ -737,7 +741,7 @@ class TemplateRender extends PageRender {
|
||||
# We only have a menu for editing entries.
|
||||
if ($this->template->getContext() == 'edit') {
|
||||
|
||||
echo '<table class="menu" width="100%" border=0>';
|
||||
echo '<table class="menu" width="100%" border="0">';
|
||||
echo '<tr>';
|
||||
$menuitem_number = 0;
|
||||
|
||||
@@ -767,7 +771,7 @@ class TemplateRender extends PageRender {
|
||||
if ($ms) {
|
||||
if (($menuitem_number % 2) == 1) {
|
||||
$menuitem_number++;
|
||||
echo '<td colspan=2> </td>';
|
||||
echo '<td colspan="2"> </td>';
|
||||
$endofrow = false;
|
||||
$start = false;
|
||||
}
|
||||
@@ -792,7 +796,7 @@ class TemplateRender extends PageRender {
|
||||
} elseif ($ms) {
|
||||
if (($menuitem_number % 2) == 1) {
|
||||
$menuitem_number++;
|
||||
echo '<td colspan=2> </td>';
|
||||
echo '<td colspan="2"> </td>';
|
||||
$endofrow = false;
|
||||
$start = false;
|
||||
}
|
||||
@@ -1249,7 +1253,7 @@ class TemplateRender extends PageRender {
|
||||
if (! count($this->template->getRDNAttrs())) {
|
||||
printf('<tr><th colspan="2">%s</th></tr>','RDN');
|
||||
|
||||
echo '<tr><td class="value" colspan="2"><center><select name="rdn_attribute[]" id="rdn_attribute">';
|
||||
echo '<tr><td class="value" colspan="2" style="text-align: center;"><select name="rdn_attribute[]" id="rdn_attribute" />';
|
||||
printf('<option value="">%s</option>',_('select the rdn attribute'));
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','rdn_all_attrs'))
|
||||
@@ -1267,7 +1271,7 @@ class TemplateRender extends PageRender {
|
||||
}
|
||||
}
|
||||
|
||||
echo '</select></center></td></tr>';
|
||||
echo '</select></td></tr>';
|
||||
|
||||
} else {
|
||||
echo '<tr><td colspan="2">';
|
||||
@@ -1286,7 +1290,7 @@ class TemplateRender extends PageRender {
|
||||
echo '<tr>';
|
||||
printf('<td class="heading">%s</td>',_('Container'));
|
||||
printf('<td><input type="text" name="container" size="40" value="%s" />',htmlspecialchars($default_container));
|
||||
draw_chooser_link('entry_form.container');
|
||||
draw_chooser_link('entry_form','container');
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
@@ -1303,7 +1307,7 @@ class TemplateRender extends PageRender {
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="heading">%s</td>',_('ObjectClasses'));
|
||||
echo '<td><select name="new_values[objectclass][]" multiple="true" size="15">';
|
||||
echo '<td><select name="new_values[objectclass][]" multiple="multiple" size="15">';
|
||||
|
||||
foreach ($socs as $name => $oclass) {
|
||||
if (! strcasecmp('top',$name))
|
||||
@@ -1346,29 +1350,35 @@ class TemplateRender extends PageRender {
|
||||
/** FORM METHODS **/
|
||||
|
||||
public function drawFormStart() {
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data" name="entry_form" onSubmit="return submitForm(this)">';
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data" id="entry_form" onsubmit="return submitForm(this)">';
|
||||
|
||||
echo '<div>';
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
protected function drawForm() {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
echo '<div>';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$this->getServerID());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($this->template->getDN()));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$this->template->getID());
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
echo '<table class="entry" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
|
||||
$this->drawShownAttributes();
|
||||
$this->drawFormSubmitButton();
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<div> ';
|
||||
$this->drawHiddenAttributes();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function drawFormEnd() {
|
||||
@@ -1382,11 +1392,11 @@ class TemplateRender extends PageRender {
|
||||
# For debugging, show the template object.
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_debug_info') && get_request('debug','GET')) {
|
||||
echo "\n\n";
|
||||
printf('<img src="%s/plus.png" alt="Plus" onClick="if (document.getElementById(\'DEBUGtemplate\').style.display == \'none\') { document.getElementById(\'DEBUGtemplate\').style.display = \'block\' } else { document.getElementById(\'DEBUGtemplate\').style.display = \'none\' };"/>',IMGDIR);
|
||||
printf('<img src="%s/plus.png" alt="Plus" onclick="if (document.getElementById(\'DEBUGtemplate\').style.display == \'none\') { document.getElementById(\'DEBUGtemplate\').style.display = \'block\' } else { document.getElementById(\'DEBUGtemplate\').style.display = \'none\' };"/>',IMGDIR);
|
||||
echo '<div id="DEBUGtemplate" style="display: none">';
|
||||
echo '<fieldset>';
|
||||
printf('<legend>DEBUG: %s</legend>',$this->template->getDescription());
|
||||
echo '<textarea cols=120 rows=20>';
|
||||
echo '<textarea cols="120" rows="20">';
|
||||
debug_dump($this);
|
||||
echo '</textarea>';
|
||||
echo '</fieldset>';
|
||||
@@ -1398,7 +1408,7 @@ class TemplateRender extends PageRender {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
if (! $this->template->isReadOnly())
|
||||
printf('<tr><td colspan=2><center><input type="submit" id="create_button" name="submit" value="%s" /></center></td></tr>',_('Update Object'));
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" /></td></tr>',_('Update Object'));
|
||||
}
|
||||
|
||||
/** STEP FORM METHODS **/
|
||||
@@ -1412,7 +1422,7 @@ class TemplateRender extends PageRender {
|
||||
# The default template only uses 2 pages
|
||||
$this->pagelast = 2;
|
||||
|
||||
echo '<center><h4>';
|
||||
echo '<h4 style="text-align: center;">';
|
||||
printf('%s: ',sprintf(_('Step %s of %s'),$page,$this->pagelast));
|
||||
|
||||
if ($page == 1)
|
||||
@@ -1420,10 +1430,10 @@ class TemplateRender extends PageRender {
|
||||
else
|
||||
echo _('Specify attributes and values');
|
||||
|
||||
echo '</h4></center>';
|
||||
echo '</h4>';
|
||||
|
||||
} elseif ($this->template->getDescription())
|
||||
printf('<center><h4>%s (%s)</h4></center>',
|
||||
printf('<h4 style="text-align: center;">%s (%s)</h4>',
|
||||
_($this->template->getDescription()),
|
||||
sprintf(_('Step %s of %s'),$page,$this->pagelast));
|
||||
}
|
||||
@@ -1432,10 +1442,11 @@ class TemplateRender extends PageRender {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
if (($this->template->isType('default') && $this->template->getContext() == 'create' && $page == 1) || $page < $this->pagelast) {
|
||||
echo '<form action="cmd.php?cmd=template_engine" method="post" enctype="multipart/form-data" name="entry_form" onSubmit="return submitForm(this)">';
|
||||
echo '<form action="cmd.php?cmd=template_engine" method="post" enctype="multipart/form-data" id="entry_form" onsubmit="return submitForm(this)">';
|
||||
|
||||
} else {
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data" name="entry_form" onSubmit="return submitForm(this)">';
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data" id="entry_form" onsubmit="return submitForm(this)">';
|
||||
echo '<div>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','create'))
|
||||
echo '<input type="hidden" name="cmd" value="create_confirm" />';
|
||||
@@ -1454,15 +1465,18 @@ class TemplateRender extends PageRender {
|
||||
$this->drawHiddenAttributes();
|
||||
|
||||
if ($this->template->isType('default') && $page == 1) {
|
||||
echo '<table class="forminput" align="center" border=0>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="forminput" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
|
||||
$this->drawContainerChooser($this->template->getContainer());
|
||||
$this->drawObjectClassChooser();
|
||||
|
||||
} else {
|
||||
printf('<input type="hidden" name="container" value="%s" />',htmlspecialchars($this->template->getContainer()));
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
echo '<table class="entry" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
|
||||
$this->drawRDNChooser();
|
||||
|
||||
@@ -1490,7 +1504,7 @@ class TemplateRender extends PageRender {
|
||||
if ($page < $this->pagelast)
|
||||
printf('<td> </td><td><input type="submit" id="create_button" value="%s" /></td>',_('Proceed >>'));
|
||||
else
|
||||
printf('<td><center><input type="submit" id="create_button" name="submit" value="%s"/></center></td>',_('Create Object'));
|
||||
printf('<td style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" /></td>',_('Create Object'));
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
@@ -1522,7 +1536,7 @@ class TemplateRender extends PageRender {
|
||||
$this->draw('Template',$attribute);
|
||||
|
||||
else
|
||||
printf('<tr class="noinput"><td colspan="2"><center>(%s)</center></td></tr>',_('none'));
|
||||
printf('<tr class="noinput"><td colspan="2" style="text-align: center;">(%s)</td></tr>',_('none'));
|
||||
|
||||
printf('<tr><th colspan="2">%s</th></tr>',_('Optional Attributes'));
|
||||
if (count($attrs['optional']))
|
||||
@@ -1530,7 +1544,7 @@ class TemplateRender extends PageRender {
|
||||
$this->draw('Template',$attribute);
|
||||
|
||||
else
|
||||
printf('<tr class="noinput"><td colspan="2"><center>(%s)</center></td></tr>',_('none'));
|
||||
printf('<tr class="noinput"><td colspan="2" style="text-align: center;">(%s)</td></tr>',_('none'));
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
@@ -1556,14 +1570,14 @@ class TemplateRender extends PageRender {
|
||||
printf('<!-- START: %s -->',__METHOD__);
|
||||
echo "\n";
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sTemplateRender.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%stoAscii.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sTemplateRender.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%stoAscii.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo "\n";
|
||||
|
||||
printf('<!-- START: MAIN FORM VALIDATION: %s -->',__METHOD__);
|
||||
echo '
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
function validateForm(silence) {
|
||||
var i = 0;
|
||||
var valid = true;
|
||||
@@ -1598,7 +1612,7 @@ function validateForm(silence) {
|
||||
|
||||
# For DateAttributes, we need to set some defaults for the js_calendar.
|
||||
echo '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
echo 'var defaults = new Array();'."\n";
|
||||
printf('var default_date_format = "%s";',$_SESSION[APPCONFIG]->getValue('appearance','date'));
|
||||
echo "\n";
|
||||
@@ -1609,7 +1623,7 @@ function validateForm(silence) {
|
||||
foreach ($this->template->getAttributesShown() as $attribute)
|
||||
$this->draw('Javascript',$attribute);
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">validateForm(true);</script>'."\n";
|
||||
echo '<script type="text/javascript">validateForm(true);</script>'."\n";
|
||||
printf('<!-- END: %s -->',__METHOD__);
|
||||
echo "\n";
|
||||
}
|
||||
@@ -1633,7 +1647,7 @@ function validateForm(silence) {
|
||||
printf('<!-- START: %s -->',__METHOD__);
|
||||
|
||||
echo '
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
var attrTrace;
|
||||
function fill(id,value) {
|
||||
attrTrace = new Array();
|
||||
@@ -1718,7 +1732,7 @@ function fillRec(id,value) {
|
||||
else
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td class="value" colspan=2>';
|
||||
echo '<td class="value" colspan="2">';
|
||||
}
|
||||
|
||||
protected function drawEndValueLineAttribute($attribute) {
|
||||
@@ -1784,7 +1798,7 @@ function fillRec(id,value) {
|
||||
|
||||
else {
|
||||
if ($icon = $attribute->getIcon())
|
||||
printf('<img src="%s" alt="Icon" align="top" /> ',$icon);
|
||||
printf('<img src="%s" alt="Icon" style="float: right;" /> ',$icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1792,7 +1806,7 @@ function fillRec(id,value) {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
if (strlen($val) <= 0)
|
||||
printf('<img src="%s/ldap-alias.png" alt="Go" align="top" /> ',IMGDIR);
|
||||
printf('<img src="%s/ldap-alias.png" alt="Go" style="float: right;" /> ',IMGDIR);
|
||||
elseif ($this->getServer()->dnExists($val))
|
||||
printf('<a href="cmd.php?cmd=template_engine&server_id=%s&dn=%s" title="%s %s"><img src="%s/ldap-alias.png" alt="Go" /></a> ',
|
||||
$this->getServerID(),rawurlencode($val),_('Go to'),$val,IMGDIR);
|
||||
@@ -1803,7 +1817,7 @@ function fillRec(id,value) {
|
||||
protected function drawMailValueIconAttribute($attribute,$val) {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
$img = sprintf('<img src="%s/mail.png" alt="%s" align="top" />',IMGDIR,_('Mail'));
|
||||
$img = sprintf('<img src="%s/mail.png" alt="%s" style="float: right;" />',IMGDIR,_('Mail'));
|
||||
if (strlen($val) <= 0)
|
||||
echo $img;
|
||||
else
|
||||
@@ -1814,13 +1828,13 @@ function fillRec(id,value) {
|
||||
protected function drawUrlValueIconAttribute($attribute,$val) {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
$img = sprintf('<img src="%s/ldap-dc.png" alt="%s" align="top" />',IMGDIR,_('URL'));
|
||||
$img = sprintf('<img src="%s/ldap-dc.png" alt="%s" style="float: right;" />',IMGDIR,_('URL'));
|
||||
$url = explode(' +',$val,2);
|
||||
|
||||
if (strlen($val) <= 0)
|
||||
echo $img;
|
||||
else
|
||||
printf('<a href="%s" target="new">%s</a>',htmlspecialchars($url[0]),$img);
|
||||
printf('<a href="%s" onclick="target=\'new\';">%s</a>',htmlspecialchars($url[0]),$img);
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
@@ -1838,7 +1852,7 @@ function fillRec(id,value) {
|
||||
printf('<!-- START: ATTRIBUTE %s (%s)-->',__METHOD__,$attribute->getName());
|
||||
echo "\n";
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
|
||||
echo '// focus'."\n";
|
||||
if ($attribute->needJS('focus')) {
|
||||
@@ -1936,7 +1950,7 @@ function fillRec(id,value) {
|
||||
|
||||
$item = '';
|
||||
|
||||
echo '<table class="entry" border=0><tr><td width=25> </td>';
|
||||
echo '<table class="entry" border="0"><tr><td style="width: 25px;"> </td>';
|
||||
echo '<td>';
|
||||
foreach (array('add','modify','rename') as $action)
|
||||
if ($item = $this->get('MenuItem',$attribute,$action))
|
||||
@@ -2048,7 +2062,7 @@ function fillRec(id,value) {
|
||||
$val = $attribute->getValue($i);
|
||||
|
||||
if ($attribute->isVisible()) {
|
||||
echo '<table cellspacing="0" cellpadding="0" width="100%" border=0><tr><td class="icon" width=25>';
|
||||
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td class="icon" style="width: 25px;">';
|
||||
$this->draw('Icon',$attribute,$val);
|
||||
echo '</td>';
|
||||
|
||||
@@ -2063,7 +2077,7 @@ function fillRec(id,value) {
|
||||
if ($attribute->isVisible()) {
|
||||
echo '</td>';
|
||||
|
||||
echo '<td valign="top" align="right">';
|
||||
echo '<td valign="top" style="text-align: right;">';
|
||||
$this->draw('RequiredSymbol',$attribute);
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
@@ -2129,14 +2143,14 @@ function fillRec(id,value) {
|
||||
$id,htmlspecialchars($attribute->getName()),$i);
|
||||
|
||||
foreach ($vals as $v) {
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected' : '',$v);
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected="selected"' : '',$v);
|
||||
|
||||
if ($v == $default)
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if (! $found)
|
||||
printf('<option value="%s" selected>%s</option>',$default,$default ? $default : ' ');
|
||||
printf('<option value="%s" selected="selected">%s</option>',$default,$default ? $default : ' ');
|
||||
|
||||
echo '</select>';
|
||||
|
||||
@@ -2185,7 +2199,7 @@ function fillRec(id,value) {
|
||||
echo "\n";
|
||||
|
||||
echo '<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->';
|
||||
echo '<form name="delete_attribute_form" action="cmd.php?cmd=delete_attr" method="post">';
|
||||
echo '<form id="delete_attribute_form" action="cmd.php?cmd=delete_attr" method="post">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$this->getServerID());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($this->template->getDN()));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$this->template->getID());
|
||||
@@ -2194,13 +2208,13 @@ function fillRec(id,value) {
|
||||
echo '</form>';
|
||||
|
||||
echo '
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
function deleteAttribute(attrName,friendlyName,i)
|
||||
{
|
||||
if (confirm("'._('Really delete value from attribute').' \'" + friendlyName + "\'?")) {
|
||||
document.delete_attribute_form.attr.value = attrName;
|
||||
document.delete_attribute_form.index.value = i;
|
||||
document.delete_attribute_form.submit();
|
||||
document.getElementById(\'delete_attribute_form\'.attr.value = attrName;
|
||||
document.getElementById(\'delete_attribute_form\'.index.value = i;
|
||||
document.getElementById(\'delete_attribute_form\'.submit();
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
@@ -2224,9 +2238,9 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
|
||||
# This JS may have been rendered by multiple Date attributes
|
||||
if (! $drawn) {
|
||||
printf('<script type="text/javascript" language="javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdate_selector.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR);
|
||||
|
||||
$drawn = true;
|
||||
}
|
||||
@@ -2240,10 +2254,10 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$config['format'] = $config['date'][$attribute->getName()];
|
||||
|
||||
for ($i=0;$i<=$attribute->getValueCount();$i++) {
|
||||
printf('<script type="text/javascript" language="javascript">defaults[\'new_values_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,$config['format']);
|
||||
printf('<script type="text/javascript">defaults[\'new_values_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,$config['format']);
|
||||
|
||||
if (in_array_ignore_case($attribute->getName(),array_keys($config['time'])) && ($config['time'][$attribute->getName()]))
|
||||
printf('<script type="text/javascript" language="javascript">defaults[\'f_time_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,'true');
|
||||
printf('<script type="text/javascript">defaults[\'f_time_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,'true');
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
@@ -2256,7 +2270,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
* Draws an HTML date selector button which, when clicked, pops up a date selector dialog.
|
||||
*/
|
||||
protected function drawSelectorPopupDateAttribute($attribute,$i) {
|
||||
printf('<a href="javascript:dateSelector(\'%s_%s\');" title="%s"><img class="chooser" src="%s/calendar.png" id="f_trigger_%s_%s" style="cursor: pointer;" alt="Calendar" /></a>',
|
||||
printf('<a href="javascript:dateSelector(\'%s_%s\');" title="%s"><img src="%s/calendar.png" alt="Calendar" class="chooser" id="f_trigger_%s_%s" style="cursor: pointer;" /></a>',
|
||||
$attribute->getName(),$i,_('Click to popup a dialog to select a date graphically'),IMGDIR,$attribute->getName(),$i);
|
||||
}
|
||||
|
||||
@@ -2299,7 +2313,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
|
||||
# Add the javascript so we can call check password later.
|
||||
echo '
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript">
|
||||
function passwordComparePopup(component_id) {
|
||||
mywindow = open(\'password_checker.php\',\'myname\',\'resizable=no,width=500,height=200,scrollbars=1\');
|
||||
mywindow.location.href = \'password_checker.php?componentid=\'+component_id;
|
||||
@@ -2337,7 +2351,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$pwd = str_replace("'","\\'",$pwd);
|
||||
|
||||
printf("\n<!-- %s -->\n",__METHOD__);
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo '<script type="text/javascript">'."\n";
|
||||
echo 'var i = 0;'."\n";
|
||||
printf('var component = document.getElementById(\'new_values_%s_\'+i);',$attribute->getName());
|
||||
echo "\n";
|
||||
@@ -2368,14 +2382,14 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$default = $this->getServer()->getValue('appearance','password_hash');
|
||||
|
||||
if (! $attribute->getPostValue())
|
||||
printf('<input type="hidden" name="post_value[%s][]" value="%s"/>',$attribute->getName(),$i);
|
||||
printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i);
|
||||
|
||||
printf('<select name="%s[%s][%s]" id="%s_%s_%s">',
|
||||
$id,htmlspecialchars($attribute->getName()),$i,
|
||||
$id,htmlspecialchars($attribute->getName()),$i);
|
||||
|
||||
foreach (password_types() as $v => $display)
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected' : '',$display);
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected="selected"' : '',$display);
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
@@ -2384,7 +2398,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$id = 'enc';
|
||||
|
||||
if (! $attribute->getPostValue())
|
||||
printf('<input type="hidden" name="post_value[%s][]" value="%s"/>',$attribute->getName(),$i);
|
||||
printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i);
|
||||
|
||||
switch ($attribute->getName()) {
|
||||
case 'sambalmpassword' : $enc = 'lm'; break;
|
||||
@@ -2394,7 +2408,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
return '';
|
||||
}
|
||||
|
||||
printf('<input type="hidden" name="%s[%s][%s]" id="%s_%s_%s" value="%s">',
|
||||
printf('<input type="hidden" name="%s[%s][%s]" id="%s_%s_%s" value="%s" />',
|
||||
$id,htmlspecialchars($attribute->getName()),$i,
|
||||
$id,htmlspecialchars($attribute->getName()),$i,$enc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user