Exemplo n.º 1
0
        private void SetupInstanceScript()
        {
            // http://translate.google.com/translate_tools

            if (languageCode.Length == 0)
            {
                CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();
                languageCode = defaultCulture.TwoLetterISOLanguageName;
            }

            StringBuilder script = new StringBuilder();

            script.Append("\n<script>\n");
            script.Append("function googleTranslateElementInit() {");
            script.Append("new google.translate.TranslateElement({");
            script.Append("pageLanguage: '" + languageCode + "'");

            if (includeLanguages.Length > 0)
            {
                script.Append(",includedLanguages: '" + includeLanguages + "'");
            }

            if (!showToolbar)
            {
                script.Append(",autoDisplay:false ");
            }

            if (pageContainsMultipleLanguageContent)
            {
                script.Append(",multilanguagePage:true ");
            }

            if (trackInGoogleAnalytics)
            {
                script.Append(",gaTrack:true ");
            }

            switch (layout.ToUpper())
            {
            case "HORIZONTAL":
                script.Append(",layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL ");
                break;

            case "SIMPLE":
                script.Append(",layout: google.translate.TranslateElement.InlineLayout.SIMPLE ");
                break;

            default:
                break;
            }

            script.Append("},");
            script.Append("'" + ClientID + "');}");
            script.Append("\n</script>");

            Page.ClientScript.RegisterClientScriptBlock(
                GetType(),
                UniqueID,
                script.ToString());
        }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (fromLanguageCode.Length == 0)
            {
                CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();
                fromLanguageCode = defaultCulture.TwoLetterISOLanguageName;
            }
        }
Exemplo n.º 3
0
        private void SendCommentNotificationEmail()
        {
            SmtpSettings smtpSettings = SiteUtils.GetSmtpSettings();

            string messageTemplate = ResourceHelper.GetMessageTemplate(SiteUtils.GetDefaultUICulture(), notificationTemplateName);

            StringBuilder message = new StringBuilder();

            message.Append(messageTemplate);
            message.Replace("{SiteName}", siteSettings.SiteName);
            string commentLink;

            if (commentUrl.StartsWith("http"))
            {
                commentLink = commentUrl;
            }
            else
            {
                commentLink = SiteRoot + commentUrl.Replace("~", string.Empty);
            }
            message.Replace("{MessageLink}", commentLink);

            if (includeCommentBodyInNotification)
            {
                message.Replace("{CommentBody}", HttpUtility.HtmlDecode(SecurityHelper.RemoveMarkup(edComment.Text)));
            }
            else
            {
                message.Replace("{CommentBody}", string.Empty);
            }

            if (includeIpAddressInNotification)
            {
                message.Append("\n\nHTTP_USER_AGENT: " + Page.Request.ServerVariables["HTTP_USER_AGENT"] + "\n");
                message.Append("HTTP_HOST: " + Page.Request.ServerVariables["HTTP_HOST"] + "\n");
                message.Append("REMOTE_HOST: " + Page.Request.ServerVariables["REMOTE_HOST"] + "\n");
                message.Append("REMOTE_ADDR: " + SiteUtils.GetIP4Address() + "\n");
                message.Append("LOCAL_ADDR: " + Page.Request.ServerVariables["LOCAL_ADDR"] + "\n");
                message.Append("HTTP_REFERER: " + Page.Request.ServerVariables["HTTP_REFERER"] + "\n");
            }

            foreach (string emailAddress in notificationAddresses)
            {
                Email.SendEmail(
                    smtpSettings,
                    siteSettings.DefaultEmailFromAddress,
                    emailAddress,
                    string.Empty,
                    string.Empty,
                    siteSettings.SiteName,
                    message.ToString(),
                    false,
                    "Normal");
            }
        }
Exemplo n.º 4
0
        public static void SendRejectionNotification(
            SmtpSettings smtpSettings,
            SiteSettings siteSettings,
            SiteUser rejectingUser,
            ContentWorkflow rejectedWorkflow,
            string rejectionReason
            )
        {
            //EmailMessageTask messageTask = new EmailMessageTask(smtpSettings);
            //messageTask.SiteGuid = siteSettings.SiteGuid;
            //messageTask.EmailFrom = siteSettings.DefaultEmailFromAddress;
            //messageTask.EmailFromAlias = siteSettings.DefaultFromEmailAlias;
            //messageTask.EmailReplyTo = rejectingUser.Email;
            //messageTask.EmailTo = rejectedWorkflow.RecentActionByUserEmail;

            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            //messageTask.Subject = ResourceHelper.GetMessageTemplate(defaultCulture, "ApprovalRequestRejectionNotificationSubject.config").Replace("{SiteName}", siteSettings.SiteName);

            StringBuilder message = new StringBuilder();

            message.Append(ResourceHelper.GetMessageTemplate(defaultCulture, "ApprovalRequestRejectionNotification.config"));
            message.Replace("{ModuleTitle}", rejectedWorkflow.ModuleTitle);
            message.Replace("{ApprovalRequestedDate}", rejectedWorkflow.RecentActionOn.ToShortDateString());
            message.Replace("{RejectionReason}", rejectionReason);
            message.Replace("{RejectedBy}", rejectingUser.Name);

            if (!Email.IsValidEmailAddressSyntax(rejectedWorkflow.RecentActionByUserEmail))
            {
                //invalid address log it
                log.Error("Failed to send workflow rejection message, invalid recipient email "
                          + rejectedWorkflow.RecentActionByUserEmail
                          + " message was " + message.ToString());

                return;
            }

            //messageTask.TextBody = message.ToString();
            //messageTask.QueueTask();

            //WebTaskManager.StartOrResumeTasks();

            Email.Send(
                smtpSettings,
                siteSettings.DefaultEmailFromAddress,
                siteSettings.DefaultFromEmailAlias,
                rejectingUser.Email,
                rejectedWorkflow.RecentActionByUserEmail,
                string.Empty,
                string.Empty,
                ResourceHelper.GetMessageTemplate(defaultCulture, "ApprovalRequestRejectionNotificationSubject.config").Replace("{SiteName}", siteSettings.SiteName),
                message.ToString(),
                false,
                Email.PriorityNormal);
        }
Exemplo n.º 5
0
        public static void SendSubscriberVerificationEmail(
            string siteRoot,
            string emailAddress,
            Guid subscribeGuid,
            LetterInfo letter,
            SiteSettings siteSettings)
        {
            string verificationTemplate;
            bool   useHtml = WebConfigSettings.NewsletterUseHtmlEmailConfirmation;

            if (useHtml)
            {
                verificationTemplate = ResourceHelper.GetMessageTemplate(SiteUtils.GetDefaultUICulture(), "NewsletterVerificationHtmlEmailMessage.config");
            }
            else
            {
                verificationTemplate = ResourceHelper.GetMessageTemplate(SiteUtils.GetDefaultUICulture(), "NewsletterVerificationEmailMessage.config");
            }

            string confirmLink = siteRoot + "/eletter/Confirm.aspx?s=" + subscribeGuid.ToString();
            string messageBody = verificationTemplate.Replace("{NewsletterName}", letter.Title).Replace("{ConfirmationLink}", confirmLink).Replace("{SiteLink}", siteRoot);
            string subject     = string.Format(CultureInfo.InvariantCulture, Resource.NewsletterVerifySubjectFormat, letter.Title);

            string fromAddress;
            string fromAlias;

            if (letter.FromAddress.Length > 0)
            {
                fromAddress = letter.FromAddress;
                fromAlias   = letter.FromName;
            }
            else
            {
                fromAddress = siteSettings.DefaultEmailFromAddress;
                fromAlias   = siteSettings.DefaultFromEmailAlias;
            }

            Email.Send(
                SiteUtils.GetSmtpSettings(),
                fromAddress,
                fromAlias,
                string.Empty,
                emailAddress,
                string.Empty,
                string.Empty,
                subject,
                messageBody,
                useHtml,
                Email.PriorityNormal);
        }
Exemplo n.º 6
0
        private void ConfigurEditor()
        {
            //editor1.Visible = false;
            //editor1.Enabled = false;
            //txtPlain.Visible = false;

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            string siteRoot = SiteUtils.GetNavigationSiteRoot();;

            //ed1.SiteRoot = siteRoot;
            if (WebConfigSettings.UseSkinCssInEditor)
            {
                ed1.EditorCSSUrl = SiteUtils.GetEditorStyleSheetUrl(true, true, Page);
            }

            if (attributes.ContainsKey("$EditorConfigPath"))
            {
                ed1.CustomConfigPath = attributes["$EditorConfigPath"].ToString();
            }
            ed1.ToolBar = ToolBar.FullWithTemplates;
            ed1.Height  = Unit.Pixel(300);
            ed1.Skin    = WebConfigSettings.CKEditorSkin;

            if (siteSettings != null)
            {
                if (
                    (WebUser.IsInRoles(siteSettings.GeneralBrowseAndUploadRoles)) ||
                    (WebUser.IsInRoles(siteSettings.UserFilesBrowseAndUploadRoles))
                    )
                {
                    ed1.FileManagerUrl    = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                    ed1.EnableFileBrowser = true;
                }
            }

            ed1.TemplatesJsonUrl = siteRoot + "/Services/CKeditorTemplates.ashx?cb=" + Guid.NewGuid().ToString(); //prevent caching with a guid param
            ed1.StylesJsonUrl    = siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty);


            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            if (defaultCulture.TextInfo.IsRightToLeft)
            {
                ed1.TextDirection = Direction.RightToLeft;
            }
        }
