private void DesktopPortalBanner_Load(object sender, EventArgs e)
        {
            string LayoutBasePage = "DesktopPortalBanner.ascx";

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

            // jes1111
            portalSettings.ShowPages = 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;
            string filepath = Path.WebPathCombine(portalSettings.PortalLayoutPath, LayoutBasePage);

            // does it exsists
            if (File.Exists(Server.MapPath(filepath)))
            {
                LayoutPlaceHolder.Controls.Add(Page.LoadControl(filepath));
            }
            else
            {
                // create an exception
                Exception ex = new Exception("Portal cannot find layout ('" + filepath + "')");
                // go log/handle it
                //ErrorHandler.HandleException(ex);
                Rainbow.Framework.ErrorHandler.Publish(Rainbow.Framework.LogLevel.Error, ex);
            }
            // [END] file path -- [email protected]
        }
コード例 #2
0
 /// <summary>
 /// Inits the images.
 /// </summary>
 private void InitImages()
 {
     imgroot               = Path.WebPathCombine(CurrentTheme.WebPath, "/img/");
     btnDelete.ImageUrl    = CurrentTheme.GetModuleImageSRC("delete.png");
     btnGoUp.ImageUrl      = CurrentTheme.GetModuleImageSRC("FolderUp.gif");
     btnNewFolder.ImageUrl = CurrentTheme.GetModuleImageSRC("newfolder.gif");
 }
コード例 #3
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    = 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));
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Defaults the dir.
        /// </summary>
        /// <returns></returns>
        private string DefaultDir()
        {
            string tmpDir = Path.WebPathCombine(Path.ApplicationPhysicalPath, 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);
        }
コード例 #6
0
        /// <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 '/rainbow/app_support/SmartError.aspx' (assuming rainbow 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(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;
            }
        }
コード例 #7
0
        /// <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(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>
        /// ShowDetail link creator
        /// </summary>
        /// <returns></returns>
        private string GetSortOrderImg(string order)
        {
            string s;

            if (order == "DESC")
            {
                s = @"<img src='" +
                    Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortdescending.gif") +
                    "' width='10' height='9' border='0'>";
            }
            else
            {
                s = @"<img src='" +
                    Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortascending.gif") +
                    "' width='10' height='9' border='0'>";
            }
            return(s);
        }
