/// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var modules = new ModulesDB();

            // If this is the first visit to the page, bind the definition data
            if (this.Page.IsPostBack)
            {
                this.addModule = bool.Parse(this.ViewState["addModule"].ToString());
            }
            else
            {
                this.ViewState["addModule"] = this.addModule;
                if (this.addModule)
                {
                    this.DeleteButton.Visible = false;
                }
                else
                {
                    // Obtain the module definition to edit from the database
                    var def = modules.GetSingleModuleDefinition(this.defId);

                    // WLF: Set UI values
                    this.FriendlyName.Text  = def.FriendlyName;
                    this.DesktopSrc.Text    = def.DesktopSource;
                    this.MobileSrc.Text     = def.MobileSource;
                    this.ModuleGuid.Text    = def.GeneralModDefID.ToString();
                    this.ModuleGuid.Enabled = false;
                }

                // Clear existing items in checkbox list
                this.PortalsName.Items.Clear();

                // Populate checkbox list with all portals
                // and "check" the ones already configured for this tab
                var portals = modules.GetModuleInUse(this.defId).ToArray();
                this.PortalsName.Items.AddRange(portals);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles OnInit event
        /// </summary>
        /// <param name="e">
        /// An <see cref="T:System.EventArgs"></see> that contains the event data.
        /// </param>
        protected override void OnInit(EventArgs e)
        {
            var modules = new ModulesDB();

            // Calculate security defID
            if (this.Request.Params["defID"] != null)
            {
                this.defId = new Guid(this.Request.Params["defID"]);
            }

            if (this.defId.Equals(Guid.Empty))
            {
                this.ChangeInstallMode(EditMode.Installer);

                ((Appleseed.Framework.Web.UI.WebControls.LinkButton) this.UpdateButton).TextKey = "ADD";
                this.DeleteButton.Visible = false;
                // new module definition
                this.InstallerFileName.Text = @"DesktopModules/[ModuleFolder]/install.xml";
                this.FriendlyName.Text      = string.Empty;
                this.DesktopSrc.Text        = string.Empty;
                this.MobileSrc.Text         = string.Empty;
            }
            else
            {
                ((Appleseed.Framework.Web.UI.WebControls.LinkButton) this.UpdateButton).TextKey = "UPDATE";
                // Obtain the module definition to edit from the database
                var dr = modules.GetSingleModuleDefinition(this.defId);

                // Read in first row from database
                var friendlyName = dr.FriendlyName;
                this.FriendlyName.Text = friendlyName;
                var desktopSrc = dr.DesktopSource;
                this.DesktopSrc.Text = desktopSrc;
                this.MobileSrc.Text  = dr.MobileSource;
                this.lblGUID.Text    = dr.GeneralModDefID.ToString();

                if (this.DesktopSrc.Text.Contains(".aspx") || this.DesktopSrc.Text.Contains(".ascx"))
                {
                    this.ChangeInstallMode(EditMode.Manually);
                }
                else
                {
                    this.FriendlyNameMVC.Text = friendlyName;

                    this.ChangeInstallMode(EditMode.MVC);
                    var items = ModelServices.GetMVCActionModules();
                    foreach (var item in this.GetPortableAreaModules())
                    {
                        items.Add(item.Text, item.Value);
                    }

                    this.ddlAction.DataSource = items;
                    this.ddlAction.DataBind();

                    var val = this.ddlAction.Items[0].Value;
                    foreach (var item in
                             this.ddlAction.Items.Cast <ListItem>().Where(
                                 item => item.Text.Contains(desktopSrc.Replace("/", "\\"))))
                    {
                        val = item.Value;
                        break;
                    }

                    this.ddlAction.SelectedValue = val;
                }
            }

            // Populate checkbox list with all portals
            // and "check" the ones already configured for this tab
            var portals = modules.GetModuleInUse(this.defId).ToArray();

            // Clear existing items in checkbox list
            this.PortalsName.Items.Clear();
            this.PortalsName.Items.AddRange(portals);

            this.btnUseInstaller.Click  += this.btnUseInstaller_Click;
            this.btnDescription.Click   += this.btnDescription_Click;
            this.chbMVCAction.Click     += this.chbMVCAction_Click;
            this.chbPortableAreas.Click += this.chbPortableAreas_Click;
            this.selectAllButton.Click  += this.selectAllButton_Click;
            this.selectNoneButton.Click += this.selectNoneButton_Click;

            base.OnInit(e);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            //if (PortalSecurity.IsInRoles("Admins") == false)
            //	PortalSecurity.AccessDeniedEdit();

            // Calculate security defID
            if (Request.Params["DefID"] != null)
            {
                defID = new Guid(Request.Params["DefID"]);
            }

            ModulesDB modules = new ModulesDB();

            // If this is the first visit to the page, bind the definition data

            if (Page.IsPostBack)
            {
                addModule = bool.Parse(ViewState["addModule"].ToString());
            }
            else
            {
                if (Request.Params["defID"] == null)
                {
                    addModule = true;
                }
                ViewState["addModule"] = addModule;
                if (addModule)
                {
                    deleteButton.Visible = false;
                }

                if (addModule)
                {
                    defID = Guid.NewGuid();
                    // new module definition
                    FriendlyName.Text = "My New Module";
                    DesktopSrc.Text   = "DesktopModules/MyNewModule.ascx";
                    MobileSrc.Text    = "";
                    ModuleGuid.Text   = defID.ToString();
                }
                else
                {
                    // Obtain the module definition to edit from the database
                    SqlDataReader dr = modules.GetSingleModuleDefinition(defID);

                    // Read in first row from database
                    while (dr.Read())
                    {
                        FriendlyName.Text  = dr["FriendlyName"].ToString();
                        DesktopSrc.Text    = dr["DesktopSrc"].ToString();
                        MobileSrc.Text     = dr["MobileSrc"].ToString();
                        ModuleGuid.Text    = dr["GeneralModDefID"].ToString();
                        ModuleGuid.Enabled = false;
                    }
                    dr.Close();
                }

                // Clear existing items in checkboxlist
                PortalsName.Items.Clear();

                // Populate checkbox list with all portals
                // and "check" the ones already configured for this tab
                SqlDataReader portals = modules.GetModuleInUse(defID);
                while (portals.Read())
                {
                    if (Convert.ToInt32(portals["PortalID"]) >= 0)
                    {
                        ListItem item = new ListItem();
                        item.Text  = (string)portals["PortalName"];
                        item.Value = portals["PortalID"].ToString();

                        if ((portals["checked"].ToString()) == "1")
                        {
                            item.Selected = true;
                        }
                        else
                        {
                            item.Selected = false;
                        }

                        PortalsName.Items.Add(item);
                    }
                }
                portals.Close(); //by Manu, fixed bug 807858
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Verify that the current user has access to access this page
            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
//			if (PortalSecurity.IsInRoles("Admins") == false)
//				PortalSecurity.AccessDeniedEdit();

            // Calculate security defID
            if (Request.Params["defID"] != null)
            {
                defID = new Guid(Request.Params["defID"]);
            }

            ModulesDB modules = new ModulesDB();

            // If this is the first visit to the page, bind the definition data
            if (Page.IsPostBack == false)
            {
                if (defID.Equals(Guid.Empty))
                {
                    ShowInstaller(true);
                    // new module definition
                    InstallerFileName.Text = "DesktopModules/MyModuleFolder/install.xml";
                    FriendlyName.Text      = "New Definition";
                    DesktopSrc.Text        = "DesktopModules/MyModule.ascx";
                    MobileSrc.Text         = "MobileModules/MyModule.ascx";
                }
                else
                {
                    ShowInstaller(false);
                    // Obtain the module definition to edit from the database
                    SqlDataReader dr = modules.GetSingleModuleDefinition(defID);

                    // Read in first row from database
                    while (dr.Read())
                    {
                        FriendlyName.Text = dr["FriendlyName"].ToString();
                        DesktopSrc.Text   = dr["DesktopSrc"].ToString();
                        MobileSrc.Text    = dr["MobileSrc"].ToString();
                        lblGUID.Text      = dr["GeneralModDefID"].ToString();
                    }
                    dr.Close(); //by Manu, fixed bug 807858
                }

                // Populate checkbox list with all portals
                // and "check" the ones already configured for this tab
                SqlDataReader portals = modules.GetModuleInUse(defID);

                // Clear existing items in checkboxlist
                PortalsName.Items.Clear();

                while (portals.Read())
                {
                    if (Convert.ToInt32(portals["PortalID"]) >= 0)
                    {
                        ListItem item = new ListItem();
                        item.Text  = (string)portals["PortalName"];
                        item.Value = portals["PortalID"].ToString();

                        if ((portals["checked"].ToString()) == "1")
                        {
                            item.Selected = true;
                        }
                        else
                        {
                            item.Selected = false;
                        }

                        PortalsName.Items.Add(item);
                    }
                }
                portals.Close(); //by Manu, fixed bug 807858
            }
        }