Exemplo n.º 1
0
        /// <summary>
        /// Handles the ItemCommand event of the dgFile control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
        private void dgFile_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "ItemClicked")
            {
                dgFile.EditItemIndex = -1;
                LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName");
                int        type    = int.Parse(dgFile.DataKeys[e.Item.ItemIndex].ToString());
                if (type == 0)
                {
                    SetCurDir(System.IO.Path.Combine(GetCurDir(), lnkName.Text));
                }
                else if (Settings["FM_DOWNLOADABLEEXT"].ToString() != "")
                {
                    string filename = System.IO.Path.Combine(GetCurDir(), lnkName.Text);
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + lnkName.Text.Trim());
                    Response.WriteFile(filename);
                    Response.End();
                }

                if (type == 0)
                {
                    try
                    {
                        BindData();
                    }
                    catch (Exception ex)
                    {
                        lblError.Text = ex.Message;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <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    = this.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     = this.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));
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the EditCommand event of the dgFile control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param>
        private void dgFile_EditCommand(object source, DataGridCommandEventArgs e)
        {
            dgFile.EditItemIndex = e.Item.ItemIndex;
            LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName");

            ViewState["lastSelection"] = lnkName.Text;
            BindData();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Deletes the item.
        /// </summary>
        /// <param name="e">The e.</param>
        private void DeleteItem(DataGridItem e)
        {
            LinkButton lnkName = (LinkButton)e.FindControl("lnkName");
            int        type    = int.Parse(dgFile.DataKeys[e.ItemIndex].ToString());

            if (type == 0)
            {
                Directory.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text), true);
            }
            else
            {
                File.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// This function traverses a given directory and finds all its nested directories and
        /// files.  As the function encounters nested directories, it calls a new instance of
        /// the procedure passing the new found directory as a parameter.  Files within the
        /// directories are nested and tabulated.
        /// </summary>
        /// <param name="path">Directory path to traverse.</param>
        private void parseDirectory(string path)
        {
            string[] entry;
            try
            {
                // Retrieve all entry (entry & directories) from the current path
                entry = Directory.GetFileSystemEntries(path);
                string contentType;
                int    locDot = 0;

                // For each entry in the directory...
                for (int i = 0; i < entry.Length; i++)
                {
                    // Trim the file path from the file, leaving the filename
                    string filename = entry[i].Replace(path, string.Empty);
                    if (!filename.StartsWith("."))
                    {
                        // If the current entry is a directory...
                        if (Directory.Exists(entry[i]))
                        {
                            // Find how many entry the subdirectory has and create an objectID name for the subdirectory
                            int    subentries = Directory.GetFileSystemEntries(entry[i]).Length;
                            string objectID;

                            if (entry[i].Length > 0)
                            {
                                objectID = entry[i].Replace(physRoot, string.Empty).Replace("\\", "~");
                            }
                            else
                            {
                                objectID = "~";
                            }

                            // Define the span that holds the opened/closed directory icon
                            Write("<img id='" + objectID + "_img'");

                            if (Settings["Collapsed"].ToString().Equals("True"))
                            {
                                Write("src='" + treeImageDIR + "dir.gif'");
                            }
                            else
                            {
                                Write("src='" + treeImageDIR + "dir_open.gif'");
                            }

                            Write(" />&nbsp;<a href=\"javascript:Toggle('" + objectID + "')\" " +
                                  // Create a hover tag that contains content details about the subdirectory.
                                  "title=\"" + subentries.ToString() + " entries found.\">" + filename + "</a>" +
                                  "&nbsp;<br />\n<div id='" + objectID + "' style='");

                            if (Settings["Collapsed"].ToString().Equals("True"))
                            {
                                Write("display:none;");
                            }
                            else
                            {
                                Write("display:block;");
                            }

                            if (!Settings["Indent"].ToString().Equals(string.Empty))
                            {
                                Write("left:" + Settings["Indent"].ToString() + "; ");
                            }

                            // Call the parseDirectory for the new subdirectory.
                            Write("POSITION: relative;'>\n");

                            parseDirectory(entry[i] + "\\");

                            Write("</div>\n");
                        }
                        else // ...the current entry is a file.
                        {
                            locDot = filename.LastIndexOf(".") + 1;

                            if (locDot > 0)
                            {
                                contentType = filename.Substring(locDot);
                            }
                            else
                            {
                                contentType = "unknown";
                            }

                            // create a file icon
                            // jminond - switched to use extensions pack
                            if (availExtensions.ContainsKey(contentType))
                            {
                                Write("<img src='" + baseImageDIR + availExtensions[contentType].ToString() + "' />");
                            }
                            else
                            {
                                Write("<img src='" + baseImageDIR + "unknown.gif' />");
                            }
                            Write("&nbsp;");

                            if (LinkType.Equals("Network Share"))
                            {
                                Write("<a href='" + entry[i] + "' title='Last Write Time: " +
                                      File.GetLastWriteTime(entry[i]).ToString());
                                Write("' target='_" + Settings["Target"].ToString() + "'>" + filename + "</a>");
                            }
                            else
                            {
                                // Create the link to the file.
                                LinkButton lb = new LinkButton();
                                lb.Text            = filename;
                                lb.CommandArgument = entry[i];
                                lb.Click          += new EventHandler(Download);
                                myPlaceHolder.Controls.Add(lb);
                            }

                            Write("&nbsp;<br />\n");
                        }
                    }
                }
            }

            catch (DirectoryNotFoundException)
            {
                Write("<span class='Error'>Error!  The directory path you specified does not exist.</span>");
                return;
            }
            catch (Exception e1) // All other exceptions...
            {
                Write("<span class='Error'>" + e1.ToString() + "</span>");
                return;
            }
        }
Exemplo n.º 6
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)
        {
            this.PlaceHolderButtons.EnableViewState  = false;
            this.PlaceholderButtons2.EnableViewState = false;

            // Controls must be created here
            this.UpdateButton = new LinkButton {
                CssClass = "CommandButton"
            };
            PlaceHolderButtons.Controls.Add(this.UpdateButton);

            // jminond added to top of property page so no need to scroll for save
            var update2 = new LinkButton {
                CssClass = "CommandButton", TextKey = "Apply", Text = "Apply"
            };

            update2.Click += this.UpdateButtonClick;
            PlaceholderButtons2.Controls.Add(update2);

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

            this.saveAndCloseButton = new LinkButton
            {
                TextKey = "OK", Text = "Save and close", CssClass = "CommandButton"
            };
            PlaceHolderButtons.Controls.Add(saveAndCloseButton);
            this.saveAndCloseButton.Click += this.SaveAndCloseButtonClick;

            // jminond added to top of property page so no need to scroll for save
            var saveAndCloseButton2 = new LinkButton
            {
                TextKey = "OK", Text = "Save and close", CssClass = "CommandButton"
            };

            PlaceholderButtons2.Controls.Add(saveAndCloseButton2);
            saveAndCloseButton2.Click += this.SaveAndCloseButtonClick;

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

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl(
                "~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", this.PageID, this.ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                {
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
                }
            }

            this.moduleSettingsButton = new HyperLink
            {
                TextKey     = "MODULESETTINGS_SETTINGS",
                Text        = "Settings",
                CssClass    = "CommandButton",
                NavigateUrl = NavigateUrlPropertyPage
            };
            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                moduleSettingsButton.Attributes.Add("onclick", "ChangeModalTitle('Module Settings');");
            }
            PlaceHolderButtons.Controls.Add(moduleSettingsButton);

            // jminond added to top of property page so no need to scroll for save
            var moduleSettingsButton2 = new HyperLink
            {
                TextKey     = "MODULESETTINGS_SETTINGS",
                Text        = "Settings",
                CssClass    = "CommandButton",
                NavigateUrl = NavigateUrlPropertyPage
            };

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                moduleSettingsButton2.Attributes.Add("onclick", "ChangeModalTitle('Module Settings');");
            }
            PlaceholderButtons2.Controls.Add(moduleSettingsButton2);

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

            this.CancelButton = new LinkButton {
                CssClass = "CommandButton"
            };
            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                this.CancelButton.ID = "SecurityCancelButton";
            }
            PlaceHolderButtons.Controls.Add(this.CancelButton);

            // jminond added to top of property page so no need to scroll for save
            var cancel2 = new LinkButton {
                CssClass = "CommandButton", TextKey = "Cancel", Text = "Cancel"
            };

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                cancel2.ID = "SecurityCancelButton2";
            }
            cancel2.Click += this.CancelButtonClick;
            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);
            // }


            this.enableWorkflowSupport.CheckedChanged += this.EnableWorkflowSupportCheckedChanged;
            base.OnInit(e);
        }
