Example #1
0
        private void InitModule()
        {
            int moduleId = 0;

            int.TryParse(Request["ModuleId"], out moduleId);
            this.ModuleId = moduleId;

            WebModuleInfo module = WebModule.GetModule(this.ModuleId);
            WebpageInfo   page   = null;

            if (this.ModuleId <= 0 ||
                null == module ||
                null == (page = module.Webpage))
            {
                cms.Admin.RedirectToMainMenu();
            }
            Page.Title = module.WebModuleType.Name + " Module";

            if (string.IsNullOrEmpty(txtStartDate.Text))
            {
                txtStartDate.Text = DateTime.Now.AddMonths(-1).ToShortDateString();
            }
            if (string.IsNullOrEmpty(txtEndDate.Text))
            {
                txtEndDate.Text = DateTime.Now.ToShortDateString();
            }
        }
Example #2
0
        private void InitModule()
        {
            int moduleId = 0;

            int.TryParse(Request.QueryString["ModuleId"], out moduleId);
            this.ModuleId = moduleId;

            WebModuleInfo module = WebModule.GetModule(this.ModuleId);
            WebpageInfo   page   = null;

            if (this.ModuleId <= 0 ||
                null == module ||
                null == (page = module.Webpage))
            {
                Redirect(Webpage.RootNavigationId);
            }
            this.PageNavigationId = page.InstanceId;

            //check user permissions.
            if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User))
            {
                throw new System.Security.SecurityException("The current user does not have permission to access this resource.");
            }

            HeaderCtl.Text = module.WebModuleType.Name;

            EnsureModule();
        }
        private void InitModule()
        {
            int moduleId = 0;

            int.TryParse(Request["ModuleId"], out moduleId);
            this.ModuleId = moduleId;

            WebModuleInfo module = WebModule.GetModule(this.ModuleId);
            WebpageInfo   page   = null;

            if (this.ModuleId <= 0 ||
                null == module ||
                null == (page = module.Webpage))
            {
                cms.Admin.RedirectToMainMenu();
            }
            this.PageNavigationId = page.InstanceId;

            //check user permissions.
            if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User))
            {
                throw new System.Security.SecurityException("The current user does not have permission to access this resource.");
            }

            ModuleName.Text    = module.Name;
            ModulTypeName.Text = module.WebModuleType.Name;
            Page.Title         = module.WebModuleType.Name + " Module";
            MainMenuLink.HRef  = cms.Admin.GetMainMenuUrl(this.PageNavigationId);

            EnsureModule();
        }
Example #4
0
        private void InitModule()
        {
            int moduleId = 0;

            int.TryParse(Request["ModuleId"], out moduleId);
            this.ModuleId = moduleId;

            _webmodule = WebModule.GetModule(moduleId);

            WebpageInfo page = null;

            if (this.ModuleId <= 0 ||
                null == _webmodule ||
                null == (page = _webmodule.Webpage))
            {
                Admin.RedirectToMainMenu();
            }
            this.PageNavigationId = page.InstanceId;

            //check user permissions.
            if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User))
            {
                throw new System.Security.SecurityException("The current user does not have permission to access this resource.");
            }
        }
Example #5
0
        public static List <WebModuleInfo> GetMasterDetailChildrenFiltered(int moduleId,
                                                                           bool filteryByPostDateAndRemoveDate,
                                                                           bool orderByMostRecentPosting,
                                                                           string filterTag)
        {
            //get the module object.
            WebModuleInfo module = WebModule.GetModule(moduleId);
            //get the container page of the module.
            WebpageInfo page = module.Webpage;
            //get all the MasterDetail modules on the child pages.
            List <WebpageInfo>   childPages          = page.Children;
            List <WebModuleInfo> MasterDetailModules = new List <WebModuleInfo>();

            foreach (WebpageInfo p in childPages)
            {
                MasterDetailModules.AddRange(p.Modules.FindAll(
                                                 delegate(WebModuleInfo m)
                {
                    return(m.WebModuleType == MasterDetailItem.ModuleType && !m.IsAlias);
                }));
            }

            if (filteryByPostDateAndRemoveDate)
            { //remove premature/expired/non-visible items.
                MasterDetailModules.RemoveAll(
                    delegate(WebModuleInfo m)
                {
                    WebpageInfo p = m.Webpage;
                    return((p.PostDate.HasValue && DateTime.Now < p.PostDate) ||
                           (p.RemoveDate.HasValue && DateTime.Today >= p.RemoveDate) ||
                           (!p.Visible));
                });
            }

            if (!string.IsNullOrEmpty(filterTag))
            {
                //remove non-matching tags.
                MasterDetailModules.RemoveAll(
                    delegate(WebModuleInfo m)
                {
                    MasterDetailItem item = MasterDetailItem.GetSafeResource(m.Id);
                    string[] tagArray     = item.Tags.Split(',');
                    foreach (var s in tagArray)
                    {
                        if (s == filterTag)
                        {
                            return(false);
                        }
                    }
                    return(true);
                });
            }

            if (orderByMostRecentPosting)
            {
                MasterDetailModules.Sort(CompareWebModulesByPostDate);
            }

            return(MasterDetailModules);
        }
