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();
            }
        }
Esempio n. 2
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();
        }