# Path: RapacheCore/Module.py
# def is_denormalized_module ( fname ):
# def is_not_normalizable( fname):
# def blacklisted ( fname ):
# def normalize_module( fname ):
# def get_module_dependants ( name, mods_dict ):
# def get_module_descriptions():
# def module_list ():
#     def __init__(self, name = None):
#     def load (self, name = False):        
#     def __get_dependecies(self, content):   
#     def is_enabled ( self ):
#     def _write(self, complete_path, content ):  
#     def toggle(self, status ):
#     def get_description(self):
#     def get_configuration_file_name(self):
#     def get_backup_files(self):
#     def get_source ( self ):
#     def get_configuration ( self ):
#     def get_configuration_version( self, date_stamp):
#     def save_configuration (self, content):
# class ModuleModel:
# 
# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30


import gtk
import gobject
import os
import re
from CheckListView import *
from RapacheCore.VirtualHost import *
from RapacheCore import Module
from RapacheCore import Configuration
from xml.sax import saxutils
            bad_items = {}
            
            for fname in  dirList :                
                site = VirtualHostModel( fname )   
                if site.enabled and not site.has_port():                 
                    bad_items[ fname ] = site
                    site = None        
            for idx in sorted( bad_items ):                    
                site = bad_items[ idx ]            
                fixable = False
                markup = site_template % site.get_name()                
                markup = markup + " CANNOT FIX"
                
                iter = lstore.append()
                pixbuf = self.render_icon(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_LARGE_TOOLBAR)
                lstore.set(iter,
                    COLUMN_ICON, pixbuf,
                    COLUMN_FIXED, False,
                    COLUMN_SEVERITY, site.get_name(),
                    COLUMN_MARKUP, markup +  "\nThe virtual host does not have a port number and you have enabled ssl\n<small><i>You must add a port number (80)</i>.</small>"
                    )
            if not len(lstore): return -1
        return fixable_items


    def _add_denormalized_vhosts( self ):
        
        site_template = "<b><big>%s</big></b>"              
        lstore = self.get_model()
        data = []  

# Path: RapacheCore/Module.py
# def is_denormalized_module ( fname ):
# def is_not_normalizable( fname):
# def blacklisted ( fname ):
# def normalize_module( fname ):
# def get_module_dependants ( name, mods_dict ):
# def get_module_descriptions():
# def module_list ():
#     def __init__(self, name = None):
#     def load (self, name = False):        
#     def __get_dependecies(self, content):   
#     def is_enabled ( self ):
#     def _write(self, complete_path, content ):  
#     def toggle(self, status ):
#     def get_description(self):
#     def get_configuration_file_name(self):
#     def get_backup_files(self):
#     def get_source ( self ):
#     def get_configuration ( self ):
#     def get_configuration_version( self, date_stamp):
#     def save_configuration (self, content):
# class ModuleModel:
# 
# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30


# Path: RapacheGtk/VhostsTreeView.py
import gtk
import gobject
import os
import re
from CheckListView import *
from RapacheCore.VirtualHost import *
from RapacheCore import Module
from RapacheCore import Configuration
from xml.sax import saxutils

            bad_items = {}
            
            for fname in  dirList :                
                site = VirtualHostModel( fname )   
                if site.enabled and not site.has_port():                 
                    bad_items[ fname ] = site
                    site = None        
            for idx in sorted( bad_items ):                    
                site = bad_items[ idx ]            
                fixable = False
                markup = site_template % site.get_name()                
                markup = markup + " CANNOT FIX"
                
                iter = lstore.append()
                pixbuf = self.render_icon(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_LARGE_TOOLBAR)
                lstore.set(iter,
                    COLUMN_ICON, pixbuf,
                    COLUMN_FIXED, False,
                    COLUMN_SEVERITY, site.get_name(),
                    COLUMN_MARKUP, markup +  "\nThe virtual host does not have a port number and you have enabled ssl\n<small><i>You must add a port number (80)</i>.</small>"
                    )
            if not len(lstore): return -1
        return fixable_items


    def _add_denormalized_vhosts( self ):
        
        site_template = "<b><big>%s</big></b>"              
        lstore = self.get_model()
        data = []  

        dirList=os.listdir( Configuration.SITES_ENABLED_DIR )