示例#1
0
        public string LoadMarkers(Dictionary <string, string> objectTypesAndTags)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var objectTypeAndTags in objectTypesAndTags)
            {
                QuickParameters quickParameters = new QuickParameters();
                quickParameters.Udc             = UserDataContext.GetUserDataContext();
                quickParameters.ObjectType      = Common.Helper.GetObjectTypeNumericID(objectTypeAndTags.Key);
                quickParameters.Tags1           = QuickParameters.GetDelimitedTagIds(objectTypeAndTags.Value, ',');
                quickParameters.Amount          = 500;
                quickParameters.DisablePaging   = true;
                quickParameters.OnlyGeoTagged   = true;
                quickParameters.ShowState       = ObjectShowState.Published;
                quickParameters.QuerySourceType = QuerySourceType.Page;
                var dataObjects = DataObjects.Load <DataObject>(quickParameters);
                foreach (var dataObject in dataObjects.DistinctBy((x, y) => x.Geo_Lat + x.Geo_Long == y.Geo_Lat + y.Geo_Long))
                {
                    string tag = string.Empty;
                    foreach (var currentTag in objectTypeAndTags.Value.Split(','))
                    {
                        if (!string.IsNullOrEmpty(currentTag) && dataObject.TagList.ToLower().Contains(currentTag.ToLower()))
                        {
                            tag = "_" + currentTag.ToLower();
                        }
                    }
                    sb.AppendLine(string.Format("AddMapMarker({0}, {1}, '{2}', '{3}', '{4}');", dataObject.Geo_Lat, dataObject.Geo_Long, tag, dataObject.ObjectID, dataObject.ObjectType));
                }
            }

            return(sb.ToString());
        }
示例#2
0
        private IRepeater LoadMyObjects(int pageSize, bool showPagerTop, bool showPagerBottom, int amount, QuickSort sortBy, string repeater, string template, int relatedObjectType, string tagList, Guid?excludeObjectId)
        {
            DataObject community = DataObject.Load <DataObject>(this.CommunityID);

            QuickParameters paras = new QuickParameters();

            paras.Udc              = UserDataContext.GetUserDataContext();
            paras.ObjectType       = relatedObjectType;
            paras.Tags1            = QuickParameters.GetDelimitedTagIds(tagList, Constants.TAG_DELIMITER);
            paras.ExcludeObjectIds = excludeObjectId.ToString();
            if (amount >= 0)
            {
                paras.Amount = amount;
            }
            paras.PageNumber    = 1;
            paras.PageSize      = pageSize;
            paras.DisablePaging = (!showPagerTop && !showPagerBottom);
            paras.SortBy        = QuickSort.Title;
            if (sortBy == QuickSort.Title)
            {
                paras.Direction = QuickSortDirection.Asc;
            }
            paras.IgnoreCache   = false;
            paras.WithCopy      = false;
            paras.OnlyConverted = true;
            paras.ShowState     = ObjectShowState.Published;

            Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater);

            IRepeater overview = ctrl as IRepeater;

            if (overview != null)
            {
                overview.QuickParameters    = paras;
                overview.OutputTemplate     = template;
                overview.TopPagerVisible    = showPagerTop;
                overview.BottomPagerVisible = showPagerBottom;
            }

            ISettings settings = ctrl as ISettings;

            if (settings != null)
            {
                if (settings.Settings == null)
                {
                    settings.Settings = new System.Collections.Generic.Dictionary <string, object>();
                }

                if (!settings.Settings.ContainsKey("ParentPageType"))
                {
                    settings.Settings.Add("ParentPageType", (int)_Host.ParentPageType);
                }

                settings.Settings.Add("Width", _Host.ColumnWidth);
            }

            return(overview);
        }
