Пример #1
0
		protected virtual HyperLink AddAnchor(Control container, PluginContext context)
		{
			string tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
			string title = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;
			string alternative = Utility.GetResourceString(GlobalResourceClassName, Name + ".AlternativeText") ?? AlternativeText;

			HyperLink a = new HyperLink();
			a.ID = "h" + Name;
			a.NavigateUrl = context.Rebase(context.Format(UrlFormat, true));
			a.SkinID = "ToolBarLink_" + Name;

			a.Target = Target;
			a.Attributes["class"] = Name + " " + RequiredPermission.ToString() + (string.IsNullOrEmpty(IconUrl) ? "" : " iconed");				
			if (UrlFormat.Contains("{"))
			{
				a.Attributes["class"] += " templatedurl";
				a.Attributes["data-url-template"] = context.Rebase(UrlFormat);
			}
			a.ToolTip = tooltip;
			a.Text = title;
			ApplyStyles(context, a);

			container.Controls.Add(a);
			return a;
		}
Пример #2
0
        protected virtual HyperLink AddAnchor(Control container, PluginContext context)
        {
            string tooltip     = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
            string title       = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;
            string alternative = Utility.GetResourceString(GlobalResourceClassName, Name + ".AlternativeText") ?? AlternativeText;

            HyperLink a = new HyperLink();

            a.ID          = "h" + Name;
            a.NavigateUrl = context.Rebase(context.Format(UrlFormat, true));
            a.SkinID      = "ToolBarLink_" + Name;

            a.Target = Target;
            a.Attributes["class"] = Name + " " + RequiredPermission.ToString() + (string.IsNullOrEmpty(IconUrl) ? "" : " iconed");
            if (UrlFormat.Contains("{"))
            {
                a.Attributes["class"]            += " templatedurl";
                a.Attributes["data-url-template"] = context.Rebase(UrlFormat);
            }
            a.ToolTip = tooltip;
            a.Text    = title;
            ApplyStyles(context, a);

            container.Controls.Add(a);
            return(a);
        }
        public override Control AddTo(Control container, PluginContext context)
        {
            var selector = context.Engine.Resolve<LanguageGatewaySelector>();
            if (!selector.Enabled || selector.LanguagesPerSite /*avoid showing options that might not be relevant */)
                return null;

            ILanguageGateway gateway = selector.GetAllLanguages();

            HtmlGenericControl div = new HtmlGenericControl("div");
            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "={selected}");

                HyperLink h = new HyperLink();
                h.ID = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass = "templatedurl language";
                h.ToolTip = language.LanguageTitle;
                h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                h.Attributes["data-url-template"] = context.Rebase(url);
                div.Controls.Add(h);
            }

            return div;
        }
Пример #4
0
        protected override N2.Web.Url GetNavigateUrl(PluginContext context)
        {
            if (!Engine.Config.Sections.Management.Legacy)
                return base.GetNavigateUrl(context);

            return context.Rebase(context.Format("{ManagementUrl}/Content/Default.aspx?{Selection.SelectedQueryKey}={Selected.Path}", UrlEncode));
        }
Пример #5
0
 protected virtual void ApplyStyles(PluginContext pluginContext, WebControl ctrl)
 {
     if (!string.IsNullOrEmpty(IconUrl))
     {
         ctrl.Style[HtmlTextWriterStyle.BackgroundImage] = pluginContext.Rebase(IconUrl);
     }
 }
        public override Control AddTo(Control container, PluginContext context)
        {
            ILanguageGateway gateway = N2.Context.Current.Resolve<ILanguageGateway>();
            if (!gateway.Enabled)
                return null;

            HtmlGenericControl div = new HtmlGenericControl("div");
            div.Attributes["class"] = "languages";
            container.Controls.Add(div);

            base.AddTo(div, context);

            foreach (ILanguage language in gateway.GetAvailableLanguages())
            {
                Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
                url = url.AppendQuery("language", language.LanguageCode);
                url = url.AppendQuery("selected={selected}");

                HyperLink h = new HyperLink();
                h.ID = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
                h.Target = Targets.Preview;
                h.NavigateUrl = context.Rebase(context.Format(url, true));
                h.CssClass = "language";
                h.ToolTip = language.LanguageTitle;
                h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
                div.Controls.Add(h);

                RegisterToolbarUrl(container, h.ClientID, url);
            }

            return div;
        }
		protected virtual Url GetNavigateUrl(PluginContext context)
		{
			Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));
			if (!string.IsNullOrEmpty(NavigateQuery))
				url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
			return url;
		}
