public static string Import(Models.WidgetManifest manifest, string userId = null) { userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId; var existing = GetWidgetManifest(manifest.FullName); manifest.Id = existing != null ? existing.Id : null; return(Save(manifest, userId)); }
public static bool IsDuplicate(Models.WidgetManifest manifest) { var m = GetWidgetManifest(manifest.FullName); if (m != null) { return(m.Id != manifest.Id); } return(false); }
public static string Save(Models.WidgetManifest manifest, string userId = null) { userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId; if (!IsDuplicate(manifest)) { var res = Repository.Current.StoreResource("WidgetManifest", null, manifest, userId); return(res.Id); } else { throw new Exception(string.Format(Localization.GetLocalization(LocalizationType.Exception, "DuplicateResource.Error", "{0} already exists. Duplicates Not Allowed.", "Core"), "Widget Manifest")); } }
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); } }
public static bool Exists(Models.WidgetManifest manifest) { var m = GetWidgetManifest(manifest.FullName); return(m != null); }