public override void HandleRequest(string jsonString, AjaxBase ajax)
        {
            SearchModuleResponse response = new SearchModuleResponse();

            string mangaWhere = "`status`='0'";
            User user = User.GetCurrentUser(ajax);
            string collectionSelect = "FALSE";
            if (Settings.AllowGuest || user != null)
            {
                collectionSelect += " OR `cid` IN (SELECT `id` FROM `collection` WHERE `public`='1')";
            }

            if (user != null)
            {
                collectionSelect += " OR `cid` IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(user.Id.ToString()) + " AND `access`='1')";
                mangaWhere += " AND `cid` NOT IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(user.Id.ToString()) + " AND `access`='0')";
            }

            mangaWhere += " AND (" + collectionSelect + ")";

            string where = "`mid` IN (SELECT `id` FROM `manga` WHERE " + mangaWhere + ")";

            response.authors = Database.GetDistinctStringValues("meta", "author", where);
            response.series = Database.GetDistinctStringValues("meta", "series", where);
            response.publishers = Database.GetDistinctStringValues("meta", "publisher", where);

            ajax.ReturnJson(response);
        }
Exemple #2
0
        private void SearchModuleRequestSuccess(SearchModuleResponse response)
        {
            foreach (string author in response.authors)
            {
                jQuery.FromHtml("<option></option>").AppendTo(jQuery.Select("#search-author")).Text(author);
            }

            foreach (string series in response.series)
            {
                jQuery.FromHtml("<option></option>").AppendTo(jQuery.Select("#search-series")).Text(series);
            }

            foreach (string publisher in response.publishers)
            {
                jQuery.FromHtml("<option></option>").AppendTo(jQuery.Select("#search-publisher")).Text(publisher);
            }
        }