예제 #1
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);
            }
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #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
            TemplateDefinition td = TemplateDefinition.Load();

            // Lấy thông tin cột chứa Module hiện thời
            PortalDefinition.Column _objColumnContainer = td.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
            td.Save();

            // Rebind
            LoadData(CurrentTemplateReference);
            ShowCurrentEditingColumn();
        }
예제 #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
            TemplateDefinition td = TemplateDefinition.Load();

            // Tìm cột sẽ chứa Module mới
            PortalDefinition.Column _objColumnContainer = td.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
                td.Save();

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

                // Hiển thị form sửa thông tin Module
                EditModule(_objNewModule.reference);
            }
        }
예제 #6
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);
        }
예제 #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;
            }
        }
        /// <summary>
        /// Überprüft ob diese Url im angegebenen Modul konfiguriert ist.
        /// </summary>
        /// <param name="szTab"></param>
        /// <param name="HostingModule"></param>
        /// <param name="szUrl"></param>
        /// <returns></returns>
        private bool UrlExist(string szTab, PortalDefinition.Module HostingModule, string szUrl)
        {
            bool bUrlFound = false;

            // Wir laden das Modul in den Speicher, damit wir einfach auf die Konfiguration zugrefen können.
            Portal.API.Module Md = (Portal.API.Module)LoadControl(Config.GetModuleVirtualPath(HostingModule.type) +
                                                                  HostingModule.type + ".ascx");

            // Modul initialisieren.
            Md.InitModule(szTab, HostingModule.reference, HostingModule.type,
                          Config.GetModuleDataVirtualPath(HostingModule.type), false);

            // Konfiguration laden.
            DataSet ModConfig = Md.ReadConfig();

            if (ModConfig != null)
            {
                // Nun iterieren wir über alle Url's in diesem Module.
                foreach (DataRow Entry in ModConfig.Tables["news"].Rows)
                {
                    if (szUrl == (string)Entry["Url"])
                    {
                        return(true);
                    }
                }
            }

            return(bUrlFound);
        }
예제 #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);
        }
예제 #10
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (fUpload.HasFile && fUpload.PostedFile.ContentType.IndexOf("image") > -1)
            {
                string fileName  = HttpUtility.UrlDecode(fUpload.FileName);
                string directory = HttpUtility.UrlDecode(Server.MapPath(PrefixURL + DateTime.Now.ToString("yyyy/MM/dd/")));
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
                fUpload.SaveAs(directory + fileName);

                PortalDefinition.Module module = new PortalDefinition.Module();
                module.reference = ModuleRef;
                module.type      = ModuleType;
                module.LoadRuntimeProperties();
                string oldValue = module.moduleRuntimeSettings.GetRuntimePropertyValue(true, "pictureurl");
                if (string.IsNullOrEmpty(oldValue))
                {
                    module.moduleRuntimeSettings.SetRuntimePropertyValue(true, "pictureurl", DateTime.Now.ToString("yyyy/MM/dd/") + fileName);
                }
                else
                {
                    module.moduleRuntimeSettings.SetRuntimePropertyValue(true, "pictureurl", oldValue + seprator + DateTime.Now.ToString("yyyy/MM/dd/") + fileName);
                }
                module.SaveRuntimeSettings();
            }
            bindForm();
            ((Portal.GUI.EditoralOffice.MainOffce.editnews.editModule) this.Page).loadPresentationModule(ModuleType, ModuleRef);
        }
예제 #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);
        }
        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();
            }
        }
