/// <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)); } } }
/// <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> /// <remarks></remarks> protected override void OnLoad(EventArgs e) { base.OnLoad(e); const string LayoutBasePage = "DesktopFooter.ascx"; // Obtain PortalSettings from Current Context var portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; if (portalSettings == null) { return; } var footerPage = Path.WebPathCombine(portalSettings.PortalLayoutPath, LayoutBasePage); if (File.Exists(this.Server.MapPath(footerPage))) { this.LayoutPlaceHolder.Controls.Add(this.Page.LoadControl(footerPage)); } // try // { // //LayoutPlaceHolder.Controls.Add(Page.LoadControl(portalSettings.PortalLayoutPath + LayoutBasePage)); // LayoutPlaceHolder.Controls.Add(Page.LoadControl(portalSettings.PortalLayoutPath + LayoutBasePage)); // } // catch // { // //No footer available // } }
/// <summary> /// Inits the images. /// </summary> private void InitImages() { imgroot = Path.WebPathCombine(this.CurrentTheme.WebPath, "/img/"); btnDelete.ImageUrl = this.CurrentTheme.GetModuleImageSRC("delete.png"); btnGoUp.ImageUrl = this.CurrentTheme.GetModuleImageSRC("FolderUp.gif"); btnNewFolder.ImageUrl = this.CurrentTheme.GetModuleImageSRC("newfolder.gif"); }
/// <summary> /// Defaults the dir. /// </summary> /// <returns></returns> private string DefaultDir() { string tmpDir = Path.WebPathCombine(Path.ApplicationPhysicalPath, this.PortalSettings.PortalPath); tmpDir = tmpDir.Replace("\\/", "\\"); tmpDir = tmpDir.Replace("/", "\\"); return(tmpDir); }
/// <summary> /// Raises OnInit event. /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { this.Load += new EventHandler(this.Page_Load); this.baseImageDIR = Path.WebPathCombine(Path.ApplicationRoot, "/aspnet_client/Ext/"); // no need for viewstate here - jminond this.myPlaceHolder.EnableViewState = false; base.OnInit(e); }
/// <summary> /// ShowDetail link creator /// </summary> /// <param name="order"> /// The order. /// </param> /// <returns> /// The get sort order image. /// </returns> private string GetSortOrderImg(string order) { var s = string.Format( @"<img src='{0}' width='10' height='9' border='0'>", order == "DESC" ? Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortdescending.gif") : Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortascending.gif")); return(s); }
/// <summary> /// Handles the Load event of the Page control. /// </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) { string topText = General.GetString("MAGICURLS_TOPTEXT", "<b>MagicUrls</b> enables users to navigate to pages within a portal by appending just a number or a string to the base URL (like www.myportal.net/2291 or www.myportal.net/special). Numbers will always be interpreted automatically as a PageID. To use a string, enter it in the 'key' column and assign it to a PageID (e.g. 2291), an internal URL (e.g. ~/site/2291/special.aspx) or an external URL (e.g. http://www.microsoft.com) in the 'value' column. "); topText = String.Format("<p>{0}</p>", topText); PlaceHolder1.Controls.Add(new LiteralControl(topText)); string btmText = General.GetString("MAGICURLS_BTMTEXT", "NOTE: for this feature to work, you must assign a Custom Error in IIS - map 404 errors to '/Appleseed/app_support/SmartError.aspx' (assuming Appleseed is the name of your virtual directory)."); btmText = String.Format("<p>{0}</p>", btmText); PlaceHolder2.Controls.Add(new LiteralControl(btmText)); if (!Page.IsPostBack) { XmlDocument _checkXml = new XmlDocument(); myFolder = Path.WebPathCombine(this.PortalSettings.PortalPath, "MagicUrl"); if (!Directory.Exists(Server.MapPath(myFolder))) { Directory.CreateDirectory(Server.MapPath(myFolder)); } myFile = Path.WebPathCombine(myFolder, "MagicUrlList.xml"); if (!File.Exists(Server.MapPath(myFile))) { StreamWriter sr = File.CreateText(Server.MapPath(myFile)); sr.WriteLine("<?xml version=\"1.0\" standalone=\"yes\" ?>"); sr.WriteLine("<MagicUrlList>"); sr.WriteLine("<MagicUrl key=\"home\" value=\"0\"/>"); sr.WriteLine("</MagicUrlList>"); sr.Close(); } else { _checkXml.Load(Server.MapPath(myFile)); if (!_checkXml.DocumentElement.HasChildNodes) { //Create a document fragment XmlDocumentFragment docFrag = _checkXml.CreateDocumentFragment(); docFrag.InnerXml = "<MagicUrl key=\"home\" value=\"0\"/>"; _checkXml.DocumentElement.AppendChild(docFrag); XmlTextWriter x = new XmlTextWriter(Server.MapPath(myFile), Encoding.UTF8); _checkXml.WriteTo(x); x.Close(); } } XmlEditGrid1.XmlFile = myFile; } }
/// <summary> /// Inits the dir. /// </summary> /// <returns></returns> private string InitDir() { //Current Portal root or deeper is allowed string tmpDir = Path.WebPathCombine(Path.ApplicationPhysicalPath, Settings["FM_DIRECTORY"].ToString()); tmpDir = tmpDir.Replace("\\/", "\\"); tmpDir = tmpDir.Replace("/", "\\"); if (!tmpDir.StartsWith(DefaultDir())) { tmpDir = DefaultDir(); } return(tmpDir); }
/// <summary> /// Handles the Load event of the Page control. /// </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) { treeImageDIR = Path.WebPathCombine(this.CurrentTheme.WebPath, "/img/"); LoadAvailableImageList(); path = Settings["Directory"].ToString(); myStyle = Settings["Style"].ToString(); LinkType = Settings["LinkType"].ToString(); // Check if the last character is an backslash. If not, append it. if (path.Length == 0) { path = "\\"; } else { if (path.Substring(path.Length - 1, 1) != "\\") { path += "\\"; } } physRoot = Server.MapPath(Path.ApplicationRoot); // Support for old installs may have physical path we want virtual. if (path.IndexOf(":") >= 0) { // find app root from phsyical path and cut so we only have virtual path path = path.Substring(Path.ApplicationPhysicalPath.Length); } Trace.Warn("path = " + path); // Check to make sure path exists before entering render methods if (Directory.Exists(Server.MapPath(path))) { Write("<script language='javascript'>baseImg = '" + treeImageDIR + "';</script>"); Write("<span style='" + myStyle + "'>\n"); parseDirectory(Server.MapPath(path)); // Close the span and create the Toggle javascript function. Write("</span>"); } else { Write("<span class='Error'>Error! The directory path you specified does not exist.</span>"); } }
/// <summary> /// Loads the control. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> private void LoadControl(object sender, EventArgs e) { base.SystemScriptPath = string.Concat( Path.ApplicationRoot, "/aspnet_client/SolpartWebControls_SolpartMenu/1_4_0_0/"); var PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; var solpart = string.Concat(Path.ApplicationRoot, "/aspnet_client/SolpartWebControls_SolpartMenu/1_4_0_0/"); if (this.ShowIconMenu) { base.SystemImagesPath = Path.WebPathCombine(PortalSettings.PortalLayoutPath, "menuimages/"); var menuDirectory = HttpContext.Current.Server.MapPath(base.SystemImagesPath); // Create directory and copy standard images for solpart if (!Directory.Exists(menuDirectory)) { Directory.CreateDirectory(menuDirectory); var solpartPhysicalDir = HttpContext.Current.Server.MapPath(solpart); if (File.Exists(solpartPhysicalDir + "/spacer.gif")) { File.Copy(solpartPhysicalDir + "/spacer.gif", menuDirectory + "/spacer.gif"); File.Copy(solpartPhysicalDir + "/spacer.gif", menuDirectory + "/menu.gif"); } if (File.Exists(solpartPhysicalDir + "/icon_arrow.gif")) { File.Copy(solpartPhysicalDir + "/icon_arrow.gif", menuDirectory + "/icon_arrow.gif"); } } } else { base.SystemImagesPath = solpart; } base.MenuCSSPlaceHolderControl = "spMenuStyle"; base.SeparateCSS = true; if (this.AutoBind) { this.DataBind(); } }
/// <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> /// <remarks> /// </remarks> protected override void OnLoad(EventArgs e) { base.OnLoad(e); const string LayoutBasePage = "DesktopPortalBanner.ascx"; // Obtain PortalSettings from Current Context var portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; if (portalSettings == null) { return; } // jes1111 portalSettings.ShowPages = this.ShowTabs; // [START] file path -- [email protected] // Validate that the layout file is present. I have found // that sometimes they go away in different releases. So let's check // string filepath = portalSettings.PortalLayoutPath + LayoutBasePage; var filepath = Path.WebPathCombine(portalSettings.PortalLayoutPath, LayoutBasePage); // does it exist if (File.Exists(this.Server.MapPath(filepath))) { this.LayoutPlaceHolder.Controls.Add(this.Page.LoadControl(filepath)); } else { // create an exception var ex = new Exception(string.Format("Portal cannot find layout ('{0}')", filepath)); // go log/handle it // ErrorHandler.HandleException(ex); ErrorHandler.Publish(LogLevel.Error, ex); } // [END] file path -- [email protected] }