aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/bookmarksTB.pngbin0 -> 3316 bytes
-rw-r--r--assets/highlightsTB.pngbin0 -> 4335 bytes
-rw-r--r--assets/notesTB.pngbin0 -> 1926 bytes
-rw-r--r--assets/notesTB2.png (renamed from assets/notes2.png)bin3763 -> 3763 bytes
-rw-r--r--source/App.css16
-rw-r--r--source/App.js28
-rw-r--r--source/api.js38
-rw-r--r--source/dataView.js103
-rw-r--r--source/main.js46
-rw-r--r--source/package.js1
10 files changed, 209 insertions, 23 deletions
diff --git a/assets/bookmarksTB.png b/assets/bookmarksTB.png
new file mode 100644
index 0000000..53d5153
--- /dev/null
+++ b/assets/bookmarksTB.png
Binary files differ
diff --git a/assets/highlightsTB.png b/assets/highlightsTB.png
new file mode 100644
index 0000000..fafd4f6
--- /dev/null
+++ b/assets/highlightsTB.png
Binary files differ
diff --git a/assets/notesTB.png b/assets/notesTB.png
new file mode 100644
index 0000000..7532b0e
--- /dev/null
+++ b/assets/notesTB.png
Binary files differ
diff --git a/assets/notes2.png b/assets/notesTB2.png
index 0d00a1c..0d00a1c 100644
--- a/assets/notes2.png
+++ b/assets/notesTB2.png
Binary files differ
diff --git a/source/App.css b/source/App.css
index 0c4a1fb..20fa076 100644
--- a/source/App.css
+++ b/source/App.css
@@ -223,6 +223,22 @@ h3, h1 {
max-width: 300px;
}
+/* DATA VIEW */
+.data-view-back {
+ position: absolute;
+ left: 0;
+ margin: 8px 2px 1px;
+}
+
+.data-view-button.active {
+ border: 2px solid;
+ border-radius: 5px;
+}
+
+.item-text {
+ font-size: 0.9em;
+}
+
/* OVERRIDE SOME ONYX SETTINGS */
.onyx-toolbar {
padding: 5px;
diff --git a/source/App.js b/source/App.js
index f324232..1f98230 100644
--- a/source/App.js
+++ b/source/App.js
@@ -11,12 +11,20 @@ enyo.kind({
fit: true,
components: [
{name: "panel", kind: "Panels", fit: true, animate: false, classes: "app-panels", arrangerKind: "CardArranger", draggable: false, onTransitionFinish: "handlePanels", components: [
- {name: "main", kind: "biblez.main", onOpenModuleManager: "openModuleManager", onOpenBC: "openSelector", onModuleChanged: "handleChangeModule", onOpenPreferences: "openPreferences", onOpenNotes: "openNotes"},
+ {name: "main", kind: "biblez.main",
+ onOpenModuleManager: "openModuleManager",
+ onOpenBC: "openSelector",
+ onModuleChanged: "handleChangeModule",
+ onOpenPreferences: "openPreferences",
+ onOpenNotes: "openNotes",
+ onOpenDataView: "openDataView"
+ },
{name: "moduleManager", kind: "biblez.moduleManager", onBack: "handleBack", onInstalled: "handleInstalledModule"},
{name: "bcSelector", kind: "biblez.bcSelector", onSelect: "handlePassageSelect", onBack: "handleBack"},
{name: "moduleManagerDesktop", kind: "biblez.moduleManagerDesktop", onBack: "handleBack", onInstalled: "handleInstalledModule"},
{name: "settings", kind: "biblez.settings", onBack: "handleBack", onChange: "handleSettings"},
- {name: "notes", kind: "biblez.notes", onBack: "handleBack", onChange: "handleNote"}
+ {name: "notes", kind: "biblez.notes", onBack: "handleBack", onChange: "handleNote"},
+ {name: "dataView", kind: "biblez.dataView", onBack: "handleBack", onVerse: "handleVerse"}
]}
],
@@ -46,8 +54,11 @@ enyo.kind({
openModuleManager: function (inSender, inEvent) {
if(enyo.platform.firefox)
this.$.panel.setIndex(3);
- else
+ else {
this.$.panel.setIndex(1);
+ this.$.moduleManager.start();
+ }
+
return true;
},
@@ -87,6 +98,17 @@ enyo.kind({
handleNote: function (inSender, inEvent) {
this.$.main.handleNote(inSender, inEvent);
return true;
+ },
+
+ openDataView: function (inSender, inEvent) {
+ this.$.dataView.setSection(inEvent.section);
+ this.$.panel.setIndex(6);
+ },
+
+ handleVerse: function (inSender, inEvent) {
+ this.$.main.handlePassage(inEvent.osisRef);
+ this.$.panel.setIndex(0);
+ return true;
}
});
diff --git a/source/api.js b/source/api.js
index 832114c..fdd9e22 100644
--- a/source/api.js
+++ b/source/api.js
@@ -42,7 +42,10 @@ var api = {
storeName: "bookmarks",
keyPath: 'id',
autoIncrement: true,
- dbVersion: 1,
+ dbVersion: 2,
+ indexes: [
+ {name: "osisRef", keyPath: "osisRef", unique: true}
+ ],
onStoreReady: function() {
//console.log("isInitialized", self.isInitialized);
self.isBmInitialized = true;
@@ -66,7 +69,10 @@ var api = {
storeName: "highlights",
keyPath: 'id',
autoIncrement: true,
- dbVersion: 1,
+ dbVersion: 2,
+ indexes: [
+ {name: "osisRef", keyPath: "osisRef", unique: true}
+ ],
onStoreReady: function() {
self.isHlInitialized = true;
if(inCallback) inCallback(null, self.hlStore);
@@ -89,7 +95,10 @@ var api = {
storeName: "notes",
keyPath: 'id',
autoIncrement: true,
- dbVersion: 1,
+ dbVersion: 2,
+ indexes: [
+ {name: "osisRef", keyPath: "osisRef", unique: true}
+ ],
onStoreReady: function() {
self.isNoteInitialized = true;
if(inCallback) inCallback(null, self.noteStore);
@@ -232,6 +241,13 @@ var api = {
);
},
+ _query: function(inDB, inOptions, inCallback) {
+ //inOptions["onError"] = function (inError) {inCallback(inError);};
+ inDB.query(function (inResults) {
+ inCallback(null, inResults);
+ }, inOptions);
+ },
+
get: function (inId, inCallback) {
this.wrapper(enyo.bind(this, function (inError, inDB) {
if(!inError) this._get(inDB, inId, inCallback);
@@ -255,7 +271,7 @@ var api = {
getAllBookmarks: function (inCallback) {
this.bmWrapper(enyo.bind(this, function (inError, inDB) {
- if(!inError) this._getAll(inDB, inCallback);
+ if(!inError) this._query(inDB, {index: "osisRef"}, inCallback);
else inCallback(inError);
}));
},
@@ -267,6 +283,13 @@ var api = {
}));
},
+ getAllHighlights: function (inCallback) {
+ this.hlWrapper(enyo.bind(this, function (inError, inDB) {
+ if(!inError) this._query(inDB, {index: "osisRef"}, inCallback);
+ else inCallback(inError);
+ }));
+ },
+
getNote: function (inId, inCallback) {
this.noteWrapper(enyo.bind(this, function (inError, inDB) {
if(!inError) this._get(inDB, inId, inCallback);
@@ -281,6 +304,13 @@ var api = {
}));
},
+ getAllNotes: function (inCallback) {
+ this.noteWrapper(enyo.bind(this, function (inError, inDB) {
+ if(!inError) this._query(inDB, {index: "osisRef"}, inCallback);
+ else inCallback(inError);
+ }));
+ },
+
getUserData: function(inOsis, inVMax, inCallback) {
var z=1,
userData = {};
diff --git a/source/dataView.js b/source/dataView.js
new file mode 100644
index 0000000..03995ae
--- /dev/null
+++ b/source/dataView.js
@@ -0,0 +1,103 @@
+enyo.kind({
+ name: "biblez.dataView",
+ kind: "enyo.FittableRows",
+ fit: true,
+ events: {
+ onBack: "",
+ onVerse: ""
+ },
+ published: {
+ section: ""
+ },
+ components: [
+ {name: "messagePopup", kind: "onyx.Popup", centered: true, floating: true, classes: "message-popup"},
+ {kind: "onyx.MoreToolbar", layoutKind:"FittableColumnsLayout", components: [
+ {kind: "onyx.IconButton", src: "assets/back.png", ontap: "handleBack"},
+ {kind: "onyx.RadioGroup", onActivate:"sectionActivated", classes: "center", fit: true, defaultKind: "onyx.IconButton", components: [
+ {name: "rbBm", src: "assets/bookmarksTB.png", section: "bookmarks", style: "margin: 0 10px;"},
+ {name: "rbNotes", src: "assets/notesTB.png", section: "notes", style: "margin: 0 10px;"},
+ {name: "rbHl", src: "assets/highlightsTB.png", section: "highlights", style: "margin: 0 10px;"}
+ ]},
+ ]},
+ {name: "dataList", kind: "List", fit: true, touch: true, onSetupItem: "setupItem", components: [
+ {name: "item", classes: "item", ontap: "handleListTap", components: [
+ {kind: "enyo.FittableRows", components: [
+ {name: "itemOsis", classes: ""},
+ {name: "itemText", classes: "item-text", allowHtml: true}
+ ]}
+ ]}
+ ]}
+ ],
+
+ data: [],
+
+ sectionActivated: function (inSender, inEvent) {
+ if (inEvent.originator.getActive()) {
+ this.section = inEvent.originator.section;
+ this.sectionChanged();
+ }
+ },
+
+ sectionChanged: function (inSender, inEvent) {
+ if (this.section === "bookmarks") {
+ this.$.rbBm.setActive(true);
+ api.getAllBookmarks(enyo.bind(this, function (inError, inData) {
+ if(!inError) {
+ this.data = inData;
+ this.$.dataList.setCount(this.data.length);
+ this.$.dataList.refresh();
+ } else
+ this.handleError(inError);
+ }));
+ } else if (this.section === "notes") {
+ this.$.rbNotes.setActive(true);
+ api.getAllNotes(enyo.bind(this, function (inError, inData) {
+ if(!inError) {
+ this.data = inData;
+ this.$.dataList.setCount(this.data.length);
+ this.$.dataList.refresh();
+ } else
+ this.handleError(inError);
+ }));
+ } else if (this.section === "highlights") {
+ this.$.rbHl.setActive(true);
+ api.getAllHighlights(enyo.bind(this, function (inError, inData) {
+ if(!inError) {
+ this.data = inData;
+ this.$.dataList.setCount(this.data.length);
+ this.$.dataList.refresh();
+ } else
+ this.handleError(inError);
+ }));
+ }
+ },
+
+ setupItem: function(inSender, inEvent) {
+ var data = this.data[inEvent.index];
+ this.$.itemOsis.setContent(api.formatOsis(data.osisRef));
+ if(this.section === "highlights")
+ this.$.item.applyStyle("background-color", data.color);
+ else
+ this.$.item.applyStyle("background-color", null);
+ if(this.section === "notes")
+ this.$.itemText.setContent(data.text);
+ else
+ this.$.itemText.setContent("");
+ //this.$.index.setContent(inEvent.index);
+ },
+
+ handleListTap: function (inSender, inEvent) {
+ this.doVerse({osisRef: this.data[inEvent.index].osisRef});
+ },
+
+ handleBack: function() {
+ this.doBack();
+ },
+
+ handleError: function (inMessage) {
+ if (inMessage.message)
+ inMessage = inMessage.message;
+ this.$.messagePopup.setContent(inMessage);
+ this.$.messagePopup.show();
+ }
+}); \ No newline at end of file
diff --git a/source/main.js b/source/main.js
index f0cd675..26d7f7f 100644
--- a/source/main.js
+++ b/source/main.js
@@ -7,7 +7,8 @@ enyo.kind({
onOpenPreferences: "",
onModuleChanged: "",
onOpenBC: "",
- onOpenNotes: ""
+ onOpenNotes: "",
+ onOpenDataView: ""
},
published: {
passage: ""
@@ -22,9 +23,8 @@ enyo.kind({
{name: "bcPopup", classes: "biblez-bc-popup", kind: "onyx.Popup", modal: true, floating: true, components: [
{kind: "biblez.bcSelector", name: "bcSelector", onSelect: "passageChanged", onBack: "closePopup"}
]},
- {kind: "onyx.MoreToolbar", name: "topTB", components: [
+ {kind: "onyx.MoreToolbar", showing: false, name: "topTB", components: [
{name: "moduleSelector", kind: "onyx.MenuDecorator", onSelect: "moduleSelected", components: [
- //{kind: "onyx.IconButton", src: "assets/modules.png"},
{kind: "onyx.Button", name: "btnModules", classes: "tb-button", style: "background-color: #934A15;"},
{kind: "onyx.Menu", name: "moduleMenu"}
]},
@@ -56,14 +56,14 @@ enyo.kind({
]}
]}
]},
- {kind: "onyx.IconButton", src: "assets/font.png", ontap: "handleFontMenu", style:"position:absolute; right:0;"},
+ {name: "btFont", kind: "onyx.IconButton", src: "assets/font.png", ontap: "handleFontMenu", style:"position:absolute; right:0;"},
//{name: "btnPrefs", kind:"onyx.IconButton", src: "assets/settings.png", ontap: "handlePrefs"},
//{name: "plus", kind: "onyx.IconButton", src: "assets/add.png", style:"position:absolute;right:0;", ontap: "doOpenModuleManager"},
/*{kind: "onyx.InputDecorator", components: [
{kind: "onyx.Input", placeholder: "Enter a passage...", onchange: "handlePassage", name: "passageInput", value: "Matt 1"}
]}*/
]},
- {name: "mainPanel", kind: "Panels", fit: true, ondragfinish: "handleChangeChapter", onTransitionStart: "handlePanelIndex", arrangerKind: "LeftRightArranger", margin: 0, classes: "background", components: [
+ {name: "mainPanel", kind: "Panels", fit: true, animate: false, ondragfinish: "handleChangeChapter", onTransitionStart: "handlePanelIndex", arrangerKind: "LeftRightArranger", margin: 0, classes: "background", components: [
{},
{kind: "FittableColumns", noStretch: true, components: [
{fit: true},
@@ -78,6 +78,10 @@ enyo.kind({
{fit: true}
]},
{},
+ {name: "firstStart", classes: "center", style: "margin-top: 100px;", components: [
+ {content: $L("You have no modules installed. Open the Module Manager to install one."), style: "font-weight: bold; margin-bottom: 20px;"},
+ {kind: "onyx.Button", classes: "onyx-affirmative", content: $L("Open Module Manager"), ontap: "doOpenModuleManager"}
+ ]}
]},
],
@@ -138,14 +142,15 @@ enyo.kind({
sword.moduleMgr.getModules(enyo.bind(this, function(inError, inModules) {
if (!inError) {
if(inModules.length !== 0) {
- this.$.moduleSelector.show();
- this.$.btnPassage.show();
+ this.$.mainPanel.setIndex(2);
+ this.$.mainPanel.draggable = true;
+ this.$.topTB.show();
this.modules = inModules;
this.renderModuleMenu(this.modules);
} else {
- this.$.moduleSelector.hide();
- this.$.btnPassage.hide();
- this.$.main.setContent("<center>" + $L("You have no modules installed. Tap on the '+' to install one!" + "</center>"));
+ this.$.topTB.hide();
+ this.$.mainPanel.draggable = false;
+ this.$.mainPanel.setIndex(5);
}
} else {
this.handleError(inError);
@@ -213,6 +218,11 @@ enyo.kind({
this.$.spinner.start();
if (typeof passage === "string") {
+ //BibleZ currently supports only Book.Chapter Osis passages in the mainView
+ if(passage.split(".").length > 2) {
+ passage = passage.slice(0, passage.lastIndexOf("."));
+ }
+
this.currentPassage.osis = passage.replace(" ", ".");
this.currentPassage.label = passage.replace(".", " ");
}
@@ -339,14 +349,16 @@ enyo.kind({
},
handleChangeChapter: function (inSender, inEvent) {
- if(this.currentModule) {
- if(this.panelIndex === 1) {
- this.handlePassage(sword.verseKey.previous(this.currentPassage.osis, this.currentModule.config.Versification).osis);
- } else if(this.panelIndex === 3) {
- this.handlePassage(sword.verseKey.next(this.currentPassage.osis, this.currentModule.config.Versification).osis);
+ if(this.$.mainPanel.getIndex() !== 5) {
+ if(this.currentModule) {
+ if(this.panelIndex === 1) {
+ this.handlePassage(sword.verseKey.previous(this.currentPassage.osis, this.currentModule.config.Versification).osis);
+ } else if(this.panelIndex === 3) {
+ this.handlePassage(sword.verseKey.next(this.currentPassage.osis, this.currentModule.config.Versification).osis);
+ }
}
+ this.$.mainPanel.setIndexDirect(2);
}
- this.$.mainPanel.setIndexDirect(2);
},
handleVerseTap: function (inSender, inEvent) {
@@ -407,6 +419,8 @@ enyo.kind({
this.doOpenModuleManager();
else if(inEvent.originator.action === "preferences")
this.doOpenPreferences();
+ else
+ this.doOpenDataView({section: inEvent.originator.action});
},
handlePanelIndex: function (inSender, inEvent) {
diff --git a/source/package.js b/source/package.js
index 1ff7f76..42060fb 100644
--- a/source/package.js
+++ b/source/package.js
@@ -13,5 +13,6 @@ enyo.depends(
"popup.js",
"settings.js",
"notes.js",
+ "dataView.js",
"App.js"
);