Example #1
0
        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();
                    }
                }
            }
        }
Example #2
0
 public CustomGenericList<Page> PageMetadataSelectByItemID(int itemID)
 {
     BHLProvider bhlServer = new BHLProvider();
     return bhlServer.PageMetadataSelectByItemID(itemID);
 }