Exemplo n.º 7
0
        private void ConfigureEditor()
        {
            fckEditor.CustomConfigurationsPath = "";

            fckEditor.BasePath = scriptBaseUrl;
            fckEditor.SkinPath = scriptBaseUrl + "editor/skins/" + WebConfigSettings.FCKeditorSkin + "/";
            //fckEditor.BaseHref = fckEditor.ResolveUrl("~/");

            //fckEditor.PluginsPath = "";
            ConfigurePaths();



            if (editorCSSUrl.Length > 0)
            {
                fckEditor.Config["EditorAreaCSS"] = editorCSSUrl;
            }

            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            fckEditor.AutoDetectLanguage = false;

            fckEditor.DefaultLanguage = defaultCulture.TwoLetterISOLanguageName;



            if ((textDirection == Direction.RightToLeft) || (defaultCulture.TextInfo.IsRightToLeft))
            {
                fckEditor.Config["ContentLangDirection"] = "rtl";
            }

            fckEditor.Width  = editorWidth;
            fckEditor.Height = editorHeight;
            if (setFocusOnStart)
            {
                fckEditor.StartupFocus = true;
            }

            if ((ConfigurationManager.AppSettings["FCKeditor:Debug"] != null) &&
                (ConfigurationManager.AppSettings["FCKeditor:Debug"] == "true"))
            {
                fckEditor.Debug = true;
            }

            SetToolBar();
        }
        private void BeginRequest(object sender, EventArgs e)
        {
            HttpApplication app = (HttpApplication)sender;

            if (WebUtils.IsRequestForStaticFile(app.Request.Path))
            {
                return;
            }
            if (app.Request.Path.ContainsCaseInsensitive("csshandler.ashx"))
            {
                return;
            }
            if (app.Request.Path.ContainsCaseInsensitive("thumbnailservice.ashx"))
            {
                return;
            }
            if (app.Request.Path.ContainsCaseInsensitive("GCheckoutNotificationHandler.ashx"))
            {
                return;
            }


            // 2006-12-29 Joe Audette
            // CultureInfo for the executing thread is automatically set to the
            // preferred culture of the user's browser by this web.config setting:
            // <globalization
            //   culture="auto:en-US"
            //   uiCulture="auto:en"
            //   requestEncoding="utf-8"
            //   responseEncoding="utf-8"
            //   fileEncoding="iso-8859-15" />
            //
            // the "auto" tells the runtime to use the browser preference
            // and the :en-US tells the runtime to fall back to en-US as the default culture for
            // missing resource keys or if no resource file exists for the preferred culture
            // you can specify a different default culture by replacing en-US with your preferred
            // culture, but you should make sure that the resource file for the default culture
            // has no missing keys or runtime errors could occur

            //by default the culture of the executing thread is set to that of the browser preferred language setting
            // and this causes the use of the language specific resource if available else it falls back to the default en-US
            //as defined in Web.config globalization section
            //below we are using a config setting to change the default behavior to force the thread to use a specific culture
            //however if there are missing keys in the specified culture it can still fall back to en-US as it should
            if (WebConfigSettings.UseCultureOverride)
            {
                CultureInfo siteCulture;
                CultureInfo siteUICulture;
                try
                {
                    siteCulture   = SiteUtils.GetDefaultCulture();
                    siteUICulture = SiteUtils.GetDefaultUICulture();
                }
                catch (InvalidOperationException) { return; }
                catch (System.Data.Common.DbException) { return; }

                if (siteCulture.IsNeutralCulture)
                {
                    log.Info("cannot use culture " + siteCulture.Name + " because it is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.");
                }
                else
                {
                    try
                    {
                        Thread.CurrentThread.CurrentCulture = siteCulture;
                        if (WebConfigSettings.SetUICultureWhenSettingCulture)
                        {
                            Thread.CurrentThread.CurrentUICulture = siteUICulture;
                        }
                    }
                    catch (ArgumentException ex)
                    {
                        log.Info("swallowed error in culture helper", ex);
                    }
                    catch (NotSupportedException ex)
                    {
                        log.Info("swallowed error in culture helper", ex);
                    }
                }
            }


            // below we are overriding only to handle culture specific workarounds, for most cultures
            // we don't need to do anything here as the runtime handles it correctly
            // but there are some cultures which are either poorly or incorrectly implemented
            // in the .NET runtime

            if (WebConfigSettings.UseCustomHandlingForPersianCulture)
            {
                if (
                    (CultureInfo.CurrentCulture.Name == "fa-IR") ||
                    (CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "fa")
                    )
                {
                    try
                    {
                        CultureInfo PersianCulture = CultureHelper.GetPersianCulture();
                        Thread.CurrentThread.CurrentCulture   = PersianCulture;
                        Thread.CurrentThread.CurrentUICulture = PersianCulture;
                    }
                    catch (System.Security.SecurityException ex)
                    {
                        //can happen in medium trust
                        log.Error(ex);
                    }
                    catch (ArgumentException ex)
                    {
                        log.Info("swallowed error in culture helper", ex);
                    }
                }
            }


            //this doesn't work but was a nice idea
            //http://weblogs.asp.net/abdullaabdelhaq/archive/2009/06/27/displaying-arabic-number.aspx
            //has the only real solution
            //if ((CultureInfo.CurrentCulture.TwoLetterISOLanguageName == "ar") && (!CultureInfo.CurrentCulture.IsNeutralCulture))
            //{
            //    CultureInfo arabic = new CultureInfo(CultureInfo.CurrentCulture.Name);
            //    arabic.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
            //    string[] arabicDigits = new string[] { "٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩" };
            //    arabic.NumberFormat.NativeDigits = arabicDigits;
            //    Thread.CurrentThread.CurrentCulture = arabic;
            //    Thread.CurrentThread.CurrentUICulture = arabic;
            //}
        }
Exemplo n.º 9
0
        private void BindVrses()
        {
            List <iQuranSearch> iSrchList = null;
            QuranSura           qSura     = new QuranSura();



            //if we camefrom search, first get the pageNumber have thats verse
            if (isSearchResult == true)
            {
                pageNumber = QuranVerse.GetVersePageNumber(this.siteID, this.suraID, this.verseID);
            }

            qSura              = new QuranSura(this.siteID, this.suraID);
            this.suraOrder     = qSura.SuraOrder;
            hdnsuraOrder.Value = this.suraOrder.ToString();

            if (isSearchResult == true)
            {
                iSrchList = iQuranSearch.GetFrontEnd_QuranPage_WithSearchVerse(this.siteID, this.quranID, this.verseID, pageNumber, IsTranslation);
            }
            else
            {
                iSrchList = iQuranSearch.GetFrontEnd_QuranPage(this.siteID, this.quranID, pageNumber, IsTranslation);
            }

            rptVerses.DataSource = iSrchList;
            rptVerses.DataBind();


            string pageUrl = string.Empty;

            pageUrl = SiteRoot
                      + "/iQuran/QuranSearch/ViewQuranPage.aspx?"
                      + "qid=" + this.quranID.ToInvariantString()
                      + "&pagenumber={0}";

            // + "&sid=" + this.suraID.ToInvariantString()
            pgr.PageURLFormat = pageUrl;
            pgr.ShowFirstLast = true;
            pgr.PageCount     = totalPages;
            pgr.CurrentIndex  = pageNumber;

            pgr.Visible = (totalPages > 1);

            //Show hide Bism Allah Verse
            //if (iSrchList.Count > 0)
            //{
            //    if ((suraID != 1) && (suraID != 9))
            //    {
            //        litBism.Text = QuranVerse.GetVerseBism(this.siteID, this.quranID, IsTranslation);
            //        divBism.Visible = true;
            //        litBism.Visible = true;
            //    }
            //}

            //show the link view whole Sura or not ?
            if ((iSrchList.Count > 0) && (isSearchResult == true))
            {
                if (suraOrder != 1)
                {
                    hlViewSura.NavigateUrl = SiteRoot + "/iQuran/QuranSearch/ViewSura.aspx?qid=" + this.quranID.ToInvariantString()
                                             + "&sid=" + this.suraID.ToInvariantString() + "&vid=" + this.verseID.ToInvariantString()
                                             + "&vo=" + this.verseOrder.ToInvariantString();;

                    hlViewSura.Visible = true;
                }

                //rptVerses.Visible = true;

                //QuranSura qSura = new QuranSura(this.siteID, this.suraID);

                string      info           = string.Empty;
                CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();
                info = ResourceHelper.GetMessageTemplate(defaultCulture,
                                                         "SuraViewSearchInfo.config");

                litSearchDescription.Text = string.Format(
                    defaultCulture,
                    info,
                    qSura.Title,
                    qSura.SuraOrder,
                    qSura.VersesCount,
                    this.verseOrder);

                litSearchDescription.Visible = true;
                divDescription.Visible       = true;
                lblmessage.Visible           = false;
            }
            else
            {
                // set the page Header for paging
                string    info   = string.Empty;
                string    titles = string.Empty;
                QuranPage qPage  = new QuranPage(this.siteID, this.quranID, this.pageNumber, IsTranslation);

                if ((qPage.Titles.Split('-').Length - 1) == 1)
                {
                    info = Resources.iQuranResources.PartHeader + "&nbsp;" + qPage.PartNo + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Resources.iQuranResources.SuratHeader + "&nbsp;" + qPage.Titles.Replace("  -  ", "");
                }
                else
                {
                    //qPage.Titles.Remove(qPage.Titles.Length, 1);
                    //qPage.Titles.Remove(qPage.Titles.ToString().LastIndexOf("-"), 1);
                    titles = qPage.Titles.Remove(qPage.Titles.ToString().IndexOf("-"), 1);
                    titles = Resources.iQuranResources.SuratHeader + "&nbsp;" + titles.Replace("-", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + Resources.iQuranResources.SuratHeader + "&nbsp;");
                    info   = Resources.iQuranResources.PartHeader + "&nbsp;" + qPage.PartNo + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + titles;
                }
                litSearchDescription.Text = info;

                litSearchDescription.Visible = true;
                divDescription.Visible       = true;
                lblmessage.Visible           = false;
            }

            if (iSrchList.Count > 0)
            {
                rptVerses.Visible = true;
            }
            else
            {
                rptVerses.Visible  = false;
                lblmessage.Visible = true;
                lblmessage.Text    = Resources.iQuranMessagesResources.NoSearchResult + "<br /><br />";
            }
        }
