protected void buttonCreate_Click(object sender, System.EventArgs e) { if (textNewFileName.Text.Length > 0) { // Get the requested file name to create and stip off any extra directories string fileName = textNewFileName.Text; fileName = Path.GetFileName(fileName); // Double check that there is an extension. If not, tag on opml if (Path.GetExtension(fileName) == String.Empty) { fileName = fileName + ".opml"; } // Add this to the list of current file names and select it as active listFiles.Items.Add(fileName); listFiles.SelectedValue = fileName; Session["newtelligence.DasBlog.Web.EditBlogRollBox.baseFileName"] = baseFileName = fileName; // This will created during LoadOutline, but have to clear it out first, otherwise this new blogroll // will get a copy of the currently selected one, instead of starting fresh opmlTree = null; LoadOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); BindGrid(); textNewFileName.Text = ""; } }
protected void Page_Load(object sender, System.EventArgs e) { if (SiteSecurity.IsInRole("admin") == false) { Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html"); } if (!IsPostBack || Session["newtelligence.DasBlog.Web.EditBlogRollBox.OpmlTree"] == null) { SharedBasePage requestPage = Page as SharedBasePage; foreach (string file in Directory.GetFiles(SiteConfig.GetConfigPathFromCurrentContext(), "*.opml")) { listFiles.Items.Add(Path.GetFileName(file)); } if (listFiles.Items.Count == 0) { listFiles.Items.Add("blogroll.opml"); } Session["newtelligence.DasBlog.Web.EditBlogRollBox.baseFileName"] = baseFileName = listFiles.Items[0].Text; string fileName = Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName); LoadOutline(fileName); } else { baseFileName = Session["newtelligence.DasBlog.Web.EditBlogRollBox.baseFileName"] as string; opmlTree = Session["newtelligence.DasBlog.Web.EditBlogRollBox.OpmlTree"] as Opml; } BindGrid(); }
private void navigatorLinksGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { navigationRoot.Items.RemoveAt(e.Item.DataSetIndex); SaveList(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] = null; Response.Redirect(Page.Request.Url.AbsoluteUri, true); }
protected void buttonSelect_Click(object sender, System.EventArgs e) { Session["newtelligence.DasBlog.Web.EditBlogRollBox.baseFileName"] = baseFileName = listFiles.Items[listFiles.SelectedIndex].Text; Session["newtelligence.DasBlog.Web.EditBlogRollBox.OpmlTree"] = null; blogRollGrid.EditItemIndex = -1; blogRollGrid.SelectedIndex = -1; LoadOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); BindGrid(); }
private void blogRollGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { opmlTree.body.outline.RemoveAt(e.Item.DataSetIndex); SaveOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); blogRollGrid.EditItemIndex = -1; blogRollGrid.SelectedIndex = -1; LoadOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); BindGrid(); }
private void navigatorLinksGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { NavigationLink link = navigationRoot.Items[e.Item.DataSetIndex]; link.Name = ((TextBox)e.Item.FindControl("textname")).Text; link.Url = ((TextBox)e.Item.FindControl("texturl")).Text; SaveList(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] = null; Response.Redirect(Page.Request.Url.AbsoluteUri, true); }
private void blogRollGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { OpmlOutline row = opmlTree.body.outline[e.Item.DataSetIndex]; EditBlogRollEditItem item = ((EditBlogRollEditItem)e.Item.FindControl("editBlogRollEditItem")); row.description = item.Description; row.title = item.Title; row.htmlUrl = item.HtmlUrl; row.xmlUrl = item.XmlUrl; SaveOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); blogRollGrid.EditItemIndex = -1; blogRollGrid.SelectedIndex = -1; LoadOutline(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); BindGrid(); }
static PingServiceCollection GetPingServiceInfo() { PingServiceCollection pingServiceCollection = new PingServiceCollection(); string fullPath = SiteConfig.GetConfigPathFromCurrentContext() + "PingServices.xml"; if (File.Exists(fullPath)) { FileStream fileStream = FileUtils.OpenForRead(fullPath); if (fileStream != null) { try { XmlSerializer ser = new XmlSerializer(typeof(PingServiceCollection)); StreamReader reader = new StreamReader(fileStream); pingServiceCollection = (PingServiceCollection)ser.Deserialize(reader); // add to cache DataCache cache = CacheFactory.GetCache(); cache.Insert("PingServices", pingServiceCollection, new CacheDependency(fullPath)); } catch (Exception e) { ErrorTrace.Trace(TraceLevel.Error, e); } finally { fileStream.Close(); } } } // add some defaults if (pingServiceCollection.Count == 0) { pingServiceCollection = PingService.GetDefaultPingServices(); } return(pingServiceCollection); }
protected void Page_Load(object sender, System.EventArgs e) { if (SiteSecurity.IsInRole("admin") == false) { Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html"); } resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get()); if (!IsPostBack || Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] == null) { SharedBasePage requestPage = Page as SharedBasePage; string fileName = Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName); LoadList(fileName); } else { navigationRoot = Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] as NavigationRoot; } BindGrid(); }
private void LoadCrossPostServerInfo() { string fullPath = SiteConfig.GetConfigPathFromCurrentContext() + "CrossPostServerInfo.xml"; if (File.Exists(fullPath)) { FileStream fileStream = newtelligence.DasBlog.Util.FileUtils.OpenForRead(fullPath); if (fileStream != null) { try { XmlSerializer ser = new XmlSerializer(typeof(CrossPostServerInfo[])); StreamReader reader = new StreamReader(fileStream); crossPostServerInfo = (CrossPostServerInfo[])ser.Deserialize(reader); } catch (Exception e) { ErrorTrace.Trace(System.Diagnostics.TraceLevel.Error, e); } finally { fileStream.Close(); } } } else { CrossPostServerInfo[] crossPostServerInfo = new CrossPostServerInfo[1]; CrossPostServerInfo c1 = new CrossPostServerInfo(); c1.Name = "DasBlog"; c1.Endpoint = "blogger.aspx"; c1.Port = 80; c1.Service = 1; crossPostServerInfo[0] = c1; } }
private void navigatorLinksGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "AddItem") { NavigationLink newLink = new NavigationLink(); newLink.Name = "New Entry"; navigationRoot.Items.Insert(0, newLink); navigatorLinksGrid.CurrentPageIndex = 0; navigatorLinksGrid.EditItemIndex = 0; BindGrid(); } else if (e.CommandName == "MoveUp" && e.Item != null) { int position = e.Item.DataSetIndex; if (position > 0) { NavigationLink link = new NavigationLink(); link.Name = navigationRoot.Items[position].Name; link.Url = navigationRoot.Items[position].Url; navigationRoot.Items.RemoveAt(position); navigationRoot.Items.Insert(position - 1, link); navigatorLinksGrid.CurrentPageIndex = (position - 1) / navigatorLinksGrid.PageSize; if (navigatorLinksGrid.EditItemIndex == position) { navigatorLinksGrid.EditItemIndex = position - 1; } else if (navigatorLinksGrid.EditItemIndex == position - 1) { navigatorLinksGrid.EditItemIndex = position; } } SaveList(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] = null; Response.Redirect(Page.Request.Url.AbsoluteUri, true); } else if (e.CommandName == "MoveDown" && e.Item != null) { int position = e.Item.DataSetIndex; if (position < navigationRoot.Items.Count - 1) { NavigationLink link = new NavigationLink(); link.Name = navigationRoot.Items[position].Name; link.Url = navigationRoot.Items[position].Url; navigationRoot.Items.RemoveAt(position); navigationRoot.Items.Insert(position + 1, link); navigatorLinksGrid.CurrentPageIndex = (position + 1) / navigatorLinksGrid.PageSize; if (navigatorLinksGrid.EditItemIndex == position) { navigatorLinksGrid.EditItemIndex = position + 1; } else if (navigatorLinksGrid.EditItemIndex == position + 1) { navigatorLinksGrid.EditItemIndex = position; } } SaveList(Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName)); Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] = null; Response.Redirect(Page.Request.Url.AbsoluteUri, true); } }