Exemplo n.º 1
0
        public string SaveModuleContent(string id, string content, string languageCode, string pageid, string newsletterid)
        {
            BaseService.CheckLoginAndLicense();

            BaseModule module = BaseModule.GetById <BaseModule>(new Guid(id));

            module = module.ConvertToType();

            module.Content = content;
            module.Save();

            module.LanguageCode = languageCode;
            CmsPage page = null;

            if (pageid != null && pageid != "")
            {
                page = BaseObject.GetById <CmsPage>(Guid.Parse(pageid));
            }
            else if (newsletterid != null && newsletterid != "")
            {
                page = BaseObject.GetById <Newsletter>(Guid.Parse(newsletterid));
            }

            return(module.Publish2(page));
        }
Exemplo n.º 2
0
        public BaseModule GetModule(string id)
        {
            BaseService.CheckLoginAndLicense();
            id = id.Replace("bitModule", "");
            id = id.Replace("bitEditor", "");
            BaseModule mod = BaseModule.GetById <BaseModule>(new Guid(id));

            if (mod.HasBitplateAutorisation())
            {
                if (!mod.IsAutorized(SessionObject.CurrentBitplateUser))
                {
                    throw new Exception("U heeft geen rechten voor deze module");
                }
            }
            mod = mod.ConvertToType();
            //if (mod.SelectGroup != null && mod.SelectGroup != "")
            //{
            //    DataGroup dataGroup = BaseObject.GetById<DataGroup>(Guid.Parse(mod.SelectGroup));
            //    if (dataGroup != null)
            //    {
            //        mod.SelectGroupPath = dataGroup.DataCollection.Name + "/" + dataGroup.GetCompletePath(); //FindDataGroupBasePath(Guid.Parse(mod.SelectGroup));
            //    }
            //}
            return(mod);
        }
Exemplo n.º 3
0
        public static string SaveModuleContent(string id, string content)
        {
            BaseService.CheckLoginAndLicense();
            id = id.Replace("bitModule", "");
            id = id.Replace("bitEditor", "");
            BaseModule module = BaseModule.GetById <BaseModule>(new Guid(id));

            module = module.ConvertToType();
            //module.LoadPropsFromXmlFile();
            content        = content.Replace("?mode=edit", ""); //BUG WORKAROUND. BUG ZIT MOGELIJK NOG IN DE EDITOR.
            module.Content = content;
            module.Save();

            module.Publish();

            //Experimenteel caching reset
            //if (module.Page != null)
            //{
            //    BitCaching.RemoveItemFromCache(module.Page.ID.ToString());
            //}

            if (module.Type == "HtmlModule")
            {
                PublishModule(module);
            }
            return(new ModuleService().GetUserControlContent(module));
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pageid"] != null)
            {
                PageID = Request.QueryString["pageid"];
            }
            CmsPage page = BaseObject.GetById <CmsPage>(new Guid(PageID));

            if (page == null)
            {
                throw new Exception("Geen pagina geladen met id: " + PageID);
            }

            //je kunt niet zien of een pagina in editmode zit, want zit in iframe
            //hierom kijken we of er een bitplateuser is ingelogd.
            //zo ja, dan wordt er geen check gedaan op site-autorisatie en of de pagina actief is.
            bool allowEdit = (SessionObject.CurrentBitplateUser != null);

            if (allowEdit)
            {
                if (!CheckBitplateAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten om deze pagina te bewerken.");
                }
            }
            else
            {
                if (!CheckIfActive(page))
                {
                    throw new Exception("Deze pagina is momenteel niet actief.");
                }

                if (!CheckSiteAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten op deze pagina.");
                }
            }

            if (Request.Form["hiddenModuleType"] != null)
            {
                string          moduleType     = Request.Form["hiddenModuleType"].ToString();
                string          id             = Request.Form["hiddenModuleID"].ToString();
                BaseModule      module         = BaseObject.GetById <BaseModule>(new Guid(id));
                IPostableModule postableModule = module.ConvertToType() as IPostableModule;
                postableModule.HandlePost(Request.Form);
            }

            string pageHtml = page.Publish2();

            Response.Write(pageHtml);
        }