Example #6
0
        private void InitModule()
        {
            int moduleId = 0;

            int.TryParse(Request["ModuleId"], out moduleId);
            this.ModuleId = moduleId;

            WebModuleInfo module = WebModule.GetModule(this.ModuleId);
            WebpageInfo   page   = null;

            if (this.ModuleId <= 0 ||
                null == module ||
                null == (page = module.Webpage))
            {
                cms.Admin.RedirectToMainMenu();
                //uncomment line below (and remove line above) for legacy WebModules.
                //Response.Redirect("~/WebModules/Admin/MyWebsite/Default.aspx?instanceId=" + Webpage.RootNavigationId);
            }
            this.PageNavigationId = page.InstanceId;

            //check user permissions.
            if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User))
            {
                throw new System.Security.SecurityException("The current user does not have permission to access this resource.");
            }

            ModuleName.Text    = module.Name;
            ModulTypeName.Text = module.WebModuleType.Name;
            MainMenuLink.HRef  = cms.Admin.GetMainMenuUrl(this.PageNavigationId);
            //uncomment line below (and remove line above) for legacy WebModules.
            //MainMenuLink.HRef = "~/WebModules/Admin/MyWebsite/Default.aspx?instanceId=" + this.PageNavigationId;

            EnsureModule();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Form.DefaultButton = UpdateButton.UniqueID;

            _instanceId = Convert.ToInt32(Request.QueryString["InstanceId"]);
            _moduleId   = Convert.ToInt32(Request.QueryString["ModuleId"]);
            _versionId  = Convert.ToInt32(Request.QueryString["VersionId"]);

            if (Request.QueryString["InstanceId"] != null)
            {
                urlReferrer += "?InstanceId=" + Request.QueryString["InstanceId"];
            }

            if (!IsPostBack)
            {
                //check user permissions.
                if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId, Page.User))
                {
                    throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
                }

                WebpageInfo   page   = Webpage.GetWebpage(_instanceId);
                WebModuleInfo module = WebModule.GetModule(_moduleId);

                Cms.Admin.BindPlaceholdersToList(page, PlaceholderDropDownList, module.Placeholder);
                ModuleNameTextBox.Text          = module.Name;
                ModuleTypeName.InnerText        = module.WebModuleType.Name;
                ModuleTypeDescription.InnerText = module.WebModuleType.Description;
            }
        }
Example #8
0
        protected void bssExport_Click(object sender, EventArgs e)
        {
            WebModuleInfo module = WebModule.GetModule(this.ModuleId);

            bssExport.OutputFileName = string.Format("{0}-responses-{1:yyyy-MMM-dd}",
                                                     Bss.BssString.Sanitize(module.Name, "_"),
                                                     DateTime.Now);


            bssExport.DataSource = GetDataTable();
        }
