Exemple #1
0
        private PropertiesInfo FillObject(IDataRecord dr)
        {
            PropertiesInfo pi = null;

            if (dr != null)
            {
                pi                      = new PropertiesInfo();
                pi.PropertyId           = Convert.ToInt32(dr["PropertyId"].ToString());
                pi.PortalId             = Convert.ToInt32(dr["PortalId"].ToString());
                pi.ObjectType           = Convert.ToInt32(dr["ObjectType"].ToString());
                pi.ObjectOwnerId        = Convert.ToInt32(dr["ObjectOwnerId"].ToString());
                pi.Name                 = dr["Name"].ToString();
                pi.DataType             = dr["DataType"].ToString();
                pi.DefaultAccessControl = Convert.ToInt32(dr["DefaultAccessControl"].ToString());
                pi.IsHidden             = bool.Parse(dr["IsHidden"].ToString());
                pi.IsReadOnly           = bool.Parse(dr["IsReadOnly"].ToString());
                pi.IsRequired           = bool.Parse(dr["IsRequired"].ToString());
                pi.ValidationExpression = dr["ValidationExpression"].ToString();
                pi.ViewTemplate         = dr["ViewTemplate"].ToString();
                pi.EditTemplate         = dr["EditTemplate"].ToString();
                pi.SortOrder            = int.Parse(dr["SortOrder"].ToString());
                pi.DefaultValue         = dr["DefaultValue"].ToString();
            }
            return(pi);
        }
Exemple #2
0
        internal PropertiesInfo GetProperty(int PropertyId, int PortalId)
        {
            Data.PropertiesDB db = new Data.PropertiesDB();
            PropertiesInfo    pi = null;

            using (IDataReader dr = db.GetProperties(PropertyId, PortalId))
            {
                while (dr.Read())
                {
                    pi = FillObject(dr);
                }
                dr.Close();
            }
            return(pi);
        }
Exemple #3
0
        internal List <PropertiesInfo> ListProperties(int PortalId, int ObjectType, int ObjectOwnerId)
        {
            List <PropertiesInfo> list = new List <PropertiesInfo>();

            Data.PropertiesDB db = new Data.PropertiesDB();
            using (IDataReader dr = db.ListProperties(PortalId, ObjectType, ObjectOwnerId))
            {
                while (dr.Read())
                {
                    PropertiesInfo p = FillObject(dr);
                    if (p != null)
                    {
                        list.Add(p);
                    }
                }
                dr.Close();
            }
            return(list);
        }
