Exemplo n.º 1
0
        /// <summary>
        /// Ham thuc hien Them mot tab moi khi them mot category. Tabref duoc tinh va chuyen theo dang
        /// Edition.CatParent.Subcat
        /// </summary>
        /// <param name="_EditionRef">Thong tin ve edition ref</param>
        /// <param name="_ParentRef">Thong tin ve catparent reFt</param>
        /// <param name="_NewRef">Thong tin ve ref cua cat moi</param>
        /// <param name="_NewTabTitle">Tieu de cua tab</param>
        public void AddCategoryTab(string _EditionRef, string _ParentRef, string _NewRef, string _NewTabTitle)
        {
            PortalDefinition _objPortal    = PortalDefinition.Load();
            string           strCurrTabRef = _EditionRef;

            if (_ParentRef != "")
            {
                strCurrTabRef += "." + _ParentRef;
            }
            PortalDefinition.Tab _objCurrentCategoryTab = _objPortal.GetTab(strCurrTabRef);

            if (_objCurrentCategoryTab == null)
            {
                PortalDefinition.Tab t = PortalDefinition.Tab.Create();
                t.reference = strCurrTabRef;
                t.title     = strCurrTabRef;

                _objPortal.tabs.Add(t);
                _objCurrentCategoryTab = _objPortal.GetTab(strCurrTabRef);
            }

            if (_objCurrentCategoryTab != null)
            {
                PortalDefinition.Tab      _newtab      = PortalDefinition.Tab.Create(_NewRef);
                PortalDefinition.ViewRole _objViewRole = new PortalDefinition.ViewRole();
                _objViewRole.name = Portal.API.Config.EveryoneRoles;
                _newtab.roles.Add(_objViewRole);
                _newtab.title     = _NewTabTitle;
                _newtab.reference = strCurrTabRef + "." + _NewRef;                //EditionRef+"."+_ParentRef
                _objCurrentCategoryTab.tabs.Add(_newtab);
                _objPortal.Save();
            }
        }
Exemplo n.º 2
0
        public void LoadData(string tabRef, string moduleRef)
        {
            CurrentTabReference = tabRef;
            CurrentReference    = moduleRef;

            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab    t = pd.GetTab(CurrentTabReference);
            PortalDefinition.Module m = t.GetModule(CurrentReference);

            if (null != m)
            {
                txtTitle.Text     = HttpUtility.HtmlDecode(m.title);
                txtReference.Text = m.reference;

                cbType.ClearSelection();
                ListItem li = cbType.Items.FindByValue(m.type);
                if (li != null)
                {
                    li.Selected = true;
                }

                RolesCtrl.LoadData(m.roles);
            }
            else
            {
                Response.Redirect(Config.MainPage);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Load Protal Definition and the current Tab
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab currentTab = pd.GetTab(Request["TabRef"]);
            if (currentTab == null)
            {
                return;
            }

            // Great, we are a top level Tab
            if (currentTab.parent == null)
            {
                return;
            }

            ArrayList tabList = new ArrayList();

            while (currentTab != null)
            {
                DisplayTabItem dt = new DisplayTabItem();
                tabList.Insert(0, dt);

                dt.m_Text = currentTab.title;
                dt.m_URL  = "~/" + Portal.API.Config.GetTabURL(currentTab.reference);

                // one up...
                currentTab = currentTab.parent;
            }

            // Bind Repeater
            tabpath.DataSource = tabList;
            tabpath.DataBind();
        }
        public void SelectTab(string reference)
        {
            PortalDefinition pd = PortalDefinition.Load();

            CurrentReference = reference;
            if (reference == "") // Root Node
            {
                //Hidden TemplateEdit and TabEdit when load first time
                TabCtrl.Visible     = false;
                TabListCtrl.Visible = true;

                //Load data to TabList
                CurrentParentReference = "";
                TabListCtrl.LoadData(pd);
            }
            else
            {
                //Hidden Template control when edit Tab
                TemplateCtrl.Visible     = false;
                TemplateListCtrl.Visible = false;

                PortalDefinition.Tab t = pd.GetTab(reference);
                CurrentParentReference = t.parent != null ? t.parent.reference : "";
                TabListCtrl.LoadData(t);
                TabCtrl.Visible = true;
                TabCtrl.LoadData(reference);
            }
        }
        public PortalDefinition.Tab getTab(string tabRef)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(tabRef);
            return(t);
        }
