/// <summary>
        /// Handles the ItemDataBound event of the dgFile control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridItemEventArgs"/> instance containing the event data.</param>
        private void dgFile_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ||
                e.Item.ItemType == ListItemType.EditItem)
            {
                Image imgType = (Image)e.Item.FindControl("imgType");
                //PlaceHolder plhImgEdit = (PlaceHolder)e.Item.FindControl("plhImgEdit");
                LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName");
                //HyperLink imgACL = (HyperLink)e.Item.FindControl("imgACL");


                //HyperLink for Edit Text
                HyperLink hlImgEdit = new HyperLink();
                hlImgEdit.ImageUrl    = CurrentTheme.GetModuleImageSRC("btnEdit.gif");
                hlImgEdit.NavigateUrl = Path.ApplicationFullPath + "Desktopmodules/Filemanager/EditFile.aspx?ID=" +
                                        GetCurDir() + "\\" + DataBinder.Eval(e.Item.DataItem, "filename");
                //----

                int type = int.Parse(DataBinder.Eval(e.Item.DataItem, "type", "{0}"));
                if (type == 0)
                {
                    imgType.ImageUrl     = CurrentTheme.GetModuleImageSRC("dir.gif");
                    e.Item.Cells[2].Text = "";
                    e.Item.Cells[3].Text = "";
                }
                else
                {
                    string name = DataBinder.Eval(e.Item.DataItem, "filename", "{0}").Trim().ToLower();
                    lnkName.Enabled = IsDownloadable(name);
                    string ext = name.Substring(name.LastIndexOf(".") + 1);
                    imgType.ImageUrl = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/Ext/" + imageAsign(ext));
                }
            }
        }
        /// <summary>
        /// Handles the ItemDataBound event of the RolesList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataListItemEventArgs"/> instance containing the event data.</param>
        protected void RolesList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            // 20/7/2004 changed by Mario Endara [email protected]
            // don't let the user to edit or delete the role "Admins"
            // the rolename is an hyperlink to the list of users of the role
            Control   dl = e.Item.FindControl("ImageButton1");
            Control   d2 = e.Item.FindControl("ImageButton2");
            HyperLink d3 = ( HyperLink )e.Item.FindControl("Name");

            RainbowRole role = (( RainbowRole )e.Item.DataItem);

            // Added by Mario Endara <*****@*****.**> 2004/11/04
            // if the user is not member of the "Admins" role, he can´t access to the members of the Admins role
            // added mID by Mario Endara <*****@*****.**> to support security check (2004/11/27)
            if ((d3 != null) && (PortalSecurity.IsInRoles("Admins") == true || role.Name != "Admins"))
            {
                d3.NavigateUrl = HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Roles/SecurityRoles.aspx", PageID,
                                                         "mID=" + ModuleID + "&roleID=" + role.Id.ToString());
            }

            if (dl != null)
            {
                if (role.Name.Equals("Admins"))
                {
                    dl.Visible = false;
                }
                (( ImageButton )dl).Attributes.Add("OnClick", "return confirmDelete()");
            }
            if (d2 != null)
            {
                if (role.Name.Equals("Admins"))
                {
                    d2.Visible = false;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Raises the Init event.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            this.PlaceHolderButtons.EnableViewState  = false;
            this.PlaceholderButtons2.EnableViewState = false;

            //Controls must be created here
            updateButton          = new LinkButton();
            updateButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(updateButton);


            // jminond added to top of property page so no need to scroll for save
            LinkButton update2 = new LinkButton();

            update2.CssClass = "CommandButton";
            update2.TextKey  = "Apply";
            update2.Text     = "Apply";
            update2.Click   += new EventHandler(UpdateButton_Click);
            PlaceholderButtons2.Controls.Add(update2);

            PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
            PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));

            saveAndCloseButton          = new LinkButton();
            saveAndCloseButton.TextKey  = "OK";
            saveAndCloseButton.Text     = "Save and close";
            saveAndCloseButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(saveAndCloseButton);
            this.saveAndCloseButton.Click += new EventHandler(this.saveAndCloseButton_Click);


            // jminond added to top of property page so no need to scroll for save
            LinkButton saveAndCloseButton2 = new LinkButton();

            saveAndCloseButton2.TextKey  = "OK";
            saveAndCloseButton2.Text     = "Save and close";
            saveAndCloseButton2.CssClass = "CommandButton";
            PlaceholderButtons2.Controls.Add(saveAndCloseButton2);
            saveAndCloseButton2.Click += new EventHandler(this.saveAndCloseButton_Click);


            PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
            PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));

            moduleSettingsButton             = new HyperLink();
            moduleSettingsButton.TextKey     = "MODULESETTINGS_SETTINGS";
            moduleSettingsButton.Text        = "Settings";
            moduleSettingsButton.CssClass    = "CommandButton";
            moduleSettingsButton.NavigateUrl =
                Rainbow.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", PageID, ModuleID);
            PlaceHolderButtons.Controls.Add(moduleSettingsButton);

            // jminond added to top of property page so no need to scroll for save
            HyperLink moduleSettingsButton2 = new HyperLink();

            moduleSettingsButton2.TextKey     = "MODULESETTINGS_SETTINGS";
            moduleSettingsButton2.Text        = "Settings";
            moduleSettingsButton2.CssClass    = "CommandButton";
            moduleSettingsButton2.NavigateUrl =
                Rainbow.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", PageID, ModuleID);
            PlaceholderButtons2.Controls.Add(moduleSettingsButton2);

            PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
            PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));

            cancelButton          = new LinkButton();
            cancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(cancelButton);

            // jminond added to top of property page so no need to scroll for save
            LinkButton cancel2 = new LinkButton();

            cancel2.CssClass = "CommandButton";
            cancel2.TextKey  = "Cancel";
            cancel2.Text     = "Cancel";
            cancel2.Click   += new EventHandler(CancelButton_Click);
            PlaceholderButtons2.Controls.Add(cancel2);

            //			if (((Page) this.Page).IsCssFileRegistered("tabsControl") == false)
            //			{
            //				string themePath = Path.WebPathCombine(this.CurrentTheme.WebPath, "/tabControl.css");
            //				((Page) this.Page).RegisterCssFile("tabsControl", themePath);
            //			}
            if (!((Rainbow.Framework.Web.UI.Page) this.Page).IsCssFileRegistered("TabControl"))
            {
                ((Rainbow.Framework.Web.UI.Page) this.Page).RegisterCssFile("TabControl");
            }

            this.enableWorkflowSupport.CheckedChanged += new EventHandler(this.enableWorkflowSupport_CheckedChanged);
            this.Load += new EventHandler(this.Page_Load);
            base.OnInit(e);
        }
        // Override CreateChildControls to create the control tree.
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            // jes1111
            if (!((Page)Page).IsCssFileRegistered("Mod_Breadcrumbs"))
            {
                ((Page)Page).RegisterCssFile("Mod_Breadcrumbs");
            }


            // Create an arraylist to fill with
            // the PageItems representing the Tree
            ArrayList crumbs;

            if (HttpContext.Current != null)
            {
                // Obtain PortalSettings from Current Context
                PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

                //Changes by Indah Fuldner 25.04.2003
                //Display breadcrumbs if the user has click a tab link  (Without hit the Database again)
                if (portalSettings.ActivePage.PageID > 0)
                {
                    ArrayList authorizedTabs = new ArrayList();
                    int       addedTabs      = 0;
                    for (int i = 0; i < portalSettings.DesktopPages.Count; i++)
                    {
                        PageStripDetails tab = (PageStripDetails)portalSettings.DesktopPages[i];

                        if (PortalSecurity.IsInRoles(tab.AuthorizedRoles))
                        {
                            authorizedTabs.Add(tab);
                        }
                        addedTabs++;
                    }

                    crumbs = GetBreadCrumbs(portalSettings.ActivePage, authorizedTabs);
                    //crumbs.Sort();
                    //Fixing bug: http://support.rainbowportal.net/jira/browse/RBP-704
                    crumbs.Reverse();
                    //End Changes by Indah Fuldner
                }
                else
                {
                    crumbs = new ArrayList();
                }
            }
            else //design time
            {
                crumbs = new ArrayList();
                crumbs.Add("Item1");
                crumbs.Add("Item2");
                crumbs.Add("Item3");
            }

            if (crumbs.Count > 1)
            {
                TableRow  r = new TableRow();
                TableCell c = new TableCell();
                c.CssClass = "breadcrumbs";

                int ct = 0;

                // Build the Breadcrumbs and add them to the table
                foreach (PageItem item in crumbs)
                {
                    if (ct > 0)
                    {
                        Label divider = new Label();
                        divider.Text            = Separator;
                        divider.CssClass        = TextCSSClass;
                        divider.EnableViewState = false;
                        c.Controls.Add(divider);
                    }
                    if (ct != (crumbs.Count - 1))
                    {
                        HyperLink link = new HyperLink();
                        link.Text            = item.Name;
                        link.NavigateUrl     = HttpUrlBuilder.BuildUrl(item.ID);
                        link.EnableViewState = false;
                        link.CssClass        = LinkCSSClass;
                        c.Controls.Add(link);
                    }
                    else
                    {
                        Label lastlink = new Label();
                        lastlink.Text            = item.Name;
                        lastlink.CssClass        = LinkCSSClass;
                        lastlink.EnableViewState = false;
                        c.Controls.Add(lastlink);
                    }
                    ct++;
                }

                r.Cells.Add(c);
                Rows.Add(r);
            }
            else
            {
                Visible = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// On init
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            this.PlaceHolderButtons.EnableViewState  = false;
            this.PlaceholderButtons2.EnableViewState = false;

            //Controls must be created here
            updateButton          = new LinkButton();
            updateButton.CssClass = "CommandButton";

            PlaceHolderButtons.Controls.Add(updateButton);

            // jminond added to top of property page so no need to scroll for save
            LinkButton update2 = new LinkButton();

            update2.CssClass = "CommandButton";
            update2.TextKey  = "Apply";
            update2.Text     = "Apply";
            update2.Click   += new EventHandler(UpdateButton_Click);
            PlaceholderButtons2.Controls.Add(update2);

//			PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
//			PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));

            saveAndCloseButton          = new LinkButton();
            saveAndCloseButton.TextKey  = "SAVE_AND_CLOSE";
            saveAndCloseButton.Text     = "Save and close";
            saveAndCloseButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(saveAndCloseButton);

            // jminond added to top of property page so no need to scroll for save
            LinkButton saveAndCloseButton2 = new LinkButton();

            saveAndCloseButton2.TextKey  = "SAVE_AND_CLOSE";
            saveAndCloseButton2.Text     = "Save and close";
            saveAndCloseButton2.CssClass = "CommandButton";
            saveAndCloseButton2.Click   += new EventHandler(this.saveAndCloseButton_Click);
            PlaceholderButtons2.Controls.Add(saveAndCloseButton2);

            this.saveAndCloseButton.Click += new EventHandler(this.saveAndCloseButton_Click);

//			PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
//			PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));

            // Removed by Mario Endara <*****@*****.**> (2004/11/04)
//			if (Rainbow.Security.PortalSecurity.IsInRoles("Admins"))
//			{
            adminPropertiesButton             = new HyperLink();
            adminPropertiesButton.TextKey     = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton.Text        = "Edit base settings";
            adminPropertiesButton.CssClass    = "CommandButton";
            adminPropertiesButton.NavigateUrl =
                HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            PlaceHolderButtons.Controls.Add(adminPropertiesButton);

            // jminond added to top of property page so no need to scroll for save
            HyperLink adminPropertiesButton2 = new HyperLink();

            adminPropertiesButton2.TextKey     = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton2.Text        = "Edit base settings";
            adminPropertiesButton2.CssClass    = "CommandButton";
            adminPropertiesButton2.NavigateUrl =
                HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            PlaceholderButtons2.Controls.Add(adminPropertiesButton2);

//			PlaceHolderButtons.Controls.Add(new LiteralControl("&nbsp;"));
//			PlaceholderButtons2.Controls.Add(new LiteralControl("&nbsp;"));
//			}

            // jminond added to top of property page so no need to scroll for save
            LinkButton cancel2 = new LinkButton();

            cancel2.CssClass = "CommandButton";
            cancel2.TextKey  = "Cancel";
            cancel2.Text     = "Cancel";
            cancel2.Click   += new EventHandler(CancelButton_Click);
            PlaceholderButtons2.Controls.Add(cancel2);

            cancelButton          = new LinkButton();
            cancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(cancelButton);

//			if(((UI.Page)this.Page).IsCssFileRegistered("tabsControl") == false)
//			{
//				string themePath = Path.WebPathCombine(this.CurrentTheme.WebPath, "/tabControl.css");
//				((UI.Page)this.Page).RegisterCssFile("tabsControl", themePath);
//			}
// Modified by Hongwei Shen 10/72005-- the css file will be inject with the main theme
//			if(!((UI.Page)this.Page).IsCssFileRegistered("TabControl"))
//				((UI.Page)this.Page).RegisterCssFile("TabControl");


            this.EditTable.UpdateControl += new UpdateControlEventHandler(this.EditTable_UpdateControl);
            this.Load += new EventHandler(this.PagePropertyPage_Load);
            base.OnInit(e);
        }
        /// <summary>
        /// DisplayImages
        /// </summary>
        public void DisplayImages()
        {
            _returnPath = "~~/" + ((SettingItem)moduleSettings["FlashPath"]).Value;
            string[] galleryfolderarray = ReturnFolderContentArray();
            flashTable.Controls.Clear();
            if (galleryfolderarray == null || galleryfolderarray.Length == 0)
            {
                gallerymessage.Text = _noImagesMessage;
            }
            else
            {
                string galleryfilename = (string.Empty);

                TableRow  rowItem;
                TableCell cellItemImage;
                TableCell cellItemSelect;
                TableCell cellItemDelete;
                TableCell cellItemFileName;
                foreach (string galleryfolderarrayitem in galleryfolderarray)
                {
                    galleryfilename = galleryfolderarrayitem.ToString();
                    galleryfilename = galleryfilename.Substring(galleryfilename.LastIndexOf(@"\") + 1);

                    FlashMovie flashMovie = new FlashMovie();
                    flashMovie.MovieName   = _imageFolder + "/" + galleryfilename;
                    flashMovie.MovieHeight = "150px";
                    flashMovie.MovieWidth  = "150px";

                    Label filenameLbl = new Label();
                    filenameLbl.Text = galleryfilename;
                    HyperLink selectCmd = new HyperLink();
                    selectCmd.TextKey     = "SELECT";
                    selectCmd.Text        = "Select"; //by yiming
                    selectCmd.CssClass    = "CommandButton";
                    selectCmd.NavigateUrl = "javascript:UpdateOpener('" + _returnPath + "/" + galleryfilename +
                                            "');self.close();";
                    LinkButton deleteCmd = new LinkButton();
                    deleteCmd.TextKey         = "DELETE";
                    deleteCmd.Text            = "Delete";
                    deleteCmd.CommandName     = "DELETE";
                    deleteCmd.CssClass        = "CommandButton";
                    deleteCmd.CommandArgument = galleryfilename;
                    deleteCmd.Command        += new CommandEventHandler(Delete_Command);

                    rowItem = new TableRow();

                    cellItemImage    = new TableCell();
                    cellItemSelect   = new TableCell();
                    cellItemDelete   = new TableCell();
                    cellItemFileName = new TableCell();
                    cellItemImage.Controls.Add(flashMovie);
                    cellItemFileName.Controls.Add(filenameLbl);
                    cellItemSelect.Controls.Add(selectCmd);
                    cellItemDelete.Controls.Add(deleteCmd);


                    rowItem.Controls.Add(cellItemImage);
                    rowItem.Controls.Add(cellItemFileName);
                    rowItem.Controls.Add(cellItemSelect);
                    rowItem.Controls.Add(cellItemDelete);

                    flashTable.Controls.Add(rowItem);
                    gallerymessage.Text = string.Empty;
                }
            }
        }