public void Reset()
        {
            DataObject dataObject = DataObject.Load <DataObject>(CommunityID);

            if ((dataObject.GetUserAccess(UserDataContext.GetUserDataContext()) & ObjectAccessRight.Update) != ObjectAccessRight.Update)
            {
                throw new Exception("Access rights missing");
            }

            HitblCommunityCty comm = HitblCommunityCty.FetchByID(CommunityID);

            if (Section == StyleSection.Header)
            {
                comm.CtyHeaderStyle = string.Empty;
            }
            else if (Section == StyleSection.Body)
            {
                comm.CtyBodyStyle = string.Empty;
            }
            else if (Section == StyleSection.Footer)
            {
                comm.CtyFooterStyle = string.Empty;
            }
            comm.Save();
        }
        protected void OnLayoutChangeClick(object sender, EventArgs e)
        {
            DataObject dataObject = DataObject.Load <DataObject>(CommunityID, null, false);

            if ((dataObject.GetUserAccess(UserDataContext.GetUserDataContext()) & ObjectAccessRight.Update) != ObjectAccessRight.Update)
            {
                throw new Exception("Access rights missing");
            }

            hitblCommunity.CtyLayout = rblLayouts.SelectedValue;
            hitblCommunity.Save();
            int previousColumnCount = Layouts.GetLayout(originalLayout).NumberDropZones;
            int newColumnCount      = Layouts.GetLayout(rblLayouts.SelectedValue).NumberDropZones;

            if (previousColumnCount > newColumnCount)
            {
                SPs.HispWidgetInstanceReorderColumns(hitblCommunity.CtyId, newColumnCount).Execute();
            }
            originalLayout = rblLayouts.SelectedValue;

            string filteredQueryString = Helper.GetFilteredQueryString(Request.QueryString, new List <string> {
                "tab"
            }, false);

            Response.Redirect(string.Format("{0}?tab=layout{1}", Request.GetRawPath(), filteredQueryString));
        }