Example #9
0
        protected override void OnLoad(EventArgs e)
        {
            if (IsPostBack)
            {
                _webmodule = WebModule.GetModule(this.ModuleId);
            }
            else
            {
                InitModule();
                EnsureModule();
            }

            base.OnLoad(e);
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check user permissions.
            if (_instanceId.HasValue && !BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId.Value, Page.User))
            {
                throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
            }

            int    n;
            string strModuleId = Request.QueryString["moduleId"];

            if (int.TryParse(strModuleId, out n))
            {
                _moduleId = n;
                _module   = WebModule.GetModule(_moduleId.Value);
            }

            string strInstanceId = Request.QueryString["InstanceId"];

            if (int.TryParse(strInstanceId, out n))
            {
                _instanceId = n;
                _page       = Webpage.GetWebpage(_instanceId.Value);
            }

            if (!IsPostBack)
            {
                lvPages.DataSource = null;
                if (_moduleId.HasValue)
                {
                    var pages = (from w in Webpage.GetWebpagesSharingModule(_moduleId.Value)
                                 orderby w.Path
                                 select new { w.InstanceId, w.Path }).Distinct();
                    lvPages.DataSource = pages;
                }
                lvPages.DataBind();

                if (Request.UrlReferrer != null)
                {
                    Referrer = Request.UrlReferrer.PathAndQuery;
                }

                if (_module != null)
                {
                    literalModuleName.Text = _module.Name;
                    literalModuleType.Text = _module.ModuleTypeName;
                }
            }
        }
        private void LeavePage()
        {
            int           instanceId;
            WebModuleInfo module = WebModule.GetModule(_moduleId);

            if (_moduleId == 0 || null == module || null == module.Webpage)
            {
                instanceId = Webpage.RootNavigationId;
            }
            else
            {
                instanceId = module.Webpage.InstanceId;
            }
            Response.Redirect("~/WebModules/Admin/MyWebsite/Default.aspx?InstanceId=" + instanceId);
        }
        //finds the first content list that "contains" this item, if any.
        public MasterDetailSetting GetContentList()
        {
            WebModuleInfo       module     = WebModule.GetModule(this.ModuleId);
            WebpageInfo         parentPage = module.Webpage.Parent;
            MasterDetailSetting itemList   = null;

            foreach (WebModuleInfo m in parentPage.Modules)
            {
                if (m.WebModuleType == MasterDetailList.ModuleType)
                {
                    itemList = MasterDetailSetting.FetchByID(m.Id);
                    break;
                }
            }

            return(itemList);
        }
        protected void MasterDetail_Item_List_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            int moduleId = int.Parse(e.CommandArgument.ToString());

            if (e.CommandName == "MoveUp" || e.CommandName == "MoveDown")
            {
                WebModuleInfo module = WebModule.GetModule(moduleId);
                WebpageInfo   page   = module.Webpage;
                if (e.CommandName == "MoveUp")
                {
                    Webpage.SortWebpageUp(page.InstanceId);
                }
                else
                {
                    Webpage.SortWebpageDown(page.InstanceId);
                }

                Response.Redirect(Request.Url.ToString());
            }
        }
        //creates/updates the current content item and associated objects.
        //does not create new CMS objects.
        public void Save()
        {
            if (this.ModuleId <= 0)
            {
                throw new InvalidOperationException("Invalid module id: " + this.ModuleId);
            }

            WebModuleInfo module = WebModule.GetModule(this.ModuleId);
            WebpageInfo   page   = GetInput_WebpageInfo(module.Webpage);

            //save webpage properties.
            //note: do not update WebpageInfo.PathName, that may hurt SEO.
            Webpage.UpdateWebpage(page);

            //note: we don't need to update the module.

            //set the module id for the below methods to use.
            this.ModuleId = module.Id;

            SaveMasterDetailItem();
        }
Example #15
0
        //also deletes webpage if it is empty.
        public static void DestroyMasterDetailItem(int moduleId)
        {
            //get the module object.
            WebModuleInfo module = WebModule.GetModule(moduleId);

            //get the container page of the module.
            WebpageInfo page = module.Webpage;

            //this cascades and destroys the MasterDetail associated items/resources.
            WebModule.DeleteModule(moduleId);

            //destory the item (this cascades down the resources).
            //MasterDetail_Item.Destroy(moduleId);

            //destory all associated item resources.
            //MasterDetail_ItemResource.Destroy(MasterDetail_ItemResource.Columns.ModuleId, moduleId);

            //if the page has no modules left on it, remove it also.
            if (null == page.Modules || page.Modules.Count == 0)
            {
                Webpage.DeleteWebpage(page.InstanceId);
            }
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _instanceId  = int.Parse(Request.QueryString["InstanceId"]);
            _urlReferrer = "Default.aspx?InstanceId=" + _instanceId;
            _moduleId    = int.Parse(Request.QueryString["ModuleId"]);
            _module      = WebModule.GetModule(_moduleId);

            if (!IsPostBack)
            {
                //check user permissions.
                if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId, Page.User))
                {
                    throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
                }

                ModuleName.Text = _module.Name;

                if (_module.ShareCount > 0)
                {
                    messageBox.ShowError("Unable to delete this module because it is shared on other pages.");
                    EditDeleteButton.Enabled = false;
                }
            }
        }
        public void Load_MasterDetail_ItemResource_AndAssociatedObjects(MasterDetailItem itemRes)
        {
            WebModuleInfo module = WebModule.GetModule(itemRes.ModuleId);
            WebpageInfo   page   = Webpage.GetWebpage(module.Webpage.InstanceId);

            tbTitle.Text              = page.Title; //WebpageInfo respects current culture.
            tbMetaKeywords.Text       = page.MetaKeywords;
            tbMetaDescription.Text    = page.MetaDescription;
            tbPageNavigationText.Text = page.Text;

            tbShortDesc.Text = itemRes.ShortDescription;
            tbLongDesc.Text  = itemRes.LongDescription;
            tbTags.Text      = itemRes.Tags;

            ImagePathCtl.ImagePath = itemRes.ImagePath;
            cbIsVisible.Checked    = page.Visible;
            cbIsFeatured.Checked   = itemRes.IsFeatured;

            if (page.PostDate.HasValue)
            {
                calPostDate.Date = page.PostDate.Value.Date;

                if (page.PostDate.Value.TimeOfDay.TotalSeconds > 0.001)
                {
                    tbPostTime.Text = page.PostDate.Value.ToShortTimeString();
                }
                else
                {
                    tbPostTime.Text = string.Empty;
                }
            }
            if (page.RemoveDate.HasValue)
            {
                calRemoveDate.Date = page.RemoveDate.Value;
            }
        }