示例#3
0
        protected void lbtnSR_Click(object sender, EventArgs e)
        {
            template = Helper.GetObjectType(objectType).SearchForSelectCtrl;

            Guid            UserID = UserProfile.Current.UserId;
            QuickParameters qp     = new QuickParameters();

            qp.Direction = QuickSortDirection.Desc;
            qp.SortBy    = QuickSort.StartDate;

            qp.Title       = TxtSearch.Text;
            qp.Description = TxtSearch.Text;

            string[] tagLists = TxtTagword.Text.ToLower().Replace("  ", " ").Replace(" or ", "¦").Split('¦');
            if (tagLists.Length > 0)
            {
                qp.Tags1 = QuickParameters.GetDelimitedTagIds(tagLists[0].Trim().Replace(" ", Constants.TAG_DELIMITER.ToString()), Constants.TAG_DELIMITER);
            }
            if (tagLists.Length > 1)
            {
                qp.Tags2 = QuickParameters.GetDelimitedTagIds(tagLists[1].Trim().Replace(" ", Constants.TAG_DELIMITER.ToString()), Constants.TAG_DELIMITER);
            }
            if (tagLists.Length > 2)
            {
                qp.Tags3 = QuickParameters.GetDelimitedTagIds(tagLists[2].Trim().Replace(" ", Constants.TAG_DELIMITER.ToString()), Constants.TAG_DELIMITER);
            }

            qp.Udc               = UserDataContext.GetUserDataContext();
            qp.ObjectType        = Helper.GetObjectTypeNumericID(objectType);
            qp.ShowState         = ObjectShowState.Published;
            qp.DisablePaging     = true;
            qp.CatalogSearchType = DBCatalogSearchType.ContainsTable;

            if (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                qp.Udc         = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERID);
                qp.CommunityID = null;
                qp.Communities = null;
                qp.UserID      = UserID;
            }
            //If its a CMSPage Search  Text  is the name of an object that is in any Public community
            else if (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Page"))
            {
                qp.Udc         = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERID);
                qp.CommunityID = null;
                qp.Communities = null;
                qp.UserID      = null;
            }
            else if (ParentDataObject.ObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                qp.Udc         = UserDataContext.GetUserDataContext();
                qp.CommunityID = ParentDataObject.CommunityID;
            }

            this.OBJOVW.DataSource = DataObjects.LoadByReflection(qp);
            this.OBJOVW.DataBind();
        }
