Example #1
0
        public void LoadForums()
        {
            //Dim dr As IDataReader
            //dr = DataProvider.Instance.PortalForums(PortalId)
            //Dim i As Integer = 0
            //While dr.Read
            //    drpForumInstance.Items.Insert(i, New Web.UI.WebControls.ListItem(CType(dr("TabName"), String), CType(dr("ModuleID"), String)))
            //End While
            //dr.Close()
            int i  = 0;
            var mc = new Entities.Modules.ModuleController();
            var tc = new Entities.Tabs.TabController();

            Entities.Tabs.TabInfo ti;
            foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
            {
                if (mi.DesktopModule.ModuleName.Trim().ToLowerInvariant() == "Active Forums".ToLowerInvariant() && mi.IsDeleted == false)
                {
                    ti = tc.GetTab(mi.TabID, PortalId, false);
                    if (ti != null)
                    {
                        if (ti.IsDeleted == false)
                        {
                            drpForumInstance.Items.Insert(i, new ListItem(ti.TabName + " - " + mi.DesktopModule.ModuleName, Convert.ToString(mi.ModuleID)));
                            i += 1;
                        }
                    }
                }
            }

            drpForumInstance.Items.Insert(0, new ListItem("-- Select a Forum Instance --", "-1"));
        }
        public int GetActiveSocialStatus(int PortalId)
        {
#if SKU_LITE
            //Not Available
            return(-2);
#else
            //TODO: the following can probably be removed? Not sure on AS support anymore
            if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")))
            {
                var mc = new Entities.Modules.ModuleController();
                var tc = new Entities.Tabs.TabController();
                Entities.Tabs.TabInfo ti;
                foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
                {
                    if (mi.DesktopModule.ModuleName.Contains("Active Social") && mi.IsDeleted == false)
                    {
                        ti = tc.GetTab(mi.TabID, PortalId, false);
                        if (ti != null)
                        {
                            if (ti.IsDeleted == false)
                            {
                                //Installed and ready
                                return(1);
                            }
                        }
                    }
                }
                //Not installed on portal
                return(0);
            }
            //Not Installed
            return(-1);
#endif
        }