コード例 #10
0
        /// <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/");
            PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
            string         solpart        =
                string.Concat(Path.ApplicationRoot, "/aspnet_client/SolpartWebControls_SolpartMenu/1_4_0_0/");

            if (ShowIconMenu)
            {
                base.SystemImagesPath = Path.WebPathCombine(portalSettings.PortalLayoutPath, "menuimages/");
                string menuDirectory = HttpContext.Current.Server.MapPath(base.SystemImagesPath);

                // Create directory and copy standard images for solpart
                if (!Directory.Exists(menuDirectory))
                {
                    Directory.CreateDirectory(menuDirectory);
                    string 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 (AutoBind)
            {
                DataBind();
            }
        }
        /// <summary>
        /// Binds the XSL.
        /// </summary>
        public void BindXSL()
        {
            PortalUrlDataType pt = new PortalUrlDataType();

            pt.Value = Settings["XSLsrc"].ToString();
            string xslsrc = pt.FullPath;

            if ((xslsrc != null) && (xslsrc.Length != 0))
            {
                if (File.Exists(Server.MapPath(xslsrc)))
                {
                    xmlControl.TransformSource = xslsrc;
                    // Change - 28/Feb/2003 - Jeremy Esland
                    // Builds cache dependency files list
                    this.ModuleConfiguration.CacheDependency.Add(Server.MapPath(xslsrc));
                }
                else
                {
                    xmlControl.TransformSource = Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/default.xslt");
                    Controls.Add(new LiteralControl("<br>" + "<span class='Error'>" + General.GetString("FILE_NOT_FOUND").Replace("%1%", xslsrc) + "<br>"));
                }
            }
        }
コード例 #12
0
        private void DesktopFooter_Load(object sender, EventArgs e)
        {
            string LayoutBasePage = "DesktopFooter.ascx";

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

            string footerPage = Path.WebPathCombine(portalSettings.PortalLayoutPath, LayoutBasePage);

            if (File.Exists(Server.MapPath(footerPage)))
            {
                LayoutPlaceHolder.Controls.Add(Page.LoadControl(footerPage));
            }
//			try
//			{
//				//LayoutPlaceHolder.Controls.Add(Page.LoadControl(portalSettings.PortalLayoutPath + LayoutBasePage));
//				LayoutPlaceHolder.Controls.Add(Page.LoadControl(portalSettings.PortalLayoutPath + LayoutBasePage));
//			}
//			catch
//			{
//				//No footer available
//			}
        }
コード例 #13
0
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);
            byte[] buffer = new byte[0];
            int    size   = 0;

            // Only Update if Input Data is Valid
            if (Page.IsValid)
            {
                // Create an instance of the Document DB component
                DocumentDB documents = new DocumentDB();

                // Determine whether a file was uploaded
                if (FileUpload.PostedFile.FileName != string.Empty)
                {
                    FileInfo fInfo = new FileInfo(FileUpload.PostedFile.FileName);
                    if (bool.Parse(moduleSettings["DOCUMENTS_DBSAVE"].ToString()))
                    {
                        Stream stream = FileUpload.PostedFile.InputStream;
                        buffer = new byte[FileUpload.PostedFile.ContentLength];
                        size   = FileUpload.PostedFile.ContentLength;
                        try
                        {
                            stream.Read(buffer, 0, size);
                            PathField.Text = fInfo.Name;
                        }
                        finally
                        {
                            stream.Close(); //by manu
                        }
                    }
                    else
                    {
                        PathToSave = ((SettingItem)moduleSettings["DocumentPath"]).FullPath;
                        // [email protected] (02/07/2004). Create the Directory if not exists.
                        if (!Directory.Exists(Server.MapPath(PathToSave)))
                        {
                            Directory.CreateDirectory(Server.MapPath(PathToSave));
                        }

                        string virtualPath  = Path.WebPathCombine(PathToSave, fInfo.Name);
                        string physicalPath = Server.MapPath(virtualPath);

//						while(System.IO.File.Exists(physicalPath))
//						{
//							// Calculate virtualPath of the newly uploaded file
//							virtualPath = Rainbow.Framework.Settings.Path.WebPathCombine(PathToSave, Guid.NewGuid().ToString() + fInfo.Extension);
//
//							// Calculate physical path of the newly uploaded file
//							phyiscalPath = Server.MapPath(virtualPath);
//						}
                        while (File.Exists(physicalPath))
                        {
                            try
                            {
                                // Delete file before upload
                                File.Delete(physicalPath);
                            }
                            catch (Exception ex)
                            {
                                Message.Text =
                                    General.GetString("ERROR_FILE_DELETE", "Error while deleting file!<br>") +
                                    ex.Message;
                                return;
                            }
                        }

                        try
                        {
                            // Save file to uploads directory
                            FileUpload.PostedFile.SaveAs(physicalPath);

                            // Update PathFile with uploaded virtual file location
                            PathField.Text = virtualPath;
                        }
                        catch (Exception ex)
                        {
                            Message.Text = General.GetString("ERROR_FILE_NAME", "Invalid file name!<br>") + ex.Message;
                            return;
                        }
                    }
                }
                // Change for save contenType and document buffer
                // documents.UpdateDocument(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, NameField.Text, PathField.Text, CategoryField.Text, new byte[0], 0, string.Empty );
                string contentType = PathField.Text.Substring(PathField.Text.LastIndexOf(".") + 1).ToLower();
                documents.UpdateDocument(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, NameField.Text,
                                         PathField.Text, CategoryField.Text, buffer, size, contentType);

                RedirectBackToReferringPage();
            }
        }