Exemple #3
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            Page.Validate("WizardStep1");
            if (Page.IsValid)
            {
                page.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                page.VirtualURL  = this.txtCommName.Text;
                page.PageType    = (PageType)Enum.Parse(typeof(PageType), RCBPageType.SelectedValue);
                page.Description = this.RadEditor1.Content;
                page.TagList     = Common.Extensions.StripHTMLTags(this.HFTagWords.Value);
                page.ShowState   = ObjectShowState.Published;
                InsertRoles();
                page.Status    = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value);
                page.Copyright = int.Parse(this.HFCopyright.Value);
                double geoLat;
                if (double.TryParse(this.HFGeoLat.Value, out geoLat))
                {
                    page.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.HFGeoLong.Value, out geoLong))
                {
                    page.Geo_Long = geoLong;
                }
                page.Zip                = this.HFZip.Value;
                page.City               = this.HFCity.Value;
                page.Street             = this.HFStreet.Value;
                page.CountryCode        = this.HFCountry.Value;
                community.CtyVirtualUrl = page.VirtualURL;

                using (TransactionScope scope = new TransactionScope())
                {
                    page.Update(UserDataContext.GetUserDataContext());

                    if (community.CtyStatus == (int)CommunityStatus.Initializing)
                    {
                        var thePage = PagesConfig.CreateNewPage(ObjectID.Value, "Page", "Start", "Home");
                        // TODO: Insert Default Widgets
                    }
                    community.CtyStatus = (int)CommunityStatus.Ready;
                    community.Save();
                    scope.Complete();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected void OnLayoutChangeClick(object sender, EventArgs e)
        {
            DataObject dataObject = DataObject.Load <DataObject>(CommunityID, null, false);

            if ((dataObject.GetUserAccess(UserDataContext.GetUserDataContext()) & ObjectAccessRight.Update) != ObjectAccessRight.Update)
            {
                throw new Exception("Access rights missing");
            }

            hitblCommunity.CtyTheme = rblThemes.SelectedValue;
            hitblCommunity.Save();

            string filteredQueryString = Helper.GetFilteredQueryString(Request.QueryString, new List <string> {
                "tab"
            }, false);

            Response.Redirect(string.Format("{0}?tab=theme{1}", Request.GetRawPath(), filteredQueryString));
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);

            udc = UserDataContext.GetUserDataContext();
            currDatatObjectCommunity = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);

            if (currDatatObjectCommunity.State == ObjectState.Added)
            {
                currDatatObjectCommunity             = new DataObjectCommunity(udc);
                currDatatObjectCommunity.ObjectID    = ObjectID;
                currDatatObjectCommunity.CommunityID = ObjectID;
                currDatatObjectCommunity.Title       = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed");
                currDatatObjectCommunity.Status      = ObjectStatus.Public;
                currDatatObjectCommunity.ShowState   = ObjectShowState.InProgress;
                if (CommunityID.HasValue)
                {
                    //It's a Group (SubCommunity)
                    currDatatObjectCommunity.ParentObjectID   = CommunityID;
                    currDatatObjectCommunity.ParentObjectType = Helper.GetObjectTypeNumericID("Community");
                }
                currDatatObjectCommunity.Insert(udc);
                currDatatObjectCommunity = DataObject.Load <DataObjectCommunity>(ObjectID, null, true);

                HitblCommunityCty objCommunity = new HitblCommunityCty();
                objCommunity.CtyId           = currDatatObjectCommunity.ObjectID.Value;
                objCommunity.CtyInsertedDate = currDatatObjectCommunity.Inserted;
                objCommunity.CtyVirtualUrl   = Guid.NewGuid().ToString();
                objCommunity.UsrIdInserted   = currDatatObjectCommunity.UserID;
                objCommunity.CtyIsProfile    = false;
                objCommunity.CtyStatus       = (int)CommunityStatus.Initializing;
                objCommunity.CtyLayout       = _4screen.CSB.Common.CustomizationSection.CachedInstance.DefaultLayouts.Community;
                objCommunity.CtyTheme        = Constants.DEFAULT_THEME;
                objCommunity.CtyUpdatedDate  = currDatatObjectCommunity.Inserted;
                objCommunity.UsrIdUpdated    = currDatatObjectCommunity.UserID;
                objCommunity.Save();
            }

            currComm = HitblCommunityCty.FetchByID(ObjectID);
            if (currComm.CtyStatus != (int)CommunityStatus.Initializing)
            {
                //its an edit inserted!
                txtCommName.ReadOnly = true;
            }
            else
            {
                currDatatObjectCommunity.Title = string.Empty;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["TG"]))
            {
                currDatatObjectCommunity.TagList = Server.UrlDecode(Request.QueryString["TG"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OS"]))
            {
                currDatatObjectCommunity.Status = (ObjectStatus)int.Parse(Request.QueryString["OS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["SS"]))
            {
                currDatatObjectCommunity.ShowState = (ObjectShowState)int.Parse(Request.QueryString["SS"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CR"]))
            {
                currDatatObjectCommunity.Copyright = int.Parse(Request.QueryString["CR"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["GC"]))
            {
                string[] geoLatLong = Request.QueryString["GC"].Split(',');
                double   geoLat, geoLong = double.MinValue;
                if (geoLatLong.Length == 2)
                {
                    if (double.TryParse(geoLatLong[0], out geoLat) && double.TryParse(geoLatLong[1], out geoLong))
                    {
                        currDatatObjectCommunity.Geo_Lat  = geoLat;
                        currDatatObjectCommunity.Geo_Long = geoLong;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["ZP"]))
            {
                currDatatObjectCommunity.Zip = Server.UrlDecode(Request.QueryString["ZP"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CI"]))
            {
                currDatatObjectCommunity.City = Server.UrlDecode(Request.QueryString["CI"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["RE"]))
            {
                currDatatObjectCommunity.Street = Server.UrlDecode(Request.QueryString["RE"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["CO"]))
            {
                currDatatObjectCommunity.CountryCode = Server.UrlDecode(Request.QueryString["CO"]);
            }

            FillEditForm();
        }
Exemple #6
0
        public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString)
        {
            if (Page.IsValid)
            {
                currDatatObjectCommunity.Title       = Common.Extensions.StripHTMLTags(this.TxtTitle.Text);
                currDatatObjectCommunity.VirtualURL  = this.txtCommName.Text;
                currDatatObjectCommunity.Description = this.RadEditor1.Content;
                currDatatObjectCommunity.TagList     = Common.Extensions.StripHTMLTags(this.HFTagWords.Value);
                currDatatObjectCommunity.ShowState   = ObjectShowState.Published;
                currDatatObjectCommunity.Managed     = Convert.ToBoolean(Convert.ToInt32((string)this.HFManaged.Value));
                currDatatObjectCommunity.Status      = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value);
                currDatatObjectCommunity.Copyright   = int.Parse(this.HFCopyright.Value);
                double geoLat;
                if (double.TryParse(this.HFGeoLat.Value, out geoLat))
                {
                    currDatatObjectCommunity.Geo_Lat = geoLat;
                }
                double geoLong;
                if (double.TryParse(this.HFGeoLong.Value, out geoLong))
                {
                    currDatatObjectCommunity.Geo_Long = geoLong;
                }
                currDatatObjectCommunity.Zip         = this.HFZip.Value;
                currDatatObjectCommunity.City        = this.HFCity.Value;
                currDatatObjectCommunity.Street      = this.HFStreet.Value;
                currDatatObjectCommunity.CountryCode = this.HFCountry.Value;
                currComm.CtyVirtualUrl = currDatatObjectCommunity.VirtualURL;

                using (TransactionScope scope = new TransactionScope())
                {
                    currDatatObjectCommunity.Update(UserDataContext.GetUserDataContext());

                    if (currComm.CtyStatus == (int)CommunityStatus.Initializing)
                    {
                        var privatePage = PagesConfig.CreateNewPage(ObjectID.Value, "Community", "Private", "Dashboard");
                        var thePage     = PagesConfig.CreateNewPage(ObjectID.Value, "Community", "Start", "Home");
                        HirelCommunityUserCur.Insert(currComm.CtyId, udc.UserID, true, 0, DateTime.Now, Guid.Empty);
                        SPs.HispDataObjectAddMemberCount(currComm.CtyId, 1).Execute();
                        try
                        {
                            if (udc.UserID != Constants.ADMIN_USERID.ToGuid())
                            {
                                HirelCommunityUserCur.Insert(currComm.CtyId, new Guid(Constants.ADMIN_USERID), true, 0, DateTime.Now, Guid.Empty);
                                SPs.HispDataObjectAddMemberCount(currComm.CtyId, 1).Execute();
                            }
                        }
                        catch
                        {
                        }
                    }
                    currComm.CtyStatus = (int)CommunityStatus.Ready;
                    currComm.Save();
                    _4screen.CSB.Extensions.Business.IncentivePointsManager.AddIncentivePointEvent("COMMUNITY_UPLOAD", udc, ObjectID.Value.ToString());
                    scope.Complete();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void Save()
        {
            DataObject dataObject = DataObject.Load <DataObject>(CommunityID);

            if ((dataObject.GetUserAccess(UserDataContext.GetUserDataContext()) & ObjectAccessRight.Update) != ObjectAccessRight.Update)
            {
                throw new Exception("Access rights missing");
            }

            string strStyle = string.Empty;

            if (RbColor.Checked)
            {
                if (TxtColor.Text.Trim().Length > 0 && TxtColor.Text.Trim() != language.GetString("MessageStyleNoColor"))
                {
                    try
                    {
                        System.Drawing.Color clr = System.Drawing.ColorTranslator.FromHtml(TxtColor.Text);
                        strStyle = String.Format("background-color:{0};background-image: none;", (object)TxtColor.Text);
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                //Image set
                if (TxtImage.Text.Length > 0)
                {
                    int footerHeight = 20;
                    try { footerHeight = int.Parse(TxtFooterHeight.Text); }
                    catch { }
                    strStyle = String.Format("background-image:url('{0}');", (object)TxtImage.Text.Replace("BG/S", "BG/L"));
                    if (CbRepeatV.Checked && CbRepeatH.Checked)
                    {
                        strStyle += "background-repeat:repeat;";
                    }
                    else if (!CbRepeatV.Checked && !CbRepeatH.Checked)
                    {
                        strStyle += "background-repeat:no-repeat;";
                    }
                    else if (CbRepeatV.Checked && !CbRepeatH.Checked)
                    {
                        strStyle += "background-repeat:repeat-y;";
                    }
                    else if (!CbRepeatV.Checked && CbRepeatH.Checked)
                    {
                        strStyle += "background-repeat:repeat-x;";
                    }
                    if (footerHeight > 20)
                    {
                        strStyle += "height:" + TxtFooterHeight.Text + "px;";
                    }
                }
            }
            HitblCommunityCty comm = HitblCommunityCty.FetchByID(CommunityID);

            if (Section == StyleSection.Header)
            {
                comm.CtyHeaderStyle = strStyle;
            }
            else if (Section == StyleSection.Body)
            {
                comm.CtyBodyStyle = strStyle;
            }
            else if (Section == StyleSection.Footer)
            {
                comm.CtyFooterStyle = strStyle;
            }
            comm.Save();
            objCty = new Community(CommunityID);
            LoadData();
        }