Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            PortalDefinition.Tab currentTab = PortalDefinition.GetCurrentTab();
            if (currentTab == null || currentTab.tabs == null)
            {
                return;
            }

            ArrayList tabList = new ArrayList();

            foreach (PortalDefinition.Tab t in currentTab.tabs)
            {
                ChannelUsers objUser = new ChannelUsers();
                if (objUser.HasViewRights(Page.User, t.roles))
                {
                    DisplayTabItem dt = new DisplayTabItem();
                    tabList.Add(dt);

                    dt.m_Text = t.title;
                    dt.m_URL  = "../../" + Portal.API.Config.GetTabURL(t.reference);
                }
            }
            Tabs.DataSource = tabList;
            Tabs.DataBind();
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = ConfigurationManager.AppSettings["icmsHeader"] ?? "NextCom Content Management System - NextCom.vn";

            // Kiem tra xem neu nguoi nay cua login thi quay ve trang Login.aspx
            if (Context.User.Identity.Name == "" && Context.Request.RawUrl.ToString().IndexOf("/login.aspx") == -1)
            {
                Response.Redirect("/login.aspx");
            }

            DateTime dt = DateTime.Now;
            TimeSpan ts = new TimeSpan(0, 30, 0);

            HttpCookie cookie1 = new HttpCookie("FileManager");

            cookie1.Values["PW"] = Crypto.EncryptByDay(Context.User.Identity.Name);
            cookie1.Expires      = dt.Add(ts);
            Response.Cookies.Add(cookie1);

            PortalDefinition.Tab _objCurrentTab = PortalDefinition.GetCurrentTab();

            if (_objCurrentTab != null)
            {
                if (_objCurrentTab.reference.IndexOf("office") < 0)
                {
                    Session.Remove("cpmode");
                }
            }
        }
Пример #3
0
        internal static Control GetEditControl(Page p)
        {
            PortalDefinition.Tab    tab = PortalDefinition.GetCurrentTab();
            PortalDefinition.Module m   = tab.GetModule(p.Request["ModuleRef"]);


            m.LoadModuleSettings();
            Module em = null;

            if (m.moduleSettings != null)
            {
                // Module Settings are present, use custom ascx Control
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + m.moduleSettings.editCtrl);
            }
            else
            {
                // Use default ascx control (Edit[type].ascx)
                em = (Module)p.LoadControl(Config.GetModuleVirtualPath(m.type) + "Edit" + m.type + ".ascx");
            }

            // Initialize the control
            em.InitModule(
                tab.reference,
                m.reference,
                m.type,
                Config.GetModuleVirtualPath(m.type),
                true);

            return(em);
        }
Пример #4
0
        /// <summary>
        /// Nạp chồng Thủ tục khởi tạo các điều khiển con
        /// </summary>
        override protected void CreateChildControls()
        {
            // Lấy thông tin Tab hiện thời
            PortalDefinition.Tab tab = PortalDefinition.GetCurrentTab();
            if (tab == null)
            {
                return;
            }

            // Kiểm tra quyền của người sử dụng
            ChannelUsers objuser = new ChannelUsers();

            // Edit by Tqdat
            // Xu ly viec khong de Session Timeout la BienTapvien out ra khoi fan Admin
            //  - Neu bi Session TimeOut thi kiem tra xem Cookie co ton tai User va Pass hay ko
            //      + Neu Co thi Login lai de lay lai session
            //      + Neu Khong thi Redirect ra trang login.aspx

            //bool isHasViewRights = objuser.HasViewRights(Page.User, tab.roles);

            /*if (isHasViewRights == false)
             * {
             *  // Kiem tra xem co Cookie hay ko
             *  HttpCookie cookie = Request.Cookies["PortalUser"];
             *  if (cookie != null)
             *  {
             *      objuser.Login(cookie.Values["AC"].Trim(), cookie.Values["PW"].Trim());
             *      isHasViewRights = true;
             *  }
             * }*/

            if (objuser.HasViewRights(Page.User, tab.roles))
            {
                RenderColumns(tab, tab.Columns, DisplayRegion);
                if (IsAdmin)
                {
                    // Hiển thị vùng trắng của các cột rỗng
                    foreach (HtmlTableCell _objEmptyColumn in _arrAllEmptyColumn)
                    {
                        LiteralControl _ltrSpace = new LiteralControl();
                        _ltrSpace.Text = "&nbsp;";
                        _objEmptyColumn.Controls.Add(_ltrSpace);
                    }
                }
            }
            else
            {
                Cache  cache           = new Cache(HttpContext.Current.Application);
                string path            = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
                string _strCacheKey    = Config.GetPortalUniqueCacheKey() + path + "_" + HttpContext.Current.User.Identity.Name;
                string _strCacheRawKey = Config.GetPortalUniqueCacheKey() + "_Raw" + HttpContext.Current.Request.RawUrl + "_" + HttpContext.Current.User.Identity.Name;
                cache[_strCacheKey]    = null;
                cache[_strCacheRawKey] = null;

                Session["NotPermission"] = "True";
                Session["lastPath"]      = HttpContext.Current.Request.RawUrl;
                Response.Redirect("/login.aspx");
            }
        }
Пример #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            tree.Elements.Clear();

            PortalDefinition pd = PortalDefinition.Load();

            InternalBuildTree(PortalDefinition.GetCurrentTab().tabs, tree.Elements);
        }
