Esempio n. 1
0
        public dynamic addcomment(dynamic Data)
        {
            dynamic Result = new ExpandoObject();

            string Useraction = HttpContext.Current.Request.Form["Action"] != null ? HttpContext.Current.Request.Form["Action"] : Data.Action.ToString();
            string Comment    = HttpContext.Current.Request.Form["Action"] != null ? HttpContext.Current.Request.Form["Comment"] : Data.Comment.ToString();

            if (!string.IsNullOrEmpty(Useraction) && !string.IsNullOrEmpty(Comment))
            {
                WorkflowManager.AddComment(PortalSettings, Useraction, Comment);
            }

            Result.Data           = Managers.ModeratorManager.GetData(PortalSettings, 0);
            Result.NotifyCount    = NotificationManager.RenderNotificationsCount(PortalSettings.PortalId);
            Result.ReviewVariable = PageManager.GetPageReviewSettings(PortalSettings);
            return(Result);
        }
Esempio n. 2
0
            public static dynamic Update(PortalSettings PortalSettings, dynamic Data)
            {
                dynamic result = new ExpandoObject();

                try
                {
                    if (Data != null)
                    {
                        int   TabId       = PortalSettings.ActiveTab.TabID;
                        Pages page        = new Pages();
                        Pages pageVersion = GetLatestVersion(PortalSettings.ActiveTab.TabID, PortalSettings.UserInfo);

                        page.TabID       = TabId;
                        page.Style       = Data["gjs-css"].ToString();
                        page.Content     = ResetModuleMarkup(PortalSettings.PortalId, Data["gjs-html"].ToString(), PortalSettings.UserId);
                        page.ContentJSON = Data["gjs-components"].ToString();
                        page.StyleJSON   = Data["gjs-styles"].ToString();

                        if (Data["IsPublished"] != null && Convert.ToBoolean(Data["IsPublished"].ToString()) && (pageVersion != null && pageVersion.IsPublished))
                        {
                            page.IsPublished = true;
                            page.Version     = GetNextVersionByTabID(TabId);
                        }
                        else
                        {
                            page.IsPublished = Convert.ToBoolean(Data["IsPublished"].ToString());

                            if (pageVersion != null && pageVersion.IsPublished)
                            {
                                page.Version = GetNextVersionByTabID(TabId);
                            }
                            else if (pageVersion != null && !pageVersion.IsPublished)
                            {
                                page.Version = pageVersion.Version;
                            }
                            else
                            {
                                page.Version = GetNextVersionByTabID(TabId);
                            }
                        }

                        Pages SavedPage = GetByVersion(page.TabID, page.Version, GetCultureCode(PortalSettings));
                        if (SavedPage != null)
                        {
                            page.CreatedBy = SavedPage.CreatedBy;
                            page.CreatedOn = SavedPage.CreatedOn;
                            page.ID        = SavedPage.ID;
                            page.StateID   = SavedPage.StateID;
                        }
                        page.Locale = GetCultureCode(PortalSettings);
                        if (pageVersion != null && page.Version == pageVersion.Version)
                        {
                            page.StateID = pageVersion.StateID;
                        }

                        page.PortalID = PortalSettings.PortalId;
                        WorkflowManager.AddComment(PortalSettings, "publish", Data["Comment"].ToString(), page);

                        ReviewSettings ReviewSettings = GetPageReviewSettings(PortalSettings);
                        if (!string.IsNullOrEmpty(Data["Comment"].ToString()) || ReviewSettings.IsPageDraft)
                        {
                            result.ReviewToastMarkup  = GetReviewToastMarkup(PortalSettings);
                            result.PageReviewSettings = ReviewSettings;
                        }
                        result.NotifyCount = NotificationManager.RenderNotificationsCount(PortalSettings.PortalId);

                        try
                        {
                            if (page.IsPublished && Data != null && Data["m2v"] != null && Data["m2v"].Value)
                            {
                                PageManager.MigrateToVanjaro(PortalSettings);
                                result.RedirectAfterm2v = Common.Utilities.ServiceProvider.NavigationManager.NavigateURL(PortalSettings.ActiveTab.TabID);
                            }
                            else
                            {
                                result.RedirectAfterm2v = null;
                            }
                        }
                        catch { }
                    }
                }
                catch { }
                return(result);
            }