//------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageTag"/> class.
        /// </summary>
        /// <param name="mode">The mode.</param>
        /// <param name="vpath">The vpath.</param>
        //------------------------------------------------------------------------------------------------------------------------
        public ImageTag(AlbumHandlerMode mode, VirtualPath vpath)
        {
            string p = vpath.Encode();

            Src = $"?mode={mode}&path={p}";
            string p2 = Path.GetFileName(p);

            switch (mode)
            {
            case AlbumHandlerMode.ThumbnailImage:
                Link    = vpath.IsRoot ? "?" : $"?path={p}";
                _width  = Album.ThumbnailSize;
                _height = Album.ThumbnailSize;
                Alt     = $"Click to see an enlarged view of &quot;{HttpUtility.UrlDecode(p2)}&quot;";
                break;

            case AlbumHandlerMode.ParentThumbnailImage:
                Link    = vpath.IsRoot ? "?" : $"?path={p}";
                _width  = Album.ThumbnailSize;
                _height = Album.ThumbnailSize;
                Alt     = "Click to go back to the folder view";
                break;

            case AlbumHandlerMode.PreviewImage:
                //if (!vpath.IsRoot)
                //	_link = p;
                //else
                // _link = @"sokool.net" + p;

                string temp = HostingEnvironment.MapPath(vpath.Value);
                if (temp != null && !temp.ToLower().Contains("sokool.net"))
                {
                    Link = @"/sokool.net" + p;
                }
                else
                {
                    Link = p;
                }

                Picture.GetPicture(vpath.PhysicalPath).CalcResizedDims(Album.PreviewSize, out _width, out _height);
                Alt = p;
                // Get the File Explorer property value for 'Comments'.
                Comments = HttpUtility.HtmlEncode(GetExplorerProperty(vpath.PhysicalPath, FileExplorerProperty.Comments));
                break;

            case AlbumHandlerMode.Default:
                break;

            default:
                throw new HttpException("invalid link mode");
            }
        }
Beispiel #2
0
 void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
 {
     Page.ClientScript.ValidateEvent(UniqueID, eventArgument);
     char command = eventArgument[0];
     string arg = eventArgument.Substring(1);
     switch (command)
     {
         case FolderCommand:
             _mode = AlbumHandlerMode.Folder;
             Path = arg;
             break;
         case PageCommand:
             _mode = AlbumHandlerMode.Page;
             Path = arg;
             break;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Parses the parameters.
        /// </summary>
        /// <param name="paramsCollection">The parameter collection to parse from.</param>
        void ParseParams(NameValueCollection paramsCollection)
        {
            string s;

            s = paramsCollection["albummode"];

            if (s != null)
            {
                try
                {
                    _mode = (AlbumHandlerMode)Enum.Parse(typeof(AlbumHandlerMode), s, true);
                }
                catch
                {
                }

                if (_mode == AlbumHandlerMode.Unknown)
                {
                    ReportError("invalid mode");
                }
            }
            else
            {
                _mode = AlbumHandlerMode.Folder;
            }

            s = paramsCollection["albumpath"];

            Path = s;
        }