コード例 #14
0
        /// <summary>
        /// Public constructor. Sets base settings for module.
        /// </summary>
        public SimpleMenu()
        {
            SettingItem setParentPageID = new SettingItem(new IntegerDataType());

            setParentPageID.Required    = true;
            setParentPageID.Value       = "0";
            setParentPageID.Group       = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            setParentPageID.EnglishName = "ParentTabId";
            setParentPageID.Description = "Sets the Id of then Parent tab for the menu (this tab may be hidden or inaccessible for the logged on user.)";
            setParentPageID.Order       = 1;
            this._baseSettings.Add("sm_ParentPageID", setParentPageID);

            //localized by Pekka Ylenius
            ArrayList SetRepeatDirectionArrayList = new ArrayList();

            SetRepeatDirectionArrayList.Add(new SettingOption(0,
                                                              General.GetString("HORIZONTAL", "Horizontal")));
            SetRepeatDirectionArrayList.Add(new SettingOption(1,
                                                              General.GetString("VERTICAL", "Vertical")));

            SettingItem setMenuRepeatDirection = new SettingItem(new CustomListDataType(SetRepeatDirectionArrayList, "Name", "Val"));

            setMenuRepeatDirection.Required    = true;
            setMenuRepeatDirection.Order       = 2;
            setMenuRepeatDirection.Group       = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            setMenuRepeatDirection.Description = "Sets the repeat direction for menu rendering.";
            setMenuRepeatDirection.EnglishName = "Menu RepeatDirection";
            this._baseSettings.Add("sm_Menu_RepeatDirection", setMenuRepeatDirection);

            // MenuLayouts
            Hashtable menuTypes = new Hashtable();

            foreach (string menuTypeControl in Directory.GetFiles(HttpContext.Current.Server.MapPath(Path.WebPathCombine(Path.ApplicationRoot, "/DesktopModules/CommunityModules/SimpleMenu/SimpleMenuTypes/")), "*.ascx"))
            {
                string menuTypeControlDisplayName = menuTypeControl.Substring(menuTypeControl.LastIndexOf("\\") + 1, menuTypeControl.LastIndexOf(".") - menuTypeControl.LastIndexOf("\\") - 1);
                string menuTypeControlName        = menuTypeControl.Substring(menuTypeControl.LastIndexOf("\\") + 1);
                menuTypes.Add(menuTypeControlDisplayName, menuTypeControlName);
            }

            // Thumbnail Layout Setting
            SettingItem menuTypeSetting = new SettingItem(new CustomListDataType(menuTypes, "Key", "Value"));

            menuTypeSetting.Required    = true;
            menuTypeSetting.Group       = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            menuTypeSetting.Value       = "StaticItemMenu.ascx";
            menuTypeSetting.Description = "Sets the type of menu this module use.";
            menuTypeSetting.EnglishName = "MenuType";
            menuTypeSetting.Order       = 3;
            this._baseSettings.Add("sm_MenuType", menuTypeSetting);


            ArrayList SetBindingArrayList = new ArrayList();

            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionNone, General.GetString("BIND_OPTION_NONE", "BindOptionNone")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionTop, General.GetString("BIND_OPTION_TOP", "BindOptionTop")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionChildren, General.GetString("BIND_OPTION_CHILDREN", "BindOptionChildren")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionCurrentChilds, General.GetString("BIND_OPTION_CURRENT_CHILDS", "BindOptionCurrentChilds")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionDefinedParent, General.GetString("BIND_OPTION_DEFINED_PARENT", "BindOptionDefinedParent")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionSiblings, General.GetString("BIND_OPTION_SIBLINGS", "BindOptionSiblings")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionSubtabSibling, General.GetString("BIND_OPTION_SUBTAB_SIBLING", "BindOptionSubtabSibling")));
            SetBindingArrayList.Add(new SettingOption((int)BindOption.BindOptionTabSibling, General.GetString("BIND_OPTION_TABSIBLING", "BindOptionTabSibling")));

            SettingItem setMenuBindingType = new SettingItem(new CustomListDataType(SetBindingArrayList, "Name", "Val"));

            setMenuBindingType.Required    = true;
            setMenuBindingType.Order       = 4;
            setMenuBindingType.Group       = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            setMenuBindingType.EnglishName = "MenuBindingType";
            this._baseSettings.Add("sm_MenuBindingType", setMenuBindingType);

            //			SettingItem setHeaderText = new SettingItem(new StringDataType());
            //			setHeaderText.Required = false;
            //			setHeaderText.Value = string.Empty;
            //			setHeaderText.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            //			setHeaderText.Description ="Sets a header text of the static menu (the special setting <CurrentTab> displays the current TabName).";
            //			setHeaderText.Order = 5;
            //			this._baseSettings.Add("sm_Menu_HeaderText", setHeaderText);
            //
            //			SettingItem setFooterText = new SettingItem(new StringDataType());
            //			setFooterText.Required = false;
            //			setFooterText.Value = string.Empty;
            //			setFooterText.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            //			setFooterText.Description ="Sets a footer text of the static menu.";
            //
            //			setFooterText.Order = 6;
            //			this._baseSettings.Add("sm_Menu_FooterText", setFooterText);
        }
        /// <summary>
        /// Binds the grid.
        /// </summary>
        protected void BindGrid()
        {
            UserDefinedTableDB objUserDefinedTable = new UserDefinedTableDB();

            string strSortField = string.Empty;
            string strSortOrder = string.Empty;

            SqlDataReader dr;

            if (ViewState["SortField"].ToString().Length != 0 && ViewState["SortOrder"].ToString().Length != 0)
            {
                strSortField = ViewState["SortField"].ToString();
                strSortOrder = ViewState["SortOrder"].ToString();
            }
            else
            {
                if (Settings["SortField"].ToString().Length != 0)
                {
                    strSortField = Settings["SortField"].ToString();
                }

                if (Settings["SortOrder"].ToString().Length != 0)
                {
                    strSortOrder = Settings["SortOrder"].ToString();
                }
                else
                {
                    strSortOrder = "ASC";
                }
            }

            grdData.Columns.Clear();

            dr = objUserDefinedTable.GetUserDefinedFields(ModuleID);
            try
            {
                while (dr.Read())
                {
                    DataGridColumn colField = null;
                    if (dr["FieldType"].ToString() == "Image")
                    {
                        colField = new BoundColumn();
                        ((BoundColumn)colField).DataField        = dr["FieldTitle"].ToString();
                        ((BoundColumn)colField).DataFormatString = "<img src=\"" + ((SettingItem)Settings["ImagePath"]).FullPath + "/{0}" + "\" alt=\"{0}\" border =0>";
                    }
                    else if (dr["FieldType"].ToString() == "File")
                    {
                        colField = new HyperLinkColumn();
                        ((HyperLinkColumn)colField).DataTextField               = dr["FieldTitle"].ToString();
                        ((HyperLinkColumn)colField).DataTextFormatString        = "{0}";
                        ((HyperLinkColumn)colField).DataNavigateUrlFormatString = ((SettingItem)Settings["DocumentPath"]).FullPath + "/{0}";
                        ((HyperLinkColumn)colField).DataNavigateUrlField        = dr["FieldTitle"].ToString();
                    }
                    else
                    {
                        colField = new BoundColumn();
                        ((BoundColumn)colField).DataField = dr["FieldTitle"].ToString();
                        switch (dr["FieldType"].ToString())
                        {
                        case "DateTime":
                            //Changed to Italian format as it is sayed to be the default (see intro of history.txt)
                            //Better would be to make this follow the current culture - Rob Siera, 15 jan 2005
                            ((BoundColumn)colField).DataFormatString = "{0:dd MMM yyyy}";
                            break;

                        case "Int32":
                            ((BoundColumn)colField).DataFormatString = "{0:#,###,##0}";
                            colField.HeaderStyle.HorizontalAlign     = HorizontalAlign.Right;
                            colField.ItemStyle.HorizontalAlign       = HorizontalAlign.Right;
                            break;

                        case "Decimal":
                            ((BoundColumn)colField).DataFormatString = "{0:#,###,##0.00}";
                            colField.HeaderStyle.HorizontalAlign     = HorizontalAlign.Right;
                            colField.ItemStyle.HorizontalAlign       = HorizontalAlign.Right;
                            break;
                        }
                    }

                    colField.HeaderText = dr["FieldTitle"].ToString();
                    if (dr["FieldTitle"].ToString() == strSortField)
                    {
                        //  2004/07/04 by Ozan Sirin, FIX: It does not show sort images when running root site instead of rainbow virtual folder.
                        if (strSortOrder == "ASC")
                        {
                            colField.HeaderText += "<img src='" + Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortascending.gif") + "' border='0' alt='" + General.GetString("USERTABLE_SORTEDBY", "Sorted By", null) + " " + strSortField + " " + General.GetString("USERTABLE_INASCORDER", "In Ascending Order", null) + "'>";
                        }
                        else
                        {
                            colField.HeaderText += "<img src='" + Path.WebPathCombine(Path.ApplicationRoot, "DesktopModules/UserDefinedTable/sortdescending.gif") + "' border='0' alt='" + General.GetString("USERTABLE_SORTEDBY", "Sorted By", null) + " " + strSortField + " " + General.GetString("USERTABLE_INDSCORDER", "In Descending Order", null) + "'>";
                        }
                    }
                    colField.Visible        = bool.Parse(dr["Visible"].ToString());
                    colField.SortExpression = dr["FieldTitle"].ToString() + "|ASC";

                    grdData.Columns.Add(colField);
                }
            }
            finally
            {
                dr.Close();
            }

            if (IsEditable)
            {
                HyperLinkColumn hc = new HyperLinkColumn();
                hc.Text = "Edit";
                hc.DataNavigateUrlField        = "UserDefinedRowID";
                hc.DataNavigateUrlFormatString = HttpUrlBuilder.BuildUrl("~/DesktopModules/CommunityModules/UserDefinedTable/UserDefinedTableEdit.aspx", PageID, "&mID=" + ModuleID + "&UserDefinedRowID={0}");
                grdData.Columns.Add(hc);
            }

            DataSet ds;

            ds = objUserDefinedTable.GetUserDefinedRows(ModuleID);

            // create a dataview to process the sort and filter options
            DataView dv;

            dv = new DataView(ds.Tables[0]);

            // sort data view
            if (strSortField.Length != 0 && strSortOrder.Length != 0)
            {
                dv.Sort = strSortField + " " + strSortOrder;
            }

            grdData.DataSource = dv;
            grdData.DataBind();
        }