示例#4
0
 public void InitializeFromQueryString()
 {
     if (!objectType.HasValue)
     {
         objectType = !String.IsNullOrEmpty(Request.QueryString["T"]) ? Helper.GetObjectType(Request.QueryString["T"]).NumericId : Helper.GetObjectType("Picture").NumericId;
     }
     if (string.IsNullOrEmpty(communityIds))
     {
         communityIds = Request.QueryString["C"] ?? string.Empty;
     }
     if (string.IsNullOrEmpty(searchWord))
     {
         searchWord = Request.QueryString["W"] ?? string.Empty;
     }
     if (!showMyContentOnly.HasValue)
     {
         showMyContentOnly = (!string.IsNullOrEmpty(Request.QueryString["I"]) && Request.QueryString["I"] == "true") ? true : false;
     }
     if (string.IsNullOrEmpty(tagList))
     {
         tagList = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL1"], ',');
     }
 }
        public override bool ShowObject(string settingsXml)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(settingsXml);

            int  dataSource     = 1;
            bool saveObjectType = false;
            bool manageSiblings = false;

            string objectType = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ObjectType", "0");
            string userId     = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "UserId", string.Empty);
            string communitId = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "CommunityId", string.Empty);
            string parentOID  = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ParentOID", string.Empty);

            int       pageSize        = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MaxNumber", 5);
            QuickSort sortBy          = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.StartDate);
            bool      showPagerTop    = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true);
            bool      showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true);
            int       featured        = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Featured", 0);
            bool      renderHtml      = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RenderHtml", false);
            bool      byUrl           = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true);

            if (objectType == "0")
            {
                if (string.IsNullOrEmpty(Request.QueryString["OT"]))
                {
                    return(false);
                }
                else
                {
                    objectType = Request.QueryString["OT"];
                }
            }
            else
            {
                saveObjectType = true;
            }

            string template = "SmallOutputObject.ascx";
            string repeater = "DataObjectLists.ascx";

            if (WidgetHost.OutputTemplate != null)
            {
                if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl))
                {
                    template = WidgetHost.OutputTemplate.OutputTemplateControl;
                }

                if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl))
                {
                    repeater = WidgetHost.OutputTemplate.RepeaterControl;
                }
            }

            QuickParameters paras = new QuickParameters();

            if (XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Anonymous", false))
            {
                paras.Udc = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERNAME);
            }
            else
            {
                paras.Udc = UserDataContext.GetUserDataContext();
            }

            paras.ObjectType = Helper.GetObjectTypeNumericID(objectType);

            if (featured > 0)
            {
                paras.Featured = featured;
            }

            if (dataSource != 4)
            {
                paras.Tags1 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList1", string.Empty), Constants.TAG_DELIMITER);
                paras.Tags2 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList2", string.Empty), Constants.TAG_DELIMITER);
                paras.Tags3 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList3", string.Empty), Constants.TAG_DELIMITER);
            }

            if (dataSource == 0)
            {
                DataObject profil = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID);
                paras.UserID = profil.UserID;
                byUrl        = false;
            }
            else if (!string.IsNullOrEmpty(userId))
            {
                paras.UserID = userId.ToGuid();
            }
            else if (dataSource == 2)
            {
                paras.Communities = communitId.Replace(",", "|");
            }
            else if (dataSource == 3)
            {
                paras.CommunityID = this.WidgetHost.ParentCommunityID;
            }
            else if (dataSource == 4)
            {
                DataObject detail = DataObject.Load <DataObject>(Request.QueryString["OID"].ToGuid());
                paras.CommunityID = detail.CommunityID;
                //paras.ExcludeObjectIds = detail.ObjectID.ToString();
                byUrl          = false;
                manageSiblings = true;
            }
            else if (byUrl && WidgetHost.ParentPageType == PageType.Detail)
            {
                parentOID = Request.QueryString["OID"];
            }
            else if (dataSource != 1)
            {
                return(false);
            }

            xmlDocument = null;

            if (!showPagerTop && !showPagerBottom)
            {
                paras.Amount = pageSize;
            }

            paras.PageNumber    = 1;
            paras.PageSize      = pageSize;
            paras.DisablePaging = (!showPagerTop && !showPagerBottom);
            paras.SortBy        = sortBy;
            if (sortBy == QuickSort.Title)
            {
                paras.Direction = QuickSortDirection.Asc;
            }
            paras.IgnoreCache   = false;
            paras.WithCopy      = false;
            paras.OnlyConverted = true;
            paras.ShowState     = ObjectShowState.Published;

            if (byUrl)
            {
                paras.FromNameValueCollection(Request.QueryString);
                if (saveObjectType)
                {
                    paras.ObjectType     = Helper.GetObjectTypeNumericID(objectType);
                    paras.RelationParams = new RelationParams();

                    // override the OID parameter if there is Relation Parent OID set in the URL (used for scenarios where a detail view shouldn't left -> Chreisgleis.tv)
                    if (!string.IsNullOrEmpty(Request.QueryString["rpoid"]))
                    {
                        paras.RelationParams.ParentObjectID = Request.QueryString["rpoid"].ToGuid();
                    }
                    else
                    {
                        paras.RelationParams.ParentObjectID = paras.ObjectID;
                    }

                    paras.ObjectID    = null;
                    paras.CommunityID = null;
                }
            }
            if (!string.IsNullOrEmpty(parentOID))
            {
                paras.RelationParams = new RelationParams();
                paras.RelationParams.ParentObjectID = parentOID.ToGuid();;
                paras.ObjectID    = null;
                paras.CommunityID = null;
            }

            IRepeater overview = CreateControl(paras, showPagerTop, showPagerBottom, repeater, template, manageSiblings, renderHtml);

            if (overview != null)
            {
                this.Ph.Controls.Add((Control)overview);
                return(overview.HasContent);
            }

            return(false);
        }
