Exemple #1
0
    private void CheckPermissionLoadControl(string PageSEOName)
    {
        PageSEOName = GetPageSEOName(PageSEOName);
        StringBuilder redirecPath = new StringBuilder();
        Uri           url         = HttpContext.Current.Request.Url;

        if (PageSEOName != string.Empty)
        {
            DataSet         dsPageSettings = new DataSet();
            SageFrameConfig sfConfig       = new SageFrameConfig();
            dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
            if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)     // Is Page Exists
            {
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) // Is Page Aceessable
                {
                    try
                    {
                        int userModuleID = Int32.Parse(ParamCollection[0]);
                        ComponentAdminControl(ParamCollection[1], userModuleID.ToString());
                    }
                    catch (Exception ex)
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.PageNotAccessibleURL);
                        HttpContext.Current.Response.Redirect(redirecPath.ToString());
                    }
                }
                else
                {
                    redirecPath.Append(url.Scheme);
                    redirecPath.Append("://");
                    redirecPath.Append(url.Authority);
                    redirecPath.Append(PortalAPI.PageNotAccessibleURL);
                    HttpContext.Current.Response.Redirect(redirecPath.ToString());
                }
            }
            else
            {
                redirecPath.Append(url.Scheme);
                redirecPath.Append("://");
                redirecPath.Append(url.Authority);
                redirecPath.Append(PortalAPI.PageNotFoundURL);
                HttpContext.Current.Response.Redirect(redirecPath.ToString());
            }
        }
    }
        private void BindModuleControls()
        {
            string preFix       = string.Empty;
            string paneName     = string.Empty;
            string ControlSrc   = string.Empty;
            string phdContainer = string.Empty;
            string PageSEOName  = "Webbuilder";
            //SageUserControl suc = new SageUserControl();
            //string PageName = "Webbuilder";// PagePath;
            //PagePath = "Webbuilder";
            //if (PagePath == null)
            //{
            //    PageName = PagePath;
            //}
            //else
            //{
            //    PageName = PagePath;
            //}
            //suc.PagePath = PageName;
            //if (PagePath != null)
            //{
            //    PageSEOName = GetPageSEOName(PagePath);
            //}
            //else
            //{
            //    SageFrameConfig sfConfig = new SageFrameConfig();
            //    PageSEOName = GetPageSEOName(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
            //}
            //:TODO: Need to get controlType and pageID from the selected page from routing path
            //string controlType = "0";
            //string pageID = "2";
            StringBuilder redirecPath = new StringBuilder();
            Uri           url         = HttpContext.Current.Request.Url;

            if (PageSEOName != string.Empty)
            {
                DataSet         dsPageSettings = new DataSet();
                SageFrameConfig sfConfig       = new SageFrameConfig();
                dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)     // Is Page Exists
                {
                    if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) // Is Page Aceessable
                    {
                        // Get ModuleControls data table
                        DataTable dtPages = dsPageSettings.Tables[1];
                        if (dtPages != null && dtPages.Rows.Count > 0)
                        {
                            OverridePageInfo(dtPages);
                        }
                        // Get ModuleDefinitions data table
                        DataTable dtPageModule = dsPageSettings.Tables[2];
                        if (dtPageModule != null && dtPageModule.Rows.Count > 0)
                        {
                            List <string> moduleDefIDList = new List <string>();
                            for (int i = 0; i < dtPageModule.Rows.Count; i++)
                            {
                                paneName = dtPageModule.Rows[i]["PaneName"].ToString();
                                if (string.IsNullOrEmpty(paneName))
                                {
                                    paneName = "ContentPane";
                                }
                                string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString();
                                ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString();
                                PlaceHolder phdPlaceHolder = (PlaceHolder)this.FindControl(paneName);
                                if (phdPlaceHolder != null)
                                {
                                    LoadControl(phdPlaceHolder, ControlSrc, paneName, UserModuleID, "", "", false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false, ParamCollection);
                                    string moduleDefID = paneName = dtPageModule.Rows[i]["ModuleDefID"].ToString();
                                    moduleDefIDList.Add(moduleDefID);
                                }
                            }
                            SetModuleDefList(moduleDefIDList);
                        }
                    }
                    else
                    {
                        if (!IsParent)
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.GetApplicationName);
                            redirecPath.Append("/portal/");
                            redirecPath.Append(GetPortalSEOName);
                            redirecPath.Append("/");
                            redirecPath.Append(PortalAPI.LoginPageWithExtension);
                        }
                        else
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.LoginURL);
                        }
                        string strCurrentURL = Request.Url.ToString();
                        if (redirecPath.ToString().Contains("?"))
                        {
                            redirecPath.Append("&ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        else
                        {
                            redirecPath.Append("?ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        HttpContext.Current.Response.Redirect(redirecPath.ToString());
                    }
                }
                else
                {
                    if (!IsParent)
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.GetApplicationName);
                        redirecPath.Append("/portal/");
                        redirecPath.Append(GetPortalSEOName);
                        redirecPath.Append("/");
                        redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension);
                    }
                    else
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.PageNotFoundURL);
                    }

                    Response.Redirect(ResolveUrl(redirecPath.ToString()));
                }
            }
        }
        private void BindModuleControls()
        {
            string          preFix       = string.Empty;
            string          paneName     = string.Empty;
            string          ControlSrc   = string.Empty;
            string          phdContainer = string.Empty;
            string          PageSEOName  = string.Empty;
            SageUserControl suc          = new SageUserControl();
            string          PageName     = PagePath;

            if (PagePath == null)
            {
                string PageUrl = Request.RawUrl;
                PageName = Path.GetFileNameWithoutExtension(PageUrl);
            }
            else
            {
                PageName = PagePath;
            }
            suc.PagePath = PageName;
            if (Request.QueryString["pgnm"] != null)
            {
                PageSEOName = Request.QueryString["pgnm"].ToString();
            }
            else
            {
                PageSEOName = GetPageSEOName(PageName);
            }
            //:TODO: Need to get controlType and pageID from the selected page from routing path
            //string controlType = "0";
            //string pageID = "2";
            StringBuilder redirecPath = new StringBuilder();
            Uri           url         = HttpContext.Current.Request.Url;

            if (PageSEOName != string.Empty)
            {
                DataSet         dsPageSettings = new DataSet();
                SageFrameConfig sfConfig       = new SageFrameConfig();
                dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)
                {
                    #region "Control Load Part"

                    if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true)
                    {
                        // Get ModuleControls data table
                        DataTable dtPages = dsPageSettings.Tables[1];
                        if (dtPages != null && dtPages.Rows.Count > 0)
                        {
                            OverridePageInfo(dtPages);
                        }
                        // Get ModuleDefinitions data table
                        DataTable dtPageModule = dsPageSettings.Tables[2];
                        if (dtPageModule != null && dtPageModule.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtPageModule.Rows.Count; i++)
                            {
                                paneName = dtPageModule.Rows[i]["PaneName"].ToString();
                                if (string.IsNullOrEmpty(paneName))
                                {
                                    paneName = "ContentPane";
                                }
                                string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString();
                                ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString();
                                string      SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString();
                                PlaceHolder phdPlaceHolder           = (PlaceHolder)this.FindControl(paneName);
                                if (paneName.Equals("navigation"))
                                {
                                    divNavigation.Attributes.Add("style", "display:block");
                                }
                                if (phdPlaceHolder != null)
                                {
                                    bool status = LoadModuleInfo(phdPlaceHolder, int.Parse(UserModuleID), 0);
                                    phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, UserModuleID, "", "", false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false);
                                    if (!status)
                                    {
                                        LoadModuleInfo(phdPlaceHolder, int.Parse(UserModuleID), 1);
                                    }
                                }
                            }
                        }
                    }

                    #endregion
                    else
                    {
                        if (GetPortalID > 1)
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.GetApplicationName);
                            redirecPath.Append("/portal/");
                            redirecPath.Append(GetPortalSEOName);
                            redirecPath.Append("/");
                            redirecPath.Append(PortalAPI.LoginPageWithExtension);
                        }
                        else
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.LoginURL);
                        }
                        string strCurrentURL = Request.Url.ToString();
                        if (redirecPath.ToString().Contains("?"))
                        {
                            redirecPath.Append("&ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        else
                        {
                            redirecPath.Append("?ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        Response.Redirect(redirecPath.ToString());
                    }
                }
                else
                {
                    if (GetPortalID > 1)
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.GetApplicationName);
                        redirecPath.Append("/portal/");
                        redirecPath.Append(GetPortalSEOName);
                        redirecPath.Append("/");
                        redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension);
                    }
                    else
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.PageNotFoundURL);
                    }
                    Response.Redirect(redirecPath.ToString());
                }
            }
        }
        private void BindModuleControls()
        {
            string          preFix       = string.Empty;
            string          paneName     = string.Empty;
            string          ControlSrc   = string.Empty;
            string          phdContainer = string.Empty;
            string          PageSEOName  = string.Empty;
            string          sufixClass   = string.Empty;
            SageUserControl suc          = new SageUserControl();
            string          PageName     = PagePath;

            if (PagePath == null)
            {
                PageName = PagePath;
            }
            else
            {
                PageName = PagePath;
            }
            suc.PagePath = PageName;
            if (PagePath != null)
            {
                PageSEOName = GetPageSEOName(PagePath);
            }
            else
            {
                SageFrameConfig sfConfig = new SageFrameConfig();
                PageSEOName = GetPageSEOName(sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
            }
            //:TODO: Need to get controlType and pageID from the selected page from routing path
            //string controlType = "0";
            //string pageID = "2";
            StringBuilder redirecPath = new StringBuilder();
            Uri           url         = HttpContext.Current.Request.Url;

            if (PageSEOName != string.Empty)
            {
                DataSet         dsPageSettings = new DataSet();
                SageFrameConfig sfConfig       = new SageFrameConfig();
                dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
                if (PageSEOName.ToLower() == "admin")
                {
                    divRightPanNav.Visible = true;
                }
                else
                {
                    divRightPanNav.Visible = false;
                }
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)     // Is Page Exists
                {
                    if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true) // Is Page Aceessable
                    {
                        // Get ModuleControls data table
                        DataTable dtPages = dsPageSettings.Tables[1];
                        if (dtPages != null && dtPages.Rows.Count > 0)
                        {
                            OverridePageInfo(dtPages);
                        }
                        // Get ModuleDefinitions data table
                        DataTable     dtPageModule    = dsPageSettings.Tables[2];
                        List <string> moduleDefIDList = new List <string>();
                        string        HeaderText      = string.Empty;

                        if (dtPageModule != null && dtPageModule.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtPageModule.Rows.Count; i++)
                            {
                                paneName   = dtPageModule.Rows[i]["PaneName"].ToString();
                                sufixClass = dtPageModule.Rows[i]["SuffixClass"].ToString();
                                HeaderText = dtPageModule.Rows[i]["HeaderText"].ToString();
                                if (!(dtPageModule.Rows[i]["ShowHeaderText"].ToString() == "True"))
                                {
                                    HeaderText = string.Empty;
                                }
                                if (string.IsNullOrEmpty(paneName))
                                {
                                    paneName = "ContentPane";
                                }
                                string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString();
                                ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString();
                                string      SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString();
                                PlaceHolder phdPlaceHolder           = (PlaceHolder)this.FindControl(paneName);
                                if (paneName.ToLower().Equals("navigation"))
                                {
                                    divNavigation.Attributes.Add("style", "display:block");
                                }
                                //if (paneName.ToLower().Equals("middlemaincurrent")) { divRight.Attributes.Add("style", "display:block"); }
                                //if (paneName.ToLower().Equals("lefta")) { divLeft.Attributes.Add("style", "display:block"); }
                                if (paneName.ToLower().Equals("cpanel"))
                                {
                                    divBottompanel.Attributes.Add("style", "display:block");
                                }
                                if (phdPlaceHolder != null)
                                {
                                    LoadControl(phdPlaceHolder, ControlSrc, paneName, UserModuleID, sufixClass, HeaderText, false, new HtmlGenericControl("div"), new HtmlGenericControl("span"), false, ParamCollection);
                                    moduleDefIDList.Add(dtPageModule.Rows[i]["ModuleDefID"].ToString());
                                }
                            }
                        }
                        SetModuleDefList(moduleDefIDList);
                    }
                    else
                    {
                        if (!IsParent)
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.GetApplicationName);
                            redirecPath.Append("/portal/");
                            redirecPath.Append(GetPortalSEOName);
                            redirecPath.Append("/");
                            redirecPath.Append(PortalAPI.LoginPageWithExtension);
                        }
                        else
                        {
                            redirecPath.Append(url.Scheme);
                            redirecPath.Append("://");
                            redirecPath.Append(url.Authority);
                            redirecPath.Append(PortalAPI.LoginURL);
                        }
                        string strCurrentURL = Request.Url.ToString();
                        if (redirecPath.ToString().Contains("?"))
                        {
                            redirecPath.Append("&ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        else
                        {
                            redirecPath.Append("?ReturnUrl=");
                            redirecPath.Append(strCurrentURL);
                        }
                        HttpContext.Current.Response.Redirect(redirecPath.ToString());
                    }
                }
                else
                {
                    if (!IsParent)
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.GetApplicationName);
                        redirecPath.Append("/portal/");
                        redirecPath.Append(GetPortalSEOName);
                        redirecPath.Append("/");
                        redirecPath.Append(PortalAPI.PageNotFoundPageWithExtension);
                    }
                    else
                    {
                        redirecPath.Append(url.Scheme);
                        redirecPath.Append("://");
                        redirecPath.Append(url.Authority);
                        redirecPath.Append(PortalAPI.PageNotFoundURL);
                    }

                    Response.Redirect(ResolveUrl(redirecPath.ToString()));
                }
            }
        }
