$view->view->navigationCode = Navigation_Passage::code($bible); // Write access? $write_access = Access_Bible::write($bible); $view->view->write_access = $write_access; $chapterLoaded = Locale_Translate::_("Loaded"); $chapterSaving = Locale_Translate::_("Saving..."); $chapterRetrying = Locale_Translate::_("Retrying..."); $write_access = $write_access ? "true" : "false"; $script = <<<EOD var editorChapterLoaded = '{$chapterLoaded}'; var editorChapterSaving = '{$chapterSaving}'; var editorChapterRetrying = '{$chapterRetrying}'; var editorWriteAccess = {$write_access}; EOD; $view->view->script = $script; $class = Filter_CustomCSS::getClass($bible); $font = $database_config_bible->getTextFont($bible); $direction = $database_config_bible->getTextDirection($bible); $view->view->custom_class = $class; $view->view->custom_css = Filter_CustomCSS::getCss($class, Fonts_Logic::getFontPath($font), $direction); $view->render("index.php"); Assets_Page::footer(); /* Tests for the Bible editor: * Autosave on going to another passage. * Autosave on document unload. * Autosave shortly after any change. * Automatic reload when another user updates the chapter on the server. * Position caret at correct verse. * Scroll caret into view. */
public function customize($bible) { $database_config_bible = Database_Config_Bible::getInstance(); $class = Filter_CustomCSS::getClass($bible); $font = $database_config_bible->getTextFont($bible); $uploaded_font = Fonts_Logic::fontExists($font); $font = Fonts_Logic::getFontPath($font); $direction = $database_config_bible->getTextDirection($bible); $css = Filter_CustomCSS::getCss($class, $font, $direction); if ($uploaded_font) { $css = str_replace("../fonts/", "", $css); } $this->css[] = $css; }
$html_text_rich_book_index = new Html_Text($bibleBookText); $htmlHeader = new Html_Header($html_text_rich_book_index); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible("", $book), Locale_Translate::_("Go back to") . " " . $bibleBookText); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()), array($database_books->getEnglishFromId($book), Filter_Paths::htmlFileNameBible()))); $html_text_rich_book_index->newParagraph("navigationbar"); $html_text_rich_book_index->addText("|"); // Go through the chapters of this book. $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { // The text filter for this chapter. $filter_text_chapter = new Filter_Text($bible); $usfm = $database_bibles->getChapter($bible, $book, $chapter); $usfm = trim($usfm); // Use small chunks of USFM at a time for much better performance. $filter_text_chapter->addUsfmCode($usfm); // Interlinked web data for one chapter. $filter_text_chapter->html_text_linked = new Html_Text(Locale_Translate::_("Bible")); $filter_text_chapter->html_text_linked->customClass = Filter_CustomCSS::getClass($bible); // Create breadcrumbs for the chapter. $htmlHeader = new Html_Header($filter_text_chapter->html_text_linked); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible("", $book, $chapter), Locale_Translate::_("Go back to") . " " . $bibleBookText . " " . $chapter); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()), array($database_books->getEnglishFromId($book), Filter_Paths::htmlFileNameBible()), array($chapter, Filter_Paths::htmlFileNameBible("", $book)))); // Create interlinked html for the chapter. $filter_text_chapter->run($stylesheet); $filter_text_chapter->html_text_linked->save(Filter_Paths::htmlFileNameBible($directory, $book, $chapter)); $html_text_rich_book_index->addLink($html_text_rich_book_index->currentPDomElement, Filter_Paths::htmlFileNameBible("", $book, $chapter), "", $chapter, "", " " . $chapter . " "); $html_text_rich_book_index->addText("|"); } // Save the book index. $html_text_rich_book_index->save(Filter_Paths::htmlFileNameBible($directory, $book)); $database_logs->log(Locale_Translate::_("Exported to web") . " {$bible} " . Export_Logic::baseBookFileName($book), Filter_Roles::TRANSLATOR_LEVEL);
$database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); // Create stylesheet. $styles_sheets = new Styles_Sheets(); $styles_sheets->create($stylesheet, $filecss, false, $bible); // Copy font to the output directory. $font = $database_config_bible->getTextFont($bible); if ($font) { if (Fonts_Logic::fontExists($font)) { $fontpath = Fonts_Logic::getFontPath($font); copy($fontpath, "{$directory}/{$font}"); } } $filter_text = new Filter_Text($bible); $filter_text->html_text_standard = new Html_Text(Locale_Translate::_("Bible")); $filter_text->html_text_standard->customClass = Filter_CustomCSS::getClass($bible); // Load one book. $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { $usfm = $database_bibles->getChapter($bible, $book, $chapter); $usfm = trim($usfm); // Use small chunks of USFM at a time for much better performance. $filter_text->addUsfmCode($usfm); } // Convert the USFM. $filter_text->run($stylesheet); // Save file. $filter_text->html_text_standard->save($filename); $database_logs->log(Locale_Translate::_("Exported to html") . " {$bible} " . Export_Logic::baseBookFileName($book), Filter_Roles::TRANSLATOR_LEVEL);
public function testClass() { $class = Filter_CustomCSS::getClass("ആഈഘലറ"); $this->assertEquals("customf86528", $class); }