Пример #8
0
        public override Control AddTo(Control container, PluginContext context)
        {
            if (RequireCurrentItem && context.Selected == null)
            {
                return(null);
            }
            if (!ActiveFor(container, context.State))
            {
                return(null);
            }

            HyperLink link    = new HyperLink();
            string    tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
            string    title   = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;

            link.Text = GetInnerHtml(context, IconUrl, tooltip, title);
            Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));

            if (!string.IsNullOrEmpty(NavigateQuery))
            {
                url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
            }
            link.NavigateUrl = url;
            link.ToolTip     = context.Format(tooltip, false);
            link.CssClass    = Name + " authorized" + context.Engine.SecurityManager.IsAuthorized(this, context.HttpContext.User, context.Selected);

            AddTargetAttribute(link);

            container.Controls.Add(link);

            return(link);
        }
        public override Control AddTo(Control container, PluginContext context)
        {
            Control c = container.Page.LoadControl(context.Rebase(userControlUrl));

            container.Controls.Add(c);
            return(c);
        }
Пример #10
0
 protected string GetInnerHtml(PluginContext pluginContext, string iconUrl, string alt, string text)
 {
     if (string.IsNullOrEmpty(iconUrl))
     {
         return(text);
     }
     return(string.Format("<img src='{0}' alt='{1}'/>{2}", pluginContext.Rebase(iconUrl), alt, text));
 }
		protected string GetInnerHtml(PluginContext pluginContext, string iconUrl, string alt, string text)
		{
			if (!string.IsNullOrEmpty(IconClass))
				return string.Format("<b class='{0}'></b> {1}", IconClass, text);
			if (string.IsNullOrEmpty(iconUrl))
				return text;
			return string.Format("<img src='{0}' alt='{1}'/>{2}", pluginContext.Rebase(iconUrl), alt, text);
		}
Пример #12
0
        public override Control AddTo(Control container, PluginContext context)
        {
            HyperLink a = AddAnchor(container, context);

            RegisterToolbarUrl(container, a.ClientID, context.Rebase(UrlFormat));

            return(a);
        }
Пример #13
0
        public override Control AddTo(Control container, PluginContext context)
        {
            HyperLink a = AddAnchor(container, context);

            RegisterToolbarUrl(container, a.ClientID, context.Rebase(UrlFormat));

            return a;
        }
Пример #14
0
        protected override N2.Web.Url GetNavigateUrl(PluginContext context)
        {
            if (!Engine.Config.Sections.Management.Legacy)
            {
                return(base.GetNavigateUrl(context));
            }

            return(context.Rebase(context.Format("{ManagementUrl}/Content/Default.aspx?{Selection.SelectedQueryKey}={Selected.Path}", UrlEncode)));
        }
Пример #15
0
        protected virtual Url GetNavigateUrl(PluginContext context)
        {
            Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));

            if (!string.IsNullOrEmpty(NavigateQuery))
            {
                url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
            }
            return(url);
        }
Пример #16
0
		public override Control AddTo(Control container, PluginContext context)
		{
			if(RequireCurrentItem && context.Selected == null)
				return null;
			if(!ActiveFor(container, context.State))
				return null;

			HyperLink link = new HyperLink();
			string tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
			string title = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;
			link.Text = GetInnerHtml(context, IconUrl, tooltip, title);
			Url url = context.Rebase(context.Format(NavigateUrl, UrlEncode));
			if (!string.IsNullOrEmpty(NavigateQuery))
				url = url.AppendQuery(context.Format(NavigateQuery, UrlEncode));
			link.NavigateUrl = url;
			link.ToolTip = context.Format(tooltip, false);
			link.CssClass = Name + " authorized" + context.Engine.SecurityManager.IsAuthorized(this, context.HttpContext.User, context.Selected) + " " + CssClass;
			
			AddTargetAttribute(link);

			container.Controls.Add(link);

			return link;
		}
Пример #17
0
        protected virtual HyperLink AddAnchor(Control container, PluginContext context)
        {
            string tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
            string title = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;
            string alternative = Utility.GetResourceString(GlobalResourceClassName, Name + ".AlternativeText") ?? AlternativeText;

            HyperLink a = new HyperLink();
            a.ID = "h" + Name;
            a.NavigateUrl = context.Rebase(context.Format(UrlFormat, true));
            a.SkinID = "ToolBarLink_" + Name;

            a.Target = Target;
            a.Attributes["class"] = Name;
            a.Text = tooltip;
            a.ToolTip = tooltip;
            a.Text = title;
            ApplyStyles(context, a);

            container.Controls.Add(a);
            return a;
        }
		protected virtual void ApplyStyles(PluginContext pluginContext, WebControl ctrl)
		{
			if (!string.IsNullOrEmpty(IconUrl))
				ctrl.Style[HtmlTextWriterStyle.BackgroundImage] = pluginContext.Rebase(IconUrl);
		}
		public override Control AddTo(Control container, PluginContext context)
		{
			Control c = container.Page.LoadControl(context.Rebase(userControlUrl));
			container.Controls.Add(c);
			return c;
		}