Exemple #4
0
 internal PropertiesInfo SaveProperty(PropertiesInfo pi)
 {
     Data.PropertiesDB db = new Data.PropertiesDB();
     pi.PropertyId = db.SaveProperty(pi.PropertyId, pi.PortalId, pi.ObjectType, pi.ObjectOwnerId, pi.Name, pi.DataType, pi.DefaultAccessControl, pi.IsHidden, pi.IsRequired, pi.IsReadOnly, pi.ValidationExpression, pi.EditTemplate, pi.ViewTemplate, pi.SortOrder, pi.DefaultValue);
     return(GetProperty(pi.PropertyId, pi.PortalId));
 }
        private void LoadTopic()
        {
            ctlForm.EditorMode = Modules.ActiveForums.Controls.SubmitForm.EditorModes.EditTopic;
            var tc = new TopicsController();
            var ti = tc.Topics_Get(PortalId, ForumModuleId, TopicId, ForumId, UserId, true);
            if (ti == null)
            {
                Response.Redirect(NavigateUrl(ForumTabId));
            }
            else if ((ti.Content.AuthorId != UserId && _canModEdit == false) | (ti.Content.AuthorId == UserId && _canEdit == false) | (_canEdit == false && _canModEdit))
            {
                Response.Redirect(NavigateUrl(ForumTabId));
            }
            else if (!_canModEdit && (ti.Content.AuthorId == UserId && _canEdit && MainSettings.EditInterval > 0 & SimulateDateDiff.DateDiff(SimulateDateDiff.DateInterval.Minute, ti.Content.DateCreated, DateTime.Now) > MainSettings.EditInterval))
            {
                var im = new InfoMessage
                                        {
                                            Message =  "<div class=\"afmessage\">" +  string.Format(GetSharedResource("[RESX:Message:EditIntervalReached]"),  MainSettings.EditInterval) + "</div>"
                                        };
                plhMessage.Controls.Add(im);
                plhContent.Controls.Clear();
            }
            else
            {
                //User has acccess
                var sBody = ti.Content.Body;
                var sSubject = ti.Content.Subject;
                sBody = Utilities.PrepareForEdit(PortalId, ForumModuleId, ImagePath, sBody, _allowHTML, _editorType);
                sSubject = Utilities.PrepareForEdit(PortalId, ForumModuleId, ImagePath, sSubject, false, EditorTypes.TEXTBOX);
                ctlForm.Subject = sSubject;
                ctlForm.Summary = ti.Content.Summary;
                ctlForm.Body = sBody;
                ctlForm.AnnounceEnd = ti.AnnounceEnd;
                ctlForm.AnnounceStart = ti.AnnounceStart;
                ctlForm.Locked = ti.IsLocked;
                ctlForm.Pinned = ti.IsPinned;
                ctlForm.TopicIcon = ti.TopicIcon;
                ctlForm.Tags = ti.Tags;
                ctlForm.Categories = ti.Categories;
                ctlForm.IsApproved = ti.IsApproved;
                ctlForm.StatusId = ti.StatusId;
                ctlForm.TopicPriority = ti.Priority;

                if (ti.Author.AuthorId > 0)
                    ctlForm.Subscribe = Subscriptions.IsSubscribed(PortalId, ForumModuleId, ForumId, TopicId, SubscriptionTypes.Instant, ti.Author.AuthorId);

                _contentId = ti.ContentId;
                _authorId = ti.Author.AuthorId;

                if (!(string.IsNullOrEmpty(ti.TopicData)))
                {
                    var pl = new List<PropertiesInfo>();
                    var xDoc = new XmlDocument();
                    xDoc.LoadXml(ti.TopicData);

                    XmlNode xRoot = xDoc.DocumentElement;
                    if (xRoot != null)
                    {
                        var xNodeList = xRoot.SelectNodes("//properties/property");
                        if (xNodeList != null && xNodeList.Count > 0)
                        {
                            for (var i = 0; i < xNodeList.Count; i++)
                            {
                                var pName = Utilities.HTMLDecode(xNodeList[i].ChildNodes[0].InnerText);
                                var pValue = Utilities.HTMLDecode(xNodeList[i].ChildNodes[1].InnerText);
                                var xmlAttributeCollection = xNodeList[i].Attributes;
                                if (xmlAttributeCollection == null)
                                    continue;
                                var pId = Convert.ToInt32(xmlAttributeCollection["id"].Value);
                                var p = new PropertiesInfo {Name = pName, DefaultValue = pValue, PropertyId = pId};
                                pl.Add(p);
                            }
                        }
                    }

                    ctlForm.TopicProperties = pl;
                }

                if (ti.TopicType == TopicTypes.Poll)
                {
                    //Get Poll
                    var ds = DataProvider.Instance().Poll_Get(ti.TopicId);
                    if (ds.Tables.Count > 0)
                    {
                        var pollRow = ds.Tables[0].Rows[0];
                        ctlForm.PollQuestion = pollRow["Question"].ToString();
                        ctlForm.PollType = pollRow["PollType"].ToString();

                        foreach (DataRow dr in ds.Tables[1].Rows)
                            ctlForm.PollOptions += dr["OptionName"] + System.Environment.NewLine;
                    }
                }

                if (ti.Content.AuthorId != UserId && _canModApprove)
                    ctlForm.ShowModOptions = true;
            }
        }
		internal PropertiesInfo SaveProperty(PropertiesInfo pi)
		{
			Data.PropertiesDB db = new Data.PropertiesDB();
			pi.PropertyId = db.SaveProperty(pi.PropertyId, pi.PortalId, pi.ObjectType, pi.ObjectOwnerId, pi.Name, pi.DataType, pi.DefaultAccessControl, pi.IsHidden, pi.IsRequired, pi.IsReadOnly, pi.ValidationExpression, pi.EditTemplate, pi.ViewTemplate, pi.SortOrder, pi.DefaultValue);
			return GetProperty(pi.PropertyId, pi.PortalId);
		}
		private PropertiesInfo FillObject(IDataRecord dr)
		{
			PropertiesInfo pi = null;
			if (dr != null)
			{
				pi = new PropertiesInfo();
				pi.PropertyId = Convert.ToInt32(dr["PropertyId"].ToString());
				pi.PortalId = Convert.ToInt32(dr["PortalId"].ToString());
				pi.ObjectType = Convert.ToInt32(dr["ObjectType"].ToString());
				pi.ObjectOwnerId = Convert.ToInt32(dr["ObjectOwnerId"].ToString());
				pi.Name = dr["Name"].ToString();
				pi.DataType = dr["DataType"].ToString();
				pi.DefaultAccessControl = Convert.ToInt32(dr["DefaultAccessControl"].ToString());
				pi.IsHidden = bool.Parse(dr["IsHidden"].ToString());
				pi.IsReadOnly = bool.Parse(dr["IsReadOnly"].ToString());
				pi.IsRequired = bool.Parse(dr["IsRequired"].ToString());
				pi.ValidationExpression = dr["ValidationExpression"].ToString();
				pi.ViewTemplate = dr["ViewTemplate"].ToString();
				pi.EditTemplate = dr["EditTemplate"].ToString();
				pi.SortOrder = int.Parse(dr["SortOrder"].ToString());
				pi.DefaultValue = dr["DefaultValue"].ToString();
			}
			return pi;
		}