private bool ViewPicture(ref BrowserSender bSender, ref bool sentCompletePage)
        {
            string txtOutput = FileCache.ReadSkinTextFile("page_viewpicture.htm");

            StringBuilder sbHTML = new StringBuilder(100);

            string FN = "";
            string strSize = "";
            bool shouldDownload = false;
            if (
                (qsParams.HasParameter("FN")) && (qsParams.HasParameter("SIZE"))
                )
            {
                string qsFN = qsParams["FN"];
                FN = HttpUtility.UrlDecode(qsFN);
                FN = Functions.DecodeFromBase64(FN, Encoding.UTF8);  // http uses UTF8 encoding

                txtPageTitle = Path.GetFileNameWithoutExtension(FN);

                strSize = qsParams["SIZE"];

                shouldDownload = (qsParams.HasParameter("DOWNLOAD"));
            }
            else
            {
                bSender.Send404Page();
                sentCompletePage = true;
            }

            // Thumbnail?
            string imgSrc;
            if (!strSize.Equals("full"))
            {
                // Assemble path to file
                imgSrc = "getfilethumbnail64?filename=" + qsParams["FN"] + "&size=" + strSize;

                HTMLImage image = new HTMLImage(imgSrc, "picturelibraryviewedpicture");

                // Link
                string strLinkToFullImage = "viewpic?FN=" + qsParams["FN"] + "&size=full";
                HTMLLink lnk = new HTMLLink(strLinkToFullImage, image.ToString());

                // Commit to form
                sbHTML.Append(lnk.ToString());

                sbHTML.Append("<br /><br />");

                HTMLLink fullLink = new HTMLLink(strLinkToFullImage, "View original size");
                sbHTML.Append(fullLink.ToString());

                sbHTML.Append("&nbsp;&nbsp;|&nbsp;&nbsp;");

                fullLink = new HTMLLink(strLinkToFullImage + "&download=yes", "Download");
                sbHTML.Append(fullLink.ToString());
            }
            else
            {
                sentCompletePage = true;
                bSender.SendFileToBrowser(FN, false, false, shouldDownload);
            }

            txtOutput = txtOutput.Replace("**LIBRARYTABLE**", sbHTML.ToString());

            txtResponse += txtOutput;

            return true;
        }
示例#2
0
        static string HTMLTableForVideoLibrary(FileBrowseResult fbrs, int numberOfColumns, int pageNumber, int itemsPerPage, bool showThumbnails)
        {
            List<string> content = new List<string>();

            foreach (BrowseItem strFolder in fbrs.Directories)
            {
                string cellContent = "";

                // Link
                string folderPath = Path.Combine(fbrs.BaseDirectory, strFolder.Name);
                folderPath = Functions.EncodeToBase64(folderPath);

                string folderImageSource = "/static/images/imgFolder150x75.png";
                HTMLImage image = new HTMLImage(folderImageSource, "folderpic");
                cellContent += image.ToString();
                cellContent += "<br />";
                cellContent += Path.GetFileName(strFolder.Name);

                HTMLLink lnk = new HTMLLink("browsevideos?PATH=" + folderPath, cellContent);

                content.Add(lnk.ToString());
            }
            foreach (BrowseItem strFile in fbrs.Files)
            {
                // Assemble path to file
                string filePath = Path.Combine(fbrs.BaseDirectory, strFile.Name);
                filePath = Functions.EncodeToBase64(filePath);

                string imgSrc = "getfilethumbnail64?filename=" + filePath + "&size=medium";
                HTMLImage image = new HTMLImage(imgSrc, "thumbnail");

                // Link
                HTMLLink lnk = new HTMLLink("streamvideo?FN=" + filePath, image.ToString());
                content.Add(lnk.ToString());
            }

            return HTMLTable.HTMLTableWithCellContents("videolibrarytable", numberOfColumns, content);
        }