Пример #1
0
        // GET: wiki
        public async Task <IActionResult> Index(string title)
        {
            if (title == null)
            {
                return(Redirect(Config.GetUrl("glossary")));
            }

            title = UtilityBLL.UppercaseFirst(UtilityBLL.ReplaceHyphinWithSpace(title));

            var model = new WikiModelView();

            model.isAllowed = true;

            var _lst = await WikiBLLC.Fetch_Record(_context, title);

            if (_lst.Count > 0)
            {
                model.Data = new JGN_Wiki()
                {
                    term_complete = _lst[0].term_complete,
                    description   = BBCode.MakeHtml(WebUtility.HtmlDecode(_lst[0].description), true)
                };
            }
            else
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.generalLocalizer["_no_records"].Value;
            }

            ViewBag.title = title;

            return(View(model));
        }
Пример #2
0
    public static string Process_Content_Text(string html)
    {
        // compress code :-> replace \n - <br />
        html = CompressCodeBreak(html);
        // process bbcode
        html = BBCode.MakeHtml(html, true);
        // prepare urls
        html = UtilityBLL.GenerateLink(html, true);
        // html decode at the end
        //html = HttpContext.Current.Server.HtmlDecode(html);

        return(html);
    }
Пример #3
0
        public static string Prepare_Description(JGN_Blogs Entity, int Length)
        {
            var _desc = BBCode.MakeHtml(Entity.description, true);

            if (_desc.Length > Length)
            {
                _desc = UtilityBLL.StripHTML(_desc.Substring(0, Length) + "...stpr");
                string removeBrokenHyperlinks = Regex.Replace(_desc, @"<a(.*)?stpr", "");

                string removeBrokenP = Regex.Replace(removeBrokenHyperlinks, @"<p(.*)?stpr", "");
                _desc = removeBrokenP.Replace("stpr", "");
            }
            else
            {
                _desc = UtilityBLL.StripHTML(_desc);
            }
            return(_desc);
        }
        //****************************************************
        // GENERAL UTILITY FUNCTIONS
        //****************************************************

        // Utility function to prepare description of any record
        public static string Prepare_Description(string description, int length)
        {
            string desc = UtilityBLL.CompressCodeBreak(BBCode.MakeHtml(description, true));

            // again replace coded word (~~ by bbcode to newline)
            desc = desc.Replace("~~", System.Environment.NewLine);

            if (desc == "")
            {
                return(desc);
            }

            if (desc.Length > length && length > 0)
            {
                desc = desc.Substring(0, length) + "..";
            }

            return(desc);
        }