Exemplo n.º 7
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
            this.UpdateButton = new LinkButton();
            this.UpdateButton.CssClass = "CommandButton";

            PlaceHolderButtons.Controls.Add(this.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 (Appleseed.Security.PortalSecurity.IsInRoles("Admins"))
            //			{

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null) {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
            }

            adminPropertiesButton = new HyperLink();
            adminPropertiesButton.TextKey = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton.Text = "Edit base settings";
            adminPropertiesButton.CssClass = "CommandButton";
            adminPropertiesButton.NavigateUrl = NavigateUrlPropertyPage;

            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 = NavigateUrlPropertyPage;

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

            this.CancelButton = new LinkButton();
            this.CancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(this.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);
        }
Exemplo n.º 8
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
            this.UpdateButton          = new LinkButton();
            this.UpdateButton.CssClass = "CommandButton";

            PlaceHolderButtons.Controls.Add(this.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);

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

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                {
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
                }
            }

            adminPropertiesButton             = new HyperLink();
            adminPropertiesButton.TextKey     = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton.Text        = "Edit base settings";
            adminPropertiesButton.CssClass    = "CommandButton";
            adminPropertiesButton.NavigateUrl = NavigateUrlPropertyPage;

            if (Framework.Security.UserProfile.HasPortalAdministrationAccess() || Framework.Security.UserProfile.HasModuleAddEditAccess())
            {
                PlaceHolderButtons.Controls.Add(adminPropertiesButton);
            }

            // 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);

            // 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 = NavigateUrlPropertyPage;

            if (Framework.Security.UserProfile.HasPortalAdministrationAccess() || Framework.Security.UserProfile.HasModuleAddEditAccess())
            {
                PlaceholderButtons2.Controls.Add(adminPropertiesButton2);
            }

            this.EditTable.UpdateControl += new UpdateControlEventHandler(this.EditTable_UpdateControl);
            this.Load += new EventHandler(this.PagePropertyPage_Load);
            base.OnInit(e);
        }
        /// <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)
        {
            this.PlaceHolderButtons.EnableViewState = false;
            this.PlaceholderButtons2.EnableViewState = false;

            // Controls must be created here
            this.UpdateButton = new LinkButton { CssClass = "CommandButton" };
            PlaceHolderButtons.Controls.Add(this.UpdateButton);

            // jminond added to top of property page so no need to scroll for save
            var update2 = new LinkButton { CssClass = "CommandButton", TextKey = "Apply", Text = "Apply" };
            update2.Click += this.UpdateButtonClick;
            PlaceholderButtons2.Controls.Add(update2);

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

            this.saveAndCloseButton = new LinkButton
                {
                    TextKey = "OK", Text = "Save and close", CssClass = "CommandButton"
                };
            PlaceHolderButtons.Controls.Add(saveAndCloseButton);
            this.saveAndCloseButton.Click += this.SaveAndCloseButtonClick;

            // jminond added to top of property page so no need to scroll for save
            var saveAndCloseButton2 = new LinkButton
                {
                    TextKey = "OK", Text = "Save and close", CssClass = "CommandButton"
                };
            PlaceholderButtons2.Controls.Add(saveAndCloseButton2);
            saveAndCloseButton2.Click += this.SaveAndCloseButtonClick;

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

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl(
                            "~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", this.PageID, this.ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null) {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
            }

            this.moduleSettingsButton = new HyperLink
                {
                    TextKey = "MODULESETTINGS_SETTINGS",
                    Text = "Settings",
                    CssClass = "CommandButton",
                    NavigateUrl = NavigateUrlPropertyPage

                };
            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                moduleSettingsButton.Attributes.Add("onclick", "ChangeModalTitle('Module Settings');");
            PlaceHolderButtons.Controls.Add(moduleSettingsButton);

            // jminond added to top of property page so no need to scroll for save
            var moduleSettingsButton2 = new HyperLink
                {
                    TextKey = "MODULESETTINGS_SETTINGS",
                    Text = "Settings",
                    CssClass = "CommandButton",
                    NavigateUrl = NavigateUrlPropertyPage
                };
            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                moduleSettingsButton2.Attributes.Add("onclick", "ChangeModalTitle('Module Settings');");
            PlaceholderButtons2.Controls.Add(moduleSettingsButton2);

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

            this.CancelButton = new LinkButton { CssClass = "CommandButton" };
            if (Request.QueryString.GetValues("ModalChangeMaster")!=null)
                this.CancelButton.ID = "SecurityCancelButton";
            PlaceHolderButtons.Controls.Add(this.CancelButton);

            // jminond added to top of property page so no need to scroll for save
            var cancel2 = new LinkButton { CssClass = "CommandButton", TextKey = "Cancel", Text = "Cancel" };
            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                cancel2.ID = "SecurityCancelButton2";
            cancel2.Click += this.CancelButtonClick;
            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);
            // }

            this.enableWorkflowSupport.CheckedChanged += this.EnableWorkflowSupportCheckedChanged;
            base.OnInit(e);
        }
        /// <summary>
        /// This function traverses a given directory and finds all its nested directories and
        /// files.  As the function encounters nested directories, it calls a new instance of
        /// the procedure passing the new found directory as a parameter.  Files within the
        /// directories are nested and tabulated.
        /// </summary>
        /// <param name="path">Directory path to traverse.</param>
        private void parseDirectory(string path)
        {
            string[] entry;
            try
            {
                // Retrieve all entry (entry & directories) from the current path
                entry = Directory.GetFileSystemEntries(path);
                string contentType;
                int locDot = 0;

                // For each entry in the directory...
                for (int i = 0; i < entry.Length; i++)
                {

                    // Trim the file path from the file, leaving the filename
                    string filename = entry[i].Replace(path, string.Empty);
                    if (!filename.StartsWith("."))
                    {
                        // If the current entry is a directory...
                        if (Directory.Exists(entry[i]))
                        {
                            // Find how many entry the subdirectory has and create an objectID name for the subdirectory
                            int subentries = Directory.GetFileSystemEntries(entry[i]).Length;
                            string objectID;

                            if (entry[i].Length > 0)
                                objectID = entry[i].Replace(physRoot, string.Empty).Replace("\\", "~");
                            else
                                objectID = "~";

                            // Define the span that holds the opened/closed directory icon
                            Write("<img id='" + objectID + "_img'");

                            if (Settings["Collapsed"].ToString().Equals("True"))
                                Write("src='" + treeImageDIR + "dir.gif'");
                            else
                                Write("src='" + treeImageDIR + "dir_open.gif'");

                            Write(" />&nbsp;<a href=\"javascript:Toggle('" + objectID + "')\" " +
                                // Create a hover tag that contains content details about the subdirectory.
                                  "title=\"" + subentries.ToString() + " entries found.\">" + filename + "</a>" +
                                  "&nbsp;<br />\n<div id='" + objectID + "' style='");

                            if (Settings["Collapsed"].ToString().Equals("True"))
                                Write("display:none;");
                            else
                                Write("display:block;");

                            if (!Settings["Indent"].ToString().Equals(string.Empty))
                                Write("left:" + Settings["Indent"].ToString() + "; ");

                            // Call the parseDirectory for the new subdirectory.
                            Write("POSITION: relative;'>\n");

                            parseDirectory(entry[i] + "\\");

                            Write("</div>\n");
                        }
                        else // ...the current entry is a file.
                        {
                            locDot = filename.LastIndexOf(".") + 1;

                            if (locDot > 0)
                                contentType = filename.Substring(locDot);
                            else
                                contentType = "unknown";

                            // create a file icon
                            // jminond - switched to use extensions pack
                            if (availExtensions.ContainsKey(contentType))
                            {
                                Write("<img src='" + baseImageDIR + availExtensions[contentType].ToString() + "' />");
                            }
                            else
                            {
                                Write("<img src='" + baseImageDIR + "unknown.gif' />");
                            }
                            Write("&nbsp;");

                            if (LinkType.Equals("Network Share"))
                            {
                                Write("<a href='" + entry[i] + "' title='Last Write Time: " +
                                      File.GetLastWriteTime(entry[i]).ToString());
                                Write("' target='_" + Settings["Target"].ToString() + "'>" + filename + "</a>");
                            }
                            else
                            {
                                // Create the link to the file.
                                LinkButton lb = new LinkButton();
                                lb.Text = filename;
                                lb.CommandArgument = entry[i];
                                lb.Click += new EventHandler(Download);
                                myPlaceHolder.Controls.Add(lb);
                            }

                            Write("&nbsp;<br />\n");
                        }
                    }
                }
            }

            catch (DirectoryNotFoundException)
            {
                Write("<span class='Error'>Error!  The directory path you specified does not exist.</span>");
                return;
            }
            catch (Exception e1) // All other exceptions...
            {
                Write("<span class='Error'>" + e1.ToString() + "</span>");
                return;
            }
        }
Exemplo n.º 11
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
            this.UpdateButton          = new LinkButton();
            this.UpdateButton.CssClass = "CommandButton";

            PlaceHolderButtons.Controls.Add(this.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 (Appleseed.Security.PortalSecurity.IsInRoles("Admins"))
//			{

            string NavigateUrlPropertyPage = Appleseed.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID);

            if (Request.QueryString.GetValues("ModalChangeMaster") != null)
            {
                NavigateUrlPropertyPage += "&ModalChangeMaster=true";
                if (Request.QueryString.GetValues("camefromEditPage") != null)
                {
                    NavigateUrlPropertyPage += "&camefromEditPage=true";
                }
            }

            adminPropertiesButton             = new HyperLink();
            adminPropertiesButton.TextKey     = "MODULESETTINGS_BASE_SETTINGS";
            adminPropertiesButton.Text        = "Edit base settings";
            adminPropertiesButton.CssClass    = "CommandButton";
            adminPropertiesButton.NavigateUrl = NavigateUrlPropertyPage;

            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 = NavigateUrlPropertyPage;


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

            this.CancelButton          = new LinkButton();
            this.CancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(this.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);
        }