Exemplo n.º 1
0
        private void RenderTitlePorletInDiv()
        {
            // Create div portlet header
            PSCPanel divHeader = new PSCPanel();

            divHeader.CssClass = "psc-divPortlet-Header";
            Controls.AddAt(0, divHeader);

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

            //Button Edit
            LiteralControl btnEdit = new LiteralControl();

            btnEdit.Text = string.Format("<img src='{0}' onclick=\"{1}\" title='Hiệu chỉnh Dữ liệu' class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletEditData.png", string.Format("PortletEditData('{0}');", Portlet.PortletInstance.Id), "ButtonImage", "Edit Portlet");
            divHeader.Controls.Add(btnEdit);

            //Button giao dien
            LiteralControl btnEditApperance = new LiteralControl();

            btnEditApperance.Text = string.Format("<img src='{0}' onclick=\"{1}\" title='Hiệu chỉnh CSS' class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletEditApperance.png", string.Format("PortletEditCSS('{0}');", Portlet.PortletInstance.Id), "ButtonImage", "Edit Portlet CSS");
            divHeader.Controls.Add(btnEditApperance);


            // Button Delete
            LiteralControl btnDelete = new LiteralControl();

            btnDelete.Text = string.Format("<img src='{0}' onclick=\"{1}\" title='Xóa Porlet' class='{2}' alt='{3}'/>", "/Systems/Engine/Images/PortletDelete.png", string.Format("PortletRemove('{0}','{1}');", Portlet.PortletInstance.Id, Portlet.PortletInstance.Name), "ButtonImage", "Remove Portlet");
            divHeader.Controls.Add(btnDelete);
        }
Exemplo n.º 2
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));
                }
            }
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
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);
        }