Exemplo n.º 5
0
        public string DoSort(string pageid, string moduleid, string column, SortDirectionEnum sortDirection, int pageNumber, int totalResults, Dictionary <string, object> parameters)
        {
            BaseModule module = BaseModule.GetById <BaseModule>(new Guid(moduleid));

            if (module == null)
            {
                return("");
            }
            ISortable pageableModule = module.ConvertToType() as ISortable;

            if (pageableModule == null)
            {
                return("");
            }
            CmsPage page = BaseObject.GetById <CmsPage>(Guid.Parse(pageid));

            return(pageableModule.DoSort(page, column, sortDirection, pageNumber, totalResults, parameters));
        }
Exemplo n.º 6
0
        public string ReloadModule(string pageid, string id, Dictionary <string, object> parameters)
        {
            BaseModule module = BaseModule.GetById <BaseModule>(new Guid(id));

            if (module == null)
            {
                return("");
            }
            IRefreshableModule refreshableModule = module.ConvertToType() as IRefreshableModule;

            if (refreshableModule == null)
            {
                return("");
            }
            CmsPage page = BaseObject.GetById <CmsPage>(Guid.Parse(pageid));

            return(refreshableModule.Reload(page, parameters));
        }
Exemplo n.º 7
0
        public string GetModuleContent(string id, string mode)
        {
            BaseService.CheckLoginAndLicense();
            string returnValue = "";

            //id = id.Replace("bitModule", "");
            id = id.Replace("bitModule", "").Replace("_", "-");

            BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(id));

            module = module.ConvertToType();
            if (mode == "edit")
            {
                returnValue = module.Content;
                Uri    uri           = System.Web.HttpContext.Current.Request.UrlReferrer;
                string currentDomain = uri.GetLeftPart(UriPartial.Authority);
                if (SessionObject.CurrentSite.DomainName != currentDomain)
                {
                    returnValue = HtmlHelper.ReplaceImageSources(returnValue, ModeEnum.Edit, SessionObject.CurrentSite);
                }
                if (module.HasBitplateAutorisation())
                {
                    //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
                    //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(module.ID);
                    //module.AutorizedBitplateUserGroups = usergroups;

                    //BitplateUser[] users = client.GetUsersByObjectPermission(module.ID);
                    //module.AutorizedBitplateUsers = users;
                    if (!module.IsAutorized(SessionObject.CurrentBitplateUser))
                    {
                        throw new Exception("U heeft geen rechten voor deze module");
                    }
                }
            }
            else
            {
                //module.LoadPropsFromXmlFile();
                //returnValue = new ModuleService().GetUserControlContent(module);
            }


            return(returnValue);
        }
