public String getListen() { return "<span class=\"listen\" id=\"listen_" + String.valueOf(passage.getStartVerseId()) + "_" + String.valueOf(passage.getEndVerseId()) + "\"></span>"; }
public String getOutput() { boolean alt = false; StringBuilder sb = new StringBuilder(); for (BibleVerse verse : passage.getVerses()) { if (alt) sb.append("<li class=\"grey\">"); else sb.append("<li>"); sb.append( "<sup>[<a href=\"" + verse.getUrl() + "\">" + String.valueOf(verse.getVerseNumber()) + "</a>]" + verse.getBody() + "</li>"); alt = !alt; } return sb.toString(); }
public SearchBean() { HttpServletRequest hsr = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); javax.servlet.http.HttpServletResponse response = (javax.servlet.http.HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); String term = hsr.getParameter("q").trim(); if (term.length() < 1) { try { response.sendRedirect("/"); } catch (Exception ex) { } } BiblePassage passage = BiblePassage.parse(term, CachedData.getBibleBooks(), true); if (passage != null) { try { response.sendRedirect("/bible/" + passage.getUrl()); } catch (Exception ex) { } } else { if (!term.contains(" ")) { String baseWord = Topic.getBaseWord(term); Topic topic = Topic.loadByBaseWord(baseWord); if (topic != null) { try { response.sendRedirect("/topics/" + topic.getUrl()); } catch (Exception ex) { } } } else { int verseId = TextSearch.findMatch(term); passage = BiblePassage.load(verseId, verseId); passage.populateVerses(AppUser.getCurrent().TranslationId); try { response.sendRedirect("/bible/" + passage.getUrl()); } catch (Exception ex) { } } } }
public ChapterBean() { HttpServletRequest hsr = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); String url = hsr.getParameter("url").replace(".html", ""); int idx = url.lastIndexOf("-"); int chapter = Integer.parseInt(url.substring(idx + 1, url.length())); String book = url.substring(0, idx).replace("-", " "); int bookId = CachedData.getBibleBooks().getByName(book).getId(); BibleVerses verses = BibleVerses.loadByBookIdChapterNumber(bookId, chapter); passage = BiblePassage.load(verses.get(0).getId(), verses.get(verses.size() - 1).getId()); if (passage == null) { passage = new BiblePassage(); passage.setStartVerseId(verses.get(0).getId()); passage.setEndVerseId(verses.get(verses.size() - 1).getId()); passage.save(); Topics.generateForPassage( passage.getId(), passage.getStartVerseId(), passage.getEndVerseId()); } passage.populateVerses(AppUser.getCurrent().TranslationId); commentsController = new CommentsController("passage", passage.getId()); relatedTopicsController = new RelatedTopicsController("passage", passage.getId(), 5); relatedImagesController = new RelatedImagesController("passage", passage.getId(), passage.getUrl()); }
public String getPageTitle() { return "Resources for " + passage.getDisplayName().split(":")[0]; }
public String getName() { return passage.getDisplayName().split(":")[0]; }