Пример #6
0
        protected void OnDeleteTab(object sender, EventArgs args)
        {
            PortalDefinition.Tab t = PortalDefinition.GetCurrentTab();
            PortalDefinition.DeleteTab(t.reference);

            if (t.parent == null)
            {
                Response.Redirect(Helper.GetTabLink(""));
            }
            else
            {
                Response.Redirect(Helper.GetTabLink(t.parent.reference));
            }
        }
Пример #7
0
        /// <summary>
        /// Nạp chồng Thủ tục khởi tạo các điều khiển con
        /// </summary>
        override protected void CreateChildControls()
        {
            // Lấy thông tin Tab hiện thời
            PortalDefinition.Tab tab = PortalDefinition.GetCurrentTab();
            if (tab == null)
            {
                return;
            }

            // Kiểm tra quyền của người sử dụng
            ChannelUsers objuser = new ChannelUsers();


            if (objuser.HasViewRights(Page.User, tab.roles))
            {
                // Tiến hành sinh mã cho các cột của Tab
                // Vùng bắt đầu là DisplayRegion.
                RenderColumns(tab, tab.Columns, DisplayRegion);
            }
            else
            {
                // Add by tqdat
                Cache  cache           = new Cache(HttpContext.Current.Application);
                string path            = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
                string _strCacheKey    = Config.GetPortalUniqueCacheKey() + path + "_" + HttpContext.Current.User.Identity.Name;
                string _strCacheRawKey = Config.GetPortalUniqueCacheKey() + "_Raw" + HttpContext.Current.Request.RawUrl + "_" + HttpContext.Current.User.Identity.Name;
                cache[_strCacheKey]    = null;
                cache[_strCacheRawKey] = null;
                Session["lastPath"]    = HttpContext.Current.Request.RawUrl;


                // Neu khong duoc fep access vao hoac Mat Session thi redirect ve trang Login

                Response.Redirect("/login.aspx");
            }
        }
Пример #8
0
        /// <summary>
        /// Hàm trợ giúp tìm kiếm mã tham chiếu đến chuyên san hiện thời từ mã tham chiếu của Tab đang đượ hiển thị
        /// </summary>
        /// <returns>Mã tham chiếu đến chuyên san hiện thời</returns>
        public static int GetCurrentEditionTypeID()
        {
            // Biến lưu trữ mã của chuyên san hiện thời
            int _intCurrentEditionTypeID = 0;

            string _strCurrentTabRef = System.Web.HttpContext.Current.Request.QueryString["TabRef"];

            //string mrs = Config.GetPortalUniqueCacheKey() + "CurrentEditionTypeID_" + (_strCurrentTabRef == null ? "" : _strCurrentTabRef);
            // Tìm kiếm trong Cache
            //if (System.Web.HttpContext.Current.Cache[mrs] != null) _intCurrentEditionTypeID = (int)System.Web.HttpContext.Current.Cache[mrs];
            //if(_intCurrentEditionTypeID > 0) return _intCurrentEditionTypeID;

            // Nạp thông tin Tab hiện thời
            PortalDefinition.Tab _objCurrentTab = PortalDefinition.GetCurrentTab();

            if (_objCurrentTab != null)
            {
                // Lấy mã tham chiếu của Tab đang dc hiển thị
                string _strTabRef     = _objCurrentTab.reference;
                string _strEditionRef = "";

                // Tìm vị trí dấu chấm đầu tiên
                int _intLastDotPos = _strTabRef.IndexOf('.');

                if (_intLastDotPos > 0)
                {
                    // Tách lấy phần tên đại diện trên URL của chuyên san
                    _strEditionRef = _objCurrentTab.reference.Substring(0, _intLastDotPos);
                }
                else
                {
                    // Nếu không có dấu chấm thì lấy toàn bộ mã tham chiếu của Tab
                    _strEditionRef = _objCurrentTab.reference;
                }

                // Lấy thông tin về chuyên san
                EditionTypeRow _objCurrentEditionType = null;
                using (MainDB _objDB = new MainDB()) {
                    _objCurrentEditionType = _objDB.EditionTypeCollection.GetRow("EditionDisplayURL = '" + _strEditionRef + "'");
                }

                if (_objCurrentEditionType != null)
                {
                    // Tìm thấy chuyên san thì trả về mã tham chiếu của chuyên san
                    _intCurrentEditionTypeID = _objCurrentEditionType.EditionType_ID;
                }
                else
                {
                    // Nếu không tìm thấy chuyên san thì trả về mã tham chiếu của chuyên san đầu tiên trong danh sách chuyên san
                    EditionTypeRow[] _arrCurrentEditionTypes = null;
                    using (MainDB _objDB = new MainDB()) {
                        _arrCurrentEditionTypes = _objDB.EditionTypeCollection.GetTopAsArray(1, "", "EditionType_ID");
                    }
                    if (_arrCurrentEditionTypes != null && _arrCurrentEditionTypes.Length > 0)
                    {
                        _intCurrentEditionTypeID = _arrCurrentEditionTypes[0].EditionType_ID;
                    }
                }
            }

            // Lưu mã của chuyên san hiện thời vào Cache
            //System.Web.HttpContext.Current.Cache.Insert(mrs, _intCurrentEditionTypeID);

            // Trả về 1 nếu không tìm thấy bất kỳ chuyên san nào trong danh sách -- Đã chỉnh sửa để loại bỏ cache vào ngày 05-08
            //edited by trangnva
            return(_intCurrentEditionTypeID);//1
        }