Esempio n. 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));
        }
Esempio n. 2
0
        // GET: glossary
        public async Task <IActionResult> Index(int?id)
        {
            int pagenumber = 1;

            if (id != null)
            {
                pagenumber = (int)id;
            }

            /* List Initialization */
            var ListEntity = new GlossaryListView()
            {
                isListStatus = false,
                QueryOptions = new WikiEntity()
                {
                    pagenumber = (int)pagenumber,
                    term       = "",
                    iscache    = true,
                    pagesize   = 20,
                    order      = "term asc",
                },
                DefaultUrl        = Config.GetUrl("glossary/"),
                PaginationUrl     = Config.GetUrl("glossary/Index/[p]/"),
                NoRecordFoundText = SiteConfig.generalLocalizer["_no_records"].Value,
            };

            if (HttpContext.Request.Query["cq"].Count > 0)
            {
                ListEntity.Character = HttpContext.Request.Query["cq"].ToString();
            }
            if (HttpContext.Request.Query["query"].Count > 0)
            {
                ListEntity.QueryOptions.term = HttpContext.Request.Query["query"].ToString();
            }

            ListEntity.TotalRecords = await WikiBLLC.Count(_context, ListEntity.QueryOptions);

            if (ListEntity.TotalRecords > 0)
            {
                ListEntity.DataList = await WikiBLLC.LoadItems(_context, ListEntity.QueryOptions);
            }

            if (ListEntity.Character != "" && ListEntity.Character != null)
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["_wiki_posts_filter_character"].Value + " " + ListEntity.Character.ToUpper();
            }
            else if (ListEntity.QueryOptions.term != "" && ListEntity.QueryOptions.term != null)
            {
                ViewBag.title = ListEntity.QueryOptions.term + " | " + SiteConfig.dictionaryLocalizer["_wiki_posts"].Value;
            }
            else
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["_wiki_posts"].Value;
            }

            return(View(ListEntity));
        }
Esempio n. 3
0
        public ActionResult proc()
        {
            var json  = new StreamReader(Request.Body).ReadToEnd();
            var model = JsonConvert.DeserializeObject <JGN_Wiki>(json);

            model = WikiBLLC.Add(_context, model);

            return(Ok(new { status = "success", record = model, message = SiteConfig.generalLocalizer["_records_processed"].Value }));
        }
Esempio n. 4
0
        public async Task <ActionResult> action()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <List <WikiEntity> >(json);

            await WikiBLLC.ProcessAction(_context, data);

            return(Ok(new { status = "success", message = SiteConfig.generalLocalizer["_records_processed"].Value }));
        }
Esempio n. 5
0
        public async Task <IActionResult> sitemap(int?rt)
        {
            int    responsetype = 0; // 0: google, 1: bing
            string sXml         = "";

            if (rt != null)
            {
                responsetype = (int)rt;
            }
            switch (responsetype)
            {
            case 0:
                sXml = await WikiBLLC.BuildGoogleSiteMapUrls(_context);

                break;
            }

            return(this.Content(sXml, "text/xml"));
        }
Esempio n. 6
0
        public async Task <ActionResult> load()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <WikiEntity>(json);

            // disable to load complete list for admin use
            data.issummary  = false;
            data.isdropdown = false;

            var _posts = await WikiBLLC.LoadItems(_context, data);

            var _records = 0;

            if (data.id == 0)
            {
                _records = await WikiBLLC.Count(_context, data);
            }

            return(Ok(new { posts = _posts, records = _records }));
        }
Esempio n. 7
0
        public async Task <ActionResult> getinfo()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <WikiEntity>(json);

            var _posts = await WikiBLLC.LoadItems(_context, data);

            if (_posts.Count > 0)
            {
                if (data.detailview)
                {
                    return(Ok(new { status = "success", post = _posts }));
                }
                else
                {
                    return(Ok(new { status = "success", post = _posts[0] }));
                }
            }
            else
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_no_records"].Value }));
            }
        }
Esempio n. 8
0
        public async Task <IActionResult> term(string term, int?id)
        {
            int pagenumber = 1;

            if (id != null)
            {
                pagenumber = (int)id;
            }

            var _sanitize = new HtmlSanitizer();

            term = _sanitize.Sanitize(UtilityBLL.ReplaceHyphinWithSpace(term));
            /* List Initialization */
            var ListEntity = new GlossaryListView()
            {
                isListStatus = false,
                QueryOptions = new WikiEntity()
                {
                    pagenumber = (int)pagenumber,
                    term       = term,
                    iscache    = false,
                    pagesize   = 20,
                    order      = "id desc",
                },
                ListObject = new Jugnoon.Scripts.ListItems()
                {
                    ListType = Jugnoon.Scripts.ListType.List, // 0: grid 1: list
                },
                DefaultUrl        = Config.GetUrl("glosarry/term/" + term),
                PaginationUrl     = Config.GetUrl("glossary/term/" + term + "/[p]/"),
                NoRecordFoundText = SiteConfig.generalLocalizer["_no_records"].Value,
            };

            if (HttpContext.Request.Query["query"].Count > 0)
            {
                ListEntity.QueryOptions.term = HttpContext.Request.Query["query"].ToString();
            }

            ListEntity.TotalRecords = await WikiBLLC.Count(_context, ListEntity.QueryOptions);

            if (ListEntity.TotalRecords > 0)
            {
                ListEntity.DataList = await WikiBLLC.LoadItems(_context, ListEntity.QueryOptions);
            }
            if (ListEntity.Character != "" && ListEntity.Character != null)
            {
                ViewBag.title       = SiteConfig.dictionaryLocalizer["glossary_character_title"].ToString().Replace("{CN}", ListEntity.Character.ToLower());
                ViewBag.description = SiteConfig.dictionaryLocalizer["glossary_character_meta"].ToString().Replace("{CN}", ListEntity.Character.ToLower());
            }
            else if (ListEntity.QueryOptions.term != "" && ListEntity.QueryOptions.term != null)
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["glossary_query_title"].ToString().Replace("{CN}", ListEntity.QueryOptions.term.ToLower());
            }
            else
            {
                ViewBag.title       = SiteConfig.dictionaryLocalizer["glossary_home_title"];
                ViewBag.description = SiteConfig.dictionaryLocalizer["glossary_home_meta"];
            }

            return(View(ListEntity));
        }