コード例 #16
0
        /// <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)
        {
//			if (!IsPostBack) //Or it does not work with singon...
//			{
            string flashSrc = ((SettingItem)Settings["src"]).Value;

            flashSrc = flashSrc.Replace("~~", portalSettings.PortalFullPath);
            flashSrc = flashSrc.Replace("~", portalSettings.PortalPath);

            string flashHeight  = (SettingItem)Settings["height"];
            string flashWidth   = (SettingItem)Settings["width"];
            string flashBGColor = (SettingItem)Settings["backcolor"];

            //Set the output type and Movie
            FlashMovie1.FlashOutputType = FlashOutputType.FlashOnly; //Was ClientScriptVersionDection;

            //Always make sure you have a valid movie or your browser will hang.
            if (flashSrc == null || flashSrc.Length == 0)
            {
                flashSrc = Path.WebPathCombine(portalSettings.PortalFullPath, "/FlashGallery/effect2-marquee.swf");
            }

            string movieName = string.Empty;

            try
            {
                if (File.Exists(Server.MapPath(flashSrc)))
                {
                    movieName = Server.MapPath(flashSrc);
                }
            }
            catch
            {
            }

            //Added existing file check by Manu
            if (movieName.Length != 0)
            {
                FlashMovie1.MovieName = flashSrc;

                // Set the plugin version to check for
                FlashMovie1.MajorPluginVersion         = 7;
                FlashMovie1.MajorPluginVersionRevision = 0;
                FlashMovie1.MinorPluginVersion         = 0;
                FlashMovie1.MinorPluginVersionRevision = 0;

                //Set some other properties
                if (flashWidth != null && flashWidth.Length != 0)
                {
                    FlashMovie1.MovieWidth = flashWidth;
                }
                if (flashHeight != null && flashHeight.Length != 0)
                {
                    FlashMovie1.MovieHeight = flashHeight;
                }

                if (flashBGColor != null && flashBGColor.Length != 0 && flashBGColor != "0")
                {
                    try
                    {
                        FlashMovie1.MovieBGColor = ColorTranslator.FromHtml(flashBGColor);
                    }
                    catch
                    {
                    }
                }

                //this.FlashMovie1.AutoLoop = false;
                //this.FlashMovie1.AutoPlay = true;
                //this.FlashMovie1.FlashHorizontalAlignment = FlashHorizontalAlignment.Center;
                //this.FlashMovie1.FlashVerticalAlignment = FlashVerticalAlignment.Center;
                //this.FlashMovie1.HtmlAlignment = FlashHtmlAlignment.None;
                //this.FlashMovie1.UseDeviceFonts = false;
                //this.FlashMovie1.WindowMode = FlashMovieWindowMode.Transparent;
                //this.FlashMovie1.ShowMenu = false;
                //this.FlashMovie1.MovieQuality = FlashMovieQuality.AutoHigh;
                //this.FlashMovie1.MovieScale = FlashMovieScale.NoScale;

                // Add some variables
                //this.FlashMovie1.MovieVariables.Add("MyVar1","MyValue1");
                //this.FlashMovie1.MovieVariables.Add("MyVar2","MyValue2");
                //this.FlashMovie1.MovieVariables.Add("MyVar3","MyValue3");

                //Set the NoScript and NoFlash content.
                //In most situations where
                //html will be displayed the content is the same for both

                //this.FlashMovie1.NoFlashContainer.Controls.Add("No flash found!");
                //this.FlashMovie1.NoScriptContainer.Controls.Add("Scripting is disabled");
            }
            else
            {
                FlashMovie1.Visible = false;
                ErrorLabel.Text     = "File '" + flashSrc + "' not found!";
                ErrorLabel.Visible  = true;
            }
//			}
        }