AJAX work on create/update

This commit is contained in:
Deon George
2010-03-13 20:45:40 +11:00
parent f713afc8d1
commit 2e8e9625d6
10 changed files with 160 additions and 30 deletions

View File

@@ -60,7 +60,7 @@ if (count($request['template']->getLDAPadd(true))) {
echo '</div>';
echo "\n\n";
echo '<form action="cmd.php" method="post">';
echo '<form action="cmd.php" method="post" id="create_form">';
echo '<div>';
echo '<input type="hidden" name="cmd" value="create" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
@@ -111,19 +111,32 @@ if (count($request['template']->getLDAPadd(true))) {
echo '<div style="text-align: center;">';
echo '<br />';
printf('<input type="submit" value="%s" />',_('Commit'));
printf('<input type="submit" name="cancel" value="%s" />',_('Cancel'));
printf('<input type="submit" value="%s" %s/>',
_('Commit'),
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'create_form\'),\'%s\');"',_('Updating Object')) : ''));
printf('<input type="submit" name="cancel" value="%s" %s/>',
_('Cancel'),
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&container=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getContainer(),_('Retrieving DN')) : ''));
echo '</div>';
echo '</form>';
echo '<br />';
} else {
echo '<div style="text-align: center;">';
echo _('You made no changes');
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
$href = sprintf('cmd=template_engine&server_id=%s&dn=%s',
$app['server']->getIndex(),rawurlencode($request['dn']));
printf(' <a href="%s">%s</a>.',htmlspecialchars($href),_('Go back'));
echo '<div style="text-align: center;">';
echo _('You made no changes');
if (isAjaxEnabled())
printf(' <a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>.',
htmlspecialchars($href),htmlspecialchars($href),_('Retrieving DN'),_('Go back'));
else
printf(' <a href="cmd.php?%s">%s</a>.',htmlspecialchars($href),_('Go back'));
echo '</div>';
}
?>