@*   Xafari Framework version : 17.2.3011.1336   *@

@using System.Drawing
@using System.Web.UI.WebControls
@using DevExpress.ExpressApp.Utils
@using DevExpress.Persistent.Base.General

@model Xafari.BC.Mvc.Editors.MvcExplorerListEditor

@Html.DevExpress().Menu(settings =>
{
	settings.Name = "PathControl";
	settings.AutoSeparators = AutoSeparatorMode.RootOnly;
	settings.Orientation = Orientation.Horizontal;
	//menu.SkinID = "MenuLinks";

	//Skin
	settings.Styles.CssFilePath = "{0}/styles.css";
	settings.ControlStyle.ItemSpacing = Unit.Pixel(0);
	settings.ShowPopOutImages = DefaultBoolean.True;
	settings.Styles.CssPostfix = DevExpressHelper.Theme;
	settings.ControlStyle.SeparatorHeight = Unit.Percentage(100);
	settings.Images.SpriteCssFilePath = "{0}/sprite.css";
	settings.ControlStyle.SeparatorWidth = Unit.Pixel(11);
	settings.ControlStyle.SeparatorColor = Color.Transparent;
	settings.ControlStyle.CssClass = "menuLinks_" + DevExpressHelper.Theme;
	settings.Style.Add("margin-bottom", "5px");


	var imageInfo = ImageLoader.Instance.GetImageInfo("Separator");
	if (!imageInfo.IsEmpty)
	{
		settings.ControlStyle.SeparatorBackgroundImage.ImageUrl = "/" + imageInfo.ImageUrl;
		settings.ControlStyle.SeparatorBackgroundImage.Repeat = BackgroundImageRepeat.NoRepeat;
	}

	settings.Items.Add(item =>
	{
		item.Name = "Root";
		item.Text = CaptionHelper.GetLocalizedText("Texts", "RootObjectCaption", "Root");
		item.ToolTip = string.Format("{0} '{1}'", CaptionHelper.GetLocalizedText("Texts", "OpenFolderActionCaption", "Open folder"), item.Text);
		var rootImageInfo = ImageLoader.Instance.GetImageInfo("OpenRootFolder");
		if (!rootImageInfo.IsEmpty)
		{
			item.Image.Url = rootImageInfo.ImageUrl;
		}
		item.NavigateUrl = string.Format("javascript: xafari.editors.explorerListEditor.openFolderClick('{0}', '{1}','{2}')", this.Model.CallbackPanelId, string.Empty, this.ViewData.Frame().ControlId(this.Model.ControlId));

	});
	var obj = this.Model.CurrentNode ?? this.Model.RootValue;
	while (obj != this.Model.RootValue)
	{
		if (obj == null) break;
		var obj1 = obj;

		var item = new MVCxMenuItem();	
		var id = this.Model.GetKeyObjectAsString(obj1);
		item.Name = string.Format("n{0}", id ?? "");
		if (obj1 != null)
		{
			var name = this.Model.GetName(obj1);
			item.Text = string.IsNullOrWhiteSpace(name) ? "-" : name;
			item.ToolTip = string.Format("{0} '{1}'", CaptionHelper.GetLocalizedText("Texts", "OpenFolderActionCaption", "Open folder"), item.Text);
			var nodeImage = obj1 as ITreeNodeImageProvider;
			if (nodeImage != null)
			{
				var pathImageInfo = ImageLoader.Instance.GetImageInfo("OpenRootFolder");
				if (!pathImageInfo.IsEmpty)
				{
					item.Image.Url = pathImageInfo.ImageUrl;
				}
			}
		}
		item.NavigateUrl = string.Format("javascript: xafari.editors.explorerListEditor.openFolderClick('{0}', '{1}','{2}')", this.Model.CallbackPanelId, this.Model.GetKeyValue(obj), this.ViewData.Frame().ControlId(this.Model.ControlId));
		settings.Items.Insert(1, item);
		
		obj = this.Model.GetParent(obj, this.Model.CurrentHierarchyName);
	}
}).GetHtml()
			

