/// <summary>
        ///
        ///
        /// <div Id="psc-divWrapper">
        ///	<div Id="psc-divTop">TOP</div>
        ///	<div Id="psc-divMain">
        ///		<div Id="psc-divLeft">Left-sidebar</div>
        ///		<div Id="psc-divCenter">Main Content</div>
        ///		<div Id="psc-divRight">Right-sidebar</div>
        ///	</div>
        ///	<div Id="psc-divBottom">Bottom</div>
        /// </div>
        ///
        ///
        /// </summary>
        /// <param name="args"></param>
        /// <param name="enableEdit"></param>
        /// <returns></returns>
        public WebControl RenderDIV(IPanelArgs args, bool enableEdit)
        {
            PanelInPage pnTop    = Search(Panel.PANEL.Top);
            PanelInPage pnLeft   = Search(Panel.PANEL.Left);
            PanelInPage pnCenter = Search(Panel.PANEL.Center);
            PanelInPage pnRight  = Search(Panel.PANEL.Right);
            PanelInPage pnBottom = Search(Panel.PANEL.Bottom);

            //Create DIV Wrapper
            PSCPanel divWrapper = new PSCPanel();

            divWrapper.ID = string.Format("psc-divPanelWrapper");


            if (pnTop != null)
            {
                //Create DIV TOP
                PSCPanel divTop = new PSCPanel();
                divTop.ID = string.Format("psc-divPanelTop");
                //add divTop to wrapper
                divWrapper.Controls.Add(divTop);

                //Loading controls in divTop and add to divTop
                pnTop.LoadControlInDiv(null, enableEdit, divTop);
            }

            //Create DIV Main
            PSCPanel divMain = new PSCPanel();

            divMain.ID = string.Format("psc-divPanelMid");
            //add divMain to wrapper
            divWrapper.Controls.Add(divMain);



            if (pnLeft != null)
            {
                //Create DIV Left
                PSCPanel divLeft = new PSCPanel();
                divLeft.ID = string.Format("psc-divPanelLeft");

                //add divTop to DIV Main
                divMain.Controls.Add(divLeft);

                //Loading controls in divLeft
                pnLeft.LoadControlInDiv(null, enableEdit, divLeft);
            }


            //if (pnCenter != null)
            //{
            //Create divCenter
            PSCPanel divCenter = new PSCPanel();

            divCenter.ID = string.Format("psc-divPanelCenter");

            //add divCenter to DIV Main
            divMain.Controls.Add(divCenter);

            //Loading controls in divLeft
            pnCenter.LoadControlInDiv(args, enableEdit, divCenter);
            // }

            if (pnRight != null)
            {
                //Create divRight
                PSCPanel divRight = new PSCPanel();
                divRight.ID = string.Format("psc-divPanelRight");

                //add divRight to DIV Main
                divMain.Controls.Add(divRight);

                //Loading controls in divRight
                pnRight.LoadControlInDiv(null, enableEdit, divRight);
            }

            if (pnBottom != null)
            {
                //Create DIV Bottom
                PSCPanel divBottom = new PSCPanel();
                divBottom.ID = string.Format("psc-divPanelBottom");
                //add divBottom to wrapper
                divWrapper.Controls.Add(divBottom);

                //Loading controls in divBottom
                pnBottom.LoadControlInDiv(null, enableEdit, divBottom);
            }

            return(divWrapper);
        }
        public WebControl RenderTable(IPanelArgs args, bool enableEdit)
        {
            PanelInPage pnTop    = Search(Panel.PANEL.Top);
            PanelInPage pnLeft   = Search(Panel.PANEL.Left);
            PanelInPage pnCenter = Search(Panel.PANEL.Center);
            PanelInPage pnRight  = Search(Panel.PANEL.Right);
            PanelInPage pnBottom = Search(Panel.PANEL.Bottom);
            int         colSpan  = 1;
            Table       result   = new Table();

            result.CellPadding = 0;
            result.CellSpacing = 0;
            result.Width       = new Unit("100%");
            TableRow  rowTop  = new TableRow();
            TableCell cellTop = new TableCell();

            rowTop.Cells.Add(cellTop);
            if (pnTop != null)
            {
                result.Rows.Add(rowTop);
                cellTop.Controls.Add(pnTop.LoadControlInTable(null, enableEdit));
            }

            TableRow rowCenter = new TableRow();

            rowCenter.ID            = "rowCenter";
            rowCenter.VerticalAlign = VerticalAlign.Top;
            if (pnLeft != null)
            {
                TableCell cellLeft = new TableCell();
                rowCenter.Cells.Add(cellLeft);
                cellLeft.Controls.Add(pnLeft.LoadControlInTable(null, enableEdit));
                colSpan++;
            }
            TableCell cellCenter = new TableCell();

            rowCenter.Cells.Add(cellCenter);
            cellCenter.Controls.Add(pnCenter.LoadControlInTable(args, enableEdit));

            if (pnRight != null)
            {
                TableCell cellRight = new TableCell();
                rowCenter.Cells.Add(cellRight);
                cellRight.Controls.Add(pnRight.LoadControlInTable(null, enableEdit));
                colSpan++;
            }
            result.Rows.Add(rowCenter);

            TableRow  rowBottom  = new TableRow();
            TableCell cellBottom = new TableCell();

            rowBottom.Cells.Add(cellBottom);
            if (pnBottom != null)
            {
                result.Rows.Add(rowBottom);
                cellBottom.Controls.Add(pnBottom.LoadControlInTable(null, enableEdit));
            }

            cellTop.ColumnSpan    = colSpan;
            cellBottom.ColumnSpan = colSpan;
            return(result);
        }
