Exemplo n.º 1
0
		protected override void OnPreRender(EventArgs e)
		{
			using (new DNNContext(this))
			{
				try
				{
					base.OnPreRender(e);

					var menuStyle = GetStringSetting("MenuStyle");
					if (String.IsNullOrEmpty(menuStyle))
					{
						menu = null;
						return;
					}

					var menuSettings = new Settings
					                   {
					                   	MenuStyle = GetStringSetting("MenuStyle"),
					                   	NodeXmlPath = GetStringSetting("NodeXmlPath"),
					                   	NodeSelector = GetStringSetting("NodeSelector"),
					                   	IncludeContext = GetBoolSetting("IncludeContext"),
										IncludeHidden = GetBoolSetting("IncludeHidden"),
										IncludeNodes = GetStringSetting("IncludeNodes"),
					                   	ExcludeNodes = GetStringSetting("ExcludeNodes"),
					                   	NodeManipulator = GetStringSetting("NodeManipulator"),
					                   	TemplateArguments =
					                   		DDRMenu.Settings.TemplateArgumentsFromSettingString(GetStringSetting("TemplateArguments")),
					                   	ClientOptions =
					                   		DDRMenu.Settings.ClientOptionsFromSettingString(GetStringSetting("ClientOptions"))
					                   };

					MenuNode rootNode = null;
					if (String.IsNullOrEmpty(menuSettings.NodeXmlPath))
					{
						rootNode =
							new MenuNode(
								Localiser.LocaliseDNNNodeCollection(
									Navigation.GetNavigationNodes(
										ClientID,
										Navigation.ToolTipSource.None,
										-1,
										-1,
										DNNAbstract.GetNavNodeOptions(menuSettings.IncludeHidden))));
					}

					menu = MenuBase.Instantiate(menuStyle);
					menu.RootNode = rootNode;
					menu.ApplySettings(menuSettings);

					menu.PreRender();
				}
				catch (Exception exc)
				{
					Exceptions.ProcessModuleLoadException(this, exc);
				}
			}
		}
Exemplo n.º 2
0
		public string ExportModule(int moduleId)
		{
            var module = ModuleController.Instance.GetModule(moduleId, Null.NullInteger, true);
			var moduleSettings = module.ModuleSettings;

			var settings = new Settings
			               {
			               	MenuStyle = moduleSettings["MenuStyle"].ToString(),
			               	NodeXmlPath = moduleSettings["NodeXmlPath"].ToString(),
			               	NodeSelector = moduleSettings["NodeSelector"].ToString(),
			               	IncludeNodes = moduleSettings["IncludeNodes"].ToString(),
			               	ExcludeNodes = moduleSettings["ExcludeNodes"].ToString(),
			               	NodeManipulator = moduleSettings["NodeManipulator"].ToString(),
			               	IncludeContext = Convert.ToBoolean(moduleSettings["IncludeContext"]),
			               	IncludeHidden = Convert.ToBoolean(moduleSettings["IncludeHidden"]),
			               	ClientOptions = Settings.ClientOptionsFromSettingString(moduleSettings["ClientOptions"].ToString()),
			               	TemplateArguments =
			               		Settings.TemplateArgumentsFromSettingString(moduleSettings["TemplateArguments"].ToString())
			               };
			return settings.ToXml();
		}
Exemplo n.º 3
0
		internal void ApplySettings(Settings settings)
		{
			menuSettings = settings;
		}