Example #3
0
        public int GetActiveSocialStatus(int PortalId)
        {
#if SKU_LITE
			//Not Available
			return -2;
#else
            //TODO: the following can probably be removed? Not sure on AS support anymore
            if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")))
            {
                var mc = new Entities.Modules.ModuleController();
                var tc = new Entities.Tabs.TabController();
                Entities.Tabs.TabInfo ti;
                foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
                {
                    if (mi.ModuleName.Contains("Active Social") && mi.IsDeleted == false)
                    {
                        ti = tc.GetTab(mi.TabID, PortalId, false);
                        if (ti != null)
                        {
                            if (ti.IsDeleted == false)
                            {
                                //Installed and ready
                                return 1;
                            }
                        }
                    }
                }
                //Not installed on portal
                return 0;
            }
            //Not Installed
            return -1;
#endif
        }
 public static string GetRichValue(ProfilePropertyDefinition prop, string strFormat, System.Globalization.CultureInfo formatProvider)
 {
     string result = "";
     if (!String.IsNullOrEmpty(prop.PropertyValue) || DisplayDataType(prop).ToLower() == "image")
     {
         switch (DisplayDataType(prop).ToLower())
         {
             case "truefalse":
                 result = PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(prop.PropertyValue), formatProvider);
                 break;
             case "date":
             case "datetime":
                 if (strFormat == string.Empty)
                     strFormat = "g";
                 result = DateTime.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                 break;
             case "integer":
                 if (strFormat == string.Empty)
                     strFormat = "g";
                 result = int.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                 break;
             case "page":
                 Entities.Tabs.TabController TabCtrl = new Entities.Tabs.TabController();
                 int tabid;
                 if (int.TryParse(prop.PropertyValue, out tabid))
                 {
                     Entities.Tabs.TabInfo Tab = TabCtrl.GetTab(tabid, Null.NullInteger, false);
                     if (Tab != null)
                     {
                         result = string.Format("<a href='{0}'>{1}</a>", Globals.NavigateURL(tabid), Tab.LocalizedTabName);
                     }
                 }
                 break;
             case "image":
                 //File is stored as a FileID
                 int fileID;
                 if (Int32.TryParse(prop.PropertyValue, out fileID) && fileID > 0)
                 {
                     result = Globals.LinkClick(String.Format("fileid={0}", fileID), Null.NullInteger, Null.NullInteger);
                 }
                 else
                 {
                     result = Globals.ResolveUrl("~/images/spacer.gif");
                 }
                 break;
             case "richtext":
                 result = PropertyAccess.FormatString(HttpUtility.HtmlDecode(prop.PropertyValue), strFormat);
                 break;
             default:
                 result = HttpUtility.HtmlEncode(PropertyAccess.FormatString(prop.PropertyValue, strFormat));
                 break;
         }
     }
     return result;
 }
        private bool CheckFileOrTab(string link, string contentType)
        {
            int            intId;
            PortalSettings portal = Globals.GetPortalSettings();

            if (link.StartsWith("FileID=", StringComparison.OrdinalIgnoreCase))
            {
                // the link is a file. Check wether it exists in the portal
                if (Int32.TryParse(link.Replace("FileID=", ""), out intId))
                {
                    var      objFileController = new FileController();
                    FileInfo objFile           = objFileController.GetFileById(intId, portal.PortalId);
                    if (objFile != null)
                    {
                        if ((!(string.IsNullOrEmpty(contentType))) && (!(objFile.ContentType.StartsWith(contentType, StringComparison.OrdinalIgnoreCase))))
                        {
                            // the file exists but is of the wrong type
                            return(false);
                        }
                    }
                    else
                    {
                        // the file does not exist for this portal
                        return(false);
                    }
                }
            }
            else if (Int32.TryParse(link, out intId))
            {
                // the link is a tab
                var objTabController = new Entities.Tabs.TabController();
                if (objTabController.GetTab(intId, portal.PortalId, false) == null)
                {
                    // the tab does not exist
                    return(false);
                }
            }

            // no reasons where found to reject the file
            return(true);
        }
        public static string GetRichValue(ProfilePropertyDefinition prop, string strFormat, System.Globalization.CultureInfo formatProvider)
        {
            string result = "";

            if (!String.IsNullOrEmpty(prop.PropertyValue) || DisplayDataType(prop).ToLower() == "image")
            {
                switch (DisplayDataType(prop).ToLower())
                {
                case "truefalse":
                    result = PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(prop.PropertyValue), formatProvider);
                    break;

                case "date":
                case "datetime":
                    if (strFormat == string.Empty)
                    {
                        strFormat = "g";
                    }
                    result = DateTime.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                    break;

                case "integer":
                    if (strFormat == string.Empty)
                    {
                        strFormat = "g";
                    }
                    result = int.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                    break;

                case "page":
                    Entities.Tabs.TabController TabCtrl = new Entities.Tabs.TabController();
                    int tabid;
                    if (int.TryParse(prop.PropertyValue, out tabid))
                    {
                        Entities.Tabs.TabInfo Tab = TabCtrl.GetTab(tabid, Null.NullInteger, false);
                        if (Tab != null)
                        {
                            result = string.Format("<a href='{0}'>{1}</a>", Globals.NavigateURL(tabid), Tab.LocalizedTabName);
                        }
                    }
                    break;

                case "image":
                    //File is stored as a FileID
                    int fileID;
                    if (Int32.TryParse(prop.PropertyValue, out fileID) && fileID > 0)
                    {
                        result = Globals.LinkClick(String.Format("fileid={0}", fileID), Null.NullInteger, Null.NullInteger);
                    }
                    else
                    {
                        result = Globals.ResolveUrl("~/images/spacer.gif");
                    }
                    break;

                case "richtext":
                    result = PropertyAccess.FormatString(HttpUtility.HtmlDecode(prop.PropertyValue), strFormat);
                    break;

                default:
                    result = HttpUtility.HtmlEncode(PropertyAccess.FormatString(prop.PropertyValue, strFormat));
                    break;
                }
            }
            return(result);
        }
        private bool CheckFileOrTab(string link, string contentType)
        {
            int intId;
            PortalSettings portal = Globals.GetPortalSettings();
            if (link.StartsWith("FileID=", StringComparison.OrdinalIgnoreCase))
            {
                // the link is a file. Check wether it exists in the portal
                if (Int32.TryParse(link.Replace("FileID=", ""), out intId))
                {
                    var objFileController = new FileController();
                    FileInfo objFile = objFileController.GetFileById(intId, portal.PortalId);
                    if (objFile != null)
                    {
                        if ((!(string.IsNullOrEmpty(contentType))) && (!(objFile.ContentType.StartsWith(contentType, StringComparison.OrdinalIgnoreCase))))
                        {
                            // the file exists but is of the wrong type
                            return false;
                        }
                    }
                    else
                    {
                        // the file does not exist for this portal
                        return false;
                    }
                }
            }
            else if (Int32.TryParse(link, out intId))
            {
                // the link is a tab
                var objTabController = new Entities.Tabs.TabController();
                if (objTabController.GetTab(intId, portal.PortalId, false) == null)
                {
                    // the tab does not exist
                    return false;
                }
            }

            // no reasons where found to reject the file
            return true;

        }
		public void LoadForums()
		{
			//Dim dr As IDataReader
			//dr = DataProvider.Instance.PortalForums(PortalId)
			//Dim i As Integer = 0
			//While dr.Read
			//    drpForumInstance.Items.Insert(i, New Web.UI.WebControls.ListItem(CType(dr("TabName"), String), CType(dr("ModuleID"), String)))
			//End While
			//dr.Close()
			int i = 0;
			var mc = new Entities.Modules.ModuleController();
			var tc = new Entities.Tabs.TabController();
			Entities.Tabs.TabInfo ti;
			foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
			{
                if (mi.DesktopModule.ModuleName.Trim().ToLowerInvariant() == "Active Forums".ToLowerInvariant() && mi.IsDeleted == false)
				{
					ti = tc.GetTab(mi.TabID, PortalId, false);
					if (ti != null)
					{
						if (ti.IsDeleted == false)
						{
							drpForumInstance.Items.Insert(i, new ListItem(ti.TabName + " - " + mi.DesktopModule.ModuleName, Convert.ToString(mi.ModuleID)));
							i += 1;
						}
					}

				}
			}

			drpForumInstance.Items.Insert(0, new ListItem("-- Select a Forum Instance --", "-1"));
		}