Exemplo n.º 8
0
        public Dictionary <string, object> GetTags(string id)
        {
            BaseService.CheckLoginAndLicense();
            List <string> tagArray  = new List <string>();
            string        tagString = "Dubbelklik op een tag om het op de plaats van de cursor te zetten<br/>";

            id = id.Replace("bitModule", "");
            id = id.Replace("bitEditor", "");
            //id = id.Replace("Template", "");
            if (id.Contains("Template"))
            {
                tagString += "<br/>";
                tagString += "<strong>Body-tags:</strong> (Deze tags kunnen genummerd worden.<br />Bijvoorbeeld: [CONTENT1], [CONTENT2], [CONTENT...)<br/>";
                tagString += "<div class='tagToInsert'>[CONTENT]</div>";
                tagArray.Add("[CONTENT]");

                tagString += "<div class='tagToInsert'>[TOP]</div>";
                tagArray.Add("[TOP]");
                tagString += "<div class='tagToInsert'>[LEFT]</div>";
                tagArray.Add("[LEFT]");
                tagString += "<div class='tagToInsert'>[CENTER]</div>";
                tagArray.Add("[CENTER]");
                tagString += "<div class='tagToInsert'>[RIGHT]</div>";
                tagArray.Add("[RIGHT]");
                tagString += "<div class='tagToInsert'>[BOTTOM]</div>";
                tagArray.Add("[BOTTOM]");
                tagString += "<br/>";
                tagString += "<strong>Head-tags:</strong><br/>";
                tagString += "<div class='tagToInsert'>[PAGETITLE]</div>";
                tagArray.Add("[PAGETITLE]");
                tagString += "<div class='tagToInsert'>[SCRIPTS]</div>";
                tagArray.Add("[SCRIPTS]");
                tagString += "<div class='tagToInsert'>[HEAD]</div>";
                tagArray.Add("[HEAD]");
                //returnValue += "<div class='tagToInsert'>[METADESCRIPTION]</div>";
                //returnValue += "<div class='tagToInsert'>[METAKEYWORDS]</div>";
            }
            else if (id != "")
            {
                //TemplateModule module = (TemplateModule)BaseDomainObject.GetById<TemplateModule>(new Guid(id));
                BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(id));
                module = module.ConvertToType();
                List <Tag> tags = module.GetAllTags();
                tags = tags.OrderBy(c => c.Name).ToList();

                foreach (Tag tag in tags) //ModeEnum.EditPageMode))
                {
                    if (tag.HasCloseTag)
                    {
                        tagString += String.Format("<div class='tagToInsert'>{0}</div>", tag.Name + tag.CloseTag);
                        tagArray.Add(tag.Name + tag.CloseTag);
                    }
                    else
                    {
                        tagString += String.Format("<div class='tagToInsert'>{0}</div>", tag.Name);
                        tagArray.Add(tag.Name);

                        if (tag.AllowFormats && tag.SampleFormats != null)
                        {
                            foreach (string sampleFormat in tag.SampleFormats)
                            {
                                string tagWithFormat = tag.Name.Replace("}", ":" + sampleFormat + "}");
                                tagString += String.Format("<div class='tagToInsert'>{0}</div>", tagWithFormat);
                                tagArray.Add(tagWithFormat);
                            }
                        }

                        //if (tag.AllowFormats && tag.AvailableArguments != null)
                        //{
                        //    foreach (string argument in tag.AvailableArguments)
                        //    {
                        //        string tagWithFormat = tag.Name.Replace("}", ":" + argument + "}");
                        //        tagString += String.Format("<div class='tagToInsert'>{0}</div>", tagWithFormat);
                        //        tagArray.Add(tagWithFormat);
                        //    }

                        //}
                    }
                }
                if (tags.Count == 0)
                {
                    tagString = "Deze module kent geen tags";
                }
            }
            Dictionary <string, object> returnvalue = new Dictionary <string, object>();

            returnvalue.Add("CKTags", tagString);
            returnvalue.Add("CMTags", tagArray.ToArray());
            return(returnvalue);
        }