示例#6
0
        public override bool ShowObject(string settingsXml)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(settingsXml);

            int  dataSource     = 1;
            bool saveObjectType = false;
            bool manageSiblings = false;
            bool byUrl          = true;

            if (WidgetHost.ParentPageType == PageType.None)
            {
                if (WidgetHost.ParentObjectType == 1)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3);
                }
                else if (WidgetHost.ParentObjectType == 19)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0);
                }

                byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", false);
            }
            else if (WidgetHost.ParentPageType == PageType.Overview || WidgetHost.ParentPageType == PageType.Homepage)
            {
                if (WidgetHost.ParentObjectType == 1)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3);
                }
                else if (WidgetHost.ParentObjectType == 19)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0);
                }
                byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true);
            }
            else if (WidgetHost.ParentPageType == PageType.Detail)
            {
                if (WidgetHost.ParentObjectType == 1)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3);
                }
                else if (WidgetHost.ParentObjectType == 19)
                {
                    dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0);
                }
                else if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
                {
                    dataSource = 4;
                }
                byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true);
            }
            else
            {
                dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 1);
                byUrl      = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", false);
            }

            string             objectType      = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ObjectType", "0");
            string             userId          = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "UserId", string.Empty);
            string             communitId      = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "CommunityId", string.Empty);
            int                pageSize        = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MaxNumber", 5);
            QuickSort          sortBy          = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.StartDate);
            QuickSortDirection sortDirection   = (QuickSortDirection)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortDirection", (int)QuickSortDirection.Desc);
            bool               showPagerTop    = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true);
            bool               showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true);
            int                featured        = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Featured", 0);
            DateConstraint     dateConstraint  = (DateConstraint)Enum.Parse(typeof(DateConstraint), XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DateConstraint", "None"));
            bool               renderHtml      = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RenderHtml", false);

            if (objectType == "0")
            {
                if (string.IsNullOrEmpty(Request.QueryString["OT"]))
                {
                    return(false);
                }
                else
                {
                    objectType = Request.QueryString["OT"];
                }
            }
            else
            {
                saveObjectType = true;
            }

            string template = "SmallOutputObject.ascx";
            string repeater = "DataObjectLists.ascx";

            if (WidgetHost.OutputTemplate != null)
            {
                if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl))
                {
                    template = WidgetHost.OutputTemplate.OutputTemplateControl;
                }

                if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl))
                {
                    repeater = WidgetHost.OutputTemplate.RepeaterControl;
                }
            }

            QuickParameters paras = new QuickParameters();

            if (WidgetHost.ParentObjectType == 1) // Community
            {
                paras.QuerySourceType = QuerySourceType.Community;
            }
            else if (WidgetHost.ParentObjectType == 19)  // Profile
            {
                paras.QuerySourceType = QuerySourceType.Profile;
            }
            else if (WidgetHost.ParentObjectType == 20) // Page
            {
                paras.QuerySourceType = QuerySourceType.Page;
            }
            else
            {
                paras.QuerySourceType = QuerySourceType.MyContent;
            }

            if (XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Anonymous", false))
            {
                paras.Udc = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERNAME);
            }
            else
            {
                paras.Udc = UserDataContext.GetUserDataContext();
            }

            paras.ObjectType = Helper.GetObjectTypeNumericID(objectType);

            if (featured > 0)
            {
                paras.Featured = featured;
            }

            if (dataSource != 4)
            {
                paras.Tags1 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList1", string.Empty), Constants.TAG_DELIMITER);
                paras.Tags2 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList2", string.Empty), Constants.TAG_DELIMITER);
                paras.Tags3 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList3", string.Empty), Constants.TAG_DELIMITER);
            }

            if (dataSource == 0)
            {
                DataObject profil = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID);
                paras.UserID = profil.UserID;
                byUrl        = false;
            }
            else if (!string.IsNullOrEmpty(userId))
            {
                paras.UserID = userId.ToGuid();
            }
            else if (dataSource == 2)
            {
                paras.Communities = communitId.Replace(",", "|");
            }
            else if (dataSource == 3)
            {
                paras.CommunityID = this.WidgetHost.ParentCommunityID;
            }
            else if (dataSource == 4)
            {
                DataObject detail = DataObject.Load <DataObject>(Request.QueryString["OID"].ToGuid());
                paras.CommunityID = detail.CommunityID;
                //paras.ExcludeObjectIds = detail.ObjectID.ToString();
                byUrl          = false;
                manageSiblings = true;
            }
            else if (dataSource != 1)
            {
                return(false);
            }

            if ((!showPagerTop && !showPagerBottom) || sortBy == QuickSort.Random)
            {
                paras.Amount        = pageSize;
                paras.DisablePaging = true;
                if (sortBy == QuickSort.Random)
                {
                    paras.IgnoreCache = true;
                }
            }
            else
            {
                paras.PageNumber = 1;
                paras.PageSize   = pageSize;
            }

            paras.SortBy    = sortBy;
            paras.Direction = sortDirection;

            paras.ShowState = ObjectShowState.Published;

            switch (dateConstraint)
            {
            case DateConstraint.UntilYesterday:
                paras.FromStartDate    = SqlDateTime.MinValue.Value;
                paras.ToStartDate      = DateTime.Today.GetEndOfDay() - new TimeSpan(1, 0, 0, 0);
                paras.FromEndDate      = SqlDateTime.MinValue.Value;
                paras.ToEndDate        = DateTime.Today.GetEndOfDay() - new TimeSpan(1, 0, 0, 0);
                paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange;
                break;

            case DateConstraint.UntilToday:
                paras.FromStartDate    = SqlDateTime.MinValue.Value;
                paras.ToStartDate      = DateTime.Today.GetEndOfDay();
                paras.FromEndDate      = SqlDateTime.MinValue.Value;
                paras.ToEndDate        = DateTime.Today.GetEndOfDay();
                paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange;
                break;

            case DateConstraint.Today:
                paras.FromStartDate    = SqlDateTime.MinValue.Value;
                paras.ToStartDate      = DateTime.Today.GetEndOfDay();
                paras.FromEndDate      = DateTime.Today.GetStartOfDay();
                paras.ToEndDate        = SqlDateTime.MaxValue.Value;
                paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange;
                break;

            case DateConstraint.FromToday:
                paras.FromStartDate    = DateTime.Today.GetStartOfDay();
                paras.ToStartDate      = SqlDateTime.MaxValue.Value;
                paras.FromEndDate      = DateTime.Today.GetStartOfDay();
                paras.ToEndDate        = SqlDateTime.MaxValue.Value;
                paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange;
                break;

            case DateConstraint.FromTomorrow:
                paras.FromStartDate    = DateTime.Today.GetStartOfDay() + new TimeSpan(1, 0, 0, 0);
                paras.ToStartDate      = SqlDateTime.MaxValue.Value;
                paras.FromEndDate      = DateTime.Today.GetStartOfDay() + new TimeSpan(1, 0, 0, 0);
                paras.ToEndDate        = SqlDateTime.MaxValue.Value;
                paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange;
                break;
            }

            if (byUrl)
            {
                paras.FromNameValueCollection(Request.QueryString);
                if (saveObjectType)
                {
                    paras.ObjectType = Helper.GetObjectTypeNumericID(objectType);
                }
            }

            if (paras.SortBy != QuickSort.Title && paras.SortBySecond == QuickSort.NotSorted)
            {
                paras.SortBySecond    = QuickSort.Title;
                paras.DirectionSecond = QuickSortDirection.Asc;
            }

            IRepeater overview = CreateControl(paras, showPagerTop, showPagerBottom, repeater, template, manageSiblings, renderHtml);

            if (overview != null)
            {
                this.Ph.Controls.Add((Control)overview);
                return(overview.HasContent);
            }

            return(false);
        }
