protected void Page_Load(object sender, EventArgs e) { main.SetPageType(Main.PageType.Content); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/jquery-1.2.6.min.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); if (!IsPostBack) { // Retrieve the pages for the item String itemIDString = Request.QueryString["ItemID"] as String; int itemID; if (itemIDString != null) { if (Int32.TryParse(itemIDString, out itemID)) { BHLProvider provider = new BHLProvider(); // If this is a Botanicus item, make sure the PDF actually exists. // Remove the DownloadUrl if it does not. Data.Item item = provider.ItemSelectByBarcodeOrItemID(itemID, null); if (!String.IsNullOrEmpty(item.DownloadUrl) && item.ItemSourceID == 2) { // This is kludgy... should find a better way to do this String pdfLocation = item.DownloadUrl.Replace("http://www.botanicus.org/", "\\\\server\\").Replace('/', '\\'); if (provider.GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(pdfLocation)) { item.DownloadUrl = ConfigurationManager.AppSettings["PdfAuthUrl"] != null?String.Format(ConfigurationManager.AppSettings["PdfAuthUrl"], item.BarCode) : String.Empty; } else { item.DownloadUrl = String.Empty; } } if (String.IsNullOrEmpty(item.DownloadUrl)) { litDownloadLink.Text = ConfigurationManager.AppSettings["PdfGenDownloadNone"].ToString(); } else if (item.ItemSourceID == 1) { litDownloadLink.Text = String.Format(ConfigurationManager.AppSettings["PdfGenDownloadIA"], item.BarCode, item.BarCode); } else { litDownloadLink.Text = String.Format(ConfigurationManager.AppSettings["PdfGenDownloadBotanicus"], item.DownloadUrl); } // Get the page information for this item CustomGenericList <Data.Page> pages = provider.PageMetadataSelectByItemID(itemID); dlPages.DataSource = pages; dlPages.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); }
protected void Page_Load(object sender, EventArgs e) { rssFeed.FeedLocation = ConfigurationManager.AppSettings["projectUpdatesFeedLocation"]; ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); }
protected void Page_Load(object sender, EventArgs e) { Main main = (Main)Page.Master; titleSelectionContentPanel.SetTableID("titleSelectionContentPanel"); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/jquery-1.2.6.min.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeContentPanel('titleSelectionContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeContentPanel('titleSelectionContentPanel', 258);"); }
protected void Page_Load(object sender, EventArgs e) { ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); Response.Cookies["CallingUrl"].Value = Request.Url.ToString(); adminLabel.Visible = true; //Helper.IsAdmin( Request ); }
protected void Page_Load(object sender, EventArgs e) { Main main = (Main)Page.Master; main.SetPageType(Main.PageType.Content); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); String institutionCode = String.Empty; if (this.Request.Cookies["ddlContributors"] != null) { institutionCode = this.Request.Cookies["ddlContributors"].Value; } String languageCode = String.Empty; if (this.Request.Cookies["ddlLanguage"] != null) { languageCode = this.Request.Cookies["ddlLanguage"].Value; } int startDate; int endDate; bool startFlag = false; if (int.TryParse(Request.QueryString["start"], out startDate) == false) { startDate = int.Parse(ConfigurationManager.AppSettings["browseByYearDefaultStart"]); startFlag = true; } if (int.TryParse(Request.QueryString["enddate"], out endDate) == false) { if (startFlag) { endDate = int.Parse(ConfigurationManager.AppSettings["browseByYearDefaultEnd"]); } else { endDate = DateTime.Now.Year; } } titleLiteral.Text = GenerateDateList(startDate, endDate, institutionCode, languageCode); }
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) { ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); string searchTerm = String.Empty; string searchLang = String.Empty; string titleMax = "0"; string authorMax = "0"; string nameMax = "0"; string subjectMax = "0"; if (Request["SearchTerm"] != null) { searchTerm = Request["SearchTerm"].ToString(); if (Request["lang"] != null) { searchLang = Request["lang"].ToString(); } if (Request["tMax"] != null) { titleMax = Request["tMax"].ToString(); } if (Request["aMax"] != null) { authorMax = Request["aMax"].ToString(); } if (Request["nMax"] != null) { nameMax = Request["nMax"].ToString(); } if (Request["sMax"] != null) { subjectMax = Request["sMax"].ToString(); } Response.Cookies.Add(new HttpCookie("nameSearchLang", searchLang)); searchResultsLabel.Text = searchTerm; PerformSearch(searchTerm, searchLang, titleMax, authorMax, nameMax, subjectMax); } }
protected void Page_Load(object sender, EventArgs e) { projectUpdateFeedLocation = ConfigurationManager.AppSettings["projectUpdatesFeedLocation"]; Page.Header.Controls.Add(ControlGenerator.GetRssFeedControl(projectUpdateFeedLocation, ConfigurationManager.AppSettings["projectUpdatesRssTitle"])); debugMode = DebugUtility.IsDebugMode(Response, Request); debugModeDiv.Visible = debugMode; if (debugMode) { Page.Title = "***DEBUG MODE*** " + Page.Title; } if (!this.IsPostBack) { PopulateContributorsList(); PopulateLanguageList(); DisplayAlertMessage(); } if (pageType == PageType.Content) { nowOnlineDiv.Visible = true; Stats stats = this.GetStats(); titlesOnlineCount = stats.TitleCount; titlesOnlineLiteral.Text = stats.TitleCount.ToString("0,0"); volumesOnlineLiteral.Text = stats.VolumeCount.ToString("0,0"); pagesOnlineLiteral.Text = stats.PageCount.ToString("0,0"); //protologuesOnlineLiteral.Text = stats.ProtologueCount.ToString("0,0"); //ControlGenerator.AddScriptControl(Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(Body, "onload", "ResizeContentPanelHeight('newsDiv', 262);"); ControlGenerator.AddAttributesAndPreserveExisting(Body, "onresize", "ResizeContentPanelHeight('newsDiv', 262);"); rssFeed.FeedLocation = projectUpdateFeedLocation; } }
protected void Page_Load(object sender, EventArgs e) { main.SetPageType(Main.PageType.Content); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/jquery-1.2.6.min.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeContentPanel('browseContentPanel', 258);ResizeBrowseDivs();"); Data.PageSummaryView ps = null; CustomGenericList <Data.Item> items = null; CustomGenericList <Data.Creator> creators = null; CustomGenericList <Data.TitleTag> titleTags = null; CustomGenericList <Data.Title_TitleIdentifier> titleIdentifiers = null; CustomGenericList <Data.TitleAssociation> titleAssociations = null; Data.Title title = null; bool showData = false; int titleId = 0; if (Request["titleid"] != null) { if (!int.TryParse(Request.QueryString["titleid"], out titleId)) { // Request seems to have included a MARCBibID instead of a TitleId Data.PageSummaryView psBib = bhlProvider.PageTitleSummarySelectByBibID(Request.QueryString["titleid"].ToString()); if (psBib != null) { titleId = psBib.TitleID; } } showData = true; } if (!showData && Request.QueryString["oclc"] != null) { // Get the title id associated with the OCLC identifier Data.Title_TitleIdentifier titleTitleId = bhlProvider.Title_TitleIdentifierSelectByIdentifierValue(Request.QueryString["oclc"].ToString()); if (titleTitleId != null) { titleId = titleTitleId.TitleID; } showData = true; } if (showData) { hidTitleID.Value = titleId.ToString(); // Check to make sure this title hasn't been replaced. If it has, redirect // to the appropriate titleid. title = bhlProvider.TitleSelect(titleId); if (title.RedirectTitleID != null) { Response.Redirect("/bibliography/" + title.RedirectTitleID.ToString()); Response.End(); } // Set the title for the COinS COinSControl1.TitleID = titleId; ps = bhlProvider.PageTitleSummarySelectByTitleId(titleId); if (ps == null) { Response.Redirect("/TitleNotFound.aspx"); Response.End(); } Barcode = ps.BarCode; creators = bhlProvider.CreatorSelectByTitleId(titleId); items = bhlProvider.ItemSelectByTitleId(titleId); titleTags = bhlProvider.TitleTagSelectTagTextByTitleId(titleId); titleIdentifiers = bhlProvider.Title_TitleIdentifierSelectByTitleID(titleId); titleAssociations = bhlProvider.TitleAssociationSelectByTitleId(titleId, true); if (titleAssociations.Count == 0) { associationsDiv.Visible = false; } else { associationsDiv.Visible = true; associationsRepeater.DataSource = titleAssociations; associationsRepeater.DataBind(); } foreach (Data.Item item in items) { // Populate empty volume descriptions with default text if (item.Volume == String.Empty || item.Volume == null) { if (items.Count == 1) { item.Volume = "View Book"; } if (items.Count > 1) { item.Volume = "(no volume description)"; } } // Make sure all Botanicus PDFs actually exist. Remove the DownloadUrl for any that do not. if (item.DownloadUrl != String.Empty && item.ItemSourceID == 2) { // This is kludgy... should find a better way to do this String pdfLocation = item.DownloadUrl.Replace("http://www.botanicus.org/", "\\\\server\\").Replace('/', '\\'); if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(pdfLocation)) { item.DownloadUrl = ConfigurationManager.AppSettings["PdfAuthUrl"] != null?String.Format(ConfigurationManager.AppSettings["PdfAuthUrl"], item.BarCode) : String.Empty; } else { item.DownloadUrl = String.Empty; } } } // Look for an OCLC identifier (use the first one... might need to account for multiple at some point) bool oclcFound = false; foreach (Data.Title_TitleIdentifier titleIdentifier in titleIdentifiers) { if (String.Compare(titleIdentifier.IdentifierName, "OCLC", StringComparison.CurrentCultureIgnoreCase) == 0) { localLibraryLink.NavigateUrl += "wcpa/oclc/"; if (titleIdentifier.IdentifierValue.ToLower().StartsWith("ocm")) { //strip the "ocm" from the beginning of the value. localLibraryLink.NavigateUrl += titleIdentifier.IdentifierValue.Substring(3); } else { localLibraryLink.NavigateUrl += titleIdentifier.IdentifierValue; } oclcFound = true; break; } } if (!oclcFound) { string truncatedTitle = ""; if (title.FullTitle.Length > 220) { truncatedTitle = title.FullTitle.Substring(0, 220); truncatedTitle = truncatedTitle.Substring(0, truncatedTitle.LastIndexOf(" ")); } else { truncatedTitle = title.FullTitle; } localLibraryLink.NavigateUrl += "search?q=" + truncatedTitle.Replace(" ", "+") + "&qt=owc_search"; } Master.Page.Title = "Biodiversity Heritage Library: Information about '" + ps.FullTitle + "'"; //descriptionLiteral.Text = title.TitleDescription; publicationInfoLiteral.Text = title.PublicationDetails; fullTitleLiteral.Text = title.FullTitle + " " + (title.PartNumber ?? "") + " " + (title.PartName ?? ""); if (title.CallNumber == null || title.CallNumber.Length == 0) { callNumberPanel.Visible = false; } else { callNumberLiteral.Text = title.CallNumber; } if (titleTags == null || titleTags.Count == 0) { subjectPanel.Visible = false; } else { int k = titleTags.Count - 1; int i = 0; StringBuilder sb = new StringBuilder(); foreach (Data.TitleTag titleTag in titleTags) { sb.Append("<a href='/subject/"); sb.Append(Server.UrlEncode(titleTag.TagText)); sb.Append("'>"); sb.Append(titleTag.TagText); sb.Append("</a>"); if (i + 1 <= k) { sb.Append(", "); } i++; } subjectLiteral.Text = sb.ToString(); } itemRepeater.DataSource = items; itemRepeater.DataBind(); CustomGenericList <Data.Creator> authors = new CustomGenericList <Data.Creator>(); CustomGenericList <Data.Creator> additionalAuthors = new CustomGenericList <Data.Creator>(); foreach (Data.Creator creator in creators) { if (creator.CreatorRoleTypeForTitle >= 1 && creator.CreatorRoleTypeForTitle <= 3) { authors.Add(creator); } else { additionalAuthors.Add(creator); } } authorsRepeater.DataSource = authors; authorsRepeater.DataBind(); additionalAuthorsRepeater.DataSource = additionalAuthors; additionalAuthorsRepeater.DataBind(); //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 ); // } //} if (Helper.IsAdmin(Request)) { editTitleLink.NavigateUrl = "/Admin/TitleEdit.aspx?id=" + titleId.ToString(); } else { editTitleLink.Visible = false; } // Get the full MARC details bool marcFound = false; String filepath = ps.MarcXmlLocation; bool test = (ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true"); if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(filepath)) { marcFound = true; } else { // File not found in primary location, so look in alternate location (Botanicus files in alt location) filepath = ps.MarcXmlAltLocation; if (new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").FileExists(filepath)) { marcFound = true; } } if (marcFound) { string marcXML = new BHLProvider().GetFileAccessProvider(ConfigurationManager.AppSettings["UseRemoteFileAccessProvider"] == "true").GetFileText(filepath); XmlDocument xml = new XmlDocument(); StringReader reader = new StringReader(marcXML); xml.Load(reader); // Set up the XSL resolver that we'll use to extract the text from the xml XmlUrlResolver resolver = new XmlUrlResolver(); resolver.Credentials = System.Net.CredentialCache.DefaultCredentials; System.Xml.Xsl.XslTransform xslTransform = new System.Xml.Xsl.XslTransform(); // Format the MARC XML into a "readable" format xslTransform.Load(Request.PhysicalApplicationPath + "xsl\\MARC21transformEnglish.xsl", resolver); StringWriter output = new StringWriter(); xslTransform.Transform(xml, null, output, resolver); litExpanded.Text = output.ToString(); // Format the MARC XML into a "flat" MARC format xslTransform.Load(Request.PhysicalApplicationPath + "xsl\\MARC21transformMARC.xsl", resolver); output = new StringWriter(); xslTransform.Transform(xml, null, output, resolver); litMarc.Text = output.ToString(); viewcontrol.Visible = true; } else { viewcontrolnomarc.Visible = true; } // Get the BibTex citations for this title try { hypBibTex.NavigateUrl += title.TitleID.ToString(); litBibTeX.Text = bhlProvider.TitleBibTeXGetCitationStringForTitleID(title.TitleID).Replace("\n", "<br>").Replace("\r", "<br>"); } catch { hypBibTex.Visible = false; litBibTeX.Text = "Error retrieving BibTex citations for this title."; } // Get the EndNote citation for this title try { hypEndNote.NavigateUrl += title.TitleID.ToString(); litEndNote.Text = bhlProvider.TitleEndNoteGetCitationStringForTitleID(title.TitleID, ConfigurationManager.AppSettings["ItemPageUrl"].ToString()).Replace("\n", "<br>").Replace("\r", "<br>"); } catch { hypEndNote.Visible = false; litEndNote.Text = "Error retrieving EndNote citations for this title."; } } }
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."; } }
protected void Page_Load(object sender, EventArgs e) { main.SetPageType(Main.PageType.Content); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeBrowseDivs();ResizeContentPanel('browseContentPanel', 258);"); String institutionCode = String.Empty; if (this.Request.Cookies["ddlContributors"] != null) { institutionCode = this.Request.Cookies["ddlContributors"].Value; } String languageCode = String.Empty; if (this.Request.Cookies["ddlLanguage"] != null) { languageCode = this.Request.Cookies["ddlLanguage"].Value; } if (Request.QueryString["tagText"] != null) { tagText = Request.QueryString["tagText"]; } // If we're referred here by the search page and the "secondary titles" flag was set, // then include secondary titles in the search. String includeSecondaryTitles = String.Empty; if (Request.UrlReferrer != null) { if (Request.UrlReferrer.LocalPath.ToLower().Contains("search.aspx") && Request.UrlReferrer.Query.ToLower().Contains("sec=1")) { includeSecondaryTitles = "1"; } } CustomGenericList <Data.Title> list = bhlProvider.TitleSelectByTagTextInstitutionAndLanguage(tagText, institutionCode, languageCode, includeSecondaryTitles); //titleRepeater.DataSource = list; //titleRepeater.DataBind(); string headerText = list.Count + " Title"; if (list.Count != 1) { headerText += "s"; } headerText += " tagged with \"" + tagText + "\""; pageHeaderLabel.Text = headerText; foreach (Data.Title title in list) { HtmlGenericControl li = new HtmlGenericControl("li"); li.InnerHtml = "<a href=\"/bibliography/" + title.TitleID.ToString() + "\" class=\"booktitle\">" + title.FullTitle + " " + (title.PartNumber ?? "") + " " + (title.PartName ?? "") + "</a><br />" + "Publication Info: " + title.PublicationDetails + "<br />" + "Contributed By: " + title.InstitutionName + "<br/>" + "Tags: "; foreach (string tag in title.Tags) { li.InnerHtml += "<a href=\"/subject/" + tag + "\" class=\"TitleTag\">" + tag + "</a> "; } titleList.Controls.Add(li); } }
protected void Page_Load(object sender, EventArgs e) { Main main = (Main)Page.Master; ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "initMap();"); if (this.Request.Cookies["ddlContributors"] != null) { institutionCode = this.Request.Cookies["ddlContributors"].Value; } if (this.Request.Cookies["ddlLanguage"] != null) { languageCode = this.Request.Cookies["ddlLanguage"].Value; } string key = ConfigurationManager.AppSettings["Google.Maps.Key." + Request.ServerVariables["HTTP_HOST"]]; //mapsScriptTag.Text = "<script src=\"http://maps.google.com/maps?file=api&v=2&key=" + key + "\" type=\"text/javascript\"></script>"; mapsScriptTag.Text = "<script src=\"" + ConfigurationManager.AppSettings["Google.Maps.ScriptUrlPrefix"] + key + "\" type=\"text/javascript\"></script>"; string geocodeUrlPrefix = "http://maps.google.com/maps/geo?output=csv&key=" + key + "&q="; BHLProvider provider = new BHLProvider(); //first get the list of TitleTags that do not yet exist in the location table CustomGenericList <CustomDataRow> newLocationList = provider.TitleTagSelectNewLocations(); foreach (CustomDataRow row in newLocationList) { //do the geocode lookups for our new locations HttpWebRequest req = (HttpWebRequest)WebRequest.Create(geocodeUrlPrefix + row["TagText"].Value.ToString()); req.Timeout = 15000; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); StreamReader reader = new StreamReader((System.IO.Stream)resp.GetResponseStream()); string results = reader.ReadLine(); string[] resultsArray = results.Split(','); //save the results to the Location table if (resultsArray[0] == "200") { //if we got a valid response, save the coordinates provider.LocationInsertAuto(row["TagText"].Value.ToString(), resultsArray[2], resultsArray[3], null, true); } else { //if we did not get a valid response, save a location record with null coordinates and set the NextAttemptDate to 30 days out provider.LocationInsertAuto(row["TagText"].Value.ToString(), null, null, DateTime.Now.AddDays(30), true); } } //next, get the list of Locations that were not successful in the past that are due for another attempt CustomGenericList <Location> invalidLocationList = provider.LocationSelectAllInvalid(); foreach (Location location in invalidLocationList) { //if the NextAttemptDate indicates that we're due to try again, do a new geocode lookup for this location if (location.NextAttemptDate != null && location.NextAttemptDate < DateTime.Now) { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(geocodeUrlPrefix + location.LocationName); req.Timeout = 15000; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); StreamReader reader = new StreamReader((System.IO.Stream)resp.GetResponseStream()); string results = reader.ReadLine(); string[] resultsArray = results.Split(','); //save the results to the Location table if (resultsArray[0] == "200") { //if we got a valid response, save the coordinates and wipe out the NextAttemptDate provider.LocationUpdateAuto(location.LocationName, resultsArray[2], resultsArray[3], null, location.IncludeInUI); } else { //if we still did not get a valid response, increment the NextAttemptDate by another 30 days provider.LocationUpdateAuto(location.LocationName, null, null, DateTime.Now.AddDays(30), location.IncludeInUI); } } } //now get the updated list of coordinates to set the markers on the map CustomGenericList <Location> validLocationList = provider.LocationSelectValidByInstitution(institutionCode, languageCode); foreach (Location location in validLocationList) { locations += location.Latitude + "," + location.Longitude + "," + location.LocationName + "," + location.NumberOfTitles.ToString() + ";"; } //strip the trailing ";" if (locations.EndsWith(";")) { locations = locations.Substring(0, locations.Length - 1); } }
protected void Page_Load(object sender, EventArgs e) { //authorListContentPanel.SetTableID("authorListContentPanel"); authorContentPanel.SetTableID("authorDetailContentPanel"); //Page.Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/ResizeContentPanelUtils.js")); //ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js"); ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeBrowseUtils.js"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload", "ResizeContentPanel('authorDetailContentPanel', 258);ResizeBrowseDivs();"); ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "ResizeContentPanel('authorDetailContentPanel', 258);ResizeBrowseDivs();"); //CustomGenericList<Data.Creator> creators = bhlProvider.CreatorSelectAll(); //authorsDropDownList.DataSource = creators; //authorsDropDownList.DataTextField = "CreatorName"; //authorsDropDownList.DataValueField = "CreatorId"; //authorsDropDownList.DataBind(); //authorsDropDownList.Attributes.Add("onchange", // "location.href='/creator/' + this.options[selectedIndex].value"); if (Request["CreatorId"] != null) { int creatorId = 0; try { creatorId = int.Parse(Request["CreatorId"]); } catch { CreatorNotFound(); } Data.Creator c = bhlProvider.CreatorSelectAuto(creatorId); if (c == null) { CreatorNotFound(); } //authorsDropDownList.SelectedValue = c.CreatorID.ToString(); creatorNameLiteral.Text = c.MARCCreator_a; if (c.MARCCreator_b != null) { creatorNameLiteral.Text += " " + c.MARCCreator_b; } if (c.DOB != null && c.DOB != "") { lifespanLiteral.Text = c.DOB; } if (c.DOD != null && c.DOD != "") { if (lifespanLiteral.Text != "") { lifespanLiteral.Text += " - " + c.DOD; } else { lifespanLiteral.Text += "Died " + c.DOD; } } else if (lifespanLiteral.Text != "") { lifespanLiteral.Text = "Born " + lifespanLiteral.Text; } if (lifespanLiteral.Text != "") { lifespanLiteral.Text = "(" + lifespanLiteral.Text + ")"; } // If we're referred here by the search page and the "secondary titles" flag was set, // then include secondary titles in the search. String includeSecondaryTitles = String.Empty; if (Request.UrlReferrer != null) { if (Request.UrlReferrer.LocalPath.ToLower().Contains("search.aspx") && Request.UrlReferrer.Query.ToLower().Contains("sec=1")) { includeSecondaryTitles = "1"; } } titlesRepeater.DataSource = bhlProvider.TitleSelectByCreator(c.CreatorID, includeSecondaryTitles); titlesRepeater.DataBind(); biographyLiteral.Text = c.Biography; } }