private void FillEditForm() { this.Img.Src = string.Format("{0}/{1}", _4screen.CSB.Common.SiteConfig.MediaDomainName, forum.GetImage(PictureVersion.S)); this.LnkImage.Attributes.Add("onClick", string.Format("radWinOpen('/Pages/Popups/SinglePictureUpload.aspx?OID={0}&ParentRadWin={1}', 'Bild hochladen', 400, 100, false, null, 'imageWin')", forum.ObjectID, "wizardWin")); this.TxtTitle.Text = forum.Title; this.TxtDesc.Content = forum.Description; this.RcbRights.SelectedValue = ((int)forum.ThreadCreationUsers).ToString(); foreach (ListItem item in this.CblUserVisibliity.Items) { CommunityUsersType enu = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), item.Value); item.Text = languageDataAccess.GetString(string.Format("EnumCommunityUsersType{0}", enu.ToString())); item.Selected = forum.ShowCommunityUsersType(enu); } this.CbxCharied.Checked = forum.ShowChaired; this.HFTagWords.Value = forum.TagList.Replace(Constants.TAG_DELIMITER, ','); this.HFStatus.Value = ((int)forum.Status).ToString(); this.HFShowState.Value = ((int)forum.ShowState).ToString(); this.HFCopyright.Value = forum.Copyright.ToString(); if (forum.Geo_Lat != double.MinValue && forum.Geo_Long != double.MinValue) { this.HFGeoLat.Value = forum.Geo_Lat.ToString(); this.HFGeoLong.Value = forum.Geo_Long.ToString(); } this.HFZip.Value = forum.Zip; this.HFCity.Value = forum.City; this.HFStreet.Value = forum.Street; this.HFCountry.Value = forum.CountryCode; }
public override bool SaveStep(ref System.Collections.Specialized.NameValueCollection queryString) { try { forum.Title = Common.Extensions.StripHTMLTags(this.TxtTitle.Text); forum.Description = this.TxtDesc.Content; forum.ThreadCreationUsers = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RcbRights.SelectedValue); foreach (ListItem item in this.CblUserVisibliity.Items) { CommunityUsersType enu = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), item.Value); forum.ShowCommunityUsersType(enu, item.Selected); } forum.ShowChaired = CbxCharied.Checked; forum.TagList = Common.Extensions.StripHTMLTags(this.HFTagWords.Value); forum.Status = (ObjectStatus)Enum.Parse(typeof(ObjectStatus), this.HFStatus.Value); forum.ShowState = (ObjectShowState)Enum.Parse(typeof(ObjectShowState), this.HFShowState.Value); forum.Copyright = int.Parse(this.HFCopyright.Value); double geoLat; if (double.TryParse(this.HFGeoLat.Value, out geoLat)) { forum.Geo_Lat = geoLat; } double geoLong; if (double.TryParse(this.HFGeoLong.Value, out geoLong)) { forum.Geo_Long = geoLong; } forum.Zip = this.HFZip.Value; forum.City = this.HFCity.Value; forum.Street = this.HFStreet.Value; forum.CountryCode = this.HFCountry.Value; forum.Update(UserDataContext.GetUserDataContext()); return(true); } catch (Exception ex) { this.LitMsg.Text = string.Format("{0}: ", language.GetString("MessageSaveError")) + ex.Message; return(false); } }
public override bool SaveStep(ref NameValueCollection queryString) { ObjectStatus objectStatus = ObjectStatus.Public; bool managed = false; string selectedRoles = null; FriendType friendVisibility = 0; if (objectViewHandler != null) { friendVisibility = objectViewHandler.GetFriendType(); objectStatus = objectViewHandler.GetObjectStatus(); selectedRoles = objectViewHandler.GetRoles(); managed = objectViewHandler.IsManaged(); } ObjectShowState objectShowState = ObjectShowState.Published; if (dataObject == null || (dataObject.ObjectType != Helper.GetObjectTypeNumericID("ProfileCommunity") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Page") && dataObject.ObjectType != Helper.GetObjectTypeNumericID("Community"))) { objectShowState = managed ? ObjectShowState.Draft : ObjectShowState.Published; } string tagWords = string.Empty; if (objectTagHandler != null) { tagWords = objectTagHandler.GetTags(); } else if (dataObject != null) { tagWords = dataObject.TagList; } if (ObjectID.HasValue && dataObject != null && dataObject.State != ObjectState.Added) { dataObject.TagList = tagWords; dataObject.Status = objectStatus; dataObject.ShowState = objectShowState; dataObject.Copyright = int.Parse(this.Copyright.SelectedValue); dataObject.FriendVisibility = friendVisibility; if (!string.IsNullOrEmpty(selectedRoles)) { var roles = dataObject.RoleRight.Keys.ToArray <string>(); foreach (string role in roles) { dataObject.RoleRight[role] = false; } string[] selRoles = selectedRoles.Split(Constants.TAG_DELIMITER); for (int i = 0; i < selRoles.Length; i++) { dataObject.RoleRight[selRoles[i]] = true; } } double geoLat; if (double.TryParse(this.TxtGeoLat.Text, out geoLat)) { dataObject.Geo_Lat = geoLat; } double geoLong; if (double.TryParse(this.TxtGeoLong.Text, out geoLong)) { dataObject.Geo_Long = geoLong; } dataObject.Zip = this.HFZip.Value.StripForScript(); dataObject.City = this.HFCity.Value.StripForScript(); dataObject.Street = this.HFStreet.Value.StripForScript(); dataObject.CountryCode = this.HFCountry.Value.StripForScript(); dataObject.Update(UserDataContext.GetUserDataContext()); /*DataObjectList<DataObject> relatedObjects = DataObjects.Load<DataObject>(new QuickParameters { Udc = UserDataContext.GetUserDataContext(), QuerySourceType = QuerySourceType.MyContent, IgnoreCache = true, DisablePaging = true, RelationParams = new RelationParams { ParentObjectID = dataObject.ObjectID, ExcludeSystemObjects = true } }); * foreach (DataObject relatedObject in relatedObjects) * { * relatedObject.Status = dataObject.Status; * relatedObject.ShowState = dataObject.ShowState; * relatedObject.Copyright = dataObject.Copyright; * relatedObject.FriendVisibility = dataObject.FriendVisibility; * foreach (KeyValuePair<string, bool> roleRight in dataObject.RoleRight) * { * relatedObject.RoleRight[roleRight.Key] = roleRight.Value; * } * relatedObject.Update(UserDataContext.GetUserDataContext()); * }*/ if (ObjectType == Helper.GetObjectTypeNumericID("Community") && ObjectID.HasValue && !CommunityID.HasValue) { CommunityUsersType communityUsersType = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyGroups.SelectedValue); CommunityUsersType communityUploadUsers = (CommunityUsersType)Enum.Parse(typeof(CommunityUsersType), this.RCBCtyUpload.SelectedValue); DataObjectCommunity communtiy = DataObject.Load <DataObjectCommunity>(ObjectID, null, true); communtiy.CreateGroupUser = communityUsersType; communtiy.UploadUsers = communityUploadUsers; communtiy.Managed = managed; communtiy.Update(UserDataContext.GetUserDataContext()); } return(true); } else { // If there isn't an upload session and no object id, we habe to create one if (string.IsNullOrEmpty(Request.QueryString["UploadSession"]) && !ObjectID.HasValue) { queryString.Add("OID", Guid.NewGuid().ToString()); } queryString.Add("TG", Server.UrlEncode(tagWords)); queryString.Add("OS", ((int)objectStatus).ToString()); queryString.Add("SS", ((int)objectShowState).ToString()); queryString.Add("FT", ((int)friendVisibility).ToString()); queryString.Add("CR", this.Copyright.SelectedValue); if (!string.IsNullOrEmpty(selectedRoles)) { queryString.Add("SR", string.Format("{0}", Server.UrlEncode(selectedRoles))); } if (!string.IsNullOrEmpty(this.TxtGeoLat.Text) && !string.IsNullOrEmpty(this.TxtGeoLong.Text)) { queryString.Add("GC", string.Format("{0},{1}", this.TxtGeoLat.Text, this.TxtGeoLong.Text)); } else { queryString.Add("GC", string.Empty); } if (!string.IsNullOrEmpty(this.HFZip.Value)) { queryString.Add("ZP", string.Format("{0}", Server.UrlEncode(this.HFZip.Value))); } else { queryString.Add("ZP", string.Empty); } if (!string.IsNullOrEmpty(this.HFCity.Value)) { queryString.Add("CI", string.Format("{0}", Server.UrlEncode(this.HFCity.Value))); } else { queryString.Add("CI", string.Empty); } if (!string.IsNullOrEmpty(this.HFStreet.Value)) { queryString.Add("RE", string.Format("{0}", Server.UrlEncode(this.HFStreet.Value))); } else { queryString.Add("RE", string.Empty); } if (!string.IsNullOrEmpty(this.HFCountry.Value)) { queryString.Add("CO", string.Format("{0}", Server.UrlEncode(this.HFCountry.Value))); } else { queryString.Add("CO", string.Empty); } return(true); } }
public bool ShowCommunityUsersType(CommunityUsersType userType, bool newValue) { XmlHelper.SetElementInnerText(this.XmlData.DocumentElement, string.Format("ShowCommunityUsersType{0}", (int)userType), newValue); return(newValue); }
public bool ShowCommunityUsersType(CommunityUsersType userType) { return(XmlHelper.GetElementValue(this.XmlData.DocumentElement, string.Format("ShowCommunityUsersType{0}", (int)userType), true)); }
protected void Page_Load(object sender, EventArgs e) { wizardId = Request.QueryString["WizardID"]; if (wizardId == "UserRegistration") { closedUserGroup = Helper.IsClosedUserGroup(); } PnlWiz.CssClass = SiteConfig.UsePopupWindows ? "wizardPopup" : "wizardWidget"; PnlWiz.ID = null; if (!string.IsNullOrEmpty(Request.QueryString["XCN"])) { communityId = !Request.QueryString["XCN"].IsGuid() ? DataObjectCommunity.GetCommunityIDByVirtualURL(Request.QueryString["XCN"]) : Request.QueryString["XCN"].ToGuid(); } if (!string.IsNullOrEmpty(Request.QueryString["OID"])) { objectId = Request.QueryString["OID"].ToGuid(); } if (!string.IsNullOrEmpty(Request.QueryString["Step"])) { stepNumber = int.Parse(Request.QueryString["Step"]); } wizard = WizardSection.CachedInstance.Wizards[wizardId]; if (wizard.AccessMode == AccessMode.Update) { _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.WizardEdit); } else if (string.IsNullOrEmpty(Request.QueryString["Flash"])) { _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.WizardInsert); } wizardSteps = wizard.Steps.LINQEnumarable.ToList(); if (wizardSteps.Count > 0 && stepNumber < wizardSteps.Count && ((wizard.NeedsAuthentication && Request.IsAuthenticated) || !wizard.NeedsAuthentication)) { CommunityUsersType communityUploadUsers = CommunityUsersType.Members; bool isOwner = false; bool isMember = false; if (communityId.HasValue) { Guid currentUserId = !string.IsNullOrEmpty(Request.QueryString["UI"]) ? Request.QueryString["UI"].ToGuid() : UserProfile.Current.UserId; DataObjectCommunity community = DataObject.Load <DataObjectCommunity>(communityId, null, true); if (community.State != ObjectState.Added) { communityUploadUsers = community.UploadUsers; } isOwner = DataAccess.Business.Community.GetIsUserOwner(currentUserId, communityId.Value, out isMember); if (communityUploadUsers == CommunityUsersType.Members && isMember) { communityAccessGranted = true; } else if (communityUploadUsers == CommunityUsersType.Owners && isOwner) { communityAccessGranted = true; } else { communityAccessGranted = false; } } RenderTabs(); RenderContent(); } }