public void SaveManifest(DtgeManifest manifest) { dynamic manifestContent; if (string.IsNullOrEmpty(manifest.PackageManifest)) { manifestContent = JsonConvert.DeserializeObject <dynamic>(_defaultManifest); } else { manifestContent = JsonConvert.DeserializeObject <dynamic>(manifest.PackageManifest); } var gridEditor = manifestContent.gridEditors != null && manifestContent.gridEditors[0] != null ? manifestContent.gridEditors[0] : null; if (gridEditor == null) { return; } gridEditor.name = manifest.Name; gridEditor.alias = manifest.Alias; gridEditor.icon = manifest.Icon; gridEditor.config.allowedDocTypes = new JArray(manifest.AllowedDocTypes.ToArray()); gridEditor.config.enablePreview = manifest.EnablePreview; gridEditor.config.size = manifest.Size; gridEditor.config.showDocTypeSelectAsGrid = manifest.ShowDocTypeSelectAsGrid; if (!string.IsNullOrEmpty(manifest.ViewPath)) { gridEditor.config.viewPath = manifest.ViewPath; } if (!string.IsNullOrEmpty(manifest.PreviewViewPath)) { gridEditor.config.previewViewPath = manifest.PreviewViewPath; } var manifestJson = new JObject(); var gridEditors = new JArray(); gridEditors.Add(gridEditor); manifestJson["gridEditors"] = gridEditors; var dirPath = HttpContext.Current.Server.MapPath("~/App_Plugins/" + pluginPrefix + "." + manifest.Alias.ToFirstUpper()); var path = dirPath + "/package.manifest"; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } File.WriteAllText(path, JsonConvert.SerializeObject(manifestJson, Formatting.Indented)); }
public DtgeManifest GenerateManifest(string manifestString) { var manifestContent = JsonConvert.DeserializeObject <dynamic>(manifestString); var gridEditor = manifestContent.gridEditors != null && manifestContent.gridEditors[0] != null ? manifestContent.gridEditors[0] : null; if (gridEditor != null) { try { var manifest = new DtgeManifest(); manifest.Name = gridEditor.name; manifest.Alias = gridEditor.alias; manifest.Icon = gridEditor.icon; manifest.AllowedDocTypes = new List <string>(); foreach (var doctype in gridEditor.config.allowedDocTypes) { manifest.AllowedDocTypes.Add(doctype.ToString()); } manifest.EnablePreview = gridEditor.config.enablePreview; manifest.Size = ((string)gridEditor.config.size).IfNullOrWhiteSpace(gridEditor.config.largeDialog != null && gridEditor.config.largeDialog ? null : "small"); manifest.ShowDocTypeSelectAsGrid = gridEditor.config.showDocTypeSelectAsGrid; manifest.ViewPath = gridEditor.config.viewPath != "/Views/Partials/TypedGrid/Editors/" ? gridEditor.config.viewPath : ""; manifest.PreviewViewPath = gridEditor.config.previewViewPath != "/Views/Partials/TypedGrid/Editors/Previews/" ? gridEditor.config.previewViewPath : ""; manifest.PackageManifest = manifestString; manifest.PackageManifestJson = manifestContent; return(manifest); } catch (Exception e) { _logger.Error <ManifestRepository>(e); return(null); } } else { return(null); } }
public DtgeManifest GenerateManifest(string manifestString) { var manifestContent = JsonConvert.DeserializeObject <dynamic>(manifestString); var gridEditor = manifestContent.gridEditors != null && manifestContent.gridEditors[0] != null ? manifestContent.gridEditors[0] : null; if (gridEditor != null) { try { var manifest = new DtgeManifest(); manifest.Name = gridEditor.name; manifest.Alias = gridEditor.alias; manifest.Icon = gridEditor.icon; manifest.AllowedDocTypes = new List <string>(); foreach (var doctype in gridEditor.config.allowedDocTypes) { manifest.AllowedDocTypes.Add(doctype.ToString()); } manifest.EnablePreview = gridEditor.config.enablePreview; manifest.ViewPath = gridEditor.config.viewPath != "/Views/Partials/TypedGrid/Editors/" ? gridEditor.config.viewPath : ""; manifest.PreviewViewPath = gridEditor.config.previewViewPath != "/Views/Partials/TypedGrid/Editors/Previews/" ? gridEditor.config.previewViewPath : ""; manifest.PackageManifest = manifestString; manifest.PackageManifestJson = manifestContent; return(manifest); } catch (Exception e) { return(null); } } else { return(null); } }
public void SaveManifest(DtgeManifest manifest) { _manifestRepository.SaveManifest(manifest); }
public bool IsManifestLoaded(DtgeManifest manifest) { return(_gridConfig.EditorsConfig.Editors.Any(x => x.Alias == manifest.Alias)); }