Exemplo n.º 9
0
        public string SaveModule(BaseModule module, string pageid, string newsletterid, string languageCode)
        {
            BaseService.CheckLoginAndLicense();
            module.Site = SessionObject.CurrentSite;
            CmsPage    page       = (pageid != null && pageid != "") ? BaseObject.GetById <CmsPage>(new Guid(pageid)) : null;
            Newsletter newsletter = (newsletterid != null && newsletterid != "") ? BaseObject.GetById <Newsletter>(new Guid(newsletterid)) : null;

            if (module.CrossPagesMode == CrossPagesModeEnum.VisibleOnAllPages)
            {
                module.Template = null;
                //module.Pages = SessionObject.CurrentSite.Pages;
                //module.Page = null;
            }
            else if (module.CrossPagesMode == CrossPagesModeEnum.VisibleOnAllPagesInTemplate)
            {
                if (pageid != null && pageid != "")
                {
                    module.Template = page.Template;
                }
                else
                {
                    module.Template = newsletter.Template;
                }
            }
            else
            {
                if (pageid != null && pageid != "")
                {
                    //if (!module.hasReferenceToPage(Guid.Parse(pageid)))
                    //{
                    //    CmsPage page = BaseObject.GetById<CmsPage>(new Guid(pageid));
                    //    module.Pages.Add(page);
                    //}
                    //module.Page = new CmsPage();
                    //module.Page.ID = new Guid(pageid);
                }
                else
                {
                    module.Newsletter    = new Newsletter();
                    module.Newsletter.ID = new Guid(newsletterid);
                }
            }
            module.Save();
            //SetUnpublishedItem(module);
            module = module.ConvertToType();

            //lijst van ObjectPermissions wordt hier alleen als drager gebruikt.
            //in de licentieserver wordt deze lijst weer gesplitst en in 2 tabellen gezet
            //BaseCollection<ObjectPermission> objPermissions = module.GetObjectPermissions4LicenseServer();
            //if (objPermissions.Count > 0)
            //{
            //    BitAutorisationService.AutorisationClient client = BitMetaServerServicesHelper.GetClient();
            //    client.SaveObjectPermissions(objPermissions);
            //}

            module.LanguageCode = languageCode;
            //Where needs the module to be published?
            string returnValue = "";

            if (page != null)
            {
                returnValue = module.Publish2(page);
            }
            else
            {
                returnValue = module.Publish2(newsletter);
            }
            return(returnValue);
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pageid"] != null)
            {
                PageID = Request.QueryString["pageid"];
            }
            CmsPage page = BaseObject.GetById <CmsPage>(new Guid(PageID));

            if (page == null)
            {
                throw new Exception("Geen pagina geladen met id: " + PageID);
            }

            //je kunt niet zien of een pagina in editmode zit, want zit in iframe
            //hierom kijken we of er een bitplateuser is ingelogd.
            //zo ja, dan wordt er geen check gedaan op site-autorisatie en of de pagina actief is.
            bool allowEdit = (SessionObject.CurrentBitplateUser != null);

            if (allowEdit)
            {
                if (!CheckBitplateAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten om deze pagina te bewerken.");
                }
            }
            else
            {
                if (!CheckIfActive(page))
                {
                    throw new Exception("Deze pagina is momenteel niet actief.");
                }

                if (!CheckSiteAutorisation(page))
                {
                    throw new Exception("U heeft geen rechten op deze pagina.");
                }
            }

            if (Request.Form["hiddenIFramePost"] != null)
            {
                string          id             = Request.Form["hiddenModuleID"].ToString();
                BaseModule      module         = BaseObject.GetById <BaseModule>(new Guid(id));
                IPostableModule postableModule = module.ConvertToType() as IPostableModule;
                PostResult      postResult     = postableModule.HandlePost(page, CollectionsHelper.ConvertFormParametersToDictionary(Request.Form));
                Response.Clear();
                Response.Write(postResult.ToJsonString());
                Response.Flush();
                Response.End();
            }

            if (Request.QueryString.AllKeys.Contains("mailing") && Request.QueryString["mailing"] != "")
            {
                Guid mailingId = Guid.Empty;
                Guid.TryParse(Request.QueryString["mailing"], out mailingId);
                if (mailingId != Guid.Empty)
                {
                    RegisterMailingLink(mailingId, page);
                }
            }

            if (!IsPostBack)
            {
                //if (SessionObject.CurrentLicense != null && SessionObject.CurrentLicense.IsValid)
                //{
                string pageHtml = page.Publish2();
                Response.Write(pageHtml);
                //}
                //else
                //{
                //    Response.Write("<div style=\"width: 350px; padding-top: 150px; margin: auto; font-size: 24px; text-align: center;\">Uw bitplate licentie is ongeldig!!</div>");
                //}
            }
        }
Exemplo n.º 11
0
        public static string SaveModule(BaseModule module, string pageid)
        {
            string Url = HttpContext.Current.Request.UrlReferrer.ToString();

            BaseService.CheckLoginAndLicense();
            module.Site = SessionObject.CurrentSite;
            if (module.IsVisibleOnAllPages)
            {
                module.Template = null;
                module.Page     = null;
            }
            else if (module.IsVisibleOnAllPagesInLayout)
            {
                if (Url.ToLower().Contains("/newsletters"))
                {
                    Newsletter newletter = BaseObject.GetById <Newsletter>(new Guid(pageid));
                    module.Template = newletter.Template;
                }
                else
                {
                    CmsPage page = BaseObject.GetById <CmsPage>(new Guid(pageid));
                    module.Template = page.Template;
                }
            }
            else
            {
                if (Url.ToLower().Contains("/newsletters"))
                {
                    module.Newsletter    = new Newsletter();
                    module.Newsletter.ID = new Guid(pageid);
                }
                else
                {
                    module.Page    = new CmsPage();
                    module.Page.ID = new Guid(pageid);
                }
            }
            module.Save();
            //SetUnpublishedItem(module);
            module = module.ConvertToType();

            //lijst van ObjectPermissions wordt hier alleen als drager gebruikt.
            //in de licentieserver wordt deze lijst weer gesplitst en in 2 tabellen gezet
            BaseCollection <ObjectPermission> objPermissions = module.GetObjectPermissions4LicenseServer();

            if (objPermissions.Count > 0)
            {
                BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
                client.SaveObjectPermissions(objPermissions);
            }
            //publiceren van pagina('s)
            PublishModule(module);
            PublishDependentPages(module);

            //Experimenteel caching reset
            //if (module.Page != null) BitCaching.RemoveItemFromCache(module.Page.ID.ToString());

            string returnValue = new ModuleService().GetUserControlContent(module);

            return(returnValue);
        }