Exemplo n.º 1
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);
        }
        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.º 4
0
        /// <summary>
        /// Thủ tục thực hiện chuyển vị trí của Module đã chọn xuống 1 mức
        /// </summary>
        /// <param name="idx">Vị trí hiện thời</param>
        /// <param name="list">Danh sách Module</param>
        internal void MoveModuleDown(int idx, ModuleList list)
        {
            // Nạp cấu trúc Portal
            PortalDefinition pd = PortalDefinition.Load();

            // Lấy thông tin cột chứa Module hiện thời
            PortalDefinition.Column _objColumnContainer = pd.GetColumn(list.ContainerColumnReference);

            // Lấy danh sách Module của cột
            ArrayList _arrModuleList = _objColumnContainer.ModuleList;

            // Nếu Module đang ở mức cuối cùng thì kết thúc thủ tục
            if (idx >= _arrModuleList.Count - 1)
            {
                return;
            }

            // Lấy thông tin Module hiện thời từ danh sách Module
            PortalDefinition.Module m = (PortalDefinition.Module)_arrModuleList[idx];

            // Gỡ Module ra khỏi vị trí hiện thời
            _arrModuleList.RemoveAt(idx);

            // Chèn Module vào vị trí mới
            _arrModuleList.Insert(idx + 1, m);

            // Lưu cấu trúc Portal
            pd.Save();

            // Rebind
            LoadData(CurrentReference);
            ShowCurrentEditingColumn();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Thủ tục thêm một Module mới
        /// </summary>
        /// <param name="_strColumnRef">Mã tham chiếu đến cột sẽ chứa Module</param>
        internal void AddModule(string _strColumnRef)
        {
            // Nạp cấu trúc portal
            PortalDefinition pd = PortalDefinition.Load();

            // Tìm cột sẽ chứa Module mới
            PortalDefinition.Column _objColumnContainer = pd.GetColumn(_strColumnRef);

            if (_objColumnContainer != null)
            {
                // Tạo Module mới
                PortalDefinition.Module _objNewModule = PortalDefinition.Module.Create();

                // Thêm Module mới vào danh sách Module của cột
                _objColumnContainer.ModuleList.Add(_objNewModule);

                // Lưu cấu trúc Portal
                pd.Save();

                // Nạp lại thông tin Tab hiện thời
                LoadData(CurrentReference);

                // Hiển thị form sửa thông tin Module
                EditModule(_objNewModule.reference);
            }
        }
Exemplo n.º 6
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.º 7
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.º 8
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.º 9
0
        override public void AddModule(ModuleList list)
        {
            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = CurrentTab;

            PortalDefinition.Module m = PortalDefinition.Module.Create();

            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(CurrentTab);

            EditModule(m.reference);
        }
Exemplo n.º 10
0
        protected void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (!Page.IsValid)
                {
                    return;
                }

                PortalDefinition     pd = PortalDefinition.Load();
                PortalDefinition.Tab t  = CurrentTab;

                t.title           = HttpUtility.HtmlEncode(txtTitle.Text);
                t.reference       = txtReference.Text;
                t.imgPathInactive = HttpUtility.HtmlEncode(txtImagePathI.Text);
                t.imgPathActive   = HttpUtility.HtmlEncode(txtImagePathA.Text);
                t.roles           = RolesCtrl.GetData();

                pd.Save();

                CurrentTab = t;

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

                ShowModulesList();
            }
            catch (Exception e)
            {
                lbError.Text = e.Message;
            }
        }
Exemplo n.º 11
0
//		internal void MoveModuleUp(int idx, ModuleList list)
        override public void MoveModuleUp(int idx, ModuleList list)
        {
            if (idx <= 0)
            {
                return;
            }

            PortalDefinition pd = PortalDefinition.Load();

            PortalDefinition.Tab t = CurrentTab;

            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;
            }

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

            pd.Save();

            // Rebind
            LoadData(CurrentTab);
        }
Exemplo n.º 12
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.º 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
        /// <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.º 16
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.º 17
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.º 18
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.º 19
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.º 20
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.º 21
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.º 22
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.º 23
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);
                    }
                }
            }
        }
Exemplo n.º 24
0
        public void AddTab()
        {
            PortalDefinition pd = PortalDefinition.Load();

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

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

            pd.Save();

            BuildTree();
            SelectTab(t.reference);
        }
Exemplo n.º 25
0
        protected void OnSave(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

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

            t.title     = txtTitle.Text;
            t.reference = txtReference.Text;
            t.roles     = RolesCtrl.GetData();

            CurrentReference = t.reference;

            pd.Save();

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

            ShowModulesList();
        }
Exemplo n.º 26
0
        protected void OnSave(object sender, EventArgs args)
        {
            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     = txtTitle.Text;
                m.type      = cbType.SelectedItem.Value;
                m.roles     = RolesCtrl.GetData();

                pd.Save();

                if (Save != null)
                {
                    Save(this, new EventArgs());
                }
            }
        }