예제 #13
0
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            LoadRuntimeSettings();
            object runtimesetting = ReadRuntimeConfig(true, "pictureurl");

            if (runtimesetting != null && runtimesetting.ToString() != string.Empty)
            {
                string strRuntimeSetting = runtimesetting.ToString();
                string arg = ((Button)sender).CommandArgument;
                strRuntimeSetting = strRuntimeSetting.Replace(arg, string.Empty);
                if (strRuntimeSetting.StartsWith(seprator))
                {
                    strRuntimeSetting = strRuntimeSetting.Substring(seprator.Length);
                }
                if (strRuntimeSetting.EndsWith(seprator))
                {
                    strRuntimeSetting = strRuntimeSetting.Substring(0, strRuntimeSetting.Length - seprator.Length);
                }
                strRuntimeSetting = strRuntimeSetting.Replace(seprator + seprator, string.Empty);

                string[]  pictureurls = strRuntimeSetting.Split(new string[] { seprator }, StringSplitOptions.RemoveEmptyEntries);
                DataTable tbl         = new DataTable();
                DataRow   row;
                tbl.Columns.Add("PictureURL");
                for (int i = 0; i < pictureurls.Length; i++)
                {
                    row    = tbl.NewRow();
                    row[0] = pictureurls.GetValue(i);
                    tbl.Rows.Add(row);
                }
                rptSlideshow.DataSource = tbl;
                rptSlideshow.DataBind();



                PortalDefinition.Module module = new PortalDefinition.Module();
                module.reference = ModuleRef;
                module.type      = ModuleType;
                module.LoadRuntimeProperties();
                module.moduleRuntimeSettings.SetRuntimePropertyValue(true, "pictureurl", strRuntimeSetting);
                module.SaveRuntimeSettings();

                // delete file
                if (File.Exists(Server.MapPath(PrefixURL + arg)))
                {
                    try
                    {
                        File.Delete(Server.MapPath(PrefixURL + arg));
                    }
                    catch { }
                }
            }
            ((Portal.GUI.EditoralOffice.MainOffce.editnews.editModule) this.Page).loadPresentationModule(ModuleType, ModuleRef);
        }
        protected void btnSaveModule_Click(object sender, EventArgs e)
        {
            string tab = (string)ViewState["TabReference"];

            PortalDefinition.Module module;

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

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

            if (string.IsNullOrEmpty(moduleRef))
            {
                return;
            }

            module           = new PortalDefinition.Module();
            module.reference = moduleRef;
            module.type      = moduleType;

            if (module != null)
            {
                // Lưu các thông số khi thực thi của module
                module.LoadModuleSettings();
                module.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;
                        module.moduleRuntimeSettings.SetRuntimePropertyValue(true, _hihPropertyName.Value, _strPropertyValue);
                    }
                }
                module.SaveRuntimeSettings();
            }
        }
예제 #15
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;
            }
        }
예제 #16
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();
        }
        void saveModule(ref PortalDefinition.Module module, XmlNode htmlModule)
        {
            string reference = xmlNodeToText(htmlModule.SelectSingleNode("@ref"));

            if (!string.IsNullOrEmpty(reference))
            {
                module.reference = reference;
            }

            module.title = xmlNodeToText(htmlModule.SelectSingleNode("@title"));
            int.TryParse(xmlNodeToText(htmlModule.SelectSingleNode("@cacheduration")), out module.CacheTime);
            module.type = xmlNodeToText(htmlModule.SelectSingleNode("@type"));

            PortalDefinition.ViewRole viewrole = new PortalDefinition.ViewRole();
            viewrole.name = "TATCA";
            module.roles.Add(viewrole);
        }
예제 #18
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            bool bAccessAllowed = false;

            PortalDefinition.Module SelModule = GetModule(Request["Tab"], Request["Ctrl"]);
            if ((SelModule != null) && (SelModule.type == "Newsticker"))
            {
                string szUrl = Server.UrlDecode(Request["Src"]);
                if (UrlExist(Request["Tab"], SelModule, szUrl))
                {
                    bAccessAllowed = true;

                    // Ermitteln der Anzahl Einträge.
                    int nNofItems = 0;
                    try
                    {
                        nNofItems = Convert.ToInt32(Request["Nof"]);
                    }
                    catch (Exception)
                    {
                        nNofItems = 5;
                    }

                    // Wir Laden den gesuchten Feed.
                    RssFeedItem Feed = new RssFeedItem(Request["Name"], szUrl, nNofItems, false);

                    // Wir ermitteln die Repräsentation dieses Objekts.
                    Control FeedParent = new Control();
                    Feed.AddFeedRepresentation(FeedParent.Controls);

                    // Wir geben die Repräsentation in HTML Code zurück.
                    StringWriter   StrWriter = new StringWriter();
                    HtmlTextWriter TxtWriter = new HtmlTextWriter(StrWriter);
                    FeedParent.RenderControl(TxtWriter);
                    Response.Write(StrWriter.ToString());
                }
            }

            if (!bAccessAllowed)
            {
                Response.Write("No Access");
            }

            Response.End();
        }
예제 #19
0
        protected void OnDelete(object sender, EventArgs args)
        {
            PortalDefinition pd = PortalDefinition.Load();

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

            PortalDefinition.Module _objDeleteModule = t.GetModule(CurrentReference);
            t.DeleteModule(CurrentReference);
            _objDeleteModule.DeleteRuntimeProperties();

            pd.Save();

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

            // Hopefully we where redirected here!
        }
예제 #20
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);
        }
        private HtmlGenericControl createModule(PortalDefinition.Module module)
        {
            HtmlGenericControl dragModule = new HtmlGenericControl("li");
            string             moduleId   = string.Format(DragModuleIdFormat, (CountDragModule++), module.type.Replace("/", "$"));

            dragModule.Attributes["id"]            = moduleId;
            dragModule.Attributes["cacheduration"] = module.CacheTime.ToString();
            dragModule.Attributes["ref"]           = module.reference;
            dragModule.Attributes["title"]         = module.title;
            dragModule.Attributes["type"]          = module.type;

            StringBuilder html = new StringBuilder();

            html.Append("<span>" + module.title + "</span>");
            html.Append(" | <a href=\"#\" onclick=\"ChangeModuleToEditMode(this); return false;\">Edit</a>");
            html.Append(" | <a href=\"#\" onclick=\"removeModule(this); return false;\">Remove</a>");

            dragModule.InnerHtml = html.ToString();

            return(dragModule);
        }
