#!C:\Perl\bin\perl.exe -w
#
# Copyright 2008 Samuel Borsutzky
#
# This file is part of PerlForms.
#
# PerlForms 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 3 of the License, or
# (at your option) any later version.
#
# PerlForms 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 PerlForms. If not, see <http://www.gnu.org/licenses/>.
#
#
#
#
# Dieses CGI verwaltet Services (Produkte) und deren technische
# Abhaengigkeiten, z.B. verfuegbarkeit gewisser Geraete, und bestimmte
# Eigenschaften dieser.
#
# Dises CGI zeigt je nach URL mit der es aufgerufen wurde z.B. Listen aller
# gespeicherten Gearaete, oder ein Formular zur Aenderung dieser Daten.
#
# Formulare werden durch Funktionen ::form zurueckgegeben.
#
# Listen durch Funktionen ::show
#
# Weiter unten gibt es eine laengere 'if'-Klausel, die anhand der URL eine
# entsprechende Ausgabe generiert/aufruft (z.B. Device::form)
#
#
# Add new object checklist: (what=name der neuen perlforms-klasse)
#
# - PerlForms::Dictionary: %dict: idattrib
# - PerlForms::Dictionary: %dict: pm
# - PerlForms::Dictionary: %dict: schoen (optional, default: capitalized what)
# - PerlForms::Dictionary: %dict: storage (optional, default: perlformsdb)
# - PerlForms::Dictionary: %dict: tablename (optional, default: what)
# - PerlForms::Dictionary: %dict: parent (optional)
# - PerlForms::Dictionary: %dict: child (optional)
# - PerlForms::Dictionary: %dict: attribs: min. id, name, <abkuerz>, <what>
# - PerlForms::Dictionary: %dict: attribs: order: alle atribute eintragen (für PerlForms->form)
# - PerlForms::Dict::Apps: %prgs: objects (wird für class->legal und somit für object->show benötigt)
# - PerlForms::Dict::Apps: %prgs: navlinks (optional, wenn ein link in der navbar stehen soll)
# - package <what> (.pm) anlegen (optional; use base qw(PerlForms::Object);)
# - Query: subs <what> und <what>_list (optional, falls default und default_list
# nicht ausreichen)
# - add .pm to REMOTE_INSTALLL* and INSTALL*
#
#
#
# Todo todolist:
#
# - funcdep-nag.pl soll automatisch einen Monitor fuer den angegebenen
# "Monitoring Access" anlegen. Ist z.B. SNMPv2 ausgwaehlt, dann soll autom.
# ein Monitor "SNMPv2 available" oder vielleicht "Monitorable" angelegt
# werden.
#
# - Deviceklassen, bei Dkl. "DedFW-Module" z.B. soll dann automatisch ein
# requirement "dfw-sa-fra-Xxxx up", "...: monitorable", "...: SSH available",
# etc. angelegt werden. Ausserdem koennten gleich ein paar Functionalities
# angelegt werden. Z.B: "DedFW-Module-XYZ Access to the Internet", etc.
# Jedenfalls sollen Monitore automatisch angelegt werden. z.B: "Swap Space"
# oder "Interface Status eth2c0 IP Layer", "System Time", etc.
#
# - Status des Service muss einstellbar sein.
#
#
#
# todo Policy: undef=unbekannt, ""=leer/n.n.definiert
#
#
#
# Style-Guide
#
# - Einrückung: Vier Leerzeichen (nicht Tab) pro Ebene.
#
# - "new"-Syntax: Klasse->new();
# Bei syntax "new Form" kommt fehlermldg, es gebe keine sub Form PerlForms..
# das hat damit zu tun, dass Perl die syntax "new Form" nicht richtig parsen
# kann, da damit ja auch &new(Form) gemeint sein könnte, also das sub new
# weiter unten.
#
# - my: my$test my%bla ... aber: my($a,$b)
#
# - if/while/foreach-Blöcke: Öffnende { am Ende der der if/while/foreach-Zeile.
# Schließende } auf neuer Zeile bündig mit dem if/while/foreach.
#
#
#
#
# Design-Policy
#
# - pfmodules(Funcdep,IPLS::Ldap,NagUtil(,PerlForms=Root))
# - apps(ldap,funcdep,logdb)
#
#
#
#
use strict;
#use lib 'C:\cygwin\lib\perl5\site_perl\5.8'; #hush
use lib "D:/Documents and Settings/sborsutz/My Documents/Entwicklung/eclipse-workspace/perlforms"; #dell
use lib "D:/Documents and Settings/sborsutz/My Documents/Entwicklung/eclipse-workspace/funcdep"; #dell
use lib "D:/Documents and Settings/sborsutz/My Documents/Entwicklung/eclipse-workspace/nagutil"; #dell
use PerlForms::HTML::REQ;
use PerlForms::Util qw(&epoch2date);
use vars qw($debug);
$debug=1 unless(defined($debug));
my($starttime)=time();
if($debug) {
print(STDERR "\n######### cgi.pl called at ".&epoch2date($starttime)." #########\n");
print(STDERR "URI: ".$ENV{REQUEST_URI}."\n");
}
PerlForms::HTML::REQ->new(scriptname=>__FILE__)->process_httpreq;
if($debug or $starttime) {
my($endtime)=time();
print(STDERR "######### cgi.pl ended at ".&epoch2date($endtime)." (duration: ".($endtime-$starttime)."s) #########\n");
}