Ejemplo n.º 1
0
        /**
         * Read all the sites
         * /etc/apache2/mods-available/
         * /etc/apache2/mods-enabled/
         **/
        public static ArrayList ReadSites()
        {
            ArrayList list = new ArrayList();

            string[] sites_available = System.IO.Directory.GetFiles("/etc/apache2/sites-available/");
            string[] sites_enabled   = System.IO.Directory.GetFiles("/etc/apache2/sites-enabled/");

            for (int i = 0; i < sites_available.Length; i++)
            {
                string tmpName = Utils.FileName(sites_available[i]);

                bool tmpActive = false;
                for (int j = 0; j < sites_enabled.Length; j++)
                {
                    if (tmpName == Utils.FileName(sites_enabled[j]).Substring(4))
                    {
                        tmpActive = true;
                    }
                }

                System.IO.FileInfo tmpConfigFile = new System.IO.FileInfo(sites_available[i]);

                ApacheSite apacheSite = new ApacheSite(tmpName, tmpActive, tmpConfigFile);
                list.Add(apacheSite);
            }

            return(list);
        }
Ejemplo n.º 2
0
        private void OnEditButtonClicked(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                ApacheSite site = (ApacheSite)model.GetValue(iter, 0);
                site.edit();
            }
        }
Ejemplo n.º 3
0
        private void OnStatusButtonToggled(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                ApacheSite site = (ApacheSite)model.GetValue(iter, 0);
                site.changeStatus();
            }
            treeView.ShowAll();
        }
Ejemplo n.º 4
0
        private void OnSelectionChanged(object o, EventArgs args)
        {
            TreeIter iter; TreeModel model;

            if (((TreeSelection)o).GetSelected(out model, out iter))
            {
                ApacheSite site = (ApacheSite)model.GetValue(iter, 0);
                statusButton.Sensitive = true;
                changeStatusButton(site.active);
                editButton.Sensitive = site.hasConfigFile();
            }
        }
Ejemplo n.º 5
0
        private void RenderStatus(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheSite site = (ApacheSite)model.GetValue(iter, 0);

            if (site.active)
            {
                (cell as Gtk.CellRendererText).Foreground = "darkgreen";
                (cell as CellRendererText).Text           = "Active";
            }
            else
            {
                (cell as Gtk.CellRendererText).Foreground = "red";
                (cell as CellRendererText).Text           = "Inactive";
            }
        }
Ejemplo n.º 6
0
        /**
         * Read all the sites
         * /etc/apache2/mods-available/
         * /etc/apache2/mods-enabled/
         **/
        public static ArrayList ReadSites()
        {
            ArrayList list = new ArrayList();

            string[] sites_available = System.IO.Directory.GetFiles("/etc/apache2/sites-available/");
            string[] sites_enabled = System.IO.Directory.GetFiles("/etc/apache2/sites-enabled/");

            for (int i = 0; i < sites_available.Length; i++) {
                string tmpName = Utils.FileName(sites_available[i]);

                bool tmpActive = false;
                for (int j = 0; j < sites_enabled.Length; j++)
                    if (tmpName == Utils.FileName(sites_enabled[j]).Substring(4))
                        tmpActive = true;

                System.IO.FileInfo tmpConfigFile = new System.IO.FileInfo(sites_available[i]);

                ApacheSite apacheSite = new ApacheSite(tmpName, tmpActive, tmpConfigFile);
                list.Add(apacheSite);
            }

            return list;
        }
Ejemplo n.º 7
0
        private void RenderConfig(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheSite site = (ApacheSite)model.GetValue(iter, 0);

            (cell as CellRendererText).Text = site.getConfigFullPath();
        }
Ejemplo n.º 8
0
        private void RenderName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ApacheSite site = (ApacheSite)model.GetValue(iter, 0);

            (cell as CellRendererText).Text = site.name;
        }
Ejemplo n.º 9
0
 private void initSites()
 {
     apacheSitesList.setCollection(ApacheSite.ReadSites());
 }