#! /usr/bin/env python # PyKota - Print Quotas for CUPS and LPRng # # (c) 2003 Jerome Alet # 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$ # # $Log$ # Revision 1.2 2003/07/28 21:16:24 jalet # Cleanly deactivate pykotadmin.cgi # # Revision 1.1 2003/05/03 17:33:08 jalet # First shot at the complete web-based administrative interface. # # # import sys import os import cgi from pykota.tool import PyKotaTool, PyKotaToolError header = """Content-type: text/html PyKota Administration

PyKota's Logo
PyKota

PyKota Administration

""" footer = """
""" class PyKotaAdminGUI(PyKotaTool) : """PyKota Administrative GUI""" def guiDisplay(self) : """Displays the administrative interface.""" global header, footer print header print self.body print footer def error(self, message) : """Adds an error message to the GUI's body.""" if message : self.body = '

%s

\n%s' % (message, self.body) def htmlListPrinters(self) : """Displays the printers multiple selection list.""" printers = self.storage.getMatchingPrinters("*") message = 'Printer : ' return message def guiAction(self) : """Main function""" self.body = "

Please click on the menu above

\n" form = cgi.FieldStorage() if form.has_key("action") : action = form["action"].value if action == "Modify" : self.error("Not implemented yet ! Sorry.") elif action == "Warn" : self.error("Not implemented yet ! Sorry.") elif action == "Report" : self.error("Not implemented yet ! Sorry.") else : self.error(body, "Invalid action [%s]" % action) self.body = self.body + self.htmlListPrinters() if __name__ == "__main__" : #admin = PyKotaAdminGUI() #admin.guiAction() #admin.guiDisplay() print "Content-type: text/html\n\nPyKotAdmin.cgiThis program is actually a draft. Don't use it !"