コード例 #1
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     currentLanguage    = CultureHandler.GetCurrentSpecificLanguageCode();
     repLang.DataSource = _4screen.Utils.Web.SiteConfig.Cultures;
     repLang.DataMember = "Key";
     repLang.DataBind();
 }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsEmbedded && PageInfo.CommunityId.HasValue)
            {
                communityId = PageInfo.CommunityId.Value;
            }

            udc = UserDataContext.GetUserDataContext();
            ShowNormalMode();
            litOutput.ID = null;

            if (string.IsNullOrEmpty(txtLN.Value))
            {
                txtLN.Value = CultureHandler.GetCurrentSpecificLanguageCode(); //Here shoudd go the current User's Language
            }
            //Print the languagebar here for the events to to fire
            if (_4screen.Utils.Web.SiteConfig.Languages.Count > 0)
            {
                PrintLanguageBar();
            }
        }
コード例 #3
0
        private void ShowEditMode()
        {
            lbtnE.Visible     = false;
            litOutput.Visible = false;
            litOutput.ID      = null;

            //Print the languagebar here for the events to fire
            if (_4screen.Utils.Web.SiteConfig.Languages.Count > 0)
            {
                PrintLanguageBar();
            }

            string content = GetContentValue(true, txtLN.Value);

            REd.Content          = content;
            REd.Height           = new Unit(200, UnitType.Pixel);
            REd.Language         = CultureHandler.GetCurrentSpecificLanguageCode();
            REd.AutoResizeHeight = true;

            pnlEditMode.Visible = true;
        }
コード例 #4
0
        private void ShowNormalMode()
        {
            string content = string.Empty;

            lbtnE.Visible       = false;
            pnlEditMode.Visible = false;

            if (IsUserEditor())
            {
                lbtnE.Visible = true;
            }

            content = GetContentValue(false, CultureHandler.GetCurrentSpecificLanguageCode());
            content = content.Replace("##DATE##", DateTime.Now.ToString("dddd, dd. MMMM yyyy"));
            if (udc.IsAuthenticated)
            {
                content = content.Replace("##LinkProfilePage##", Helper.GetDetailLink("User", udc.Nickname));
            }
            else
            {
                content = content.Replace("##LinkProfilePage##", Constants.Links["LINK_TO_REGISTRATION_PAGE"].Url);
            }
            Match match = Regex.Match(content, "##LinkCreate(.*?)##");

            if (match.Success)
            {
                if (udc.IsAuthenticated)
                {
                    string objectType = match.Groups[1].Value;
                    string createLink = string.Format("{0}&XCN={1}&OID={2}&ReturnUrl={3}", Helper.GetUploadWizardLink(Helper.GetObjectTypeNumericID(objectType), _4screen.CSB.Common.SiteConfig.UsePopupWindows), UserProfile.Current.ProfileCommunityID, Guid.NewGuid(), System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(Request.RawUrl)));
                    content = Regex.Replace(content, "##LinkCreate.*?##", createLink);
                }
                else
                {
                    content = Regex.Replace(content, "##LinkCreate.*?##", Constants.Links["LINK_TO_REGISTRATION_PAGE"].Url);
                }
            }


            if (content.IndexOf("##SendReport##") > -1)
            {
                if (udc.IsAuthenticated)
                {
                    string objectType = string.Empty;
                    if (!string.IsNullOrEmpty(Request.QueryString["OT"]))
                    {
                        objectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]).ToString();
                    }

                    string href = string.Format("javascript:radWinOpen('/Pages/Popups/MessageSend.aspx?MsgType=rep&RecType=report&ObjType={0}&URL={1}', '{2}', 450, 450, true)", objectType, System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(Request.RawUrl)), languageShared.GetString("CommandContentReport").StripForScript());
                    content = content.Replace("##SendReport##", href);
                }
                else
                {
                    content = content.Replace("##SendReport##", Constants.Links["LINK_TO_LOGIN_PAGE"].Url);
                }
            }

            //invite
            if (content.IndexOf("##SendPropose##") > -1)
            {
                string objectType = string.Empty;
                if (!string.IsNullOrEmpty(Request.QueryString["OT"]))
                {
                    objectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]).ToString();
                }

                string href = string.Format("javascript:radWinOpen('/Pages/Popups/MessageSend.aspx?MsgType=rec&URL={0}', '{1}', 450, 450, true)", System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Empty)), languageShared.GetString("CommandRecommend").StripForScript());
                content = content.Replace("##SendPropose##", href);
            }

            litOutput.Text    = content;
            litOutput.Visible = true;
        }
