Ejemplo n.º 1
0
        public static void RenderWidgetEditor(this HtmlHelper helper, Models.WidgetManifest manifest)
        {
            //var manifest = Services.Portal.GetWidgetManifest(ManifestFullPath);
            helper.RegisterScript("~/scripts/widgets/videre.widgets.editor.base.js", true);

            var path = string.IsNullOrEmpty(manifest.EditorPath) ? "Widgets/Core/CommonEditor" : manifest.EditorPath;

            if (!HtmlExtensions.IsKeyRegistered(helper, path))
            {
                helper.RenderPartial(path, new Videre.Core.Models.WidgetEditor(manifest.Id)
                {
                    ClientId = Services.Portal.NextClientId()
                });
                HtmlExtensions.RegisterKey(helper, path);
            }
        }
Ejemplo n.º 2
0
        public static void RegisterControlPresenter(this HtmlHelper helper, Models.IClientControl model, string clientType, string instanceName, Dictionary <string, object> properties = null)
        {
            properties = properties == null ? new Dictionary <string, object>() : properties;
            RegisterCoreScripts(helper);

            if (!string.IsNullOrEmpty(model.ScriptPath))
            {
                HtmlExtensions.RegisterScript(helper, model.ScriptPath + clientType + ".js", true);
            }

            properties["id"] = model.ClientId;  //todo: not necessary now... same as ns?
            properties["ns"] = model.ClientId;

            //Properties["user"] = Services.Account.GetClientUser();
            //var ser = new System.Web.Script.Serialization.JavaScriptSerializer();   //no binders for date conversions...
            HtmlExtensions.RegisterDocumentReadyScript(helper, model.ClientId + "Presenter", string.Format("videre.widgets.register('{0}', {1}, {2});", model.ClientId, clientType, properties.ToJson(ignoreType: "client")));
        }
Ejemplo n.º 3
0
        public static void RegisterTheme(this HtmlHelper helper, Models.PageTemplate template)
        {
            var theme = Services.UI.PortalTheme;

            if (template != null && template.Layout != null && template.Layout.Theme != null)
            {
                theme = template.Layout.Theme;
            }
            if (template != null && template != null && template.Theme != null)
            {
                theme = template.Theme;
            }

            if (theme != null)
            {
                foreach (var file in theme.Files)
                {
                    if (file.Type == Models.ReferenceFileType.Css)
                    {
                        HtmlExtensions.RegisterStylesheet(helper, file.Path, true, new Dictionary <string, string>()
                        {
                            { "type", "theme" }
                        });
                    }
                    if (file.Type == Models.ReferenceFileType.Script)
                    {
                        HtmlExtensions.RegisterScript(helper, file.Path, true, new Dictionary <string, string>()
                        {
                            { "type", "theme" }
                        });
                    }
                }
            }
            else
            {
                HtmlExtensions.RegisterStylesheet(helper, "~/scripts/bootstrap-2.1.0/css/bootstrap.css", true, new Dictionary <string, string>()
                {
                    { "type", "theme" }
                });
            }
        }