Ejemplo n.º 1
0
    /// <summary>
    /// Button make version major click.
    /// </summary>
    protected void btnMakeMajor_Click(object sender, EventArgs e)
    {
        if (Object != null)
        {
            // Check permissions
            if (CheckPermissions && !AllowModify)
            {
                ShowError(GetString("History.ErrorNotAllowedToModify"));
                return;
            }

            ObjectVersionHistoryInfo version = ObjectVersionManager.GetLatestVersion(Object.TypeInfo.ObjectType, Object.Generalized.ObjectID);
            if (version != null)
            {
                if (ObjectVersionManager.MakeVersionMajor(version))
                {
                    ShowConfirmation(GetString("objectversioning.makeversionmajorinfo"));
                }

                ReloadData();
            }
            else
            {
                ShowError(GetString("objectversioning.makeversionmajornoversion") + " " + GetString("objectversioning.objecthasnohistory"));
            }
        }
        else
        {
            UIContext.EditedObject = null;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Destroys latest version from history. Called when the "Destroy version" button is pressed.
    /// Expects the CreateVersionedObject method to be run first.
    /// </summary>
    private bool DestroyVersion()
    {
        // Get the css stylesheet
        CssStylesheetInfo stylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewVersionedStylesheet");

        if (stylesheet != null)
        {
            // Get the latest version
            ObjectVersionHistoryInfo version = ObjectVersionManager.GetLatestVersion(stylesheet.ObjectType, stylesheet.StylesheetID);

            if (version != null)
            {
                // Destroy the latest version
                ObjectVersionManager.DestroyObjectVersion(version.VersionID);

                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Button make version major click.
    /// </summary>
    protected void btnMakeMajor_Click(object sender, EventArgs e)
    {
        if (Object != null)
        {
            ObjectVersionHistoryInfo version = ObjectVersionManager.GetLatestVersion(Object.ObjectType, Object.ObjectID);
            if (version != null)
            {
                ObjectVersionManager.MakeVersionMajor(version);
                ReloadData();

                lblInfo.Text = GetString("objectversioning.makeversionmajorinfo");
            }
            else
            {
                lblError.Text = GetString("objectversioning.makeversionmajornoversion") + " " + GetString("objectversioning.objecthasnohistory");
            }

            plcLabels.Visible = true;
        }
        else
        {
            CMSPage.EditedObject = null;
        }
    }