示例#3
0
        public void LoadControlInDiv(IPanelArgs args, bool enableEdit, PSCPanel pannel)
        {
            //Create Div Edit

            if (enableEdit)
            {
                PSCPanel divEdit = new PSCPanel();
                divEdit.ID       = string.Format("psc-divPanel{0}-edit", _panel.ToString());
                divEdit.CssClass = "psc-divPanelEdit";
                pannel.Controls.Add(divEdit);

                //Title Pannel
                System.Web.UI.WebControls.Literal lblTitle = new System.Web.UI.WebControls.Literal();
                lblTitle.Text = string.Format("<span>{0}</span>", _panel.Name);
                divEdit.Controls.Add(lblTitle);

                //Button Edit
                System.Web.UI.WebControls.Literal btnEditApperance = new System.Web.UI.WebControls.Literal();
                btnEditApperance.Text = string.Format("<img id='{0}_btnEditApperance' title='Hiệu chỉnh Panel' src='/Systems/Engine/Images/PortletEditApperance.png' alt='Edit Apperance' onclick='PanelStyleGet(\"{0}\");'/>", _panel.Id, _panel.Id);
                divEdit.Controls.Add(btnEditApperance);

                //Button Remove
                System.Web.UI.WebControls.Literal btnRemove = new System.Web.UI.WebControls.Literal();
                btnRemove.Text = string.Format("<img id='{0}_btnRemove'  title='Xóa Panel' src='/Systems/Engine/Images/PortletDelete.png' alt='Remove Panel' onclick='PanelRemove(\"{1}\");'/>", _panel.Id, _panel.Id);
                divEdit.Controls.Add(btnRemove);
            }

            PSCPanel divContent = new PSCPanel();

            divContent.ID          = string.Format("psc-divPanel{0}-Content", _panel.ToString());
            divContent.Style.Value = "min-height: 30px;";
            pannel.Style.Value     = _style;
            pannel.Controls.Add(divContent);

            //Load Porlets into divContent
            if (args != null)
            {
                System.Web.UI.UserControl uc = new System.Web.UI.UserControl();
                divContent.Controls.Add(uc.LoadControl(args.Path));
            }
            else
            {
                foreach (PortletInstanceInPanel item in _portlets)
                {
                    //divContent.Controls.Add(item.RenderTable(enableEdit));


                    //Create div Portlet Wrapper
                    PSCPanel divPortletWrapper = new PSCPanel();
                    divPortletWrapper.ID          = string.Format("psc-divPortlet-{0}", item.PortletInstance.Id.ToString());
                    divPortletWrapper.Style.Value = item.Style;
                    divPortletWrapper.CssClass    = "psc-divPortlet-Wrapper";
                    divContent.Controls.Add(divPortletWrapper);

                    // Create div Portlet Header
                    if (enableEdit)
                    {
                        CreateDivPortletHeader(divPortletWrapper, item);
                    }

                    // Create div Portlet Content
                    PSCPanel divPortletContent = new PSCPanel();
                    //divPortletContent.ID = string.Format("psc-divPortlet-{0}", item.PortletInstance.Id.ToString());
                    divPortletContent.CssClass = "psc-divPortlet-Content";
                    divPortletWrapper.Controls.Add(divPortletContent);

                    divPortletContent.Controls.Add(item.RenderPortletDiv(enableEdit));
                }
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs eventArgs)
        {
            IPanelArgs args      = null;
            string     articleId = Page.RouteData.Values["Id"] != null ? Page.RouteData.Values["Id"].ToString() : Request.QueryString["ArticleId"];
            string     topicId   = Page.RouteData.Values["TopicId1"] != null ? Page.RouteData.Values["TopicId1"].ToString() : Request.QueryString["TopicId"];
            string     moduleId  = Page.RouteData.Values["ModuleId"] != null ? Page.RouteData.Values["ModuleId"].ToString() : Request.QueryString["ModuleId"];

            if (topicId != null)
            {
                int index = topicId.IndexOf("/");
                if (index > 0)
                {
                    topicId = topicId.Substring(0, index);
                }
                var topic = Topic.GetTopic(topicId);
                if (topic.PageId != PagePortal.Id)
                {
                    ChangePage(topic.PageId);
                }
                var topicArgs = new Engine.TopicArgs(topic.PageId);
                if (topic.Rss)
                {
                    Response.Redirect("~/Services/RssHandler.ashx?TopicId=" + topic.Id);
                }
                args = topicArgs;
            }
            else if (articleId != null)
            {
                int index  = articleId.IndexOf("/");
                int review = articleId.IndexOf("Preview");
                if (index > 0)
                {
                    articleId = articleId.Substring(0, index);
                }
                Article article = review > -1 ? Article.GetArticleUnPublish(articleId) : Article.GetArticle(articleId);
                if (article.PageId != PagePortal.Id)
                {
                    ChangePage(article.PageId);
                }
                var    articleArgs = new Engine.ArticleArgs();
                Layout layout      = LayoutCollection.GetPageLayOut(article.PageId).SingleOrDefault();
                if (layout != null)
                {
                    if (layout.Id != Guid.Empty)
                    {
                        articleArgs.Path = layout.NavigationUrl;  // ConfigurationManager.AppSettings["ArticleDisplay"] + layout.Name + ".ascx";
                    }
                }
                args = articleArgs;
            }
            else if (moduleId != null)
            {
                int index = moduleId.IndexOf("/");
                if (index > 0)
                {
                    moduleId = moduleId.Substring(0, index);
                }
                var moduleArgs = new ModuleDipslayArgs {
                    moduleId = moduleId
                };
                var moudule = Module.GetModule(moduleId);
                if (moudule.Id.ToString() == ConfigurationManager.AppSettings["ModuleAlbum"] ||
                    moudule.Id.ToString() == ConfigurationManager.AppSettings["ModuleVideoClip"] || moduleId == ConfigurationManager.AppSettings["ModuleSiteMap"])
                {
                    ChangePage(new Guid(SubDomain.GetPage(Libs.Ultility.GetSubDomain())));
                }
                else if (moudule.PageId != PagePortal.Id)
                {
                    ChangePage(moudule.PageId);
                }
                args = moduleArgs;
            }
            foreach (var control in Controls)
            {
                var phDisplay = control as PlaceHolder;
                if (phDisplay != null)
                {
                    //phDisplay.Controls.Add(PanelInPageList.RenderTable(args, false));
                    phDisplay.Controls.Add(PanelInPageList.RenderDIV(args, Edit));
                    break;
                }
            }
        }
示例#5
0
        public System.Web.UI.Control LoadControlInTable(IPanelArgs args, bool enableEdit)
        {
            PSCPanel result = new PSCPanel();

            result.ID = string.Format("pn{0}", _panel.ToString());
            PSCPanel pnTitle = new PSCPanel();

            pnTitle.ID = string.Format("pn{0}Title", _panel.ToString());

            System.Web.UI.WebControls.Table tblTitle = new System.Web.UI.WebControls.Table();
            tblTitle.CellPadding = 0;
            tblTitle.CellSpacing = 0;
            tblTitle.Width       = System.Web.UI.WebControls.Unit.Percentage(100);
            System.Web.UI.WebControls.TableRow rowTitle = new System.Web.UI.WebControls.TableRow();
            tblTitle.Rows.Add(rowTitle);
            System.Web.UI.WebControls.TableCell cellLeft = new System.Web.UI.WebControls.TableCell();
            System.Web.UI.WebControls.Image     imgLeft  = new System.Web.UI.WebControls.Image();
            imgLeft.ImageUrl = "~/Systems/Engine/Images/PanelTitleLeft.png";
            cellLeft.Controls.Add(imgLeft);
            cellLeft.Width  = System.Web.UI.WebControls.Unit.Pixel(18);
            cellLeft.Height = System.Web.UI.WebControls.Unit.Pixel(18);
            rowTitle.Cells.Add(cellLeft);

            System.Web.UI.WebControls.TableCell cellTitle = new System.Web.UI.WebControls.TableCell();
            cellTitle.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            System.Web.UI.WebControls.Label lblTitle = new System.Web.UI.WebControls.Label();
            lblTitle.Text = _panel.Name;
            cellTitle.Controls.Add(lblTitle);
            cellTitle.Style.Add(System.Web.UI.HtmlTextWriterStyle.BackgroundImage, "/Systems/Engine/Images/PanelTitleCenter.png");
            rowTitle.Cells.Add(cellTitle);


            System.Web.UI.WebControls.TableCell cellControls = new System.Web.UI.WebControls.TableCell();
            cellControls.Wrap = false;
            cellControls.Style.Add(System.Web.UI.HtmlTextWriterStyle.BackgroundImage, "/Systems/Engine/Images/PanelTitleCenter.png");

            System.Web.UI.WebControls.Literal btnEditApperance = new System.Web.UI.WebControls.Literal();
            btnEditApperance.Text = string.Format("<img id='{0}_btnEditApperance' src='/Systems/Engine/Images/PanelEditApperance.png' alt='Edit Apperance' onclick='PanelStyleGet(\"{0}\");'/>", _panel.Id, _panel.Id);
            cellControls.Controls.Add(btnEditApperance);

            if (_panel.Id != (int)Panel.PANEL.Center)
            {
                System.Web.UI.WebControls.Literal btnRemove = new System.Web.UI.WebControls.Literal();
                btnRemove.Text = string.Format("<img id='{0}_btnRemove' src='/Systems/Engine/Images/PanelDelete.png' alt='Remove Panel' onclick='PanelRemove(\"{1}\");'/>", _panel.Id, _panel.Id);
                cellControls.Controls.Add(btnRemove);
            }
            rowTitle.Cells.Add(cellControls);

            System.Web.UI.WebControls.TableCell cellRight = new System.Web.UI.WebControls.TableCell();
            System.Web.UI.WebControls.Image     imgRight  = new System.Web.UI.WebControls.Image();
            imgRight.ImageUrl = "~/Systems/Engine/Images/PanelTitleRight.png";
            cellRight.Controls.Add(imgRight);
            rowTitle.Cells.Add(cellRight);

            //bool enableEdit = true;
            if (enableEdit)
            {
                result.Controls.Add(pnTitle);
            }

            pnTitle.Controls.Add(tblTitle);

            PSCPanel pnMain = new PSCPanel();

            pnMain.ID          = string.Format("pn{0}Display", _panel.ToString());
            pnMain.Style.Value = _style;
            //add panel class for mobile
            pnMain.CssClass = "panelCss";
            if (pnMain.Style["width"] != null)
            {
                pnTitle.Width = System.Web.UI.WebControls.Unit.Parse(pnMain.Style["width"]);
            }

            if (args != null)
            {
                pnMain.Height = System.Web.UI.WebControls.Unit.Empty;
            }

            result.Controls.Add(pnMain);
            if (enableEdit)
            {
                pnMain.BorderStyle = System.Web.UI.WebControls.BorderStyle.Dotted;
                pnMain.BorderWidth = 1;
            }

            if (args != null)
            {
                System.Web.UI.UserControl uc = new System.Web.UI.UserControl();
                pnMain.Controls.Add(uc.LoadControl(args.Path));
            }
            else
            {
                foreach (PortletInstanceInPanel item in _portlets)
                {
                    pnMain.Controls.Add(item.RenderPortletTable(enableEdit));
                }
            }

            return(result);
        }