Exemplo n.º 6
0
        protected void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (Page.IsValid)
                {
                    // Save
                    PortalDefinition        pd = PortalDefinition.Load();
                    PortalDefinition.Tab    t  = pd.GetTab(CurrentTabReference);
                    PortalDefinition.Module m  = t.GetModule(CurrentReference);

                    m.reference = txtReference.Text;
                    m.title     = HttpUtility.HtmlEncode(txtTitle.Text);
                    m.type      = cbType.SelectedItem.Value;
                    m.roles     = RolesCtrl.GetData();

                    pd.Save();

                    CurrentReference = m.reference;

                    if (Save != null)
                    {
                        Save(this, new EventArgs());
                    }
                }
            }
            catch (Exception e)
            {
                lbError.Text = e.Message;
            }
        }
Exemplo n.º 7
0
        internal void AddModule(ModuleList list)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentReference);

            PortalDefinition.Module m = new PortalDefinition.Module();
            m.reference = Guid.NewGuid().ToString();

            if (list == ModuleListCtrl_Left)
            {
                t.left.Add(m);
            }
            else if (list == ModuleListCtrl_Middle)
            {
                t.middle.Add(m);
            }
            else if (list == ModuleListCtrl_Right)
            {
                t.right.Add(m);
            }

            pd.Save();

            // Rebind
            LoadData(CurrentReference);

            EditModule(m.reference);
        }
//		internal void MoveTabUp(int index)
        override public void MoveTabUp(int index)
        {
            if (index <= 0)
            {
                return;
            }

            PortalDefinition pd = PortalDefinition.Load();
            ArrayList        a  = null;

            if (CurrentReference == "")
            {
                // Root
                a = pd.tabs;
            }
            else
            {
                PortalDefinition.Tab pt = pd.GetTab(CurrentReference);
                a = pt.tabs;
            }

            PortalDefinition.Tab t = (PortalDefinition.Tab)a[index];
            a.RemoveAt(index);
            a.Insert(index - 1, t);

            pd.Save();

            // Rebind
            BuildTree();
            SelectTab(CurrentReference);
        }
        protected void btnBindModuleEditForm_Click(object sender, EventArgs e)
        {
            string tab = (string)ViewState["TabReference"];

            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(tab);

            string arg        = Request.Form["pageArg"];
            string moduleRef  = string.Empty;
            string moduleType = string.Empty;
            string columnRef  = string.Empty;
            string title      = string.Empty;

            if (arg.Split("$".ToCharArray()).Length == 4)
            {
                moduleRef  = arg.Split("$".ToCharArray())[0];
                moduleType = arg.Split("$".ToCharArray())[1];
                title      = arg.Split("$".ToCharArray())[2];
                columnRef  = arg.Split("$".ToCharArray())[3];
            }
            else
            {
                return;
            }

            PortalDefinition.Column column = pd.GetColumn(columnRef);

            if (moduleRef == null || moduleRef == string.Empty || moduleRef.ToLower() == "null")
            {
                module       = PortalDefinition.Module.Create();
                module.type  = moduleType;
                module.title = title;
                moduleRef    = module.reference;
            }
            else
            {
                module           = new PortalDefinition.Module();
                module.type      = moduleType;
                module.title     = title;
                module.reference = moduleRef;
            }

            if (module != null)
            {
                module.LoadModuleSettings();
                module.LoadRuntimeProperties();

                moduleSettings        = module.moduleSettings;
                moduleRuntimeSettings = module.moduleRuntimeSettings;

                lblModuleType.Text = moduleType;
                txtReference.Text  = module.reference;


                rptRuntimeProperties.DataSource = module.GetRuntimePropertiesSource(true);
                rptRuntimeProperties.DataBind();
                upEditModuleForm.Update();
            }
        }
        internal void MoveTabDown(int idx)
        {
            PortalDefinition pd = PortalDefinition.Load();
            ArrayList        a  = null;

            if (CurrentReference == "")
            {
                // Root
                a = pd.tabs;
            }
            else
            {
                PortalDefinition.Tab pt = pd.GetTab(CurrentReference);
                a = pt.tabs;
            }

            if (idx >= a.Count - 1)
            {
                return;
            }

            PortalDefinition.Tab t = (PortalDefinition.Tab)a[idx];
            a.RemoveAt(idx);
            a.Insert(idx + 1, t);

            pd.Save();

            // Rebind
            BuildTree();
            SelectTab(CurrentReference);
        }
