phpldapadmin/templates/template_header.php

176 lines
6.2 KiB
PHP
Raw Normal View History

2009-06-30 09:29:51 +00:00
<?php
2009-06-30 10:26:08 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/template_header.php,v 1.6.4.5 2005/12/09 14:32:37 wurley Exp $
2009-06-30 09:29:51 +00:00
/**
* Header page for engine.
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
*/
include './header.php';
$time = gettimeofday();
$random_junk = md5(strtotime('now').$time['usec']);
$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:26:08 +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) {
$actionlayout = '<td class="icon"><img src="images/%s" /></td><td><a href="%s" title="%s">%s</a></td>';
$hintlayout = '<td class="icon"><img src="images/light.png" /></td><td colspan="3"><span class="hint">%s</span></td>';
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>';
printf($actionlayout,'refresh.png',$refresh_href,_('Refresh this entry'),_('Refresh'));
printf($actionlayout,'save.png',$export_href_base,_('Save a dump of this object'),_('Export'));
echo '</tr><tr>';
printf($actionlayout,'cut.png',$copy_href,_('Copy this object to another location, a new DN, or another server'),_('Copy or move this entry'));
if ($show_internal_attrs)
printf($actionlayout,'tools-no.png',$refresh_href,'',_('Hide internal attributes'));
else
printf($actionlayout,'tools.png',$intattr_href,'',_('Show internal attributes'));
echo '</tr>';
if (! $ldapserver->isReadOnly()) {
echo '<tr>';
printf($actionlayout,'trash.png',$delete_href,_('You will be prompted to confirm this decision'),_('Delete this entry'));
printf($actionlayout,'rename.png',$rename_href,'',_('Rename'));
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>';
printf($actionlayout,'compare.png',$compare_href,'',_('Compare with another entry'));
echo '</tr>';
echo '<tr>';
printf($actionlayout,'star.png',$create_href,'',_('Create a child entry'));
printf($actionlayout,'add.png',$addattr_href,'',_('Add new attribute'));
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>';
printf($actionlayout,'children.png',$child_href,'',($children_count == 1) ? _('View 1 child') : sprintf(_('View %s children'),$children_count));
printf($actionlayout,'save.png',$export_href_sub,_('Save a dump of this object and all of its children'),_('Export subtree'));
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);
printf('<input type="hidden" name="dn" value="%s" />',$dn);
}
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:26:08 +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>',
$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
}
?>