示例#7
0
        private IRepeater LoadMyObjects(int pageSize, bool showPagerTop, bool showPagerBottom, QuickSort sortBy, QuickSortDirection sortDirection, string repeater, string template, int relatedObjectType, string tagList, Guid?excludeObjectId)
        {
            DataObject community = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID);

            QuickParameters paras = new QuickParameters();

            paras.Udc        = UserDataContext.GetUserDataContext();
            paras.ObjectType = relatedObjectType;
            paras.Tags1      = QuickParameters.GetDelimitedTagIds(tagList, Constants.TAG_DELIMITER);

            if ((!showPagerTop && !showPagerBottom) || sortBy == QuickSort.Random)
            {
                paras.Amount        = pageSize;
                paras.DisablePaging = true;
                if (sortBy == QuickSort.Random)
                {
                    paras.IgnoreCache = true;
                }
            }
            else
            {
                paras.PageNumber = 1;
                paras.PageSize   = pageSize;
            }

            paras.SortBy    = sortBy;
            paras.Direction = sortDirection;
            if (paras.SortBy != QuickSort.Title && paras.SortBySecond == QuickSort.NotSorted)
            {
                paras.SortBySecond    = QuickSort.Title;
                paras.DirectionSecond = QuickSortDirection.Asc;
            }

            paras.ShowState = ObjectShowState.Published;

            Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater);

            IRepeater overview = ctrl as IRepeater;

            if (overview != null)
            {
                overview.QuickParameters    = paras;
                overview.OutputTemplate     = template;
                overview.TopPagerVisible    = showPagerTop;
                overview.BottomPagerVisible = showPagerBottom;
            }

            ISettings settings = ctrl as ISettings;

            if (settings != null)
            {
                if (settings.Settings == null)
                {
                    settings.Settings = new System.Collections.Generic.Dictionary <string, object>();
                }

                if (!settings.Settings.ContainsKey("ParentPageType"))
                {
                    settings.Settings.Add("ParentPageType", (int)WidgetHost.ParentPageType);
                }

                settings.Settings.Add("Width", WidgetHost.ColumnWidth - WidgetHost.ContentPadding);
                settings.Settings.Add("SelectCurrentPage", true);
                settings.Settings.Add("WidgetInstanceId", WidgetHost.WidgetInstance.INS_ID.ToString());
            }

            return(overview);
        }