Exemplo n.º 11
0
        internal void MoveModuleDown(int idx, ModuleList list)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentReference);

            ArrayList a = null;

            if (list == ModuleListCtrl_Left)
            {
                a = t.left;
            }
            else if (list == ModuleListCtrl_Middle)
            {
                a = t.middle;
            }
            else if (list == ModuleListCtrl_Right)
            {
                a = t.right;
            }

            if (idx >= a.Count - 1)
            {
                return;
            }

            PortalDefinition.Module m = (PortalDefinition.Module)a[idx];
            a.RemoveAt(idx);
            a.Insert(idx + 1, m);

            pd.Save();

            // Rebind
            LoadData(CurrentReference);
        }
Exemplo n.º 12
0
        protected void OnSaveTemplate(object sender, EventArgs args)
        {
            //Load PortalDefinition to get current Tab and Load TemplateDefinition to Save template
            PortalDefinition _objPortal = PortalDefinition.Load();

            PortalDefinition.Tab _objCurrentTab = _objPortal.GetTab(CurrentReference);

            if (_objCurrentTab != null)
            {
                try
                {
                    //Save to PortalDefinition
                    _objPortal.TemplateColumns   = _objCurrentTab.Columns;
                    _objPortal.TemplateReference = _objCurrentTab.reference;
                    _objPortal.Save();

                    //Save to TemplateDefinition
                    TemplateDefinition          _objTemplate = TemplateDefinition.Load();
                    TemplateDefinition.Template t            = new TemplateDefinition.Template();

                    t.reference = txtReference.Text;
                    t.type      = Definition.CT_TYPE_TEMPLATE;
                    t.Columns   = _objCurrentTab.Columns;
                    _objTemplate.templates.Add(t);

                    _objTemplate.Save();
                }
                catch (Exception e)
                {
                    lbError.Text = e.Message;
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Lưu các thiết lập của Module
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (Page.IsValid)
                {
                    // Nạp cấu trúc Portal
                    PortalDefinition     pd = PortalDefinition.Load();
                    PortalDefinition.Tab t  = pd.GetTab(CurrentTabReference);
                    // Truy xuất đến cấu trúc Module hiện thời
                    PortalDefinition.Module m = t.GetModule(CurrentReference);

                    // Thay đổi các thông số tương ứng
                    m.reference = txtReference.Text;
                    m.title     = HttpUtility.HtmlEncode(txtTitle.Text);
                    m.type      = cboPath.SelectedValue + "/" + cbType.SelectedItem.Value;
                    m.roles     = RolesCtrl.GetData();
                    m.CacheTime = Convert.ToInt32(txtCacheTime.Text);

                    // Lưu các thông số và cấu trúc
                    pd.Save();

                    // Lưu các thông số khi thực thi của module
                    m.LoadModuleSettings();
                    m.LoadRuntimeProperties();
                    for (int _intPropertyCount = 0; _intPropertyCount < rptRuntimeProperties.Items.Count; _intPropertyCount++)
                    {
                        HtmlInputHidden _hihPropertyName   = rptRuntimeProperties.Items[_intPropertyCount].FindControl("lblPropertyName") as HtmlInputHidden;
                        TextBox         _txtPropertyValue  = rptRuntimeProperties.Items[_intPropertyCount].FindControl("txtPropertyValue") as TextBox;
                        DropDownList    _drdAvaiableValues = rptRuntimeProperties.Items[_intPropertyCount].FindControl("drdAvaiableValues") as DropDownList;

                        if (_hihPropertyName != null && _txtPropertyValue != null)
                        {
                            string _strPropertyValue = _txtPropertyValue.Visible ? _txtPropertyValue.Text : _drdAvaiableValues.SelectedValue;
                            m.moduleRuntimeSettings.SetRuntimePropertyValue(true, _hihPropertyName.Value, _strPropertyValue);
                        }
                    }
                    m.SaveRuntimeSettings();

                    CurrentReference = m.reference;

                    // Phát sinh sự kiện lưu thông tin thành công
                    if (Save != null)
                    {
                        Save(this, new EventArgs());
                    }
                }
            }
            catch (Exception e)
            {
                lbError.Text = e.Message;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Ham thuc hien luu cac response xuong html cache file
        /// </summary>
        protected void OnAddTab(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = PortalDefinition.Tab.Create();

            pd.GetTab(Request["TabRef"]).tabs.Add(t);

            pd.Save();

            Response.Redirect(Helper.GetEditTabLink(t.reference));
        }
Exemplo n.º 15
0
        protected void OnDelete(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentReference);
            PortalDefinition.DeleteTab(CurrentReference);

            if (Delete != null)
            {
                Delete(this, t);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Thủ tục cập nhật lại mã tham chiếu của thẻ tương ứng với đề mục đã sửa
        /// Thủ tục này được gọi khi người sử dụng thay đổi đường dẫn hiển thị trên URL của một đề mục nào đó.
        /// </summary>
        /// <param name="_strOldTabRef">Mã tham chiếu cũ, dùng để tìm ra thẻ hiện thời ứng với đề mục cần sửa</param>
        /// <param name="_strNewTabRef">Mã</param>
        /// <param name="_strNewTabTitle"></param>
        private void SyncCategoryTab(string _strOldTabRef, string _strNewTabRef, string _strNewTabTitle)
        {
            PortalDefinition _objPortal = PortalDefinition.Load();

            PortalDefinition.Tab _objCurrentCategoryTab = _objPortal.GetTab(_strOldTabRef);

            if (_objCurrentCategoryTab != null)
            {
                _objCurrentCategoryTab.title     = _strNewTabTitle;
                _objCurrentCategoryTab.reference = _strNewTabRef;
                _objPortal.Save();
            }
        }
Exemplo n.º 17
0
        protected void OnCancel(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentReference);

            if (Cancel != null)
            {
                Cancel(this, t);
            }

            LoadData(CurrentReference);
            ShowModulesList();
        }
Exemplo n.º 18
0
        public void LoadData(string tabRef, string moduleRef)
        {
            CurrentTabReference = tabRef;
            CurrentReference    = moduleRef;

            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentTabReference);
            _module = t.GetModule(CurrentReference);

            // Load Module Common Properties
            txtTitle.Text     = HttpUtility.HtmlDecode(_module.title);
            txtReference.Text = _module.reference;
            txtCacheTime.Text = _module.CacheTime.ToString();

            cboPath.ClearSelection();
            cbType.ClearSelection();
            //lay ve duong dan den file module tinh tu RootModule
            string strModule = _module.type, strPth = "";

            string[] strModulePath = strModule.Split("/".ToCharArray());
            if (strModulePath.Length == 2)
            {
                strPth    = strModulePath[0];
                strModule = strModulePath[1];
            }
            ListItem pli = cboPath.Items.FindByValue(strPth);

            if (pli != null)
            {
                pli.Selected = true;
            }
            //goi load du lieu cho type
            LoadModuleTypes(strPth);
            ListItem li = cbType.Items.FindByValue(strModule);

            if (li != null)
            {
                li.Selected = true;
            }

            // Load Roles List
            RolesCtrl.LoadData(_module.roles);
            RolesCtrl.ShowRoleType = false;
            // Load Module's Runtime Properties
            _module.LoadModuleSettings();
            _module.LoadRuntimeProperties();
            rptRuntimeProperties.DataSource = _module.GetRuntimePropertiesSource(true);
            rptRuntimeProperties.DataBind();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Add new tab to Portal.config [bacth, 10:11 AM 5/26/2008]
        /// </summary>
        /// <param name="tabRef">new tab reference</param>
        /// <param name="parentTabRef">parent tab reference</param>
        /// <param name="title">new tab title</param>
        /// <param name="cloneTabRef">layout tab copied</param>
        /// <returns></returns>
        public static bool AddNewTab(string tabRef, string parentTabRef, string title, string cloneTabRef)
        {
            //string config1 = HttpContext.Current.Server.MapPath("~/settings/Portal.config"); // current application
            //string config2 = @"D:\shared\Portal.config"; // synchronous other file

            PortalDefinition portal = PortalDefinition.Load();

            PortalDefinition.Tab newTab    = portal.GetTab(tabRef);
            PortalDefinition.Tab parentTab = portal.GetTab(parentTabRef);
            if (newTab == null)
            {
                // add new tab
                newTab           = PortalDefinition.Tab.Create();
                newTab.reference = tabRef;
                newTab.title     = title;
                parentTab.tabs.Add(newTab);
                // tab roles
                PortalDefinition.ViewRole role = new PortalDefinition.ViewRole();
                role.name = Portal.API.Config.EveryoneRoles;
                newTab.roles.Add(role);
                // tab layout
                if (!string.IsNullOrEmpty(cloneTabRef))
                {
                    PortalDefinition.Tab cloneTab = portal.GetTab(cloneTabRef);
                    if (cloneTab != null)
                    {
                        newTab.Columns = cloneTab.CloneColumns();
                        foreach (PortalDefinition.Column c in newTab.Columns)
                        {
                            getNewRef(c);
                        }
                    }
                }
            }
            portal.Save();
            return(true);
        }
Exemplo n.º 20
0
        protected void OnDelete(object sender, EventArgs args)
        {
            if (Parent is Tab)
            {
                PortalDefinition        pd = PortalDefinition.Load();
                PortalDefinition.Tab    t  = pd.GetTab(CurrentTabReference);
                PortalDefinition.Column _objColumnBeingDeleted = pd.GetColumn(CurrentColumnReference);

                if (_objColumnBeingDeleted != null)
                {
                    t.DeleteColumn(CurrentColumnReference);

                    pd.Save();

                    if (Delete != null)
                    {
                        Delete(CurrentColumnReference,
                               _objColumnBeingDeleted.ColumnParent == null
                                   ? Guid.NewGuid().ToString()
                                   : _objColumnBeingDeleted.ColumnReference);
                    }
                }
            }
            else if (Parent is Template)
            {
                TemplateDefinition          td = TemplateDefinition.Load();
                TemplateDefinition.Template t  = td.GetTemplate(CurrentTabReference);
                PortalDefinition.Column     _objColumnBeingDeleted = td.GetColumn(CurrentColumnReference);

                if (_objColumnBeingDeleted != null)
                {
                    t.DeleteColumn(CurrentColumnReference);

                    td.Save();

                    if (Delete != null)
                    {
                        Delete(CurrentColumnReference,
                               _objColumnBeingDeleted.ColumnParent == null
                                   ? Guid.NewGuid().ToString()
                                   : _objColumnBeingDeleted.ColumnReference);
                    }
                }
            }


            // Hopefully we where redirected here!
        }
Exemplo n.º 21
0
        /// <summary>
        /// Thủ tục áp nội dung thẻ mẫu vào nội dung thẻ đã chọn
        /// </summary>
        /// <param name="_strTabRef"></param>
        private void ApplyCustomTab(string _strTabRef)
        {
            PortalDefinition _objPortal = PortalDefinition.Load();

            PortalDefinition.Tab _objSelectedTab     = _objPortal.GetTab(_strTabRef);
            ArrayList            _arrTemplateContent = _objPortal.CloneToTemplateTab(_objPortal.TemplateColumns) as ArrayList;

            if (_objSelectedTab != null && _objSelectedTab.reference != _objPortal.TemplateReference && _arrTemplateContent != null)
            {
                ReGenModuleID(ref _arrTemplateContent);

                _objSelectedTab.Columns = _arrTemplateContent;

                _objPortal.Save();
            }
        }
Exemplo n.º 22
0
        public void LoadData(string tabRef)
        {
            CurrentReference = tabRef;

            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentReference);

            txtTitle.Text     = t.title;
            txtReference.Text = CurrentReference;

            RolesCtrl.LoadData(t.roles);
            ModuleListCtrl_Left.LoadData(t.left);
            ModuleListCtrl_Middle.LoadData(t.middle);
            ModuleListCtrl_Right.LoadData(t.right);
        }
Exemplo n.º 23
0
        private void UpdateTabs(TemplateApplyingMode _objGenerateMode)
        {
            PortalDefinition _objPortal = PortalDefinition.Load();

            EditionTypeRow[] _arrAllEditionTypes = null;

            using (MainDB _objDB = new MainDB())
            {
                _arrAllEditionTypes = _objDB.EditionTypeCollection.GetAll();
            }

            if (_arrAllEditionTypes != null)
            {
                foreach (EditionTypeRow _objEdition in _arrAllEditionTypes)
                {
                    PortalDefinition.Tab _objCurrentEdition  = _objPortal.GetTab(_objEdition.EditionDisplayURL);
                    ArrayList            _arrTemplateColumns = _objPortal.CloneToTemplateTab(_objPortal.TemplateColumns) as ArrayList;
                    ReGenModuleID(ref _arrTemplateColumns);

                    if (_objCurrentEdition != null)
                    {
                        // Nếu cho phép cập nhật chuyên san thì cần xét thêm chuyên san phải khác với chuyên san mẫu
                        if (_objGenerateMode.EditionType && _objCurrentEdition.reference != _objPortal.TemplateReference)
                        {
                            _objCurrentEdition.Columns = _arrTemplateColumns;
                            _objCurrentEdition.title   = _objEdition.EditionName;
                        }
                        AddCategoryTab(_objPortal, _objCurrentEdition.tabs, _objEdition.EditionType_ID.ToString(), null, _objEdition.EditionDisplayURL, _objGenerateMode);
                    }
                    else
                    {
                        PortalDefinition.Tab      _objNewEditionTab = PortalDefinition.Tab.Create(_objEdition.EditionDisplayURL);
                        PortalDefinition.ViewRole _objViewRole      = new PortalDefinition.ViewRole();
                        _objViewRole.name = Config.EveryoneRoles;
                        _objNewEditionTab.roles.Add(_objViewRole);
                        _objNewEditionTab.Columns = _arrTemplateColumns;
                        _objPortal.tabs.Add(_objNewEditionTab);

                        AddCategoryTab(_objPortal, _objNewEditionTab.tabs, _objEdition.EditionType_ID.ToString(), null, _objEdition.EditionDisplayURL, _objGenerateMode);
                    }
                }
            }

            _objPortal.Save();
            Response.Redirect(Request.Url.PathAndQuery);
        }
Exemplo n.º 24
0
        protected void OnDelete(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = pd.GetTab(CurrentTabReference);

            t.DeleteModule(CurrentReference);

            pd.Save();

            if (Delete != null)
            {
                Delete(this, new EventArgs());
            }

            // Hopefully we where redirected here!
        }
Exemplo n.º 25
0
        protected void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (!Page.IsValid)
                {
                    return;
                }

                PortalDefinition     pd = PortalDefinition.Load();
                PortalDefinition.Tab t  = pd.GetTab(CurrentReference);

                t.title     = HttpUtility.HtmlEncode(txtTitle.Text);
                t.reference = txtReference.Text;
                t.SkinName  = ddrSkins.SelectedValue;
                t.IsHidden  = chkIsHidden.Checked;
                t.roles     = RolesCtrl.GetData();

                if (!string.Empty.Equals(ddrTemplateList.SelectedValue))
                {
                    //get information about selected template
                    TemplateDefinition          td       = TemplateDefinition.Load();
                    TemplateDefinition.Template template = td.GetTemplate(ddrTemplateList.SelectedValue);

                    //apply template to tab by replace columns's tab by columns'template
                    t.Columns = (ArrayList)template.Columns.Clone();
                }

                pd.Save();

                CurrentReference = t.reference;

                if (Save != null)
                {
                    Save(this, t);
                }

                ShowModulesList();
                LoadData(CurrentReference);
            }
            catch (Exception e)
            {
                lbError.Text = e.Message;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Thủ tục cập nhật lại mã tham chiếu của thẻ tương ứng với đề mục đã sửa
        /// Thủ tục này được gọi khi người sử dụng thay đổi đường dẫn hiển thị trên URL của một đề mục nào đó.
        /// </summary>
        /// <param name="_strOldTabRef">Mã tham chiếu cũ, dùng để tìm ra thẻ hiện thời ứng với đề mục cần sửa</param>
        /// <param name="_strNewTabRef">Mã</param>
        /// <param name="_strNewTabTitle"></param>
        public void SyncCategoryTab(string _strOldTabRef, string _strNewTabRef, string _strNewTabTitle, string _EditionRef, string _ParentRef, string _NewRef, string _NewTabTitle)
        {
            PortalDefinition _objPortal = PortalDefinition.Load();

            PortalDefinition.Tab _objCurrentCategoryTab = _objPortal.GetTab(_strOldTabRef);

            if (_objCurrentCategoryTab != null)
            {
                _objCurrentCategoryTab.title     = _strNewTabTitle;
                _objCurrentCategoryTab.reference = _strNewTabRef;
                _objPortal.Save();
            }
            else
            {
                //neu truong hop khong ton tai tab thi tao tab do ra
                AddCategoryTab(_EditionRef, _ParentRef, _NewRef, _NewTabTitle);
            }
        }
Exemplo n.º 27
0
        protected void btnSaveLayout_Click(object sender, EventArgs e)
        {
            string tab = (string)ViewState["TabReference"];

            string html = "<tables>" + HiddenField1.Value + "</tables>";

            // hotfix
            html = html.Replace("<br style=\"clear: both;\">", string.Empty);
            html = html.Replace("<BR style=\"CLEAR: both\">", string.Empty);


            XmlDocument layout = convertHTMLtoXML(html);

            if (layout != null)
            {
                PortalDefinition     pd = PortalDefinition.Load();
                PortalDefinition.Tab t  = pd.GetTab(tab);
                // remove all old column
                while (t.Columns.Count > 0)
                {
                    t.DeleteColumn(((PortalDefinition.Column)t.Columns[0]).ColumnReference);
                }

                // add new column
                XmlNodeList htmlTables = layout.SelectNodes("tables/table");
                if (htmlTables.Count == 0)
                {
                    htmlTables = layout.SelectNodes("tables/TABLE");                                        // fix ie: UPPERCASE all tag
                }
                PortalDefinition.Column newColumn;

                int countTable = 0;
                foreach (XmlNode htmlTable in htmlTables)
                {
                    newColumn = PortalDefinition.Column.Create(t);
                    saveTable(ref newColumn, htmlTable, countTable++);
                    t.Columns.Add(newColumn);
                }
                pd.Save();
                RenderTables(t.Columns, workarea);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Ermittelt die Definition des Modules des angegebenene Tabs.
        /// </summary>
        /// <param name="szTab"></param>
        /// <param name="szCtrl"></param>
        /// <returns></returns>
        private PortalDefinition.Module GetModule(string szTab, string szCtrl)
        {
            PortalDefinition.Module SelectedModule = null;

            if ((szTab != null) && (szCtrl != null))
            {
                PortalDefinition     PortDef = PortalDefinition.Load();
                PortalDefinition.Tab NewsTab = PortDef.GetTab(szTab);
                if (UserManagement.HasViewRights(Page.User, NewsTab.roles))
                {
                    PortalDefinition.Module Md = NewsTab.GetModule(szCtrl);
                    if (UserManagement.HasViewRights(Page.User, Md.roles))
                    {
                        SelectedModule = Md;
                    }
                }
            }

            return(SelectedModule);
        }
        public void SelectTab(string reference)
        {
            PortalDefinition pd = PortalDefinition.Load();

            CurrentReference = reference;
            if (reference == "")            // Root Node
            {
                CurrentParentReference = "";
                TabCtrl.Visible        = false;
                TabListCtrl.LoadData(pd);
            }
            else
            {
                PortalDefinition.Tab t = pd.GetTab(reference);
                CurrentParentReference = t.parent != null ? t.parent.reference : "";
                TabListCtrl.LoadData(t);
                TabCtrl.Visible = true;
                TabCtrl.LoadData(reference);
            }
        }
Exemplo n.º 30
0
        protected void OnAddColumn(object sender, CommandEventArgs e)
        {
            if (Parent is Tab)
            {
                PortalDefinition     pd = PortalDefinition.Load();
                PortalDefinition.Tab t  = pd.GetTab(e.CommandArgument.ToString());

                if (t != null)
                {
                    PortalDefinition.Column _objNewColumn = PortalDefinition.Column.Create(t);

                    t.Columns.Add(_objNewColumn);

                    pd.Save();

                    if (AddColumn != null)
                    {
                        AddColumn(this, _objNewColumn);
                    }
                }
            }
            else if (Parent is Template)
            {
                TemplateDefinition          td = TemplateDefinition.Load();
                TemplateDefinition.Template t  = td.GetTemplate(e.CommandArgument.ToString());

                if (t != null)
                {
                    PortalDefinition.Column _objNewColumn = PortalDefinition.Column.Create(t);

                    t.Columns.Add(_objNewColumn);

                    td.Save();

                    if (AddColumn != null)
                    {
                        AddColumn(this, _objNewColumn);
                    }
                }
            }
        }