New Feature: Mass Edit

This commit is contained in:
Deon George
2009-07-07 19:40:48 +10:00
parent e7ce1030c0
commit 4cab46a55e
6 changed files with 365 additions and 2 deletions

48
lib/MassRender.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
/**
* This class will render the editing of multiple LDAP entries.
*
* @author The phpLDAPadmin development team
* @package phpLDAPadmin
*/
/**
* TemplateRender class
*
* @package phpLDAPadmin
* @subpackage Templates
*/
class MassRender extends TemplateRender {
protected function drawMassFormReadWriteValueAttribute($attribute,$i,$j) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
if ($attribute->getHelper())
echo '<table cellspacing="0" cellpadding="0" border=1><tr><td valign="top">';
printf('<input type="text" class="value" name="mass_values[%s][%s][%s]" id="new_values_%s_%s_%s" value="%s" %s%s %s %s/>',
$j,htmlspecialchars($attribute->getName()),$i,
$j,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->getSize() > 0) ? sprintf('size="%s"',$attribute->getSize()) : '',
($attribute->getMaxLength() > 0) ? sprintf('maxlength="%s"',$attribute->getMaxLength()) : '');
if ($attribute->getHelper()) {
echo '</td><td valign="top">';
$this->draw('AttributeHelper',$attribute,$i);
echo '</td></tr></table>';
}
}
protected function drawMassFormReadWriteValueBinaryAttribute($attribute,$i,$j) {
$this->drawFormReadWriteValueBinaryAttribute($attribute,$i);
}
protected function drawMassFormReadWriteValueJpegAttribute($attribute,$i,$j) {
$this->drawFormReadOnlyValueJpegAttribute($attribute,$i);
}
}
?>

View File

@@ -208,7 +208,8 @@ class QueryRender extends PageRender {
if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) {
$mass_actions = array(
'&nbsp;' => '',
_('delete') => 'mass_delete'
_('delete') => 'mass_delete',
_('edit') => 'mass_edit'
);
}
@@ -364,6 +365,9 @@ function hideall(key,except) {
echo '<form action="cmd.php" method="post" name="massform">';
printf('<input type="hidden" name="server_id" value="%s" />',$server->getIndex());
foreach ($this->template->resultsdata[$base]['attrs'] as $attr)
printf('<input type="hidden" name="attrs[]" value="%s" />',$attr);
echo '<table class="result_table" border=0>';
echo '<thead class="fixheader">';
@@ -394,7 +398,7 @@ function hideall(key,except) {
# Is mass action enabled.
if ($_SESSION[APPCONFIG]->getValue('mass','enabled'))
printf('<td><input type="checkbox" id="ma%s" name="dn[]" value="%s"/ onclick="this.checked=!this.checked;"></td>',$counter,$dn);
printf('<td><input type="checkbox" id="ma%s" name="dn[]" value="%s" onclick="this.checked=!this.checked;" /></td>',$counter,$dn);
$href = sprintf('cmd=template_engine&server_id=%s&dn=%s',$server->getIndex(),rawurlencode($dn));
printf('<td class="icon"><a href="cmd.php?%s"><img src="%s/%s" alt="icon" /></a></td>',

View File

@@ -308,6 +308,8 @@ class Config {
'logout' => true,
'login_form' => true,
'mass_delete' => true,
'mass_edit' => true,
'mass_update' => true,
'modify_member_form' => true,
'monitor' => true,
'purge_cache' => true,