本文整理汇总了C++中Assets_Header::setEditorStylesheet方法的典型用法代码示例。如果您正苦于以下问题:C++ Assets_Header::setEditorStylesheet方法的具体用法?C++ Assets_Header::setEditorStylesheet怎么用?C++ Assets_Header::setEditorStylesheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assets_Header
的用法示例。
在下文中一共展示了Assets_Header::setEditorStylesheet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: editone_preview
string editone_preview (void * webserver_request)
{
Webserver_Request * request = (Webserver_Request *) webserver_request;
bool touch = request->session_logic ()->touchEnabled ();
string page;
Assets_Header header = Assets_Header (translate("Preview"), request);
header.setNavigator ();
header.setEditorStylesheet ();
if (touch) header.jQueryTouchOn ();
header.addBreadCrumb (menu_logic_translate_menu (), menu_logic_translate_text ());
header.refresh (5, "index");
page = header.run ();
Assets_View view;
// Get active Bible, and check read access to it.
// If needed, change Bible to one it has read access to.
string bible = access_bible_clamp (request, request->database_config_user()->getBible ());
string cls = Filter_Css::getClass (bible);
string font = Fonts_Logic::getTextFont (bible);
int direction = Database_Config_Bible::getTextDirection (bible);
int lineheight = Database_Config_Bible::getLineHeight (bible);
int letterspacing = Database_Config_Bible::getLetterSpacing (bible);
view.set_variable ("custom_class", cls);
view.set_variable ("custom_css", Filter_Css::getCss (cls,
Fonts_Logic::getFontPath (font),
direction,
lineheight,
letterspacing));
int book = Ipc_Focus::getBook (webserver_request);
int chapter = Ipc_Focus::getChapter (webserver_request);
//int verse = Ipc_Focus::getVerse (webserver_request);
string stylesheet = request->database_config_user()->getStylesheet ();
string usfm = request->database_bibles()->getChapter (bible, book, chapter);
Editor_Usfm2Html editor_usfm2html;
editor_usfm2html.load (usfm);
editor_usfm2html.stylesheet (stylesheet);
editor_usfm2html.run ();
string html = editor_usfm2html.get ();
view.set_variable ("html", html);
page += view.render ("editone", "preview");
page += Assets_Page::footer ();
return page;
}
示例2: editone_index
string editone_index (void * webserver_request)
{
Webserver_Request * request = (Webserver_Request *) webserver_request;
bool touch = request->session_logic ()->touchEnabled ();
if (request->query.count ("switchbook") && request->query.count ("switchchapter")) {
int switchbook = convert_to_int (request->query ["switchbook"]);
int switchchapter = convert_to_int (request->query ["switchchapter"]);
Ipc_Focus::set (request, switchbook, switchchapter, 1);
Navigation_Passage::recordHistory (request, switchbook, switchchapter, 1);
}
string page;
Assets_Header header = Assets_Header (translate("Edit verse"), request);
header.setNavigator ();
header.setEditorStylesheet ();
if (touch) header.jQueryTouchOn ();
header.notifItOn ();
header.addBreadCrumb (menu_logic_translate_menu (), menu_logic_translate_text ());
page = header.run ();
Assets_View view;
if (request->query.count ("changebible")) {
string changebible = request->query ["changebible"];
if (changebible == "") {
Dialog_List dialog_list = Dialog_List ("index", translate("Select which Bible to open in the editor"), "", "");
vector <string> bibles = access_bible_bibles (request);
for (auto bible : bibles) {
dialog_list.add_row (bible, "changebible", bible);
}
page += dialog_list.run();
return page;
} else {
request->database_config_user()->setBible (changebible);
}
}
// Get active Bible, and check read access to it.
// If needed, change Bible to one it has read access to.
string bible = access_bible_clamp (request, request->database_config_user()->getBible ());
if (request->query.count ("bible")) bible = access_bible_clamp (request, request->query ["bible"]);
view.set_variable ("bible", bible);
// Store the active Bible in the page's javascript.
view.set_variable ("navigationCode", Navigation_Passage::code (bible));
string chapterLoaded = locale_logic_text_loaded ();
string chapterSaving = locale_logic_text_saving ();
string chapterSaved = locale_logic_text_saved ();
string chapterRetrying = locale_logic_text_retrying ();
int verticalCaretPosition = request->database_config_user ()->getVerticalCaretPosition ();
string script =
"var oneverseEditorVerseLoaded = '" + chapterLoaded + "';\n"
"var oneverseEditorVerseSaving = '" + chapterSaving + "';\n"
"var oneverseEditorVerseSaved = '" + chapterSaved + "';\n"
"var oneverseEditorVerseRetrying = '" + chapterRetrying + "';\n"
"var oneverseEditorWriteAccess = true;"
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n"
"var unsentBibleDataTimeoutWarning = '" + bible_logic_unsent_unreceived_data_warning (false) + "';\n";
config_logic_swipe_enabled (webserver_request, script);
view.set_variable ("script", script);
string cls = Filter_Css::getClass (bible);
string font = Fonts_Logic::getTextFont (bible);
int direction = Database_Config_Bible::getTextDirection (bible);
int lineheight = Database_Config_Bible::getLineHeight (bible);
int letterspacing = Database_Config_Bible::getLetterSpacing (bible);
view.set_variable ("custom_class", cls);
view.set_variable ("custom_css", Filter_Css::getCss (cls,
Fonts_Logic::getFontPath (font),
direction,
lineheight,
letterspacing));
// Whether to enable fast Bible editor switching.
if (request->database_config_user ()->getFastEditorSwitchingAvailable ()) {
view.enable_zone ("fastswitcheditor");
}
// Whether to enable the styles button.
if (request->database_config_user ()->getEnableStylesButtonVisualEditors ()) {
view.enable_zone ("stylesbutton");
}
page += view.render ("editone", "index");
page += Assets_Page::footer ();
return page;
}
示例3: edit_index
string edit_index (void * webserver_request)
{
Webserver_Request * request = (Webserver_Request *) webserver_request;
bool touch = request->session_logic ()->touchEnabled ();
if (request->query.count ("switchbook") && request->query.count ("switchchapter")) {
int switchbook = convert_to_int (request->query ["switchbook"]);
int switchchapter = convert_to_int (request->query ["switchchapter"]);
int switchverse = 1;
if (request->query.count ("switchverse")) switchverse = convert_to_int (request->query ["switchverse"]);
Ipc_Focus::set (request, switchbook, switchchapter, switchverse);
Navigation_Passage::recordHistory (request, switchbook, switchchapter, switchverse);
}
string page;
Assets_Header header = Assets_Header (translate("Edit"), request);
header.setNavigator ();
header.setEditorStylesheet ();
if (touch) header.jQueryTouchOn ();
header.notifItOn ();
header.addBreadCrumb (menu_logic_translate_menu (), menu_logic_translate_text ());
page = header.run ();
if (request->query.count ("changebible")) {
string changebible = request->query ["changebible"];
if (changebible == "") {
Dialog_List dialog_list = Dialog_List ("index", translate("Select which Bible to open in the editor"), "", "");
vector <string> bibles = access_bible_bibles (request);
for (auto & bible : bibles) {
dialog_list.add_row (bible, "changebible", bible);
}
page += dialog_list.run();
return page;
} else {
request->database_config_user()->setBible (changebible);
// Going to another Bible, ensure that the focused book exists there.
int book = Ipc_Focus::getBook (request);
vector <int> books = request->database_bibles()->getBooks (changebible);
if (find (books.begin(), books.end(), book) == books.end()) {
if (!books.empty ()) book = books [0];
else book = 0;
Ipc_Focus::set (request, book, 1, 1);
}
}
}
Assets_View view;
// Active Bible, and check access.
string bible = access_bible_clamp (request, request->database_config_user()->getBible ());
if (request->query.count ("bible")) bible = access_bible_clamp (request, request->query ["bible"]);
view.set_variable ("bible", bible);
// Store the active Bible in the page's javascript.
view.set_variable ("navigationCode", Navigation_Passage::code (bible));
int verticalCaretPosition = request->database_config_user ()->getVerticalCaretPosition ();
string script =
"var editorChapterLoaded = '" + locale_logic_text_loaded () + "';\n"
"var editorChapterSaving = '" + locale_logic_text_saving () + "';\n"
"var editorChapterSaved = '" + locale_logic_text_saved () + "';\n"
"var editorChapterRetrying = '" + locale_logic_text_retrying () + "';\n"
"var editorChapterReformat = '" + locale_logic_text_reformat () + "';\n"
"var editorWriteAccess = true;\n"
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n"
"var unsentBibleDataTimeoutWarning = '" + bible_logic_unsent_unreceived_data_warning (false) + "';\n";
config_logic_swipe_enabled (webserver_request, script);
view.set_variable ("script", script);
string clss = Filter_Css::getClass (bible);
string font = Fonts_Logic::getTextFont (bible);
int direction = Database_Config_Bible::getTextDirection (bible);
int lineheight = Database_Config_Bible::getLineHeight (bible);
int letterspacing = Database_Config_Bible::getLetterSpacing (bible);
view.set_variable ("custom_class", clss);
view.set_variable ("custom_css", Filter_Css::getCss (clss,
Fonts_Logic::getFontPath (font),
direction,
lineheight,
letterspacing));
// In basic mode the editor has no controls and fewer indicators.
// In basic mode, the user can just edit text, and cannot style it.
bool basic_mode = config_logic_basic_mode (webserver_request);
if (!basic_mode) view.enable_zone ("advancedmode");
//.........这里部分代码省略.........