Exemple #5
0
        private void BindModuleControls()
        {
            string          preFix       = string.Empty;
            string          paneName     = string.Empty;
            string          ControlSrc   = string.Empty;
            string          phdContainer = string.Empty;
            string          PageSEOName  = string.Empty;
            SageUserControl suc          = new SageUserControl();

            string PageName = PagePath;

            if (PagePath == null)
            {
                string PageUrl = Request.RawUrl;
                PageName = Path.GetFileNameWithoutExtension(PageUrl);
            }
            else
            {
                PageName = PagePath;
            }
            suc.PagePath = PageName;
            if (Request.QueryString["pgnm"] != null)
            {
                PageSEOName = Request.QueryString["pgnm"].ToString();
            }
            else
            {
                PageSEOName = GetPageSEOName(PageName);
            }
            //:TODO: Need to get controlType and pageID from the selected page from routing path
            //string controlType = "0";
            //string pageID = "2";
            string redirecPath = string.Empty;

            if (PageSEOName != string.Empty)
            {
                DataSet         dsPageSettings = new DataSet();
                SageFrameConfig sfConfig       = new SageFrameConfig();
                dsPageSettings = sfConfig.GetPageSettingsByPageSEONameForAdmin("1", PageSEOName, GetUsername);
                if (bool.Parse(dsPageSettings.Tables[0].Rows[0][0].ToString()) == true)
                {
                    if (bool.Parse(dsPageSettings.Tables[0].Rows[0][1].ToString()) == true)
                    {
                        // Get ModuleControls data table
                        DataTable dtPages = dsPageSettings.Tables[1];
                        if (dtPages != null && dtPages.Rows.Count > 0)
                        {
                            OverridePageInfo(dtPages);
                        }

                        // Get ModuleDefinitions data table
                        DataTable dtPageModule = dsPageSettings.Tables[2];
                        if (dtPageModule != null && dtPageModule.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtPageModule.Rows.Count; i++)
                            {
                                paneName = dtPageModule.Rows[i]["PaneName"].ToString();
                                if (string.IsNullOrEmpty(paneName))
                                {
                                    paneName = "ContentPane";
                                }
                                string UserModuleID = dtPageModule.Rows[i]["UserModuleID"].ToString();
                                ControlSrc = "/" + dtPageModule.Rows[i]["ControlSrc"].ToString();
                                string      SupportsPartialRendering = dtPageModule.Rows[i]["SupportsPartialRendering"].ToString();
                                PlaceHolder phdPlaceHolder           = (PlaceHolder)this.FindControl(paneName);
                                if (phdPlaceHolder != null)
                                {
                                    phdPlaceHolder = LoadControl(i.ToString(), bool.Parse(SupportsPartialRendering), phdPlaceHolder, ControlSrc, paneName, UserModuleID);
                                }
                                // AddModuleCssToPage(ControlSrc, false);
                            }
                        }
                    }
                    else
                    {
                        if (IsUseFriendlyUrls)
                        {
                            if (GetPortalID > 1)
                            {
                                redirecPath =
                                    ResolveUrl("~/portal/" + GetPortalSEOName + "/" +
                                               sfConfig.GetSettingsByKey(
                                                   SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx");
                            }
                            else
                            {
                                redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx");
                            }
                        }
                        else
                        {
                            redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible));
                        }
                        Response.Redirect(redirecPath);
                    }
                }
                else
                {
                    if (IsUseFriendlyUrls)
                    {
                        if (GetPortalID > 1)
                        {
                            redirecPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx");
                        }
                        else
                        {
                            redirecPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx");
                        }
                    }
                    else
                    {
                        redirecPath = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound));
                    }
                    Response.Redirect(redirecPath);
                }
            }

            HttpContext.Current.Session["ModuleCss"] = null;
            HttpContext.Current.Session["ModuleJs"]  = null;
        }