Пример #1
0
        /// <summary>
        /// Outputs some navigation links to the page.
        /// </summary>
        /// <param name="controlCollection">the pages' controls</param>
        /// <param name="path">The path of the current image directory being browsed</param>
        /// <param name="url">The URL to use in the links</param>
        public static void RendenderLinkPath(System.Web.UI.ControlCollection controlCollection, string path, System.Web.UI.Control ctrl, ImageBrowserConfig cfg)
        {
            HyperLink h = null;
            Literal   l = null;

            DirectorySettingsHandler RootSettings = new DirectorySettingsHandler(cfg.PictureRootDirectory, "My Pictures");

            if (path != null && path.Length > 0)
            {
                path = path.Replace(@"\", "/");
            }
            else
            {
                h             = new HyperLink();
                h.NavigateUrl = "";
                h.Text        = RootSettings.DirectoryCaption;
                h.Attributes.Add("class", "LinkButton");
                controlCollection.Add(h);
                return;
            }

            string[] paths = path.Split('/');

            paths[0] = RootSettings.DirectoryCaption;

            for (int i = 1; i <= paths.Length; i++)
            {
                DirectorySettingsHandler DirSetting = new DirectorySettingsHandler(
                    cfg.PictureRootDirectory + "\\" + string.Join("\\", paths, 0, i).Replace(RootSettings.DirectoryCaption, ""), paths[i - 1]);
                if (i < paths.Length)
                {
                    h             = new HyperLink();
                    h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + string.Join("/", paths, 0, i).Replace(RootSettings.DirectoryCaption, "") + ";0");
                    h.Text        = DirSetting.DirectoryCaption;
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);

                    l      = new Literal();
                    l.Text = " &raquo; \n";
                    controlCollection.Add(l);
                }
                else
                {
                    h             = new HyperLink();
                    h.NavigateUrl = "";
                    h.Text        = DirSetting.DirectoryCaption;
                    h.Attributes.Add("class", "LinkButton");
                    controlCollection.Add(h);
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Gets a new Image Wrapper
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 public ImageWrapper GetImageWrapper(string file, DirectorySettingsHandler dirSettingsHandler)
 {
   return new ImageWrapper(file, this, dirSettingsHandler);
 }
Пример #3
0
 /// <summary>
 /// Gets a new Image Wrapper
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 public ImageWrapper GetImageWrapper(string file, DirectorySettingsHandler dirSettingsHandler)
 {
     return(new ImageWrapper(file, this, dirSettingsHandler));
 }
Пример #4
0
		/// <summary>
		/// Outputs some navigation links to the page.
		/// </summary>
		/// <param name="controlCollection">the pages' controls</param>
		/// <param name="path">The path of the current image directory being browsed</param>
		/// <param name="url">The URL to use in the links</param>
		public static void RendenderLinkPath(System.Web.UI.ControlCollection controlCollection, string path, System.Web.UI.Control ctrl, ImageBrowserConfig cfg)
		{

			HyperLink h = null;
			Literal l = null;

      DirectorySettingsHandler RootSettings = new DirectorySettingsHandler(cfg.PictureRootDirectory, "My Pictures");

			if ( path != null && path.Length > 0 )
				path = path.Replace(@"\","/");
			else
			{
				h = new HyperLink();
				h.NavigateUrl = "";
				h.Text = RootSettings.DirectoryCaption;
				h.Attributes.Add("class","LinkButton");
				controlCollection.Add(h);
				return;
			}

			string[] paths = path.Split('/');

			paths[0] = RootSettings.DirectoryCaption;

			for ( int i = 1; i <= paths.Length; i++ )
			{
        DirectorySettingsHandler DirSetting = new DirectorySettingsHandler(
          cfg.PictureRootDirectory + "\\" + string.Join("\\",paths,0,i).Replace(RootSettings.DirectoryCaption,""), paths[i-1]);
        if ( i < paths.Length )
				{
					h = new HyperLink();
					h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + string.Join("/",paths,0,i).Replace(RootSettings.DirectoryCaption,"") + ";0");
					h.Text = DirSetting.DirectoryCaption;
					h.Attributes.Add("class","LinkButton");
					controlCollection.Add(h);

					l = new Literal();
					l.Text = " &raquo; \n";
					controlCollection.Add(l);
				}
				else
				{
					h = new HyperLink();
					h.NavigateUrl = "";
					h.Text = DirSetting.DirectoryCaption;
					h.Attributes.Add("class","LinkButton");
					controlCollection.Add(h);
				}
			}
		}