Mercurial Hosting > nabble
view src/global/web/Index.jtp @ 65:3d7067a23eff
fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 17 Sep 2024 05:01:59 -0600 |
parents | 4987e1a38a6c |
children |
line wrap: on
line source
<% package global.web; import fschmidt.util.servlet.JtpContext; import fschmidt.util.servlet.ServletUtils; import global.HtmlGlobalUtils; import global.Site; import nabble.view.web.more.ForumStart; import org.apache.lucene.index.Term; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; public final class Index extends HttpServlet { private static final Logger logger = LoggerFactory.getLogger(Index.class); // private static boolean hasJobsAtNabble = Init.get("hasJobsAtNabble",false); public static String path() { return "/"; } protected void service(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { JtpContext jtpContext = (JtpContext)getServletContext().getAttribute(JtpContext.attrName); jtpContext.setEtag(request,response,"x"); PrintWriter out = response.getWriter(); %> <!DOCTYPE html> <html lang="en"> <head> <% HtmlGlobalUtils.head(request, response, "Free Forum • Embeddable Web Apps"); %> <link rel="canonical" href="https://www.nabble.com/"> <meta name="description" content="Create a free forum online in less than one minute. All forums are embeddable and fully customizable with scripting language. Choose a unique style and build a discussion board for your community." /> <meta name="keywords" content="free forum, free photo gallery, free newspaper, free blog, best forum, free message board, message board hosting, bulletin board, customizable, private forum, phpBB, vBulletin, hosted, communities"> <meta name="google-site-verification" content="SUurO4gVJ46SZyzANkH4pJBGH8q-6Bv5P-ZgRBH8Cck" /> <style> div[actions] i.fa.fa-chevron-right { color: #DDD; float: right; } a[fixed] { margin-top: -3em; position: absolute; right: 1em; text-decoration: none; background-color: #555; border-radius: .5em; padding: .5em; color: #D0D0D0; text-shadow: 0px 1px 1px black; border-bottom: 1px dotted #757474; } @media (max-width: 950px) { div[footer] { padding-bottom: 5em; } } div[note] { margin-top: 1em; text-align: right; } </style> </head> <body lato> <% HtmlGlobalUtils.header(request,response); %> <div full> <div content center> <span style="display:inline-block"> <div col1 center> <h1 oswald>Free Forum Hosting & Online Web Apps!</h1> <h2 lato gray>Clean Look <span light>•</span> Embeddable <span light>•</span> Customizable</h2> <img src="/assets/images/home.png" alt="Free forum hosting and online embeddable apps"/> </div> <div col2 actions> <ul> <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("forum")%>" title="Click to create a free forum">Create Free Forum</a> <i class="fa fa-chevron-right"></i></li> <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("gallery")%>" title="Click to create a free photo gallery">Create Photo Gallery</a> <i class="fa fa-chevron-right"></i></li> <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("newspaper")%>" title="Click to create a free newspaper">Create News Site</a> <i class="fa fa-chevron-right"></i></li> <li><a href="<%=HtmlGlobalUtils.nabbleContextUrl%><%=ForumStart.path("blog")%>" title="Click to create a free blog">Create Blog</a> <i class="fa fa-chevron-right"></i></li> </ul> </div> </span> </div> <div content paddingTop> <div col33 center> <h2 oswald>Multi Language</h2> <ul floating> <li>English</li> <li>Čeština (Czech Republic)</li> <li>Español</li> <li>Français</li> <li>Polski</li> <li>Português (Brasil)</li> <li>Svenska</li> <li>Türkçe</li> <li>Русский</li> <li>Ελληνικά</li> <li>中文 (简体)</li> <li><a href="http://support.nabble.com/Nabble-Translations-f6669344.html">Translate to other languages</a> »</li> </ul> </div> <div col33 center> <h2 oswald>Embed into any Website</h2> <p lineHeight marginHorizontal>All Nabble apps are naturally embeddable, which means that they can be easily displayed inside any web page. </p> </div> <div col33 center> <h2 oswald>Fully Customizable</h2> <p lineHeight marginHorizontal>All Nabble apps are built with NAML, a scripting language that gives you full control over the app pages.</p> </div> </div> <div content center paddingTop> <h2 oswald>Browse Active Nabble Apps</h2> <% topSites(out); %> </div> </div> <% HtmlGlobalUtils.footer(request,response); %> <%/*%> <a fixed href="http://www.blasma.com">Help design a new forum <i class="fa fa-chevron-right"></i></a> <%*/%> </body> </html> <% } static BooleanQuery query = new BooleanQuery(); static { query.add(new TermQuery(new Term(Site.EMBARRASSING_FLD,"false")), BooleanClause.Occur.MUST); query.add(new TermQuery(new Term(Site.PRIVATE_FLD,"false")), BooleanClause.Occur.MUST); } private static void topSites(PrintWriter out) throws ServletException, IOException { IndexSearcher searcher; TopDocs hits; try { searcher = new IndexSearcher(Site.dir()); hits = searcher.search( query, 60, Site.SORT_BY_ACTIVITY ); } catch(IOException e) { logger.error("Index error", e); %>[Rebuilding Index]<% return; } try { %> <ul floating center> <% for( ScoreDoc sd : hits.scoreDocs ) { Site site = new Site( searcher.doc(sd.doc) ); %> <li><%=site.link()%></li> <% } %> </ul> <div style="padding-top:.5em;clear:both"> <a bold href="<%=RootForums.path()%>" title="View more active forums and apps">View More</a></b> <i class="fa fa-chevron-right"></i> </div> <% } finally { searcher.close(); } } } %>