Exemplo n.º 10
0
        private void PopulateControls()
        {
            ForumThread thread = null;

            if (threadId == -1)
            {
                this.btnDelete.Visible = false;
                postList.Visible       = false;
                postListAlt.Visible    = false;
                Title = SiteUtils.FormatPageTitle(siteSettings, CurrentPage.PageName + " - " + ForumResources.NewThreadLabel);
            }
            else
            {
                if (postId > -1)
                {
                    thread = new ForumThread(threadId, postId);
                    if (isModerator ||
                        ((this.theUser != null) && (this.theUser.UserId == thread.PostUserId))
                        )
                    {
                        this.txtSubject.Text = thread.PostSubject;
                        edMessage.Text       = thread.PostMessage;
                    }
                    else
                    {
                        //user has no permission to edit this post
                        WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                        return;
                    }

                    if (isModerator)
                    {
                        divSortOrder.Visible = true;
                        txtSortOrder.Text    = thread.PostSortOrder.ToInvariantString();
                    }
                    else if ((config.AllowEditingPostsLessThanMinutesOld != -1) && (thread.CurrentPostDate < DateTime.UtcNow.AddMinutes(-config.AllowEditingPostsLessThanMinutesOld)))
                    {
                        // not allowing edit of older posts
                        WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                        return;
                    }
                }
                else
                {
                    thread = new ForumThread(threadId);
                    this.txtSubject.Text
                        = ResourceHelper.GetMessageTemplate(SiteUtils.GetDefaultUICulture(), "ForumPostReplyPrefix.config")
                          + SecurityHelper.RemoveMarkup(thread.Subject);
                }

                if ((thread.IsLocked || thread.IsClosed(config.CloseThreadsOlderThanDays)) && (!isModerator))
                {
                    WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                    return;
                }


                if ((forum != null) && (thread != null))
                {
                    Title = SiteUtils.FormatPageTitle(siteSettings, forum.Title + " - " + SecurityHelper.RemoveMarkup(thread.Subject));
                }

                if (forumId == -1)
                {
                    forumId = thread.ForumId;
                }

                postList.Forum    = forum;
                postListAlt.Forum = forum;

                postList.Thread    = thread;
                postListAlt.Thread = thread;
            }

            if (forum != null)
            {
                heading.Text             = forum.Title;
                litForumDescription.Text = forum.Description;
                divDescription.Visible   = (forum.Description.Length > 0) && (!displaySettings.HideForumDescriptionOnPostEdit);
            }


            if (threadId == -1) //only focus the subject on new threads
            {
                string hookupInputScript = "<script type=\"text/javascript\">"
                                           + "document.getElementById('" + this.txtSubject.ClientID + "').focus();</script>";

                if (!Page.ClientScript.IsStartupScriptRegistered("finitscript"))
                {
                    this.Page.ClientScript.RegisterStartupScript(
                        typeof(Page),
                        "finitscript", hookupInputScript);
                }

                edMessage.WebEditor.SetFocusOnStart = false;
            }
            else
            {
                edMessage.WebEditor.SetFocusOnStart = true;
            }



            chkNotifyOnReply.Checked = isSubscribedToThread;

            lnkPageCrumb.Text        = CurrentPage.PageName;
            lnkPageCrumb.NavigateUrl = SiteUtils.GetCurrentPageUrl();

            if (ForumConfiguration.CombineUrlParams)
            {
                lnkForum.HRef = SiteRoot + "/Forums/ForumView.aspx?pageid=" + pageId.ToInvariantString()
                                + "&amp;f=" + forum.ItemId.ToInvariantString() + "~1";
            }
            else
            {
                lnkForum.HRef = SiteRoot + "/Forums/ForumView.aspx?ItemID="
                                + forum.ItemId.ToInvariantString()
                                + "&amp;pageid=" + pageId.ToInvariantString()
                                + "&amp;mid=" + forum.ModuleId.ToInvariantString();
            }

            lnkForum.InnerHtml = forum.Title;
            if (thread != null)
            {
                lblThreadDescription.Text = SecurityHelper.RemoveMarkup(thread.Subject);
            }
        }
Exemplo n.º 11
0
        public static void BuildScript(StringBuilder script, ITinyMceSettings config, string targetClientId, Unit width, Unit height)
        {
            if (script == null)
            {
                return;
            }
            if (config == null)
            {
                return;
            }

            script.Append("tinymce.init({");

            if (config.Inline)
            {
                script.Append("inline:true,");
            }

            script.Append("selector:\"#" + targetClientId + "\"");

            //http://www.tinymce.com/wiki.php/Configuration

            if (width != Unit.Empty)
            {
                script.Append(",width:\"" + width.ToString() + "\"");
            }

            if (height != Unit.Empty)
            {
                script.Append(",height: \"" + height.ToString() + "\"");
            }

            if (!config.ConvertUrls)
            {
                script.Append(",convert_urls:false");
            }

            if (config.NoWrap)
            {
                script.Append(",nowrap:true");
            }

            if (config.DisableMenuBar)
            {
                script.Append(",menubar:false");
            }
            else
            {
                script.Append(",menubar:'" + config.Menubar + "'");
            }

            if ((!config.ShowStatusbar) || (config.Inline))
            {
                script.Append(",statusbar:false");
            }

            if (config.ForcePasteAsPlainText)
            {
                script.Append(",paste_as_text:true");
            }

            if (config.RemovedMenuItems.Length > 0)
            {
                script.Append(",removed_menuitems: '" + config.RemovedMenuItems + "'");
            }

            script.Append(",schema:'html5'");

            if (config.CustomToolbarElementClientId.Length > 0)
            {
                script.Append(",fixed_toolbar_container:'" + config.CustomToolbarElementClientId + "'");
            }

            if (config.EnableBrowserSpellCheck)
            {
                script.Append(",browser_spellcheck:true ");
            }

            if (config.AutoLocalize)
            {
                CultureInfo culture;
                if (WebConfigSettings.UseCultureOverride)
                {
                    culture = SiteUtils.GetDefaultUICulture();
                }
                else
                {
                    culture = CultureInfo.CurrentUICulture;
                }

                config.Language = GetSupportedLangCode(culture.Name, culture.TwoLetterISOLanguageName);

                if (culture.TextInfo.IsRightToLeft)
                {
                    config.TextDirection = "rtl";
                }
            }

            if (config.Language.Length > 0)
            {
                script.Append(",language:\"" + config.Language + "\"");
            }

            if (config.ExtendedValidElements.Length > 0)
            {
                script.Append(",extended_valid_elements:\"" + config.ExtendedValidElements + "\"");
            }

            if ((config.TextDirection != "ltr") && (config.TextDirection.Length > 0))
            {
                script.Append(",directionality:'" + config.TextDirection + "'");
            }

            if (!config.EnableObjectResizing)
            {
                script.Append(",object_resizing:false");
            }

            // http://www.tinymce.com/wiki.php/Plugins
            if (config.Plugins.Length > 0)
            {
                script.Append(",plugins:\"" + config.Plugins + "\"");
            }

            if (config.Theme != "modern")
            {
                script.Append(",theme:\"" + config.Theme + "\"");
            }

            if (config.Skin != "lightgray")
            {
                script.Append(",skin:\"" + config.Skin + "\"");
            }

            if (config.UnDoLevels != -1)
            {
                script.Append(",custom_undo_redo_levels:" + config.UnDoLevels.ToInvariantString());
            }

            if (config.Toolbar1Buttons.Length > 0)
            {
                script.Append(",toolbar1:\"" + config.Toolbar1Buttons + "\"");
            }

            if (config.Toolbar2Buttons.Length > 0)
            {
                script.Append(",toolbar2:\"" + config.Toolbar2Buttons + "\"");
            }

            if (config.Toolbar3Buttons.Length > 0)
            {
                script.Append(",toolbar3:\"" + config.Toolbar3Buttons + "\"");
            }

            if (config.EnableImageAdvancedTab)
            {
                script.Append(",image_advtab:true");
            }

            if (config.EditorAreaCSS.Length > 0)
            {
                script.Append(",content_css:\"" + config.EditorAreaCSS + "\"");
            }

            if (config.EditorBodyCssClass.Length > 0)
            {
                script.Append(",body_class:\"" + config.EditorBodyCssClass + "\"");
            }

            if (config.AutoFocus)
            {
                script.Append(",auto_focus:\"" + targetClientId + "\" ");
            }

            if (config.TemplatesUrl.Length > 0)
            {
                script.Append(",templates: \"" + config.TemplatesUrl + "\"");
            }

            if (config.StyleFormats.Length > 0)
            {
                script.Append(",style_formats:" + config.StyleFormats);
            }

            if (config.EmotionsBaseUrl.Length > 0)
            {
                script.Append(",emotions_images_url:'" + config.EmotionsBaseUrl + "'");
            }

            if (config.OnSaveCallback.Length > 0)
            {
                script.Append(",save_onsavecallback:" + config.OnSaveCallback);
                if (config.SaveEnableWhenDirty)
                {
                    script.Append(",save_enablewhendirty:true");
                }
            }

            if (config.DropFileUploadUrl.Length > 0)
            {
                script.Append(",dropFileUploadUrl:'" + config.DropFileUploadUrl + "'");
            }

            if ((config.FileManagerUrl.Length > 0))
            {
                script.Append(",file_browser_callback: function(field_name, url, type, win) { ");
                script.Append("tinyMCE.activeEditor.windowManager.open({");
                script.Append("url:'" + config.FileManagerUrl + "' + '?editor=tinymce&type=' + type, ");
                script.Append("title:'" + Resource.FileBrowser.HtmlEscapeQuotes() + "',");
                script.Append("width: ~~((80 / 100) * window.innerWidth),");
                script.Append("height: ~~((80 / 100) * window.innerHeight)");
                //script.Append(",resizable: true"); // doesn't seem to work
                //script.Append("inline : 'yes',"); // not needed in 4.x I guess
                //script.Append(" close_previous : 'no'"); // not needed in 4.x I guess
                script.Append("}, {");
                script.Append("oninsert: function(newurl) {win.document.getElementById(field_name).value = newurl;}");
                script.Append("}); ");
                script.Append("return false;");
                script.Append("}");
            }

            script.Append(",setup:function(editor) {");

            if (config.GlobarVarToAssignEditor.Length > 0)
            {
                script.Append(config.GlobarVarToAssignEditor + " = editor; ");
            }

            if (config.PromptOnNavigationWithUnsavedChanges)
            {
                // autosave plugin also prompts so don't need this if it is used
                if (!config.Plugins.Contains("autosave,"))
                {
                    script.Append("editor.on('change', function(e) {");
                    script.Append("hookupGoodbyePrompt(\"" + Resource.UnSavedChangesPrompt.HtmlEscapeQuotes().RemoveLineBreaks() + "\"); ");
                    script.Append("});");
                }
            }

            script.Append("}");             //end setup
            script.Append("});");
        }
