# 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
            if ( site.parsable ):
                markup = site_template \
                % ( site.get_server_name(), site.get_document_root() )
            else:
                markup = site_unparsable_template % site.get_server_name()
            iter = lstore.append()
            
            favicon = site.get_icon()
            pixbuf = gtk.gdk.pixbuf_new_from_file( favicon )
                       
            lstore.set(iter,
                COLUMN_FIXED, site.enabled,
                COLUMN_ICON, pixbuf,
                COLUMN_SEVERITY, site.get_name(),
                COLUMN_MARKUP, markup )

    def __fixed_toggled(self, cell, path, treeview): 
        if not Shell.command.ask_password(): return 
        # get toggled iter        
        model = treeview.get_model()
        iter = model.get_iter((int(path),))
        fixed = model.get_value(iter, COLUMN_FIXED)
        name = model.get_value(iter, COLUMN_SEVERITY)

        fixed = not fixed        
        if fixed:
            Shell.command.sudo_execute ( [Configuration.APPPATH+'/hosts-manager', '-a',name])
        else :
            Shell.command.sudo_execute ( [Configuration.APPPATH+'/hosts-manager', '-r',name])
        # set new value        

# 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

            if ( site.parsable ):
                markup = site_template \
                % ( site.get_server_name(), site.get_document_root() )
            else:
                markup = site_unparsable_template % site.get_server_name()
            iter = lstore.append()
            
            favicon = site.get_icon()
            pixbuf = gtk.gdk.pixbuf_new_from_file( favicon )
                       
            lstore.set(iter,
                COLUMN_FIXED, site.enabled,
                COLUMN_ICON, pixbuf,
                COLUMN_SEVERITY, site.get_name(),
                COLUMN_MARKUP, markup )

    def __fixed_toggled(self, cell, path, treeview): 
        if not Shell.command.ask_password(): return 
        # get toggled iter        
        model = treeview.get_model()
        iter = model.get_iter((int(path),))
        fixed = model.get_value(iter, COLUMN_FIXED)
        name = model.get_value(iter, COLUMN_SEVERITY)

        fixed = not fixed        
        if fixed:
            Shell.command.sudo_execute ( [Configuration.APPPATH+'/hosts-manager', '-a',name])
        else :
            Shell.command.sudo_execute ( [Configuration.APPPATH+'/hosts-manager', '-r',name])
        # set new value        

        site = VirtualHostModel( name )