protected void Page_Load(object sender, EventArgs e) { main.SetPageType(Main.PageType.NamesResult); Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/BotanicusDropInViewerUtils.js")); if (!IsPostBack) { //fillPageTypeCombo(); } fillResultTree(); main.Body.Attributes.Add("onload", "ResizeNameBibliography();resizeViewerHeight(97);PerformSearch();"); main.Body.Attributes.Add("onresize", "ResizeNameBibliography();resizeViewerHeight(97);"); main.Page.Title = "Biodiversity Heritage Library: Name Search - \"" + name + "\""; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { browseContentPanel.SetTableID("browseContentPanel"); Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/ResizeBrowseUtils.js")); //ControlGenerator.AddScriptControl(Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); main.SetPageType(Main.PageType.Content); loadBrowseControl(); } }
protected void Page_Load(object sender, EventArgs e) { //Master.Page.Header.Controls.Add( ControlGenerator.GetScriptControl( "/Scripts/Ubio.js" ) ); Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/BotanicusDropInViewerUtils.js")); //Master.Page.Header.Controls.Add( ControlGenerator.GetScriptControl( "/Scripts/Highlighter.js" ) ); pageListContentPanel.SetTableID("pageListTable"); namesListContentPanel.SetTableID("nameListTable"); //ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "SetContentPanelWidth('pageListTable', 250);SetContentPanelWidth('nameListTable', 250);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "resizeViewerHeight(157);"); main.SetPageType(Main.PageType.TitleViewer); main.HideOverflow(); if (!Page.IsPostBack) { PageSummaryView ps = null; if ((Request["BibId"] != null) && ((Request["volume"] != null) || (Request["issue"] != null) || (Request["year"] != null) || (Request["startpage"] != null)) && Request["resolved"] == null) { Response.Redirect("PageResolve.aspx?" + Request.ServerVariables["QUERY_STRING"]); } if (ps == null) { if (Request.QueryString["pageid"] != null) { int pageid; if (int.TryParse(Request.QueryString["pageid"], out pageid)) { ps = bhlProvider.PageSummarySelectByPageId(pageid); } } else if (Request.QueryString["titleid"] != null) { int titleid; if (int.TryParse(Request.QueryString["titleid"], out titleid)) { // Check to make sure this title hasn't been replaced. If it has, redirect // to the appropriate titleid. Title title = bhlProvider.TitleSelect(titleid); if (title.RedirectTitleID != null) { Response.Redirect("/title/" + title.RedirectTitleID.ToString()); Response.End(); } ps = bhlProvider.PageTitleSummarySelectByTitleId(titleid); } } else if (Request.QueryString["itemid"] != null) { int itemid; if (int.TryParse(Request.QueryString["itemid"], out itemid)) { ps = bhlProvider.PageSummarySelectByItemId(itemid); } } else if (Request["BibId"] != null) { ps = bhlProvider.PageTitleSummarySelectByBibID(Request["bibID"].ToString()); } else if (Request["Barcode"] != null) { ps = bhlProvider.PageSummarySelectByBarcode(Request["Barcode"].ToString()); } else if (Request["Prefix"] != null) { ps = bhlProvider.PageSummarySelectByPrefix(Request["Prefix"].ToString()); } } if (ps != null) { hidItemID.Value = ps.ItemID.ToString(); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "changePage(" + ps.SequenceOrder + ");resizeViewerHeight(157);"); } else { // if our PageSummaryView is still null, then redirect because we couldn't find the requested title. Response.Redirect("/TitleNotFound.aspx"); Response.End(); } if (ps != null) { Master.Page.Title = "Biodiversity Heritage Library: " + ps.ShortTitle; // Set the item for the COinS COinSControl1.ItemID = ps.ItemID; CustomGenericList <MOBOT.BHL.DataObjects.Page> pages = bhlProvider.PageMetadataSelectByItemID(ps.ItemID); pageListBox.DataTextField = "WebDisplay"; pageListBox.DataValueField = "PageID"; pageListBox.DataSource = pages; pageListBox.DataBind(); int totalPageCount = bhlProvider.PageSelectCountByItemID(ps.ItemID); hidSequenceMax.Value = totalPageCount.ToString(); hidPageID.Value = ps.PageID.ToString(); pageLink.InnerText = "/page/" + ps.PageID.ToString(); titleVolumeSelectionControl.PopulateControl(ps); Data.Institution institution = bhlProvider.InstitutionSelectByItemID(ps.ItemID); if (institution != null) { if (institution.InstitutionUrl != null && institution.InstitutionUrl.Trim().Length > 0) { HyperLink link = new HyperLink(); link.Text = institution.InstitutionName; link.NavigateUrl = institution.InstitutionUrl; link.Target = "_blank"; attributionPlaceHolder.Controls.Add(link); } else { Literal literal = new Literal(); literal.Text = institution.InstitutionName; attributionPlaceHolder.Controls.Add(literal); } string attributionDivAttributesString = ""; if (BrowserUtility.IsBrowserIE6OrBelow(Request)) { attributionDivAttributesString = ConfigurationManager.AppSettings["attributionDivPropertiesIE6"]; } else { attributionDivAttributesString = ConfigurationManager.AppSettings["attributionDivPropertiesDefault"]; } string[] attributionDivAttributeParts = attributionDivAttributesString.Split('|'); attributionDiv.Style.Add("position", attributionDivAttributeParts[0]); attributionDiv.Style.Add("bottom", attributionDivAttributeParts[1]); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { browseContentPanel.SetTableID("browseContentPanel"); Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/ResizeBrowseUtils.js")); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); main.SetPageType(Main.PageType.Content); } if ((Request.QueryString["titleid"] != null || Request.QueryString["pid"] != null || Request.QueryString["title"] != null || Request.QueryString["stitle"] != null) && ((Request.QueryString["volume"] != null) || (Request.QueryString["issue"] != null) || (Request.QueryString["year"] != null) || (Request.QueryString["startpage"] != null) || (Request.QueryString["spage"] != null) || (Request.QueryString["date"] != null))) { string volume = ""; string issue = ""; string year = ""; string startpage = ""; if (Request.QueryString["volume"] != null) { volume = Request.QueryString["volume"].ToString(); } if (Request.QueryString["issue"] != null) { issue = Request.QueryString["issue"].ToString(); } if (Request.QueryString["year"] != null) { year = Request.QueryString["year"].ToString(); } if (Request.QueryString["startpage"] != null) { startpage = Request.QueryString["startpage"].ToString(); } if (Request.QueryString["spage"] != null) { startpage = Request.QueryString["spage"].ToString(); } if (Request.QueryString["date"] != null) { year = Request.QueryString["date"].ToString(); } //see if this is a valid date value...if so, only use the year portion DateTime date; if (DateTime.TryParse(year, out date)) { year = date.Year.ToString(); } if (volume.Trim().Length == 0) { volumeLiteral.Text = "not supplied"; } else { volumeLiteral.Text = volume; } if (issue.Trim().Length == 0) { issueLiteral.Text = "not supplied"; } else { issueLiteral.Text = issue; } if (year.Trim().Length == 0) { yearLiteral.Text = "not supplied"; } else { yearLiteral.Text = year; } if (startpage.Trim().Length == 0) { startPageLiteral.Text = "not supplied"; } else { startPageLiteral.Text = startpage; } int titleId = 0; string fullTitle = ""; string abbreviation = ""; if (Request.QueryString["titleid"] != null) { int.TryParse(Request.QueryString["titleid"], out titleId); } if (Request.QueryString["pid"] != null) { int.TryParse(Request.QueryString["pid"], out titleId); } if (Request.QueryString["title"] != null) { fullTitle = Request.QueryString["title"]; } if (Request.QueryString["stitle"] != null) { abbreviation = Request.QueryString["stitle"]; } MOBOT.BHL.DataObjects.Title title = null; if (titleId > 0) { title = bhlProvider.TitleSelectAuto(titleId); } else if (fullTitle != null && fullTitle.Trim().Length > 0) { CustomGenericList <MOBOT.BHL.DataObjects.Title> titleList = bhlProvider.TitleSelectByFullTitle(fullTitle); if (titleList.Count == 1) { titleId = titleList[0].TitleID; } } else if (abbreviation != null && abbreviation.Trim().Length > 0) { CustomGenericList <MOBOT.BHL.DataObjects.Title> titleList = bhlProvider.TitleSelectByAbbreviation(abbreviation); if (titleList.Count == 1) { titleId = titleList[0].TitleID; } } PageSummaryView ps = null; if (titleId > 0) { ps = bhlProvider.PageTitleSummarySelectByTitleId(titleId); } if (ps == null) { resultMessageLiteral.Text = "We're sorry, but we were not able to map your request to a particular title."; } else { titleLiteral.Text = ps.FullTitle; resultMessageLiteral.Text = "Title found...move on to the next step..."; CustomGenericList <CustomDataRow> list = bhlProvider.PageResolve(ps.TitleID, volume, issue, year, startpage); if (!UniqueItemFound(list)) { // Couldn't narrow down to a single item/volume, therefore, redirect to the bibliography page and let them choose // from there resultMessageLiteral.Text = "We're sorry, but we were unable to resolve the page you requested to a unique " + "item. Please visit the <a href=\"/bibliography/" + ps.TitleID.ToString() + "\">bibliography</a> page for " + "this title to browse for the requested page."; } else if (list.Count > 1 || !IsResultAnExactMatch(list[0])) { // Multiple results so show the results and let the user pick resultMessageLiteral.Text = "We're sorry, but we were not able to find an exact match based on the above " + "criteria. However, we did find options that are close. Please select one of the pages below or visit the " + "<a href=\"/bibliography/" + ps.TitleID.ToString() + "\">bibliography</a> page for this title to browse " + "for the requested page.<br />"; // Kind of kludgy, but since we don't have a typed object to work with, we can't bind to a repeater. foreach (CustomDataRow row in list) { string singleResut = "<br /><a href=\"page/" + row["PageID"].Value.ToString() + "\">"; if (row["Year"].Value != null) { singleResut += "Year: " + row["Year"].Value.ToString() + "; "; } if (row["Issue"].Value != null) { singleResut += "Issue: " + row["Issue"].Value.ToString() + "; "; } if (row["Volume"].Value != null) { singleResut += "Volume: " + row["Volume"].Value.ToString() + "; "; } if (row["PagePrefix"].Value != null && row["PageNumber"].Value != null) { singleResut += "Start Page: " + row["PagePrefix"].Value.ToString() + " " + row["PageNumber"].Value.ToString() + "; "; } singleResut += "(ID: " + row["PageID"].Value.ToString() + ")</a><br />"; similarResultsLiteral.Text += singleResut; } } else { // Narrowed it down to one potential page. If all criteria matches exactly, redirect to title page. // Otherwise display the single result and acknowledge that it is not an exact match Response.Redirect("/page/" + list[0]["PageID"].Value.ToString()); } } } else { resultMessageLiteral.Text = "We're sorry, but we were not able to map your request to a particular title."; } }