/// <summary> /// Handles the loading and configuration of the control /// </summary> protected void Page_Load(object sender, EventArgs e) { if (Resource == null) { RedirectToInformation("editedobject.notexists"); return; } if (!SetUpPackageBuilder()) { return; } SetupUniGrids(); dataForm.SubmitButton.Visible = false; ModulePackageMetadata metadata = mPackageBuilder.GetModuleMetadata(); var formInfo = CreateFormInfo(); FillFormWithData(formInfo, metadata); SetUpFooterButton(metadata); }
/// <summary> /// Populates the form with data to be displayed /// </summary> /// <param name="formInfo">FormInfo that will be used in the form</param> /// <param name="metadata">Metadata of the package</param> private void FillFormWithData(FormInfo formInfo, ModulePackageMetadata metadata) { DataRow row = formInfo.GetDataRow(); row["moduleDisplayName"] = HTMLHelper.HTMLEncode(metadata.Title); row["moduleName"] = HTMLHelper.HTMLEncode(metadata.Id); row["moduleDescription"] = HTMLHelper.HTMLEncode(metadata.Description); row["moduleVersion"] = HTMLHelper.HTMLEncode(metadata.Version); row["moduleAuthor"] = HTMLHelper.HTMLEncode(metadata.Authors); dataForm.DataRow = row; dataForm.FormInformation = formInfo; dataForm.ReloadData(); }
/// <summary> /// Configures the footer button /// </summary> private void SetUpFooterButton(ModulePackageMetadata metadata) { var button = (CMSButton)FooterControl; button.Text = GetString("general.create"); button.ButtonStyle = ButtonStyle.Primary; string fullFilePath = GetPackageFilePath(metadata); if (File.Exists(fullFilePath)) { string errorMessage = ScriptHelper.GetString(String.Format(GetString("cms.modules.installpackage.exists"), fullFilePath)); button.OnClientClick = String.Format("if(!confirm({0})){{return false;}}", errorMessage); } button.Click += (sender, e) => MoveToNextStep(fullFilePath); }
/// <summary> /// Gets the path to the location of the package based on provided package <see cref="metadata"/>. /// </summary> /// <param name="metadata">Metadata of the package</param> private string GetPackageFilePath(ModulePackageMetadata metadata) { return(Path.EnsureBackslashes(Path.Combine(Path.Combine(ImportExportHelper.GetSiteUtilsFolder(), "Export"), String.Format("{0}_{1}.nupkg", metadata.Id, metadata.Version)))); }
/// <summary> /// Gets the path to the location of the package based on provided package <see cref="metadata"/>. /// </summary> /// <param name="metadata">Metadata of the package</param> private string GetPackageFilePath(ModulePackageMetadata metadata) { var packageName = String.Format("{0}.{1}.nupkg", metadata.Id, metadata.Version); return(Path.EnsureSlashes(Path.Combine(ImportExportHelper.GetSiteUtilsFolder(), "Export", packageName))); }
/// <summary> /// Gets the path to the location of the package based on provided package <see cref="metadata"/>. /// </summary> /// <param name="metadata">Metadata of the package</param> private string GetPackageFilePath(ModulePackageMetadata metadata) { return Path.EnsureBackslashes(Path.Combine(Path.Combine(ImportExportHelper.GetSiteUtilsFolder(), "Export"), String.Format("{0}_{1}.nupkg", metadata.Id, metadata.Version))); }
/// <summary> /// Populates the form with data to be displayed /// </summary> /// <param name="metadata">Metadata of the package</param> private void FillFormWithData(ModulePackageMetadata metadata) { ffModuleDisplayName.EditingControl.Value = HTMLHelper.HTMLEncode(metadata.Title); ffModuleName.EditingControl.Value = HTMLHelper.HTMLEncode(metadata.Id); ffModuleDescription.EditingControl.Value = HTMLHelper.HTMLEncode(metadata.Description); ffModuleAuthor.EditingControl.Value = HTMLHelper.HTMLEncode(metadata.Authors); ffModuleVersion.EditingControl.Value = HTMLHelper.HTMLEncode(metadata.Version); }