Пример #1
0
        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
        private bool ViewPicturesLibrary()
        {
            string path;
            if (qsParams.HasParameter("PATH"))
            {
                string qsFN = qsParams["PATH"];
                path = HttpUtility.UrlDecode(qsFN);
                path = Functions.DecodeFromBase64(path, Encoding.UTF8);  // http uses UTF8 encoding

                txtPageTitle = Path.GetFileNameWithoutExtension(path); // actually folder name
            }
            else
            {
                path = "PICTURES_LIBRARY";
                txtPageTitle = "Picture Library";
            }

            string txtPicTable = FileBrowseExporter.HTMLTableForPicturesLibrary(path, 7); // 7 pics horizontally on each row
            txtPicTable += "<br />";
            HTMLLink linkToZip = new HTMLLink("picfolderaszip?PATH=" + qsParams["PATH"], "Download All as Zip");
            txtPicTable += linkToZip.ToString();

            string txtOutput = FileCache.ReadSkinTextFile("page_viewlibrary.htm");
            txtOutput = txtOutput.Replace("**LIBRARYTABLE**", txtPicTable);

            // Commit to form
            txtResponse += txtOutput;

            return true;
        }
Пример #3
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);
        }