示例#8
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ScriptManager.GetCurrent(Page).Scripts.Add(new ScriptReference(string.Format("http://maps.google.com/maps/api/js?sensor=false")));
            ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("/Services/GoogleMapServices.asmx"));

            PnlMap.Attributes.Add("style", string.Format("float:left;width:{0}px", Width));
            PnlMap.ID   = null;
            LitMap.Text = string.Format("<div id=\"mapCanvas\" style=\"width:{0}px;height:{1}px;\"></div>", Width, Height);

            string onMapLoadScript = string.Empty;

            if (MapLayout == MapLayout.SidebarAndMap)
            {
                LoadSidebar();
                HasContent      = true;
                PnlNavi.Visible = true;
                PnlNavi.ID      = null;
            }
            else if (MapLayout == MapLayout.MapOnly)
            {
                StringBuilder sb = new StringBuilder();

                if (ObjectId.HasValue || QuickParameters != null)
                {
                    List <DataObject> dataObjects = new List <DataObject>();
                    ObjectTypesAndTags = new List <MapObjectTypeElement>();
                    if (ObjectId.HasValue)
                    {
                        dataObjects.Add(DataObject.Load <DataObject>(ObjectId));
                        if (dataObjects[0].Geo_Lat != double.MinValue)
                        {
                            Latitude   = dataObjects[0].Geo_Lat;
                            Longitude  = dataObjects[0].Geo_Long;
                            HasContent = true;
                        }
                    }
                    else if (QuickParameters != null)
                    {
                        dataObjects = DataObjects.Load <DataObject>(QuickParameters);
                        if (dataObjects.Count > 0)
                        {
                            HasContent = true;
                        }
                    }
                    foreach (var dataObject in dataObjects.DistinctBy((x, y) => x.Geo_Lat + x.Geo_Long == y.Geo_Lat + y.Geo_Long))
                    {
                        sb.AppendLine(string.Format("AddMapMarker({0}, {1}, '{2}', '{3}', '{4}');", dataObject.Geo_Lat, dataObject.Geo_Long, string.Empty, dataObject.ObjectID, dataObject.ObjectType));
                        SiteObjectType objectType = Helper.GetObjectType(dataObject.ObjectType);
                        if (!ObjectTypesAndTags.Exists(x => x.Id == objectType.Id))
                        {
                            ObjectTypesAndTags.Add(new MapObjectTypeElement()
                            {
                                Id = objectType.Id, IconUrl = objectType.MapIcon
                            });
                        }
                    }
                }
                else if (ObjectTypesAndTags != null)
                {
                    foreach (var objectType in ObjectTypesAndTags)
                    {
                        QuickParameters quickParameters = new QuickParameters();
                        quickParameters.Udc             = UserDataContext.GetUserDataContext();
                        quickParameters.ObjectType      = Common.Helper.GetObjectTypeNumericID(objectType.Id);
                        quickParameters.Tags1           = QuickParameters.GetDelimitedTagIds(string.Join(",", objectType.Tags.LINQEnumarable.Select(x => x.Id).ToArray()), ',');
                        quickParameters.Amount          = 500;
                        quickParameters.DisablePaging   = true;
                        quickParameters.OnlyGeoTagged   = true;
                        quickParameters.ShowState       = ObjectShowState.Published;
                        quickParameters.QuerySourceType = QuerySourceType.Page;
                        var dataObjects = DataObjects.Load <DataObject>(quickParameters);
                        if (dataObjects.Count > 0)
                        {
                            HasContent = true;
                        }
                        foreach (var dataObject in dataObjects.DistinctBy((x, y) => x.Geo_Lat + x.Geo_Long == y.Geo_Lat + y.Geo_Long))
                        {
                            string tag = string.Empty;
                            foreach (var currentTag in objectType.Tags.LINQEnumarable.Select(x => x.Id))
                            {
                                if (!string.IsNullOrEmpty(currentTag) && dataObject.TagList.ToLower().Contains(currentTag.ToLower()))
                                {
                                    tag = "_" + currentTag.ToLower();
                                }
                            }
                            sb.AppendLine(string.Format("AddMapMarker({0}, {1}, '{2}', '{3}', '{4}');", dataObject.Geo_Lat, dataObject.Geo_Long, tag, dataObject.ObjectID, dataObject.ObjectType));
                        }
                    }
                }

                onMapLoadScript = sb.ToString();
            }

            StringBuilder loadScript = new StringBuilder();

            loadScript.AppendLine("<script type=\"text/javascript\">");
            loadScript.AppendLine("AttachEvent(window, \"load\", initialize);");
            loadScript.AppendLine("var map;");
            loadScript.AppendLine("var mapTree;");
            loadScript.AppendLine("var mapMarkers = new Object();");
            loadScript.AppendLine("var mapMarkerOptions = new Object();");
            loadScript.AppendLine("var mapObjectTypes;");
            loadScript.AppendLine("var mapInfoWindow = new google.maps.InfoWindow();");
            if (MapLayout == MapLayout.SidebarAndMap)
            {
                loadScript.AppendLine("function OnMapNavigationLoad() {");
                loadScript.AppendLine("  mapTree = $find('" + Rtv.ClientID + "');");
                loadScript.AppendLine("  if(map != null) OnMapNavigationChange();");
                loadScript.AppendLine("};");
            }
            loadScript.AppendLine("function initialize() {");
            loadScript.AppendLine("  var mapOptions = {");
            loadScript.AppendLine("    zoom: " + Zoom + ",");
            loadScript.AppendLine("    center: new google.maps.LatLng(" + Latitude + "," + Longitude + "),");
            switch (MapStyle)
            {
            case MapStyle.Road:
                loadScript.AppendLine("    mapTypeId: google.maps.MapTypeId.ROADMAP,");
                break;

            case MapStyle.Aerial:
                loadScript.AppendLine("    mapTypeId: google.maps.MapTypeId.SATELLITE,");
                break;

            case MapStyle.Hybrid:
                loadScript.AppendLine("    mapTypeId: google.maps.MapTypeId.HYBRID,");
                break;

            case MapStyle.Terrain:
                loadScript.AppendLine("    mapTypeId: google.maps.MapTypeId.TERRAIN,");
                break;
            }
            switch (MapNaviation)
            {
            case MapNavigation.Small:
                loadScript.AppendLine("    style: google.maps.NavigationControlStyle.SMALL");
                break;

            default:
                loadScript.AppendLine("    style: google.maps.NavigationControlStyle.DEFAULT");
                break;
            }
            loadScript.AppendLine("  };");
            loadScript.AppendLine("  map = new google.maps.Map(document.getElementById(\"mapCanvas\"), mapOptions);");
            loadScript.AppendLine("  mapMarkerOptions['0'] = { icon: new google.maps.MarkerImage('/library/images/map/default.png', new google.maps.Size(20, 34)), shadow: new google.maps.MarkerImage('/library/images/map/shadow.png', new google.maps.Size(34, 34), new google.maps.Point(0,0), new google.maps.Point(10, 34)) };");
            if (ObjectTypesAndTags != null)
            {
                foreach (var objectType in ObjectTypesAndTags)
                {
                    loadScript.AppendLine("  mapMarkerOptions['" + Helper.GetObjectTypeNumericID(objectType.Id) + "'] = { icon: new google.maps.MarkerImage('" + objectType.IconUrl + "', new google.maps.Size(20, 34)) };");
                    foreach (MapObjectTypeTagElement tag in objectType.Tags)
                    {
                        loadScript.AppendLine("  mapMarkerOptions['" + Helper.GetObjectTypeNumericID(objectType.Id) + "_" + tag.Id.ToLower() + "'] = { icon: new google.maps.MarkerImage('" + tag.IconUrl + "', new google.maps.Size(20, 34)) };");
                    }
                }
                loadScript.AppendLine("  mapObjectTypes = new Array('" + string.Join("', '", ObjectTypesAndTags.ConvertAll(x => x.Id).ToArray()) + "');");
            }
            loadScript.AppendLine("  " + onMapLoadScript);
            if (MapLayout == MapLayout.SidebarAndMap)
            {
                loadScript.AppendLine("  if(mapTree != null) OnMapNavigationChange();");
            }
            loadScript.AppendLine("};");
            loadScript.AppendLine("</script>");
            LitScript.Text = loadScript.ToString();
        }