Exemplo n.º 12
0
        private void SetupScripts()
        {
            ScriptManager.RegisterClientScriptBlock(
                this,
                this.GetType(),
                "ckeditormain",
                "\n<script type=\"text/javascript\" src=\""
                + ResolveUrl(this.BasePath + "ckeditor.js") + "\"></script>", false);

            StringBuilder script = new StringBuilder();

            script.Append("\n<script type=\"text/javascript\">");

            script.Append("var editor" + this.ClientID + " = CKEDITOR.replace('" + this.ClientID + "'");

            script.Append(", { ");

            script.Append("customConfig : '" + ResolveUrl(customConfigPath) + "' ");

            script.Append(", baseHref : '" + siteRoot + "'");

            if (Height != Unit.Empty)
            {
                script.Append(", height : " + this.Height.ToString().Replace("px", string.Empty));
            }
            else
            {
                script.Append(", height : 350");
            }

            if (autoFocus)
            {
                script.Append(",startupFocus : true");
            }

            script.Append(",skin:'" + skin + "'");

            script.Append(",editorId:'" + ClientID + "'");

            CultureInfo culture;

            if (WebConfigSettings.UseCultureOverride)
            {
                culture = SiteUtils.GetDefaultUICulture();
            }
            else
            {
                culture = CultureInfo.CurrentUICulture;
            }

            if (WebConfigSettings.CKeditorSuppressTitle)
            {
                script.Append(",title:false");
            }


            script.Append(",language:'" + GetLanguageCode(culture) + "'");

            if ((textDirection == Direction.RightToLeft) || (culture.TextInfo.IsRightToLeft))
            {
                script.Append(", contentsLangDirection : 'rtl'");
            }

            if (editorCSSUrl.Length > 0)
            {
                script.Append(", contentsCss : '" + editorCSSUrl + "'");
            }

            script.Append(",bodyClass:'" + editorBodyCssClass + "' ");

            if ((enableFileBrowser) && (fileManagerUrl.Length > 0))
            {
                script.Append(",filebrowserWindowWidth : 860");
                script.Append(",filebrowserWindowHeight : 700");
                script.Append(",filebrowserBrowseUrl:'" + fileManagerUrl + "?ed=ck&type=file' ");
                script.Append(",filebrowserImageBrowseUrl:'" + fileManagerUrl + "?ed=ck&type=image' ");
                script.Append(",filebrowserFlashBrowseUrl:'" + fileManagerUrl + "?ed=ck&type=media' ");
                script.Append(",filebrowserImageBrowseLinkUrl:'" + fileManagerUrl + "?ed=ck&type=file' ");
                script.Append(",filebrowserWindowFeatures:'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes'");
                if (dropFileUploadUrl.Length > 0)
                {
                    script.Append(",dropFileUploadUrl:'" + Page.ResolveUrl(dropFileUploadUrl) + "'");
                }
            }

            // script.Append(",ignoreEmptyParagraph:true");

            if (forcePasteAsPlainText)
            {
                script.Append(",forcePasteAsPlainText:true");
            }

            //if (!entityEncode)
            //{
            //    script.Append(",entities:false");
            //}

            if (htmlEncode)
            {
                script.Append(",htmlEncodeOutput:true");
            }

            if (fullPageMode)
            {
                script.Append(",fullPage : true ");
            }

            SetupToolBar(script);
            script.Append("}");

            script.Append("); ");


            script.Append("function SetupEditor" + this.ClientID + "( editorObj){");


            if (stylesJsonUrl.Length > 0)
            {
                script.Append("editorObj.config.stylesCombo_stylesSet = 'mojo:" + stylesJsonUrl + "';");
            }

            if (templatesJsonUrl.Length > 0)
            {
                script.Append("editorObj.config.templates = 'mojo';");
                script.Append("editorObj.config.templates_files = ['" + templatesJsonUrl + "'];");
                script.Append("editorObj.config.templates_replaceContent = false;");
            }

            script.Append("editorObj.config.smiley_path = '" + Page.ResolveUrl("~/Data/SiteImages/emoticons/") + "';");
            script.Append("editorObj.config.extraPlugins='onchange'; ");

            if (useGoodbyePrompt)
            {
                script.Append("editorObj.on( 'change', function(e) {");
                //script.Append("hookupGoodbyePrompt(\"" + Page.Server.HtmlEncode(Resource.UnSavedChangesPrompt) + "\"); ");
                script.Append(" if (editorObj.checkDirty()){");
                script.Append("hookupGoodbyePrompt(\"" + Resource.UnSavedChangesPrompt.HtmlEscapeQuotes().RemoveLineBreaks() + "\"); ");
                script.Append("} ");

                script.Append(" }); ");
            }



            script.Append("}");

            script.Append("SetupEditor" + this.ClientID + "(editor" + this.ClientID + ");");


            script.Append("</script>");

            ScriptManager.RegisterStartupScript(
                this,
                this.GetType(),
                this.UniqueID,
                script.ToString(),
                false);

            //this will help the editor work in updatepanel
            ScriptManager.RegisterOnSubmitStatement(this, this.GetType(), "updateditor" + this.ClientID, "CKEDITOR.instances['" + this.ClientID + "'].updateElement();");
        }