예제 #22
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());
                }
            }
        }
예제 #23
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);

            txtTitle.Text     = 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);
        }
예제 #24
0
 /// <summary>
 /// Initializes the Control
 /// </summary>
 /// <param name="md"></param>
 internal void SetModuleConfig(PortalDefinition.Module md)
 {
     ModuleDef             = md;
     lnkEditLink.ModuleRef = md.reference;
 }
        private TableCell AnalyseColumn(PortalDefinition.Column column)
        {
            if (column.Columns.Count == 0)
            {
                TableCell cellColumn;
                if (column.ModuleList.Count >= 1)
                {
                    string strModuleTitle_0 = "";
                    for (int i = 0; i < column.ModuleList.Count; i++)
                    {
                        PortalDefinition.Module tempModule_0 = (PortalDefinition.Module)column.ModuleList[i];
                        if (i == 0)
                        {
                            strModuleTitle_0 += tempModule_0.title;
                        }
                        else
                        {
                            strModuleTitle_0 += " <br> " + tempModule_0.title;
                        }
                    }

                    cellColumn = CreateTableCell(strModuleTitle_0, "child-cell", column.ColumnCustomStyle, column.ColumnWidth);
                }
                else
                {
                    cellColumn = CreateTableCell("cột mới chưa có module", "child-cell", column.ColumnCustomStyle, column.ColumnWidth);
                }
                return(cellColumn);
            }
            // if this column has more one children
            else
            {
                TableCell cellColumn;
                cellColumn = CreateTableCell("", "", column.ColumnCustomStyle, column.ColumnWidth);

                //Moi dong cua mot level tuong ung voi mot bang duoc chua trong mot cell
                Table childrenTable = new Table();
                childrenTable.Width = cellColumn.Width;
                cellColumn.Controls.Add(childrenTable);

                int _iMaxColumnLevel = column.GetMaxLevelOfChildrenColumns();
                int _iMinColumnLevel = column.GetMinLevelOfChildrenColumns();

                for (int currentColumnLevel_1 = _iMinColumnLevel; currentColumnLevel_1 <= _iMaxColumnLevel; currentColumnLevel_1++)
                {
                    //Get all column have same level
                    ArrayList _arrayListColumns = column.GetArrayChildrenColumnWithLevel(currentColumnLevel_1);

                    TableRow childrenRow = new TableRow();
                    childrenRow.Width = childrenTable.Width;
                    childrenTable.Rows.Add(childrenRow);

                    TableCell cellChildrenColumn = CreateTableCell("", "", "", "");
                    cellChildrenColumn.Width = childrenRow.Width;
                    childrenRow.Cells.Add(cellChildrenColumn);

                    Table grandChildrenTable = new Table();
                    grandChildrenTable.Width = cellChildrenColumn.Width;
                    cellChildrenColumn.Controls.Add(grandChildrenTable);

                    TableRow grandChildrenRow = new TableRow();
                    grandChildrenRow.Width = grandChildrenTable.Width;
                    grandChildrenTable.Rows.Add(grandChildrenRow);

                    foreach (PortalDefinition.Column childrenColumn in _arrayListColumns)
                    {
                        TableCell cellGradnChildrenColumn = AnalyseColumn(childrenColumn);
                        if (_arrayListColumns.Count == 1)
                        {
                            cellGradnChildrenColumn.Width = grandChildrenRow.Width;
                        }
                        grandChildrenRow.Cells.Add(cellGradnChildrenColumn);
                    }
                }

                //if this colum has more one module
                if (column.ModuleList.Count >= 1)
                {
                    TableRow childrenRow = new TableRow();
                    childrenRow.Width = childrenTable.Width;
                    childrenTable.Rows.Add(childrenRow);

                    string strModuleTitle_0 = "";
                    for (int i = 0; i < column.ModuleList.Count; i++)
                    {
                        PortalDefinition.Module tempModule_0 = (PortalDefinition.Module)column.ModuleList[i];
                        if (i == 0)
                        {
                            strModuleTitle_0 += tempModule_0.title;
                        }
                        else
                        {
                            strModuleTitle_0 += " <br> " + tempModule_0.title;
                        }
                    }

                    TableCell cellChildrenColumn = CreateTableCell(strModuleTitle_0, "child-cell", column.ColumnCustomStyle, column.ColumnWidth);
                    cellChildrenColumn.Width = childrenRow.Width;
                    childrenRow.Cells.Add(cellChildrenColumn);
                }
                return(cellColumn);
            }
        }