Exemplo n.º 27
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.º 28
0
        /// <summary>
        /// Thủ tục lưu các thông tin đã xác lập của 1 Cột
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (Page.IsValid)
                {
                    // Save
                    PortalDefinition.Column _objColumn = null;
                    PortalDefinition        pd         = null;
                    TemplateDefinition      td         = null;

                    if (Parent is Tab)
                    {
                        // Lấy thông tin về cột cần sửa
                        pd         = PortalDefinition.Load();
                        _objColumn = pd.GetColumn(CurrentColumnReference);
                    }
                    else if (Parent is Template)
                    {
                        td         = TemplateDefinition.Load();
                        _objColumn = td.GetColumn(CurrentColumnReference);
                    }

                    if (_objColumn != null)
                    {
                        // Cập nhật lại tên cột và độ rộng của cột
                        _objColumn.ColumnName = txtTitle.Text;

                        // Cập nhật màu nền của cột
                        _objColumn.ColumnCustomStyle = txtCustomStyle.Text;

                        // Cập nhật mức độ của cột
                        _objColumn.ColumnLevel = Convert.ToInt32(drdColumnLevel.SelectedValue);
                        //lay ve do rong cua cot
                        string strColWidth = txtColWidth.Text;
                        try
                        {
                            _objColumn.ColumnWidth = chkDefaultColumnWidth.Checked ? "" : strColWidth;
                        }
                        catch
                        {
                            // Nếu có lỗi, lấy độ rộng mặc định
                            _objColumn.ColumnWidth = "";
                        }
                    }

                    if (Parent is Tab)
                    {
                        pd.Save();
                    }
                    else if (Parent is Template)
                    {
                        td.Save();
                    }

                    CurrentColumnReference = _objColumn.ColumnReference;

                    if (Save != null)
                    {
                        Save(this, new EventArgs());
                    }
                }
            }
            catch (Exception e)
            {
                lbError.Text = e.Message;
            }
        }
Exemplo n.º 29
0
        internal void MoveColumnRight(string _strColumnReference)
        {
            // Nạp cấu trúc Portal
            PortalDefinition _objPortal = PortalDefinition.Load();

            // Lấy thông tin về cột cần dịch chuyển
            PortalDefinition.Column _objSelectedColumn = _objPortal.GetColumn(_strColumnReference);

            // Nếu cột cần dịch chuyển không tồn tại thì kết thúc hàm
            if (_objSelectedColumn != null)
            {
                // Tìm kiếm danh sách cột trong đó có cột đang xét
                PortalDefinition.Column _objParentColumn = _objSelectedColumn.ColumnParent;
                ArrayList _arrColumnsList = null;

                // Nếu cột cha rỗng thì cột đang xét trực thuộc Tab
                if (_objParentColumn == null)
                {
                    // Lấy thông tin Tab hiện thời
                    PortalDefinition.Tab _objCurrentTab = _objPortal.GetTab(CurrentReference);
                    if (_objCurrentTab != null)
                    {
                        // Lấy danh sách cột của Tab
                        _arrColumnsList = _objCurrentTab.Columns;
                    }
                }
                else
                {
                    // Nếu cột đang xét là cột con của 1 cột khác, thì trả về danh sách các cột đồng cấp
                    _arrColumnsList = _objParentColumn.Columns;
                }

                // Biến lưu vị trí của cột đã chọn trong danh sách
                int _intCurrentColumnIndex = 0;

                // Biến lưu trữ số cột đồng mức với cột đã chọn
                int _intSameLevelColumnsCount = 0;

                // Kiểm duyệt danh sách cột đồng cấp
                // Đếm cột có cùng Level
                for (int _intColumnCount = 0; _intColumnCount < _arrColumnsList.Count; _intColumnCount++)
                {
                    PortalDefinition.Column _objColumn = _arrColumnsList[_intColumnCount] as PortalDefinition.Column;
                    if (_objColumn.ColumnLevel == _objSelectedColumn.ColumnLevel)
                    {
                        if (_objColumn.ColumnReference == _objSelectedColumn.ColumnReference)
                        {
                            _intCurrentColumnIndex = _intSameLevelColumnsCount;
                        }
                        _intSameLevelColumnsCount++;
                    }
                }

                // Duyệt danh sách các cột cùng cấp
                if (_arrColumnsList != null && _intSameLevelColumnsCount > 0)
                {
                    // Để di chuyển sang phải --> không thể đang là vị trí cuối cùng
                    if (_intCurrentColumnIndex >= (_intSameLevelColumnsCount - 1))
                    {
                        return;
                    }
                    else
                    {
                        // Di chuyển cột đã chọn sang trái
                        _arrColumnsList.RemoveAt(_intCurrentColumnIndex);
                        _arrColumnsList.Insert(_intCurrentColumnIndex + 1, _objSelectedColumn);
                    }
                }
            }

            // Lưu cấu trúc Portal
            _objPortal.Save();

            // Nạp dữ liệu Tab
            LoadData(CurrentReference);

            // Nạp dữ liệu cột
            if (CurrentColumnReference != "")
            {
                EditColumn(CurrentColumnReference);
            }
        }