/** * 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); }
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(); } }
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(); }
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(); } }
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"; } }
/** * 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; }
private void RenderConfig(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ApacheSite site = (ApacheSite)model.GetValue(iter, 0); (cell as CellRendererText).Text = site.getConfigFullPath(); }
private void RenderName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ApacheSite site = (ApacheSite)model.GetValue(iter, 0); (cell as CellRendererText).Text = site.name; }
private void initSites() { apacheSitesList.setCollection(ApacheSite.ReadSites()); }