Exemplo n.º 13
0
        private void SetupScripts()
        {
            if (BasePath.Contains("tiny_mce"))
            {
                this.Page.ClientScript.RegisterClientScriptBlock(
                    this.GetType(),
                    "tinymcemain",
                    "<script type=\"text/javascript\" src=\""
                    + ResolveUrl(this.BasePath + "tiny_mce.js") + "\"></script>");
            }
            else
            {
                this.Page.ClientScript.RegisterClientScriptBlock(
                    this.GetType(),
                    "tinymcemain",
                    "<script type=\"text/javascript\" src=\""
                    + ResolveUrl(this.BasePath + "tinymce.min.js") + "\"></script>");
            }

            StringBuilder setupScript = new StringBuilder();

            setupScript.Append("function mojoTinyMCEOnChangeHandler(inst) {");
            //setupScript.Append("hookupGoodbyePrompt(\"" + Page.Server.HtmlEncode(Resource.UnSavedChangesPrompt) + "\"); ");
            setupScript.Append("hookupGoodbyePrompt(\"" + Resource.UnSavedChangesPrompt.HtmlEscapeQuotes().RemoveLineBreaks() + "\"); ");
            setupScript.Append("} ");

            Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                                                        "tinymceExitPrompt", "\n<script type=\"text/javascript\">\n"
                                                        + setupScript.ToString() + "\n</script>");

            setupScript = new StringBuilder();
            setupScript.Append("\n<script type=\"text/javascript\">");

            //this older approach did not work inside tabs
            // so we switched to use the editor constructor
            //setupScript.Append("tinyMCE.init({");
            //setupScript.Append("mode :\"specific_textareas\" ");
            //setupScript.Append(", editor_selector : \"mceEditor\" ");

            //if (BasePath.Contains("tiny_mce"))
            //{

            setupScript.Append(" var ed" + this.ClientID + " = new tinymce.Editor('" + this.ClientID + "', { ");
            //}
            //else
            //{
            //    setupScript.Append("tinyMCE.init({");
            //    setupScript.Append("selector: 'textarea#" + this.ClientID + "',");
            //    setupScript.Append("theme: 'modern',");
            //}


            setupScript.Append("accessibility_focus : true ");

            //waiting for the 3.5 branch of TinyMCE to comeout of beta
            // it has more support for html 5

            setupScript.Append(", schema :'" + WebConfigSettings.TinyMceSchema + "' ");
            //http://www.tinymce.com/tryit/html5_formats.php
            // setupScript.Append(",style_formats :[{title : 'section', block : 'section', wrapper: true, merge_siblings: false},");
            // setupScript.Append("{title : 'article', block : 'article', wrapper: true, merge_siblings: false},");
            // setupScript.Append("{title : 'aside', block : 'aside', wrapper: true},");
            // setupScript.Append("{title : 'figure', block : 'figure', wrapper: true}]");



            //if (!AccessibilityFocus) // true is default
            //{
            //    setupScript.Append(", accessibility_focus : false ");
            //}
            if (!AccessibilityWarnings)
            {
                setupScript.Append(", accessibility_warnings : false ");
            }

            setupScript.Append(", browsers : \"" + this.Browsers + "\"");

            setupScript.Append(",forced_root_block:'" + forcedRootBlock + "'");

            if (!CustomShortcuts)
            {
                setupScript.Append(", custom_shortcuts : false ");
            }

            if (!convertUrls)
            {
                setupScript.Append(", convert_urls : false ");
            }

            // added 2009-12-15 previously TinyMCE was encoding German chars and this made it not find matches in search index
            setupScript.Append(", entity_encoding : 'raw' ");

            //setupScript.Append(",encoding :'xml'");

            setupScript.Append(", dialog_type : \"" + this.DialogType + "\"");

            CultureInfo culture;

            if (WebConfigSettings.UseCultureOverride)
            {
                culture = SiteUtils.GetDefaultUICulture();
            }
            else
            {
                culture = CultureInfo.CurrentUICulture;
            }



            setupScript.Append(",language:'" + culture.TwoLetterISOLanguageName + "'");

            if (culture.TextInfo.IsRightToLeft)
            {
                textDirection = "rtl";
            }

            if (extendedValidElements.Length > 0)
            {
                setupScript.Append(",extended_valid_elements:\"" + extendedValidElements + "\"");
            }

            //extended_valid_elements

            setupScript.Append(",directionality:\"" + this.TextDirection + "\"");

            setupScript.Append(",editor_deselector:\"" + this.DeSelectorCSSClass + "\"");

            if (spellCheckerUrl.Length > 0)
            {
                setupScript.Append(", spellchecker_rpc_url:\"" + spellCheckerUrl + "\"");
            }
            else
            {
                if (EnableGeckoSpellCheck)
                {
                    setupScript.Append(",gecko_spellcheck : true ");
                }
            }

            if ((plugins.Contains("spellchecker")) && (SpellCheckerLanguages.Length > 0))
            {
                setupScript.Append(",spellchecker_languages:\"" + SpellCheckerLanguages + "\"");
            }

            //setupScript.Append(", language : \"" + this.Language + "\"");

            setupScript.Append(",body_class:'" + editorBodyCssClass + "'");

            if (!EnableObjectResizing)
            {
                setupScript.Append(", object_resizing : false ");
            }

            if (Plugins.Length > 0)
            {
                setupScript.Append(", plugins : \"" + this.Plugins + "\"");
                if (Plugins.Contains("preview"))
                {
                    setupScript.Append(",plugin_preview_width:'850'");
                    setupScript.Append(",plugin_preview_height:'900'");
                }

                //TODO: populate from style templates for a element
                //http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink
                //This option should contain a semicolon separated list of class titles and class names separated by =
                //advlink_styles : “Code=code;Excel=excel;Flash=flash;Sound=sound;Office=office;PDF=pdf;Image=image;PowerPoint=powerpoint;Word=word;Video=video”
                //advlink_styles

                //setupScript.Append(",media_strict:false");
            }

            //setupScript.Append(",apply_source_formatting:true");

            //if (UseStrictLoadingMode)
            //{
            //    setupScript.Append(", strict_loading_mode : true ");
            //}

            setupScript.Append(", theme : \"" + this.Theme + "\"");

            if (!EnableUndoRedo)
            {
                setupScript.Append(", custom_undo_redo : false ");
            }

            if (EnableUndoRedo)
            {
                setupScript.Append(", custom_undo_redo_levels : " + this.UnDoLevels.ToString());
            }

            if (Theme == "advanced")
            {
                setupScript.Append(", layout_manager : \"" + this.AdvancedLayoutManager + "\"");
                setupScript.Append(", theme_advanced_blockformats : \"" + this.AdvancedBlockFormats + "\"");
                if (AdvancedStyles.Length > 0)
                {
                    setupScript.Append(", theme_advanced_styles : \"" + this.AdvancedStyles + "\"");
                }

                setupScript.Append(", theme_advanced_source_editor_width : \"" + this.AdvancedSourceEditorWidth + "\"");
                setupScript.Append(", theme_advanced_source_editor_height : \"" + this.AdvancedSourceEditorHeight + "\"");
                if (!AdvancedSourceEditorWrap)
                {
                    setupScript.Append(", theme_advanced_source_editor_wrap : false ");
                }

                if (AdvancedLayoutManager == "SimpleLayout")
                {
                    setupScript.Append(", theme_advanced_toolbar_location : \"" + this.AdvancedToolbarLocation + "\"");
                    setupScript.Append(", theme_advanced_toolbar_align : \"" + this.AdvancedToolbarAlign + "\"");
                    setupScript.Append(", theme_advanced_statusbar_location : \"" + this.AdvancedStatusBarLocation + "\"");

                    setupScript.Append(", theme_advanced_buttons1 : \"" + this.AdvancedRow1Buttons + "\"");
                    setupScript.Append(", theme_advanced_buttons2 : \"" + this.AdvancedRow2Buttons + "\"");
                    setupScript.Append(", theme_advanced_buttons3 : \"" + this.AdvancedRow3Buttons + "\"");

                    //setupScript.Append(", theme_advanced_buttons1_add : \"pastetext,pasteword,selectall\"");

                    setupScript.Append(",theme_advanced_resizing : true ");
                }

                //advanced theme has 2 skins default and o2k7
                // o2k7 also supports skin_variant with default, silver and black as options
                // so basically we have
                // default
                // o2k7default
                // o2k7silver
                // o2k7black
                switch (skin)
                {
                case "o2k7default":
                    setupScript.Append(",skin :'o2k7'");
                    break;

                case "o2k7silver":
                    setupScript.Append(",skin :'o2k7'");
                    setupScript.Append(",skin_variant :'silver'");
                    break;

                case "o2k7black":
                    setupScript.Append(",skin :'o2k7'");
                    setupScript.Append(",skin_variant :'black'");
                    break;


                case "default":
                default:
                    //do nothing
                    break;
                }

                if (templatesUrl.Length > 0)
                {
                    setupScript.Append(",template_external_list_url: \"" + this.templatesUrl + "\"");
                }

                if (!Cleanup)
                {
                    setupScript.Append(", cleanup : false ");
                }

                if (CleanupOnStart)
                {
                    setupScript.Append(", cleanup_on_startup : true ");
                }

                //setupScript.Append(",convert_newlines_to_brs : true ");

                if (!InlineStyles)
                {
                    setupScript.Append(", inline_styles : false ");
                }

                if (EditorAreaCSS.Length > 0)
                {
                    setupScript.Append(", content_css : \"" + this.EditorAreaCSS + "\"");
                }

                if (emotionsBaseUrl.Length > 0)
                {
                    setupScript.Append(",emotions_images_url : '" + emotionsBaseUrl + "'");
                }

                if (AutoFocus)
                {
                    setupScript.Append(", auto_focus : \"" + this.ClientID + "\" ");
                }

                if ((enableFileBrowser) && (fileManagerUrl.Length > 0))
                {
                    setupScript.Append(",file_browser_callback : 'myFileBrowser' ");
                }


                setupScript.Append(",onchange_callback : 'mojoTinyMCEOnChangeHandler' ");


                if (forcePasteAsPlainText)
                {
                    //setupScript.Append(",oninit:'setPlainText'");
                    setupScript.Append(",paste_text_sticky:true");
                    setupScript.Append(",setup : function(ed) {");
                    setupScript.Append("ed.onInit.add(function(ed) {");
                    setupScript.Append("ed.pasteAsPlainText = true;");
                    setupScript.Append("});}");
                }
            }

            setupScript.Append("}); ");

            if (plugins.Contains("fullpage"))
            {
                StringBuilder supScript = new StringBuilder();
                supScript.Append("\n<script type=\"text/javascript\">");
                supScript.Append("var editorContentFilter = {");
                supScript.Append("setContent: function(originalContent) {");
                supScript.Append(" var headMatch = originalContent.match(/<head>(.|\\n|\\r)*?<\\/head>/i);");
                supScript.Append("if (headMatch) {");
                supScript.Append("var headText = headMatch[0];");
                supScript.Append("var stylesMatch = headText.match(/<style(.|\\n|\\r)*?>(.|\\n|\\r)*?<\\/style>/ig);");
                supScript.Append("if (stylesMatch) {");
                supScript.Append("var styleText = \"\";");
                supScript.Append("for (var i = 0; i < stylesMatch.length; i++) {");
                supScript.Append("styleText += stylesMatch[i];");
                supScript.Append("}");
                supScript.Append("originalContent = originalContent.replace(/<body((.|\\n|\\r)*?)>/gi, \"<body$1><!--style begin-->\" + styleText + \"<!--style end-->\");");
                supScript.Append("}");
                supScript.Append("}");
                supScript.Append("return originalContent;");
                supScript.Append("},");
                supScript.Append("getContent: function(originalContent) {");
                supScript.Append(" return originalContent.replace(/<!--style begin-->(.|\\n|\\r)*?<!--style end-->/g, '');");
                supScript.Append("}");
                supScript.Append("};");

                supScript.Append("</script>");

                this.Page.ClientScript.RegisterClientScriptBlock(
                    typeof(Page),
                    "tmcfpfix",
                    supScript.ToString());

                setupScript.Append("ed" + this.ClientID + ".onBeforeSetContent.add(function(ed, o) {");
                setupScript.Append("o.content = editorContentFilter.setContent(o.content);");
                setupScript.Append(" });");

                setupScript.Append("ed" + this.ClientID + ".onGetContent.add(function(ed, o) {");
                setupScript.Append("o.content = editorContentFilter.getContent(o.content);");
                setupScript.Append(" });");
            }

            setupScript.Append("ed" + this.ClientID + ".render(); ");

            //if (forcePasteAsPlainText)
            //{
            //    setupScript.Append("ed" + this.ClientID + ".onPaste.add( function(ed, e, o){ ");
            //    setupScript.Append("ed.execCommand('mcePasteText', true); ");
            //    setupScript.Append("ed.execCommand('mceAddUndoLevel');");
            //    setupScript.Append("return tinymce.dom.Event.cancel(e); ");
            //    setupScript.Append("});");

            //}



            setupScript.Append("</script>");

            this.Page.ClientScript.RegisterStartupScript(
                this.GetType(),
                this.UniqueID,
                setupScript.ToString());


            if ((enableFileBrowser) && (fileManagerUrl.Length > 0))
            {
                SetupFileBrowserScript();
            }

            //string submitScript = " tinyMCE.triggerSave(false,true); ";
            ////submitScript = " alert(tinyMCE.getContent('" + this.ClientID + "')); return false; ";

            //this.Page.ClientScript.RegisterOnSubmitStatement(
            //    this.GetType(), "tmsubmit", submitScript);
        }
        /// <summary>
        /// textSearchWordOrRoot : - r : root  - w: word
        /// searchedTextType : Searched Text Type : Part From Word - p , Part From Verse - v , Exact word - i
        /// textSearchWord : the word we are searching for , no matter, root or word
        /// wordFontType - Word Fornt Type  : Dictational (field : TypeDict) , Othmani (Field : TypeOthm)
        /// serachCriteria : the criteria no matter Otmani or Dictional :
        ///     Word Dictional Criteria : DictNMAlif , DictNM
        ///     Word Othmani Criteria : OthmNMAlif , OthmNM , Othm
        ///
        /// Parameteres: qid sf st vf vt sw tor tt sc ft d ps
        /// pageSize (ps)
        /// quranID (qid)  suraIDFrom (sf) suraIDTo (st) verseOrderFrom (vf) verseOrderTo (vt)  textSearchWord (sw)
        /// textSearchWordOrRoot (tor) : w , r
        /// isDefault (d) : 0 -no, 1 - yes
        /// searchedTextType (tt) : Part From - p , Exact word - i
        /// serachCriteria (sc) : * Word Dictional Criteria : DictNMAlif , DictNM / * Word Othmani Criteria : OthmNMAlif , OthmNM , Othm
        /// Font Type (ft) : o - Othmani , d- Dictional
        /// </summary>
        private void BindVrses()
        {
            List <iQuranSearch> iSrchList = null;
            string redirectUrl            = string.Empty;

            if (this.isDefault == 1)
            {
                #region [Arabic Default]

                if (textSearchWordOrRoot == "r")
                {
                    iSrchList = iQuranSearch.iSearch_GetPage_Default_ByRoot_Table(this.siteID, this.quranID, this.suraIDFrom,
                                                                                  this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord, pageNumber, pageSize, out totalPages);
                }
                else
                {
                    switch (searchedTextType)
                    {
                    case "v":
                        iSrchList = iQuranSearch.iSearch_GetPage_Default_ByWordVerse(this.serachCriteria, this.siteID, this.quranID, this.suraIDFrom,
                                                                                     this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord, pageNumber, pageSize, out totalPages);
                        break;

                    case "p":
                    default:
                        iSrchList = iQuranSearch.iSearch_GetPage_Default_ByWordSentence(this.serachCriteria, this.siteID, this.quranID, this.suraIDFrom,
                                                                                        this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord, pageNumber, pageSize, out totalPages);
                        break;

                    case "i":
                        iSrchList = iQuranSearch.iSearch_GetPage_Default_ByOnlyWord(this.serachCriteria, this.siteID, this.quranID, this.suraIDFrom,
                                                                                    this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord, pageNumber, pageSize, out totalPages);
                        break;
                    }
                }
                #endregion
            }
            else
            {
                #region [Translation]

                iSrchList = iQuranSearch.iSearch_GetPage_Translation_ByWordSentence(this.siteID, this.quranID, this.suraIDFrom,
                                                                                    this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord, pageNumber, pageSize, out totalPages);

                #endregion
            }

            rptVerses.DataSource = iSrchList;
            rptVerses.DataBind();



            string pageUrl = string.Empty;

            if (this.isDefault == 1)
            {
                if (textSearchWordOrRoot == "r")
                {
                    //Root
                    pageUrl = SiteRoot
                              + "/iQuran/QuranSearch/iQuranSimpleSearchView.aspx?"
                              + "qid=" + this.quranID.ToInvariantString()
                              + "&sf=" + this.suraIDFrom.ToInvariantString()
                              + "&st=" + this.suraIDTo.ToInvariantString()
                              + "&vf=" + this.verseOrderFrom.ToInvariantString()
                              + "&vt=" + this.verseOrderTo.ToInvariantString()
                              + "&tor=" + this.textSearchWordOrRoot
                              + "&d=" + this.isDefault
                              + "&ps=" + this.pageSize
                              + "&sw=" + this.textSearchWord
                              + "&pagenumber={0}";
                }
                else
                {
                    //Word
                    pageUrl = SiteRoot
                              + "/iQuran/QuranSearch/iQuranSimpleSearchView.aspx?"
                              + "qid=" + this.quranID.ToInvariantString()
                              + "&sf=" + this.suraIDFrom.ToInvariantString()
                              + "&st=" + this.suraIDTo.ToInvariantString()
                              + "&vf=" + this.verseOrderFrom.ToInvariantString()
                              + "&vt=" + this.verseOrderTo.ToInvariantString()
                              + "&tor=" + this.textSearchWordOrRoot
                              + "&d=" + this.isDefault
                              + "&ps=" + this.pageSize
                              + "&tt=" + this.searchedTextType
                              + "&ft=" + this.fontType
                              + "&sc=" + this.serachCriteria
                              + "&sw=" + this.textSearchWord
                              + "&pagenumber={0}";
                }
            }
            else
            {
                // transl
                pageUrl = SiteRoot
                          + "/iQuran/QuranSearch/iQuranSimpleSearchView.aspx?"
                          + "qid=" + this.quranID.ToInvariantString()
                          + "&sf=" + this.suraIDFrom.ToInvariantString()
                          + "&st=" + this.suraIDTo.ToInvariantString()
                          + "&vf=" + this.verseOrderFrom.ToInvariantString()
                          + "&vt=" + this.verseOrderTo.ToInvariantString()
                          + "&tor=" + this.textSearchWordOrRoot
                          + "&d=" + this.isDefault
                          + "&ps=" + this.pageSize
                          + "&sw=" + this.textSearchWord
                          + "&pagenumber={0}";
            }

            pgr.PageURLFormat = pageUrl;
            pgr.ShowFirstLast = true;
            pgr.PageSize      = this.pageSize;
            pgr.PageCount     = totalPages;
            pgr.CurrentIndex  = pageNumber;

            pgr.Visible = (totalPages > 1);

            if (iSrchList.Count > 0)
            {
                rptVerses.Visible = true;


                if (this.isDefault == 1)
                {
                    #region [Arabic Default]

                    string info     = string.Empty;
                    string VerseQty = string.Empty;
                    string WordQty  = string.Empty;

                    CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();
                    info = ResourceHelper.GetMessageTemplate(defaultCulture,
                                                             "SimpleSearchViewInfo.config");

                    string     SearchWord = this.textSearchWord;
                    SearchInfo srchInfo   = new SearchInfo();

                    if (textSearchWordOrRoot == "r")
                    {
                        srchInfo = new SearchInfo(this.siteID, this.quranID, this.suraIDFrom,
                                                  this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord);
                    }
                    else
                    {
                        srchInfo = new SearchInfo(this.searchedTextType, this.serachCriteria, this.siteID, this.quranID, this.suraIDFrom,
                                                  this.suraIDTo, this.verseOrderFrom, this.verseOrderTo, this.textSearchWord);
                    }

                    // fill info region:

                    VerseQty = srchInfo.VerseQty;
                    WordQty  = srchInfo.WordQty;
                    divTextSearchWord.Attributes.Add("title", srchInfo.SearchedWords);

                    litSearchDescription.Text = string.Format(
                        defaultCulture,
                        info,
                        SearchWord,
                        VerseQty,
                        WordQty);
                    litSearchDescription.Visible = true;
                    divDescription.Visible       = true;
                    lblmessage.Visible           = false;

                    #endregion
                }
                else
                {
                    #region [Translation]

                    litSearchDescription.Visible = false;
                    divDescription.Visible       = false;

                    #endregion
                }
            }
            else
            {
                rptVerses.Visible            = false;
                lblmessage.Visible           = true;
                lblmessage.Text              = Resources.iQuranMessagesResources.NoSearchResult + "<br /><br />";
                litSearchDescription.Visible = false;
                divDescription.Visible       = false;
            }


            #region [BackLink]

            if (this.isDefault == 1)
            {
                #region [Arabic Default]

                if (textSearchWordOrRoot == "r")
                {
                    //Root
                    redirectUrl = SiteRoot
                                  + "/iQuran/QuranSearch/iQuranSimpleSearch.aspx?"
                                  + "qid=" + this.quranID.ToInvariantString()
                                  + "&sf=" + int.Parse(hdnSuraIDFrom.Value).ToInvariantString()
                                  + "&st=" + int.Parse(hdnSuraIDTo.Value).ToInvariantString()
                                  + "&vf=" + int.Parse(hdnVerseOrderFrom.Value).ToInvariantString()
                                  + "&vt=" + int.Parse(hdnVerseOrderTo.Value).ToInvariantString()
                                  + "&tor=" + this.hdnTextSearchWordOrRoot.Value
                                  + "&d=" + this.hdnIsDefault.Value
                                  + "&sw=" + this.hdnTextSearchWord.Value
                                  + "&ps=" + this.pageSize;
                }
                else
                {
                    //Word
                    redirectUrl = SiteRoot
                                  + "/iQuran/QuranSearch/iQuranSimpleSearch.aspx?"
                                  + "qid=" + this.quranID.ToInvariantString()
                                  + "&sf=" + int.Parse(hdnSuraIDFrom.Value).ToInvariantString()
                                  + "&st=" + int.Parse(hdnSuraIDTo.Value).ToInvariantString()
                                  + "&vf=" + int.Parse(hdnVerseOrderFrom.Value).ToInvariantString()
                                  + "&vt=" + int.Parse(hdnVerseOrderTo.Value).ToInvariantString()
                                  + "&tor=" + this.hdnTextSearchWordOrRoot.Value
                                  + "&d=" + this.hdnIsDefault.Value
                                  + "&ps=" + this.pageSize
                                  + "&tt=" + this.hdnSearchedTextType.Value
                                  + "&ft=" + this.hdnFontType.Value
                                  + "&sc=" + this.hdnSerachCriteria.Value
                                  + "&sw=" + this.hdnTextSearchWord.Value;
                }

                #endregion
            }
            else
            {
                #region [Translation]
                // transl
                redirectUrl = SiteRoot
                              + "/iQuran/QuranSearch/iQuranSimpleSearch.aspx?"
                              + "qid=" + this.quranID.ToInvariantString()
                              + "&sf=" + int.Parse(hdnSuraIDFrom.Value).ToInvariantString()
                              + "&st=" + int.Parse(hdnSuraIDTo.Value).ToInvariantString()
                              + "&vf=" + int.Parse(hdnVerseOrderFrom.Value).ToInvariantString()
                              + "&vt=" + int.Parse(hdnVerseOrderTo.Value).ToInvariantString()
                              + "&tor=" + this.hdnTextSearchWordOrRoot.Value
                              + "&d=" + this.hdnIsDefault.Value
                              + "&sw=" + this.hdnTextSearchWord.Value
                              + "&ps=" + this.pageSize;

                #endregion
            }

            hlBack1.NavigateUrl = redirectUrl;
            hlBack2.NavigateUrl = redirectUrl;


            #endregion
        }