Example #18
0
        private void LoadModule()
        {
            WebModuleInfo   module    = WebModule.GetModule(this.ModuleId);
            SlideShowModule slideshow = SlideShowModule.GetByModuleId(this.ModuleId);

            //model.SlideShow_Module slideshow = model.SlideShow_Module.Get(this.ModuleId);

            ClassName_div.Visible = false;
            ClassNameTextBox.Text = slideshow.SlideShowClassName ?? string.Empty;

            this.IsFlashSlideShow = (module.WebModuleType.Name == "Slide Show (Flash)");

            this.IsJQuerySlidingContentSlideShow = (module.WebModuleType.Name == "Slide Show (Sliding jQuery)");

            this.IsJQuerySlidingTextContentSlideShow = (module.WebModuleType.Name == "Slide Show (Sliding jQuery WYSIWYG)");

            this.IsGalleryViewSlideShow = (module.WebModuleType.Name == "Slide Show (Image Gallery)");

            this.IsFlexSlideShow = (module.WebModuleType.Name == "Slide Show (Flex SlideShow)");

            FlashFileCtl.ImagePath    = slideshow.FlashFileName;
            HeightCtl.Text            = slideshow.Height.ToString();
            WidthCtl.Text             = slideshow.Width.ToString();
            ImageDisplayTimeCtl.Text  = slideshow.ImageDisplayTime.ToString();
            ImageDisplayOrderCtl.Text = slideshow.ImageDisplayOrder.ToString();
            ImageLoopingCtl.Checked   = slideshow.ImageLooping;
            ImageFadeTimeCtl.Text     = slideshow.ImageFadeTime.ToString();
            //ImageXPositionCtl.Text = slideshow.ImageXPosition.ToString();
            //ImageYPositionCtl.Text = slideshow.ImageYPosition.ToString();

            if (this.IsJQuerySlidingContentSlideShow || this.IsJQuerySlidingTextContentSlideShow)
            {
                ImageNavTypeCtl.Text  = slideshow.NavType.ToString();
                ImageWrapTypeCtl.Text = slideshow.WrapType.ToString();
            }

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                SlideShowImagesCtl.IsJQuerySlidingTextContentSlideShow = true;
            }

            if (this.IsGalleryViewSlideShow)
            {
                SlideShowImagesCtl.IsGalleryViewSlideShow = true;
            }

            SlideShowImagesCtl.Load_(this.ModuleId);

            if (this.IsFlashSlideShow)
            {
                InitFlashSlideshowAdmin();
            }
            else if (this.IsJQuerySlidingContentSlideShow)
            {
                InitJQuerySlidingContentSlideshowAdmin();
            }
            else if (this.IsJQuerySlidingTextContentSlideShow)
            {
                InitJQuerySlidingTextContentSlideshowAdmin();
            }
            else if (this.IsGalleryViewSlideShow)
            {
                InitGalleryViewSlideshowAdmin();
            }
            else if (this.IsFlexSlideShow)
            {
                InitFlexSlideShow();
            }
            else
            {
                InitNormalSlideshowAdmin();
            }
        }
        public void EmailNotifyAdmin()
        {
            try
            {
                var body = new StringBuilder();

                string   strNotifyEmails  = this.FormBuilder_Module.NotifyEmail;
                string[] astrNotifyEmails = strNotifyEmails.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (astrNotifyEmails.Length > 0)
                {
                    WebModuleInfo module = WebModule.GetModule(this.FormBuilder_Module.ModuleId);

                    var dbContext = new FormBuilderDataContext();
                    List <FormBuilder_FieldInput> lInputsSorted = (from i in dbContext.FormBuilder_FieldInputs
                                                                   where i.ResponseId == this.Id
                                                                   orderby i.FormBuilder_Field.SortOrder
                                                                   select i).ToList();

                    foreach (var input in lInputsSorted)
                    {
                        if (input.FormBuilder_Field.Type == (int)FormBuilder_Field.FieldType.FileUpload &&
                            !String.IsNullOrEmpty(input.InputValue))
                        {
                            body.Append(input.FormBuilder_Field.Name
                                        + String.Format(": <b>{0}",
                                                        input.InputValue.Replace("~", "").Replace("//", "").Replace(@"\", "")) + "</b><br>");
                        }
                        else if (input.FormBuilder_Field.Type == (int)FormBuilder_Field.FieldType.SectionHeader)
                        {
                            body.Append(String.Format("<br/><b>{0}</b><br/>", input.FormBuilder_Field.Name));
                        }
                        else
                        {
                            body.Append(input.FormBuilder_Field.Name + ": <b>" + input.InputValue + "</b><br>");
                        }
                    }

                    MailMessage email = new MailMessage();
                    foreach (string strNotifyEmail in astrNotifyEmails)
                    {
                        MailAddress address = new MailAddress(strNotifyEmail.Trim());
                        email.To.Add(address);
                    }

                    email.Body = "<font face='Arial'>New form response submission has been received.<br>" +
                                 "<hr>" + body + "<br>" +
                                 "To view all form responses, " +
                                 "<a href='" + Common.Web.Url.ToAbsoluteUrl(module.GetEditUrl()) + "'>click here</a>." +
                                 "</font>";

                    email.Subject = string.Format("{0}: {1}",
                                                  Website.Current.Resource.Name,
                                                  module.Webpage.Title);

                    email.IsBodyHtml = true;

                    new SmtpClient().Send(email);
                }
            }
            catch (Exception ex)
            {
                string strMessage = "Failed sending contact us notification message";
                BayshoreSolutions.WebModules.WebModulesAuditEvent.Raise(strMessage, this, ex);
            }
        }
        protected override void PopulateRss(string channelName, string userName)
        {
            // Get the data
            string qModuleId = HttpContext.Current.Request["moduleId"];
            int    moduleId;

            if (!int.TryParse(qModuleId, out moduleId) || moduleId <= 0)
            {
                throw new ArgumentException("Invalid or missing module id: " + moduleId);
            }

            WebModuleInfo MasterDetailListModule = WebModule.GetModule(moduleId);

            if (MasterDetailListModule.WebModuleType != MasterDetailList.ModuleType)
            {
                throw new ArgumentException(string.Format("Invalid module type '{0}'. Module type must be '{1}'", MasterDetailListModule.ModuleTypeName, MasterDetailList.ModuleType.Name));
            }
            WebpageInfo MasterDetailListPage = MasterDetailListModule.Webpage;

            if (null == MasterDetailListModule)
            {
                throw new ArgumentException("Invalid module id: " + moduleId);
            }
            List <WebModuleInfo> MasterDetailItemModules = MasterDetailList.GetMasterDetailChildren(moduleId, true, true);


            // Build the feed
            Rss.Channel             = new MasterDetailChannel();
            Rss.Version             = "2.0";
            Rss.Channel.Title       = MasterDetailListPage.Title;
            Rss.Channel.Description = MasterDetailListPage.MetaDescription;
            Rss.Channel.Link        = MasterDetailListPage.Path;

            Rss.Channel.Items = new List <MasterDetailRssItem>();
            if (!string.IsNullOrEmpty(channelName))
            {
                Rss.Channel.Title += " '" + channelName + "'";
            }

            if (!string.IsNullOrEmpty(userName))
            {
                Rss.Channel.Title += " (generated for " + userName + ")";
            }

            int maxItemsPerPage = 25;
            int i = 0;

            foreach (WebModuleInfo m in MasterDetailItemModules)
            {
                WebpageInfo      p       = m.Webpage;
                MasterDetailItem itemRes = MasterDetailItem.GetSafeResource(m.Id);
                //string postDateString = "";
                //if (p.PostDate.HasValue)
                //{
                //this is a hack
                //	postDateString = p.PostDate.Value.GetDateTimeFormats(
                //		System.Globalization.CultureInfo.GetCultureInfo("en-US"))[103];
                //}

                MasterDetailRssItem item = new MasterDetailRssItem();
                item.Title       = p.Title;
                item.Description = itemRes.GetSummary(p);
                if (p.PostDate.HasValue)
                {
                    item.PubDate = RssXmlHelper.ToRfc822(p.PostDate.Value);
                }
                item.Link = VirtualPathUtility.ToAbsolute(p.Path);

                Rss.Channel.Items.Add(item);

                i++;
                if (i == maxItemsPerPage)
                {
                    break;
                }
            }
        }