Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Jul 11, 2020
1 parent 1d9ad23 commit d40821e
Show file tree
Hide file tree
Showing 36 changed files with 2,397 additions and 1,424 deletions.
4 changes: 2 additions & 2 deletions package.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C414BE13-5F10-48B7-AF92-9E4E7265D720}
AppName=Bibledit
AppVersion=5.0.891
AppVersion=5.0.901
AppPublisher=Teus Benschop
AppPublisherURL=http://bibledit.org
AppSupportURL=http://bibledit.org
Expand All @@ -19,7 +19,7 @@ DisableDirPage=yes
DefaultGroupName=Bibledit
LicenseFile=COPYING
; OutputDir=C:\bibledit-windows-packager
OutputBaseFilename=bibledit-5.0.891
OutputBaseFilename=bibledit-5.0.901
Compression=lzma
SolidCompression=yes
; Create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process.
Expand Down
2 changes: 1 addition & 1 deletion server/assets/xhtml_start.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
##head_lines##
<title>##title##</title>
<link rel="stylesheet" type="text/css" href="/css/stylesheet.css?##VERSION##">
<script type="text/javascript" src="/jquery/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="/jquery/jquery-3.5.1.min.js"></script>
<!-- #BEGINZONE include_jquery_touch -->
<script type="text/javascript" src="/jquery/jquery.touchSwipe.min.js"></script>
<!-- #ENDZONE include_jquery_touch -->
Expand Down
81 changes: 62 additions & 19 deletions server/bb/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,37 +431,78 @@ void bible_logic_merge_irregularity_mail (vector <string> users, vector <Merge_C
xml_node node;
node = document.append_child ("h3");
node.text ().set (conflict.subject.c_str());


// Storage of the changes the user sent, and the result that was saved, in raw USFM, per verse.
vector <string> change_usfm;
vector <string> result_usfm;

// Go through all verses available in the USFM,
// and make a record for each verse,
// where the USFM differs between the change that the user made and the result that was saved.
vector <int> verses = usfm_get_verse_numbers (conflict.result);
for (auto verse : verses) {
string change = usfm_get_verse_text (conflict.change, verse);
string result = usfm_get_verse_text (conflict.result, verse);
// When there's no change in the verse, skip it.
if (change == result) continue;
// Record the difference.
change_usfm.push_back (change);
result_usfm.push_back (result);
}

// Add some information for the user.
node = document.append_child ("p");
node.text ().set ("While merging the text, something unusual was detected.");
node.text ().set ("You sent changes to the Cloud. The Cloud crossed the parts below out, and replaced it with the bold text below.");

// Go over each verse where the change differs from the resulting text that was saved.
// For each verse, outline the difference between the change and the result.
// Clearly maark it up for the user.
// The purpose is that the user immediately can see what happened,
// and whether and how to correct it.
for (size_t i = 0; i < change_usfm.size(); i++) {
node = document.append_child ("p");
string modification = filter_diff_diff (change_usfm[i], result_usfm[i]);
// Add raw html to the email's text buffer.
node.append_buffer (modification.c_str (), modification.size ());
}

// Add the base text.
// Add some information for the user.
document.append_child ("hr");
document.append_child ("br");
node = document.append_child ("p");
node.text ().set ("Base text");
node = document.append_child ("pre");
document.append_child ("br");
xml_node div_node;
div_node = document.append_child ("div");
div_node.append_attribute ("style") = "font-size: xx-small";

node = div_node.append_child ("p");
node.text ().set ("Here are some details.");

// Add the base text.
div_node.append_child ("br");
node = div_node.append_child ("p");
node.text ().set ("Base text loaded in your editor");
node = div_node.append_child ("pre");
node.text ().set (conflict.base.c_str ());

// Add the changed text.
document.append_child ("br");
node = document.append_child ("p");
node.text ().set ("Changed text");
node = document.append_child ("pre");
div_node.append_child ("br");
node = div_node.append_child ("p");
node.text ().set ("Changed text by you");
node = div_node.append_child ("pre");
node.text ().set (conflict.change.c_str ());

// Add the existing text.
document.append_child ("br");
node = document.append_child ("p");
node.text ().set ("Existing text");
node = document.append_child ("pre");
div_node.append_child ("br");
node = div_node.append_child ("p");
node.text ().set ("Existing text in the Cloud");
node = div_node.append_child ("pre");
node.text ().set (conflict.prioritized_change.c_str ());

// Add the merge result.
document.append_child ("br");
node = document.append_child ("p");
node.text ().set ("The text that was actually saved to the chapter");
node = document.append_child ("pre");
div_node.append_child ("br");
node = div_node.append_child ("p");
node.text ().set ("The text that was actually saved to the chapter in the Cloud");
node = div_node.append_child ("pre");
node.text ().set (conflict.result.c_str ());

// Convert the document to a string.
Expand Down Expand Up @@ -512,7 +553,9 @@ void bible_logic_unsafe_save_mail (const string & message, const string & explan
// if the USFM received from the client
// does not match the USFM that gets stored on the server.
void bible_logic_client_receive_merge_mail (const string & bible, int book, int chapter, const string & user,
const string & client_old, const string & client_new, const string & server)
const string & client_old,
const string & client_new,
const string & server)
{
// No difference: Done.
if (client_old == server) return;
Expand Down
4 changes: 3 additions & 1 deletion server/bb/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ void bible_logic_merge_irregularity_mail (vector <string> users,
vector <Merge_Conflict> conflicts);
void bible_logic_unsafe_save_mail (const string & message, const string & explanation, const string & user, const string & usfm);
void bible_logic_client_receive_merge_mail (const string & bible, int book, int chapter, const string & user,
const string & client_old, const string & client_new, const string & server);
const string & client_old,
const string & client_new,
const string & server);
void bible_logic_client_mail_pending_bible_updates (string user);
void bible_logic_client_no_write_access_mail (const string & bible, int book, int chapter, const string & user,
const string & oldusfm, const string & newusfm);
Expand Down
6 changes: 0 additions & 6 deletions server/bootstrap/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <bb/css.h>
#include <compare/index.h>
#include <jobs/index.h>
#include <editverse/index.h>
#include <navigation/update.h>
#include <navigation/poll.h>
#include <editusfm/index.h>
Expand Down Expand Up @@ -371,11 +370,6 @@ void bootstrap_index (void * webserver_request)
return;
}

