diff options
Diffstat (limited to 'src/lib/Server/Hostbase/hostbase')
6 files changed, 299 insertions, 435 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index 48e924ddc..146963af5 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -13,7 +13,7 @@ from django.db import connection from django.shortcuts import render_to_response import re -templatedir = '/usr/lib/python2.3/site-packages/Hostbase/hostbase/webtemplates' +templatedir = '/usr/lib/python2.4/site-packages/Hostbase/hostbase/webtemplates' attribs = ['hostname', 'whatami', 'netgroup', 'security_class', 'support', 'csi', 'printq', 'primary_user', 'administrator', 'location', @@ -91,9 +91,9 @@ def search(request): cursor.execute(querystring) results = cursor.fetchall() - return render_to_response('%s/results.html' % templatedir, {'hosts': results}) + return render_to_response('results.html', {'hosts': results}) else: - return render_to_response('%s/search.html' % templatedir, + return render_to_response('search.html', {'TYPE_CHOICES': Interface.TYPE_CHOICES, 'DNS_CHOICES': Name.DNS_CHOICES, 'yesno': [(1, 'yes'), (0, 'no')]}) @@ -104,7 +104,7 @@ def look(request, host_id): interfaces = [] for interface in host.interface_set.all(): interfaces.append([interface, interface.ip_set.all()]) - return render_to_response('%s/host.html' % templatedir, + return render_to_response('host.html', {'host': host, 'interfaces': interfaces}) @@ -121,7 +121,7 @@ def dns(request, host_id): for name in ip.name_set.all(): cnames.extend(name.cname_set.all()) mxs.append((name.id, name.mxs.all())) - return render_to_response('%s/dns.html' % templatedir, + return render_to_response('dns.html', {'host': host, 'info': info, 'cnames': cnames, @@ -300,12 +300,14 @@ def edit(request, host_id): return HttpResponse(str(t)) # examine the check boxes for any changes else: - t = Template(open('%s/edit.html' % templatedir).read()) - hostdata = gethostdata(host_id) - t = fill(t, hostdata) - t.type_choices = Interface.TYPE_CHOICES - t.request = request - return HttpResponse(str(t)) + host = Host.objects.get(id=host_id) + interfaces = [] + for interface in host.interface_set.all(): + interfaces.append([interface, interface.ip_set.all()]) + return render_to_response('edit.html', + {'host': host, + 'interfaces': interfaces, + 'TYPE_CHOICES': Interface.TYPE_CHOICES}) def confirm(request, item, item_id, host_id, name_id=None): """Asks if the user is sure he/she wants to remove an item""" @@ -335,44 +337,48 @@ def confirm(request, item, item_id, host_id, name_id=None): else: return HttpResponseRedirect('/hostbase/%s/edit' % host_id) else: - temp = Template(open('%s/confirm.html' % templatedir).read()) interface = None ips = [] - names = {} - cnames = {} - mxs = {} + names = [] + cnames = [] + mxs = [] if item == 'interface': interface = Interface.objects.get(id=item_id) ips = interface.ip_set.all() for ip in ips: - names[ip.id] = ip.name_set.all() - for name in names[ip.id]: - cnames[name.id] = name.cname_set.all() - mxs[name.id] = name.mx_set.all() + for name in ip.name_set.all(): + names.append((ip.id, name)) + for cname in name.cname_set.all(): + cnames.append((name.id, cname)) + for mx in name.mxs.all(): + mxs.append((name.id, mx)) elif item=='ip': ips = [IP.objects.get(id=item_id)] - names[ips[0].id] = ips[0].name_set.all() - for name in names[ips[0].id]: - cnames[name.id] = name.cname_set.all() - mxs[name.id] = name.mx_set.all() + for name in ips[0].name_set.all(): + names.append((ips[0].id, name)) + for cname in name.cname_set.all(): + cnames.append((name.id, cname)) + for mx in name.mxs.all(): + mxs.append((name.id, mx)) elif item=='name': names = [Name.objects.get(id=item_id)] - for name in names: - cnames[name.id] = name.cname_set.all() - mxs[name.id] = name.mxs.all() + for cname in names[0].cname_set.all(): + cnames.append((names[0].id, cname)) + for mx in names[0].mxs.all(): + mxs.append((names[0].id, mx)) elif item=='cname': cnames = [CName.objects.get(id=item_id)] elif item=='mx': mxs = [MX.objects.get(id=item_id)] - temp.interface = interface - temp.ips = ips - temp.names = names - temp.cnames = cnames - temp.mxs = mxs - temp.id = item_id - temp.type = item - temp.host_id = host_id - return HttpResponse(str(temp)) + return render_to_response('confirm.html', + {'interface': interface, + 'ips': ips, + 'names': names, + 'cnames': cnames, + 'id': item_id, + 'type': item, + 'host_id': host_id, + 'mxs': mxs}) def dnsedit(request, host_id): """Edits specific DNS information @@ -423,11 +429,26 @@ def dnsedit(request, host_id): name.mxs.add(mx) return HttpResponseRedirect('/hostbase/%s/dns' % host_id) else: - temp = Template(open('%s/dnsedit.html' % templatedir).read()) - hostdata = gethostdata(host_id, True) - temp = fill(temp, hostdata, True) - temp.request = request - return HttpResponse(str(temp)) + host = Host.objects.get(id=host_id) + ips = [] + info = [] + cnames = [] + mxs = [] + interfaces = host.interface_set.all() + for interface in host.interface_set.all(): + ips.extend(interface.ip_set.all()) + for ip in ips: + info.append([ip, ip.name_set.all()]) + for name in ip.name_set.all(): + cnames.extend(name.cname_set.all()) + mxs.append((name.id, name.mxs.all())) + return render_to_response('dnsedit.html', + {'host': host, + 'info': info, + 'cnames': cnames, + 'mxs': mxs, + 'request': request, + 'interfaces': interfaces}) def new(request): """Function for creating a new host in hostbase @@ -571,7 +592,8 @@ def new(request): {'TYPE_CHOICES': Interface.TYPE_CHOICES, 'NETGROUP_CHOICES': Host.NETGROUP_CHOICES, 'CLASS_CHOICES': Host.CLASS_CHOICES, - 'SUPPORT_CHOICES': Host.SUPPORT_CHOICES}) + 'SUPPORT_CHOICES': Host.SUPPORT_CHOICES, + 'WHATAMI_CHOICES': Host.WHATAMI_CHOICES}) def validate(request, new=False, host_id=None): """Function for checking form data""" diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html b/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html index 96ed4ed4f..2c46e4fe7 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/confirm.html @@ -1,189 +1,100 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><!-- InstanceBegin template="/Templates/publicFull.dwt" codeOutsideHTMLIsLocked="false" -->
-<head>
-<link href="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/stylesheets/argonne.css" rel="stylesheet" type="text/css">
-<link href="http://www.anl.gov/favicon.ico" rel="SHORTCUT ICON">
-<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/anlmain.js" type="text/JavaScript"></script>
-<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/stm31.js" type="text/JavaScript"></script>
-<!-- InstanceBeginEditable name="head" --> -<!-- Insert page specific head elements in this region, including custom javascript --> -<!-- TemplateBeginEditable name="head" --> -<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/main.js" type="text/JavaScript"></script> -<!-- TemplateEndEditable --><!-- InstanceEndEditable -->
-<!-- InstanceBeginEditable name="title" --> -<title></title> -<!-- InstanceEndEditable -->
-<!-- InstanceBeginEditable name="metadata" --> -<meta name="description" content=""> -<meta name="keywords" content=""> -<meta name="classification" content=""> -<meta name="author" content="Argonne National Laboratory"> -<meta name="expires" content=""> -<!-- InstanceEndEditable -->
-<!-- InstanceParam name="Contact URL" type="URL" value="../about/contacts.html" --><!-- InstanceParam name="Sitemap URL" type="URL" value="../Division/sitemap.html" --><!-- InstanceParam name="Search URL" type="URL" value="../About/search.html" --><!-- InstanceParam name="enableOptionalSponsorLogos" type="boolean" value="true" --><!-- InstanceParam name="enableNavBarTabs" type="boolean" value="true" --><!-- InstanceParam name="enableNavBarSearch" type="boolean" value="false" --><!-- InstanceParam name="enableOptionalSitemapFooter" type="boolean" value="false" --><!-- InstanceParam name="enableOptionalSearchFooter" type="boolean" value="false" -->
-</head>
-<body>
-<table width="100%" border="0" cellpadding="0" cellspacing="3">
- <tr>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr class="headerBkgd" valign="middle">
- <td width="10"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" height="10" width="10" border="0" alt=""></td>
- <td width="300" align="left"><a href="http://www.anl.gov"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/argonne_header_logo.jpg" alt="Argonne National Laboratory" width="227" height="100" border="0"></a></td>
- <td><span class="sectionTitle"><!-- InstanceBeginEditable name="divisionProgramIdentity" --><img src="http://www-unix.mcs.anl.gov/hostbaseweb/images/mcs_logo_white_minus_logo_small.png" width="92" height="31"><br> - <a href="http://www.mcs.anl.gov">Mathematics - and Computer Science </a><!-- InstanceEndEditable --></span></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
-
- <tr> <!-- InstanceBeginRepeat name="localNavigation" --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> <a href="http://www.mcs.anl.gov">About - Us</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --><a href="http://www-fp.mcs.anl.gov/division/research/">Research</a><!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> <a href="../research/index.html"></a><a href="http://www-fp.mcs.anl.gov/division/resources/">Facilities</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --><a href="http://www-fp.mcs.anl.gov/division/people/">Staff</a><!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/software/">Software</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/collaboration">Collaborations </a> - <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/information/">Information</a> - <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat -->
-
- <td class="navGlobalBkgd" width="50%"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="1" height="30" border="0" alt=""></td>
- </tr> </table>
- <!-- #EndLibraryItem --></td>
- </tr>
- <tr>
- <td class="greyBkgdLight"><span class="breadcrumbs"><a href="http://www.mcs.anl.gov/">MCS
- Home</a> > <!-- InstanceBeginEditable name="topLevelBreadcrumbs" --> - <script language="JavaScript">breadCrumbs("www-unix.mcs.anl.gov/new",">","","breadcrumbs","None","None","0");</script> - <!-- InstanceEndEditable --></span></td>
- </tr>
- <tr valign="top">
- <td nowrap><table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td><!-- InstanceBeginEditable name="mainFeature" --> +{% extends "base.html" %} + +{% block pagebanner %} + <div class="header"> + <h2>Confirm Removal</h2> + </div> + <br/> +{% endblock %} + +{% block sidebar %} +<a href="/hostbase/" class="sidebar">new search</a> +{% endblock %} + +{% block content %} + <form name="input" action="confirm.html?sub=true" method="post"> -<h3>Are you sure?</h3> Are you sure you want to remove these items? -#if $interface +{% if interface %} <ul> -<li> interface: $interface.__str__ </li> -#end if +<li> interface: {{ interface.mac_addr }} </li> +{% endif %} -#if $ips +{% if ips %} <ul> -#for $ip in $ips -<li> ip: $ip.__str__ </li> +{% for ip in ips %} +<li> ip: {{ ip.ip_addr }} </li> <ul> -#for $name in $names[$ip.id] -<li> name: $name.__str__ </li> +{% for name in names %} +{% ifequal name.0 ip.id %} +<li> name: {{ name.1.name }} </li> <ul> -#for $cname in $cnames[$name.id] -<li> cname: $cname.__str__ </li> -#end for +{% endifequal %} +{% for cname in cnames %} +{% ifequal cname.0 name.1.id %} +<li> cname: {{ cname.1.name }} </li> +{% endifequal %} +{% endfor %} </ul> <ul> -#for $mx in $mxs[$name.id] -<li> mx: $mx.priority $mx.__str__ </li> -#end for +{% for mx in mxs %} +{% ifequal mx.0 name.1.id %} +<li> mx: {{ mx.1.priority }} {{ mx.1.mx }} </li> +{% endifequal %} +{% endfor %} </ul> -#end for +{% endfor %} </ul> -#end for +{% endfor %} </ul> -#end if +{% endif %} -#if $names and not $ips +{% if names and not ips %} <ul> -#for $name in $names -<li> name: $name.__str__ </li> +{% for name in names %} +<li> name: {{ name.name }} </li> <ul> -#for $cname in $cnames[$name.id] -<li> cname: $cname.__str__ </li> -#end for +{% for cname in cnames %} +{% ifequal cname.0 name.id %} +<li> cname: {{ cname.1.cname }} </li> +{% endifequal %} +{% endfor %} </ul> <ul> -#for $mx in $mxs[$name.id] -<li> mx: $mx.priority $mx.__str__ </li> -#end for +{% for mx in mxs %} +{% ifequal mx.0 name.id %} +<li> mx: {{ mx.1.priority }} {{ mx.1.mx }} </li> +{% endifequal %} +{% endfor %} </ul> -#end for +{% endfor %} </ul> -#end if +{% endif %} -#if $cnames and not $names +{% if cnames and not names %} <ul> -#for $cname in $cnames -<li> cname: $cname.__str__ </li> -#end for +{% for cname in cnames %} +<li> cname: {{ cname.cname }} </li> +{% endfor %} </ul> -#end if +{% endif %} -#if $mxs and not $names +{% if mxs and not names %} <ul> -#for $mx in $mxs -<li> mx: $mx.priority $mx.__str__ </li> -#end for +{% for mx in mxs %} +<li> mx: {{ mx.priority }} {{ mx.mx }} </li> +{% endfor %} </ul> -#end if +{% endif %} -#if $interface +{% if interface %} </ul> -#end if +{% endif %} <input type="submit" value="confirm"> <input type="reset" value="cancel" onclick="history.back()"> </form> - <!-- InstanceEndEditable --></td>
- </tr>
- </table></td>
- </tr>
- <tr valign="top">
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="2" align="left"><hr size="1"></td>
- </tr>
- <tr valign="top">
- <td colspan="2" align="center"><table border="0" cellspacing="0" cellpadding="5">
- <tr>
- <td><a href="http://www.doe.gov/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_doe.gif" alt="U.S. Department of Energy" width="153" height="35" border="0"></a></td>
- <td><a href="http://www.uchicago.edu/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_uofc.gif" alt="The University of Chicago" width="125" height="34" border="0"></a></td>
-
- <td><!-- InstanceBeginEditable name="sponsorLogos" --><!-- #BeginLibraryItem "/Library/logoOfficeOfScience.lbi" --><a href="http://www.sc.doe.gov/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_doe_science.gif" alt="Office of Science - Department of Energy" width="143" height="31" border="0"></a><!-- #EndLibraryItem --><!-- InstanceEndEditable --></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td colspan="2" align="center"> <table cellspacing="0" cellpadding="2" border="0">
- <tr>
- <td class="footerText"><a href="http://www.anl.gov/notice.html">Privacy & Security Notice</a> | <a href="http://www.anl.gov/Adminstration/contactus.html">Contact Us</a></td>
- </tr>
- </table></td>
- </tr>
- </table></td>
- </tr>
-</table>
-</body>
-<!-- InstanceEnd --></html>
+{% endblock %} diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html index 9065153da..01caba4ad 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/dnsedit.html @@ -1,192 +1,96 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><!-- InstanceBegin template="/Templates/publicFull.dwt" codeOutsideHTMLIsLocked="false" -->
-<head>
-<link href="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/stylesheets/argonne.css" rel="stylesheet" type="text/css">
-<link href="http://www.anl.gov/favicon.ico" rel="SHORTCUT ICON">
-<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/anlmain.js" type="text/JavaScript"></script>
-<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/stm31.js" type="text/JavaScript"></script>
-<!-- InstanceBeginEditable name="head" --> -<!-- Insert page specific head elements in this region, including custom javascript --> -<!-- TemplateBeginEditable name="head" --> -<script language="JavaScript" src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/javascript/main.js" type="text/JavaScript"></script> -<!-- TemplateEndEditable --><!-- InstanceEndEditable -->
-<!-- InstanceBeginEditable name="title" --> -<title></title> -<!-- InstanceEndEditable -->
-<!-- InstanceBeginEditable name="metadata" --> -<meta name="description" content=""> -<meta name="keywords" content=""> -<meta name="classification" content=""> -<meta name="author" content="Argonne National Laboratory"> -<meta name="expires" content=""> -<!-- InstanceEndEditable -->
-<!-- InstanceParam name="Contact URL" type="URL" value="../about/contacts.html" --><!-- InstanceParam name="Sitemap URL" type="URL" value="../Division/sitemap.html" --><!-- InstanceParam name="Search URL" type="URL" value="../About/search.html" --><!-- InstanceParam name="enableOptionalSponsorLogos" type="boolean" value="true" --><!-- InstanceParam name="enableNavBarTabs" type="boolean" value="true" --><!-- InstanceParam name="enableNavBarSearch" type="boolean" value="false" --><!-- InstanceParam name="enableOptionalSitemapFooter" type="boolean" value="false" --><!-- InstanceParam name="enableOptionalSearchFooter" type="boolean" value="false" -->
-</head>
-<body>
-<table width="100%" border="0" cellpadding="0" cellspacing="3">
- <tr>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr class="headerBkgd" valign="middle">
- <td width="10"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" height="10" width="10" border="0" alt=""></td>
- <td width="300" align="left"><a href="http://www.anl.gov"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/argonne_header_logo.jpg" alt="Argonne National Laboratory" width="227" height="100" border="0"></a></td>
- <td><span class="sectionTitle"><!-- InstanceBeginEditable name="divisionProgramIdentity" --><img src="http://www-unix.mcs.anl.gov/hostbaseweb/images/mcs_logo_white_minus_logo_small.png" width="92" height="31"><br> - <a href="http://www.mcs.anl.gov">Mathematics - and Computer Science </a><!-- InstanceEndEditable --></span></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
-
- <tr> <!-- InstanceBeginRepeat name="localNavigation" --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> <a href="http://www.mcs.anl.gov">About - Us</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --><a href="http://www-fp.mcs.anl.gov/division/research/">Research</a><!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> <a href="../research/index.html"></a><a href="http://www-fp.mcs.anl.gov/division/resources/">Facilities</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --><a href="http://www-fp.mcs.anl.gov/division/people/">Staff</a><!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/software/">Software</a> <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/collaboration">Collaborations </a> - <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
- <td nowrap class="navGlobalBkgd"><span class="navGlobal"><!-- InstanceBeginEditable name="localNavigationItem" --> - <a href="http://www-fp.mcs.anl.gov/division/information/">Information</a> - <!-- InstanceEndEditable --></span></td>
- <td width="3" nowrap><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="3" height="1" border="0" alt=""></td>
- <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat -->
-
- <td class="navGlobalBkgd" width="50%"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/spacer.gif" width="1" height="30" border="0" alt=""></td>
- </tr> </table>
- <!-- #EndLibraryItem --></td>
- </tr>
- <tr>
- <td class="greyBkgdLight"><span class="breadcrumbs"><a href="http://www.mcs.anl.gov/">MCS
- Home</a> > <!-- InstanceBeginEditable name="topLevelBreadcrumbs" --> - <script language="JavaScript">breadCrumbs("www-unix.mcs.anl.gov/new",">","","breadcrumbs","None","None","0");</script> - <!-- InstanceEndEditable --></span></td>
- </tr>
- <tr valign="top">
- <td nowrap><table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td><!-- InstanceBeginEditable name="mainFeature" --> +{% extends "base.html" %} -#set $cont = 1 +{% block pagebanner %} + <div class="header"> + <h2>dns info for {{ host.hostname }}</h2> + </div> + <br/> +{% endblock %} -#if $request.GET.has_key('sub') -ok, submitted -#end if +{% block sidebar %} +<a href="/hostbase/" class="sidebar">new search</a> +<ul class="sidebar"> + <li><a href="/hostbase/{{ host.id }}/" class="sidebar">host info</a></li> + <li><a href="/hostbase/{{ host.id }}/edit/" class="sidebar">edit host info</a></li> + <li><a href="edit/" class="sidebar">edit dns info</a></li> +</ul> +{% endblock %} +{% block content %} -#if $cont <form name="dns" action="?sub=true" method="post"> -<input type="hidden" name="host" value="$host.id"> -<b>Edit DNS information below for individual IP addresses.</b> +<input type="hidden" name="host" value="{{ host.id }}"> <table border="0" width="100%"> <colgroup> <col width="150"> <col width="*"> - #for $interface in $interfaces + {% for interface in interfaces %} <tr><td><br></td></tr> <tr> <td> <b>interface type</b> </td> - <td> $interface.hdwr_type </td></tr> + <td> {{ interface.hdwr_type }} </td></tr> <tr> <td> <b>mac_addr</b> </td> - <td> $interface.mac_addr </td></tr> + <td> {{ interface.mac_addr }} </td></tr> <tr><td><hr></td><td><hr></td></tr> - #for $ip in $ips[$interface.id] + {% for ip in info %} + {% ifequal ip.0.interface interface %} <tr> <td> <b>ip_addr</b></td> - <td>$ip.ip_addr</td></tr> - #for $name in $names[$ip.id] + <td>{{ ip.0.ip_addr }}</td></tr> + {% for name in ip.1 %} <tr> <td><b>name(dns)</b></td> - <td> <input name="name$name.id" type="text" value="$name.name"> - <select name="dns_view$name.id"> - #for $choice in $name.DNS_CHOICES - #if $name.dns_view == $choice[0] - <option value="$choice[0]">$choice[1] - #else - <option value="$choice[0]">$choice[1] - #end if - #end for + <td> <input name="name{{ name.id }}" type="text" value="{{ name.name }}"> + <select name="dns_view{{ name.id }}"> + {% for choice in name.DNS_CHOICES %} + {% ifequal name.dns_view choice.0 %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </select> - <a style="font-size:75%" href="/hostbase/$host.id/name/${name.id}/confirm">remove</a></td></tr> - #for $cname in $cnames[$name.id] + <a style="font-size:75%" href="/hostbase/{{ host.id }}/name/{{ name.id }}/confirm">remove</a></td></tr> + {% for cname in cnames %} + {% ifequal name cname.name %} <tr> <td> <b>cname</b></td> - <td> <input name="cname$cname.id" type="text" value="$cname.cname"> - <a style="font-size:75%" href="/hostbase/$host.id/cname/${cname.id}/confirm">remove</a></td></tr> - #end for + <td> <input name="cname{{ cname.id }}" type="text" value="{{ cname.cname }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/cname/{{ cname.id }}/confirm">remove</a></td></tr> + {% endifequal %} + {% endfor %} <tr> <td> <b>cname</b></td> - <td> <input name="${name.id}cname" type="text"></td></tr> - #for $mx in $mxs[$name.id] + <td> <input name="{{ name.id }}cname" type="text"></td></tr> + {% for mx in mxs %} + {% ifequal mx.0 name.id %} + {% for record in mx.1 %} <tr> <td> <b>mx</b></td> - <td> <input name="priority$mx.id" type="text" size="6" value="$mx.priority"> - <input name="mx$mx.id" type="text" value="$mx.mx"> - <a style="font-size:75%" href="/hostbase/$host.id/mx/${mx.id}/${name.id}/confirm">remove</a></td></tr> - #end for + <td> <input name="priority{{ record.id }}" type="text" size="6" value="{{ record.priority }}"> + <input name="mx{{ record.id }}" type="text" value="{{ record.mx }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/mx/{{ record.id }}/{{ name.id }}/confirm">remove</a></td></tr> + {% endfor %} + {% endifequal %} + {% endfor %} <tr> <td> <b>mx</b></td> - <td> <input name="${name.id}priority" type="text" size="6"> - <input name="${name.id}mx" type="text"></td></tr> - #end for + <td> <input name="{{ name.id }}priority" type="text" size="6"> + <input name="{{ name.id }}mx" type="text"></td></tr> + {% endfor %} <tr> <td> <b>name</b></td> - <td> <input name="${ip.__str__}name" type="text"> - <select name="${ip.__str__}dns_view"> - #for $choice in $name.DNS_CHOICES - <option value="$choice[0]">$choice[1] - #end for + <td> <input name="{{ ip.0.ip_addr }}name" type="text"> + <select name="{{ ip.0.ip_addr }}dns_view"> + {% for choice in name.DNS_CHOICES %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endfor %} </select></td></tr> <tr> <td> <b>cname</b></td> - <td> <input name="${ip.__str__}cname" type="text"></td></tr> + <td> <input name="{{ ip.0.ip_addr }}cname" type="text"></td></tr> <tr> <td> <b>mx</b></td> - <td> <input name="${ip.__str__}priority" type="text" size="6"> - <input name="${ip.__str__}mx" type="text"></td></tr> + <td> <input name="{{ ip.0.ip_addr }}priority" type="text" size="6"> + <input name="{{ ip.0.ip_addr }}mx" type="text"></td></tr> <tr><td></td></tr> <tr><td><hr></td><td><hr></td></tr> - #end for - #end for + {% endifequal %} + {% endfor %} + {% endfor %} </table> <p><input type="submit" value="Submit"> </form> -#end if - <!-- InstanceEndEditable --></td>
- </tr>
- </table></td>
- </tr>
- <tr valign="top">
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="2" align="left"><hr size="1"></td>
- </tr>
- <tr valign="top">
- <td colspan="2" align="center"><table border="0" cellspacing="0" cellpadding="5">
- <tr>
- <td><a href="http://www.doe.gov/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_doe.gif" alt="U.S. Department of Energy" width="153" height="35" border="0"></a></td>
- <td><a href="http://www.uchicago.edu/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_uofc.gif" alt="The University of Chicago" width="125" height="34" border="0"></a></td>
-
- <td><!-- InstanceBeginEditable name="sponsorLogos" --><!-- #BeginLibraryItem "/Library/logoOfficeOfScience.lbi" --><a href="http://www.sc.doe.gov/"><img src="http://www-unix.mcs.anl.gov/hostbaseweb/anl_templates/images/logos/footer_doe_science.gif" alt="Office of Science - Department of Energy" width="143" height="31" border="0"></a><!-- #EndLibraryItem --><!-- InstanceEndEditable --></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td colspan="2" align="center"> <table cellspacing="0" cellpadding="2" border="0">
- <tr>
- <td class="footerText"><a href="http://www.anl.gov/notice.html">Privacy & Security Notice</a> | <a href="http://www.anl.gov/Administration/contactus.html">Contact Us</a></td>
- </tr>
- </table></td>
- </tr>
- </table></td>
- </tr>
-</table>
-</body>
-<!-- InstanceEnd --></html>
+{% endblock %} diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html index 87cfbd1a3..bee7acfd7 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html @@ -1,3 +1,23 @@ +{% extends "base.html" %} + +{% block pagebanner %} + <div class="header"> + <h2>{{ host.hostname }}</h2> + </div> + <br/> +{% endblock %} + +{% block sidebar %} +<a href="/hostbase/" class="sidebar">new search</a> +<ul> +<li><a href="/hostbase/{{ host.id }}/" class="sidebar">host info</a></li> +<li><a href="/hostbase/{{ host.id }}/dns/" class="sidebar">detailed dns info</a></li> +<li><a href="/hostbase/{{ host.id }}/dns/edit/" class="sidebar">edit dns info</a></li> +</ul> +{% endblock %} + +{% block content %} + <script language=JavaScript type=text/Javascript> function toggleAddr(interface_id){ if(document.getElementById){ @@ -14,136 +34,136 @@ function toggleInter(){ </script> <style type=text/css> -#for $interface in $interfaces -div#ipaddr${interface.id}{ +{% for interface in interfaces %} +div#ipaddr{{ interface.0.id }}{ display: none; } -#end for +{% endfor %} div#interface{ display: none; } </style> <form name="hostdata" action="?sub=true" method="post"> -<input type="hidden" name="host" value="$host.id"> +<input type="hidden" name="host" value="{{ host.id }}"> <table border="0" width="100%"> <colgroup> <col width="150"> <col width="*"> <tr> <td> <b>hostname</b></td> - <td> <input name="hostname" type="text" value="$host.hostname"></td></tr> + <td> <input name="hostname" type="text" value="{{ host.hostname }}"></td></tr> <tr> <td> <b>whatami</b></td> <td> <select name="whatami"> - #for $choice in $host.WHATAMI_CHOICES - #if $host.whatami == $choice[0] - <option value="$choice[0]" selected="selected">$choice[1] - #else - <option value="$choice[0]">$choice[1] - #end if - #end for + {% for choice in host.WHATAMI_CHOICES %} + {% ifequal host.whatami choice.0 %} + <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </select></td></tr> <tr> <td> <b>netgroup</b></td> <td> <select name="netgroup"> - #for $choice in $host.NETGROUP_CHOICES - #if $host.netgroup == $choice[0] - <option value="$choice[0]" selected="selected">$choice[1] - #else - <option value="$choice[0]">$choice[1] - #end if - #end for + {% for choice in host.NETGROUP_CHOICES %} + {% ifequal host.netgroup choice.0 %} + <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </select> </td></tr> <tr> <td> <b>class</b></td> <td> <select name="security_class"> - #for $choice in $host.CLASS_CHOICES - #if $host.security_class == $choice[0] - <option value="$choice[0]" selected="selected">$choice[1] - #else - <option value="$choice[0]">$choice[1] - #end if - #end for + {% for choice in host.CLASS_CHOICES %} + {% ifequal host.security_class choice.0 %} + <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </select></td></tr> <tr> <td> <b>support</b></td> <td> <select name="support"> - #for $choice in $host.SUPPORT_CHOICES - #if $host.support == $choice[0] - <option value="$choice[0]" selected="selected">$choice[1] - #else - <option value="$choice[0]">$choice[1] - #end if - #end for + {% for choice in host.SUPPORT_CHOICES %} + {% ifequal host.support choice.0 %} + <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </select></td></tr> <tr> <td> <b>csi</b></td> - <td> <input name="csi" type="text" value="$host.csi"></td></tr> + <td> <input name="csi" type="text" value="{{ host.csi }}"></td></tr> <tr> <td> <b>printq</b></td> - <td> <input name="printq" type="text" value="$host.printq"></td></tr> + <td> <input name="printq" type="text" value="{{ host.printq }}"></td></tr> <tr> <td> <b>dhcp</b></td> <td> - #if $host.dhcp + {% if host.dhcp %} <input type="checkbox" checked="checked" name="dhcp"></td></tr> - #else + {% else %} <input type="checkbox" name="dhcp"></td></tr> - #end if + {% endif %} <tr> <td> <b>outbound_smtp</b></td> <td> - #if $host.outbound_smtp + {% if host.outbound_smtp %} <input type="checkbox" checked="checked" name="outbound_smtp"></td></tr> - #else + {% else %} <input type="checkbox" name="outbound_smtp"></td></tr> - #end if + {% endif %} <tr> <td> <b>primary_user</b></td> - <td> <input name="primary_user" type="text" size="32" value="$host.primary_user"></td></tr> + <td> <input name="primary_user" type="text" size="32" value="{{ host.primary_user }}"></td></tr> <tr> <td> <b>administrator</b></td> - <td> <input name="administrator" type="text" size="32" value="$host.administrator"></td></tr> + <td> <input name="administrator" type="text" size="32" value="{{ host.administrator }}"></td></tr> <tr> <td> <b>location</b></td> - <td> <input name="location" type="text" value="$host.location"></td></tr> + <td> <input name="location" type="text" value="{{ host.location }}"></td></tr> <tr> <td> <b>expiration_date</b></td> - <td> <input name="expiration_date" type="text" value="$host.expiration_date"> YYYY-MM-DD</td></tr> - #for $interface in $interfaces + <td> <input name="expiration_date" type="text" value="{{ host.expiration_date }}"> YYYY-MM-DD</td></tr> + {% for interface in interfaces %} <tr> <td><br><b>Interface</b> </td><td><br> - #for $choice in $interface.TYPE_CHOICES - #if $interface.hdwr_type == $choice[0] - <input type="radio" name="hdwr_type$interface.id" value="$choice[0]" checked="checked">$choice[1] - #else - <input type="radio" name="hdwr_type$interface.id" value="$choice[0]">$choice[1] - #end if - #end for + {% for choice in interface.0.TYPE_CHOICES %} + {% ifequal interface.0.hdwr_type choice.0 %} + <input type="radio" name="hdwr_type{{ interface.0.id }}" value="{{ choice.0 }}" checked="checked">{{ choice.1 }} + {% else %} + <input type="radio" name="hdwr_type{{ interface.0.id }}" value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} </td></tr> <tr> <td> <b>mac_addr</b></td> - <td> <input name="mac_addr$interface.id" type="text" value="$interface.mac_addr"> - <a style="font-size:75%" href="/hostbase/$host.id/interface/${interface.id}/confirm">remove</a> + <td> <input name="mac_addr{{ interface.0.id }}" type="text" value="{{ interface.0.mac_addr }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/interface/{{ interface.0.id }}/confirm">remove</a> </td></tr> - #for $ip in $ips[$interface.id] + {% for ip in interface.1 %} <tr> <td> <b>ip_addr</b> </td> - <td> <input name="ip_addr${ip.id}" type="text" value="$ip.ip_addr"> - <a style="font-size:75%" href="/hostbase/$host.id/ip/${ip.id}/confirm">remove + <td> <input name="ip_addr{{ ip.id }}" type="text" value="{{ ip.ip_addr }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/ip/{{ ip.id }}/confirm">remove </a></td></tr> - #end for + {% endfor %} <!-- Section for adding a new IP address to an existing interface --> <!-- By default, section is hidden --> </table> - <div id=ipaddr${interface.id}> + <div id=ipaddr{{ interface.0.id }}> <table border="0" width="100%"> <colgroup> <col width="150"> <col width="*"> <tr> <td> <b>ip_addr</b></td> - <td> <input name="${interface.id}ip_addr" type="text"></td></tr> + <td> <input name="{{ interface.0.id }}ip_addr" type="text"></td></tr> </table> </div> - <a style="font-size:75%" href=# onclick="toggleAddr($interface.id)">Add a New IP Address</a> + <a style="font-size:75%" href=# onclick="toggleAddr({{ interface.0.id }})">Add a New IP Address</a> <table border="0" width="100%"> <colgroup> <col width="150"> <col width="*"> - #end for + {% endfor %} <!-- End section for new IP address --> <!-- Section for add an entirely new interface to a host --> @@ -155,9 +175,9 @@ div#interface{ <col width="150"> <col width="*"> <tr> <td><br><b>Interface</b></td><td><br> - #for $choice in $type_choices - <input type="radio" name="hdwr_type_new" value="$choice[0]">$choice[1] - #end for + {% for choice in TYPE_CHOICES %} + <input type="radio" name="hdwr_type_new" value="{{ choice.0 }}">{{ choice.1 }} + {% endfor %} </td></tr> <tr> <td> <b>mac_addr</b></td> <td> <input name="mac_addr_new" type="text"></td></tr> @@ -174,20 +194,22 @@ div#interface{ <col width="150"> <col width="*"> <tr> <td> <b>comments</b></td> -<td> <textarea rows="10" cols="50" name="comments">$host.comments</textarea></td></tr> +<td> <textarea rows="10" cols="50" name="comments">{{ host.comments }}</textarea></td></tr> </table> -<a style="font-size:75%" href="/hostbase/$host.id/dns/edit">edit detailed DNS information for this host</a> +<a style="font-size:75%" href="/hostbase/{{ host.id }}/dns/edit">edit detailed DNS information for this host</a> <br> this host is <select name="status"> -#for $choice in $host.STATUS_CHOICES -#if $host.status == $choice[0] -<option value="$choice[0]" selected="selected">$choice[1] -#else -<option value="$choice[0]">$choice[1] -#end if -#end for +{% for choice in host.STATUS_CHOICES %} +{% ifequal host.status choice.0 %} +<option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} +{% else %} +<option value="{{ choice.0 }}">{{ choice.1 }} +{% endifequal %} +{% endfor %} </select><br> -last update on $host.last<br> +last update on {{ host.last }}<br> <p><input type="submit" value="Submit"> </form> + +{% endblock %} diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html index 47d32ede4..2d5e6fdf9 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html @@ -21,7 +21,6 @@ There were errors in the following fields<br><br> {% endfor %} {% endif %} -<br> Press the back button on your browser and edit those field(s) {% endblock %}
\ No newline at end of file diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/new.html b/src/lib/Server/Hostbase/hostbase/webtemplates/new.html index 7ed664368..6a0f927fe 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/new.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/new.html @@ -24,7 +24,13 @@ <tr> <td> <b>hostname</b></td> <td> <input name="hostname" type="text" ></td></tr> <tr> <td> <b>whatami</b></td> - <td> </td></tr> + <td> + <select name="whatami"> + {% for choice in WHATAMI_CHOICES %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endfor %} + </select> + </td></tr> <tr> <td> <b>netgroup</b></td> <td> <select name="netgroup"> |