示例#9
0
        protected override void OnInit(EventArgs e)
        {
            _4screen.CSB.Extensions.Business.TrackingManager.TrackEventPage(null, null, IsPostBack, LogSitePageType.Notification);

            Pages.Popups.UserControls.Notification notification = this.LoadControl("/Pages/Popups/UserControls/Notification.ascx") as Pages.Popups.UserControls.Notification;
            notification.ID = "NOT";

            if (!string.IsNullOrEmpty(Request.QueryString["OID"]))
            {
                notification.ObjectID = Request.QueryString["OID"].ToGuid();
            }
            if (!string.IsNullOrEmpty(Request.QueryString["UI"]))
            {
                notification.ObjectID = Request.QueryString["UI"].ToGuid();
                notification.UserID   = Request.QueryString["UI"].ToGuid();
            }
            string paramCtyId = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["CN"]))
            {
                paramCtyId = Request.QueryString["CN"];

                if (!paramCtyId.IsGuid())
                {
                    notification.ObjectID = notification.CommunityID = DataObjectCommunity.GetCommunityIDByVirtualURL(paramCtyId);
                }
                else
                {
                    notification.ObjectID = notification.CommunityID = paramCtyId.ToGuid();
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OT"]))
            {
                notification.ObjectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OTS"]))
            {
                string[] objectTypesArray = Request.QueryString["OTS"].Split(',');
                int[]    objectTypes      = new int[objectTypesArray.Length];
                for (int i = 0; i < objectTypesArray.Length; i++)
                {
                    objectTypes[i] = Helper.GetObjectTypeNumericID(objectTypesArray[i]);
                }
                notification.ObjectTypes = objectTypes;
            }

            List <TagWord> tagWords = new List <TagWord>();

            if (!string.IsNullOrEmpty(Request.QueryString["TGL1"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL1"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 1
                    });
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["TGL2"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL2"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 2
                    });
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["TGL3"]))
            {
                string[] tagWordIDs = QuickParameters.GetDelimitedTagIds(Request.QueryString["TGL3"], ',').Split('|');
                foreach (string tagWordID in tagWordIDs)
                {
                    tagWords.Add(new TagWord()
                    {
                        TagID = tagWordID, GroupID = 3
                    });
                }
            }
            notification.TagWords = tagWords;

            ph.Controls.Add(notification);
            base.OnInit(e);
        }