Mercurial > avadmin > converted
view mess_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 | 152ab8c93126 |
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_message import av_log conn = av_conn.Conn() conn.html.content("text/html") conn.html.header("Messages") conn.html.heading("Messages") conn.securitycheck(conn.user.getPERM()["mess"],loglevel=av_log.SECLOG) buff = "" if (av_message.totalMessages(conn)): buff += "<table class=\"plain\">\n" buff += "<tr><td class=\"main\"><b>From</b></td><td class=\"main\"><b>Subject</b></td><td class=\"main\"><b>Date Sent</b></td></tr>\n" for messid in conn.db.execSQL("SELECT `id` FROM `messages` WHERE `touser` = " + str(conn.user.getUID()) + " ORDER BY `datesent` DESC, `id` DESC;"): mess = av_message.Message(conn,messid[0]) # From buff += "<tr><td class=\"main\"><a href=\"" + conn.makeURL("mess_read.py",params={"messid":str(messid[0])}) + "\">" if (not mess.getREAD()): buff += "<i>" + conn.user.UID2User(mess.getFromUID()) + "</i>" else: buff += conn.user.UID2User(mess.getFromUID()) buff += "</a></td>" # Subject buff += "<td class=\"main\"><a href=\"" + conn.makeURL("mess_read.py",params={"messid":str(messid[0])}) + "\">" if (not mess.getREAD()): buff += "<i>" + mess.getSubject() + "</i>" else: buff += mess.getSubject() buff += "</a></td>" # Date buff += "<td class=\"main\"><a href=\"" + conn.makeURL("mess_read.py",params={"messid":str(messid[0])}) + "\">" if (not mess.getREAD()): buff += "<i>" + mess.getDATE() + "</i>" else: buff += mess.getDATE() buff += "</a></td></tr>\n" buff += "</table>\n" else: buff += "There are no messages." conn.html.body.set(buff) conn.html.footer() print conn.flush()