Exemplo n.º 15
0
        public static void SendPublishRequestNotification(
            SmtpSettings smtpSettings,
            SiteSettings siteSettings,
            SiteUser submittingUser,
            SiteUser approvingUser,
            ContentWorkflow draftWorkflow,
            string publisherRoles,
            string contentUrl
            )
        {
            if (string.IsNullOrEmpty(publisherRoles))
            {
                publisherRoles = "Admins;Content Administrators;Content Publishers;";
            }

            Module module = new Module(draftWorkflow.ModuleGuid);

            if (module == null)
            {
                return;
            }


            List <string> emailAddresses = SiteUser.GetEmailAddresses(siteSettings.SiteId, publisherRoles);

            //int queuedMessageCount = 0;

            CultureInfo defaultCulture  = SiteUtils.GetDefaultUICulture();
            string      messageTemplate = ResourceHelper.GetMessageTemplate(defaultCulture, "PublishRequestNotification.config");
            string      messageSubject  = ResourceHelper.GetMessageTemplate(defaultCulture, "PublishRequestNotificationSubject.config").Replace("{SiteName}", siteSettings.SiteName);

            foreach (string email in emailAddresses)
            {
                if (WebConfigSettings.EmailAddressesToExcludeFromAdminNotifications.IndexOf(email, StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    continue;
                }

                if (!Email.IsValidEmailAddressSyntax(email))
                {
                    continue;
                }

                StringBuilder message = new StringBuilder();
                message.Append(messageTemplate);
                message.Replace("{ModuleTitle}", draftWorkflow.ModuleTitle);
                message.Replace("{PublishRequestedDate}", draftWorkflow.RecentActionOn.ToShortDateString());
                message.Replace("{SubmittedBy}", submittingUser.Name);
                message.Replace("{ApprovedBy}", approvingUser.Name);
                message.Replace("{ContentUrl}", contentUrl);

                Email.Send(
                    smtpSettings,
                    siteSettings.DefaultEmailFromAddress,
                    siteSettings.DefaultFromEmailAlias,
                    submittingUser.Email,
                    email,
                    string.Empty,
                    string.Empty,
                    messageSubject,
                    message.ToString(),
                    false,
                    Email.PriorityNormal);
            }
        }
        public override void UserRegisteredHandler(object sender, UserRegisteredEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            if (e.SiteUser == null)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (
                (!siteSettings.RequireApprovalBeforeLogin) &&
                (siteSettings.EmailAdressesForUserApprovalNotification.Length == 0)
                )
            {
                return;
            }

            log.Debug("NotifyAdminUserRegisteredHandler called for new user " + e.SiteUser.Email);

            if (HttpContext.Current == null)
            {
                return;
            }

            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            string subjectTemplate
                = ResourceHelper.GetMessageTemplate(defaultCulture,
                                                    "NotifyAdminofNewUserRegistationSubject.config");

            string textBodyTemplate = ResourceHelper.GetMessageTemplate(defaultCulture,
                                                                        "NotifyAdminofNewUserRegistationMessage.config");

            string       siteRoot     = SiteUtils.GetNavigationSiteRoot();
            SmtpSettings smtpSettings = SiteUtils.GetSmtpSettings();

            //lookup admin users and send notification email with link to manage user
            List <string> adminEmails;

            if (siteSettings.EmailAdressesForUserApprovalNotification.Length > 0)
            {
                adminEmails = siteSettings.EmailAdressesForUserApprovalNotification.SplitOnChar(',');
            }
            else
            {
                adminEmails = SiteUser.GetEmailAddresses(siteSettings.SiteId, "Admins;");
            }

            //foreach (DataRow row in admins.Rows)
            foreach (string email in adminEmails)
            {
                if (WebConfigSettings.EmailAddressesToExcludeFromAdminNotifications.IndexOf(email, StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    continue;
                }

                //EmailMessageTask messageTask = new EmailMessageTask(smtpSettings);
                //messageTask.EmailFrom = siteSettings.DefaultEmailFromAddress;
                //messageTask.EmailFromAlias = siteSettings.DefaultFromEmailAlias;
                //messageTask.EmailTo = email;
                //messageTask.Subject = string.Format(defaultCulture, subjectTemplate, e.SiteUser.Email, siteRoot);

                string manageUserLink = siteRoot + "/Admin/ManageUsers.aspx?userid="
                                        + e.SiteUser.UserId.ToInvariantString();

                //messageTask.TextBody = string.Format(defaultCulture, textBodyTemplate, siteSettings.SiteName, siteRoot, manageUserLink);
                //messageTask.SiteGuid = siteSettings.SiteGuid;
                //messageTask.QueueTask();

                Email.Send(
                    smtpSettings,
                    siteSettings.DefaultEmailFromAddress,
                    siteSettings.DefaultFromEmailAlias,
                    string.Empty,
                    email,
                    string.Empty,
                    string.Empty,
                    string.Format(defaultCulture, subjectTemplate, e.SiteUser.Email, siteRoot),
                    string.Format(defaultCulture, textBodyTemplate, siteSettings.SiteName, siteRoot, manageUserLink),
                    false,
                    Email.PriorityNormal);
            }

            //WebTaskManager.StartOrResumeTasks();
        }
Exemplo n.º 17
0
        public static void SendApprovalRequestNotification(
            SmtpSettings smtpSettings,
            SiteSettings siteSettings,
            SiteUser submittingUser,
            ContentWorkflow draftWorkflow,
            string approvalRoles,
            string contentUrl
            )
        {
            if (string.IsNullOrEmpty(approvalRoles))
            {
                approvalRoles = "Admins;Content Administrators;Content Publishers;";
            }

            List <string> emailAddresses = SiteUser.GetEmailAddresses(siteSettings.SiteId, approvalRoles);

            //int queuedMessageCount = 0;

            CultureInfo defaultCulture  = SiteUtils.GetDefaultUICulture();
            string      messageTemplate = ResourceHelper.GetMessageTemplate(defaultCulture, "ApprovalRequestNotification.config");
            string      messageSubject  = ResourceHelper.GetMessageTemplate(defaultCulture, "ApprovalRequestNotificationSubject.config").Replace("{SiteName}", siteSettings.SiteName);

            foreach (string email in emailAddresses)
            {
                if (WebConfigSettings.EmailAddressesToExcludeFromAdminNotifications.IndexOf(email, StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    continue;
                }

                if (!Email.IsValidEmailAddressSyntax(email))
                {
                    continue;
                }

                StringBuilder message = new StringBuilder();
                message.Append(messageTemplate);
                message.Replace("{ModuleTitle}", draftWorkflow.ModuleTitle);
                message.Replace("{ApprovalRequestedDate}", draftWorkflow.RecentActionOn.ToShortDateString());
                message.Replace("{SubmittedBy}", submittingUser.Name);
                message.Replace("{ContentUrl}", contentUrl);

                if (!Email.IsValidEmailAddressSyntax(draftWorkflow.RecentActionByUserEmail))
                {
                    //invalid address log it
                    log.Error("Failed to send workflow rejection message, invalid recipient email "
                              + draftWorkflow.RecentActionByUserEmail
                              + " message was " + message.ToString());

                    return;
                }

                //EmailMessageTask messageTask = new EmailMessageTask(smtpSettings);
                //messageTask.SiteGuid = siteSettings.SiteGuid;
                //messageTask.EmailFrom = siteSettings.DefaultEmailFromAddress;
                //messageTask.EmailReplyTo = submittingUser.Email;
                //messageTask.EmailTo = email;
                //messageTask.Subject = messageSubject;
                //messageTask.TextBody = message.ToString();
                //messageTask.QueueTask();
                //queuedMessageCount += 1;

                Email.Send(
                    smtpSettings,
                    siteSettings.DefaultEmailFromAddress,
                    siteSettings.DefaultFromEmailAlias,
                    submittingUser.Email,
                    email,
                    string.Empty,
                    string.Empty,
                    messageSubject,
                    message.ToString(),
                    false,
                    Email.PriorityNormal);
            }

            //if (queuedMessageCount > 0) { WebTaskManager.StartOrResumeTasks(); }
        }
Exemplo n.º 18
0
        public static void SendPublishRejectionNotification(
            SmtpSettings smtpSettings,
            SiteSettings siteSettings,
            SiteUser rejectingUser,
            SiteUser draftSubmissionUser,
            ContentWorkflow rejectedWorkflow,
            string rejectionReason
            )
        {
            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            string        messageTemplate   = String.Empty;
            string        messageSubject    = String.Empty;
            List <string> messageRecipients = new List <string>();

            if (Email.IsValidEmailAddressSyntax(rejectedWorkflow.RecentActionByUserEmail))
            {
                messageRecipients.Add(rejectedWorkflow.RecentActionByUserEmail);
            }

            messageTemplate = ResourceHelper.GetMessageTemplate(defaultCulture, "PublishRequestRejectionNotification.config");
            messageSubject  = ResourceHelper.GetMessageTemplate(defaultCulture, "PublishRequestRejectionNotificationSubject.config").Replace("{SiteName}", siteSettings.SiteName);

            if (Email.IsValidEmailAddressSyntax(draftSubmissionUser.LoweredEmail))
            {
                messageRecipients.Add(draftSubmissionUser.LoweredEmail);
            }

            StringBuilder message = new StringBuilder();

            message.Append(messageTemplate);
            message.Replace("{ModuleTitle}", rejectedWorkflow.ModuleTitle);
            message.Replace("{PublishRequestedDate}", rejectedWorkflow.RecentActionOn.ToShortDateString());
            message.Replace("{RejectionReason}", rejectionReason);
            message.Replace("{RejectedBy}", rejectingUser.Name);

            if (messageRecipients.Count < 1)
            {
                //no valid addresses -- log it
                log.Error("Failed to send workflow publish rejection message, no valid recipient email "
                          + rejectedWorkflow.RecentActionByUserEmail + ", " + draftSubmissionUser.LoweredEmail
                          + " message was " + message.ToString());

                return;
            }

            foreach (string recipient in messageRecipients)
            {
                Email.Send(
                    smtpSettings,
                    siteSettings.DefaultEmailFromAddress,
                    siteSettings.DefaultFromEmailAlias,
                    rejectingUser.Email,
                    recipient,
                    string.Empty,
                    string.Empty,
                    messageSubject,
                    message.ToString(),
                    false,
                    Email.PriorityNormal);
            }
        }
Exemplo n.º 19
0
        private void PopulateLabels()
        {
            Title = SiteUtils.FormatPageTitle(siteSettings, Resource.PasswordRecoveryTitle);

            MetaDescription = Server.HtmlEncode(string.Format(CultureInfo.InvariantCulture,
                                                              Resource.RecoverPasswordMetaDescriptionFormat,
                                                              siteSettings.SiteName));

            EnterUserNameLabel = (Label)this.PasswordRecovery1.UserNameTemplateContainer.FindControl("lblEnterUserName");
            if (EnterUserNameLabel != null)
            {
                if ((siteSettings != null) && (siteSettings.UseEmailForLogin))
                {
                    EnterUserNameLabel.Text = Resource.EnterEmailLabel;
                }
                else
                {
                    EnterUserNameLabel.Text = Resource.EnterUserNameLabel;
                }
            }

            // UserName template
            Button userNameNextButton = (Button)PasswordRecovery1.UserNameTemplateContainer.FindControl("SubmitButton");

            if (userNameNextButton != null)
            {
                userNameNextButton.Text = Resource.PasswordRecoveryNextButton;
                SiteUtils.SetButtonAccessKey(userNameNextButton, AccessKeys.PasswordRecoveryAccessKey);
            }

            RequiredFieldValidator reqUserName
                = (RequiredFieldValidator)PasswordRecovery1.UserNameTemplateContainer.FindControl("UserNameRequired");

            if (reqUserName != null)
            {
                reqUserName.ErrorMessage = Resource.PasswordRecoveryUserNameRequiredWarning;
            }

            // Question Template
            Button questionNextButton = (Button)PasswordRecovery1.QuestionTemplateContainer.FindControl("SubmitButton");

            if (questionNextButton != null)
            {
                questionNextButton.Text = Resource.PasswordRecoveryNextButton;
                SiteUtils.SetButtonAccessKey(questionNextButton, AccessKeys.PasswordRecoveryAccessKey);
            }

            RequiredFieldValidator reqAnswer
                = (RequiredFieldValidator)PasswordRecovery1.QuestionTemplateContainer.FindControl("AnswerRequired");

            if (reqAnswer != null)
            {
                reqAnswer.ErrorMessage = Resource.PasswordRecoveryAnswerRequired;
            }

            this.PasswordRecovery1.GeneralFailureText  = Resource.PasswordRecoveryGeneralFailureText;
            this.PasswordRecovery1.QuestionFailureText = Resource.PasswordRecoveryQuestionFailureText;
            this.PasswordRecovery1.UserNameFailureText = Resource.PasswordRecoveryUserNameFailureText;

            this.PasswordRecovery1.MailDefinition.From = siteSettings.DefaultEmailFromAddress;
            this.PasswordRecovery1.MailDefinition.Subject
                = string.Format(Resource.PasswordRecoveryEmailSubjectFormatString,
                                siteSettings.SiteName);

            string emailFilename;

            if (Membership.Provider.PasswordFormat == MembershipPasswordFormat.Hashed)
            {
                emailFilename =
                    ResourceHelper.GetFullResourceFilePath(
                        System.Globalization.CultureInfo.CurrentUICulture,
                        this.GetEmailTemplatesFolder(),
                        WebConfigSettings.HashedPasswordRecoveryEmailTemplateFileNamePattern);

                this.PasswordRecovery1.MailDefinition.BodyFileName =
                    string.IsNullOrEmpty(emailFilename) ?
                    this.PasswordRecovery1.MailDefinition.BodyFileName
                    = Server.MapPath("~/Data/MessageTemplates/"
                                     + SiteUtils.GetDefaultUICulture()
                                     + "-" + WebConfigSettings.HashedPasswordRecoveryEmailTemplateFileNamePattern) :
                      emailFilename;
            }
            else
            {
                emailFilename =
                    ResourceHelper.GetFullResourceFilePath(
                        System.Globalization.CultureInfo.CurrentUICulture,
                        this.GetEmailTemplatesFolder(),
                        WebConfigSettings.PasswordRecoveryEmailTemplateFileNamePattern);

                this.PasswordRecovery1.MailDefinition.BodyFileName =
                    string.IsNullOrEmpty(emailFilename) ?
                    this.PasswordRecovery1.MailDefinition.BodyFileName
                    = Server.MapPath("~/Data/MessageTemplates/"
                                     + SiteUtils.GetDefaultUICulture()
                                     + "-" + WebConfigSettings.PasswordRecoveryEmailTemplateFileNamePattern) :
                      emailFilename;
            }

            this.PasswordRecovery1.MailDefinition.IsBodyHtml = ConfigHelper.GetBoolProperty("UseHtmlBodyInPasswordRecoveryEmail", false);

#if !NET35
            PasswordRecovery1.RenderOuterTable = false;
#endif

            AddClassToBody("passwordrecovery");
        }
Exemplo n.º 20
0
        private void BindVrses()
        {
            List <iQuranSearch> iSrchList = null;

            // Get the whole Sura without paging
            int pageNumber = 0;

            bool IsTranslation = false;

            Quran q = new Quran(this.siteID, this.quranID);

            IsTranslation = !q.IsDefault;

            QuranSura qSura = new QuranSura(this.siteID, this.suraID);

            this.suraOrder     = qSura.SuraOrder;
            hdnsuraOrder.Value = this.suraOrder.ToString();


            iSrchList = iQuranSearch.GetFrontEndPage_iSura(this.siteID, this.quranID, this.suraID, this.verseID,
                                                           pageNumber, IsTranslation);

            rptVerses.DataSource = iSrchList;
            rptVerses.DataBind();

            if (iSrchList.Count > 0)
            {
                if ((this.suraOrder != 1) && (this.suraOrder != 9))
                {
                    litBism.Text    = QuranVerse.GetVerseBism(this.siteID, this.quranID, IsTranslation);
                    divBism.Visible = true;
                    litBism.Visible = true;
                }
            }

            if (iSrchList.Count > 0)
            {
                rptVerses.Visible = true;


                string      info           = string.Empty;
                CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();
                info = ResourceHelper.GetMessageTemplate(defaultCulture,
                                                         "SuraViewSearchInfo.config");

                litSearchDescription.Text = string.Format(
                    defaultCulture,
                    info,
                    qSura.Title,
                    qSura.SuraOrder,
                    qSura.VersesCount,
                    this.verseOrder);

                litSearchDescription.Visible = true;
                divDescription.Visible       = true;
                lblmessage.Visible           = false;
            }
            else
            {
                rptVerses.Visible  = false;
                lblmessage.Visible = true;
                lblmessage.Text    = Resources.iQuranMessagesResources.NoSearchResult + "<br /><br />";
            }
        }