示例#1
0
        protected void OnVersionsGridItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                HtmlTextInfo htmlContent;

                //disable delete button if user doesn't have delete rights???
                switch (e.CommandName.ToLower())
                {
                case "remove":
                    htmlContent = GetHTMLContent(e);
                    _htmlTextController.DeleteHtmlText(ModuleId, htmlContent.ItemID);
                    break;

                case "rollback":
                    htmlContent            = GetHTMLContent(e);
                    htmlContent.ItemID     = -1;
                    htmlContent.ModuleID   = ModuleId;
                    htmlContent.WorkflowID = WorkflowID;
                    htmlContent.StateID    = _workflowStateController.GetFirstWorkflowStateID(WorkflowID);
                    _htmlTextController.UpdateHtmlText(htmlContent, _htmlTextController.GetMaximumVersionHistory(PortalId));
                    break;

                case "preview":
                    htmlContent = GetHTMLContent(e);
                    DisplayPreview(htmlContent);
                    break;
                }

                if ((e.CommandName.ToLower() != "preview"))
                {
                    var latestContent = _htmlTextController.GetTopHtmlText(ModuleId, false, WorkflowID);
                    if (latestContent == null)
                    {
                        DisplayInitialContent(_workflowStateController.GetWorkflowStates(WorkflowID)[0] as WorkflowStateInfo);
                    }
                    else
                    {
                        DisplayContent(latestContent);
                        //DisplayPreview(latestContent);
                        //DisplayVersions();
                    }
                }

                //Module failed to load
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }