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

@@ -343,7 +343,7 @@ class Template extends xmlTemplate {
continue;
# If _REQUEST['skip_array'] with this attr set, we'll ignore this new_value
if (isset($_REQUEST['skip_array'][$attr]))
if (isset($_REQUEST['skip_array'][$attr]) && $_REQUEST['skip_array'][$attr] == 'on')
continue;
# Prune out entries with a blank value.

View File

@@ -1408,7 +1408,10 @@ class TemplateRender extends PageRender {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (! $this->template->isReadOnly())
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" /></td></tr>',_('Update Object'));
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" %s/></td></tr>',
_('Update Object'),
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'entry_form\'),\'%s\');"',_('Updating DN')) : ''),
_('Update Object'));
}
/** STEP FORM METHODS **/
@@ -1504,7 +1507,9 @@ class TemplateRender extends PageRender {
if ($page < $this->pagelast)
printf('<td>&nbsp;</td><td><input type="submit" id="create_button" value="%s" /></td>',_('Proceed &gt;&gt;'));
else
printf('<td style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" /></td>',_('Create Object'));
printf('<td style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" %s /></td>',
_('Create Object'),
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'entry_form\'),\'%s\');"',_('Creating Object')) : ''));
echo '</tr>';
}
@@ -2012,7 +2017,7 @@ function fillRec(id,value) {
$this->getServerID(),rawurlencode($this->template->getDN()),rawurlencode($attribute->getName(false))));
if (isAjaxEnabled())
return sprintf('(<a href="cmd.php?%s" title="%s %s" onclick="return ajDISPLAY(\'ADDVALUE%s\',\'%s&amp;raw=1\',\'%s\');">%s</a>)',
return sprintf('(<a href="cmd.php?%s" title="%s %s" onclick="return ajDISPLAY(\'ADDVALUE%s\',\'%s&amp;raw=1\',\'%s\',1);">%s</a>)',
$href_parm,_('Add an additional value to attribute'),$attribute->getName(false),$attribute->getName(),
$href_parm,_('Add Value to Attribute'),_('add value'));
else
@@ -2020,6 +2025,24 @@ function fillRec(id,value) {
$href_parm,_('Add an additional value to attribute'),$attribute->getName(false),_('add value'));
}
protected function getAddValueMenuItemObjectClassAttribute($attribute) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$href_parm = htmlspecialchars(sprintf('cmd=add_value_form&server_id=%s&dn=%s&attr=%s',
$this->getServerID(),rawurlencode($this->template->getDN()),rawurlencode($attribute->getName(false))));
if (isAjaxEnabled())
return sprintf('(<a href="cmd.php?%s" title="%s %s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>)',
$href_parm,_('Add an additional value to attribute'),$attribute->getName(false),
$href_parm,_('Add Value to Attribute'),_('add value'));
else
return sprintf('(<a href="cmd.php?%s" title="%s %s">%s</a>)',
$href_parm,_('Add an additional value to attribute'),$attribute->getName(false),_('add value'));
}
protected function getModifyMemberMenuItemAttribute($attribute) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);

View File

@@ -107,8 +107,11 @@ class page {
printf('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
if (isset($_SESSION[APPCONFIG]))
printf('<title>%s (%s) - %s</title>',
$this->_app['title'],app_version(),$_SESSION[APPCONFIG]->getValue('appearance','page_title'));
printf('<title>%s (%s) - %s%s</title>',
$this->_app['title'],
app_version(),
(get_request('dn','REQUEST') ? htmlspecialchars(get_request('dn','REQUEST')).' ' : ''),
$_SESSION[APPCONFIG]->getValue('appearance','page_title'));
else
printf('<title>%s - %s</title>',$this->_app['title'],app_version());