示例#1
0
    /// <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);
    }
示例#2
0
    /// <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();
    }
示例#3
0
    /// <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);
    }
示例#4
0
 /// <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))));
 }
示例#5
0
    /// <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>
    /// 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>
 /// 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);
 }