phpldapadmin/templates/template_header.php

176 lines
6.3 KiB
PHP
Raw Normal View History

2009-06-30 09:29:51 +00:00
<?php
2009-06-30 10:40:33 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/template_header.php,v 1.8 2006/04/29 06:49:32 wurley Exp $
2009-06-30 10:26:08 +00:00
2009-06-30 09:29:51 +00:00
/**
* Header page for engine.
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
*/
include './header.php';
2009-06-30 10:40:03 +00:00
$time = gettimeofday();
$random_junk = md5(strtotime('now').$time['usec']);
2009-06-30 09:29:51 +00:00
$url_base = sprintf('server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn);
$export_href_base = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'base');
$export_href_sub = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'sub');
2009-06-30 10:40:03 +00:00
$refresh_href = sprintf('template_engine.php?%s&amp;random=%s',$url_base,$random_junk);
2009-06-30 09:29:51 +00:00
$copy_href = sprintf('copy_form.php?%s',$url_base);
2009-06-30 10:26:08 +00:00
$intattr_href = sprintf('template_engine.php?%s&amp;show_internal_attrs=true',$url_base);
2009-06-30 09:29:51 +00:00
$delete_href = sprintf('delete_form.php?%s',$url_base);
$rename_href = sprintf('rename_form.php?%s',$url_base);
$compare_href = sprintf('compare_form.php?%s',$url_base);
$create_href = sprintf('create_form.php?server_id=%s&amp;container=%s',$ldapserver->server_id,$encoded_dn);
$addattr_href = sprintf('add_attr_form.php?%s',$url_base);
2009-06-30 10:26:08 +00:00
echo '<body>';
if ($dn) {
2009-06-30 10:40:33 +00:00
$actionlayout = '<td class="icon"><img src="images/%s" alt="%s" /></td><td><a href="%s" title="%s">%s</a></td>';
$hintlayout = '<td class="icon"><img src="images/light.png" alt="Hint" /></td><td colspan="3"><span class="hint">%s</span></td>';
2009-06-30 10:26:08 +00:00
printf('<h3 class="title">%s</h3>',htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
echo "\n";
echo '<table class="edit_dn_menu"><tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'refresh.png','Refresh',$refresh_href,_('Refresh this entry'),_('Refresh'));
printf($actionlayout,'save.png','Save',$export_href_base,_('Save a dump of this object'),_('Export'));
2009-06-30 10:26:08 +00:00
echo '</tr><tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'cut.png','Cut',$copy_href,_('Copy this object to another location, a new DN, or another server'),_('Copy or move this entry'));
2009-06-30 10:26:08 +00:00
if ($show_internal_attrs)
2009-06-30 10:40:33 +00:00
printf($actionlayout,'tools-no.png','Hide',$refresh_href,'',_('Hide internal attributes'));
2009-06-30 10:26:08 +00:00
else
2009-06-30 10:40:33 +00:00
printf($actionlayout,'tools.png','Show',$intattr_href,'',_('Show internal attributes'));
2009-06-30 10:26:08 +00:00
echo '</tr>';
if (! $ldapserver->isReadOnly()) {
echo '<tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'trash.png','Trash',$delete_href,_('You will be prompted to confirm this decision'),_('Delete this entry'));
printf($actionlayout,'rename.png','Rename',$rename_href,'',_('Rename'));
2009-06-30 10:26:08 +00:00
echo '</tr>';
if ($config->GetValue('appearance','show_hints')) {
echo '<tr>';
printf($hintlayout,_('Hint: To delete an attribute, empty the text field and click save.'));
echo '</tr>';
}
echo '<tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'compare.png','Compare',$compare_href,'',_('Compare with another entry'));
2009-06-30 10:26:08 +00:00
echo '</tr>';
echo '<tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'star.png','Create',$create_href,'',_('Create a child entry'));
printf($actionlayout,'add.png','Add',$addattr_href,'',_('Add new attribute'));
2009-06-30 10:26:08 +00:00
echo '</tr>';
}
2009-06-30 09:29:51 +00:00
flush();
2009-06-30 10:26:08 +00:00
$children = $ldapserver->getContainerContents($dn,$max_children,'(objectClass=*)',$config->GetValue('deref','view'));
2009-06-30 09:29:51 +00:00
if (($children_count = count($children)) > 0) {
if ($children_count == $max_children)
$children_count = $children_count.'+';
$child_href = sprintf('search.php?server_id=%s&amp;search=true&amp;filter=%s&amp;base_dn=%s&amp;form=advanced&amp;scope=one',
$ldapserver->server_id,rawurlencode('objectClass=*'),$encoded_dn);
2009-06-30 10:26:08 +00:00
echo '<tr>';
2009-06-30 10:40:33 +00:00
printf($actionlayout,'children.png','Children',$child_href,'',($children_count == 1) ? _('View 1 child') : sprintf(_('View %s children'),$children_count));
printf($actionlayout,'save.png','Save',$export_href_sub,_('Save a dump of this object and all of its children'),_('Export subtree'));
2009-06-30 10:26:08 +00:00
echo '</tr>';
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($config->GetValue('appearance','show_hints')) {
echo '<tr>';
printf($hintlayout,_('Hint: To view the schema for an attribute, click the attribute name.'));
echo '</tr>';
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($ldapserver->isReadOnly()) {
echo '<tr>';
printf($hintlayout,_('Viewing entry in read-only mode.'));
echo '</tr>';
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($modified_attrs) {
echo '<tr>';
printf($hintlayout,
($children_count == 1) ? sprintf(_('An attribute (%s) was modified and is highlighted below.'),implode('',$modified_attrs)) :
sprintf(_('Some attributes (%s) were modified and are highlighted below.'),implode(', ',$modified_attrs)));
echo '</tr>';
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo '</table>';
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
flush();
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if (! $ldapserver->isReadOnly()) {
echo '<form action="update_confirm.php" method="post" name="edit_form">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
2009-06-30 10:40:33 +00:00
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
2009-06-30 10:26:08 +00:00
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo '<br />'."\n\n";
echo '<table class="edit_dn">';
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($show_internal_attrs) {
2009-06-30 09:29:51 +00:00
$counter = 0;
2009-06-30 10:26:08 +00:00
foreach ($ldapserver->getDNSysAttrs($dn) as $attr => $vals) {
2009-06-30 09:29:51 +00:00
$counter++;
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',
$ldapserver->server_id,real_attr_name($attr));
2009-06-30 10:40:03 +00:00
printf('<tr><td colspan="2" class="attr"><b><a title="'._('Click to view the schema defintion for attribute type \'%s\'').'" href="%s" />%s</b></td></tr>',
2009-06-30 10:26:08 +00:00
$attr,$schema_href,htmlspecialchars($attr));
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo '<tr><td class="val"><small>';
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if ($ldapserver->isAttrBinary($attr)) {
$href = sprintf('download_binary_attr.php?server_id=%s&amp;dn=%s&amp;attr=%s',$server_id,$encoded_dn,$attr);
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo _('Binary value');
echo '<br />';
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
if (count($vals) > 1) {
for ($i=1;$i<=count($vals);$i++)
printf('<a href="%s&amp;value_num=%s"><img src="images/save.png" /> %s(%s)</a><br />',
$href,$i,_('download value'),$i);
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
} else {
printf('<a href="%s"><img src="images/save.png" /> %s</a><br />',
$href,_('download value'));
}
2009-06-30 09:29:51 +00:00
} else {
2009-06-30 10:26:08 +00:00
foreach ($vals as $v)
printf('%s<br />',htmlspecialchars($v));
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:26:08 +00:00
echo '</small></td></tr>';
2009-06-30 09:29:51 +00:00
}
if ($counter == 0)
2009-06-30 10:26:08 +00:00
printf('<tr><td colspan="2">(%s)</td></tr>',_('No internal attributes'));
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo "\n\n";
}
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
flush();
2009-06-30 09:29:51 +00:00
} else {
2009-06-30 10:26:08 +00:00
printf('<h3 class="title">%s</h3>',_('Create Object'));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('using template'),htmlspecialchars($_REQUEST['template']));
2009-06-30 09:29:51 +00:00
}
?>