view eq_ls.py @ 508:64f8666690d8

README update (Logical change 1.149)
author optonline.net!jeffpc
date Fri, 16 Jan 2004 02:53:48 +0000
parents c6d44287810f
children dfeb0c137ffd
line wrap: on
line source

#!/usr/bin/python

#/*
# * AV Admin - Helps to manage an AV department
# *
# * Copyright (C) 2003, 2004 Josef "Jeff" Sipek
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# *
# * $Id$
# */

import av_conn
import av_eq
import av_log

conn = av_conn.Conn()

conn.html.content("text/html")
conn.html.header("Equipment")
conn.html.heading("Equipment")

conn.securitycheck(conn.user.getPERM()["eq"],loglevel=av_log.SECLOG)

# FIXME: make me pretty looking

buff = "<table>\n"
buff += "<tr><td><b>Name</b></td><td><b>Type</b></td><td><b>Func?</b></td><td><b>In?</b></td></tr>\n"

for rec in conn.db.execSQL("SELECT `id` FROM `equip` ORDER BY `name`"):
	eq = av_eq.Equip(conn,rec[0])
	
	if (eq.getNote()):
		buff += "<div class=\"ctooltip\" id=\"tt" + str(eq.getID()) + "\">" + conn.utils.htmlify(eq.getNote()) + "</div>"
	buff += "<tr><td>"
	if (conn.user.getPERM()["eqm"] or conn.user.getPERM()["eqr"]):
		buff += "<a href=\"" + conn.makeURL("eq_view.py",params={"eqn":str(eq.getID())}) + "\""
	else:
		buff += "<div style=\"text-decoration: underline;\"" 
	if (eq.getNote()):
		buff += " onMouseOver=\"ShowTip(" + str(eq.getID()) + ");\" onMouseOut=\"HideTip(" + str(eq.getID()) + ");\">" 
	else:
		buff += ">"
	buff += eq.getName()
	if (conn.user.getPERM()["eqm"] or conn.user.getPERM()["eqr"]):
		buff += "</a>"
	else:
		buff += "</div>"
	buff += "</td><td>" + eq.getTypeStr() + "</td><td>" + conn.yesno(eq.getFunc()) + "</td>"
	buff += "<td>"
	buff += conn.yesno(eq.isin())
	buff += "</td></tr>\n"
buff += "</table>\n"

conn.html.body.set(buff)
conn.html.footer()

print conn.flush()