if ((url == editverse_index_url ()) && browser_request_security_okay (request) && editverse_index_acl (request)) {
request->reply = editverse_index (request);
return;
}

if ((url == editone_index_url ()) && browser_request_security_okay (request) && editone_index_acl (request)) {
request->reply = editone_index (request);
return;
Expand Down
6 changes: 3 additions & 3 deletions server/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#define PACKAGE_PREFIX_DIR "NONE"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "bibledit 5.0.891"
#define PACKAGE_STRING "bibledit 5.0.901"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bibledit"
Expand All @@ -93,13 +93,13 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "5.0.891"
#define PACKAGE_VERSION "5.0.901"

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "5.0.891"
#define VERSION "5.0.901"

/* Define whether to compile on Windows */
#define WIN32 1
10 changes: 5 additions & 5 deletions server/dtl/Diff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ namespace dtl {
* print differences given an SES
*/
template < typename stream >
static void printSES (const Ses< elem >& s, stream& out) {
void printSES (const Ses< elem >& s, stream& out) {
sesElemVec ses_v = s.getSequence();
for_each(ses_v.begin(), ses_v.end(), ChangePrinter< sesElem, stream >(out));
}

static void printSES (const Ses< elem >& s, ostream& out = cout) {
void printSES (const Ses< elem >& s, ostream& out = cout) {
printSES< ostream >(s, out);
}

Expand Down Expand Up @@ -357,11 +357,11 @@ namespace dtl {
* print unified format difference with given unified format hunks
*/
template < typename stream >
static void printUnifiedFormat (const uniHunkVec& hunks, stream& out) {
void printUnifiedFormat (const uniHunkVec& hunks, stream& out) {
for_each(hunks.begin(), hunks.end(), UniHunkPrinter< sesElem >(out));
}

static void printUnifiedFormat (const uniHunkVec& hunks, ostream& out = cout) {
void printUnifiedFormat (const uniHunkVec& hunks, ostream& out = cout) {
printUnifiedFormat< ostream >(hunks, out);
}

Expand Down Expand Up @@ -504,7 +504,7 @@ namespace dtl {
* compose ses from stream
*/
template <typename stream>
static Ses< elem > composeSesFromStream (stream& st)
Ses< elem > composeSesFromStream (stream& st)
{
elem line;
Ses< elem > ret;
Expand Down
3 changes: 1 addition & 2 deletions server/edit/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ string edit_index (void * webserver_request)
"var editorChapterRetrying = '" + locale_logic_text_retrying () + "';\n"
"var editorChapterReformat = '" + locale_logic_text_reformat () + "';\n"
"var editorChapterVerseUpdatedLoaded = '" + locale_logic_text_reload () + "';\n"
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n"
"var editorForceReadOnly = " + convert_to_true_false (request->query.count (workspace_query_key_readonly ())) + ";\n";
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n";
config_logic_swipe_enabled (webserver_request, script);
view.set_variable ("script", script);

Expand Down
14 changes: 11 additions & 3 deletions server/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ function editorLoadChapter (reload)
success: function (response) {
// Set the editor read-write or read-only.
editorWriteAccess = checksum_readwrite (response);
if (editorForceReadOnly) editorWriteAccess = false;
// If this is the second or third or higher editor in the workspace,
// make the editor read-only.
if (window.frameElement) {
iframe = $(window.frameElement);
var data_editor_number = iframe.attr("data-editor-no");
if (data_editor_number > 1) {
editorWriteAccess = false;
}
}
// Checksumming.
response = checksum_receive (response);
if (response !== false) {
Expand Down Expand Up @@ -295,7 +303,7 @@ function editorGetHtml ()

/*
Portion dealing with triggers for editor's content change.
Portion dealing with triggers for when the editor's content changes.
*/

Expand Down Expand Up @@ -661,7 +669,7 @@ function editorScrollVerseIntoView ()
var bounds = quill.getBounds (position);
var workspaceHeight = $("#workspacewrapper").height();
var currentScrollTop = $("#workspacewrapper").scrollTop();
var scrollTo = bounds.top - (workspaceHeight / 2);
var scrollTo = bounds.top - (workspaceHeight * verticalCaretPosition / 100);
scrollTo = parseInt (scrollTo);
var lowerBoundary = currentScrollTop - (workspaceHeight / 10);
var upperBoundary = currentScrollTop + (workspaceHeight / 10);
Expand Down
3 changes: 1 addition & 2 deletions server/editone/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ string editone_index (void * webserver_request)
"var oneverseEditorVerseSaved = '" + locale_logic_text_saved () + "';\n"
"var oneverseEditorVerseRetrying = '" + locale_logic_text_retrying () + "';\n"
"var oneverseEditorVerseUpdatedLoaded = '" + locale_logic_text_reload () + "';\n"
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n"
"var oneverseForceReadOnly = " + convert_to_true_false (request->query.count (workspace_query_key_readonly ())) + ";\n";
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n";
config_logic_swipe_enabled (webserver_request, script);
view.set_variable ("script", script);

Expand Down
33 changes: 20 additions & 13 deletions server/editone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ $ (document).ready (function ()
}

$ ("#oneeditor").on ("click", oneEditorNoteCitationClicked);

});


Expand Down Expand Up @@ -119,8 +120,8 @@ var oneverseSaveAsync;
var oneverseLoadAjaxRequest;
var oneverseSaving = false;
var oneverseEditorWriteAccess = true;
var oneverseEditorLoadDate = new Date(0);
var oneverseEditorSaveDate = new Date(0);
var oneverseEditorLoadDate = {};
var oneverseEditorSaveDate = {};


//
Expand Down Expand Up @@ -170,7 +171,7 @@ function oneverseEditorLoadVerse ()
} else {
oneverseReloadPosition = undefined;
// When saving and immediately going to another verse, do not give an alert.
oneverseEditorSaveDate = new Date(0);
oneverseEditorSaveDate[oneverseVerseLoading] = new Date(0);
}
if (oneverseLoadAjaxRequest && oneverseLoadAjaxRequest.readystate != 4) {
oneverseLoadAjaxRequest.abort();
Expand All @@ -182,7 +183,15 @@ function oneverseEditorLoadVerse ()
success: function (response) {
// Flag for editor read-write or read-only.
oneverseEditorWriteAccess = checksum_readwrite (response);
if (oneverseForceReadOnly) oneverseEditorWriteAccess = false;
// If this is the second or third or higher editor in the workspace,
// make the editor read-only.
if (window.frameElement) {
iframe = $(window.frameElement);
var data_editor_number = iframe.attr("data-editor-no");
if (data_editor_number > 1) {
oneverseEditorWriteAccess = false;
}
}
// Checksumming.
response = checksum_receive (response);
// Splitting.
Expand Down Expand Up @@ -224,10 +233,12 @@ function oneverseEditorLoadVerse ()
oneverseScrollVerseIntoView ();
oneversePositionCaret ();
// https://github.com/bibledit/cloud/issues/346
oneverseEditorLoadDate = new Date();
var seconds = (oneverseEditorLoadDate.getTime() - oneverseEditorSaveDate.getTime()) / 1000;
if ((seconds < 2) | oneverseReloadFlag) {
if (oneverseEditorWriteAccess) alert (oneverseEditorVerseUpdatedLoaded);
oneverseEditorLoadDate[oneverseVerseLoading] = new Date();
if (oneverseVerseLoading in oneverseEditorSaveDate) {
var seconds = (oneverseEditorLoadDate[oneverseVerseLoading].getTime() - oneverseEditorSaveDate[oneverseVerseLoading].getTime()) / 1000;
if ((seconds < 2) | oneverseReloadFlag) {
if (oneverseEditorWriteAccess) alert (oneverseEditorVerseUpdatedLoaded);
}
}
oneverseReloadFlag = false;
}
Expand Down Expand Up @@ -286,11 +297,7 @@ function oneverseEditorSaveVerse (sync)
complete: function (xhr, status) {
oneverseSaveAsync = true;
oneverseSaving = false;
oneverseEditorSaveDate = new Date();
var seconds = (oneverseEditorSaveDate.getTime() - oneverseEditorLoadDate.getTime()) / 1000;
if (seconds < 2) {
if (oneverseEditorWriteAccess) alert (oneverseEditorVerseUpdatedLoaded);
}
oneverseEditorSaveDate [oneverseVerseLoaded] = new Date();
}
});
}
Expand Down
1 change: 0 additions & 1 deletion server/editor/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <edit/index.h>
#include <editone/index.h>
#include <editusfm/index.h>
#include <editverse/index.h>


string editor_select_url ()
Expand Down
3 changes: 1 addition & 2 deletions server/editusfm/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ string editusfm_index (void * webserver_request)
"var usfmEditorChapterRetrying = \"" + locale_logic_text_retrying () + "\";\n"
"var usfmEditorVerseUpdatedLoaded = '" + locale_logic_text_reload () + "';\n"
"var usfmEditorWriteAccess = true;\n"
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n"
"var usfmForceReadOnly = " + convert_to_true_false (request->query.count (workspace_query_key_readonly ())) + ";\n";
"var verticalCaretPosition = " + convert_to_string (verticalCaretPosition) + ";\n";
config_logic_swipe_enabled (webserver_request, script);
view.set_variable ("script", script);

Expand Down
Loading

0 comments on commit d40821e

Please sign in to comment.