コード例 #5
0
ファイル: Extensions.cs プロジェクト: pimboden/csbooster
        public static string GetLocalizedUrl(string relativeUrl)
        {
            string returnUrl = relativeUrl;
            bool   addVPath  = false;

            try
            {
                bool.TryParse(ConfigurationManager.AppSettings["UseVirtualLanguagePath"], out addVPath);
            }
            catch
            {
            }
            if (addVPath)
            {
                bool   continueSearch    = true;
                string languageCodeToAdd = string.Format("/{0}", CultureHandler.GetCurrentSpecificLanguageCode());
                // /someUrl.aspx                      ==> /CURRENTLANGGUAGECODE/someUrl.aspx
                // /someUrl.aspx?LG=LangCode          ==> /LangCode/someUrl.aspx
                // /someUrl.aspx?LG=langCode&Var=val  ==> /LangCode/someUrl.aspx?var=val
                // /someUrl.aspx?Var=val&LG=langCode  ==> /LangCode/someUrl.aspx?var=val
                // /LangCode/someUrl.aspx?Var=val     ==> /LangCode/someUrl.aspx?var=

                int firstIndexOfSlash = returnUrl.IndexOf("/");
                int lastIndexOfSlash  = returnUrl.LastIndexOf("/");

                if (firstIndexOfSlash < lastIndexOfSlash)
                {
                    string[] urlParts = returnUrl.Split('/');
                    try
                    {
                        //Is the first part a Culture
                        CultureInfo cu = new CultureInfo(urlParts[1]);
                        languageCodeToAdd = string.Empty;
                        continueSearch    = false;
                    }
                    catch (Exception)
                    {
                        //Do nothing.. just continue
                    }
                }
                if (continueSearch)
                {
                    if (returnUrl.IndexOf('?') > 0)
                    {
                        var    currentUrl      = returnUrl.Split('?');
                        string queryString     = currentUrl[1];
                        string queryNoLanguage = string.Empty;
                        if (!string.IsNullOrEmpty(queryString))
                        {
                            queryString.Replace("&amp;", "§§tempAmp§§");
                            string[] queryParams = queryString.Split('&');
                            foreach (string queryParam in queryParams)
                            {
                                var keyValuePair = queryParam.Split('=');
                                if (string.Compare(keyValuePair[0], "LG", true) != 0)
                                {
                                    queryNoLanguage += string.Format("{0}&", queryParam.Replace("§§tempAmp§§", "&amp;"));
                                }
                                else
                                {
                                    try
                                    {
                                        CultureInfo cu = new CultureInfo(keyValuePair[1]);
                                        languageCodeToAdd = string.Format("/{0}", keyValuePair[1]);
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                            if (queryNoLanguage.Length > 0)
                            {
                                queryNoLanguage = string.Format("?{0}", queryNoLanguage.TrimEnd('&'));
                            }
                        }
                        returnUrl = string.Format("{0}{1}", currentUrl[0], queryNoLanguage);
                    }
                }
                returnUrl = string.Format("{0}{1}", languageCodeToAdd, returnUrl);
            }
            return(returnUrl);
        }
コード例 #6
0
ファイル: CountryNames.cs プロジェクト: pimboden/csbooster
 public static List <CountryName> Load()
 {
     return(Data.CountryNames.Load(CultureHandler.GetCurrentSpecificLanguageCode()));
 }