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));
        }
Exemplo n.º 2
0
        private void LoadCrucialLayoutInfo()
        {
            var header = Layouts.GetLayout("header");

            if (header == null)
            {
                throw new System.Exception("Build " + Name + "in engines.xml is missing a layout for \"header\".");
            }

            if (header.Size == 0)
            {
                throw new System.Exception("Header layout for build " + Name + "in engines.xml is missing a valid size attribute.");
            }
            HeaderSize = header.Size;

            if (!header.HasField("build string"))
            {
                throw new System.Exception("Header layout for build " + Name + "in engines.xml is missing a \"build string\" field.");
            }
            BuildStringOffset = header.GetFieldOffset("build string");
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!isReadOnly)
            {
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("/Services/WidgetService.asmx"));
            }

            // Show customization bar
            if (!string.IsNullOrEmpty(Request.QueryString["edit"]) && !isReadOnly)
            {
                if (Request.QueryString["edit"] == "content")
                {
                    CustomizationBarContent customizationBar = (CustomizationBarContent)LoadControl("~/UserControls/CustomizationBarContent.ascx");
                    customizationBar.ID          = "cb";
                    customizationBar.CommunityID = PageInfo.EffectiveCommunityId.Value;
                    PhCB.Controls.Add(customizationBar);
                }
                else if (Request.QueryString["edit"] == "style")
                {
                    CustomizationBarStyle customizationBar = (CustomizationBarStyle)LoadControl("~/UserControls/CustomizationBarStyle.ascx");
                    customizationBar.ID          = "cb";
                    customizationBar.CommunityID = PageInfo.EffectiveCommunityId.Value;
                    PhCB.Controls.Add(customizationBar);
                }

                // Show dialogs
                if (pageOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
                {
                    List <string> pageNames = new List <string>();
                    pageNames.Add("ProfileEditStyle");
                    List <Dialog> dialogs = DialogEngine.GetDialogByPageName(pageNames, UserProfile.Current.UserId);
                    if (dialogs.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (Dialog dialog in dialogs)
                        {
                            sb.AppendFormat("<div><b>{0}</b><br/>{1}</div>", dialog.Title, dialog.Content);
                            sb.AppendFormat("<div style=\"margin-top:10px;margin-bottom:10px;height:1px;background-color:#CCCCCC;\"></div>");
                        }
                        string content = Regex.Replace(sb.ToString(), "<(.*?)>", "&lt;$1&gt;"); // Ugly, but safari needs it
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "DialogWin", "SetPopupWindow('" + this.ClientID + "', 700, 0, 200, 'Mitteilungen', '" + content + "', true);", true);
                    }
                }
            }

            // Load tabbar
            if (pageOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("Community") || pageOrCommunity.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                TabBar tabBar = (TabBar)LoadControl("~/UserControls/TabBar.ascx");
                tabBar.ID              = "tb";
                tabBar.WDC             = wdc;
                tabBar.Pages           = pages;
                tabBar.CurrentPage     = currentPage;
                tabBar.IsOwner         = isOwner;
                tabBar.IsMember        = isMember;
                tabBar.PageOrCommunity = pageOrCommunity;
                tabBar.Community       = community;
                Ph.Controls.Add(tabBar);
            }

            // Load layout
            Layout layout = Layouts.GetLayout(community.CTY_Layout);

            if (layout == null)
            {
                layout = Layouts.GetLayout("Default");
                community.CTY_Layout = "Default";
                wdc.SubmitChanges();
                wdc.hisp_WidgetInstance_ReorderColumns(PageInfo.EffectiveCommunityId.Value, layout.NumberDropZones);
            }
            if (isReadOnly)
            {
                Ph2.Controls.Add(Page.ParseControl(layout.DisplayTemplate));
            }
            else
            {
                Ph2.Controls.Add(Page.ParseControl(layout.DragDropTemplate));
            }
            columnWidths = layout.ColumnWidths;
            columnPanels = new Panel[layout.NumberDropZones];
            for (int i = 0; i < columnPanels.Length; i++)
            {
                columnPanels[i] = (Panel)Ph2.FindControl("WCP" + i);
                if (!isReadOnly)
                {
                    columnPanels[i].Attributes["PageId"] = currentPage.PAG_ID.ToString();
                }
            }

            LoadWidgets();
        }
        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));
                }
            }
        }