protected void Page_Load(object sender, EventArgs e)
        {
            FillThemes();

            hitblCommunity          = HitblCommunityCty.FetchByID(CommunityID);
            rblThemes.SelectedValue = hitblCommunity.CtyTheme;
        }
        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();
        }
        private void LoadData()
        {
            hitblCommunity = HitblCommunityCty.FetchByID(CommunityID);

            string currentLayoutName = HitblCommunityCty.FetchByID(CommunityID).CtyLayout;

            foreach (ListItem listItem in rblLayouts.Items)
            {
                if (listItem.Value == currentLayoutName)
                {
                    rblLayouts.SelectedIndex = rblLayouts.Items.IndexOf(listItem);
                    originalLayout           = listItem.Value;
                }
                else
                {
                    listItem.Attributes.Remove("onclick");
                    listItem.Attributes.Add("onclick", string.Format("LayoutChange({0}, {1})", Layouts.GetLayout(currentLayoutName).NumberDropZones, Layouts.GetLayout(listItem.Value).NumberDropZones));
                }
            }
        }
Example #4
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();
        }
        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();
        }